Commit ecd54e79 authored by kra568's avatar kra568

FIX + ENH: fixed comparator of Multiindex class, fixed building scripts for windows + Visual Studio

parent 8f9b00ff
......@@ -9,14 +9,15 @@ win_1:
before_script:
- call VsDevCmd.bat
- call download_dependencies.bat
- cd external_dependencies\boost\
- call bootstrap.bat --with-serialization --with-random --with-system
- .\b2 --layout=system variant=release link=shared address-model=64
- cd ..\..
- cd build_scripts/windows
- call win_download_dependencies.bat
- cd ../../
script:
- 'call build-ci.bat'
- cd build_scripts/windows
- call win_VS_build_x64_debug.bat
- call win_run_tests.bat
- cd ../../
# Latest Ubuntu with Boost and Exprtk
# in system directories
......
cmake_minimum_required(VERSION 3.0)
project(lib4neuro)
ADD_DEFINITIONS("-DBOOST_ALL_NO_LIB")
#cmake_policy(SET CMP0074 NEW)
#cmake_policy(SET CMP0060 NEW)
......@@ -34,9 +37,9 @@ endif (NOT CMAKE_BUILD_TYPE)
# Setting C++ compiler flags #
#--------------------------------#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -mtune=native" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost" )
endif()
......@@ -54,13 +57,14 @@ message("Looking for external libraries...")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED COMPONENTS serialization random)
if(Boost_FOUND)
message("Boost INCLUDE DIR: ${Boost_INCLUDEDIR}")
message("Boost LIB DIR: ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIR} ${Boost_INCLUDEDIR} ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif()
set(Boost_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost)
set(Boost_LIBRARY_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost/stage/lib)
message("Boost INCLUDE DIR: ${Boost_INCLUDE_DIR}")
message("Boost LIB DIR: ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIR} ${Boost_INCLUDEDIR} ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS} ${LIB4NEURO_DIR})
find_package(exprtk)
......@@ -86,8 +90,11 @@ set(SRC_DIR src)
set(PROJECT_BINARY_DIR build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
include_directories(include ${SRC_DIR})
message(" Running CMake in: ${SRC_DIR} ${PROJECT_BINARY_DIR}")
add_subdirectory(${SRC_DIR} ${PROJECT_BINARY_DIR})
@echo off
title Build lib4neuro project
rem Build type (Release/Debug)
set BUILD_TYPE=Debug
rem C++ compiler
set CXX_COMPILER=cl
set C_COMPILER=cl
rem Makefile generator
rem For the complete list type "cmake --help"
rem Example: "MSYS Makefiles", "MinGW Makefiles", "NMake Makefiles"
set MAKEFILE_GENERATOR="Visual Studio 15 2017"
call clean.bat
cmake -G %MAKEFILE_GENERATOR% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBoost_DEBUG:BOOL=ON .
cmake --build . --config %BUILD_TYPE% && (echo "Build complete. For examples have a look at the folder build/bin/examples.") || (echo "Build finished with errors!")
@echo off
title Build lib4neuro project
rem Build type (Release/Debug)
set BUILD_TYPE=
rem C++ compiler
set CXX_COMPILER=cl
set C_COMPILER=cl
rem Makefile generator
rem For the complete list type "cmake --help"
rem Example: "MSYS Makefiles", "MinGW Makefiles", "NMake Makefiles"
set MAKEFILE_GENERATOR="Visual Studio 15 2017"
call clean.bat
cmake -G %MAKEFILE_GENERATOR% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBoost_DEBUG:BOOL=ON .
cmake --build . --config %BUILD_TYPE% && (echo (Build complete.); echo (For examples have a look at the folder build/bin/examples.)) || (echo "Build finished with errors!")
@echo off
title Building the 'lib4neuro' project for Debug
cls
set "REBUILD_BOOST="
set "BUILD_EXAMPLES="
set "BUILD_TESTS="
set "BUILD_LIB="
set "BUILD_SOMETHING="
set "BUILD_SOMETHING_LIB="
rem call VsDevCmd.bat
rem Should we rebuild BOOST? (yes/no)
set REBUILD_BOOST=yes
rem Should we build the examples? (yes/no)
set BUILD_EXAMPLES=yes
rem Should we build the unit-tests? (yes/no)
set BUILD_TESTS=yes
rem Should we build the lib4neuro library? (yes)
set BUILD_LIB=yes
rem **********************DO NOT CHANGE BEYOND THIS LINE****************************************
set BUILD_SOMETHING=no
set BUILD_SOMETHING_LIB=no
IF "%BUILD_LIB%"=="yes" (
echo Lib4neuro build type: Debug
echo Lib4neuro build architecture: x64
echo Lib4neuro will be built in 'build/lib/'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_TESTS%"=="yes" (
echo Lib4neuro unit tests will be built in 'build/unit-tests'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_EXAMPLES%"=="yes" (
echo Lib4neuro examples will be built in 'build/examples'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%REBUILD_BOOST%"=="yes" (
echo The required BOOST library will be recompiled in the directory 'external_dependencies/boost'
set BUILD_SOMETHING=yes
)
IF "%BUILD_SOMETHING%"=="yes" (
rem pause
)
rem Boost rebuild
IF "%REBUILD_BOOST%"=="yes" (
title Rebuilding 'BOOST' for Debug
cd ../../
rmdir /s /q external_dependencies\boost\stage 2>NUL
rmdir /s /q external_dependencies\boost\bin.v2 2>NUL
cd external_dependencies/boost
.\b2 --layout=system variant=debug link=static address-model=64 --with-system --with-serialization --with-random
cd ../../build_scripts/windows
)
IF "%BUILD_SOMETHING_LIB%"=="yes" (
IF "%BUILD_LIB%"=="yes" (
call win_clean_lib.bat
)
IF "%BUILD_EXAMPLES%"=="yes" (
call win_clean_examples.bat
)
IF "%BUILD_TESTS%"=="yes" (
call win_clean_tests.bat
)
title Building the 'lib4neuro' project for Debug (preparing makefiles)
rem C++ compiler (Requires Visual Studio 2017)
set CXX_COMPILER=cl
set C_COMPILER=cl
set MAKEFILE_GENERATOR="Visual Studio 15 2017 Win64"
cd ../../
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBUILD_TESTS=%BUILD_TESTS% -DBUILD_EXAMPLES=%BUILD_EXAMPLES% -DBUILD_LIB=%BUILD_LIB% -DLIB4NEURO_DIR=build\lib .
title Building the 'lib4neuro' project for Debug (building)
(cmake --build . --config Debug > build.log) && (echo "Build complete.") || (echo "Build finished with errors!")
cd build_scripts/windows
IF "%BUILD_LIB%"=="yes" (
cd ../../
rem Moving LIB files around to have a neater structure
xcopy /y build\bin\Debug\lib4neuro.dll build\lib 2>NUL
xcopy /y build\lib\Debug\lib4neuro.lib build\lib 2>NUL
rmdir /s /q "build\lib\Debug" 2> NUL
cd build_scripts/windows
)
IF "%BUILD_EXAMPLES%"=="yes" (
cd ../../
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\examples\bin\Debug\*.exe build\tmp 2>NUL
rmdir /s /q "build\examples" 2> NUL
mv build\tmp build\examples
xcopy /y build\lib\*.dll build\examples 2>NUL
cd build_scripts/windows
)
IF "%BUILD_TESTS%"=="yes" (
cd ../../
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\unit-tests\bin\Debug\*.exe build\tmp 2>NUL
rmdir /s /q "build\unit-tests" 2> NUL
mv build\tmp build\unit-tests
xcopy /y build\lib\*.dll build\unit-tests 2>NUL
cd build_scripts/windows
)
call win_clean_garbage.bat
)
@echo off
title Building the 'lib4neuro' project for Release
cls
set "REBUILD_BOOST="
set "BUILD_EXAMPLES="
set "BUILD_TESTS="
set "BUILD_LIB="
set "BUILD_SOMETHING="
set "BUILD_SOMETHING_LIB="
rem call VsDevCmd.bat
rem Should we rebuild BOOST? (yes/no)
set REBUILD_BOOST=no
rem Should we build the examples? (yes/no)
set BUILD_EXAMPLES=no
rem Should we build the unit-tests? (yes/no)
set BUILD_TESTS=no
rem Should we build the lib4neuro library? (yes)
set BUILD_LIB=no
rem **********************DO NOT CHANGE BEYOND THIS LINE****************************************
set BUILD_SOMETHING=no
set BUILD_SOMETHING_LIB=no
IF "%BUILD_LIB%"=="yes" (
echo Lib4neuro build type: Release
echo Lib4neuro build architecture: x64
echo Lib4neuro will be built in 'build/lib/'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_TESTS%"=="yes" (
echo Lib4neuro unit tests will be built in 'build/unit-tests'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_EXAMPLES%"=="yes" (
echo Lib4neuro examples will be built in 'build/examples'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%REBUILD_BOOST%"=="yes" (
echo The required BOOST library will be recompiled in the directory 'external_dependencies/boost'
set BUILD_SOMETHING=yes
)
IF "%BUILD_SOMETHING%"=="yes" (
rem pause
)
rem Boost rebuild
IF "%REBUILD_BOOST%"=="yes" (
title Rebuilding 'BOOST' for Release
cd ../../
rmdir /s /q external_dependencies\boost\stage 2>NUL
rmdir /s /q external_dependencies\boost\bin.v2 2>NUL
cd external_dependencies/boost
.\b2 --layout=system variant=release link=static address-model=64 --with-system --with-serialization --with-random
cd ../../build_scripts/windows
)
IF "%BUILD_SOMETHING_LIB%"=="yes" (
IF "%BUILD_LIB%"=="yes" (
call win_clean_lib.bat
)
IF "%BUILD_EXAMPLES%"=="yes" (
call win_clean_examples.bat
)
IF "%BUILD_TESTS%"=="yes" (
call win_clean_tests.bat
)
title Building the 'lib4neuro' project for Release (preparing makefiles)
rem C++ compiler (Requires Visual Studio 2017)
set CXX_COMPILER=cl
set C_COMPILER=cl
set MAKEFILE_GENERATOR="Visual Studio 15 2017 Win64"
cd ../../
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBUILD_TESTS=%BUILD_TESTS% -DBUILD_EXAMPLES=%BUILD_EXAMPLES% -DBUILD_LIB=%BUILD_LIB% -DLIB4NEURO_DIR=build\lib .
title Building the 'lib4neuro' project for Release (building)
(cmake --build . --config Release > build.log) && (echo "Build complete.") || (echo "Build finished with errors!")
cd build_scripts/windows
IF "%BUILD_LIB%"=="yes" (
cd ../../
rem Moving LIB files around to have a neater structure
xcopy /y build\bin\Release\lib4neuro.dll build\lib 2>NUL
xcopy /y build\lib\Release\lib4neuro.lib build\lib 2>NUL
rmdir /s /q "build\lib\Release" 2> NUL
cd build_scripts/windows
)
IF "%BUILD_EXAMPLES%"=="yes" (
cd ../../
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\examples\bin\Release\*.exe build\tmp 2>NUL
rmdir /s /q "build\examples" 2> NUL
mv build\tmp build\examples
xcopy /y build\lib\*.dll build\examples 2>NUL
cd build_scripts/windows
)
IF "%BUILD_TESTS%"=="yes" (
cd ../../
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\unit-tests\bin\Release\*.exe build\tmp 2>NUL
rmdir /s /q "build\unit-tests" 2> NUL
mv build\tmp build\unit-tests
xcopy /y build\lib\*.dll build\unit-tests 2>NUL
cd build_scripts/windows
)
call win_clean_garbage.bat
)
@echo off
title Cleaning up 'examples'
cd ../../
rmdir /s /q "build\examples" 2>NUL
cd build_scripts/windows
\ No newline at end of file
@echo off
title Cleaning up after the party!
cd ../../
rem Deleting unnecessary files
rmdir /s /q Debug 2>NUL
rmdir /s /q Release 2>NUL
rmdir /s /q Win32 2>NUL
rmdir /s /q x64 2>NUL
del "ALL_BUILD.vcxproj.user" 2>NUL
del "Makefile" 2>NUL
del /s /q "docs/*" 2>NUL
del "src/*TestRunner*" 2>NUL
del "src/*.o src/*.mod" 2>NUL
del "src/funit.tmp" 2>NUL
del "src/*_fun.f90" 2>NUL
del CMakeCache.txt 2>NUL
del "cmake_install.cmake" 2>NUL
del "src/cmake_install.cmake" 2>NUL
del /s /q CMakeFiles 2>NUL
del "*.vcxproj" 2>NUL
del "*.vcxproj.filters" 2>NUL
del "*.sln" 2>NUL
rmdir /s /q "CMakeFiles" 2>NUL
rmdir /s /q "src/CMakeFiles" 2>NUL
rmdir /s /q "src/examples/CMakeFiles" 2>NUL
rmdir /s /q "src/tests/CMakeFiles" 2>NUL
rmdir /s /q "build/CMakeFiles" 2>NUL
rmdir /s /q "build/lib4neuro.dir" 2>NUL
rmdir /s /q "build/libexprtk.dir" 2>NUL
rmdir /s /q "build/bin" 2>NUL
del /q "build\*vcxproj*" 2>NUL
del /q "build\*cmake*" 2>NUL
cd build_scripts/windows
\ No newline at end of file
@echo off
title Cleaning up 'lib4neuro'
cd ../../
rmdir /s /q "build\lib" 2>NUL
rmdir /s /q "build\bin\Debug" 2>NUL
rmdir /s /q "build\bin\Release" 2>NUL
cd build_scripts/windows
\ No newline at end of file
@echo off
title Cleaning up 'unit-tests'
cd ../../
rmdir /s /q "build\unit-tests" 2>NUL
cd build_scripts/windows
\ No newline at end of file
@echo off
title Downloading 'lib4neuro' project dependencies
cls
set "DOWNLOAD_DEP="
rem call VsDevCmd.bat
rem Should we download BOOST? (yes/no)
set DOWNLOAD_DEP=yes
IF "%DOWNLOAD_DEP%"=="yes" (
echo The required libraries will be downloaded from the official repositories into the directory 'external_dependencies'
rem pause
)
rem Dependencies download
IF "%DOWNLOAD_DEP%"=="yes" (
cd ../../
rmdir /s /q external_dependencies 2>NUL
git submodule init
git submodule update --remote
cd external_dependencies/boost
rem Submodules containing headers included in lib4neuro directly, but not required by serialization, system nor random
rem set BOOST_DEPENDENCIES_LIB4NEURO=libs/algorithm libs/range libs/concept_check libs/test libs/timer libs/exception
rem Submodules required by linked libraries serialization, system or random
rem set BOOST_DEPENDENCIES=libs/bind libs/container_hash libs/type_index libs/function libs/array libs/optional libs/integer libs/utility libs/move libs/detail libs/throw_exception tools/build libs/config libs/assert libs/predef libs/io libs/spirit libs/smart_ptr libs/static_assert libs/type_traits libs/mpl libs/core libs/preprocessor libs/iterator libs/winapi
rem Submodules required by lib4neuro
rem set BOOST_REQUIRED_LIBS=libs/serialization libs/system libs/random
rem echo Running 'submodule update --init %BOOST_DEPENDENCIES_LIB4NEURO% %BOOST_DEPENDENCIES% %BOOST_REQUIRED_LIBS%'
rem git submodule update --init libs/algorithm libs/exception libs/range libs/concept_check libs/test libs/timer libs/bind libs/container_hash libs/type_index libs/function libs/array libs/optional libs/integer libs/utility libs/move libs/detail libs/throw_exception tools/build libs/config libs/assert libs/predef libs/io libs/spirit libs/smart_ptr libs/static_assert libs/type_traits libs/mpl libs/core libs/preprocessor libs/iterator libs/winapi libs/serialization libs/system libs/random
git submodule update --init
call bootstrap.bat
cd ../../build_scripts/windows
)
@echo off
title Running 'lib4neuro' unit-tests
cd ../../build/unit-tests
rem Runs all the available Unit-Tests
for /r %%v in ("*_test.exe") do call %%v
cd ../../build_scripts/windows
\ No newline at end of file
@echo off
rmdir /s /q build 2>NUL
del Makefile 2>NUL
del /s /q "docs/*" 2>NUL
del "src/*TestRunner*" 2>NUL
del "src/*.o src/*.mod" 2>NUL
del src/funit.tmp 2>NUL
del "src/*_fun.f90" 2>NUL
del CMakeCache.txt 2>NUL
del cmake_install.cmake 2>NUL
del src/cmake_install.cmake 2>NUL
del /s /q CMakeFiles 2>NUL
del "*.vcxproj" 2>NUL
del "*.vcxproj.filters" 2>NUL
del "*.sln" 2>NUL
rmdir /s /q CMakeFiles 2>NUL
rmdir /s /q src/CMakeFiles 2>NUL
rmdir /s /q src/examples/CMakeFiles 2>NUL
rmdir /s /q src/tests/CMakeFiles 2>NUL
git submodule init
git submodule update
cd external_dependencies/boost
git submodule init
git submodule update
cd ../..
Subproject commit 222d227d546da6fab65af11267a296618cdbc103
Subproject commit 9a8474e7a259fa5348658a651cd19af216749674
add_subdirectory(tests bin/unit-tests)
add_subdirectory(examples bin/examples)
add_library(4neuro SHARED
Neuron/Neuron.cpp
Neuron/NeuronBinary.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
DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp
LearningMethods/ILearningMethods.h)
if ("${BUILD_TESTS}" STREQUAL "yes")
add_subdirectory(tests unit-tests)
endif ()
if ("${BUILD_EXAMPLES}" STREQUAL "yes")
add_subdirectory(examples examples)
endif ()
add_library(boost_unit_test SHARED boost_test_lib_dummy.cpp)
add_library(exprtk SHARED exprtk.cpp)
if ("${BUILD_LIB}" STREQUAL "yes")
add_library(lib4neuro SHARED
Neuron/Neuron.cpp
Neuron/NeuronBinary.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
DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp
LearningMethods/ILearningMethods.h
)
add_library(libexprtk STATIC exprtk.cpp)
target_link_libraries(lib4neuro libboost_serialization libboost_system libboost_random libexprtk)
endif ()
target_link_libraries(4neuro ${Boost_LIBRARIES} boost_unit_test exprtk)
......@@ -18,7 +18,7 @@
#include <boost/serialization/utility.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include "../settings.h"
/**
* Class representing an error caused by an incorrect
......@@ -92,13 +92,13 @@ public:
* Constructor reading data from the file
* @param file_path Path to the file with stored data set
*/
DataSet(std::string file_path);
LIB4NEURO_API DataSet(std::string file_path);
/**
* Constructor accepting data vector
* @param data_ptr Pointer to the vector containing data
*/
DataSet(std::vector<std::pair<std::vector<double>, std::vector<double>>>* data_ptr);
LIB4NEURO_API DataSet(std::vector<std::pair<std::vector<double>, std::vector<double>>>* data_ptr);
/**
* Creates a new data set with input values equidistantly positioned
......@@ -114,7 +114,7 @@ public:
* @param size Number of input-output pairs generated
* @param output Constant output value
*/
DataSet(double lower_bound, double upper_bound, unsigned int size, double output);
LIB4NEURO_API DataSet(double lower_bound, double upper_bound, unsigned int size, double output);
/**
*
......@@ -123,39 +123,39 @@ public:
* @param output_func
* @param output_dim
*/
DataSet(std::vector<double> &bounds, unsigned int no_elems_in_one_dim, std::vector<double> (*output_func)(std::vector<double>&), unsigned int output_dim);
LIB4NEURO_API DataSet(std::vector<double> &bounds, unsigned int no_elems_in_one_dim, std::vector<double> (*output_func)(std::vector<double>&), unsigned int output_dim);
/**
* Getter for number of elements
* @return Number of elements in the data set
*/
size_t get_n_elements();
LIB4NEURO_API size_t get_n_elements();
/**
* Returns the input dimension
* @return Input dimension
*/
size_t get_input_dim();
LIB4NEURO_API size_t get_input_dim();
/**
* Return the output dimension
* @return Output dimension
*/
size_t get_output_dim();
LIB4NEURO_API size_t get_output_dim();
/**
* Getter for the data structure
* @return Vector of data
*/
std::vector<std::pair<std::vector<double>, std::vector<double>>>* get_data();
LIB4NEURO_API std::vector<std::pair<std::vector<double>, std::vector<double>>>* get_data();
/**
* Adds a new pair of data to the data set
* @param inputs Vector of input data
* @param outputs Vector of output data corresponding to the input data
*/
void add_data_pair(std::vector<double> &inputs, std::vector<double> &outputs);
LIB4NEURO_API void add_data_pair(std::vector<double> &inputs, std::vector<double> &outputs);
//TODO expand method to generate multiple data types - chebyshev etc.
/**
......@@ -170,7 +170,7 @@ public:
* @param size Number of input-output pairs generated
* @param output Constant output value
*/
void add_isotropic_data(double lower_bound, double upper_bound, unsigned int size, double output);
LIB4NEURO_API void add_isotropic_data(double lower_bound, double upper_bound, unsigned int size, double output);
/**
* Adds a new data with input values equidistantly positioned
......@@ -184,19 +184,19 @@ public:
* @param size Number of input-output pairs generated
* @param output_func Function determining output value
*/
void add_isotropic_data(std::vector<double> &bounds, unsigned int no_elems_in_one_dim, std::vector<double> (*output_func)(std::vector<double>&));
LIB4NEURO_API void add_isotropic_data(std::vector<double> &bounds, unsigned int no_elems_in_one_dim, std::vector<double> (*output_func)(std::vector<double>&));
//TODO Chebyshev - ch. interpolation points, i-th point = cos(i*alpha) from 0 to pi
/**
* Prints the data set
*/
void print_data();
LIB4NEURO_API void print_data();
/**
* Stores the DataSet object to the binary file
*/
void store_text(std::string &file_path);
LIB4NEURO_API void store_text(std::string &file_path);
};
#endif //INC_4NEURO_DATASET_H
......@@ -5,6 +5,8 @@
#ifndef INC_4NEURO_ERRORFUNCTION_H
#define INC_4NEURO_ERRORFUNCTION_H