diff options
author | 2009-08-23 04:06:16 +0200 | |
---|---|---|
committer | 2009-08-23 04:06:16 +0200 | |
commit | 878f15b8a56ba1c19a6b44fbd5955ac702e46a06 (patch) | |
tree | 9309b3ef82515c8af58692ec6c7d44577688a4f5 /unsupported/test/NonLinear.cpp | |
parent | f2fcbb0207dc1cd3d76c8cffacf92af36ab858ba (diff) |
* use eigen object for callbacks for hybrd and lmdif
* use Functor instead of argument for ei_fdjac*()
Diffstat (limited to 'unsupported/test/NonLinear.cpp')
-rw-r--r-- | unsupported/test/NonLinear.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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; |