aboutsummaryrefslogtreecommitdiffstats
path: root/interface/c_example.cc
blob: 0fb6d43a3672d4aa41ba694276cc97b3a2efa1cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "opt.h"
#include <iostream>
using namespace std;

double foo(const double* p)
{
  return p[0]*p[0]+(p[1]-1)*(p[1]-1);
}

int main()
{
  double p[2]={1000,1000};
  optimize_powell(foo,2,p,1e-40);
  optimize_powell(foo,2,p,1e-40);
  cout<<p[0]<<"\t"<<p[1]<<endl;
}