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

Function test_sparse_matrix_vector_multiply2

dlib/test/sparse_vector.cpp:93–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91// ----------------------------------------------------------------------------------------
92
93 void test_sparse_matrix_vector_multiply2()
94 {
95 std::vector<std::pair<unsigned long,double> > sv;
96 sv.push_back(make_pair(6, 1.42));
97 sv.push_back(make_pair(3, 5));
98
99 matrix<double,9,1> v;
100 v = 0;
101 v(3) = 5;
102 v(6) = 1.42;
103
104
105 matrix<double,0,1> r1, r2;
106
107 r1 = gaussian_randm(3,9)*v;
108 r2 = sparse_matrix_vector_multiply(gaussian_randm(3,std::numeric_limits<long>::max()),sv);
109
110 DLIB_TEST(max(abs(r1-r2)) < 1e-15);
111 }
112
113// ----------------------------------------------------------------------------------------
114

Callers 1

perform_testMethod · 0.85

Calls 5

gaussian_randmFunction · 0.85
absFunction · 0.85
maxFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected