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

Function test_axpy

dlib/test/matrix3.cpp:1078–1111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1076
1077
1078 void test_axpy()
1079 {
1080 const int n = 4;
1081 matrix<double> B = dlib::randm(n,n);
1082
1083 matrix<double> g = dlib::uniform_matrix<double>(n,1,0.0);
1084
1085 const double tau = 1;
1086
1087 matrix<double> p = g + tau*dlib::colm(B,0);
1088 matrix<double> q = dlib::colm(B,0);
1089 DLIB_TEST(max(abs(p-q)) < 1e-14);
1090
1091 p = tau*dlib::colm(B,0);
1092 q = dlib::colm(B,0);
1093 DLIB_TEST(max(abs(p-q)) < 1e-14);
1094
1095
1096
1097
1098 g = dlib::uniform_matrix<double>(n,n,0.0);
1099 p = g + tau*B;
1100 DLIB_TEST(max(abs(p-B)) < 1e-14);
1101
1102 p = g + tau*subm(B,get_rect(B));
1103 DLIB_TEST(max(abs(p-B)) < 1e-14);
1104
1105 g = dlib::uniform_matrix<double>(2,2,0.0);
1106 p = g + tau*subm(B,1,1,2,2);
1107 DLIB_TEST(max(abs(p-subm(B,1,1,2,2))) < 1e-14);
1108
1109 set_subm(p,0,0,2,2) = g + tau*subm(B,1,1,2,2);
1110 DLIB_TEST(max(abs(p-subm(B,1,1,2,2))) < 1e-14);
1111 }
1112
1113
1114 class matrix_tester : public tester

Callers 1

perform_testMethod · 0.85

Calls 7

absFunction · 0.85
submFunction · 0.85
get_rectFunction · 0.85
set_submFunction · 0.85
randmFunction · 0.70
colmFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected