Revert qr tests
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index 27ef33a..b0cc000 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp
@@ -13,7 +13,7 @@ #include <Eigen/SVD> #include "solverbase.h" -template <typename MatrixType, typename PermutationIndex> +template <typename MatrixType> void cod() { Index rows = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE); @@ -27,7 +27,7 @@ MatrixQType; MatrixType matrix; createRandomPIMatrixOfRank(rank, rows, cols, matrix); - CompleteOrthogonalDecomposition<MatrixType, PermutationIndex> cod(matrix); + CompleteOrthogonalDecomposition<MatrixType> cod(matrix); VERIFY(rank == cod.rank()); VERIFY(cols - cod.rank() == cod.dimensionOfKernel()); VERIFY(!cod.isInjective()); @@ -62,14 +62,14 @@ VERIFY_IS_APPROX(cod_solution, pinv * rhs); } -template <typename MatrixType, typename PermutationIndex, int Cols2> +template <typename MatrixType, int Cols2> void cod_fixedsize() { enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; typedef typename MatrixType::Scalar Scalar; - typedef CompleteOrthogonalDecomposition<Matrix<Scalar, Rows, Cols>, PermutationIndex> COD; + typedef CompleteOrthogonalDecomposition<Matrix<Scalar, Rows, Cols> > COD; int rank = internal::random<int>(1, (std::min)(int(Rows), int(Cols)) - 1); Matrix<Scalar, Rows, Cols> matrix; createRandomPIMatrixOfRank(rank, Rows, Cols, matrix); @@ -95,7 +95,7 @@ VERIFY_IS_APPROX(cod_solution, pinv * rhs); } -template<typename MatrixType, typename PermutationIndex> void qr() +template<typename MatrixType> void qr() { using std::sqrt; @@ -107,7 +107,7 @@ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType; MatrixType m1; createRandomPIMatrixOfRank(rank,rows,cols,m1); - ColPivHouseholderQR<MatrixType, PermutationIndex> qr(m1); + ColPivHouseholderQR<MatrixType> qr(m1); VERIFY_IS_EQUAL(rank, qr.rank()); VERIFY_IS_EQUAL(cols - qr.rank(), qr.dimensionOfKernel()); VERIFY(!qr.isInjective()); @@ -155,7 +155,7 @@ } } -template<typename MatrixType, typename PermutationIndex, int Cols2> void qr_fixedsize() +template<typename MatrixType, int Cols2> void qr_fixedsize() { using std::sqrt; using std::abs; @@ -165,7 +165,7 @@ int rank = internal::random<int>(1, (std::min)(int(Rows), int(Cols))-1); Matrix<Scalar,Rows,Cols> m1; createRandomPIMatrixOfRank(rank,Rows,Cols,m1); - ColPivHouseholderQR<Matrix<Scalar,Rows,Cols>, PermutationIndex> qr(m1); + ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1); VERIFY_IS_EQUAL(rank, qr.rank()); VERIFY_IS_EQUAL(Cols - qr.rank(), qr.dimensionOfKernel()); VERIFY_IS_EQUAL(qr.isInjective(), (rank == Rows)); @@ -204,7 +204,7 @@ // for rank-revealing QR. See // http://www.netlib.org/lapack/lawnspdf/lawn176.pdf // page 3 for more detail. -template<typename MatrixType, typename PermutationIndex> void qr_kahan_matrix() +template<typename MatrixType> void qr_kahan_matrix() { using std::sqrt; using std::abs; @@ -224,7 +224,7 @@ pow_s_i *= s; } m1 = (m1 + m1.transpose()).eval(); - ColPivHouseholderQR<MatrixType, PermutationIndex> qr(m1); + ColPivHouseholderQR<MatrixType> qr(m1); MatrixType r = qr.matrixQR().template triangularView<Upper>(); RealScalar threshold = @@ -244,7 +244,7 @@ } } -template<typename MatrixType, typename PermutationIndex> void qr_invertible() +template<typename MatrixType> void qr_invertible() { using std::log; using std::abs; @@ -263,7 +263,7 @@ m1 += a * a.adjoint(); } - ColPivHouseholderQR<MatrixType, PermutationIndex> qr(m1); + ColPivHouseholderQR<MatrixType> qr(m1); check_solverbase<MatrixType, MatrixType>(m1, qr, size, size, size); @@ -280,11 +280,11 @@ VERIFY_IS_APPROX(log(absdet), qr.logAbsDeterminant()); } -template<typename MatrixType, typename PermutationIndex> void qr_verify_assert() +template<typename MatrixType> void qr_verify_assert() { MatrixType tmp; - ColPivHouseholderQR<MatrixType, PermutationIndex> qr; + ColPivHouseholderQR<MatrixType> qr; VERIFY_RAISES_ASSERT(qr.matrixQR()) VERIFY_RAISES_ASSERT(qr.solve(tmp)) VERIFY_RAISES_ASSERT(qr.transpose().solve(tmp)) @@ -300,11 +300,11 @@ VERIFY_RAISES_ASSERT(qr.logAbsDeterminant()) } -template<typename MatrixType, typename PermutationIndex> void cod_verify_assert() +template<typename MatrixType> void cod_verify_assert() { MatrixType tmp; - CompleteOrthogonalDecomposition<MatrixType, PermutationIndex> cod; + CompleteOrthogonalDecomposition<MatrixType> cod; VERIFY_RAISES_ASSERT(cod.matrixQTZ()) VERIFY_RAISES_ASSERT(cod.solve(tmp)) VERIFY_RAISES_ASSERT(cod.transpose().solve(tmp)) @@ -320,58 +320,50 @@ VERIFY_RAISES_ASSERT(cod.logAbsDeterminant()) } - - EIGEN_DECLARE_TEST(qr_colpivoting) { - #if defined(EIGEN_USE_LAPACKE) - typedef lapack_int PermutationIndex; - #else - typedef int PermutationIndex; - #endif - for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST_1( (qr<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_2( (qr<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_3( (qr<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_4(( (qr_fixedsize<Matrix<float,3,5>, PermutationIndex, 4>)() )); - CALL_SUBTEST_5(( (qr_fixedsize<Matrix<double,6,2>, PermutationIndex, 3>)() )); - CALL_SUBTEST_5(( (qr_fixedsize<Matrix<double,1,1>, PermutationIndex, 1>)() )); + 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 >() )); + CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,1,1>, 1 >() )); } for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST_1( (cod<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_2( (cod<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_3( (cod<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_4(( (cod_fixedsize<Matrix<float,3,5>, PermutationIndex, 4>)() )); - CALL_SUBTEST_5(( (cod_fixedsize<Matrix<double,6,2>, PermutationIndex, 3>)() )); - CALL_SUBTEST_5(( (cod_fixedsize<Matrix<double,1,1>, PermutationIndex, 1>)() )); + CALL_SUBTEST_1( cod<MatrixXf>() ); + CALL_SUBTEST_2( cod<MatrixXd>() ); + CALL_SUBTEST_3( cod<MatrixXcd>() ); + CALL_SUBTEST_4(( cod_fixedsize<Matrix<float,3,5>, 4 >() )); + CALL_SUBTEST_5(( cod_fixedsize<Matrix<double,6,2>, 3 >() )); + CALL_SUBTEST_5(( cod_fixedsize<Matrix<double,1,1>, 1 >() )); } for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST_1( (qr_invertible<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_2( (qr_invertible<MatrixXd, PermutationIndex>)() ); - CALL_SUBTEST_6( (qr_invertible<MatrixXcf, PermutationIndex>)() ); - CALL_SUBTEST_3( (qr_invertible<MatrixXcd, PermutationIndex>)() ); + 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_7( (qr_verify_assert<Matrix3f, PermutationIndex>) ()); - CALL_SUBTEST_8( (qr_verify_assert<Matrix3d, PermutationIndex>)()); - CALL_SUBTEST_1( (qr_verify_assert<MatrixXf, PermutationIndex>)()); - CALL_SUBTEST_2( (qr_verify_assert<MatrixXd, PermutationIndex>)()); - CALL_SUBTEST_6( (qr_verify_assert<MatrixXcf, PermutationIndex>)()); - CALL_SUBTEST_3( (qr_verify_assert<MatrixXcd, PermutationIndex>)()); + 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>()); - CALL_SUBTEST_7( (cod_verify_assert<Matrix3f, PermutationIndex>)()); - CALL_SUBTEST_8( (cod_verify_assert<Matrix3d, PermutationIndex>)()); - CALL_SUBTEST_1( (cod_verify_assert<MatrixXf, PermutationIndex>)()); - CALL_SUBTEST_2( (cod_verify_assert<MatrixXd, PermutationIndex>)()); - CALL_SUBTEST_6( (cod_verify_assert<MatrixXcf, PermutationIndex>)()); - CALL_SUBTEST_3( (cod_verify_assert<MatrixXcd, PermutationIndex>)()); + CALL_SUBTEST_7(cod_verify_assert<Matrix3f>()); + CALL_SUBTEST_8(cod_verify_assert<Matrix3d>()); + CALL_SUBTEST_1(cod_verify_assert<MatrixXf>()); + CALL_SUBTEST_2(cod_verify_assert<MatrixXd>()); + CALL_SUBTEST_6(cod_verify_assert<MatrixXcf>()); + CALL_SUBTEST_3(cod_verify_assert<MatrixXcd>()); // Test problem size constructors - CALL_SUBTEST_9((ColPivHouseholderQR<MatrixXf, PermutationIndex>(10, 20))); + CALL_SUBTEST_9(ColPivHouseholderQR<MatrixXf>(10, 20)); - CALL_SUBTEST_1( (qr_kahan_matrix<MatrixXf, PermutationIndex>)() ); - CALL_SUBTEST_2( (qr_kahan_matrix<MatrixXd, PermutationIndex>)() ); + CALL_SUBTEST_1( qr_kahan_matrix<MatrixXf>() ); + CALL_SUBTEST_2( qr_kahan_matrix<MatrixXd>() ); }
diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp index c0f44ae..bd40881 100644 --- a/test/qr_fullpivoting.cpp +++ b/test/qr_fullpivoting.cpp
@@ -12,7 +12,7 @@ #include <Eigen/QR> #include "solverbase.h" -template<typename MatrixType, typename PermutationIndex> void qr() +template<typename MatrixType> void qr() { static const int Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime; @@ -27,7 +27,7 @@ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType; MatrixType m1; createRandomPIMatrixOfRank(rank,rows,cols,m1); - FullPivHouseholderQR<MatrixType, PermutationIndex> qr(m1); + FullPivHouseholderQR<MatrixType> qr(m1); VERIFY_IS_EQUAL(rank, qr.rank()); VERIFY_IS_EQUAL(cols - qr.rank(), qr.dimensionOfKernel()); VERIFY(!qr.isInjective()); @@ -66,7 +66,7 @@ } } -template<typename MatrixType, typename PermutationIndex> void qr_invertible() +template<typename MatrixType> void qr_invertible() { using std::log; using std::abs; @@ -87,7 +87,7 @@ m1 += a * a.adjoint(); } - FullPivHouseholderQR<MatrixType, PermutationIndex> qr(m1); + FullPivHouseholderQR<MatrixType> qr(m1); VERIFY(qr.isInjective()); VERIFY(qr.isInvertible()); VERIFY(qr.isSurjective()); @@ -107,11 +107,11 @@ VERIFY_IS_APPROX(log(absdet), qr.logAbsDeterminant()); } -template<typename MatrixType, typename PermutationIndex> void qr_verify_assert() +template<typename MatrixType> void qr_verify_assert() { MatrixType tmp; - FullPivHouseholderQR<MatrixType, PermutationIndex> qr; + FullPivHouseholderQR<MatrixType> qr; VERIFY_RAISES_ASSERT(qr.matrixQR()) VERIFY_RAISES_ASSERT(qr.solve(tmp)) VERIFY_RAISES_ASSERT(qr.transpose().solve(tmp)) @@ -129,35 +129,33 @@ EIGEN_DECLARE_TEST(qr_fullpivoting) { - typedef int PermutationIndex; - for(int i = 0; i < 1; i++) { - CALL_SUBTEST_5( (qr<Matrix3f, PermutationIndex>()) ); - CALL_SUBTEST_6( (qr<Matrix3d, PermutationIndex>()) ); - CALL_SUBTEST_8( (qr<Matrix2f, PermutationIndex>()) ); - CALL_SUBTEST_1( (qr<MatrixXf, PermutationIndex>()) ); - CALL_SUBTEST_2( (qr<MatrixXd, PermutationIndex>()) ); - CALL_SUBTEST_3( (qr<MatrixXcd, PermutationIndex>()) ); + CALL_SUBTEST_5( qr<Matrix3f>() ); + CALL_SUBTEST_6( qr<Matrix3d>() ); + CALL_SUBTEST_8( 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_1( (qr_invertible<MatrixXf, PermutationIndex>()) ); - CALL_SUBTEST_2( (qr_invertible<MatrixXd, PermutationIndex>()) ); - CALL_SUBTEST_4( (qr_invertible<MatrixXcf, PermutationIndex>()) ); - CALL_SUBTEST_3( (qr_invertible<MatrixXcd, PermutationIndex>()) ); + 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_5( (qr_verify_assert<Matrix3f, PermutationIndex>()) ); - CALL_SUBTEST_6( (qr_verify_assert<Matrix3d, PermutationIndex>()) ); - CALL_SUBTEST_1( (qr_verify_assert<MatrixXf, PermutationIndex>()) ); - CALL_SUBTEST_2( (qr_verify_assert<MatrixXd, PermutationIndex>()) ); - CALL_SUBTEST_4( (qr_verify_assert<MatrixXcf, PermutationIndex>()) ); - CALL_SUBTEST_3( (qr_verify_assert<MatrixXcd, PermutationIndex>()) ); + 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>()); // Test problem size constructors - CALL_SUBTEST_7( (FullPivHouseholderQR<MatrixXf,PermutationIndex>(10, 20))); - CALL_SUBTEST_7( (FullPivHouseholderQR<Matrix<float, 10, 20>, PermutationIndex>(10, 20))); - CALL_SUBTEST_7( (FullPivHouseholderQR<Matrix<float, 10, 20>, PermutationIndex>(Matrix<float,10,20>::Random()))); - CALL_SUBTEST_7( (FullPivHouseholderQR<Matrix<float, 20, 10>, PermutationIndex>(20, 10))); - CALL_SUBTEST_7( (FullPivHouseholderQR<Matrix<float, 20, 10>, PermutationIndex>(Matrix<float,20,10>::Random()))); + CALL_SUBTEST_7(FullPivHouseholderQR<MatrixXf>(10, 20)); + CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,10,20> >(10,20))); + CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,10,20> >(Matrix<float,10,20>::Random()))); + CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,20,10> >(20,10))); + CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,20,10> >(Matrix<float,20,10>::Random()))); }