diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:45:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:45:13 +0100 |
commit | bbdfe42628cc324904a49d472230c8cbbfd9e1d5 (patch) | |
tree | 0ae6a380649af4a854c88245abb1c9fa3a571cc4 /eigen/test | |
parent | 3e07e568a1ae478b89812d91438d75179c94ab35 (diff) |
update eigen
Diffstat (limited to 'eigen/test')
62 files changed, 112 insertions, 137 deletions
diff --git a/eigen/test/adjoint.cpp b/eigen/test/adjoint.cpp index bdea51c..37032d2 100644 --- a/eigen/test/adjoint.cpp +++ b/eigen/test/adjoint.cpp @@ -70,7 +70,6 @@ template<typename MatrixType> void adjoint(const MatrixType& m) Transpose.h Conjugate.h Dot.h */ using std::abs; - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; diff --git a/eigen/test/array.cpp b/eigen/test/array.cpp index 15c3266..7afd3ed 100644 --- a/eigen/test/array.cpp +++ b/eigen/test/array.cpp @@ -11,7 +11,6 @@ template<typename ArrayType> void array(const ArrayType& m) { - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename ArrayType::RealScalar RealScalar; typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType; @@ -130,7 +129,6 @@ template<typename ArrayType> void array(const ArrayType& m) template<typename ArrayType> void comparisons(const ArrayType& m) { using std::abs; - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -208,7 +206,6 @@ template<typename ArrayType> void array_real(const ArrayType& m) { using std::abs; using std::sqrt; - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -319,7 +316,6 @@ template<typename ArrayType> void array_real(const ArrayType& m) template<typename ArrayType> void array_complex(const ArrayType& m) { - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -424,7 +420,6 @@ template<typename ArrayType> void array_complex(const ArrayType& m) template<typename ArrayType> void min_max(const ArrayType& m) { - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; Index rows = m.rows(); diff --git a/eigen/test/array_for_matrix.cpp b/eigen/test/array_for_matrix.cpp index b872139..a05bba1 100644 --- a/eigen/test/array_for_matrix.cpp +++ b/eigen/test/array_for_matrix.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType; typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; @@ -83,7 +82,6 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m) template<typename MatrixType> void comparisons(const MatrixType& m) { using std::abs; - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -172,7 +170,6 @@ template<typename VectorType> void lpNorm(const VectorType& v) template<typename MatrixType> void cwise_min_max(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); @@ -211,7 +208,6 @@ template<typename MatrixType> void cwise_min_max(const MatrixType& m) template<typename MatrixTraits> void resize(const MatrixTraits& t) { - typedef typename MatrixTraits::Index Index; typedef typename MatrixTraits::Scalar Scalar; typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType; typedef Array<Scalar,Dynamic,Dynamic> Array2DType; diff --git a/eigen/test/array_replicate.cpp b/eigen/test/array_replicate.cpp index 779c8fc..0dad5ba 100644 --- a/eigen/test/array_replicate.cpp +++ b/eigen/test/array_replicate.cpp @@ -14,7 +14,6 @@ template<typename MatrixType> void replicate(const MatrixType& m) /* this test covers the following files: Replicate.cpp */ - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, Dynamic, Dynamic> MatrixX; diff --git a/eigen/test/array_reverse.cpp b/eigen/test/array_reverse.cpp index c9d9f90..9d5b9a6 100644 --- a/eigen/test/array_reverse.cpp +++ b/eigen/test/array_reverse.cpp @@ -15,7 +15,6 @@ using namespace std; template<typename MatrixType> void reverse(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; diff --git a/eigen/test/basicstuff.cpp b/eigen/test/basicstuff.cpp index 99d91f9..2e532f7 100644 --- a/eigen/test/basicstuff.cpp +++ b/eigen/test/basicstuff.cpp @@ -13,7 +13,6 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; @@ -144,7 +143,6 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) template<typename MatrixType> void basicStuffComplex(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType; diff --git a/eigen/test/block.cpp b/eigen/test/block.cpp index f64bdae..ca9c21f 100644 --- a/eigen/test/block.cpp +++ b/eigen/test/block.cpp @@ -32,7 +32,6 @@ block_real_only(const MatrixType &, Index, Index, Index, Index, const Scalar&) { template<typename MatrixType> void block(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; @@ -207,7 +206,6 @@ template<typename MatrixType> void block(const MatrixType& m) template<typename MatrixType> void compare_using_data_and_stride(const MatrixType& m) { - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); Index size = m.size(); @@ -241,7 +239,6 @@ void compare_using_data_and_stride(const MatrixType& m) template<typename MatrixType> void data_and_stride(const MatrixType& m) { - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); diff --git a/eigen/test/cholesky.cpp b/eigen/test/cholesky.cpp index b4b6bda..5cf842d 100644 --- a/eigen/test/cholesky.cpp +++ b/eigen/test/cholesky.cpp @@ -19,6 +19,7 @@ template<typename MatrixType, int UpLo> typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { + if(m.cols()==0) return typename MatrixType::RealScalar(0); MatrixType symm = m.template selfadjointView<UpLo>(); return symm.cwiseAbs().colwise().sum().maxCoeff(); } @@ -57,7 +58,6 @@ template<typename MatrixType,template <typename,int> class CholType> void test_c template<typename MatrixType> void cholesky(const MatrixType& m) { - typedef typename MatrixType::Index Index; /* this test covers the following files: LLT.h LDLT.h */ @@ -97,7 +97,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m) RealScalar rcond_est = chollo.rcond(); // Verify that the estimated condition number is within a factor of 10 of the // truth. - VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); // test the upper mode LLT<SquareMatrixType,Upper> cholup(symmUp); @@ -113,12 +113,12 @@ template<typename MatrixType> void cholesky(const MatrixType& m) rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Upper>(symmUp)) / matrix_l1_norm<MatrixType, Upper>(symmUp_inverse); rcond_est = cholup.rcond(); - VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); MatrixType neg = -symmLo; chollo.compute(neg); - VERIFY(chollo.info()==NumericalIssue); + VERIFY(neg.size()==0 || chollo.info()==NumericalIssue); VERIFY_IS_APPROX(MatrixType(chollo.matrixL().transpose().conjugate()), MatrixType(chollo.matrixU())); VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL())); @@ -167,7 +167,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m) RealScalar rcond_est = ldltlo.rcond(); // Verify that the estimated condition number is within a factor of 10 of the // truth. - VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); LDLT<SquareMatrixType,Upper> ldltup(symmUp); @@ -184,7 +184,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m) rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Upper>(symmUp)) / matrix_l1_norm<MatrixType, Upper>(symmUp_inverse); rcond_est = ldltup.rcond(); - VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); VERIFY_IS_APPROX(MatrixType(ldltlo.matrixL().transpose().conjugate()), MatrixType(ldltlo.matrixU())); VERIFY_IS_APPROX(MatrixType(ldltlo.matrixU().transpose().conjugate()), MatrixType(ldltlo.matrixL())); @@ -289,8 +289,6 @@ template<typename MatrixType> void cholesky_cplx(const MatrixType& m) // test mixing real/scalar types - typedef typename MatrixType::Index Index; - Index rows = m.rows(); Index cols = m.cols(); @@ -510,6 +508,11 @@ void test_cholesky() CALL_SUBTEST_6( cholesky_cplx(MatrixXcd(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } + // empty matrix, regression test for Bug 785: + CALL_SUBTEST_2( cholesky(MatrixXd(0,0)) ); + + // This does not work yet: + // CALL_SUBTEST_2( cholesky(Matrix<double,0,0>()) ); CALL_SUBTEST_4( cholesky_verify_assert<Matrix3f>() ); CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() ); diff --git a/eigen/test/conservative_resize.cpp b/eigen/test/conservative_resize.cpp index 498421b..21a1db4 100644 --- a/eigen/test/conservative_resize.cpp +++ b/eigen/test/conservative_resize.cpp @@ -17,7 +17,6 @@ template <typename Scalar, int Storage> void run_matrix_tests() { typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Storage> MatrixType; - typedef typename MatrixType::Index Index; MatrixType m, n; diff --git a/eigen/test/corners.cpp b/eigen/test/corners.cpp index 3c64c32..32edadb 100644 --- a/eigen/test/corners.cpp +++ b/eigen/test/corners.cpp @@ -15,7 +15,6 @@ template<typename MatrixType> void corners(const MatrixType& m) { - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); diff --git a/eigen/test/determinant.cpp b/eigen/test/determinant.cpp index 758f3af..b8c9bab 100644 --- a/eigen/test/determinant.cpp +++ b/eigen/test/determinant.cpp @@ -16,7 +16,6 @@ template<typename MatrixType> void determinant(const MatrixType& m) /* this test covers the following files: Determinant.h */ - typedef typename MatrixType::Index Index; Index size = m.rows(); MatrixType m1(size, size), m2(size, size); diff --git a/eigen/test/diagonal.cpp b/eigen/test/diagonal.cpp index 0b5ae82..8ed9b46 100644 --- a/eigen/test/diagonal.cpp +++ b/eigen/test/diagonal.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void diagonal(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); diff --git a/eigen/test/diagonalmatrices.cpp b/eigen/test/diagonalmatrices.cpp index a4ff102..c55733d 100644 --- a/eigen/test/diagonalmatrices.cpp +++ b/eigen/test/diagonalmatrices.cpp @@ -11,7 +11,6 @@ using namespace std; template<typename MatrixType> void diagonalmatrices(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; typedef Matrix<Scalar, Rows, 1> VectorType; diff --git a/eigen/test/dontalign.cpp b/eigen/test/dontalign.cpp index 4643cfe..ac00112 100644 --- a/eigen/test/dontalign.cpp +++ b/eigen/test/dontalign.cpp @@ -19,7 +19,6 @@ template<typename MatrixType> void dontalign(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; diff --git a/eigen/test/eigen2support.cpp b/eigen/test/eigen2support.cpp index ad1d980..ac6931a 100644 --- a/eigen/test/eigen2support.cpp +++ b/eigen/test/eigen2support.cpp @@ -13,7 +13,6 @@ template<typename MatrixType> void eigen2support(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); diff --git a/eigen/test/eigensolver_complex.cpp b/eigen/test/eigensolver_complex.cpp index 293b1b2..7269452 100644 --- a/eigen/test/eigensolver_complex.cpp +++ b/eigen/test/eigensolver_complex.cpp @@ -71,7 +71,6 @@ void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& template<typename MatrixType> void eigensolver(const MatrixType& m) { - typedef typename MatrixType::Index Index; /* this test covers the following files: ComplexEigenSolver.h, and indirectly ComplexSchur.h */ diff --git a/eigen/test/eigensolver_generalized_real.cpp b/eigen/test/eigensolver_generalized_real.cpp index f7861d3..9dd44c8 100644 --- a/eigen/test/eigensolver_generalized_real.cpp +++ b/eigen/test/eigensolver_generalized_real.cpp @@ -15,7 +15,6 @@ template<typename MatrixType> void generalized_eigensolver_real(const MatrixType& m) { - typedef typename MatrixType::Index Index; /* this test covers the following files: GeneralizedEigenSolver.h */ diff --git a/eigen/test/eigensolver_generic.cpp b/eigen/test/eigensolver_generic.cpp index d0e644d..07bf65e 100644 --- a/eigen/test/eigensolver_generic.cpp +++ b/eigen/test/eigensolver_generic.cpp @@ -14,7 +14,6 @@ template<typename MatrixType> void eigensolver(const MatrixType& m) { - typedef typename MatrixType::Index Index; /* this test covers the following files: EigenSolver.h */ diff --git a/eigen/test/eigensolver_selfadjoint.cpp b/eigen/test/eigensolver_selfadjoint.cpp index 39ad413..0e39b53 100644 --- a/eigen/test/eigensolver_selfadjoint.cpp +++ b/eigen/test/eigensolver_selfadjoint.cpp @@ -68,7 +68,6 @@ template<typename MatrixType> void selfadjointeigensolver_essential_check(const template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m) { - typedef typename MatrixType::Index Index; /* this test covers the following files: EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h) */ diff --git a/eigen/test/geo_alignedbox.cpp b/eigen/test/geo_alignedbox.cpp index d2339a6..b64ea3b 100644 --- a/eigen/test/geo_alignedbox.cpp +++ b/eigen/test/geo_alignedbox.cpp @@ -24,7 +24,6 @@ template<typename BoxType> void alignedbox(const BoxType& _box) /* this test covers the following files: AlignedBox.h */ - typedef typename BoxType::Index Index; typedef typename BoxType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType; @@ -86,7 +85,6 @@ template<typename BoxType> void alignedboxCastTests(const BoxType& _box) { // casting - typedef typename BoxType::Index Index; typedef typename BoxType::Scalar Scalar; typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType; diff --git a/eigen/test/geo_hyperplane.cpp b/eigen/test/geo_hyperplane.cpp index 2789285..b3a48c5 100644 --- a/eigen/test/geo_hyperplane.cpp +++ b/eigen/test/geo_hyperplane.cpp @@ -19,7 +19,6 @@ template<typename HyperplaneType> void hyperplane(const HyperplaneType& _plane) Hyperplane.h */ using std::abs; - typedef typename HyperplaneType::Index Index; const Index dim = _plane.dim(); enum { Options = HyperplaneType::Options }; typedef typename HyperplaneType::Scalar Scalar; diff --git a/eigen/test/geo_parametrizedline.cpp b/eigen/test/geo_parametrizedline.cpp index 9bf5f3c..6a87947 100644 --- a/eigen/test/geo_parametrizedline.cpp +++ b/eigen/test/geo_parametrizedline.cpp @@ -19,7 +19,6 @@ template<typename LineType> void parametrizedline(const LineType& _line) ParametrizedLine.h */ using std::abs; - typedef typename LineType::Index Index; const Index dim = _line.dim(); typedef typename LineType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; diff --git a/eigen/test/half_float.cpp b/eigen/test/half_float.cpp index 3d2410a..b37b819 100644 --- a/eigen/test/half_float.cpp +++ b/eigen/test/half_float.cpp @@ -11,6 +11,10 @@ #include <Eigen/src/Core/arch/CUDA/Half.h> +#ifdef EIGEN_HAS_CUDA_FP16 +#error "EIGEN_HAS_CUDA_FP16 should not be defined in this CPU unit test" +#endif + // Make sure it's possible to forward declare Eigen::half namespace Eigen { struct half; @@ -20,7 +24,7 @@ using Eigen::half; void test_conversion() { - using Eigen::half_impl::__half; + using Eigen::half_impl::__half_raw; // Conversion from float. VERIFY_IS_EQUAL(half(1.0f).x, 0x3c00); @@ -37,9 +41,9 @@ void test_conversion() VERIFY_IS_EQUAL(half(1.19209e-07f).x, 0x0002); // Verify round-to-nearest-even behavior. - float val1 = float(half(__half(0x3c00))); - float val2 = float(half(__half(0x3c01))); - float val3 = float(half(__half(0x3c02))); + float val1 = float(half(__half_raw(0x3c00))); + float val2 = float(half(__half_raw(0x3c01))); + float val3 = float(half(__half_raw(0x3c02))); VERIFY_IS_EQUAL(half(0.5f * (val1 + val2)).x, 0x3c00); VERIFY_IS_EQUAL(half(0.5f * (val2 + val3)).x, 0x3c02); @@ -55,21 +59,21 @@ void test_conversion() VERIFY_IS_EQUAL(half(true).x, 0x3c00); // Conversion to float. - VERIFY_IS_EQUAL(float(half(__half(0x0000))), 0.0f); - VERIFY_IS_EQUAL(float(half(__half(0x3c00))), 1.0f); + VERIFY_IS_EQUAL(float(half(__half_raw(0x0000))), 0.0f); + VERIFY_IS_EQUAL(float(half(__half_raw(0x3c00))), 1.0f); // Denormals. - VERIFY_IS_APPROX(float(half(__half(0x8001))), -5.96046e-08f); - VERIFY_IS_APPROX(float(half(__half(0x0001))), 5.96046e-08f); - VERIFY_IS_APPROX(float(half(__half(0x0002))), 1.19209e-07f); + VERIFY_IS_APPROX(float(half(__half_raw(0x8001))), -5.96046e-08f); + VERIFY_IS_APPROX(float(half(__half_raw(0x0001))), 5.96046e-08f); + VERIFY_IS_APPROX(float(half(__half_raw(0x0002))), 1.19209e-07f); // NaNs and infinities. VERIFY(!(numext::isinf)(float(half(65504.0f)))); // Largest finite number. VERIFY(!(numext::isnan)(float(half(0.0f)))); - VERIFY((numext::isinf)(float(half(__half(0xfc00))))); - VERIFY((numext::isnan)(float(half(__half(0xfc01))))); - VERIFY((numext::isinf)(float(half(__half(0x7c00))))); - VERIFY((numext::isnan)(float(half(__half(0x7c01))))); + VERIFY((numext::isinf)(float(half(__half_raw(0xfc00))))); + VERIFY((numext::isnan)(float(half(__half_raw(0xfc01))))); + VERIFY((numext::isinf)(float(half(__half_raw(0x7c00))))); + VERIFY((numext::isnan)(float(half(__half_raw(0x7c01))))); #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 @@ -79,12 +83,12 @@ void test_conversion() #endif // Exactly same checks as above, just directly on the half representation. - VERIFY(!(numext::isinf)(half(__half(0x7bff)))); - VERIFY(!(numext::isnan)(half(__half(0x0000)))); - VERIFY((numext::isinf)(half(__half(0xfc00)))); - VERIFY((numext::isnan)(half(__half(0xfc01)))); - VERIFY((numext::isinf)(half(__half(0x7c00)))); - VERIFY((numext::isnan)(half(__half(0x7c01)))); + VERIFY(!(numext::isinf)(half(__half_raw(0x7bff)))); + VERIFY(!(numext::isnan)(half(__half_raw(0x0000)))); + VERIFY((numext::isinf)(half(__half_raw(0xfc00)))); + VERIFY((numext::isnan)(half(__half_raw(0xfc01)))); + VERIFY((numext::isinf)(half(__half_raw(0x7c00)))); + VERIFY((numext::isnan)(half(__half_raw(0x7c01)))); #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 diff --git a/eigen/test/householder.cpp b/eigen/test/householder.cpp index c5f6b5e..e70b7ea 100644 --- a/eigen/test/householder.cpp +++ b/eigen/test/householder.cpp @@ -12,7 +12,6 @@ template<typename MatrixType> void householder(const MatrixType& m) { - typedef typename MatrixType::Index Index; static bool even = true; even = !even; /* this test covers the following files: diff --git a/eigen/test/integer_types.cpp b/eigen/test/integer_types.cpp index 2512631..3629559 100644 --- a/eigen/test/integer_types.cpp +++ b/eigen/test/integer_types.cpp @@ -18,7 +18,6 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; @@ -49,7 +48,6 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m template<typename MatrixType> void integer_type_tests(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; VERIFY(NumTraits<Scalar>::IsInteger); diff --git a/eigen/test/inverse.cpp b/eigen/test/inverse.cpp index 97fe6ff..be607cc 100644 --- a/eigen/test/inverse.cpp +++ b/eigen/test/inverse.cpp @@ -14,7 +14,6 @@ template<typename MatrixType> void inverse(const MatrixType& m) { using std::abs; - typedef typename MatrixType::Index Index; /* this test covers the following files: Inverse.h */ diff --git a/eigen/test/jacobi.cpp b/eigen/test/jacobi.cpp index 7ccd412..319e476 100644 --- a/eigen/test/jacobi.cpp +++ b/eigen/test/jacobi.cpp @@ -14,7 +14,6 @@ template<typename MatrixType, typename JacobiScalar> void jacobi(const MatrixType& m = MatrixType()) { - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); diff --git a/eigen/test/jacobisvd.cpp b/eigen/test/jacobisvd.cpp index 7f5f715..64b8663 100644 --- a/eigen/test/jacobisvd.cpp +++ b/eigen/test/jacobisvd.cpp @@ -36,7 +36,6 @@ void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true) template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m) { svd_verify_assert<JacobiSVD<MatrixType> >(m); - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); @@ -70,6 +69,21 @@ void jacobisvd_method() VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m); } +namespace Foo { +// older compiler require a default constructor for Bar +// cf: https://stackoverflow.com/questions/7411515/ +class Bar {public: Bar() {}}; +bool operator<(const Bar&, const Bar&) { return true; } +} +// regression test for a very strange MSVC issue for which simply +// including SVDBase.h messes up with std::max and custom scalar type +void msvc_workaround() +{ + const Foo::Bar a; + const Foo::Bar b; + std::max EIGEN_NOT_A_MACRO (a,b); +} + void test_jacobisvd() { CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) )); @@ -123,4 +137,6 @@ void test_jacobisvd() CALL_SUBTEST_9( svd_preallocate<void>() ); CALL_SUBTEST_2( svd_underoverflow<void>() ); + + msvc_workaround(); } diff --git a/eigen/test/linearstructure.cpp b/eigen/test/linearstructure.cpp index 17474af..b6559b2 100644 --- a/eigen/test/linearstructure.cpp +++ b/eigen/test/linearstructure.cpp @@ -19,7 +19,6 @@ template<typename MatrixType> void linearStructure(const MatrixType& m) /* this test covers the following files: CwiseUnaryOp.h, CwiseBinaryOp.h, SelfCwiseBinaryOp.h */ - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; diff --git a/eigen/test/lu.cpp b/eigen/test/lu.cpp index 9787f4d..176a2f0 100644 --- a/eigen/test/lu.cpp +++ b/eigen/test/lu.cpp @@ -18,7 +18,6 @@ typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { template<typename MatrixType> void lu_non_invertible() { - typedef typename MatrixType::Index Index; typedef typename MatrixType::RealScalar RealScalar; /* this test covers the following files: LU.h @@ -58,6 +57,10 @@ template<typename MatrixType> void lu_non_invertible() // The image of the zero matrix should consist of a single (zero) column vector VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1)); + // The kernel of the zero matrix is the entire space, and thus is an invertible matrix of dimensions cols. + KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel(); + VERIFY((kernel.fullPivLu().isInvertible())); + MatrixType m1(rows, cols), m3(rows, cols2); CMatrixType m2(cols, cols2); createRandomPIMatrixOfRank(rank, rows, cols, m1); @@ -87,7 +90,7 @@ template<typename MatrixType> void lu_non_invertible() VERIFY(!lu.isInjective()); VERIFY(!lu.isInvertible()); VERIFY(!lu.isSurjective()); - VERIFY((m1 * m1kernel).isMuchSmallerThan(m1)); + VERIFY_IS_MUCH_SMALLER_THAN((m1 * m1kernel), m1); VERIFY(m1image.fullPivLu().rank() == rank); VERIFY_IS_APPROX(m1 * m1.adjoint() * m1image, m1image); @@ -181,7 +184,6 @@ template<typename MatrixType> void lu_partial_piv() /* this test covers the following files: PartialPivLU.h */ - typedef typename MatrixType::Index Index; typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; Index size = internal::random<Index>(1,4); diff --git a/eigen/test/mapped_matrix.cpp b/eigen/test/mapped_matrix.cpp index ef350b2..bc8a694 100644 --- a/eigen/test/mapped_matrix.cpp +++ b/eigen/test/mapped_matrix.cpp @@ -17,7 +17,6 @@ template<typename VectorType> void map_class_vector(const VectorType& m) { - typedef typename VectorType::Index Index; typedef typename VectorType::Scalar Scalar; Index size = m.size(); @@ -51,7 +50,6 @@ template<typename VectorType> void map_class_vector(const VectorType& m) template<typename MatrixType> void map_class_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(), cols = m.cols(), size = rows*cols; @@ -122,7 +120,6 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m) template<typename VectorType> void map_static_methods(const VectorType& m) { - typedef typename VectorType::Index Index; typedef typename VectorType::Scalar Scalar; Index size = m.size(); @@ -164,7 +161,6 @@ template<typename Scalar> void map_not_aligned_on_scalar() { typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType; - typedef typename MatrixType::Index Index; Index size = 11; Scalar* array1 = internal::aligned_new<Scalar>((size+1)*(size+1)+1); Scalar* array2 = reinterpret_cast<Scalar*>(sizeof(Scalar)/2+std::size_t(array1)); diff --git a/eigen/test/mapstaticmethods.cpp b/eigen/test/mapstaticmethods.cpp index 06272d1..8156ca9 100644 --- a/eigen/test/mapstaticmethods.cpp +++ b/eigen/test/mapstaticmethods.cpp @@ -69,7 +69,6 @@ struct mapstaticmethods_impl<PlainObjectType, true, false> { static void run(const PlainObjectType& m) { - typedef typename PlainObjectType::Index Index; Index rows = m.rows(), cols = m.cols(); int i = internal::random<int>(2,5), j = internal::random<int>(2,5); @@ -116,7 +115,6 @@ struct mapstaticmethods_impl<PlainObjectType, true, true> { static void run(const PlainObjectType& v) { - typedef typename PlainObjectType::Index Index; Index size = v.size(); int i = internal::random<int>(2,5); diff --git a/eigen/test/mapstride.cpp b/eigen/test/mapstride.cpp index de77dc5..d785148 100644 --- a/eigen/test/mapstride.cpp +++ b/eigen/test/mapstride.cpp @@ -11,7 +11,6 @@ template<int Alignment,typename VectorType> void map_class_vector(const VectorType& m) { - typedef typename VectorType::Index Index; typedef typename VectorType::Scalar Scalar; Index size = m.size(); @@ -50,7 +49,6 @@ template<int Alignment,typename VectorType> void map_class_vector(const VectorTy template<int Alignment,typename MatrixType> void map_class_matrix(const MatrixType& _m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = _m.rows(), cols = _m.cols(); diff --git a/eigen/test/miscmatrices.cpp b/eigen/test/miscmatrices.cpp index ef20dc7..f17291c 100644 --- a/eigen/test/miscmatrices.cpp +++ b/eigen/test/miscmatrices.cpp @@ -14,7 +14,6 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m) /* this test covers the following files: DiagonalMatrix.h Ones.h */ - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; Index rows = m.rows(); diff --git a/eigen/test/mixingtypes.cpp b/eigen/test/mixingtypes.cpp index ad9c2c6..45d79aa 100644 --- a/eigen/test/mixingtypes.cpp +++ b/eigen/test/mixingtypes.cpp @@ -8,13 +8,27 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -// work around "uninitialized" warnings and give that option some testing -#define EIGEN_INITIALIZE_MATRICES_BY_ZERO +#if defined(EIGEN_TEST_PART_7) #ifndef EIGEN_NO_STATIC_ASSERT #define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them #endif +// ignore double-promotion diagnostic for clang and gcc, if we check for static assertion anyway: +// TODO do the same for MSVC? +#if defined(__clang__) +# if (__clang_major__ * 100 + __clang_minor__) >= 308 +# pragma clang diagnostic ignored "-Wdouble-promotion" +# endif +#elif defined(__GNUC__) + // TODO is there a minimal GCC version for this? At least g++-4.7 seems to be fine with this. +# pragma GCC diagnostic ignored "-Wdouble-promotion" +#endif + +#endif + + + #if defined(EIGEN_TEST_PART_1) || defined(EIGEN_TEST_PART_2) || defined(EIGEN_TEST_PART_3) #ifndef EIGEN_DONT_VECTORIZE @@ -35,6 +49,28 @@ using namespace std; VERIFY_IS_APPROX(XPR,REF); \ VERIFY( g_called && #XPR" not properly optimized"); +template<int SizeAtCompileType> +void raise_assertion(Index size = SizeAtCompileType) +{ + // VERIFY_RAISES_ASSERT(mf+md); // does not even compile + Matrix<float, SizeAtCompileType, 1> vf; vf.setRandom(size); + Matrix<double, SizeAtCompileType, 1> vd; vd.setRandom(size); + VERIFY_RAISES_ASSERT(vf=vd); + VERIFY_RAISES_ASSERT(vf+=vd); + VERIFY_RAISES_ASSERT(vf-=vd); + VERIFY_RAISES_ASSERT(vd=vf); + VERIFY_RAISES_ASSERT(vd+=vf); + VERIFY_RAISES_ASSERT(vd-=vf); + + // vd.asDiagonal() * mf; // does not even compile + // vcd.asDiagonal() * mf; // does not even compile + +#if 0 // we get other compilation errors here than just static asserts + VERIFY_RAISES_ASSERT(vd.dot(vf)); +#endif +} + + template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) { typedef std::complex<float> CF; @@ -69,17 +105,10 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) double epsd = std::sqrt(std::numeric_limits<double>::min EIGEN_EMPTY ()); while(std::abs(sf )<epsf) sf = internal::random<float>(); - while(std::abs(sd )<epsd) sf = internal::random<double>(); + while(std::abs(sd )<epsd) sd = internal::random<double>(); while(std::abs(scf)<epsf) scf = internal::random<CF>(); while(std::abs(scd)<epsd) scd = internal::random<CD>(); -// VERIFY_RAISES_ASSERT(mf+md); // does not even compile - -#ifdef EIGEN_DONT_VECTORIZE - VERIFY_RAISES_ASSERT(vf=vd); - VERIFY_RAISES_ASSERT(vf+=vd); -#endif - // check scalar products VERIFY_MIX_SCALAR(vcf * sf , vcf * complex<float>(sf)); VERIFY_MIX_SCALAR(sd * vcd , complex<double>(sd) * vcd); @@ -119,9 +148,6 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) // check dot product vf.dot(vf); -#if 0 // we get other compilation errors here than just static asserts - VERIFY_RAISES_ASSERT(vd.dot(vf)); -#endif VERIFY_IS_APPROX(vcf.dot(vf), vcf.dot(vf.template cast<complex<float> >())); // check diagonal product @@ -130,9 +156,6 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) VERIFY_IS_APPROX(mcf * vf.asDiagonal(), mcf * vf.template cast<complex<float> >().asDiagonal()); VERIFY_IS_APPROX(md * vcd.asDiagonal(), md.template cast<complex<double> >() * vcd.asDiagonal()); -// vd.asDiagonal() * mf; // does not even compile -// vcd.asDiagonal() * mf; // does not even compile - // check inner product VERIFY_IS_APPROX((vf.transpose() * vcf).value(), (vf.template cast<complex<float> >().transpose() * vcf).value()); @@ -296,5 +319,10 @@ void test_mixingtypes() CALL_SUBTEST_4(mixingtypes<3>()); CALL_SUBTEST_5(mixingtypes<4>()); CALL_SUBTEST_6(mixingtypes<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))); + CALL_SUBTEST_7(raise_assertion<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))); } + CALL_SUBTEST_7(raise_assertion<0>()); + CALL_SUBTEST_7(raise_assertion<3>()); + CALL_SUBTEST_7(raise_assertion<4>()); + CALL_SUBTEST_7(raise_assertion<Dynamic>(0)); } diff --git a/eigen/test/nomalloc.cpp b/eigen/test/nomalloc.cpp index 50756c2..b7ea4d3 100644 --- a/eigen/test/nomalloc.cpp +++ b/eigen/test/nomalloc.cpp @@ -24,7 +24,6 @@ template<typename MatrixType> void nomalloc(const MatrixType& m) { /* this test check no dynamic memory allocation are issued with fixed-size matrices */ - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); diff --git a/eigen/test/permutationmatrices.cpp b/eigen/test/permutationmatrices.cpp index b2229cf..e885f0e 100644 --- a/eigen/test/permutationmatrices.cpp +++ b/eigen/test/permutationmatrices.cpp @@ -14,7 +14,6 @@ using namespace std; template<typename MatrixType> void permutationmatrices(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime, Options = MatrixType::Options }; diff --git a/eigen/test/product_extra.cpp b/eigen/test/product_extra.cpp index e2b855b..de2709d 100644 --- a/eigen/test/product_extra.cpp +++ b/eigen/test/product_extra.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void product_extra(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, 1, Dynamic> RowVectorType; typedef Matrix<Scalar, Dynamic, 1> ColVectorType; diff --git a/eigen/test/product_notemporary.cpp b/eigen/test/product_notemporary.cpp index 30592b7..28865d3 100644 --- a/eigen/test/product_notemporary.cpp +++ b/eigen/test/product_notemporary.cpp @@ -15,7 +15,6 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m) { /* This test checks the number of temporaries created * during the evaluation of a complex expression */ - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar, 1, Dynamic> RowVectorType; diff --git a/eigen/test/product_selfadjoint.cpp b/eigen/test/product_selfadjoint.cpp index 3d768aa..88d6839 100644 --- a/eigen/test/product_selfadjoint.cpp +++ b/eigen/test/product_selfadjoint.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, 1, MatrixType::RowsAtCompileTime> RowVectorType; diff --git a/eigen/test/product_symm.cpp b/eigen/test/product_symm.cpp index 8c44383..7d1042a 100644 --- a/eigen/test/product_symm.cpp +++ b/eigen/test/product_symm.cpp @@ -16,7 +16,6 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in typedef Matrix<Scalar, OtherSize, Size> Rhs2; enum { order = OtherSize==1 ? 0 : RowMajor }; typedef Matrix<Scalar, Size, OtherSize,order> Rhs3; - typedef typename MatrixType::Index Index; Index rows = size; Index cols = size; diff --git a/eigen/test/product_syrk.cpp b/eigen/test/product_syrk.cpp index e10f0f2..3ebbe14 100644 --- a/eigen/test/product_syrk.cpp +++ b/eigen/test/product_syrk.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void syrk(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime, RowMajor> RMatrixType; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> Rhs1; diff --git a/eigen/test/product_trmv.cpp b/eigen/test/product_trmv.cpp index 57a202a..65d66e5 100644 --- a/eigen/test/product_trmv.cpp +++ b/eigen/test/product_trmv.cpp @@ -11,7 +11,6 @@ template<typename MatrixType> void trmv(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; diff --git a/eigen/test/qr.cpp b/eigen/test/qr.cpp index dfcc1e8..5688460 100644 --- a/eigen/test/qr.cpp +++ b/eigen/test/qr.cpp @@ -12,8 +12,6 @@ template<typename MatrixType> void qr(const MatrixType& m) { - typedef typename MatrixType::Index Index; - Index rows = m.rows(); Index cols = m.cols(); diff --git a/eigen/test/qr_colpivoting.cpp b/eigen/test/qr_colpivoting.cpp index 26ed27f..96c0bad 100644 --- a/eigen/test/qr_colpivoting.cpp +++ b/eigen/test/qr_colpivoting.cpp @@ -14,8 +14,6 @@ template <typename MatrixType> void cod() { - typedef typename MatrixType::Index Index; - Index rows = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE); Index cols = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE); Index cols2 = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE); @@ -94,7 +92,6 @@ void cod_fixedsize() { template<typename MatrixType> void qr() { using std::sqrt; - typedef typename MatrixType::Index Index; Index rows = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols2 = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE); Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1); @@ -211,7 +208,6 @@ template<typename MatrixType> void qr_kahan_matrix() { using std::sqrt; using std::abs; - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; diff --git a/eigen/test/qr_fullpivoting.cpp b/eigen/test/qr_fullpivoting.cpp index 70e89c1..4d8ef68 100644 --- a/eigen/test/qr_fullpivoting.cpp +++ b/eigen/test/qr_fullpivoting.cpp @@ -13,8 +13,6 @@ template<typename MatrixType> void qr() { - typedef typename MatrixType::Index Index; - Index max_size = EIGEN_TEST_MAX_SIZE; Index min_size = numext::maxi(1,EIGEN_TEST_MAX_SIZE/10); Index rows = internal::random<Index>(min_size,max_size), diff --git a/eigen/test/qtvector.cpp b/eigen/test/qtvector.cpp index 2be885e..22df0d5 100644 --- a/eigen/test/qtvector.cpp +++ b/eigen/test/qtvector.cpp @@ -18,8 +18,6 @@ template<typename MatrixType> void check_qtvector_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; - Index rows = m.rows(); Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); diff --git a/eigen/test/real_qz.cpp b/eigen/test/real_qz.cpp index 99ac312..3c1492e 100644 --- a/eigen/test/real_qz.cpp +++ b/eigen/test/real_qz.cpp @@ -18,7 +18,6 @@ template<typename MatrixType> void real_qz(const MatrixType& m) RealQZ.h */ using std::abs; - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index dim = m.cols(); diff --git a/eigen/test/redux.cpp b/eigen/test/redux.cpp index 2bade37..213f080 100644 --- a/eigen/test/redux.cpp +++ b/eigen/test/redux.cpp @@ -16,7 +16,6 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; @@ -81,7 +80,6 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m) template<typename VectorType> void vectorRedux(const VectorType& w) { using std::abs; - typedef typename VectorType::Index Index; typedef typename VectorType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; Index size = w.size(); diff --git a/eigen/test/ref.cpp b/eigen/test/ref.cpp index 9dd2c04..704495a 100644 --- a/eigen/test/ref.cpp +++ b/eigen/test/ref.cpp @@ -32,7 +32,6 @@ template<typename MatrixType> void ref_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar,Dynamic,Dynamic,MatrixType::Options> DynMatrixType; @@ -80,7 +79,6 @@ template<typename MatrixType> void ref_matrix(const MatrixType& m) template<typename VectorType> void ref_vector(const VectorType& m) { - typedef typename VectorType::Index Index; typedef typename VectorType::Scalar Scalar; typedef typename VectorType::RealScalar RealScalar; typedef Matrix<Scalar,Dynamic,1,VectorType::Options> DynMatrixType; diff --git a/eigen/test/schur_real.cpp b/eigen/test/schur_real.cpp index 4aede87..e5229e6 100644 --- a/eigen/test/schur_real.cpp +++ b/eigen/test/schur_real.cpp @@ -13,8 +13,6 @@ template<typename MatrixType> void verifyIsQuasiTriangular(const MatrixType& T) { - typedef typename MatrixType::Index Index; - const Index size = T.cols(); typedef typename MatrixType::Scalar Scalar; diff --git a/eigen/test/selfadjoint.cpp b/eigen/test/selfadjoint.cpp index aaa4888..bb11cc3 100644 --- a/eigen/test/selfadjoint.cpp +++ b/eigen/test/selfadjoint.cpp @@ -15,7 +15,6 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); diff --git a/eigen/test/sparse_basic.cpp b/eigen/test/sparse_basic.cpp index f84b6e3..d0ef722 100644 --- a/eigen/test/sparse_basic.cpp +++ b/eigen/test/sparse_basic.cpp @@ -630,7 +630,8 @@ void big_sparse_triplet(Index rows, Index cols, double density) { { Index r = internal::random<Index>(0,rows-1); Index c = internal::random<Index>(0,cols-1); - Scalar v = internal::random<Scalar>(); + // use positive values to prevent numerical cancellation errors in sum + Scalar v = numext::abs(internal::random<Scalar>()); triplets.push_back(TripletType(r,c,v)); sum += v; } diff --git a/eigen/test/stable_norm.cpp b/eigen/test/stable_norm.cpp index 3c02474..ac8b129 100644 --- a/eigen/test/stable_norm.cpp +++ b/eigen/test/stable_norm.cpp @@ -21,7 +21,6 @@ template<typename MatrixType> void stable_norm(const MatrixType& m) */ using std::sqrt; using std::abs; - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; diff --git a/eigen/test/stddeque.cpp b/eigen/test/stddeque.cpp index bb4b476..b511c4e 100644 --- a/eigen/test/stddeque.cpp +++ b/eigen/test/stddeque.cpp @@ -15,8 +15,6 @@ template<typename MatrixType> void check_stddeque_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; - Index rows = m.rows(); Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); diff --git a/eigen/test/stdlist.cpp b/eigen/test/stdlist.cpp index 17cce77..23cbe90 100644 --- a/eigen/test/stdlist.cpp +++ b/eigen/test/stdlist.cpp @@ -15,8 +15,6 @@ template<typename MatrixType> void check_stdlist_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; - Index rows = m.rows(); Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); diff --git a/eigen/test/stdvector.cpp b/eigen/test/stdvector.cpp index 50cb334..fa928ea 100644 --- a/eigen/test/stdvector.cpp +++ b/eigen/test/stdvector.cpp @@ -117,6 +117,16 @@ void check_stdvector_quaternion(const QuaternionType&) } } +// the code below triggered an invalid warning with gcc >= 7 +// eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807 +// This has been reported to gcc there: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544 +void std_vector_gcc_warning() +{ + typedef Eigen::Vector3f T; + std::vector<T, Eigen::aligned_allocator<T> > v; + v.push_back(T()); +} + void test_stdvector() { // some non vectorizable fixed sizes diff --git a/eigen/test/svd_common.h b/eigen/test/svd_common.h index 605d5df..cba0665 100644 --- a/eigen/test/svd_common.h +++ b/eigen/test/svd_common.h @@ -23,7 +23,6 @@ template<typename SvdType, typename MatrixType> void svd_check_full(const MatrixType& m, const SvdType& svd) { - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); @@ -101,7 +100,6 @@ void svd_least_square(const MatrixType& m, unsigned int computationOptions) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); @@ -168,7 +166,6 @@ template<typename MatrixType> void svd_min_norm(const MatrixType& m, unsigned int computationOptions) { typedef typename MatrixType::Scalar Scalar; - typedef typename MatrixType::Index Index; Index cols = m.cols(); enum { @@ -261,7 +258,6 @@ void svd_test_all_computation_options(const MatrixType& m, bool full_only) CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeThinV) )); // test reconstruction - typedef typename MatrixType::Index Index; Index diagSize = (std::min)(m.rows(), m.cols()); SvdType svd(m, ComputeThinU | ComputeThinV); VERIFY_IS_APPROX(m, svd.matrixU().leftCols(diagSize) * svd.singularValues().asDiagonal() * svd.matrixV().leftCols(diagSize).adjoint()); @@ -437,7 +433,6 @@ template<typename SvdType,typename MatrixType> void svd_verify_assert(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; - typedef typename MatrixType::Index Index; Index rows = m.rows(); Index cols = m.cols(); diff --git a/eigen/test/svd_fill.h b/eigen/test/svd_fill.h index 3877c0c..d68647e 100644 --- a/eigen/test/svd_fill.h +++ b/eigen/test/svd_fill.h @@ -23,7 +23,6 @@ void svd_fill_random(MatrixType &m, int Option = 0) using std::pow; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; Index diagSize = (std::min)(m.rows(), m.cols()); RealScalar s = std::numeric_limits<RealScalar>::max_exponent10/4; s = internal::random<RealScalar>(1,s); diff --git a/eigen/test/triangular.cpp b/eigen/test/triangular.cpp index b968564..328eef4 100644 --- a/eigen/test/triangular.cpp +++ b/eigen/test/triangular.cpp @@ -134,7 +134,6 @@ template<typename MatrixType> void triangular_square(const MatrixType& m) template<typename MatrixType> void triangular_rect(const MatrixType& m) { - typedef const typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; diff --git a/eigen/test/vectorwiseop.cpp b/eigen/test/vectorwiseop.cpp index f3ab561..a099d17 100644 --- a/eigen/test/vectorwiseop.cpp +++ b/eigen/test/vectorwiseop.cpp @@ -15,7 +15,6 @@ template<typename ArrayType> void vectorwiseop_array(const ArrayType& m) { - typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType; typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> RowVectorType; @@ -129,7 +128,6 @@ template<typename ArrayType> void vectorwiseop_array(const ArrayType& m) template<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m) { - typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType; diff --git a/eigen/test/visitor.cpp b/eigen/test/visitor.cpp index 844170e..7f4efab 100644 --- a/eigen/test/visitor.cpp +++ b/eigen/test/visitor.cpp @@ -12,7 +12,6 @@ template<typename MatrixType> void matrixVisitor(const MatrixType& p) { typedef typename MatrixType::Scalar Scalar; - typedef typename MatrixType::Index Index; Index rows = p.rows(); Index cols = p.cols(); @@ -65,7 +64,6 @@ template<typename MatrixType> void matrixVisitor(const MatrixType& p) template<typename VectorType> void vectorVisitor(const VectorType& w) { typedef typename VectorType::Scalar Scalar; - typedef typename VectorType::Index Index; Index size = w.size(); |