diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-07-21 00:34:46 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-07-21 00:34:46 +0000 |
commit | c10f069b6b9f0dd4bb313341d1969bd7e1cf9338 (patch) | |
tree | 95934f5bc632a391dfa149783226b1543b24ff41 /test | |
parent | ce425d92f1c1d199c8428c46b4c4ea3be81b137b (diff) |
* Merge Extract and Part to the Part expression.
Renamed "MatrixBase::extract() const" to "MatrixBase::part() const"
* Renamed static functions identity, zero, ones, random with an upper case
first letter: Identity, Zero, Ones and Random.
Diffstat (limited to 'test')
-rw-r--r-- | test/adjoint.cpp | 18 | ||||
-rw-r--r-- | test/array.cpp | 12 | ||||
-rw-r--r-- | test/basicstuff.cpp | 18 | ||||
-rw-r--r-- | test/cholesky.cpp | 4 | ||||
-rw-r--r-- | test/commainitializer.cpp | 6 | ||||
-rw-r--r-- | test/cwiseop.cpp | 18 | ||||
-rw-r--r-- | test/eigensolver.cpp | 4 | ||||
-rw-r--r-- | test/geometry.cpp | 12 | ||||
-rw-r--r-- | test/inverse.cpp | 8 | ||||
-rw-r--r-- | test/linearstructure.cpp | 16 | ||||
-rw-r--r-- | test/map.cpp | 2 | ||||
-rw-r--r-- | test/miscmatrices.cpp | 12 | ||||
-rw-r--r-- | test/nomalloc.cpp | 18 | ||||
-rw-r--r-- | test/product.cpp | 26 | ||||
-rw-r--r-- | test/qr.cpp | 6 | ||||
-rw-r--r-- | test/submatrices.cpp | 18 | ||||
-rw-r--r-- | test/triangular.cpp | 34 |
17 files changed, 116 insertions, 116 deletions
diff --git a/test/adjoint.cpp b/test/adjoint.cpp index cfcf1f0a5..835af5e64 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -35,18 +35,18 @@ template<typename MatrixType> void adjoint(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), + mzero = MatrixType::Zero(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - v3 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + v3 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); Scalar s1 = ei_random<Scalar>(), s2 = ei_random<Scalar>(); diff --git a/test/array.cpp b/test/array.cpp index 3acb4ab55..eb78322c2 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -37,16 +37,16 @@ template<typename MatrixType> void scalarAdd(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols); Scalar s1 = ei_random<Scalar>(), s2 = ei_random<Scalar>(); VERIFY_IS_APPROX(m1.cwise() + s1, s1 + m1.cwise()); - VERIFY_IS_APPROX(m1.cwise() + s1, MatrixType::constant(rows,cols,s1) + m1); - VERIFY_IS_APPROX((m1*Scalar(2)).cwise() - s2, (m1+m1) - MatrixType::constant(rows,cols,s2) ); + VERIFY_IS_APPROX(m1.cwise() + s1, MatrixType::Constant(rows,cols,s1) + m1); + VERIFY_IS_APPROX((m1*Scalar(2)).cwise() - s2, (m1+m1) - MatrixType::Constant(rows,cols,s2) ); m3 = m1; m3.cwise() += s2; VERIFY_IS_APPROX(m3, m1.cwise() + s2); @@ -71,8 +71,8 @@ template<typename MatrixType> void comparisons(const MatrixType& m) int r = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols); VERIFY(((m1.cwise() + Scalar(1)).cwise() > m1).all()); diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 4e3db3c1b..9da5167e6 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -34,17 +34,17 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), + mzero = MatrixType::Zero(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); int r = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); @@ -68,7 +68,7 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) // hence has no _write() method, the corresponding MatrixBase method (here zero()) // should return a const-qualified object so that it is the const-qualified // operator() that gets called, which in turn calls _read(). - VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::zero(rows,cols)(r,c), static_cast<Scalar>(1)); + VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows,cols)(r,c), static_cast<Scalar>(1)); // now test copying a row-vector into a (column-)vector and conversely. square.col(r) = square.row(r).eval(); diff --git a/test/cholesky.cpp b/test/cholesky.cpp index 4c02b4124..eab1febf2 100644 --- a/test/cholesky.cpp +++ b/test/cholesky.cpp @@ -38,8 +38,8 @@ template<typename MatrixType> void cholesky(const MatrixType& m) typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - MatrixType a = MatrixType::random(rows,cols); - VectorType b = VectorType::random(rows); + MatrixType a = MatrixType::Random(rows,cols); + VectorType b = VectorType::Random(rows); SquareMatrixType covMat = a * a.adjoint(); CholeskyWithoutSquareRoot<SquareMatrixType> cholnosqrt(covMat); diff --git a/test/commainitializer.cpp b/test/commainitializer.cpp index acd1fb630..fa3e3e348 100644 --- a/test/commainitializer.cpp +++ b/test/commainitializer.cpp @@ -35,7 +35,7 @@ void test_commainitializer() double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; - m3 = Matrix3d::random(); + m3 = Matrix3d::Random(); m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; VERIFY_IS_APPROX(m3, (Matrix<double,3,3,RowMajorBit>::map(data)) ); @@ -43,14 +43,14 @@ void test_commainitializer() vec[0] << 1, 4, 7; vec[1] << 2, 5, 8; vec[2] << 3, 6, 9; - m3 = Matrix3d::random(); + m3 = Matrix3d::Random(); m3 << vec[0], vec[1], vec[2]; VERIFY_IS_APPROX(m3, (Matrix<double,3,3,RowMajorBit>::map(data)) ); vec[0] << 1, 2, 3; vec[1] << 4, 5, 6; vec[2] << 7, 8, 9; - m3 = Matrix3d::random(); + m3 = Matrix3d::Random(); m3 << vec[0].transpose(), 4, 5, 6, vec[2].transpose(); diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp index 9278dd08d..6e94d4b29 100644 --- a/test/cwiseop.cpp +++ b/test/cwiseop.cpp @@ -42,18 +42,18 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), - mones = MatrixType::ones(rows, cols), + mzero = MatrixType::Zero(rows, cols), + mones = MatrixType::Ones(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); m2 = m2.template binaryExpr<AddIfNull<Scalar> >(mones); diff --git a/test/eigensolver.cpp b/test/eigensolver.cpp index 89cbfe8fc..9837162f6 100644 --- a/test/eigensolver.cpp +++ b/test/eigensolver.cpp @@ -35,14 +35,14 @@ template<typename MatrixType> void eigensolver(const MatrixType& m) typedef typename std::complex<typename NumTraits<typename MatrixType::Scalar>::Real> Complex; - MatrixType a = MatrixType::random(rows,cols); + MatrixType a = MatrixType::Random(rows,cols); MatrixType symmA = a.adjoint() * a; SelfAdjointEigenSolver<MatrixType> eiSymm(symmA); VERIFY_IS_APPROX(symmA * eiSymm.eigenvectors(), (eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal().eval())); // generalized eigen problem Ax = lBx - MatrixType b = MatrixType::random(rows,cols); + MatrixType b = MatrixType::Random(rows,cols); MatrixType symmB = b.adjoint() * b; eiSymm.compute(symmA,symmB); VERIFY_IS_APPROX(symmA * eiSymm.eigenvectors(), symmB * (eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal().eval())); diff --git a/test/geometry.cpp b/test/geometry.cpp index 395d1c2c8..053a3b87a 100644 --- a/test/geometry.cpp +++ b/test/geometry.cpp @@ -42,9 +42,9 @@ template<typename Scalar> void geometry(void) typedef AngleAxis<Scalar> AngleAxis; Quaternion q1, q2; - Vector3 v0 = Vector3::random(), - v1 = Vector3::random(), - v2 = Vector3::random(); + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(), + v2 = Vector3::Random(); Matrix3 matrot1; Scalar a = ei_random<Scalar>(-M_PI, M_PI); @@ -116,7 +116,7 @@ template<typename Scalar> void geometry(void) t1.setIdentity(); t1.affine() = q1.toRotationMatrix(); - v0 << 50, 2, 1;//= Vector3::random().cwiseProduct(Vector3(10,2,0.5)); + v0 << 50, 2, 1;//= Vector3::Random().cwiseProduct(Vector3(10,2,0.5)); t0.scale(v0); t1.prescale(v0); @@ -140,8 +140,8 @@ template<typename Scalar> void geometry(void) // 2D transformation Transform2 t20, t21; - Vector2 v20 = Vector2::random(); - Vector2 v21 = Vector2::random(); + Vector2 v20 = Vector2::Random(); + Vector2 v21 = Vector2::Random(); t21.setIdentity(); t21.affine() = Rotation2D<Scalar>(a).toRotationMatrix(); VERIFY_IS_APPROX(t20.fromPositionOrientationScale(v20,a,v21).matrix(), diff --git a/test/inverse.cpp b/test/inverse.cpp index 0324cd1ea..5614c987d 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp @@ -36,10 +36,10 @@ template<typename MatrixType> void inverse(const MatrixType& m) typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType; - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), - mzero = MatrixType::zero(rows, cols), - identity = MatrixType::identity(rows, rows); + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + mzero = MatrixType::Zero(rows, cols), + identity = MatrixType::Identity(rows, rows); m2 = m1.inverse(); VERIFY_IS_APPROX(m1, m2.inverse() ); diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index 8096d2f3e..8e20b450d 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp @@ -38,17 +38,17 @@ template<typename MatrixType> void linearStructure(const MatrixType& m) // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), + mzero = MatrixType::Zero(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); Scalar s1 = ei_random<Scalar>(); diff --git a/test/map.cpp b/test/map.cpp index 39e40af15..e7c1cf03d 100644 --- a/test/map.cpp +++ b/test/map.cpp @@ -33,7 +33,7 @@ template<typename VectorType> void tmap(const VectorType& m) // test Map.h Scalar* array1 = ei_aligned_malloc<Scalar>(size); Scalar* array2 = ei_aligned_malloc<Scalar>(size); - Map<VectorType, Aligned>(array1, size) = VectorType::random(size); + Map<VectorType, Aligned>(array1, size) = VectorType::Random(size); Map<VectorType>(array2, size) = Map<VectorType>(array1, size); VectorType ma1 = Map<VectorType>(array1, size); VectorType ma2 = Map<VectorType, Aligned>(array2, size); diff --git a/test/miscmatrices.cpp b/test/miscmatrices.cpp index aed7f36f1..5f1e77c8f 100644 --- a/test/miscmatrices.cpp +++ b/test/miscmatrices.cpp @@ -37,18 +37,18 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m) int cols = m.cols(); int r = ei_random<int>(0, rows-1), r2 = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); - VERIFY_IS_APPROX(MatrixType::ones(rows,cols)(r,c), static_cast<Scalar>(1)); - MatrixType m1 = MatrixType::ones(rows,cols); + VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast<Scalar>(1)); + MatrixType m1 = MatrixType::Ones(rows,cols); VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1)); - VectorType v1 = VectorType::random(rows); + VectorType v1 = VectorType::Random(rows); v1[0]; Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> square = v1.asDiagonal(); if(r==r2) VERIFY_IS_APPROX(square(r,r2), v1[r]); else VERIFY_IS_MUCH_SMALLER_THAN(square(r,r2), static_cast<Scalar>(1)); - square = MatrixType::zero(rows, rows); - square.diagonal() = VectorType::ones(rows); - VERIFY_IS_APPROX(square, MatrixType::identity(rows, rows)); + square = MatrixType::Zero(rows, rows); + square.diagonal() = VectorType::Ones(rows); + VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows)); } void test_miscmatrices() diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp index d9653588d..a1b12f57c 100644 --- a/test/nomalloc.cpp +++ b/test/nomalloc.cpp @@ -56,17 +56,17 @@ template<typename MatrixType> void nomalloc(const MatrixType& m) // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), + mzero = MatrixType::Zero(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); Scalar s1 = ei_random<Scalar>(); @@ -82,7 +82,7 @@ template<typename MatrixType> void nomalloc(const MatrixType& m) 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( nomalloc(Matrix<float, 1, 1>()) ); CALL_SUBTEST( nomalloc(Matrix4d()) ); } diff --git a/test/product.cpp b/test/product.cpp index 48999119f..2f6677ff1 100644 --- a/test/product.cpp +++ b/test/product.cpp @@ -54,21 +54,21 @@ template<typename MatrixType> void product(const MatrixType& m) // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols); + mzero = MatrixType::Zero(rows, cols); RowSquareMatrixType - identity = RowSquareMatrixType::identity(rows, rows), - square = RowSquareMatrixType::random(rows, rows), - res = RowSquareMatrixType::random(rows, rows); + identity = RowSquareMatrixType::Identity(rows, rows), + square = RowSquareMatrixType::Random(rows, rows), + res = RowSquareMatrixType::Random(rows, rows); ColSquareMatrixType - square2 = ColSquareMatrixType::random(cols, cols), - res2 = ColSquareMatrixType::random(cols, cols); - RowVectorType v1 = RowVectorType::random(rows), - v2 = RowVectorType::random(rows), - vzero = RowVectorType::zero(rows); - ColVectorType vc2 = ColVectorType::random(cols), vcres; + square2 = ColSquareMatrixType::Random(cols, cols), + res2 = ColSquareMatrixType::Random(cols, cols); + RowVectorType v1 = RowVectorType::Random(rows), + v2 = RowVectorType::Random(rows), + vzero = RowVectorType::Zero(rows); + ColVectorType vc2 = ColVectorType::Random(cols), vcres; OtherMajorMatrixType tm1 = m1; Scalar s1 = ei_random<Scalar>(); @@ -99,7 +99,7 @@ template<typename MatrixType> void product(const MatrixType& m) VERIFY_IS_APPROX(v1, identity*v1); VERIFY_IS_APPROX(v1.transpose(), v1.transpose() * identity); // again, test operator() to check const-qualification - VERIFY_IS_APPROX(MatrixType::identity(rows, cols)(r,c), static_cast<Scalar>(r==c)); + VERIFY_IS_APPROX(MatrixType::Identity(rows, cols)(r,c), static_cast<Scalar>(r==c)); if (rows!=cols) VERIFY_RAISES_ASSERT(m3 = m1*m1); diff --git a/test/qr.cpp b/test/qr.cpp index 716ec94c9..be9e97a04 100644 --- a/test/qr.cpp +++ b/test/qr.cpp @@ -37,10 +37,10 @@ template<typename MatrixType> void qr(const MatrixType& m) typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> SquareMatrixType; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType; - MatrixType a = MatrixType::random(rows,cols); + MatrixType a = MatrixType::Random(rows,cols); QR<MatrixType> qrOfA(a); VERIFY_IS_APPROX(a, qrOfA.matrixQ() * qrOfA.matrixR()); - VERIFY_IS_NOT_APPROX(a+MatrixType::identity(rows, cols), qrOfA.matrixQ() * qrOfA.matrixR()); + VERIFY_IS_NOT_APPROX(a+MatrixType::Identity(rows, cols), qrOfA.matrixQ() * qrOfA.matrixR()); SquareMatrixType b = a.adjoint() * a; @@ -52,7 +52,7 @@ template<typename MatrixType> void qr(const MatrixType& m) HessenbergDecomposition<SquareMatrixType> hess(b); VERIFY_IS_APPROX(b, hess.matrixQ() * hess.matrixH() * hess.matrixQ().adjoint()); VERIFY_IS_APPROX(tridiag.matrixT(), hess.matrixH()); - b = SquareMatrixType::random(cols,cols); + b = SquareMatrixType::Random(cols,cols); hess.compute(b); VERIFY_IS_APPROX(b, hess.matrixQ() * hess.matrixH() * hess.matrixQ().adjoint()); } diff --git a/test/submatrices.cpp b/test/submatrices.cpp index d486943e3..f0475f99f 100644 --- a/test/submatrices.cpp +++ b/test/submatrices.cpp @@ -62,18 +62,18 @@ template<typename MatrixType> void submatrices(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), - mzero = MatrixType::zero(rows, cols), + mzero = MatrixType::Zero(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - v3 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + v3 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); Scalar s1 = ei_random<Scalar>(); diff --git a/test/triangular.cpp b/test/triangular.cpp index 01d4ecf84..185471dc7 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -32,23 +32,23 @@ template<typename MatrixType> void triangular(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - MatrixType m1 = MatrixType::random(rows, cols), - m2 = MatrixType::random(rows, cols), + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), m3(rows, cols), r1(rows, cols), r2(rows, cols), - mzero = MatrixType::zero(rows, cols), - mones = MatrixType::ones(rows, cols), + mzero = MatrixType::Zero(rows, cols), + mones = MatrixType::Ones(rows, cols), identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::identity(rows, rows), + ::Identity(rows, rows), square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> - ::random(rows, rows); - VectorType v1 = VectorType::random(rows), - v2 = VectorType::random(rows), - vzero = VectorType::zero(rows); + ::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); - MatrixType m1up = m1.template extract<Eigen::Upper>(); - MatrixType m2up = m2.template extract<Eigen::Upper>(); + MatrixType m1up = m1.template part<Eigen::Upper>(); + MatrixType m2up = m2.template part<Eigen::Upper>(); if (rows*cols>1) { @@ -70,18 +70,18 @@ template<typename MatrixType> void triangular(const MatrixType& m) m1.setZero(); m1.template part<Eigen::Upper>() = (m2.transpose() * m2).lazy(); m3 = m2.transpose() * m2; - VERIFY_IS_APPROX(m3.template extract<Eigen::Lower>().transpose(), m1); + VERIFY_IS_APPROX(m3.template part<Eigen::Lower>().transpose(), m1); // test overloaded operator= m1.setZero(); m1.template part<Eigen::Lower>() = (m2.transpose() * m2).lazy(); - VERIFY_IS_APPROX(m3.template extract<Eigen::Lower>(), m1); + VERIFY_IS_APPROX(m3.template part<Eigen::Lower>(), m1); // test back and forward subsitution - m1 = MatrixType::random(rows, cols); - VERIFY_IS_APPROX(m1.template extract<Eigen::Upper>() * (m1.template extract<Eigen::Upper>().inverseProduct(m2)), m2); - VERIFY_IS_APPROX(m1.template extract<Eigen::Lower>() * (m1.template extract<Eigen::Lower>().inverseProduct(m2)), m2); - VERIFY((m1.template extract<Eigen::Upper>() * m2.template extract<Eigen::Upper>()).isUpper()); + m1 = MatrixType::Random(rows, cols); + VERIFY_IS_APPROX(m1.template part<Eigen::Upper>() * (m1.template part<Eigen::Upper>().inverseProduct(m2)), m2); + VERIFY_IS_APPROX(m1.template part<Eigen::Lower>() * (m1.template part<Eigen::Lower>().inverseProduct(m2)), m2); + VERIFY((m1.template part<Eigen::Upper>() * m2.template part<Eigen::Upper>()).isUpper()); } |