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:
@ -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
29
examples/exMin.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user