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

Function test_blas

dlib/test/matrix3.cpp:96–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95 template <typename type>
96 void test_blas( long rows, long cols)
97 {
98 // The tests in this function exercise the BLAS bindings located in the matrix/matrix_blas_bindings.h file.
99 // It does this by performing an assignment that is subject to BLAS bindings and comparing the
100 // results directly to an unevaluated matrix_exp that should be equal.
101
102 dlib::rand rnd;
103
104 matrix<type> a(rows,cols), temp, temp2, temp3;
105
106 for (int k = 0; k < 6; ++k)
107 {
108 for (long r= 0; r < a.nr(); ++r)
109 {
110 for (long c = 0; c < a.nc(); ++c)
111 {
112 a(r,c) = rnd_num<type>(rnd);
113 }
114 }
115 matrix<type> at;
116 at = trans(a);
117
118 matrix<complex<type> > c_a(rows,cols), c_at, c_sqr;
119 for (long r= 0; r < a.nr(); ++r)
120 {
121 for (long c = 0; c < a.nc(); ++c)
122 {
123 c_a(r,c) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
124 }
125 }
126 c_at = trans(c_a);
127 const int size = max(rows,cols);
128 c_sqr = 10*matrix_cast<complex<type> >(complex_matrix(randm(size,size,rnd), randm(size,size,rnd)));
129
130
131 matrix<complex<type> > c_temp(cols,cols), c_temp2(cols,cols);
132 const complex<type> i(0,1);
133
134 const type one = 1;
135 const type two = 1;
136 const type num1 = static_cast<type>(3.6);
137 const type num2 = static_cast<type>(6.6);
138 const type num3 = static_cast<type>(8.6);
139
140 matrix<complex<type>,0,1> c_cv4(cols), c_cv3(rows);
141 matrix<complex<type>,1,0> c_rv4(cols), c_rv3(rows);
142
143 matrix<type,0,1> cv4(cols);
144
145 for (long idx = 0; idx < cv4.size(); ++idx)
146 cv4(idx) = rnd_num<type>(rnd);
147
148 for (long idx = 0; idx < c_cv4.size(); ++idx)
149 c_cv4(idx) = complex<type>(rnd_num<type>(rnd),rnd_num<type>(rnd));
150
151 matrix<type,1,0> rv3(rows);
152
153 for (long idx = 0; idx < rv3.size(); ++idx)

Callers

nothing calls this directly

Calls 15

complex_matrixFunction · 0.85
check_equalFunction · 0.85
tmpFunction · 0.85
print_spinnerFunction · 0.85
c_check_equalFunction · 0.85
submFunction · 0.85
assign_no_blasFunction · 0.85
set_all_elementsFunction · 0.85
set_submFunction · 0.85
set_colmFunction · 0.85
set_rowmFunction · 0.85
absFunction · 0.85

Tested by

no test coverage detected