mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
big huge changes, so i dont remember everything.
* renaming, e.g. LU ---> FullPivLU * split tests framework: more robust, e.g. dont generate empty tests if a number is skipped * make all remaining tests use that splitting, as needed. * Fix 4x4 inversion (see stable branch) * Transform::inverse() and geo_transform test : adapt to new inverse() API, it was also trying to instantiate inverse() for 3x4 matrices. * CMakeLists: more robust regexp to parse the version number * misc fixes in unit tests
This commit is contained in:
@@ -108,16 +108,17 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
void test_adjoint()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( adjoint(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( adjoint(Matrix3d()) );
|
||||
CALL_SUBTEST( adjoint(Matrix4f()) );
|
||||
CALL_SUBTEST( adjoint(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST( adjoint(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( adjoint(MatrixXf(21, 21)) );
|
||||
CALL_SUBTEST_1( adjoint(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( adjoint(Matrix3d()) );
|
||||
CALL_SUBTEST_3( adjoint(Matrix4f()) );
|
||||
CALL_SUBTEST_4( adjoint(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST_5( adjoint(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_6( adjoint(MatrixXf(21, 21)) );
|
||||
}
|
||||
// test a large matrix only once
|
||||
CALL_SUBTEST( adjoint(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST_7( adjoint(Matrix<float, 100, 100>()) );
|
||||
|
||||
#ifdef EIGEN_TEST_PART_4
|
||||
{
|
||||
MatrixXcf a(10,10), b(10,10);
|
||||
VERIFY_RAISES_ASSERT(a = a.transpose());
|
||||
@@ -128,5 +129,6 @@ void test_adjoint()
|
||||
VERIFY_RAISES_ASSERT(a = a.adjoint() + b);
|
||||
VERIFY_RAISES_ASSERT(a = b + a.adjoint());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -146,26 +146,26 @@ template<typename VectorType> void lpNorm(const VectorType& v)
|
||||
void test_array()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( array(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( array(Matrix2f()) );
|
||||
CALL_SUBTEST( array(Matrix4d()) );
|
||||
CALL_SUBTEST( array(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( array(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST( array(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_1( array(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( array(Matrix2f()) );
|
||||
CALL_SUBTEST_3( array(Matrix4d()) );
|
||||
CALL_SUBTEST_4( array(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_5( array(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST_6( array(MatrixXi(8, 12)) );
|
||||
}
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( comparisons(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( comparisons(Matrix2f()) );
|
||||
CALL_SUBTEST( comparisons(Matrix4d()) );
|
||||
CALL_SUBTEST( comparisons(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST( comparisons(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_1( comparisons(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( comparisons(Matrix2f()) );
|
||||
CALL_SUBTEST_3( comparisons(Matrix4d()) );
|
||||
CALL_SUBTEST_5( comparisons(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST_6( comparisons(MatrixXi(8, 12)) );
|
||||
}
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( lpNorm(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( lpNorm(Vector2f()) );
|
||||
CALL_SUBTEST( lpNorm(Vector3d()) );
|
||||
CALL_SUBTEST( lpNorm(Vector4f()) );
|
||||
CALL_SUBTEST( lpNorm(VectorXf(16)) );
|
||||
CALL_SUBTEST( lpNorm(VectorXcd(10)) );
|
||||
CALL_SUBTEST_1( lpNorm(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( lpNorm(Vector2f()) );
|
||||
CALL_SUBTEST_7( lpNorm(Vector3d()) );
|
||||
CALL_SUBTEST_8( lpNorm(Vector4f()) );
|
||||
CALL_SUBTEST_5( lpNorm(VectorXf(16)) );
|
||||
CALL_SUBTEST_4( lpNorm(VectorXcf(10)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,11 +76,11 @@ template<typename MatrixType> void replicate(const MatrixType& m)
|
||||
void test_array_replicate()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( replicate(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( replicate(Vector2f()) );
|
||||
CALL_SUBTEST( replicate(Vector3d()) );
|
||||
CALL_SUBTEST( replicate(Vector4f()) );
|
||||
CALL_SUBTEST( replicate(VectorXf(16)) );
|
||||
CALL_SUBTEST( replicate(VectorXcd(10)) );
|
||||
CALL_SUBTEST_1( replicate(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( replicate(Vector2f()) );
|
||||
CALL_SUBTEST_3( replicate(Vector3d()) );
|
||||
CALL_SUBTEST_4( replicate(Vector4f()) );
|
||||
CALL_SUBTEST_5( replicate(VectorXf(16)) );
|
||||
CALL_SUBTEST_6( replicate(VectorXcd(10)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,19 +163,20 @@ template<typename MatrixType> void reverse(const MatrixType& m)
|
||||
void test_array_reverse()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( reverse(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( reverse(Matrix2f()) );
|
||||
CALL_SUBTEST( reverse(Matrix4f()) );
|
||||
CALL_SUBTEST( reverse(Matrix4d()) );
|
||||
CALL_SUBTEST( reverse(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( reverse(MatrixXi(6, 3)) );
|
||||
CALL_SUBTEST( reverse(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST( reverse(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(6,3)) );
|
||||
CALL_SUBTEST_1( reverse(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( reverse(Matrix2f()) );
|
||||
CALL_SUBTEST_3( reverse(Matrix4f()) );
|
||||
CALL_SUBTEST_4( reverse(Matrix4d()) );
|
||||
CALL_SUBTEST_5( reverse(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_6( reverse(MatrixXi(6, 3)) );
|
||||
CALL_SUBTEST_7( reverse(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST_8( reverse(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST_9( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(6,3)) );
|
||||
}
|
||||
#ifdef EIGEN_TEST_PART_3
|
||||
Vector4f x; x << 1, 2, 3, 4;
|
||||
Vector4f y; y << 4, 3, 2, 1;
|
||||
VERIFY(x.reverse()[1] == 3);
|
||||
VERIFY(x.reverse() == y);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -79,6 +79,6 @@ void test_bandmatrix()
|
||||
int cols = ei_random<int>(1,10);
|
||||
int sups = ei_random<int>(0,cols-1);
|
||||
int subs = ei_random<int>(0,rows-1);
|
||||
CALL_SUBTEST( bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
|
||||
CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,17 +146,17 @@ void casting()
|
||||
void test_basicstuff()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( basicStuff(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( basicStuff(Matrix4d()) );
|
||||
CALL_SUBTEST( basicStuff(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( basicStuff(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( basicStuff(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST( basicStuff(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST( basicStuff(Matrix<long double,Dynamic,Dynamic>(10,10)) );
|
||||
CALL_SUBTEST_1( basicStuff(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( basicStuff(Matrix4d()) );
|
||||
CALL_SUBTEST_3( basicStuff(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_4( basicStuff(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_5( basicStuff(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST_6( basicStuff(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST_7( basicStuff(Matrix<long double,Dynamic,Dynamic>(10,10)) );
|
||||
|
||||
CALL_SUBTEST( basicStuffComplex(MatrixXcf(21, 17)) );
|
||||
CALL_SUBTEST( basicStuffComplex(MatrixXcd(2, 3)) );
|
||||
CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(21, 17)) );
|
||||
CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(2, 3)) );
|
||||
}
|
||||
|
||||
CALL_SUBTEST(casting());
|
||||
CALL_SUBTEST_2(casting());
|
||||
}
|
||||
|
||||
@@ -148,17 +148,17 @@ template<typename MatrixType> void cholesky_verify_assert()
|
||||
void test_cholesky()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( cholesky(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST( cholesky(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST( cholesky(Matrix2d()) );
|
||||
CALL_SUBTEST( cholesky(Matrix3f()) );
|
||||
CALL_SUBTEST( cholesky(Matrix4d()) );
|
||||
CALL_SUBTEST( cholesky(MatrixXd(200,200)) );
|
||||
CALL_SUBTEST( cholesky(MatrixXcd(100,100)) );
|
||||
CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST_2( cholesky(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST_3( cholesky(Matrix2d()) );
|
||||
CALL_SUBTEST_4( cholesky(Matrix3f()) );
|
||||
CALL_SUBTEST_5( cholesky(Matrix4d()) );
|
||||
CALL_SUBTEST_2( cholesky(MatrixXd(200,200)) );
|
||||
CALL_SUBTEST_6( cholesky(MatrixXcd(100,100)) );
|
||||
}
|
||||
|
||||
CALL_SUBTEST( cholesky_verify_assert<Matrix3f>() );
|
||||
CALL_SUBTEST( cholesky_verify_assert<Matrix3d>() );
|
||||
CALL_SUBTEST( cholesky_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST( cholesky_verify_assert<MatrixXd>() );
|
||||
CALL_SUBTEST_4( cholesky_verify_assert<Matrix3f>() );
|
||||
CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() );
|
||||
CALL_SUBTEST_8( cholesky_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST_2( cholesky_verify_assert<MatrixXd>() );
|
||||
}
|
||||
|
||||
@@ -110,20 +110,20 @@ void run_vector_tests()
|
||||
|
||||
void test_conservative_resize()
|
||||
{
|
||||
run_matrix_tests<int, Eigen::RowMajor>();
|
||||
run_matrix_tests<int, Eigen::ColMajor>();
|
||||
run_matrix_tests<float, Eigen::RowMajor>();
|
||||
run_matrix_tests<float, Eigen::ColMajor>();
|
||||
run_matrix_tests<double, Eigen::RowMajor>();
|
||||
run_matrix_tests<double, Eigen::ColMajor>();
|
||||
run_matrix_tests<std::complex<float>, Eigen::RowMajor>();
|
||||
run_matrix_tests<std::complex<float>, Eigen::ColMajor>();
|
||||
run_matrix_tests<std::complex<double>, Eigen::RowMajor>();
|
||||
run_matrix_tests<std::complex<double>, Eigen::ColMajor>();
|
||||
CALL_SUBTEST_1((run_matrix_tests<int, Eigen::RowMajor>()));
|
||||
CALL_SUBTEST_1((run_matrix_tests<int, Eigen::ColMajor>()));
|
||||
CALL_SUBTEST_2((run_matrix_tests<float, Eigen::RowMajor>()));
|
||||
CALL_SUBTEST_2((run_matrix_tests<float, Eigen::ColMajor>()));
|
||||
CALL_SUBTEST_3((run_matrix_tests<double, Eigen::RowMajor>()));
|
||||
CALL_SUBTEST_3((run_matrix_tests<double, Eigen::ColMajor>()));
|
||||
CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::RowMajor>()));
|
||||
CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::ColMajor>()));
|
||||
CALL_SUBTEST_5((run_matrix_tests<std::complex<double>, Eigen::RowMajor>()));
|
||||
CALL_SUBTEST_6((run_matrix_tests<std::complex<double>, Eigen::ColMajor>()));
|
||||
|
||||
run_vector_tests<int>();
|
||||
run_vector_tests<float>();
|
||||
run_vector_tests<double>();
|
||||
run_vector_tests<std::complex<float> >();
|
||||
run_vector_tests<std::complex<double> >();
|
||||
CALL_SUBTEST_1((run_vector_tests<int>()));
|
||||
CALL_SUBTEST_2((run_vector_tests<float>()));
|
||||
CALL_SUBTEST_3((run_vector_tests<double>()));
|
||||
CALL_SUBTEST_4((run_vector_tests<std::complex<float> >()));
|
||||
CALL_SUBTEST_5((run_vector_tests<std::complex<double> >()));
|
||||
}
|
||||
|
||||
@@ -163,11 +163,11 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
|
||||
void test_cwiseop()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++) {
|
||||
CALL_SUBTEST( cwiseops(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( cwiseops(Matrix4d()) );
|
||||
CALL_SUBTEST( cwiseops(MatrixXf(3, 3)) );
|
||||
CALL_SUBTEST( cwiseops(MatrixXf(22, 22)) );
|
||||
CALL_SUBTEST( cwiseops(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( cwiseops(MatrixXd(20, 20)) );
|
||||
CALL_SUBTEST_1( cwiseops(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( cwiseops(Matrix4d()) );
|
||||
CALL_SUBTEST_3( cwiseops(MatrixXf(3, 3)) );
|
||||
CALL_SUBTEST_4( cwiseops(MatrixXf(22, 22)) );
|
||||
CALL_SUBTEST_5( cwiseops(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_6( cwiseops(MatrixXd(20, 20)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ template<typename MatrixType> void determinant(const MatrixType& m)
|
||||
void test_determinant()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( determinant(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( determinant(Matrix<double, 2, 2>()) );
|
||||
CALL_SUBTEST( determinant(Matrix<double, 3, 3>()) );
|
||||
CALL_SUBTEST( determinant(Matrix<double, 4, 4>()) );
|
||||
CALL_SUBTEST( determinant(Matrix<std::complex<double>, 10, 10>()) );
|
||||
CALL_SUBTEST( determinant(MatrixXd(20, 20)) );
|
||||
CALL_SUBTEST_1( determinant(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( determinant(Matrix<double, 2, 2>()) );
|
||||
CALL_SUBTEST_3( determinant(Matrix<double, 3, 3>()) );
|
||||
CALL_SUBTEST_4( determinant(Matrix<double, 4, 4>()) );
|
||||
CALL_SUBTEST_5( determinant(Matrix<std::complex<double>, 10, 10>()) );
|
||||
CALL_SUBTEST_6( determinant(MatrixXd(20, 20)) );
|
||||
}
|
||||
CALL_SUBTEST( determinant(MatrixXd(200, 200)) );
|
||||
CALL_SUBTEST_6( determinant(MatrixXd(200, 200)) );
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
|
||||
void test_diagonalmatrices()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix3f()) );
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix<double,3,3,RowMajor>()) );
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix4d()) );
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix<float,4,4,RowMajor>()) );
|
||||
CALL_SUBTEST( diagonalmatrices(MatrixXcf(3, 5)) );
|
||||
CALL_SUBTEST( diagonalmatrices(MatrixXi(10, 8)) );
|
||||
CALL_SUBTEST( diagonalmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
|
||||
CALL_SUBTEST( diagonalmatrices(MatrixXf(21, 24)) );
|
||||
CALL_SUBTEST_1( diagonalmatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( diagonalmatrices(Matrix3f()) );
|
||||
CALL_SUBTEST_3( diagonalmatrices(Matrix<double,3,3,RowMajor>()) );
|
||||
CALL_SUBTEST_4( diagonalmatrices(Matrix4d()) );
|
||||
CALL_SUBTEST_5( diagonalmatrices(Matrix<float,4,4,RowMajor>()) );
|
||||
CALL_SUBTEST_6( diagonalmatrices(MatrixXcf(3, 5)) );
|
||||
CALL_SUBTEST_7( diagonalmatrices(MatrixXi(10, 8)) );
|
||||
CALL_SUBTEST_8( diagonalmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
|
||||
CALL_SUBTEST_9( diagonalmatrices(MatrixXf(21, 24)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +112,11 @@ void test_dynalloc()
|
||||
|
||||
for (int i=0; i<g_repeat*100; ++i)
|
||||
{
|
||||
CALL_SUBTEST( check_dynaligned<Vector4f>() );
|
||||
CALL_SUBTEST( check_dynaligned<Vector2d>() );
|
||||
CALL_SUBTEST( check_dynaligned<Matrix4f>() );
|
||||
CALL_SUBTEST( check_dynaligned<Vector4d>() );
|
||||
CALL_SUBTEST( check_dynaligned<Vector4i>() );
|
||||
CALL_SUBTEST(check_dynaligned<Vector4f>() );
|
||||
CALL_SUBTEST(check_dynaligned<Vector2d>() );
|
||||
CALL_SUBTEST(check_dynaligned<Matrix4f>() );
|
||||
CALL_SUBTEST(check_dynaligned<Vector4d>() );
|
||||
CALL_SUBTEST(check_dynaligned<Vector4i>() );
|
||||
}
|
||||
|
||||
// check static allocation, who knows ?
|
||||
|
||||
@@ -54,8 +54,8 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
|
||||
void test_eigensolver_complex()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( eigensolver(Matrix4cf()) );
|
||||
CALL_SUBTEST2( eigensolver(MatrixXcd(14,14)) );
|
||||
CALL_SUBTEST_1( eigensolver(Matrix4cf()) );
|
||||
CALL_SUBTEST_2( eigensolver(MatrixXcd(14,14)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,18 +75,18 @@ template<typename MatrixType> void eigensolver_verify_assert()
|
||||
void test_eigensolver_generic()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( eigensolver(Matrix4f()) );
|
||||
CALL_SUBTEST2( eigensolver(MatrixXd(17,17)) );
|
||||
CALL_SUBTEST_1( eigensolver(Matrix4f()) );
|
||||
CALL_SUBTEST_2( eigensolver(MatrixXd(17,17)) );
|
||||
|
||||
// some trivial but implementation-wise tricky cases
|
||||
CALL_SUBTEST2( eigensolver(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST2( eigensolver(MatrixXd(2,2)) );
|
||||
CALL_SUBTEST3( eigensolver(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST4( eigensolver(Matrix2d()) );
|
||||
CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
|
||||
CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST_4( eigensolver(Matrix2d()) );
|
||||
}
|
||||
|
||||
CALL_SUBTEST1( eigensolver_verify_assert<Matrix4f>() );
|
||||
CALL_SUBTEST2( eigensolver_verify_assert<MatrixXd>() );
|
||||
CALL_SUBTEST4( eigensolver_verify_assert<Matrix2d>() );
|
||||
CALL_SUBTEST5( eigensolver_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST_1( eigensolver_verify_assert<Matrix4f>() );
|
||||
CALL_SUBTEST_2( eigensolver_verify_assert<MatrixXd>() );
|
||||
CALL_SUBTEST_4( eigensolver_verify_assert<Matrix2d>() );
|
||||
CALL_SUBTEST_5( eigensolver_verify_assert<MatrixXf>() );
|
||||
}
|
||||
|
||||
@@ -117,17 +117,17 @@ void test_eigensolver_selfadjoint()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
// very important to test a 3x3 matrix since we provide a special path for it
|
||||
CALL_SUBTEST1( selfadjointeigensolver(Matrix3f()) );
|
||||
CALL_SUBTEST2( selfadjointeigensolver(Matrix4d()) );
|
||||
CALL_SUBTEST3( selfadjointeigensolver(MatrixXf(10,10)) );
|
||||
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(19,19)) );
|
||||
CALL_SUBTEST5( selfadjointeigensolver(MatrixXcd(17,17)) );
|
||||
CALL_SUBTEST_1( selfadjointeigensolver(Matrix3f()) );
|
||||
CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );
|
||||
CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(10,10)) );
|
||||
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(19,19)) );
|
||||
CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(17,17)) );
|
||||
|
||||
// some trivial but implementation-wise tricky cases
|
||||
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(2,2)) );
|
||||
CALL_SUBTEST6( selfadjointeigensolver(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST7( selfadjointeigensolver(Matrix<double,2,2>()) );
|
||||
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(1,1)) );
|
||||
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(2,2)) );
|
||||
CALL_SUBTEST_6( selfadjointeigensolver(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST_7( selfadjointeigensolver(Matrix<double,2,2>()) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
|
||||
void test_geo_alignedbox()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( alignedbox(AlignedBox<float,2>()) );
|
||||
CALL_SUBTEST( alignedbox(AlignedBox<float,3>()) );
|
||||
CALL_SUBTEST( alignedbox(AlignedBox<double,4>()) );
|
||||
CALL_SUBTEST_1( alignedbox(AlignedBox<float,2>()) );
|
||||
CALL_SUBTEST_2( alignedbox(AlignedBox<float,3>()) );
|
||||
CALL_SUBTEST_3( alignedbox(AlignedBox<double,4>()) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ template<typename Scalar> void eulerangles(void)
|
||||
void test_geo_eulerangles()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( eulerangles<float>() );
|
||||
CALL_SUBTEST( eulerangles<double>() );
|
||||
CALL_SUBTEST_1( eulerangles<float>() );
|
||||
CALL_SUBTEST_2( eulerangles<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ template<typename Scalar,int Size> void homogeneous(void)
|
||||
void test_geo_homogeneous()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
// CALL_SUBTEST(( homogeneous<float,1>() ));
|
||||
CALL_SUBTEST(( homogeneous<double,3>() ));
|
||||
// CALL_SUBTEST(( homogeneous<double,8>() ));
|
||||
CALL_SUBTEST_1(( homogeneous<float,1>() ));
|
||||
CALL_SUBTEST_2(( homogeneous<double,3>() ));
|
||||
CALL_SUBTEST_3(( homogeneous<double,8>() ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ template<typename Scalar> void lines()
|
||||
void test_geo_hyperplane()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( hyperplane(Hyperplane<float,2>()) );
|
||||
CALL_SUBTEST( hyperplane(Hyperplane<float,3>()) );
|
||||
CALL_SUBTEST( hyperplane(Hyperplane<double,4>()) );
|
||||
CALL_SUBTEST( hyperplane(Hyperplane<std::complex<double>,5>()) );
|
||||
CALL_SUBTEST( lines<float>() );
|
||||
CALL_SUBTEST( lines<double>() );
|
||||
CALL_SUBTEST_1( hyperplane(Hyperplane<float,2>()) );
|
||||
CALL_SUBTEST_2( hyperplane(Hyperplane<float,3>()) );
|
||||
CALL_SUBTEST_3( hyperplane(Hyperplane<double,4>()) );
|
||||
CALL_SUBTEST_4( hyperplane(Hyperplane<std::complex<double>,5>()) );
|
||||
CALL_SUBTEST_1( lines<float>() );
|
||||
CALL_SUBTEST_2( lines<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,15 +113,15 @@ template<typename Scalar, int Size> void orthomethods(int size=Size)
|
||||
void test_geo_orthomethods()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( orthomethods_3<float>() );
|
||||
CALL_SUBTEST( orthomethods_3<double>() );
|
||||
CALL_SUBTEST( (orthomethods<float,2>()) );
|
||||
CALL_SUBTEST( (orthomethods<double,2>()) );
|
||||
CALL_SUBTEST( (orthomethods<float,3>()) );
|
||||
CALL_SUBTEST( (orthomethods<double,3>()) );
|
||||
CALL_SUBTEST( (orthomethods<float,7>()) );
|
||||
CALL_SUBTEST( (orthomethods<std::complex<double>,8>()) );
|
||||
CALL_SUBTEST( (orthomethods<float,Dynamic>(36)) );
|
||||
CALL_SUBTEST( (orthomethods<double,Dynamic>(35)) );
|
||||
CALL_SUBTEST_1( orthomethods_3<float>() );
|
||||
CALL_SUBTEST_2( orthomethods_3<double>() );
|
||||
CALL_SUBTEST_1( (orthomethods<float,2>()) );
|
||||
CALL_SUBTEST_2( (orthomethods<double,2>()) );
|
||||
CALL_SUBTEST_1( (orthomethods<float,3>()) );
|
||||
CALL_SUBTEST_2( (orthomethods<double,3>()) );
|
||||
CALL_SUBTEST_3( (orthomethods<float,7>()) );
|
||||
CALL_SUBTEST_4( (orthomethods<std::complex<double>,8>()) );
|
||||
CALL_SUBTEST_5( (orthomethods<float,Dynamic>(36)) );
|
||||
CALL_SUBTEST_6( (orthomethods<double,Dynamic>(35)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ template<typename LineType> void parametrizedline(const LineType& _line)
|
||||
void test_geo_parametrizedline()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( parametrizedline(ParametrizedLine<float,2>()) );
|
||||
CALL_SUBTEST( parametrizedline(ParametrizedLine<float,3>()) );
|
||||
CALL_SUBTEST( parametrizedline(ParametrizedLine<double,4>()) );
|
||||
CALL_SUBTEST( parametrizedline(ParametrizedLine<std::complex<double>,5>()) );
|
||||
CALL_SUBTEST_1( parametrizedline(ParametrizedLine<float,2>()) );
|
||||
CALL_SUBTEST_2( parametrizedline(ParametrizedLine<float,3>()) );
|
||||
CALL_SUBTEST_3( parametrizedline(ParametrizedLine<double,4>()) );
|
||||
CALL_SUBTEST_4( parametrizedline(ParametrizedLine<std::complex<double>,5>()) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +92,12 @@ template<typename Scalar> void quaternion(void)
|
||||
VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized());
|
||||
VERIFY_IS_APPROX( v1.normalized(),(q2.setFromTwoVectors(v1, v1)*v1).normalized());
|
||||
VERIFY_IS_APPROX(-v1.normalized(),(q2.setFromTwoVectors(v1,-v1)*v1).normalized());
|
||||
v3 = v1.cwise()+eps;
|
||||
VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized());
|
||||
VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized());
|
||||
if (ei_is_same_type<Scalar,double>::ret)
|
||||
{
|
||||
v3 = v1.cwise()+eps;
|
||||
VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized());
|
||||
VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized());
|
||||
}
|
||||
|
||||
// inverse and conjugate
|
||||
VERIFY_IS_APPROX(q1 * (q1.inverse() * v1), v1);
|
||||
@@ -110,7 +113,7 @@ template<typename Scalar> void quaternion(void)
|
||||
void test_geo_quaternion()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
// CALL_SUBTEST( quaternion<float>() );
|
||||
CALL_SUBTEST( quaternion<double>() );
|
||||
CALL_SUBTEST_1( quaternion<float>() );
|
||||
CALL_SUBTEST_2( quaternion<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,16 +298,19 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
VERIFY_IS_APPROX((t0 * v1).template start<3>(), AlignedScaling3(v0) * v1);
|
||||
|
||||
// test transform inversion
|
||||
if(Mode!=AffineCompact)
|
||||
{
|
||||
t0.setIdentity();
|
||||
t0.translate(v0);
|
||||
t0.linear().setRandom();
|
||||
VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t0.matrix().inverse());
|
||||
t0.setIdentity();
|
||||
t0.translate(v0).rotate(q1);
|
||||
VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t0.matrix().inverse());
|
||||
}
|
||||
t0.setIdentity();
|
||||
t0.translate(v0);
|
||||
t0.linear().setRandom();
|
||||
Matrix4 t044 = Matrix4::Zero();
|
||||
t044(3,3) = 1;
|
||||
t044.block(0,0,t0.matrix().rows(),4) = t0.matrix();
|
||||
VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4));
|
||||
t0.setIdentity();
|
||||
t0.translate(v0).rotate(q1);
|
||||
t044 = Matrix4::Zero();
|
||||
t044(3,3) = 1;
|
||||
t044.block(0,0,t0.matrix().rows(),4) = t0.matrix();
|
||||
VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4));
|
||||
|
||||
// test extract rotation and aligned scaling
|
||||
// t0.setIdentity();
|
||||
@@ -354,9 +357,8 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
void test_geo_transformations()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
// CALL_SUBTEST( transformations<float>() );
|
||||
CALL_SUBTEST(( transformations<double,Affine>() ));
|
||||
CALL_SUBTEST(( transformations<double,AffineCompact>() ));
|
||||
CALL_SUBTEST(( transformations<double,Projective>() ));
|
||||
CALL_SUBTEST_1(( transformations<double,Affine>() ));
|
||||
CALL_SUBTEST_2(( transformations<float,AffineCompact>() ));
|
||||
CALL_SUBTEST_3(( transformations<double,Projective>() ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +92,12 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
||||
void test_householder()
|
||||
{
|
||||
for(int i = 0; i < 2*g_repeat; i++) {
|
||||
CALL_SUBTEST( householder(Matrix<double,2,2>()) );
|
||||
CALL_SUBTEST( householder(Matrix<float,2,3>()) );
|
||||
CALL_SUBTEST( householder(Matrix<double,3,5>()) );
|
||||
CALL_SUBTEST( householder(Matrix<float,4,4>()) );
|
||||
CALL_SUBTEST( householder(MatrixXd(10,12)) );
|
||||
CALL_SUBTEST( householder(MatrixXcf(16,17)) );
|
||||
CALL_SUBTEST_1( householder(Matrix<double,2,2>()) );
|
||||
CALL_SUBTEST_2( householder(Matrix<float,2,3>()) );
|
||||
CALL_SUBTEST_3( householder(Matrix<double,3,5>()) );
|
||||
CALL_SUBTEST_4( householder(Matrix<float,4,4>()) );
|
||||
CALL_SUBTEST_5( householder(MatrixXd(10,12)) );
|
||||
CALL_SUBTEST_6( householder(MatrixXcf(16,17)) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ void test_inverse()
|
||||
{
|
||||
int s;
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( inverse(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST2( inverse(Matrix2d()) );
|
||||
CALL_SUBTEST3( inverse(Matrix3f()) );
|
||||
CALL_SUBTEST4( inverse(Matrix4f()) );
|
||||
CALL_SUBTEST_1( inverse(Matrix<double,1,1>()) );
|
||||
CALL_SUBTEST_2( inverse(Matrix2d()) );
|
||||
CALL_SUBTEST_3( inverse(Matrix3f()) );
|
||||
CALL_SUBTEST_4( inverse(Matrix4f()) );
|
||||
s = ei_random<int>(50,320);
|
||||
CALL_SUBTEST5( inverse(MatrixXf(s,s)) );
|
||||
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
|
||||
s = ei_random<int>(25,100);
|
||||
CALL_SUBTEST6( inverse(MatrixXcd(s,s)) );
|
||||
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );
|
||||
}
|
||||
|
||||
#ifdef EIGEN_TEST_PART_4
|
||||
|
||||
@@ -80,27 +80,27 @@ void test_jacobisvd()
|
||||
Matrix2cd m;
|
||||
m << 0, 1,
|
||||
0, 1;
|
||||
CALL_SUBTEST(( svd<Matrix2cd,0>(m, false) ));
|
||||
CALL_SUBTEST_1(( svd<Matrix2cd,0>(m, false) ));
|
||||
m << 1, 0,
|
||||
1, 0;
|
||||
CALL_SUBTEST(( svd<Matrix2cd,0>(m, false) ));
|
||||
CALL_SUBTEST_1(( svd<Matrix2cd,0>(m, false) ));
|
||||
Matrix2d n;
|
||||
n << 1, 1,
|
||||
1, -1;
|
||||
CALL_SUBTEST(( svd<Matrix2d,0>(n, false) ));
|
||||
CALL_SUBTEST(( svd<Matrix3f,0>() ));
|
||||
CALL_SUBTEST(( svd<Matrix4d,Square>() ));
|
||||
CALL_SUBTEST(( svd<Matrix<float,3,5> , AtLeastAsManyColsAsRows>() ));
|
||||
CALL_SUBTEST(( svd<Matrix<double,Dynamic,2> , AtLeastAsManyRowsAsCols>(Matrix<double,Dynamic,2>(10,2)) ));
|
||||
CALL_SUBTEST_2(( svd<Matrix2d,0>(n, false) ));
|
||||
CALL_SUBTEST_3(( svd<Matrix3f,0>() ));
|
||||
CALL_SUBTEST_4(( svd<Matrix4d,Square>() ));
|
||||
CALL_SUBTEST_5(( svd<Matrix<float,3,5> , AtLeastAsManyColsAsRows>() ));
|
||||
CALL_SUBTEST_6(( svd<Matrix<double,Dynamic,2> , AtLeastAsManyRowsAsCols>(Matrix<double,Dynamic,2>(10,2)) ));
|
||||
|
||||
CALL_SUBTEST(( svd<MatrixXf,Square>(MatrixXf(50,50)) ));
|
||||
CALL_SUBTEST(( svd<MatrixXcd,AtLeastAsManyRowsAsCols>(MatrixXcd(14,7)) ));
|
||||
CALL_SUBTEST_7(( svd<MatrixXf,Square>(MatrixXf(50,50)) ));
|
||||
CALL_SUBTEST_8(( svd<MatrixXcd,AtLeastAsManyRowsAsCols>(MatrixXcd(14,7)) ));
|
||||
}
|
||||
CALL_SUBTEST(( svd<MatrixXf,0>(MatrixXf(300,200)) ));
|
||||
CALL_SUBTEST(( svd<MatrixXcd,AtLeastAsManyColsAsRows>(MatrixXcd(100,150)) ));
|
||||
CALL_SUBTEST_9(( svd<MatrixXf,0>(MatrixXf(300,200)) ));
|
||||
CALL_SUBTEST_10(( svd<MatrixXcd,AtLeastAsManyColsAsRows>(MatrixXcd(100,150)) ));
|
||||
|
||||
CALL_SUBTEST(( svd_verify_assert<Matrix3f>() ));
|
||||
CALL_SUBTEST(( svd_verify_assert<Matrix3d>() ));
|
||||
CALL_SUBTEST(( svd_verify_assert<MatrixXf>() ));
|
||||
CALL_SUBTEST(( svd_verify_assert<MatrixXd>() ));
|
||||
CALL_SUBTEST_3(( svd_verify_assert<Matrix3f>() ));
|
||||
CALL_SUBTEST_3(( svd_verify_assert<Matrix3d>() ));
|
||||
CALL_SUBTEST_9(( svd_verify_assert<MatrixXf>() ));
|
||||
CALL_SUBTEST_11(( svd_verify_assert<MatrixXd>() ));
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
|
||||
void test_linearstructure()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( linearStructure(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( linearStructure(Matrix2f()) );
|
||||
CALL_SUBTEST( linearStructure(Vector3d()) );
|
||||
CALL_SUBTEST( linearStructure(Matrix4d()) );
|
||||
CALL_SUBTEST( linearStructure(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( linearStructure(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST( linearStructure(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( linearStructure(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST_1( linearStructure(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( linearStructure(Matrix2f()) );
|
||||
CALL_SUBTEST_3( linearStructure(Vector3d()) );
|
||||
CALL_SUBTEST_4( linearStructure(Matrix4d()) );
|
||||
CALL_SUBTEST_5( linearStructure(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_6( linearStructure(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST_7( linearStructure(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_8( linearStructure(MatrixXcd(20, 20)) );
|
||||
}
|
||||
}
|
||||
|
||||
54
test/lu.cpp
54
test/lu.cpp
@@ -58,13 +58,13 @@ template<typename MatrixType> void lu_non_invertible()
|
||||
int rank = ei_random<int>(1, std::min(rows, cols)-1);
|
||||
|
||||
// The image of the zero matrix should consist of a single (zero) column vector
|
||||
VERIFY((MatrixType::Zero(rows,cols).lu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
||||
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
||||
|
||||
MatrixType m1(rows, cols), m3(rows, cols2);
|
||||
CMatrixType m2(cols, cols2);
|
||||
createRandomMatrixOfRank(rank, rows, cols, m1);
|
||||
|
||||
LU<MatrixType> lu(m1);
|
||||
FullPivLU<MatrixType> lu(m1);
|
||||
KernelMatrixType m1kernel = lu.kernel();
|
||||
ImageMatrixType m1image = lu.image(m1);
|
||||
|
||||
@@ -75,20 +75,16 @@ template<typename MatrixType> void lu_non_invertible()
|
||||
VERIFY(!lu.isInvertible());
|
||||
VERIFY(!lu.isSurjective());
|
||||
VERIFY((m1 * m1kernel).isMuchSmallerThan(m1));
|
||||
VERIFY(m1image.lu().rank() == rank);
|
||||
VERIFY(m1image.fullPivLu().rank() == rank);
|
||||
DynamicMatrixType sidebyside(m1.rows(), m1.cols() + m1image.cols());
|
||||
sidebyside << m1, m1image;
|
||||
VERIFY(sidebyside.lu().rank() == rank);
|
||||
VERIFY(sidebyside.fullPivLu().rank() == rank);
|
||||
m2 = CMatrixType::Random(cols,cols2);
|
||||
m3 = m1*m2;
|
||||
m2 = CMatrixType::Random(cols,cols2);
|
||||
// test that the code, which does resize(), may be applied to an xpr
|
||||
m2.block(0,0,m2.rows(),m2.cols()) = lu.solve(m3);
|
||||
VERIFY_IS_APPROX(m3, m1*m2);
|
||||
|
||||
CMatrixType m4(cols, cols), m5(cols, cols);
|
||||
createRandomMatrixOfRank(cols/2, cols, cols, m4);
|
||||
VERIFY(!m4.computeInverseWithCheck(&m5));
|
||||
}
|
||||
|
||||
template<typename MatrixType> void lu_invertible()
|
||||
@@ -109,14 +105,14 @@ template<typename MatrixType> void lu_invertible()
|
||||
m1 += a * a.adjoint();
|
||||
}
|
||||
|
||||
LU<MatrixType> lu(m1);
|
||||
FullPivLU<MatrixType> lu(m1);
|
||||
VERIFY(0 == lu.dimensionOfKernel());
|
||||
VERIFY(lu.kernel().cols() == 1); // the kernel() should consist of a single (zero) column vector
|
||||
VERIFY(size == lu.rank());
|
||||
VERIFY(lu.isInjective());
|
||||
VERIFY(lu.isSurjective());
|
||||
VERIFY(lu.isInvertible());
|
||||
VERIFY(lu.image(m1).lu().isInvertible());
|
||||
VERIFY(lu.image(m1).fullPivLu().isInvertible());
|
||||
m3 = MatrixType::Random(size,size);
|
||||
m2 = lu.solve(m3);
|
||||
VERIFY_IS_APPROX(m3, m1*m2);
|
||||
@@ -127,7 +123,7 @@ template<typename MatrixType> void lu_verify_assert()
|
||||
{
|
||||
MatrixType tmp;
|
||||
|
||||
LU<MatrixType> lu;
|
||||
FullPivLU<MatrixType> lu;
|
||||
VERIFY_RAISES_ASSERT(lu.matrixLU())
|
||||
VERIFY_RAISES_ASSERT(lu.permutationP())
|
||||
VERIFY_RAISES_ASSERT(lu.permutationQ())
|
||||
@@ -142,10 +138,10 @@ template<typename MatrixType> void lu_verify_assert()
|
||||
VERIFY_RAISES_ASSERT(lu.isInvertible())
|
||||
VERIFY_RAISES_ASSERT(lu.inverse())
|
||||
|
||||
PartialLU<MatrixType> plu;
|
||||
PartialPivLU<MatrixType> plu;
|
||||
VERIFY_RAISES_ASSERT(plu.matrixLU())
|
||||
VERIFY_RAISES_ASSERT(plu.permutationP())
|
||||
VERIFY_RAISES_ASSERT(plu.solve(tmp,&tmp))
|
||||
VERIFY_RAISES_ASSERT(plu.solve(tmp))
|
||||
VERIFY_RAISES_ASSERT(plu.determinant())
|
||||
VERIFY_RAISES_ASSERT(plu.inverse())
|
||||
}
|
||||
@@ -153,26 +149,26 @@ template<typename MatrixType> void lu_verify_assert()
|
||||
void test_lu()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( lu_non_invertible<Matrix3f>() );
|
||||
CALL_SUBTEST1( lu_verify_assert<Matrix3f>() );
|
||||
CALL_SUBTEST_1( lu_non_invertible<Matrix3f>() );
|
||||
CALL_SUBTEST_1( lu_verify_assert<Matrix3f>() );
|
||||
|
||||
CALL_SUBTEST2( (lu_non_invertible<Matrix<double, 4, 6> >()) );
|
||||
CALL_SUBTEST2( (lu_verify_assert<Matrix<double, 4, 6> >()) );
|
||||
CALL_SUBTEST_2( (lu_non_invertible<Matrix<double, 4, 6> >()) );
|
||||
CALL_SUBTEST_2( (lu_verify_assert<Matrix<double, 4, 6> >()) );
|
||||
|
||||
CALL_SUBTEST3( lu_non_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST3( lu_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST3( lu_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST_3( lu_non_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST_3( lu_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST_3( lu_verify_assert<MatrixXf>() );
|
||||
|
||||
CALL_SUBTEST4( lu_non_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST4( lu_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST4( lu_verify_assert<MatrixXd>() );
|
||||
CALL_SUBTEST_4( lu_non_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST_4( lu_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST_4( lu_verify_assert<MatrixXd>() );
|
||||
|
||||
CALL_SUBTEST5( lu_non_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST5( lu_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST5( lu_verify_assert<MatrixXcf>() );
|
||||
CALL_SUBTEST_5( lu_non_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST_5( lu_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST_5( lu_verify_assert<MatrixXcf>() );
|
||||
|
||||
CALL_SUBTEST6( lu_non_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST6( lu_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST6( lu_verify_assert<MatrixXcd>() );
|
||||
CALL_SUBTEST_6( lu_non_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST_6( lu_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST_6( lu_verify_assert<MatrixXcd>() );
|
||||
}
|
||||
}
|
||||
|
||||
76
test/main.h
76
test/main.h
@@ -171,63 +171,99 @@ namespace Eigen
|
||||
} while (0)
|
||||
|
||||
#ifdef EIGEN_TEST_PART_1
|
||||
#define CALL_SUBTEST1(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_1(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST1(FUNC)
|
||||
#define CALL_SUBTEST_1(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_2
|
||||
#define CALL_SUBTEST2(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_2(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST2(FUNC)
|
||||
#define CALL_SUBTEST_2(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_3
|
||||
#define CALL_SUBTEST3(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_3(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST3(FUNC)
|
||||
#define CALL_SUBTEST_3(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_4
|
||||
#define CALL_SUBTEST4(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_4(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST4(FUNC)
|
||||
#define CALL_SUBTEST_4(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_5
|
||||
#define CALL_SUBTEST5(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_5(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST5(FUNC)
|
||||
#define CALL_SUBTEST_5(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_6
|
||||
#define CALL_SUBTEST6(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_6(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST6(FUNC)
|
||||
#define CALL_SUBTEST_6(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_7
|
||||
#define CALL_SUBTEST7(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_7(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST7(FUNC)
|
||||
#define CALL_SUBTEST_7(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_8
|
||||
#define CALL_SUBTEST8(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_8(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST8(FUNC)
|
||||
#define CALL_SUBTEST_8(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_9
|
||||
#define CALL_SUBTEST9(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_9(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST9(FUNC)
|
||||
#define CALL_SUBTEST_9(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_10
|
||||
#define CALL_SUBTEST10(FUNC) CALL_SUBTEST(FUNC)
|
||||
#define CALL_SUBTEST_10(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST10(FUNC)
|
||||
#define CALL_SUBTEST_10(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_11
|
||||
#define CALL_SUBTEST_11(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_11(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_12
|
||||
#define CALL_SUBTEST_12(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_12(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_13
|
||||
#define CALL_SUBTEST_13(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_13(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_14
|
||||
#define CALL_SUBTEST_14(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_14(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_15
|
||||
#define CALL_SUBTEST_15(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_15(FUNC)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_16
|
||||
#define CALL_SUBTEST_16(FUNC) CALL_SUBTEST(FUNC)
|
||||
#else
|
||||
#define CALL_SUBTEST_16(FUNC)
|
||||
#endif
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
20
test/map.cpp
20
test/map.cpp
@@ -80,16 +80,16 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
|
||||
void test_map()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( map_class(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( map_class(Vector4d()) );
|
||||
CALL_SUBTEST( map_class(RowVector4f()) );
|
||||
CALL_SUBTEST( map_class(VectorXcf(8)) );
|
||||
CALL_SUBTEST( map_class(VectorXi(12)) );
|
||||
CALL_SUBTEST_1( map_class(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( map_class(Vector4d()) );
|
||||
CALL_SUBTEST_3( map_class(RowVector4f()) );
|
||||
CALL_SUBTEST_4( map_class(VectorXcf(8)) );
|
||||
CALL_SUBTEST_5( map_class(VectorXi(12)) );
|
||||
|
||||
CALL_SUBTEST( map_static_methods(Matrix<double, 1, 1>()) );
|
||||
CALL_SUBTEST( map_static_methods(Vector3f()) );
|
||||
CALL_SUBTEST( map_static_methods(RowVector3d()) );
|
||||
CALL_SUBTEST( map_static_methods(VectorXcd(8)) );
|
||||
CALL_SUBTEST( map_static_methods(VectorXf(12)) );
|
||||
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)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
|
||||
void test_miscmatrices()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( miscMatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( miscMatrices(Matrix4d()) );
|
||||
CALL_SUBTEST( miscMatrices(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( miscMatrices(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( miscMatrices(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST_1( miscMatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( miscMatrices(Matrix4d()) );
|
||||
CALL_SUBTEST_3( miscMatrices(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_4( miscMatrices(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_5( miscMatrices(MatrixXcd(20, 20)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,10 +174,10 @@ template<int SizeAtCompileType> void mixingtypes_small()
|
||||
void test_mixingtypes()
|
||||
{
|
||||
// check that our operator new is indeed called:
|
||||
CALL_SUBTEST(mixingtypes<3>());
|
||||
CALL_SUBTEST(mixingtypes<4>());
|
||||
CALL_SUBTEST(mixingtypes<Dynamic>(20));
|
||||
CALL_SUBTEST_1(mixingtypes<3>());
|
||||
CALL_SUBTEST_2(mixingtypes<4>());
|
||||
CALL_SUBTEST_3(mixingtypes<Dynamic>(20));
|
||||
|
||||
CALL_SUBTEST(mixingtypes_small<4>());
|
||||
CALL_SUBTEST(mixingtypes_large(20));
|
||||
CALL_SUBTEST_4(mixingtypes_small<4>());
|
||||
CALL_SUBTEST_5(mixingtypes_large(20));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void test_nomalloc()
|
||||
{
|
||||
// check that our operator new is indeed called:
|
||||
VERIFY_RAISES_ASSERT(MatrixXd dummy = MatrixXd::Random(3,3));
|
||||
CALL_SUBTEST( nomalloc(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( nomalloc(Matrix4d()) );
|
||||
CALL_SUBTEST( nomalloc(Matrix<float,32,32>()) );
|
||||
CALL_SUBTEST(nomalloc(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST(nomalloc(Matrix4d()) );
|
||||
CALL_SUBTEST(nomalloc(Matrix<float,32,32>()) );
|
||||
}
|
||||
|
||||
@@ -233,12 +233,12 @@ template<typename Scalar> void packetmath_real()
|
||||
void test_packetmath()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( packetmath<float>() );
|
||||
CALL_SUBTEST( packetmath<double>() );
|
||||
CALL_SUBTEST( packetmath<int>() );
|
||||
CALL_SUBTEST( packetmath<std::complex<float> >() );
|
||||
CALL_SUBTEST_1( packetmath<float>() );
|
||||
CALL_SUBTEST_2( packetmath<double>() );
|
||||
CALL_SUBTEST_3( packetmath<int>() );
|
||||
CALL_SUBTEST_1( packetmath<std::complex<float> >() );
|
||||
|
||||
CALL_SUBTEST( packetmath_real<float>() );
|
||||
CALL_SUBTEST( packetmath_real<double>() );
|
||||
CALL_SUBTEST_1( packetmath_real<float>() );
|
||||
CALL_SUBTEST_2( packetmath_real<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
||||
void test_product_extra()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( product_extra(MatrixXf(ei_random<int>(2,320), ei_random<int>(2,320))) );
|
||||
CALL_SUBTEST2( product_extra(MatrixXcf(ei_random<int>(50,50), ei_random<int>(50,50))) );
|
||||
CALL_SUBTEST3( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(2,50), ei_random<int>(2,50))) );
|
||||
CALL_SUBTEST_1( product_extra(MatrixXf(ei_random<int>(2,320), ei_random<int>(2,320))) );
|
||||
CALL_SUBTEST_2( product_extra(MatrixXcf(ei_random<int>(50,50), ei_random<int>(50,50))) );
|
||||
CALL_SUBTEST_3( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(2,50), ei_random<int>(2,50))) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
void test_product_large()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
|
||||
CALL_SUBTEST5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
|
||||
CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
}
|
||||
|
||||
#if defined EIGEN_TEST_PART_6
|
||||
|
||||
@@ -117,8 +117,8 @@ void test_product_notemporary()
|
||||
int s;
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
s = ei_random<int>(16,320);
|
||||
CALL_SUBTEST1( product_notemporary(MatrixXf(s, s)) );
|
||||
CALL_SUBTEST_1( product_notemporary(MatrixXf(s, s)) );
|
||||
s = ei_random<int>(16,120);
|
||||
CALL_SUBTEST2( product_notemporary(MatrixXcd(s,s)) );
|
||||
CALL_SUBTEST_2( product_notemporary(MatrixXcd(s,s)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,13 +78,13 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
|
||||
void test_product_selfadjoint()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++) {
|
||||
CALL_SUBTEST1( product_selfadjoint(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST2( product_selfadjoint(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST3( product_selfadjoint(Matrix3d()) );
|
||||
CALL_SUBTEST4( product_selfadjoint(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST5( product_selfadjoint(MatrixXcd(21,21)) );
|
||||
CALL_SUBTEST6( product_selfadjoint(MatrixXd(14,14)) );
|
||||
CALL_SUBTEST7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(17,17)) );
|
||||
CALL_SUBTEST8( product_selfadjoint(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(19, 19)) );
|
||||
CALL_SUBTEST_1( product_selfadjoint(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( product_selfadjoint(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST_3( product_selfadjoint(Matrix3d()) );
|
||||
CALL_SUBTEST_4( product_selfadjoint(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST_5( product_selfadjoint(MatrixXcd(21,21)) );
|
||||
CALL_SUBTEST_6( product_selfadjoint(MatrixXd(14,14)) );
|
||||
CALL_SUBTEST_7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(17,17)) );
|
||||
CALL_SUBTEST_8( product_selfadjoint(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(19, 19)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
void test_product_small()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST1( product(Matrix<float, 3, 2>()) );
|
||||
CALL_SUBTEST2( product(Matrix<int, 3, 5>()) );
|
||||
CALL_SUBTEST3( product(Matrix3d()) );
|
||||
CALL_SUBTEST4( product(Matrix4d()) );
|
||||
CALL_SUBTEST5( product(Matrix4f()) );
|
||||
CALL_SUBTEST_1( product(Matrix<float, 3, 2>()) );
|
||||
CALL_SUBTEST_2( product(Matrix<int, 3, 5>()) );
|
||||
CALL_SUBTEST_3( product(Matrix3d()) );
|
||||
CALL_SUBTEST_4( product(Matrix4d()) );
|
||||
CALL_SUBTEST_5( product(Matrix4f()) );
|
||||
}
|
||||
|
||||
#ifdef EIGEN_TEST_PART_6
|
||||
|
||||
@@ -108,10 +108,10 @@ void test_product_symm()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++)
|
||||
{
|
||||
CALL_SUBTEST1(( symm<float,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST2(( symm<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST_1(( symm<float,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST_2(( symm<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
|
||||
|
||||
CALL_SUBTEST3(( symm<float,Dynamic,1>(ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST4(( symm<std::complex<double>,Dynamic,1>(ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST_3(( symm<float,Dynamic,1>(ei_random<int>(10,320)) ));
|
||||
CALL_SUBTEST_4(( symm<std::complex<double>,Dynamic,1>(ei_random<int>(10,320)) ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ void test_product_syrk()
|
||||
{
|
||||
int s;
|
||||
s = ei_random<int>(10,320);
|
||||
CALL_SUBTEST1( syrk(MatrixXf(s, s)) );
|
||||
CALL_SUBTEST_1( syrk(MatrixXf(s, s)) );
|
||||
s = ei_random<int>(10,320);
|
||||
CALL_SUBTEST2( syrk(MatrixXcd(s, s)) );
|
||||
CALL_SUBTEST_2( syrk(MatrixXcd(s, s)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void test_product_trmm()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++)
|
||||
{
|
||||
CALL_SUBTEST1((trmm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST2((trmm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST_1((trmm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST_2((trmm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ template<typename MatrixType> void trmv(const MatrixType& m)
|
||||
void test_product_trmv()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++) {
|
||||
CALL_SUBTEST1( trmv(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST2( trmv(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST3( trmv(Matrix3d()) );
|
||||
CALL_SUBTEST4( trmv(Matrix<std::complex<float>,23, 23>()) );
|
||||
CALL_SUBTEST5( trmv(MatrixXcd(17,17)) );
|
||||
CALL_SUBTEST6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) );
|
||||
CALL_SUBTEST_1( trmv(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( trmv(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST_3( trmv(Matrix3d()) );
|
||||
CALL_SUBTEST_4( trmv(Matrix<std::complex<float>,23, 23>()) );
|
||||
CALL_SUBTEST_5( trmv(MatrixXcd(17,17)) );
|
||||
CALL_SUBTEST_6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ void test_product_trsm()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++)
|
||||
{
|
||||
CALL_SUBTEST1((trsm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST2((trsm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST_1((trsm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
CALL_SUBTEST_2((trsm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
|
||||
}
|
||||
}
|
||||
|
||||
30
test/qr.cpp
30
test/qr.cpp
@@ -115,24 +115,24 @@ template<typename MatrixType> void qr_verify_assert()
|
||||
void test_qr()
|
||||
{
|
||||
for(int i = 0; i < 1; i++) {
|
||||
CALL_SUBTEST( qr(MatrixXf(47,40)) );
|
||||
CALL_SUBTEST( qr(MatrixXcd(17,7)) );
|
||||
CALL_SUBTEST(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));
|
||||
CALL_SUBTEST(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));
|
||||
CALL_SUBTEST(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));
|
||||
CALL_SUBTEST_1( qr(MatrixXf(47,40)) );
|
||||
CALL_SUBTEST_2( qr(MatrixXcd(17,7)) );
|
||||
CALL_SUBTEST_3(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));
|
||||
CALL_SUBTEST_4(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));
|
||||
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));
|
||||
}
|
||||
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST_6( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST_7( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST_8( qr_invertible<MatrixXcd>() );
|
||||
}
|
||||
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
|
||||
CALL_SUBTEST_9(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST_10(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST_6(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST_7(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST_8(qr_verify_assert<MatrixXcd>());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename MatrixType> void qr()
|
||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType;
|
||||
MatrixType m1;
|
||||
createRandomMatrixOfRank(rank,rows,cols,m1);
|
||||
ColPivotingHouseholderQR<MatrixType> qr(m1);
|
||||
ColPivHouseholderQR<MatrixType> qr(m1);
|
||||
VERIFY_IS_APPROX(rank, qr.rank());
|
||||
VERIFY(cols - qr.rank() == qr.dimensionOfKernel());
|
||||
VERIFY(!qr.isInjective());
|
||||
@@ -74,7 +74,7 @@ template<typename MatrixType, int Cols2> void qr_fixedsize()
|
||||
int rank = ei_random<int>(1, std::min(int(Rows), int(Cols))-1);
|
||||
Matrix<Scalar,Rows,Cols> m1;
|
||||
createRandomMatrixOfRank(rank,Rows,Cols,m1);
|
||||
ColPivotingHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
|
||||
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
|
||||
VERIFY_IS_APPROX(rank, qr.rank());
|
||||
VERIFY(Cols - qr.rank() == qr.dimensionOfKernel());
|
||||
VERIFY(!qr.isInjective());
|
||||
@@ -118,7 +118,7 @@ template<typename MatrixType> void qr_invertible()
|
||||
m1 += a * a.adjoint();
|
||||
}
|
||||
|
||||
ColPivotingHouseholderQR<MatrixType> qr(m1);
|
||||
ColPivHouseholderQR<MatrixType> qr(m1);
|
||||
m3 = MatrixType::Random(size,size);
|
||||
qr.solve(m3, &m2);
|
||||
VERIFY_IS_APPROX(m3, m1*m2);
|
||||
@@ -138,7 +138,7 @@ template<typename MatrixType> void qr_verify_assert()
|
||||
{
|
||||
MatrixType tmp;
|
||||
|
||||
ColPivotingHouseholderQR<MatrixType> qr;
|
||||
ColPivHouseholderQR<MatrixType> qr;
|
||||
VERIFY_RAISES_ASSERT(qr.matrixQR())
|
||||
VERIFY_RAISES_ASSERT(qr.solve(tmp,&tmp))
|
||||
VERIFY_RAISES_ASSERT(qr.matrixQ())
|
||||
@@ -155,24 +155,24 @@ template<typename MatrixType> void qr_verify_assert()
|
||||
void test_qr_colpivoting()
|
||||
{
|
||||
for(int i = 0; i < 1; i++) {
|
||||
CALL_SUBTEST( qr<MatrixXf>() );
|
||||
CALL_SUBTEST( qr<MatrixXd>() );
|
||||
CALL_SUBTEST( qr<MatrixXcd>() );
|
||||
CALL_SUBTEST(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));
|
||||
CALL_SUBTEST(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));
|
||||
CALL_SUBTEST_1( qr<MatrixXf>() );
|
||||
CALL_SUBTEST_2( qr<MatrixXd>() );
|
||||
CALL_SUBTEST_3( qr<MatrixXcd>() );
|
||||
CALL_SUBTEST_4(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));
|
||||
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));
|
||||
}
|
||||
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST_2( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST_6( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );
|
||||
}
|
||||
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
|
||||
CALL_SUBTEST_7(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST_8(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST_6(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename MatrixType> void qr()
|
||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType;
|
||||
MatrixType m1;
|
||||
createRandomMatrixOfRank(rank,rows,cols,m1);
|
||||
FullPivotingHouseholderQR<MatrixType> qr(m1);
|
||||
FullPivHouseholderQR<MatrixType> qr(m1);
|
||||
VERIFY_IS_APPROX(rank, qr.rank());
|
||||
VERIFY(cols - qr.rank() == qr.dimensionOfKernel());
|
||||
VERIFY(!qr.isInjective());
|
||||
@@ -84,7 +84,7 @@ template<typename MatrixType> void qr_invertible()
|
||||
m1 += a * a.adjoint();
|
||||
}
|
||||
|
||||
FullPivotingHouseholderQR<MatrixType> qr(m1);
|
||||
FullPivHouseholderQR<MatrixType> qr(m1);
|
||||
VERIFY(qr.isInjective());
|
||||
VERIFY(qr.isInvertible());
|
||||
VERIFY(qr.isSurjective());
|
||||
@@ -108,7 +108,7 @@ template<typename MatrixType> void qr_verify_assert()
|
||||
{
|
||||
MatrixType tmp;
|
||||
|
||||
FullPivotingHouseholderQR<MatrixType> qr;
|
||||
FullPivHouseholderQR<MatrixType> qr;
|
||||
VERIFY_RAISES_ASSERT(qr.matrixQR())
|
||||
VERIFY_RAISES_ASSERT(qr.solve(tmp,&tmp))
|
||||
VERIFY_RAISES_ASSERT(qr.matrixQ())
|
||||
@@ -126,23 +126,23 @@ void test_qr_fullpivoting()
|
||||
{
|
||||
for(int i = 0; i < 1; i++) {
|
||||
// FIXME : very weird bug here
|
||||
// CALL_SUBTEST( qr(Matrix2f()) );
|
||||
CALL_SUBTEST( qr<MatrixXf>() );
|
||||
CALL_SUBTEST( qr<MatrixXd>() );
|
||||
CALL_SUBTEST( qr<MatrixXcd>() );
|
||||
// CALL_SUBTEST(qr(Matrix2f()) );
|
||||
CALL_SUBTEST_1( qr<MatrixXf>() );
|
||||
CALL_SUBTEST_2( qr<MatrixXd>() );
|
||||
CALL_SUBTEST_3( qr<MatrixXcd>() );
|
||||
}
|
||||
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
|
||||
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
|
||||
CALL_SUBTEST_2( qr_invertible<MatrixXd>() );
|
||||
CALL_SUBTEST_4( qr_invertible<MatrixXcf>() );
|
||||
CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );
|
||||
}
|
||||
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
|
||||
CALL_SUBTEST_5(qr_verify_assert<Matrix3f>());
|
||||
CALL_SUBTEST_6(qr_verify_assert<Matrix3d>());
|
||||
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
|
||||
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
|
||||
CALL_SUBTEST_4(qr_verify_assert<MatrixXcf>());
|
||||
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
|
||||
}
|
||||
|
||||
@@ -112,16 +112,16 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||
void test_redux()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( matrixRedux(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( matrixRedux(Matrix2f()) );
|
||||
CALL_SUBTEST( matrixRedux(Matrix4d()) );
|
||||
CALL_SUBTEST( matrixRedux(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( matrixRedux(MatrixXd(8, 12)) );
|
||||
CALL_SUBTEST( matrixRedux(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( matrixRedux(Matrix2f()) );
|
||||
CALL_SUBTEST_3( matrixRedux(Matrix4d()) );
|
||||
CALL_SUBTEST_4( matrixRedux(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_5( matrixRedux(MatrixXd(8, 12)) );
|
||||
CALL_SUBTEST_6( matrixRedux(MatrixXi(8, 12)) );
|
||||
}
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( vectorRedux(Vector4f()) );
|
||||
CALL_SUBTEST( vectorRedux(VectorXd(10)) );
|
||||
CALL_SUBTEST( vectorRedux(VectorXf(33)) );
|
||||
CALL_SUBTEST_7( vectorRedux(Vector4f()) );
|
||||
CALL_SUBTEST_5( vectorRedux(VectorXd(10)) );
|
||||
CALL_SUBTEST_8( vectorRedux(VectorXf(33)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ void test_regression()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++)
|
||||
{
|
||||
#ifdef EIGEN_TEST_PART_1
|
||||
{
|
||||
Vector2f points2f [1000];
|
||||
Vector2f *points2f_ptrs [1000];
|
||||
@@ -108,7 +109,9 @@ void test_regression()
|
||||
CALL_SUBTEST(check_linearRegression(100, points2f_ptrs, coeffs2f, 0.01f));
|
||||
CALL_SUBTEST(check_linearRegression(1000, points2f_ptrs, coeffs2f, 0.002f));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_2
|
||||
{
|
||||
Vector2f points2f [1000];
|
||||
Vector2f *points2f_ptrs [1000];
|
||||
@@ -119,7 +122,9 @@ void test_regression()
|
||||
CALL_SUBTEST(check_fitHyperplane(100, points2f_ptrs, coeffs3f, 0.01f));
|
||||
CALL_SUBTEST(check_fitHyperplane(1000, points2f_ptrs, coeffs3f, 0.002f));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_3
|
||||
{
|
||||
Vector4d points4d [1000];
|
||||
Vector4d *points4d_ptrs [1000];
|
||||
@@ -130,7 +135,9 @@ void test_regression()
|
||||
CALL_SUBTEST(check_fitHyperplane(100, points4d_ptrs, coeffs5d, 0.01));
|
||||
CALL_SUBTEST(check_fitHyperplane(1000, points4d_ptrs, coeffs5d, 0.002));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TEST_PART_4
|
||||
{
|
||||
VectorXcd *points11cd_ptrs[1000];
|
||||
for(int i = 0; i < 1000; i++) points11cd_ptrs[i] = new VectorXcd(11);
|
||||
@@ -141,5 +148,6 @@ void test_regression()
|
||||
delete coeffs12cd;
|
||||
for(int i = 0; i < 1000; i++) delete points11cd_ptrs[i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void resizeLikeTest31() { resizeLikeTest<3,1>(); }
|
||||
|
||||
void test_resize()
|
||||
{
|
||||
CALL_SUBTEST( resizeLikeTest12() );
|
||||
CALL_SUBTEST( resizeLikeTest1020() );
|
||||
CALL_SUBTEST( resizeLikeTest31() );
|
||||
CALL_SUBTEST(resizeLikeTest12() );
|
||||
CALL_SUBTEST(resizeLikeTest1020() );
|
||||
CALL_SUBTEST(resizeLikeTest31() );
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
|
||||
|
||||
void test_sizeof()
|
||||
{
|
||||
CALL_SUBTEST( verifySizeOf(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( verifySizeOf(Matrix4d()) );
|
||||
CALL_SUBTEST( verifySizeOf(Matrix<double, 4, 2>()) );
|
||||
CALL_SUBTEST( verifySizeOf(Matrix<bool, 7, 5>()) );
|
||||
CALL_SUBTEST( verifySizeOf(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( verifySizeOf(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( verifySizeOf(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST( verifySizeOf(Matrix<float, 100, 100>()) );
|
||||
CALL_SUBTEST(verifySizeOf(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST(verifySizeOf(Matrix4d()) );
|
||||
CALL_SUBTEST(verifySizeOf(Matrix<double, 4, 2>()) );
|
||||
CALL_SUBTEST(verifySizeOf(Matrix<bool, 7, 5>()) );
|
||||
CALL_SUBTEST(verifySizeOf(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST(verifySizeOf(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST(verifySizeOf(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST(verifySizeOf(Matrix<float, 100, 100>()) );
|
||||
|
||||
VERIFY(sizeof(std::complex<float>) == 2*sizeof(float));
|
||||
VERIFY(sizeof(std::complex<double>) == 2*sizeof(double));
|
||||
|
||||
@@ -50,8 +50,8 @@ template<typename Scalar> void smallVectors()
|
||||
void test_smallvectors()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( smallVectors<int>() );
|
||||
CALL_SUBTEST( smallVectors<float>() );
|
||||
CALL_SUBTEST( smallVectors<double>() );
|
||||
CALL_SUBTEST(smallVectors<int>() );
|
||||
CALL_SUBTEST(smallVectors<float>() );
|
||||
CALL_SUBTEST(smallVectors<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,10 +344,10 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
||||
void test_sparse_basic()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( sparse_basic(SparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST( sparse_basic(SparseMatrix<std::complex<double> >(16, 16)) );
|
||||
CALL_SUBTEST( sparse_basic(SparseMatrix<double>(33, 33)) );
|
||||
CALL_SUBTEST_1( sparse_basic(SparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST_2( sparse_basic(SparseMatrix<std::complex<double> >(16, 16)) );
|
||||
CALL_SUBTEST_1( sparse_basic(SparseMatrix<double>(33, 33)) );
|
||||
|
||||
CALL_SUBTEST( sparse_basic(DynamicSparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST_3( sparse_basic(DynamicSparseMatrix<double>(8, 8)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +123,10 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
|
||||
void test_sparse_product()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( sparse_product(SparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST( sparse_product(SparseMatrix<std::complex<double> >(16, 16)) );
|
||||
CALL_SUBTEST( sparse_product(SparseMatrix<double>(33, 33)) );
|
||||
CALL_SUBTEST_1( sparse_product(SparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST_2( sparse_product(SparseMatrix<std::complex<double> >(16, 16)) );
|
||||
CALL_SUBTEST_1( sparse_product(SparseMatrix<double>(33, 33)) );
|
||||
|
||||
CALL_SUBTEST( sparse_product(DynamicSparseMatrix<double>(8, 8)) );
|
||||
CALL_SUBTEST_3( sparse_product(DynamicSparseMatrix<double>(8, 8)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,8 +172,8 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
|
||||
|
||||
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag, &zeroCoords, &nonzeroCoords);
|
||||
|
||||
LU<DenseMatrix> refLu(refMat2);
|
||||
refLu.solve(b, &refX);
|
||||
FullPivLU<DenseMatrix> refLu(refMat2);
|
||||
refX = refLu.solve(b);
|
||||
#if defined(EIGEN_SUPERLU_SUPPORT) || defined(EIGEN_UMFPACK_SUPPORT)
|
||||
Scalar refDet = refLu.determinant();
|
||||
#endif
|
||||
@@ -229,8 +229,8 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
|
||||
void test_sparse_solvers()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
// CALL_SUBTEST( sparse_solvers<double>(8, 8) );
|
||||
CALL_SUBTEST( sparse_solvers<std::complex<double> >(16, 16) );
|
||||
// CALL_SUBTEST( sparse_solvers<double>(100, 100) );
|
||||
// CALL_SUBTEST(sparse_solvers<double>(8, 8) );
|
||||
CALL_SUBTEST(sparse_solvers<std::complex<double> >(16, 16) );
|
||||
// CALL_SUBTEST(sparse_solvers<double>(100, 100) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
|
||||
void test_sparse_vector()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( sparse_vector<double>(8, 8) );
|
||||
CALL_SUBTEST( sparse_vector<std::complex<double> >(16, 16) );
|
||||
CALL_SUBTEST( sparse_vector<double>(299, 535) );
|
||||
CALL_SUBTEST_1( sparse_vector<double>(8, 8) );
|
||||
CALL_SUBTEST_2( sparse_vector<std::complex<double> >(16, 16) );
|
||||
CALL_SUBTEST_1( sparse_vector<double>(299, 535) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
|
||||
void test_stable_norm()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( stable_norm(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( stable_norm(Vector4d()) );
|
||||
CALL_SUBTEST( stable_norm(VectorXd(ei_random<int>(10,2000))) );
|
||||
CALL_SUBTEST( stable_norm(VectorXf(ei_random<int>(10,2000))) );
|
||||
CALL_SUBTEST( stable_norm(VectorXcd(ei_random<int>(10,2000))) );
|
||||
CALL_SUBTEST_1( stable_norm(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( stable_norm(Vector4d()) );
|
||||
CALL_SUBTEST_3( stable_norm(VectorXd(ei_random<int>(10,2000))) );
|
||||
CALL_SUBTEST_4( stable_norm(VectorXf(ei_random<int>(10,2000))) );
|
||||
CALL_SUBTEST_5( stable_norm(VectorXcd(ei_random<int>(10,2000))) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,29 +135,29 @@ void check_stdvector_quaternion(const QuaternionType&)
|
||||
void test_stdvector()
|
||||
{
|
||||
// some non vectorizable fixed sizes
|
||||
CALL_SUBTEST(check_stdvector_matrix(Vector2f()));
|
||||
CALL_SUBTEST(check_stdvector_matrix(Matrix3f()));
|
||||
CALL_SUBTEST(check_stdvector_matrix(Matrix3d()));
|
||||
CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));
|
||||
CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));
|
||||
CALL_SUBTEST_2(check_stdvector_matrix(Matrix3d()));
|
||||
|
||||
// some vectorizable fixed sizes
|
||||
CALL_SUBTEST(check_stdvector_matrix(Matrix2f()));
|
||||
CALL_SUBTEST(check_stdvector_matrix(Vector4f()));
|
||||
CALL_SUBTEST(check_stdvector_matrix(Matrix4f()));
|
||||
CALL_SUBTEST(check_stdvector_matrix(Matrix4d()));
|
||||
CALL_SUBTEST_1(check_stdvector_matrix(Matrix2f()));
|
||||
CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));
|
||||
CALL_SUBTEST_1(check_stdvector_matrix(Matrix4f()));
|
||||
CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));
|
||||
|
||||
// some dynamic sizes
|
||||
CALL_SUBTEST(check_stdvector_matrix(MatrixXd(1,1)));
|
||||
CALL_SUBTEST(check_stdvector_matrix(VectorXd(20)));
|
||||
CALL_SUBTEST(check_stdvector_matrix(RowVectorXf(20)));
|
||||
CALL_SUBTEST(check_stdvector_matrix(MatrixXcf(10,10)));
|
||||
CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));
|
||||
CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));
|
||||
CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));
|
||||
CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));
|
||||
|
||||
// some Transform
|
||||
CALL_SUBTEST(check_stdvector_transform(Transform2f()));
|
||||
CALL_SUBTEST(check_stdvector_transform(Transform3f()));
|
||||
CALL_SUBTEST(check_stdvector_transform(Transform3d()));
|
||||
//CALL_SUBTEST(check_stdvector_transform(Transform4d()));
|
||||
CALL_SUBTEST_4(check_stdvector_transform(Transform2f()));
|
||||
CALL_SUBTEST_4(check_stdvector_transform(Transform3f()));
|
||||
CALL_SUBTEST_4(check_stdvector_transform(Transform3d()));
|
||||
//CALL_SUBTEST(heck_stdvector_transform(Transform4d()));
|
||||
|
||||
// some Quaternion
|
||||
CALL_SUBTEST(check_stdvector_quaternion(Quaternionf()));
|
||||
CALL_SUBTEST(check_stdvector_quaternion(Quaterniond()));
|
||||
CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
|
||||
CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));
|
||||
}
|
||||
|
||||
@@ -215,14 +215,14 @@ void data_and_stride(const MatrixType& m)
|
||||
void test_submatrices()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( submatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( submatrices(Matrix4d()) );
|
||||
CALL_SUBTEST( submatrices(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST( submatrices(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST( submatrices(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST( submatrices(MatrixXf(20, 20)) );
|
||||
CALL_SUBTEST_1( submatrices(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( submatrices(Matrix4d()) );
|
||||
CALL_SUBTEST_3( submatrices(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_4( submatrices(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_5( submatrices(MatrixXcd(20, 20)) );
|
||||
CALL_SUBTEST_6( submatrices(MatrixXf(20, 20)) );
|
||||
|
||||
CALL_SUBTEST( data_and_stride(MatrixXf(ei_random(5,50), ei_random(5,50))) );
|
||||
CALL_SUBTEST( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(ei_random(5,50), ei_random(5,50))) );
|
||||
CALL_SUBTEST_6( data_and_stride(MatrixXf(ei_random(5,50), ei_random(5,50))) );
|
||||
CALL_SUBTEST_7( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(ei_random(5,50), ei_random(5,50))) );
|
||||
}
|
||||
}
|
||||
|
||||
20
test/svd.cpp
20
test/svd.cpp
@@ -100,17 +100,17 @@ template<typename MatrixType> void svd_verify_assert()
|
||||
void test_svd()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( svd(Matrix3f()) );
|
||||
CALL_SUBTEST( svd(Matrix4d()) );
|
||||
CALL_SUBTEST( svd(MatrixXf(7,7)) );
|
||||
CALL_SUBTEST( svd(MatrixXd(14,7)) );
|
||||
CALL_SUBTEST_1( svd(Matrix3f()) );
|
||||
CALL_SUBTEST_2( svd(Matrix4d()) );
|
||||
CALL_SUBTEST_3( svd(MatrixXf(7,7)) );
|
||||
CALL_SUBTEST_4( svd(MatrixXd(14,7)) );
|
||||
// complex are not implemented yet
|
||||
// CALL_SUBTEST( svd(MatrixXcd(6,6)) );
|
||||
// CALL_SUBTEST( svd(MatrixXcf(3,3)) );
|
||||
// CALL_SUBTEST(svd(MatrixXcd(6,6)) );
|
||||
// CALL_SUBTEST(svd(MatrixXcf(3,3)) );
|
||||
}
|
||||
|
||||
CALL_SUBTEST( svd_verify_assert<Matrix3f>() );
|
||||
CALL_SUBTEST( svd_verify_assert<Matrix3d>() );
|
||||
CALL_SUBTEST( svd_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST( svd_verify_assert<MatrixXd>() );
|
||||
CALL_SUBTEST_1( svd_verify_assert<Matrix3f>() );
|
||||
CALL_SUBTEST_2( svd_verify_assert<Matrix4d>() );
|
||||
CALL_SUBTEST_3( svd_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST_4( svd_verify_assert<MatrixXd>() );
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ template<typename MatrixType> void swap(const MatrixType& m)
|
||||
|
||||
void test_swap()
|
||||
{
|
||||
CALL_SUBTEST( swap(Matrix3f()) ); // fixed size, no vectorization
|
||||
CALL_SUBTEST( swap(Matrix4d()) ); // fixed size, possible vectorization
|
||||
CALL_SUBTEST( swap(MatrixXd(3,3)) ); // dyn size, no vectorization
|
||||
CALL_SUBTEST( swap(MatrixXf(30,30)) ); // dyn size, possible vectorization
|
||||
CALL_SUBTEST_1( swap(Matrix3f()) ); // fixed size, no vectorization
|
||||
CALL_SUBTEST_2( swap(Matrix4d()) ); // fixed size, possible vectorization
|
||||
CALL_SUBTEST_3( swap(MatrixXd(3,3)) ); // dyn size, no vectorization
|
||||
CALL_SUBTEST_4( swap(MatrixXf(30,30)) ); // dyn size, possible vectorization
|
||||
}
|
||||
|
||||
@@ -137,12 +137,12 @@ template<typename MatrixType> void triangular(const MatrixType& m)
|
||||
void test_triangular()
|
||||
{
|
||||
for(int i = 0; i < g_repeat ; i++) {
|
||||
CALL_SUBTEST( triangular(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( triangular(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST( triangular(Matrix3d()) );
|
||||
CALL_SUBTEST( triangular(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST( triangular(Matrix<std::complex<float>,8, 8>()) );
|
||||
CALL_SUBTEST( triangular(MatrixXcd(17,17)) );
|
||||
CALL_SUBTEST( triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
|
||||
CALL_SUBTEST_1( triangular(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( triangular(Matrix<float, 2, 2>()) );
|
||||
CALL_SUBTEST_3( triangular(Matrix3d()) );
|
||||
CALL_SUBTEST_4( triangular(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST_5( triangular(Matrix<std::complex<float>,8, 8>()) );
|
||||
CALL_SUBTEST_6( triangular(MatrixXcd(17,17)) );
|
||||
CALL_SUBTEST_7( triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,17 +181,17 @@ void test_umeyama()
|
||||
// works also for dimensions bigger than 3...
|
||||
for (int dim=2; dim<8; ++dim)
|
||||
{
|
||||
CALL_SUBTEST(run_test<MatrixXd>(dim, num_elements));
|
||||
CALL_SUBTEST(run_test<MatrixXf>(dim, num_elements));
|
||||
CALL_SUBTEST_1(run_test<MatrixXd>(dim, num_elements));
|
||||
CALL_SUBTEST_2(run_test<MatrixXf>(dim, num_elements));
|
||||
}
|
||||
|
||||
CALL_SUBTEST((run_fixed_size_test<float, 2>(num_elements)));
|
||||
CALL_SUBTEST((run_fixed_size_test<float, 3>(num_elements)));
|
||||
CALL_SUBTEST((run_fixed_size_test<float, 4>(num_elements)));
|
||||
CALL_SUBTEST_3((run_fixed_size_test<float, 2>(num_elements)));
|
||||
CALL_SUBTEST_4((run_fixed_size_test<float, 3>(num_elements)));
|
||||
CALL_SUBTEST_5((run_fixed_size_test<float, 4>(num_elements)));
|
||||
|
||||
CALL_SUBTEST((run_fixed_size_test<double, 2>(num_elements)));
|
||||
CALL_SUBTEST((run_fixed_size_test<double, 3>(num_elements)));
|
||||
CALL_SUBTEST((run_fixed_size_test<double, 4>(num_elements)));
|
||||
CALL_SUBTEST_6((run_fixed_size_test<double, 2>(num_elements)));
|
||||
CALL_SUBTEST_7((run_fixed_size_test<double, 3>(num_elements)));
|
||||
CALL_SUBTEST_8((run_fixed_size_test<double, 4>(num_elements)));
|
||||
}
|
||||
|
||||
// Those two calls don't compile and result in meaningful error messages!
|
||||
|
||||
@@ -115,17 +115,17 @@ template<typename VectorType> void vectorVisitor(const VectorType& w)
|
||||
void test_visitor()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( matrixVisitor(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST( matrixVisitor(Matrix2f()) );
|
||||
CALL_SUBTEST( matrixVisitor(Matrix4d()) );
|
||||
CALL_SUBTEST( matrixVisitor(MatrixXd(8, 12)) );
|
||||
CALL_SUBTEST( matrixVisitor(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
|
||||
CALL_SUBTEST( matrixVisitor(MatrixXi(8, 12)) );
|
||||
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( vectorVisitor(Vector4f()) );
|
||||
CALL_SUBTEST( vectorVisitor(VectorXd(10)) );
|
||||
CALL_SUBTEST( vectorVisitor(RowVectorXd(10)) );
|
||||
CALL_SUBTEST( vectorVisitor(VectorXf(33)) );
|
||||
CALL_SUBTEST_7( vectorVisitor(Vector4f()) );
|
||||
CALL_SUBTEST_8( vectorVisitor(VectorXd(10)) );
|
||||
CALL_SUBTEST_9( vectorVisitor(RowVectorXd(10)) );
|
||||
CALL_SUBTEST_10( vectorVisitor(VectorXf(33)) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user