Fix trivial warnings in LevenbergMarquardt module and test

This commit is contained in:
Christoph Hertzberg 2015-04-24 21:35:30 +02:00
parent de18cd413d
commit 8c6a3b5ace
2 changed files with 16 additions and 11 deletions

View File

@ -30,7 +30,7 @@ namespace internal {
using std::abs;
typedef typename QRSolver::MatrixType MatrixType;
typedef typename QRSolver::Scalar Scalar;
typedef typename QRSolver::StorageIndex StorageIndex;
// typedef typename QRSolver::StorageIndex StorageIndex;
/* Local variables */
Index j;

View File

@ -9,6 +9,9 @@
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// FIXME: These tests all check for hard-coded values. Ideally, parameters and start estimates should be randomized.
#include <stdio.h>
#include "main.h"
@ -275,7 +278,7 @@ const double chwirut2_functor::m_y[54] = { 92.9000E0 ,57.1000E0 ,31.0500E0 ,11.5
void testNistChwirut2(void)
{
const int n=3;
int info;
LevenbergMarquardtSpace::Status info;
VectorXd x(n);
@ -610,7 +613,7 @@ const double lanczos1_functor::y[24] = { 2.513400000000E+00 ,2.044333373291E+00
void testNistLanczos1(void)
{
const int n=6;
int info;
LevenbergMarquardtSpace::Status info;
VectorXd x(n);
@ -624,7 +627,7 @@ void testNistLanczos1(void)
info = lm.minimize(x);
// check return value
VERIFY_IS_EQUAL(info, 2);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeErrorTooSmall);
VERIFY_IS_EQUAL(lm.nfev(), 79);
VERIFY_IS_EQUAL(lm.njev(), 72);
// check norm^2
@ -645,7 +648,7 @@ void testNistLanczos1(void)
info = lm.minimize(x);
// check return value
VERIFY_IS_EQUAL(info, 2);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeErrorTooSmall);
VERIFY_IS_EQUAL(lm.nfev(), 9);
VERIFY_IS_EQUAL(lm.njev(), 8);
// check norm^2
@ -696,7 +699,7 @@ const double rat42_functor::y[9] = { 8.930E0 ,10.800E0 ,18.590E0 ,22.330E0 ,39.3
void testNistRat42(void)
{
const int n=3;
int info;
LevenbergMarquardtSpace::Status info;
VectorXd x(n);
@ -710,7 +713,7 @@ void testNistRat42(void)
info = lm.minimize(x);
// check return value
VERIFY_IS_EQUAL(info, 1);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeReductionTooSmall);
VERIFY_IS_EQUAL(lm.nfev(), 10);
VERIFY_IS_EQUAL(lm.njev(), 8);
// check norm^2
@ -728,7 +731,7 @@ void testNistRat42(void)
info = lm.minimize(x);
// check return value
VERIFY_IS_EQUAL(info, 1);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeReductionTooSmall);
VERIFY_IS_EQUAL(lm.nfev(), 6);
VERIFY_IS_EQUAL(lm.njev(), 5);
// check norm^2
@ -774,7 +777,7 @@ const double MGH10_functor::y[16] = { 3.478000E+04, 2.861000E+04, 2.365000E+04,
void testNistMGH10(void)
{
const int n=3;
int info;
LevenbergMarquardtSpace::Status info;
VectorXd x(n);
@ -786,6 +789,7 @@ void testNistMGH10(void)
MGH10_functor functor;
LevenbergMarquardt<MGH10_functor> lm(functor);
info = lm.minimize(x);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeErrorTooSmall);
// check norm^2
VERIFY_IS_APPROX(lm.fvec().squaredNorm(), 8.7945855171E+01);
@ -805,6 +809,7 @@ void testNistMGH10(void)
x<< 0.02, 4000., 250.;
// do the computation
info = lm.minimize(x);
VERIFY_IS_EQUAL(info, LevenbergMarquardtSpace::RelativeReductionTooSmall);
// check norm^2
VERIFY_IS_APPROX(lm.fvec().squaredNorm(), 8.7945855171E+01);
@ -891,8 +896,8 @@ void testNistBoxBOD(void)
// check return value
VERIFY_IS_EQUAL(info, 1);
VERIFY_IS_EQUAL(lm.nfev(), 15 );
VERIFY_IS_EQUAL(lm.njev(), 14 );
VERIFY_IS_EQUAL(lm.nfev(), 16 );
VERIFY_IS_EQUAL(lm.njev(), 15 );
// check norm^2
VERIFY_IS_APPROX(lm.fvec().squaredNorm(), 1.1680088766E+03);
// check x