1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00
LatAnalyze/examples/exMin.cpp
2014-10-14 16:36:20 +01:00

30 lines
631 B
C++

#include <iostream>
#include <LatAnalyze/CompiledFunction.hpp>
#include <LatAnalyze/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(1);
double min;
minimizer.setVerbosity(Minimizer::Verbosity::Debug);
min = minimizer(f)(0);
cout << "function minimum = " << min << endl;
return EXIT_SUCCESS;
}