MCPcopy Create free account
hub / github.com/davisking/dlib / test_qp4_test7

Function test_qp4_test7

dlib/test/opt_qp_solver.cpp:317–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315 }
316
317 void test_qp4_test7()
318 {
319 matrix<double> A(3,3);
320 A = -1,2,4,
321 -3,1,6,
322 -6,7,-2;
323
324 matrix<double,0,1> b(3);
325 b = -1,
326 -2,
327 3;
328
329 matrix<double> Q(3,3);
330 Q = 4,-5,6,
331 1,-4,2,
332 -9,-4,5;
333 Q = Q*trans(Q);
334
335 const double C = 2;
336
337 matrix<double,0,1> alpha(3), true_alpha(3), d(3), lambda;
338 alpha = C/2, C/2, 0;
339 d = 0;
340
341 solve_qp4_using_smo(A, Q, b, d, alpha, lambda, 1e-9, 800);
342
343 dlog << LINFO << "*******************************************************";
344
345 dlog << LINFO << "alpha: " << trans(alpha);
346 true_alpha = 0, 2, 0;
347 dlog << LINFO << "true alpha: "<< trans(true_alpha);
348
349 dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
350 DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
351
352 }
353
354// ----------------------------------------------------------------------------------------
355

Callers 1

test_solve_qp4_using_smoFunction · 0.85

Calls 4

solve_qp4_using_smoFunction · 0.85
absFunction · 0.85
transFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected