MCPcopy Create free account
hub / github.com/abess-team/abess / testLmdif1

Function testLmdif1

python/include/unsupported/test/NonLinearOptimization.cpp:556–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554};
555
556void testLmdif1()
557{
558 const int n=3;
559 int info;
560
561 VectorXd x(n), fvec(15);
562
563 /* the following starting values provide a rough fit. */
564 x.setConstant(n, 1.);
565
566 // do the computation
567 lmdif_functor functor;
568 DenseIndex nfev;
569 info = LevenbergMarquardt<lmdif_functor>::lmdif1(functor, x, &nfev);
570
571 // check return value
572 VERIFY_IS_EQUAL(info, 1);
573 VERIFY_IS_EQUAL(nfev, 26);
574
575 // check norm
576 functor(x, fvec);
577 VERIFY_IS_APPROX(fvec.blueNorm(), 0.09063596);
578
579 // check x
580 VectorXd x_ref(n);
581 x_ref << 0.0824106, 1.1330366, 2.3436947;
582 VERIFY_IS_APPROX(x, x_ref);
583
584}
585
586void testLmdif()
587{

Callers 1

Calls 2

functorFunction · 0.85
blueNormMethod · 0.45

Tested by

no test coverage detected