Skip to content
Snippets Groups Projects
Commit 9dcd59ad authored by Michal Kravcenko's avatar Michal Kravcenko
Browse files

FIX: desolver

parent f8732f03
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ BUILD_EXAMPLES=yes
BUILD_TESTS=yes
# Should we rebuild BOOST? (yes/no)
REBUILD_BOOST=yes
REBUILD_BOOST=no
# Should we build the lib4neuro library? (yes)
BUILD_LIB=yes
......@@ -23,13 +23,13 @@ C_COMPILER="gcc"
#**********************DO NOT CHANGE BEYOND THIS LINE****************************************
export LINK_TYPE=static
if [ ${DEPENDENCIES_LINK_TYPE} = "shared" ]
if [ $DEPENDENCIES_LINK_TYPE = "shared" ]
then
export LINK_TYPE=shared
fi
CLEAN_AF=yes
if [ ${CLEAN_AFTER} = "no" ]
if [ $CLEAN_AFTER = "no" ]
then
CLEAN_AF=no
fi
......
......@@ -22,11 +22,17 @@ C_COMPILER="gcc"
#**********************DO NOT CHANGE BEYOND THIS LINE****************************************
LINK_TYPE=static
if [ ${DEPENDENCIES_LINK_TYPE} = "shared" ]
if [ $DEPENDENCIES_LINK_TYPE = "shared" ]
then
LINK_TYPE=shared
fi
CLEAN_AF=yes
if [ $CLEAN_AFTER = "no" ]
then
CLEAN_AF=no
fi
BUILD_ERROR_OCCURED=0
RED='\033[0;31m'
......@@ -103,6 +109,8 @@ then
fi
if [ ${CLEAN_AF} = "yes" ]
then
if [ $BUILD_LIB = "yes" ]
then
./linux_clean_after_lib.sh
......@@ -122,6 +130,7 @@ if [ $BUILD_SOMETHING_LIB = "yes" ]
then
./linux_clean_garbage.sh
fi
fi
if [ $BUILD_ERROR_OCCURED = "1" ]
......
......@@ -127,7 +127,7 @@ IF "%CLEAN_AF%"=="yes" IF "%BUILD_LIB%"=="yes" call win_clean_after_lib.bat
IF "%CLEAN_AF%"=="yes" IF "%BUILD_EXAMPLES%"=="yes" call win_clean_after_examples.bat
IF "%CLEAN_AF%"=="yes" IF "%BUILD_TESTS%"=="yes" call win_clean_after_tests.bat
IF "%CLEAN_AF%"=="yes" IF "%BUILD_SOMETHING_LIB%"=="yes" call win_clean_garbage.bat
rem exit 1
exit 1
:final_goto
......
......@@ -7,21 +7,24 @@ if ("${BUILD_EXAMPLES}" STREQUAL "yes")
endif ()
if ("${BUILD_LIB}" STREQUAL "yes")
add_library(
exprtk_wrap
SHARED
General/ExprtkWrapper.cpp
)
add_library(
exprtk_wrap
STATIC
General/ExprtkWrapper.cpp
)
target_include_directories(
exprtk_wrap
target_include_directories(
exprtk_wrap
PRIVATE
${EXPRTK_INCLUDE_DIR}
PRIVATE
${EXPRTK_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
)
target_compile_options(
exprtk_wrap PRIVATE -fPIC
)
target_link_libraries(
exprtk_wrap
......@@ -33,15 +36,15 @@ if ("${BUILD_LIB}" STREQUAL "yes")
add_library(lib4neuro SHARED
Neuron/Neuron.cpp
Neuron/NeuronBinary.cpp
Neuron/NeuronConstant.cpp
Neuron/NeuronConstant.cpp
Neuron/NeuronLinear.cpp
Neuron/NeuronLogistic.cpp
Network/NeuralNetwork.cpp
Network/NeuralNetworkSum.cpp
NetConnection/ConnectionFunctionGeneral.cpp
NetConnection/ConnectionFunctionIdentity.cpp
LearningMethods/ParticleSwarm.cpp
LearningMethods/GradientDescent.cpp
LearningMethods/ParticleSwarm.cpp
LearningMethods/GradientDescent.cpp
DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp
......
......@@ -21,6 +21,8 @@ ExprtkWrapper::ExprtkWrapper() {
ExprtkWrapper::ExprtkWrapper( std::string expression_string ) {
this->p_impl = new ExprtkWrapperImpl();
this->p_impl->expression_str = expression_string;
this->p_impl->symbol_table = new symbol_table_t( );
......@@ -56,6 +58,9 @@ ExprtkWrapper::~ExprtkWrapper() {
this->p_impl->parser = nullptr;
}
delete this->p_impl;
this->p_impl = nullptr;
}
double ExprtkWrapper::eval(double x1, double x2, double x3, double x4) {
......@@ -65,7 +70,8 @@ double ExprtkWrapper::eval(double x1, double x2, double x3, double x4) {
this->p_impl->z = x3;
this->p_impl->t = x4;
return this->p_impl->expression->value();
return this->p_impl->expression->value( );
}
double ExprtkWrapper::eval(std::vector<double> &p) {
......
......@@ -66,7 +66,7 @@ private:
* to isolate Exprtk dependency from header
*/
class ExprtkWrapperImpl;
std::unique_ptr<ExprtkWrapperImpl> p_impl;
ExprtkWrapperImpl *p_impl;
};
......
......@@ -5,6 +5,7 @@
* @date 22.7.18 -
*/
#include <string>
#include "DESolver.h"
//TODO add support for multiple unknown functions
......@@ -192,6 +193,7 @@ void DESolver::add_to_differential_equation( size_t equation_idx, MultiIndex &al
throw std::invalid_argument("The supplied multi-index represents partial derivative of order higher than 2! (Valid degree is at most 2)\n");
}
/* retrieve indices of the variables according to which we perform the derivations ( applicable to any order, not just 2 or less )*/
std::vector<size_t> partial_derivative_indices;
partial_derivative_indices.reserve(derivative_degree);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment