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

Method perform_test

dlib/test/svm_c_linear.cpp:290–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288 {}
289
290 void perform_test (
291 )
292 {
293 test_dense();
294 test_sparse();
295 run_prior_test();
296 run_prior_sparse_test();
297
298 // test mixed sparse and dense dot products
299 {
300 std::map<unsigned int, double> sv;
301 matrix<double,0,1> dv(4);
302
303 dv = 1,2,3,4;
304
305 sv[0] = 1;
306 sv[3] = 1;
307
308
309 DLIB_TEST(dot(sv,dv) == 5);
310 DLIB_TEST(dot(dv,sv) == 5);
311 DLIB_TEST(dot(dv,dv) == 30);
312 DLIB_TEST(dot(sv,sv) == 2);
313
314 sv[10] = 9;
315 DLIB_TEST(dot(sv,dv) == 5);
316 }
317
318 // test mixed sparse dense assignments
319 {
320 std::map<unsigned int, double> sv, sv2;
321 std::vector<std::pair<unsigned int, double> > sv3;
322 matrix<double,0,1> dv(4), dv2;
323
324 dv = 1,2,3,4;
325
326 sv[0] = 1;
327 sv[3] = 1;
328
329
330 assign(dv2, dv);
331
332 DLIB_TEST(dv2.size() == 4);
333 DLIB_TEST(dv2(0) == 1);
334 DLIB_TEST(dv2(1) == 2);
335 DLIB_TEST(dv2(2) == 3);
336 DLIB_TEST(dv2(3) == 4);
337
338 assign(sv2, dv);
339 DLIB_TEST(sv2.size() == 4);
340 DLIB_TEST(sv2[0] == 1);
341 DLIB_TEST(sv2[1] == 2);
342 DLIB_TEST(sv2[2] == 3);
343 DLIB_TEST(sv2[3] == 4);
344
345 assign(sv2, sv);
346 DLIB_TEST(sv2.size() == 2);
347 DLIB_TEST(sv2[0] == 1);

Callers

nothing calls this directly

Calls 8

test_denseFunction · 0.85
test_sparseFunction · 0.70
run_prior_testFunction · 0.70
run_prior_sparse_testFunction · 0.70
dotFunction · 0.50
assignFunction · 0.50
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected