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

Method test_stuff

dlib/test/symmetric_matrix_cache.cpp:152–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 // -----------------------------------
151
152 void test_stuff (
153 long csize
154 )
155 {
156 print_spinner();
157 dlog << LINFO << "csize: "<< csize;
158 matrix<double> m = randm(10,10,rnd);
159
160 m = make_symmetric(m);
161
162 DLIB_TEST(equal(symmetric_matrix_cache<float>(m, csize), matrix_cast<float>(m)));
163 DLIB_TEST(equal(symmetric_matrix_cache<double>(m, csize), matrix_cast<double>(m)));
164
165 dlog << LINFO << "test colm/rowm";
166
167
168 for (long i = 0; i < m.nr(); ++i)
169 {
170 DLIB_TEST(equal(colm(symmetric_matrix_cache<float>(m, csize),i), colm(matrix_cast<float>(m),i)));
171 DLIB_TEST(equal(rowm(symmetric_matrix_cache<float>(m, csize),i), rowm(matrix_cast<float>(m),i)));
172 // things are supposed to be symmetric
173 DLIB_TEST(equal(colm(symmetric_matrix_cache<float>(m, csize),i), trans(rowm(matrix_cast<float>(m),i))));
174 DLIB_TEST(equal(rowm(symmetric_matrix_cache<float>(m, csize),i), trans(colm(matrix_cast<float>(m),i))));
175 }
176
177 dlog << LINFO << "test diag";
178 DLIB_TEST(equal(diag(symmetric_matrix_cache<float>(m,csize)), diag(matrix_cast<float>(m))));
179
180 test_colm_exp(symmetric_matrix_cache<float>(m,csize), matrix_cast<float>(m));
181 test_rowm_exp(symmetric_matrix_cache<float>(m,csize), matrix_cast<float>(m));
182 test_diag_exp(symmetric_matrix_cache<float>(m,csize), matrix_cast<float>(m));
183
184 test_colm_exp(tmp(symmetric_matrix_cache<float>(m,csize)), tmp(matrix_cast<float>(m)));
185 test_rowm_exp(symmetric_matrix_cache<float>(m,csize), tmp(matrix_cast<float>(m)));
186 test_diag_exp(tmp(symmetric_matrix_cache<float>(m,csize)), tmp(matrix_cast<float>(m)));
187 }
188
189
190 void perform_test (

Callers

nothing calls this directly

Calls 10

print_spinnerFunction · 0.85
make_symmetricFunction · 0.85
tmpFunction · 0.85
randmFunction · 0.70
equalFunction · 0.50
colmFunction · 0.50
rowmFunction · 0.50
transFunction · 0.50
diagFunction · 0.50
nrMethod · 0.45

Tested by

no test coverage detected