From 878f15b8a56ba1c19a6b44fbd5955ac702e46a06 Mon Sep 17 00:00:00 2001 From: Thomas Capricelli Date: Sun, 23 Aug 2009 04:06:16 +0200 Subject: * use eigen object for callbacks for hybrd and lmdif * use Functor instead of argument for ei_fdjac*() --- unsupported/test/NonLinear.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'unsupported/test/NonLinear.cpp') diff --git a/unsupported/test/NonLinear.cpp b/unsupported/test/NonLinear.cpp index 31b44e5e8..73d07b0bb 100644 --- a/unsupported/test/NonLinear.cpp +++ b/unsupported/test/NonLinear.cpp @@ -322,12 +322,15 @@ void testHybrj() } struct hybrd_functor { - static int f(int n, const double *x, double *fvec, int /*iflag*/) + static int f(const VectorXd &x, VectorXd &fvec, int /*iflag*/) { /* subroutine fcn for hybrd1 example. */ int k; double one=1, temp, temp1, temp2, three=3, two=2, zero=0; + const int n = x.size(); + + assert(fvec.size()==n); for (k=0; k < n; k++) { @@ -495,7 +498,7 @@ void testLmstr() } struct lmdif_functor { - static int f(int /*m*/, int /*n*/, const double *x, double *fvec, int /*iflag*/) + static int f(const VectorXd &x, VectorXd &fvec, int /*iflag*/) { /* function fcn for lmdif1 example */ @@ -504,6 +507,8 @@ struct lmdif_functor { double y[15]={1.4e-1,1.8e-1,2.2e-1,2.5e-1,2.9e-1,3.2e-1,3.5e-1,3.9e-1, 3.7e-1,5.8e-1,7.3e-1,9.6e-1,1.34e0,2.1e0,4.39e0}; + assert(x.size()==3); + assert(fvec.size()==15); for (i=0; i<15; i++) { tmp1 = i+1; -- cgit v1.2.3