17 bool assert_flag =
false;
18 assert((assert_flag =
true, assert_flag));
19 if ( ! assert_flag ) {
20 std::cerr <<
"Assert is disabled" << std::endl;
29 for(
unsigned int i = 0; i < m1.size1(); ++i) {
30 for(
unsigned int j = 0; j <= i; ++j)
36 trkf::ublas::matrix<double> unit1 = prod(m1, minv1);
40 for(
unsigned int i = 0; i < m1.size1(); ++i) {
41 for(
unsigned int j = 0; j <= i; ++j) {
42 double val = (i==j ? 1. : 0.);
43 assert(
std::abs(unit1(i,j) - val) < 1.
e-10);
50 for(
unsigned int i = 0; i < m2.size1(); ++i) {
51 for(
unsigned int j = 0; j <= i; ++j)
57 trkf::ublas::matrix<double> unit2 = prod(m2, minv2);
61 for(
unsigned int i = 0; i < m2.size1(); ++i) {
62 for(
unsigned int j = 0; j <= i; ++j) {
63 double val = (i==j ? 1. : 0.);
64 assert(
std::abs(unit2(i,j) - val) < 1.
e-10);
71 for(
unsigned int i = 0; i < m3.size1(); ++i) {
72 for(
unsigned int j = 0; j <= i; ++j) {
81 trkf::ublas::matrix<double> unit3 = prod(m3, minv3);
85 for(
unsigned int i = 0; i < m3.size1(); ++i) {
86 for(
unsigned int j = 0; j <= i; ++j) {
87 double val = (i==j ? 1. : 0.);
88 assert(
std::abs(unit3(i,j) - val) < 1.
e-10);
95 for(
unsigned int i = 0; i < m4.size1(); ++i) {
96 for(
unsigned int j = 0; j <= i; ++j) {
105 trkf::ublas::matrix<double> unit4 = prod(m4, minv4);
109 for(
unsigned int i = 0; i < m4.size1(); ++i) {
110 for(
unsigned int j = 0; j <= i; ++j) {
111 double val = (i==j ? 1. : 0.);
112 assert(
std::abs(unit4(i,j) - val) < 1.
e-10);
119 for(
unsigned int i = 0; i < m5.size1(); ++i) {
120 for(
unsigned int j = 0; j <= i; ++j) {
129 trkf::ublas::matrix<double> unit5 = prod(m5, minv5);
133 for(
unsigned int i = 0; i < m5.size1(); ++i) {
134 for(
unsigned int j = 0; j <= i; ++j) {
135 double val = (i==j ? 1. : 0.);
136 assert(
std::abs(unit5(i,j) - val) < 1.
e-10);
143 for(
unsigned int i = 0; i < m6.size1(); ++i) {
144 for(
unsigned int j = 0; j < m6.size2(); ++j)
145 m6(i,j) = i + 2*j + 1.;
150 trkf::ublas::matrix<double> unit6 = prod(m6, minv6);
154 for(
unsigned int i = 0; i < m6.size1(); ++i) {
155 for(
unsigned int j = 0; j < m6.size2(); ++j) {
156 double val = (i==j ? 1. : 0.);
157 assert(
std::abs(unit6(i,j) - val) < 1.
e-10);
164 for(
unsigned int i = 0; i < m7.size1(); ++i) {
165 for(
unsigned int j = 0; j < m7.size2(); ++j)
166 m7(i,j) = i + 2*j + 1.;
171 trkf::ublas::matrix<double> unit7 = prod(m7, minv7);
175 for(
unsigned int i = 0; i < m7.size1(); ++i) {
176 for(
unsigned int j = 0; j < m7.size2(); ++j) {
177 double val = (i==j ? 1. : 0.);
178 assert(
std::abs(unit7(i,j) - val) < 1.
e-10);
185 for(
unsigned int i = 0; i < m8.size1(); ++i) {
186 for(
unsigned int j = 0; j < m8.size2(); ++j)
187 m8(i,j) = i + 2*j + (i==j ? 1. : 0.);
193 trkf::ublas::matrix<double> unit8 = prod(m8, minv8);
197 for(
unsigned int i = 0; i < m8.size1(); ++i) {
198 for(
unsigned int j = 0; j < m8.size2(); ++j) {
199 double val = (i==j ? 1. : 0.);
200 assert(
std::abs(unit8(i,j) - val) < 1.
e-10);
207 for(
unsigned int i = 0; i < m9.size1(); ++i) {
208 for(
unsigned int j = 0; j < m9.size2(); ++j)
209 m9(i,j) = i + 2*j + (i==j ? 1. : 0.);
215 trkf::ublas::matrix<double> unit9 = prod(m9, minv9);
219 for(
unsigned int i = 0; i < m9.size1(); ++i) {
220 for(
unsigned int j = 0; j < m9.size2(); ++j) {
221 double val = (i==j ? 1. : 0.);
222 assert(
std::abs(unit9(i,j) - val) < 1.
e-10);
229 for(
unsigned int i = 0; i < m10.size1(); ++i) {
230 for(
unsigned int j = 0; j < m10.size2(); ++j)
231 m10(i,j) = i + 2*j + (i==j ? 1. : 0.);
237 trkf::ublas::matrix<double> unit10 = prod(m10, minv10);
241 for(
unsigned int i = 0; i < m10.size1(); ++i) {
242 for(
unsigned int j = 0; j < m10.size2(); ++j) {
243 double val = (i==j ? 1. : 0.);
244 assert(
std::abs(unit10(i,j) - val) < 1.
e-10);
250 std::cout <<
"LATest: All tests passed." << std::endl;
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
BEGIN_PROLOG could also be cerr
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, N *M > > type
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
bool invert(ublas::matrix< T, L, A > &m)
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
BEGIN_PROLOG could also be cout