void test_matrix_power() { CALL_SUBTEST_2(test2dRotation<double>(1e-13)); CALL_SUBTEST_1(test2dRotation<float>(2e-5)); // was 1e-5, relaxed for clang 2.8 / linux / x86-64 CALL_SUBTEST_9(test2dRotation<long double>(1e-13)); CALL_SUBTEST_2(test2dHyperbolicRotation<double>(1e-14)); CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5)); CALL_SUBTEST_9(test2dHyperbolicRotation<long double>(1e-14)); CALL_SUBTEST_10(test3dRotation<double>(1e-13)); CALL_SUBTEST_11(test3dRotation<float>(1e-5)); CALL_SUBTEST_12(test3dRotation<long double>(1e-13)); CALL_SUBTEST_2(testGeneral(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testGeneral(Matrix3dRowMajor(), 1e-13)); CALL_SUBTEST_3(testGeneral(Matrix4cd(), 1e-13)); CALL_SUBTEST_4(testGeneral(MatrixXd(8,8), 2e-12)); CALL_SUBTEST_1(testGeneral(Matrix2f(), 1e-4)); CALL_SUBTEST_5(testGeneral(Matrix3cf(), 1e-4)); CALL_SUBTEST_8(testGeneral(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testGeneral(MatrixXf(2,2), 1e-3)); // see bug 614 CALL_SUBTEST_9(testGeneral(MatrixXe(7,7), 1e-13)); CALL_SUBTEST_10(testGeneral(Matrix3d(), 1e-13)); CALL_SUBTEST_11(testGeneral(Matrix3f(), 1e-4)); CALL_SUBTEST_12(testGeneral(Matrix3e(), 1e-13)); CALL_SUBTEST_2(testSingular(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testSingular(Matrix3dRowMajor(), 1e-13)); CALL_SUBTEST_3(testSingular(Matrix4cd(), 1e-13)); CALL_SUBTEST_4(testSingular(MatrixXd(8,8), 2e-12)); CALL_SUBTEST_1(testSingular(Matrix2f(), 1e-4)); CALL_SUBTEST_5(testSingular(Matrix3cf(), 1e-4)); CALL_SUBTEST_8(testSingular(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testSingular(MatrixXf(2,2), 1e-3)); CALL_SUBTEST_9(testSingular(MatrixXe(7,7), 1e-13)); CALL_SUBTEST_10(testSingular(Matrix3d(), 1e-13)); CALL_SUBTEST_11(testSingular(Matrix3f(), 1e-4)); CALL_SUBTEST_12(testSingular(Matrix3e(), 1e-13)); CALL_SUBTEST_2(testLogThenExp(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testLogThenExp(Matrix3dRowMajor(), 1e-13)); CALL_SUBTEST_3(testLogThenExp(Matrix4cd(), 1e-13)); CALL_SUBTEST_4(testLogThenExp(MatrixXd(8,8), 2e-12)); CALL_SUBTEST_1(testLogThenExp(Matrix2f(), 1e-4)); CALL_SUBTEST_5(testLogThenExp(Matrix3cf(), 1e-4)); CALL_SUBTEST_8(testLogThenExp(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testLogThenExp(MatrixXf(2,2), 1e-3)); CALL_SUBTEST_9(testLogThenExp(MatrixXe(7,7), 1e-13)); CALL_SUBTEST_10(testLogThenExp(Matrix3d(), 1e-13)); CALL_SUBTEST_11(testLogThenExp(Matrix3f(), 1e-4)); CALL_SUBTEST_12(testLogThenExp(Matrix3e(), 1e-13)); }
void test_mapped_matrix() { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( map_class_vector(Matrix<float, 1, 1>()) ); CALL_SUBTEST_1( check_const_correctness(Matrix<float, 1, 1>()) ); CALL_SUBTEST_2( map_class_vector(Vector4d()) ); CALL_SUBTEST_2( map_class_vector(VectorXd(13)) ); CALL_SUBTEST_2( check_const_correctness(Matrix4d()) ); CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); CALL_SUBTEST_4( map_class_vector(VectorXcf(8)) ); CALL_SUBTEST_5( map_class_vector(VectorXi(12)) ); CALL_SUBTEST_5( check_const_correctness(VectorXi(12)) ); CALL_SUBTEST_1( map_class_matrix(Matrix<float, 1, 1>()) ); CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); CALL_SUBTEST_11( map_class_matrix(Matrix<float,3,5>()) ); CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) ); CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random<int>(1,10),internal::random<int>(1,10))) ); CALL_SUBTEST_6( map_static_methods(Matrix<double, 1, 1>()) ); CALL_SUBTEST_7( map_static_methods(Vector3f()) ); CALL_SUBTEST_8( map_static_methods(RowVector3d()) ); CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) ); CALL_SUBTEST_10( map_static_methods(VectorXf(12)) ); CALL_SUBTEST_11( map_not_aligned_on_scalar<double>() ); } }
void test_product_trsolve() { for(int i = 0; i < g_repeat ; i++) { // matrices CALL_SUBTEST_1((trsolve<float,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_2((trsolve<double,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_3((trsolve<std::complex<float>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2)))); CALL_SUBTEST_4((trsolve<std::complex<double>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2)))); // vectors CALL_SUBTEST_5((trsolve<float,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_6((trsolve<double,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_7((trsolve<std::complex<float>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_8((trsolve<std::complex<double>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)))); // meta-unrollers CALL_SUBTEST_9((trsolve<float,4,1>())); CALL_SUBTEST_10((trsolve<double,4,1>())); CALL_SUBTEST_11((trsolve<std::complex<float>,4,1>())); CALL_SUBTEST_12((trsolve<float,1,1>())); CALL_SUBTEST_13((trsolve<float,1,2>())); CALL_SUBTEST_14((trsolve<float,3,1>())); } }
void test_bdcsvd() { CALL_SUBTEST_3(( svd_verify_assert<BDCSVD<Matrix3f> >(Matrix3f()) )); CALL_SUBTEST_4(( svd_verify_assert<BDCSVD<Matrix4d> >(Matrix4d()) )); CALL_SUBTEST_7(( svd_verify_assert<BDCSVD<MatrixXf> >(MatrixXf(10,12)) )); CALL_SUBTEST_8(( svd_verify_assert<BDCSVD<MatrixXcd> >(MatrixXcd(7,5)) )); CALL_SUBTEST_101(( svd_all_trivial_2x2(bdcsvd<Matrix2cd>) )); CALL_SUBTEST_102(( svd_all_trivial_2x2(bdcsvd<Matrix2d>) )); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_3(( bdcsvd<Matrix3f>() )); CALL_SUBTEST_4(( bdcsvd<Matrix4d>() )); CALL_SUBTEST_5(( bdcsvd<Matrix<float,3,5> >() )); int r = internal::random<int>(1, EIGEN_TEST_MAX_SIZE/2), c = internal::random<int>(1, EIGEN_TEST_MAX_SIZE/2); TEST_SET_BUT_UNUSED_VARIABLE(r) TEST_SET_BUT_UNUSED_VARIABLE(c) CALL_SUBTEST_6(( bdcsvd(Matrix<double,Dynamic,2>(r,2)) )); CALL_SUBTEST_7(( bdcsvd(MatrixXf(r,c)) )); CALL_SUBTEST_7(( compare_bdc_jacobi(MatrixXf(r,c)) )); CALL_SUBTEST_10(( bdcsvd(MatrixXd(r,c)) )); CALL_SUBTEST_10(( compare_bdc_jacobi(MatrixXd(r,c)) )); CALL_SUBTEST_8(( bdcsvd(MatrixXcd(r,c)) )); CALL_SUBTEST_8(( compare_bdc_jacobi(MatrixXcd(r,c)) )); // Test on inf/nan matrix CALL_SUBTEST_7( (svd_inf_nan<BDCSVD<MatrixXf>, MatrixXf>()) ); CALL_SUBTEST_10( (svd_inf_nan<BDCSVD<MatrixXd>, MatrixXd>()) ); } // test matrixbase method CALL_SUBTEST_1(( bdcsvd_method<Matrix2cd>() )); CALL_SUBTEST_3(( bdcsvd_method<Matrix3f>() )); // Test problem size constructors CALL_SUBTEST_7( BDCSVD<MatrixXf>(10,10) ); // Check that preallocation avoids subsequent mallocs // Disbaled because not supported by BDCSVD // CALL_SUBTEST_9( svd_preallocate<void>() ); CALL_SUBTEST_2( svd_underoverflow<void>() ); }
void test_boostmultiprec() { typedef Matrix<Real,Dynamic,Dynamic> Mat; typedef Matrix<std::complex<Real>,Dynamic,Dynamic> MatC; std::cout << "NumTraits<Real>::epsilon() = " << NumTraits<Real>::epsilon() << std::endl; std::cout << "NumTraits<Real>::dummy_precision() = " << NumTraits<Real>::dummy_precision() << std::endl; std::cout << "NumTraits<Real>::lowest() = " << NumTraits<Real>::lowest() << std::endl; std::cout << "NumTraits<Real>::highest() = " << NumTraits<Real>::highest() << std::endl; std::cout << "NumTraits<Real>::digits10() = " << NumTraits<Real>::digits10() << std::endl; // chekc stream output { Mat A(10,10); A.setRandom(); std::stringstream ss; ss << A; } { MatC A(10,10); A.setRandom(); std::stringstream ss; ss << A; } for(int i = 0; i < g_repeat; i++) { int s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE); CALL_SUBTEST_1( cholesky(Mat(s,s)) ); CALL_SUBTEST_2( lu_non_invertible<Mat>() ); CALL_SUBTEST_2( lu_invertible<Mat>() ); CALL_SUBTEST_2( lu_non_invertible<MatC>() ); CALL_SUBTEST_2( lu_invertible<MatC>() ); CALL_SUBTEST_3( qr(Mat(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_3( qr_invertible<Mat>() ); CALL_SUBTEST_4( qr<Mat>() ); CALL_SUBTEST_4( cod<Mat>() ); CALL_SUBTEST_4( qr_invertible<Mat>() ); CALL_SUBTEST_5( qr<Mat>() ); CALL_SUBTEST_5( qr_invertible<Mat>() ); CALL_SUBTEST_6( selfadjointeigensolver(Mat(s,s)) ); CALL_SUBTEST_7( eigensolver(Mat(s,s)) ); CALL_SUBTEST_8( generalized_eigensolver_real(Mat(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } CALL_SUBTEST_9(( jacobisvd(Mat(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); CALL_SUBTEST_10(( bdcsvd(Mat(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); }
void test_visitor() { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( matrixVisitor(Matrix<float, 1, 1>()) ); CALL_SUBTEST_2( matrixVisitor(Matrix2f()) ); CALL_SUBTEST_3( matrixVisitor(Matrix4d()) ); CALL_SUBTEST_4( matrixVisitor(MatrixXd(8, 12)) ); CALL_SUBTEST_5( matrixVisitor(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) ); CALL_SUBTEST_6( matrixVisitor(MatrixXi(8, 12)) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_7( vectorVisitor(Vector4f()) ); CALL_SUBTEST_8( vectorVisitor(VectorXd(10)) ); CALL_SUBTEST_9( vectorVisitor(RowVectorXd(10)) ); CALL_SUBTEST_10( vectorVisitor(VectorXf(33)) ); } }