| 554 | }; |
| 555 | |
| 556 | void 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 | |
| 586 | void testLmdif() |
| 587 | { |
no test coverage detected