2014-03-13 18:51:01 +00:00
|
|
|
#include <LatAnalyze/CompiledFunction.hpp>
|
2016-04-12 20:31:53 +01:00
|
|
|
#include <LatAnalyze/GslMinimizer.hpp>
|
2014-02-20 20:21:45 +00:00
|
|
|
|
|
|
|
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];
|
|
|
|
|
2016-04-12 20:31:53 +01:00
|
|
|
DoubleFunction f = compile(source, 1);
|
|
|
|
GslMinimizer minimize;
|
2015-02-24 17:00:19 +00:00
|
|
|
DVec init(1);
|
2014-02-20 20:21:45 +00:00
|
|
|
double min;
|
2015-02-24 17:00:19 +00:00
|
|
|
|
|
|
|
init(0) = 0.1;
|
|
|
|
minimize.setInit(init);
|
|
|
|
minimize.setVerbosity(Minimizer::Verbosity::Debug);
|
|
|
|
min = minimize(f)(0);
|
2014-02-20 20:21:45 +00:00
|
|
|
cout << "function minimum = " << min << endl;
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|