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

Function test_sparse_matrix_vector_multiply1

dlib/test/sparse_vector.cpp:70–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68// ----------------------------------------------------------------------------------------
69
70 void test_sparse_matrix_vector_multiply1()
71 {
72 print_spinner();
73 std::map<unsigned long,double> sv;
74 sv[2] = 8;
75 sv[6] = 2.3;
76
77 matrix<double,10,1> v;
78 v = 0;
79 v(2) = 8;
80 v(6) = 2.3;
81
82
83 matrix<double,0,1> r1, r2;
84
85 r1 = gaussian_randm(4,10)*v;
86 r2 = sparse_matrix_vector_multiply(gaussian_randm(4,std::numeric_limits<long>::max()),sv);
87
88 DLIB_TEST(max(abs(r1-r2)) < 1e-15);
89 }
90
91// ----------------------------------------------------------------------------------------
92

Callers 1

perform_testMethod · 0.85

Calls 5

print_spinnerFunction · 0.85
gaussian_randmFunction · 0.85
absFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected