diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-03-12 17:17:36 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-03-12 17:17:36 +0000 |
commit | 2ee68a074efc1163358fb3b51fb4b23e83a05f97 (patch) | |
tree | 48df581770a55f8eb9f632aee54c777816478b64 /test | |
parent | 01572b9f54e769a7d1bb3d5073c264a5fbc7ce42 (diff) |
generalized ei_traits<>.
Finally the importing macro is named EIGEN_BASIC_PUBLIC_INTERFACE
because it does not only import the ei_traits, it also makes the base class
a friend, etc.
Diffstat (limited to 'test')
-rw-r--r-- | test/adjoint.cpp | 6 | ||||
-rw-r--r-- | test/basicstuff.cpp | 12 | ||||
-rw-r--r-- | test/cwiseop.cpp | 6 | ||||
-rw-r--r-- | test/linearstructure.cpp | 6 | ||||
-rw-r--r-- | test/main.h | 8 | ||||
-rw-r--r-- | test/miscmatrices.cpp | 6 | ||||
-rw-r--r-- | test/product.cpp | 6 | ||||
-rw-r--r-- | test/submatrices.cpp | 10 |
8 files changed, 30 insertions, 30 deletions
diff --git a/test/adjoint.cpp b/test/adjoint.cpp index 96e3cf6f7..a400e948e 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -33,7 +33,7 @@ template<typename MatrixType> void adjoint(const MatrixType& m) */ typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; int rows = m.rows(); int cols = m.cols(); @@ -41,9 +41,9 @@ template<typename MatrixType> void adjoint(const MatrixType& m) m2 = MatrixType::random(rows, cols), m3(rows, cols), mzero = MatrixType::zero(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index bd009eb0b..5e79ec21c 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -29,7 +29,7 @@ namespace Eigen { template<typename MatrixType> void basicStuff(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; int rows = m.rows(); int cols = m.cols(); @@ -40,9 +40,9 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) m2 = MatrixType::random(rows, cols), m3(rows, cols), mzero = MatrixType::zero(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), @@ -74,13 +74,13 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) // now test copying a row-vector into a (column-)vector and conversely. square.col(r) = square.row(r).eval(); - Matrix<Scalar, 1, MatrixType::Traits::RowsAtCompileTime> rv(rows); - Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> cv(rows); + Matrix<Scalar, 1, MatrixType::RowsAtCompileTime> rv(rows); + Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> cv(rows); rv = square.col(r); cv = square.row(r); VERIFY_IS_APPROX(rv, cv.transpose()); - if(cols!=1 && rows!=1 && MatrixType::Traits::SizeAtCompileTime!=Dynamic) + if(cols!=1 && rows!=1 && MatrixType::SizeAtCompileTime!=Dynamic) { VERIFY_RAISES_ASSERT(m1 = (m2.block(0,0, rows-1, cols-1))); } diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp index 02a0a1afd..5ca51b74e 100644 --- a/test/cwiseop.cpp +++ b/test/cwiseop.cpp @@ -37,7 +37,7 @@ struct AddIfNull { template<typename MatrixType> void cwiseops(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; int rows = m.rows(); int cols = m.cols(); @@ -47,9 +47,9 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) m3(rows, cols), mzero = MatrixType::zero(rows, cols), mones = MatrixType::ones(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index 593f9e7b9..475c6325d 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp @@ -33,7 +33,7 @@ template<typename MatrixType> void linearStructure(const MatrixType& m) */ typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; int rows = m.rows(); int cols = m.cols(); @@ -44,9 +44,9 @@ template<typename MatrixType> void linearStructure(const MatrixType& m) m2 = MatrixType::random(rows, cols), m3(rows, cols), mzero = MatrixType::zero(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), diff --git a/test/main.h b/test/main.h index d139e55af..946572046 100644 --- a/test/main.h +++ b/test/main.h @@ -153,21 +153,21 @@ template<typename Derived1, typename Derived2> inline bool test_ei_isApprox(const MatrixBase<Derived1>& m1, const MatrixBase<Derived2>& m2) { - return m1.isApprox(m2, test_precision<typename Scalar<Derived1>::Type>()); + return m1.isApprox(m2, test_precision<typename ei_traits<Derived1>::Scalar>()); } template<typename Derived1, typename Derived2> inline bool test_ei_isMuchSmallerThan(const MatrixBase<Derived1>& m1, const MatrixBase<Derived2>& m2) { - return m1.isMuchSmallerThan(m2, test_precision<typename Scalar<Derived1>::Type>()); + return m1.isMuchSmallerThan(m2, test_precision<typename ei_traits<Derived1>::Scalar>()); } template<typename Derived> inline bool test_ei_isMuchSmallerThan(const MatrixBase<Derived>& m, - const typename NumTraits<typename Scalar<Derived>::Type>::Real& s) + const typename NumTraits<typename ei_traits<Derived>::Scalar>::Real& s) { - return m.isMuchSmallerThan(s, test_precision<typename Scalar<Derived>::Type>()); + return m.isMuchSmallerThan(s, test_precision<typename ei_traits<Derived>::Scalar>()); } class EigenTest : public QObject diff --git a/test/miscmatrices.cpp b/test/miscmatrices.cpp index e04eb7ecc..54a5934c1 100644 --- a/test/miscmatrices.cpp +++ b/test/miscmatrices.cpp @@ -33,8 +33,8 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m) */ typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; - typedef Matrix<Scalar, 1, MatrixType::Traits::ColsAtCompileTime> RowVectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; int rows = m.rows(); int cols = m.cols(); @@ -44,7 +44,7 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m) VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1)); VectorType v1 = VectorType::random(rows); v1[0]; - Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + 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)); diff --git a/test/product.cpp b/test/product.cpp index 8d802b576..f09b5c33e 100644 --- a/test/product.cpp +++ b/test/product.cpp @@ -33,7 +33,7 @@ template<typename MatrixType> void product(const MatrixType& m) */ typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; int rows = m.rows(); int cols = m.cols(); @@ -44,9 +44,9 @@ template<typename MatrixType> void product(const MatrixType& m) m2 = MatrixType::random(rows, cols), m3(rows, cols), mzero = MatrixType::zero(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), diff --git a/test/submatrices.cpp b/test/submatrices.cpp index 7bb5b2a3c..cba88bda6 100644 --- a/test/submatrices.cpp +++ b/test/submatrices.cpp @@ -59,8 +59,8 @@ template<typename MatrixType> void submatrices(const MatrixType& m) Row.h Column.h Block.h Minor.h DiagonalCoeffs.h */ typedef typename MatrixType::Scalar Scalar; - typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType; - typedef Matrix<Scalar, 1, MatrixType::Traits::ColsAtCompileTime> RowVectorType; + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; + typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; int rows = m.rows(); int cols = m.cols(); @@ -68,9 +68,9 @@ template<typename MatrixType> void submatrices(const MatrixType& m) m2 = MatrixType::random(rows, cols), m3(rows, cols), mzero = MatrixType::zero(rows, cols), - identity = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::identity(rows, rows), - square = Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::RowsAtCompileTime> + square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> ::random(rows, rows); VectorType v1 = VectorType::random(rows), v2 = VectorType::random(rows), @@ -103,7 +103,7 @@ template<typename MatrixType> void submatrices(const MatrixType& m) m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0); //check minor() - CheckMinor<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::ColsAtCompileTime> checkminor(m1,r1,c1); + CheckMinor<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> checkminor(m1,r1,c1); //check diagonal() VERIFY_IS_APPROX(m1.diagonal(), m1.transpose().diagonal()); |