diff --git a/unsupported/Eigen/src/NonLinear/fdjac1.h b/unsupported/Eigen/src/NonLinear/fdjac1.h index 7c317df28..64c742ab7 100644 --- a/unsupported/Eigen/src/NonLinear/fdjac1.h +++ b/unsupported/Eigen/src/NonLinear/fdjac1.h @@ -6,9 +6,7 @@ int ei_fdjac1( Matrix< Scalar, Dynamic, 1 > &fvec, Matrix< Scalar, Dynamic, Dynamic > &fjac, int ml, int mu, - Scalar epsfcn, - Matrix< Scalar, Dynamic, 1 > &wa1, - Matrix< Scalar, Dynamic, 1 > &wa2) + Scalar epsfcn) { /* Local variables */ Scalar h; @@ -20,6 +18,9 @@ int ei_fdjac1( /* Function Body */ const Scalar epsmch = epsilon(); const int n = x.size(); + assert(fvec.size()==n); + Matrix< Scalar, Dynamic, 1 > wa1(n); + Matrix< Scalar, Dynamic, 1 > wa2(n); eps = ei_sqrt((std::max(epsfcn,epsmch))); msum = ml + mu + 1; diff --git a/unsupported/Eigen/src/NonLinear/fdjac2.h b/unsupported/Eigen/src/NonLinear/fdjac2.h index bc3a82106..8766a9566 100644 --- a/unsupported/Eigen/src/NonLinear/fdjac2.h +++ b/unsupported/Eigen/src/NonLinear/fdjac2.h @@ -5,8 +5,7 @@ int ei_fdjac2( Matrix< Scalar, Dynamic, 1 > &x, Matrix< Scalar, Dynamic, 1 > &fvec, Matrix< Scalar, Dynamic, Dynamic > &fjac, - Scalar epsfcn, - Matrix< Scalar, Dynamic, 1 > &wa) + Scalar epsfcn) { /* Local variables */ Scalar h, temp; @@ -16,6 +15,7 @@ int ei_fdjac2( const Scalar epsmch = epsilon(); const int n = x.size(); const Scalar eps = ei_sqrt((std::max(epsfcn,epsmch))); + Matrix< Scalar, Dynamic, 1 > wa(fvec.size()); for (int j = 0; j < n; ++j) { temp = x[j]; diff --git a/unsupported/Eigen/src/NonLinear/hybrd.h b/unsupported/Eigen/src/NonLinear/hybrd.h index ef310b5e1..dcabc8f72 100644 --- a/unsupported/Eigen/src/NonLinear/hybrd.h +++ b/unsupported/Eigen/src/NonLinear/hybrd.h @@ -93,7 +93,7 @@ int ei_hybrd( /* calculate the jacobian matrix. */ iflag = ei_fdjac1(Functor, x, fvec, fjac, - nb_of_subdiagonals, nb_of_superdiagonals, epsfcn, wa1, wa2); + nb_of_subdiagonals, nb_of_superdiagonals, epsfcn); nfev += msum; if (iflag < 0) break; diff --git a/unsupported/Eigen/src/NonLinear/lmdif.h b/unsupported/Eigen/src/NonLinear/lmdif.h index 3bf99e658..1a1c32e84 100644 --- a/unsupported/Eigen/src/NonLinear/lmdif.h +++ b/unsupported/Eigen/src/NonLinear/lmdif.h @@ -72,7 +72,7 @@ int ei_lmdif( /* calculate the jacobian matrix. */ - iflag = ei_fdjac2(Functor, x, fvec, fjac, epsfcn, wa4); + iflag = ei_fdjac2(Functor, x, fvec, fjac, epsfcn); nfev += n; if (iflag < 0) break;