MCPcopy Create free account
hub / github.com/abess-team/abess / test_array

Function test_array

python/include/unsupported/test/cxx11_tensor_fixed_size.cpp:226–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224
225
226static void test_array()
227{
228 TensorFixedSize<float, Sizes<2, 3, 7> > mat1;
229 float val = 0.0f;
230 for (int i = 0; i < 2; ++i) {
231 for (int j = 0; j < 3; ++j) {
232 for (int k = 0; k < 7; ++k) {
233 mat1(i,j,k) = val;
234 val += 1.0f;
235 }
236 }
237 }
238
239 TensorFixedSize<float, Sizes<2, 3, 7> > mat3;
240 mat3 = mat1.pow(3.5f);
241
242 val = 0.0f;
243 for (int i = 0; i < 2; ++i) {
244 for (int j = 0; j < 3; ++j) {
245 for (int k = 0; k < 7; ++k) {
246 VERIFY_IS_APPROX(mat3(i,j,k), powf(val, 3.5f));
247 val += 1.0f;
248 }
249 }
250 }
251}
252
253void test_cxx11_tensor_fixed_size()
254{

Callers 1

Calls 1

powMethod · 0.45

Tested by

no test coverage detected