diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2013-02-02 22:04:42 +0000 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2013-02-02 22:04:42 +0000 |
commit | 14e2ab02b58ba07e2be6b003bc178a0ec5e1015b (patch) | |
tree | dcddfd386dd5b428beaee6ef14803b4eb00de212 /unsupported/Eigen/src/NonLinearOptimization | |
parent | 35647b01334370d0ddfd5d2d3376d4200947b007 (diff) |
Replace assert() by eigen_assert() (fixes bug #548).
Diffstat (limited to 'unsupported/Eigen/src/NonLinearOptimization')
8 files changed, 22 insertions, 22 deletions
diff --git a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h index b190827b3..5b24b4619 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +++ b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h @@ -150,7 +150,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveInit(FVectorType &x) fjac.resize(n, n); if (!useExternalScaling) diag.resize(n); - assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); + eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); /* Function Body */ nfev = 0; @@ -187,7 +187,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x) { using std::abs; - assert(x.size()==n); // check the caller is not cheating us + eigen_assert(x.size()==n); // check the caller is not cheating us Index j; std::vector<JacobiRotation<Scalar> > v_givens(n), w_givens(n); @@ -390,7 +390,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffInit(FVectorType & fvec.resize(n); if (!useExternalScaling) diag.resize(n); - assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); + eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); /* Function Body */ nfev = 0; diff --git a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h index 4b1a2d0fb..3d0a9c8fc 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +++ b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h @@ -172,7 +172,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeInit(FVectorType &x) fjac.resize(m, n); if (!useExternalScaling) diag.resize(n); - assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); + eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); qtf.resize(n); /* Function Body */ @@ -209,7 +209,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x) using std::abs; using std::sqrt; - assert(x.size()==n); // check the caller is not cheating us + eigen_assert(x.size()==n); // check the caller is not cheating us /* calculate the jacobian matrix. */ Index df_ret = functor.df(x, fjac); @@ -391,7 +391,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageInit(FVectorType fjac.resize(n, n); if (!useExternalScaling) diag.resize(n); - assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); + eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'"); qtf.resize(n); /* Function Body */ @@ -429,7 +429,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp using std::abs; using std::sqrt; - assert(x.size()==n); // check the caller is not cheating us + eigen_assert(x.size()==n); // check the caller is not cheating us Index i, j; bool sing; diff --git a/unsupported/Eigen/src/NonLinearOptimization/covar.h b/unsupported/Eigen/src/NonLinearOptimization/covar.h index c2fb79441..68260d191 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/covar.h +++ b/unsupported/Eigen/src/NonLinearOptimization/covar.h @@ -20,7 +20,7 @@ void covar( const Index n = r.cols(); const Scalar tolr = tol * abs(r(0,0)); Matrix< Scalar, Dynamic, 1 > wa(n); - assert(ipvt.size()==n); + eigen_assert(ipvt.size()==n); /* form the inverse of r in the full upper triangle of r. */ l = -1; diff --git a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h index 57dbc8bfb..4210958e7 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h +++ b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h @@ -24,9 +24,9 @@ void dogleg( /* Function Body */ const Scalar epsmch = NumTraits<Scalar>::epsilon(); const Index n = qrfac.cols(); - assert(n==qtb.size()); - assert(n==x.size()); - assert(n==diag.size()); + eigen_assert(n==qtb.size()); + eigen_assert(n==x.size()); + eigen_assert(n==diag.size()); Matrix< Scalar, Dynamic, 1 > wa1(n), wa2(n); /* first, calculate the gauss-newton direction. */ diff --git a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h index 05947936e..bb7cf267b 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h +++ b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h @@ -27,7 +27,7 @@ DenseIndex fdjac1( /* Function Body */ const Scalar epsmch = NumTraits<Scalar>::epsilon(); const Index n = x.size(); - assert(fvec.size()==n); + eigen_assert(fvec.size()==n); Matrix< Scalar, Dynamic, 1 > wa1(n); Matrix< Scalar, Dynamic, 1 > wa2(n); diff --git a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h index 834407c5a..4c17d4cdf 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +++ b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h @@ -29,9 +29,9 @@ void lmpar( /* Function Body */ const Scalar dwarf = (std::numeric_limits<Scalar>::min)(); const Index n = r.cols(); - assert(n==diag.size()); - assert(n==qtb.size()); - assert(n==x.size()); + eigen_assert(n==diag.size()); + eigen_assert(n==qtb.size()); + eigen_assert(n==x.size()); Matrix< Scalar, Dynamic, 1 > wa1, wa2; @@ -187,8 +187,8 @@ void lmpar2( /* Function Body */ const Scalar dwarf = (std::numeric_limits<Scalar>::min)(); const Index n = qr.matrixQR().cols(); - assert(n==diag.size()); - assert(n==qtb.size()); + eigen_assert(n==diag.size()); + eigen_assert(n==qtb.size()); Matrix< Scalar, Dynamic, 1 > wa1, wa2; diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h index 55fae5ae8..f28766061 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h +++ b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h @@ -24,10 +24,10 @@ void r1updt( // r1updt had a broader usecase, but we dont use it here. And, more // importantly, we can not test it. - assert(m==n); - assert(u.size()==m); - assert(v.size()==n); - assert(w.size()==n); + eigen_assert(m==n); + eigen_assert(u.size()==m); + eigen_assert(v.size()==n); + eigen_assert(w.size()==n); /* move the nontrivial part of the last column of s into w. */ w[n-1] = s(n-1,n-1); diff --git a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h index 9ce079e22..6ebf8563f 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h +++ b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h @@ -12,7 +12,7 @@ void rwupdt( typedef DenseIndex Index; const Index n = r.cols(); - assert(r.rows()>=n); + eigen_assert(r.rows()>=n); std::vector<JacobiRotation<Scalar> > givens(n); /* Local variables */ |