Commit 51581e35 authored by Michael Zbyszyński's avatar Michael Zbyszyński
Browse files

everything working except PiPo

parent ec8b5aea
......@@ -2,11 +2,27 @@ cmake_minimum_required(VERSION 2.8.9)
project (rapidmix)
# The version number.
set (rapidmix_VERSION_MAJOR 1)
set (rapidmix_VERSION_MINOR 0)
set (rapidmix_VERSION_MAJOR 2)
set (rapidmix_VERSION_MINOR 2)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# Compiler Flags
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -DJSON_DEBUG -fPIC")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# Main lib
include_directories(${PROJECT_SOURCE_DIR}/src)
......@@ -19,37 +35,56 @@ include_directories(dependencies/Maximilian)
include_directories(dependencies/Maximilian/libs)
include_directories(dependencies/pipo/src/include)
include_directories(dependencies/pipo/src/host)
include_directories(dependencies/pipo/src/modules)
include_directories(dependencies/pipo/src/dependencies/rta)
#__cplusplus not defined problem with line below
#include_directories(dependencies/pipo/src/dependencies/rta/common)
# Third party dependencies
include_directories(dependencies/third_party/json)
# Source Files
file(GLOB_RECURSE RAPIDMIX_SRC "${PROJECT_SOURCE_DIR}/src/*.cpp")
file(GLOB GVF_SRC "${PROJECT_SOURCE_DIR}/dependencies/GVF/GVF.cpp")
# Maximilian
file(GLOB MAXI_SRC "${PROJECT_SOURCE_DIR}/dependencies/Maximilian/maximilian.cpp")
file(GLOB MAXI_SRC ${MAXI_SRC} "${PROJECT_SOURCE_DIR}/dependencies/Maximilian/libs/maxiFFT.cpp")
file(GLOB MAXI_SRC ${MAXI_SRC} "${PROJECT_SOURCE_DIR}/dependencies/Maximilian/libs/fft.cpp")
#PiPofile
file(GLOB_RECURSE PIPO_SRC "${PROJECT_SOURCE_DIR}/dependencies/pipo/src/*")
# RapidLib
file(GLOB RAPIDLIB_SRC "${PROJECT_SOURCE_DIR}/dependencies/RapidLib/src/*.cpp")
file(GLOB RAPIDLIB_DEP "${PROJECT_SOURCE_DIR}/dependencies/RapidLib/dependencies/libsvm/libsvm.cpp")
file(GLOB JSON_SRC "${PROJECT_SOURCE_DIR}/dependencies/third_party/jsoncpp.cpp")
# XMM
file(GLOB_RECURSE XMM_SRC "${PROJECT_SOURCE_DIR}/dependencies/xmm/src/*")
file(GLOB JSON_SRC "${PROJECT_SOURCE_DIR}/dependencies/third_party/jsoncpp.cpp")
#Set the source for the main library, using the groups defined above
# Set the source for the main library, using the groups defined above
set(RAPIDMIX_FULL_SRC ${RAPIDMIX_SRC}
${GVF_SRC}
${MAXI_SRC}
${MAXI_SRC}
# ${PIPO_SRC}
${RAPIDLIB_SRC}
${RAPIDLIB_DEP}
${XMM_SRC}
${JSON_SRC}
)
add_library(RMIX ${RAPIDMIX_FULL_SRC})
add_library(RAPID-MIX_API ${RAPIDMIX_FULL_SRC})
add_executable(rapidmix tests/rapidMixTest.cpp )
add_executable(rapidmixTest tests/rapidMixTest.cpp )
if (APPLE)
find_library(ACCELERATE Accelerate)
if (NOT ACCELERATE)
message(FATAL_ERROR "Accelearate not found")
endif()
target_link_libraries(rapidmix RMIX ${ACCELERATE})
target_link_libraries(rapidmixTest RAPID-MIX_API ${ACCELERATE})
else()
target_link_libraries(rapidmixTest RAPID-MIX_API)
endif()
......@@ -54,6 +54,64 @@ int main() {
assert(myNN.run(inputVec)[0] == 12.596715279688549);
std::cout << "staticRegression passed." << std::endl;
//////////////////////////////////////Test XMM
rapidmix::xmmConfig xcfg;
xcfg.relativeRegularization = 0.1;
rapidmix::trainingData myXmmData;
std::vector<double> myXmmInput;
std::vector<double> myXmmOutput;
myXmmData.startRecording("lab1");
myXmmInput = { 0.2, 0.7 };
myXmmData.addElement(myXmmInput, myXmmOutput);
myXmmData.stopRecording();
myXmmData.startRecording("lab2");
myXmmInput = { 0.8, 0.1 };
myXmmData.addElement(myXmmInput, myXmmOutput);
myXmmData.stopRecording();
myXmmData.writeJSON("/var/tmp/testTrainingData.json");
rapidmix::xmmStaticClassification myGmm(xcfg);
myGmm.train(myXmmData);
std::string filepath = "/var/tmp/modelSetDescription";
myGmm.writeJSON(filepath);
myXmmInput = { 0.2, 0.7 };
rapidmix::xmmStaticClassification myGmmFromFile;
myGmmFromFile.readJSON(filepath);
assert(myGmm.run(myXmmInput)[0] == myGmmFromFile.run(myXmmInput)[0]);
std::cout << "xmm passed." << std::endl;
/////////////////////////////////////Test pipo signal processing
//rapidmix::pipoHost host;
/////////////////////////////////////Test rapidStream signal processing
rapidmix::rapidStream myProcessor(5); //create a processor with a window size of 5
myProcessor.pushToWindow(0.246);
myProcessor.pushToWindow(0.44);
myProcessor.pushToWindow(-0.228);
myProcessor.pushToWindow(0.402);
myProcessor.pushToWindow(-0.382);
assert(myProcessor.maximum() == 0.44);
assert(myProcessor.minimum() == -0.382);
assert(myProcessor.sum() == 0.478);
assert(myProcessor.mean() == 0.09559999999999999);
assert(myProcessor.standardDeviation() == 0.33702557766436664);
assert(myProcessor.rms() == 0.3503221374677884);
std::cout << "rapidStream passed." << std::endl;
/////////////////////////////////////Test Maxi signal processing
rapidmix::FFT myFFT;
......@@ -65,7 +123,7 @@ int main() {
}
assert(myFFT.spectralCentroid() == 3520.84277f);
std::cout << "maxi fft passed" << std::endl;
std::cout << "maxi fft passed." << std::endl;
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment