1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-06-20 08:16:55 +01:00

first minimiser implementation

This commit is contained in:
2014-02-20 20:21:45 +00:00
parent 242c3f4225
commit 5a3f6a6106
8 changed files with 384 additions and 2 deletions

View File

@ -18,6 +18,7 @@ noinst_PROGRAMS = \
exCompiledDoubleFunction\
exMat \
exMathInterpreter \
exMin \
exPlot \
exRand
@ -29,6 +30,10 @@ exMat_SOURCES = exMat.cpp
exMat_CFLAGS = -g -O2
exMat_LDFLAGS = -L../latan/.libs -llatan
exMin_SOURCES = exMin.cpp
exMin_CFLAGS = -g -O2
exMin_LDFLAGS = -L../latan/.libs -llatan
exMathInterpreter_SOURCES = exMathInterpreter.cpp
exMathInterpreter_CFLAGS = -g -O2
exMathInterpreter_LDFLAGS = -L../latan/.libs -llatan

29
examples/exMin.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
#include <latan/CompiledFunction.hpp>
#include <latan/MinuitMinimizer.hpp>
using namespace std;
using namespace Latan;
int main(int argc, char* argv[])
{
string source;
if (argc != 2)
{
cerr << "usage: " << argv[0] << " <function>" << endl;
return EXIT_FAILURE;
}
source = argv[1];
CompiledDoubleFunction f(1, source);
MinuitMinimizer minimizer;
double min;
minimizer.setVerbosity(Minimizer::Verbosity::Debug);
min = minimizer(f)(0);
cout << "function minimum = " << min << endl;
return EXIT_SUCCESS;
}