From 3b2ea2fcbc7ea22506fd82015937a7f93d8dbc34 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Wed, 15 Feb 2012 15:39:13 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@221 ed2142bd-67ad-457f-ba7c-d818d4011675 --- interface/c_example.cc | 16 ++++++++++++++++ interface/fortran_example.f90 | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 interface/c_example.cc create mode 100644 interface/fortran_example.f90 diff --git a/interface/c_example.cc b/interface/c_example.cc new file mode 100644 index 0000000..0fb6d43 --- /dev/null +++ b/interface/c_example.cc @@ -0,0 +1,16 @@ +#include "opt.h" +#include +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<