MCPcopy Create free account
hub / github.com/PX4/eigen / test_adjoint

Function test_adjoint

test/adjoint.cpp:149–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void test_adjoint()
150{
151 for(int i = 0; i < g_repeat; i++) {
152 CALL_SUBTEST_1( adjoint(Matrix<float, 1, 1>()) );
153 CALL_SUBTEST_2( adjoint(Matrix3d()) );
154 CALL_SUBTEST_3( adjoint(Matrix4f()) );
155
156 CALL_SUBTEST_4( adjoint(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );
157 CALL_SUBTEST_5( adjoint(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
158 CALL_SUBTEST_6( adjoint(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
159
160 // Complement for 128 bits vectorization:
161 CALL_SUBTEST_8( adjoint(Matrix2d()) );
162 CALL_SUBTEST_9( adjoint(Matrix<int,4,4>()) );
163
164 // 256 bits vectorization:
165 CALL_SUBTEST_10( adjoint(Matrix<float,8,8>()) );
166 CALL_SUBTEST_11( adjoint(Matrix<double,4,4>()) );
167 CALL_SUBTEST_12( adjoint(Matrix<int,8,8>()) );
168 }
169 // test a large static matrix only once
170 CALL_SUBTEST_7( adjoint(Matrix<float, 100, 100>()) );
171
172#ifdef EIGEN_TEST_PART_13
173 {
174 MatrixXcf a(10,10), b(10,10);
175 VERIFY_RAISES_ASSERT(a = a.transpose());
176 VERIFY_RAISES_ASSERT(a = a.transpose() + b);
177 VERIFY_RAISES_ASSERT(a = b + a.transpose());
178 VERIFY_RAISES_ASSERT(a = a.conjugate().transpose());
179 VERIFY_RAISES_ASSERT(a = a.adjoint());
180 VERIFY_RAISES_ASSERT(a = a.adjoint() + b);
181 VERIFY_RAISES_ASSERT(a = b + a.adjoint());
182
183 // no assertion should be triggered for these cases:
184 a.transpose() = a.transpose();
185 a.transpose() += a.transpose();
186 a.transpose() += a.transpose() + b;
187 a.transpose() = a.adjoint();
188 a.transpose() += a.adjoint();
189 a.transpose() += a.adjoint() + b;
190
191 // regression tests for check_for_aliasing
192 MatrixXd c(10,10);
193 c = 1.0 * MatrixXd::Ones(10,10) + c;
194 c = MatrixXd::Ones(10,10) * 1.0 + c;
195 c = c + MatrixXd::Ones(10,10) .cwiseProduct( MatrixXd::Zero(10,10) );
196 c = MatrixXd::Ones(10,10) * MatrixXd::Zero(10,10);
197 }
198#endif
199}
200

Callers

nothing calls this directly

Calls 5

adjointFunction · 0.85
transposeMethod · 0.45
conjugateMethod · 0.45
adjointMethod · 0.45
cwiseProductMethod · 0.45

Tested by

no test coverage detected