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

Function testHybrj

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

Source from the content-addressed store, hash-verified

311}
312
313void testHybrj()
314{
315 const int n=9;
316 int info;
317 VectorXd x(n);
318
319 /* the following starting values provide a rough fit. */
320 x.setConstant(n, -1.);
321
322
323 // do the computation
324 hybrj_functor functor;
325 HybridNonLinearSolver<hybrj_functor> solver(functor);
326 solver.diag.setConstant(n, 1.);
327 solver.useExternalScaling = true;
328 info = solver.solve(x);
329
330 // check return value
331 VERIFY_IS_EQUAL(info, 1);
332 VERIFY_IS_EQUAL(solver.nfev, 11);
333 VERIFY_IS_EQUAL(solver.njev, 1);
334
335 // check norm
336 VERIFY_IS_APPROX(solver.fvec.blueNorm(), 1.192636e-08);
337
338
339// check x
340 VectorXd x_ref(n);
341 x_ref <<
342 -0.5706545, -0.6816283, -0.7017325,
343 -0.7042129, -0.701369, -0.6918656,
344 -0.665792, -0.5960342, -0.4164121;
345 VERIFY_IS_APPROX(x, x_ref);
346
347}
348
349struct hybrd_functor : Functor<double>
350{

Callers 1

Calls 2

solveMethod · 0.45
blueNormMethod · 0.45

Tested by

no test coverage detected