the Index types change. As discussed on the list (too long to explain here).
diff --git a/test/array.cpp b/test/array.cpp index 8006531..df1e1b4 100644 --- a/test/array.cpp +++ b/test/array.cpp
@@ -127,9 +127,12 @@ // count VERIFY(((m1.abs()+1)>RealScalar(0.1)).count() == rows*cols); + + typedef Array<typename ArrayType::Index, Dynamic, 1> ArrayOfIndices; + // TODO allows colwise/rowwise for array - VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).colwise().count(), ArrayXi::Constant(cols,rows).transpose()); - VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).rowwise().count(), ArrayXi::Constant(rows, cols)); + VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).colwise().count(), ArrayOfIndices::Constant(cols,rows).transpose()); + VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).rowwise().count(), ArrayOfIndices::Constant(rows, cols)); } template<typename ArrayType> void array_real(const ArrayType& m)
diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index 516c040..477d178 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp
@@ -124,9 +124,12 @@ // count VERIFY(((m1.array().abs()+1)>RealScalar(0.1)).count() == rows*cols); + + typedef Matrix<typename MatrixType::Index, Dynamic, 1> VectorOfIndices; + // TODO allows colwise/rowwise for array - VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().colwise().count(), RowVectorXi::Constant(cols,rows)); - VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().rowwise().count(), VectorXi::Constant(rows, cols)); + VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().colwise().count(), VectorOfIndices::Constant(cols,rows).transpose()); + VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().rowwise().count(), VectorOfIndices::Constant(rows, cols)); } template<typename VectorType> void lpNorm(const VectorType& v)
diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp index a80145f..9eb8d13 100644 --- a/test/nomalloc.cpp +++ b/test/nomalloc.cpp
@@ -133,7 +133,7 @@ void test_nomalloc() { // check that our operator new is indeed called: - VERIFY_RAISES_ASSERT(MatrixXd dummy = MatrixXd::Random(3,3)); + VERIFY_RAISES_ASSERT(MatrixXd dummy(MatrixXd::Random(3,3))); CALL_SUBTEST_1(nomalloc(Matrix<float, 1, 1>()) ); CALL_SUBTEST_2(nomalloc(Matrix4d()) ); CALL_SUBTEST_3(nomalloc(Matrix<float,32,32>()) );
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index a34feed..7064bc2 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp
@@ -38,7 +38,7 @@ MatrixType m1; createRandomPIMatrixOfRank(rank,rows,cols,m1); ColPivHouseholderQR<MatrixType> qr(m1); - VERIFY_IS_APPROX(rank, qr.rank()); + VERIFY(rank == qr.rank()); VERIFY(cols - qr.rank() == qr.dimensionOfKernel()); VERIFY(!qr.isInjective()); VERIFY(!qr.isInvertible()); @@ -66,7 +66,7 @@ Matrix<Scalar,Rows,Cols> m1; createRandomPIMatrixOfRank(rank,Rows,Cols,m1); ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1); - VERIFY_IS_APPROX(rank, qr.rank()); + VERIFY(rank == qr.rank()); VERIFY(Cols - qr.rank() == qr.dimensionOfKernel()); VERIFY(qr.isInjective() == (rank == Rows)); VERIFY(qr.isSurjective() == (rank == Cols));
diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp index 82c42c7..33350ce 100644 --- a/test/qr_fullpivoting.cpp +++ b/test/qr_fullpivoting.cpp
@@ -37,7 +37,7 @@ MatrixType m1; createRandomPIMatrixOfRank(rank,rows,cols,m1); FullPivHouseholderQR<MatrixType> qr(m1); - VERIFY_IS_APPROX(rank, qr.rank()); + VERIFY(rank == qr.rank()); VERIFY(cols - qr.rank() == qr.dimensionOfKernel()); VERIFY(!qr.isInjective()); VERIFY(!qr.isInvertible());
diff --git a/test/sizeof.cpp b/test/sizeof.cpp index a724359..779f3b5 100644 --- a/test/sizeof.cpp +++ b/test/sizeof.cpp
@@ -30,7 +30,7 @@ if (MatrixType::RowsAtCompileTime!=Dynamic && MatrixType::ColsAtCompileTime!=Dynamic) VERIFY(sizeof(MatrixType)==sizeof(Scalar)*MatrixType::SizeAtCompileTime); else - VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(int)); + VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index)); } void test_sizeof()
diff --git a/test/visitor.cpp b/test/visitor.cpp index 65ee60b..1ddabc6 100644 --- a/test/visitor.cpp +++ b/test/visitor.cpp
@@ -27,22 +27,23 @@ template<typename MatrixType> void matrixVisitor(const MatrixType& p) { typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::Index Index; - int rows = p.rows(); - int cols = p.cols(); + Index rows = p.rows(); + Index cols = p.cols(); // construct a random matrix where all coefficients are different MatrixType m; m = MatrixType::Random(rows, cols); - for(int i = 0; i < m.size(); i++) - for(int i2 = 0; i2 < i; i2++) + for(Index i = 0; i < m.size(); i++) + for(Index i2 = 0; i2 < i; i2++) while(m(i) == m(i2)) // yes, == m(i) = ei_random<Scalar>(); Scalar minc = Scalar(1000), maxc = Scalar(-1000); - int minrow=0,mincol=0,maxrow=0,maxcol=0; - for(int j = 0; j < cols; j++) - for(int i = 0; i < rows; i++) + Index minrow=0,mincol=0,maxrow=0,maxcol=0; + for(Index j = 0; j < cols; j++) + for(Index i = 0; i < rows; i++) { if(m(i,j) < minc) { @@ -57,7 +58,7 @@ maxcol = j; } } - int eigen_minrow, eigen_mincol, eigen_maxrow, eigen_maxcol; + Index eigen_minrow, eigen_mincol, eigen_maxrow, eigen_maxcol; Scalar eigen_minc, eigen_maxc; eigen_minc = m.minCoeff(&eigen_minrow,&eigen_mincol); eigen_maxc = m.maxCoeff(&eigen_maxrow,&eigen_maxcol); @@ -74,20 +75,21 @@ template<typename VectorType> void vectorVisitor(const VectorType& w) { typedef typename VectorType::Scalar Scalar; + typedef typename VectorType::Index Index; - int size = w.size(); + Index size = w.size(); // construct a random vector where all coefficients are different VectorType v; v = VectorType::Random(size); - for(int i = 0; i < size; i++) - for(int i2 = 0; i2 < i; i2++) + for(Index i = 0; i < size; i++) + for(Index i2 = 0; i2 < i; i2++) while(v(i) == v(i2)) // yes, == v(i) = ei_random<Scalar>(); Scalar minc = Scalar(1000), maxc = Scalar(-1000); - int minidx=0,maxidx=0; - for(int i = 0; i < size; i++) + Index minidx=0,maxidx=0; + for(Index i = 0; i < size; i++) { if(v(i) < minc) { @@ -100,7 +102,7 @@ maxidx = i; } } - int eigen_minidx, eigen_maxidx; + Index eigen_minidx, eigen_maxidx; Scalar eigen_minc, eigen_maxc; eigen_minc = v.minCoeff(&eigen_minidx); eigen_maxc = v.maxCoeff(&eigen_maxidx);