Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
matrix:
os: [ubuntu-latest] #, ubuntu-18.04] # TODO: Consider(!) supporting the previous version.
compiler: [gcc, clang]
options: ["", "--ffp"]
linkage: ["", "--shared", "--lto"]
steps:
- uses: actions/checkout@v1
Expand All @@ -38,8 +39,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache03-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.linkage }}-build-${{ github.sha }}
restore-keys: ccache03-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.linkage }}-build-
key: ccache03-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.linkage }}-${{ matrix.options }}-build-${{ github.sha }}
restore-keys: ccache03-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.linkage }}-${{ matrix.options }}-build-
# Less volatile cache
- name: data cache
uses: actions/cache@v2
Expand All @@ -62,9 +63,9 @@ jobs:
- name: build & install the unmanaged dependencies
run: util/deps-build.sh
- name: build
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt --build-r
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} ${{ matrix.options }} --unity --build-qt --build-r
- name: run demo
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt --build-r --run-demo
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} ${{ matrix.options }} --unity --build-qt --build-r --run-demo
# It doesn't make sense for now, since we're not linking Boost statically yet.
# - uses: actions/upload-artifact@v2
# if: ${{ matrix.compiler == 'gcc' && matrix.linkage == '--lto' }}
Expand All @@ -75,6 +76,42 @@ jobs:
# TODO: All the unmaintained denendencies should have their own CMakeLists.txt file (URT. Others?) and the util/deps-build.sh should not be used, if possible.
# TODO: All the testing should be done in a separate job, AFTER building and downloading resources, in order to use caches better (short and easy. Needs to have the build scripts restructured - separate building and testing)

# Performance tests:
perf-ubuntu:
runs-on: ${{ matrix.os }}
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
strategy:
fail-fast: false
# max-parallel: 1 # Single threaded for now, because the jobs overwrite each other's data/bin/* files?
matrix:
os: [ubuntu-latest] #, ubuntu-18.04] # TODO: Consider(!) supporting the previous version.
compiler: [gcc, clang]
options: ["", "--ffp"]
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
# Less volatile cache
- name: data cache
uses: actions/cache@v2
with:
path: build/data/data/txt
key: data-${{ hashFiles('build/data/data/txt/**/*') }}
restore-keys: data-${{ hashFiles('build/data/data/txt/**/*') }}
- name: prepare environment
run: util/prep-env.sh
- name: set apt conf
run: ${{env.APT_SET_CONF}}
- name: install dependencies
run: util/deps-pull.sh
- name: build & install the unmanaged dependencies
run: util/deps-build.sh
- name: build
run: ./ci-default --compiler ${{ matrix.compiler }} --lto -j 1 ${{ matrix.options }} --native --unity --build-qt --build-r
- name: run demo
run: ./ci-default --compiler ${{ matrix.compiler }} --lto -j 1 ${{ matrix.options }} --native --unity --build-qt --build-r --run-demo

