diff --git a/unsupported/Eigen/src/NonLinear/MathFunctions.h b/unsupported/Eigen/src/NonLinear/MathFunctions.h index 31d803b8c..b2c696b3f 100644 --- a/unsupported/Eigen/src/NonLinear/MathFunctions.h +++ b/unsupported/Eigen/src/NonLinear/MathFunctions.h @@ -27,22 +27,19 @@ #include -template +template // TODO : fixe Scalar here int ei_hybrd1( - VectorType &x, - VectorType &fvec, -// ei_traits::Scalar tol - double tol -// = ei_sqrt(machine_epsilon()) + Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, + Eigen::Matrix< double, Eigen::Dynamic, 1 > &fvec, + Scalar tol = Eigen::ei_sqrt(Eigen::machine_epsilon()) ) { - typedef typename VectorType::Scalar Scalar; int lwa = (x.size()*(3*x.size()+13))/2; - VectorType wa(lwa); + Eigen::Matrix< double, Eigen::Dynamic, 1 > wa(lwa); fvec.resize(x.size()); return hybrd1(Functor::f, 0, x.size(), x.data(), fvec.data(), tol, wa.data(), lwa); } - #endif // EIGEN_NONLINEAR_MATHFUNCTIONS_H + diff --git a/unsupported/test/NonLinear.cpp b/unsupported/test/NonLinear.cpp index d877ba375..18766757e 100644 --- a/unsupported/test/NonLinear.cpp +++ b/unsupported/test/NonLinear.cpp @@ -501,7 +501,7 @@ void testHybrd1() /* unless high solutions are required, */ /* this is the recommended setting. */ - info = ei_hybrd1(x, fvec, ei_sqrt(machine_epsilon())); + info = ei_hybrd1(x, fvec); // check return value VERIFY( 1 == info); @@ -510,7 +510,7 @@ void testHybrd1() VERIFY_IS_APPROX(fvec.norm(), 1.192636e-08); // check x - VectorXd x_ref; + VectorXd x_ref(n); x_ref << -0.5706545, -0.6816283, -0.7017325, -0.7042129, -0.701369, -0.6918656, -0.665792, -0.5960342, -0.4164121; VERIFY_IS_APPROX(x, x_ref); }