build-macos:
runs-on: ${{ matrix.os }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
*.app

# Own
./build*
build/*
2 changes: 1 addition & 1 deletion externals/EnjoLib
Submodule EnjoLib updated 44 files
+23 −0 .github/workflows/build.yml
+3 −1 CMakeLists.txt
+1 −1 cmake/util.cmake
+3 −0 lib/CMakeLists.txt
+2 −1 lib/ML/DataSets.cpp
+2 −0 lib/ML/DataSets.hpp
+4 −4 lib/Math/Burkardt/MonicPoly.cpp
+2 −2 lib/Math/Burkardt/MonicPoly.hpp
+35 −35 lib/Math/Burkardt/NelderMeadBurkardt.cpp
+3 −2 lib/Math/Burkardt/NelderMeadBurkardt.hpp
+4 −4 lib/Math/Burkardt/Poly.cpp
+2 −2 lib/Math/Burkardt/Poly.hpp
+1 −0 lib/Math/FP.cpp
+14 −0 lib/Math/FP.hpp
+7 −7 lib/Math/Opti/OptiMultiBinSearch.cpp
+3 −3 lib/Math/Opti/OptiMultiBinSearch.hpp
+8 −8 lib/Math/Opti/OptiMultiNelderMead.cpp
+1 −1 lib/Math/Opti/OptiMultiNelderMead.hpp
+1 −1 lib/Math/Opti/OptiMultiSubject.hpp
+16 −16 lib/Statistical/Distrib.cpp
+1 −1 lib/Statistical/Distrib.hpp
+3 −3 lib/Statistical/PCA.cpp
+17 −0 lib/Statistical/VectorF.cpp
+3 −0 lib/Statistical/VectorF.hpp
+68 −48 lib/Util/VecD.cpp
+56 −50 lib/Util/VecD.hpp
+3 −3 libStat3rd/Statistical/3rdParty/FFT.cpp
+7 −6 libStat3rd/Statistical/3rdParty/Wavelet.cpp
+22 −0 tests/EnjoLibAnimTest/CMakeLists.txt
+105 −0 tests/EnjoLibAnimTest/src/AnimationTest.cpp
+22 −0 tests/EnjoLibAnimTest/src/AnimationTest.h
+22 −0 tests/EnjoLibAnimTest/src/main.cpp
+22 −0 tests/EnjoLibPerfTest/CMakeLists.txt
+77 −0 tests/EnjoLibPerfTest/src/PcaTest.cpp
+24 −0 tests/EnjoLibPerfTest/src/PcaTest.h
+22 −0 tests/EnjoLibPerfTest/src/main.cpp
+1 −1 tests/EnjoLibTest/src/OptiMultiRosenbrok.cpp
+9 −7 tests/EnjoLibTest/src/OptiMultiRosenbrok.h
+4 −4 tests/EnjoLibTest/src/Rosenbrok.cpp
+2 −1 tests/EnjoLibTest/src/Rosenbrok.h
+1 −1 tests/EnjoLibUTest/src/TestAlgoSTD.cpp
+3 −3 tests/EnjoLibUTest/src/TestPCA.cpp
+2 −3 tests/EnjoLibUTest/src/TestStatistical.cpp
+2 −1 util/ci-gcc.sh
16 changes: 8 additions & 8 deletions src/lib-base/src/BufferDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ BufferDouble::~BufferDouble()
//dtor
}

double BufferDouble::operator[](unsigned i) const
EnjoLib::FP BufferDouble::operator[](unsigned i) const
{
//return (*m_buf)[i];
return BufferTpl<double>(m_data.Data(), m_name.c_str())[i];
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str())[i];
}

unsigned BufferDouble::ConvertIndex(unsigned i) const
{
//return (*m_buf).ConvertIndex(i);
return BufferTpl<double>(m_data.Data(), m_name.c_str()).ConvertIndex(i);
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str()).ConvertIndex(i);
}

double BufferDouble::operator[](const State & st) const
EnjoLib::FP BufferDouble::operator[](const State & st) const
{
return BufferTpl<double>(m_data.Data(), m_name.c_str())[st];
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str())[st];
}

EnjoLib::VecD BufferDouble::GetAfter(unsigned iFrom, unsigned num) const
{
return BufferTpl<double>(m_data.Data(), m_name.c_str()).GetAfter(iFrom, num);
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str()).GetAfter(iFrom, num);
}

EnjoLib::VecD BufferDouble::GetBefore(unsigned iUntil, unsigned num) const
{
return BufferTpl<double>(m_data.Data(), m_name.c_str()).GetBefore(iUntil, num);
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str()).GetBefore(iUntil, num);
}

const EnjoLib::VecD & BufferDouble::GetData() const
Expand All @@ -47,5 +47,5 @@ const EnjoLib::VecD & BufferDouble::GetData() const

int BufferDouble::Len() const
{
return BufferTpl<double>(m_data.Data(), m_name.c_str()).Len();
return BufferTpl<EnjoLib::FP>(m_data.Data(), m_name.c_str()).Len();
}
4 changes: 2 additions & 2 deletions src/lib-base/src/BufferDouble.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class BufferDouble
virtual ~BufferDouble();

// From BufferTpl
double operator[](unsigned i) const;
double operator[](const State & st) const;
EnjoLib::FP operator[](unsigned i) const;
EnjoLib::FP operator[](const State & st) const;
EnjoLib::VecD GetBefore(unsigned iUntil, unsigned num) const;
EnjoLib::VecD GetAfter(unsigned iFrom, unsigned num) const;
//STDFWD::vector<T> GetMiddle(unsigned i, unsigned num) const;
Expand Down
6 changes: 3 additions & 3 deletions src/lib-base/src/DTWDistCompDTW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ using namespace EnjoLib;
DTWDistCompDTW::DTWDistCompDTW(const EnjoLib::VecD & obsNew)
//const int size = obsNew.size();
//const int tol = size / 10; // we use the DTW with a tolerance of 10% (size/10)
: m_filter(obsNew.Data(), obsNew.size()/10)
: m_filter(obsNew.ToVecDouble(), obsNew.size()/10)
{
}

DTWDistCompDTW::~DTWDistCompDTW(){}

double DTWDistCompDTW::Compare(const EnjoLib::VecD & obsVec) const
{
double newbest = m_filter.test(obsVec.Data());
double newbest = m_filter.test(obsVec.ToVecDouble());
return newbest;
}

Expand All @@ -25,4 +25,4 @@ double DTWDistCompKNN::Compare(const EnjoLib::VecD & obsVec) const
{
double newbest = Statistical().RMSTwo(obsNew, obsVec);
return newbest;
}
}
4 changes: 2 additions & 2 deletions src/lib-base/src/GnuplotIOSWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void GnuplotIOSWrap::Add1d(const EnjoLib::VecD & data)
}

///SetupXY()
void GnuplotIOSWrap::Add2d(const EnjoLib::Array<EnjoLib::Pair<double, double>> & data)
void GnuplotIOSWrap::Add2d(const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & data)
{
std::vector<std::tuple<double, double>> dataTuple;
for (const auto & par : data)
Expand Down Expand Up @@ -98,7 +98,7 @@ void GnuplotPlotTerminal1d(const EnjoLib::VecD & data, const EnjoLib::Str & desc
plot.Add1d(data);
}

void GnuplotPlotTerminal2d(const EnjoLib::Array<EnjoLib::Pair<double, double>> & data, const EnjoLib::Str & descr, float scaleX, float scaleY)
void GnuplotPlotTerminal2d(const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & data, const EnjoLib::Str & descr, float scaleX, float scaleY)
{
if (not descr.empty())
{
Expand Down
4 changes: 2 additions & 2 deletions src/lib-base/src/GnuplotIOSWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GnuplotIOSWrap
void SetZeroMin(double valMax);
void SetZeroMin();
void Add1d(const EnjoLib::VecD & data);
void Add2d(const EnjoLib::Array<EnjoLib::Pair<double, double>> & data);
void Add2d(const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & data);

const static int TERMINAL_W;
const static int TERMINAL_H;
Expand All @@ -39,7 +39,7 @@ class GnuplotIOSWrap

};
void GnuplotPlotTerminal1d(const EnjoLib::VecD & data, const EnjoLib::Str & descr = "", float scaleX = 1, float scaleY = 1);
void GnuplotPlotTerminal2d(const EnjoLib::Array<EnjoLib::Pair<double, double>> & data, const EnjoLib::Str & descr = "", float scaleX = 1, float scaleY = 1);
void GnuplotPlotTerminal2d(const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & data, const EnjoLib::Str & descr = "", float scaleX = 1, float scaleY = 1);
void GnuplotPlotTerminal1dSubplots(const EnjoLib::Array<const EnjoLib::VecD *> & data, const EnjoLib::Str & descr = "", float scaleX = 1, float scaleY = 1);

#endif // GNUPLOTIOSWRAP_H
2 changes: 1 addition & 1 deletion src/lib-base/src/MatplotACF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void MatplotACF::Plot(const EnjoLib::VecD & dat, int lags, int periodSeasonal, c
ofs << line << Nl;
}
VecD reversed = dat;
AlgoSTDIVec<double>().Reverse(&reversed);
AlgoSTDIVec<FP>().Reverse(&reversed);
//ofs << dat.PrintPython("dat") << Nl;
ofs << reversed.PrintPython("dat") << Nl;
ofs << "plotACF(dat, " << lags << ", '" << title << "')" << Nl;
Expand Down
2 changes: 1 addition & 1 deletion src/lib-base/src/OptiSubjectTSUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OptiSubjectTSUtil::~OptiSubjectTSUtil()
{
}

double OptiSubjectTSUtil::UpdateOptiGetPenality(const double * inp, int n, const EnjoLib::VecD & iterData, IOptimizable * opti) const
double OptiSubjectTSUtil::UpdateOptiGetPenality(const EnjoLib::FP * inp, int n, const EnjoLib::VecD & iterData, IOptimizable * opti) const
{
EnjoLib::Array<OptiVarF *> vopti = opti->GetOptiFloat().Vec();
//OptiVarF * varReal = FindVarCurrent(strat, iVar);
Expand Down
2 changes: 1 addition & 1 deletion src/lib-base/src/OptiSubjectTSUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class OptiSubjectTSUtil
OptiSubjectTSUtil();
virtual ~OptiSubjectTSUtil();

double UpdateOptiGetPenality(const double * in, int n, const EnjoLib::VecD & iterData, IOptimizable * opti) const;
double UpdateOptiGetPenality(const EnjoLib::FP * in, int n, const EnjoLib::VecD & iterData, IOptimizable * opti) const;

EnjoLib::VecD GetStartProt(const STDFWD::vector<OptiVarF> & optiVec) const;
EnjoLib::VecD GetStepProt(const STDFWD::vector<OptiVarF> & optiVec) const;
Expand Down
4 changes: 3 additions & 1 deletion src/lib-base/src/RWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#endif //USE_R

#include <cstring>
#include <STD/VectorCpp.hpp>

RWrapper::RWrapper()
{
Expand All @@ -21,8 +22,9 @@ RWrapper::~RWrapper()
/**
* Wrapper for R function predict, defined in func.R.
*/
EnjoLib::VecD RWrapper::R_predictVec(const EnjoLib::VecD & vec)
EnjoLib::VecD RWrapper::R_predictVec(const EnjoLib::VecD & vecd)
{
const std::vector<double> vec = vecd.ToVecDouble();
EnjoLib::VecD retVec;
#ifdef USE_R
const double * a = vec.data();
Expand Down
14 changes: 7 additions & 7 deletions src/lib-base/src/RegressionPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RegressionPoints::~RegressionPoints(){}
float RegressionPoints::GetPoints() const
{
float error = 0;
const Array<EnjoLib::Pair<double, double>> & data = GetDistrib();
const Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & data = GetDistrib();
for (unsigned i = 0; i < data.size(); ++i)
{
const double x = data.at(i).first;
Expand Down Expand Up @@ -130,14 +130,14 @@ void RegressionPoints::Finish()
m_distributionOut.atw(i) = m_distributionIn.at(i) * mul;
}

EnjoLib::Array<EnjoLib::Pair<double, double>> RegressionPoints::GetDistrib() const
EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> RegressionPoints::GetDistrib() const
{
std::vector<EnjoLib::Pair<double, double>> data;
std::vector<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> data;
for (unsigned i = 0; i < m_distributionOut.size(); ++i)
{
double moved = i - (m_numBins / 2.0 - 1);
double scaleFactor = 2.5 / m_numBins;
double scaledX = moved * scaleFactor;
EnjoLib::FP scaledX = moved * scaleFactor;
data.push_back(EnjoLib::MakePair(scaledX, m_distributionOut.at(i)));
}
return data;
Expand All @@ -146,7 +146,7 @@ EnjoLib::Array<EnjoLib::Pair<double, double>> RegressionPoints::GetDistrib() con
// Wykrywac wszystkie mody powyzej 0.35
float RegressionPoints::GetMedian() const
{
const EnjoLib::Array<EnjoLib::Pair<double, double>> & distrib = GetDistrib();
const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & distrib = GetDistrib();
double maxArg = -1;
double maxVal = -1;
for (int i = 0; i < int(distrib.size()); ++i)
Expand All @@ -166,8 +166,8 @@ float RegressionPoints::GetMedian() const
/// TODO: Upstream ?
float RegressionPoints::GetDistribDiff(const RegressionPoints & other) const
{
const EnjoLib::Array<EnjoLib::Pair<double, double>> & distrib1 = GetDistrib();
const EnjoLib::Array<EnjoLib::Pair<double, double>> & distrib2 = other.GetDistrib();
const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & distrib1 = GetDistrib();
const EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> & distrib2 = other.GetDistrib();

double sum = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/lib-base/src/RegressionPoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RegressionPoints

private:
double GetNormalDistrib(double x) const;
EnjoLib::Array<EnjoLib::Pair<double, double>> GetDistrib() const;
EnjoLib::Array<EnjoLib::Pair<EnjoLib::FP, EnjoLib::FP>> GetDistrib() const;

static const int m_numBins;

Expand Down
2 changes: 1 addition & 1 deletion src/lib-base/src/StatsMedianSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ StatsMedianSplit::Results StatsMedianSplit::CalcResults(const EnjoLib::VecD & ve
const Statistical stat;
const VecD & vecNoZeros = stat.RemoveLeadingZeroes(vecWZeros);

const vector<vector<double>> & dataSplit = VecOp().Split(vecNoZeros.Data(), numRanges);
const vector<vector<EnjoLib::FP>> & dataSplit = VecOp().Split(vecNoZeros.Data(), numRanges);

std::future<double> fut;
if (m_multiThreaded)
Expand Down
2 changes: 1 addition & 1 deletion src/tsqsim-lib/src/OptiSubjectPred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ OptiSubjectPred::~OptiSubjectPred()
//dtor
}

double OptiSubjectPred::Get(const double * inp, int n)
EnjoLib::FP OptiSubjectPred::Get(const EnjoLib::FP * inp, int n)
{
CorPtr<IPredictor> fun = m_fact.Create(m_period, m_type);
IPredictor & strat = *(fun.get());
Expand Down
2 changes: 1 addition & 1 deletion src/tsqsim-lib/src/OptiSubjectPred.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OptiSubjectPred : public IOptiSubject

double GetGoal() const;

double Get(const double * in, int n) override;
EnjoLib::FP Get(const EnjoLib::FP * in, int n) override;
EnjoLib::VecD GetStart() const override;
EnjoLib::VecD GetStep() const override;
EnjoLib::Array<EnjoLib::OptiMultiSubject::Bounds> GetBounds() const override;
Expand Down
5 changes: 5 additions & 0 deletions util/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--shared', default=False, action='store_true', help="build shared libraries (default: OFF)")
parser.add_argument('-l', '--lto', default=False, action='store_true', help="link time optimization (Release case; default: OFF)")
parser.add_argument('-f', '--ffp', default=False, action='store_true', help="faster, but less precise floating point (default: OFF)")
parser.add_argument('-n', '--native', default=False, action='store_true', help="native build (default: OFF)")
parser.add_argument('-d', '--debug', default=False, action='store_true', help="build debug (default: OFF)")
parser.add_argument('-p', '--pch', default=False, action='store_true', help="build pch (Dev case; default: OFF)")
parser.add_argument('-u', '--unity', default=False, action='store_true', help="build unity (CI case; default: OFF)")
Expand Down Expand Up @@ -126,6 +128,9 @@ def build(args):
cmd += NL + '-DUSE_DEBUG={}' .format(ON if args.debug else OFF)
cmd += NL + '-DUSE_UNITY={}' .format(ON if args.unity else OFF)
cmd += NL + '-DUSE_PCH={}' .format(ON if args.pch else OFF)
cmd += NL + '-DUSE_FLOATING_POINT_LOW_PRECISION={}'.format(ON if args.ffp else OFF)
cmd += NL + '-DUSE_OPTI_NATIVE={}' .format(ON if args.native else OFF)
cmd += NL + '-DUSE_OPTI_GENERIC={}'.format(OFF if args.native else ON)
cmd += NL + '-DBUILD_QT={}' .format(ON if args.build_qt else OFF) # Optional
cmd += NL + '-DBUILD_WX={}' .format(OFF if args.no_wx else ON ) # Optional
cmd += NL + '-DBUILD_TESTS={}'.format(OFF if args.no_tests else ON ) # Optional
Expand Down