diff options
author | 2009-11-18 18:15:19 +0100 | |
---|---|---|
committer | 2009-11-18 18:15:19 +0100 | |
commit | e3d890bc5a89798eff50ff6650292b4fa934f72e (patch) | |
tree | 3c7d40332a019dce2773fc6a096d046eeab9fb7a /test | |
parent | 0529ecfe1b43d40e40755a2d856188d3ded2c14e (diff) |
Another big refactoring change:
* add a new Eigen2Support module including Cwise, Flagged, and some other deprecated stuff
* add a few cwiseXxx functions
* adapt a few modules to use cwiseXxx instead of the .cwise() prefix
Diffstat (limited to 'test')
-rw-r--r-- | test/array.cpp | 1 | ||||
-rw-r--r-- | test/cwiseop.cpp | 13 | ||||
-rw-r--r-- | test/eigensolver_complex.cpp | 2 | ||||
-rw-r--r-- | test/eigensolver_selfadjoint.cpp | 4 | ||||
-rw-r--r-- | test/geo_alignedbox.cpp | 1 | ||||
-rw-r--r-- | test/geo_eulerangles.cpp | 1 | ||||
-rw-r--r-- | test/geo_homogeneous.cpp | 1 | ||||
-rw-r--r-- | test/geo_hyperplane.cpp | 1 | ||||
-rw-r--r-- | test/geo_orthomethods.cpp | 1 | ||||
-rw-r--r-- | test/geo_parametrizedline.cpp | 1 | ||||
-rw-r--r-- | test/geo_quaternion.cpp | 1 | ||||
-rw-r--r-- | test/geo_transformations.cpp | 5 |
12 files changed, 21 insertions, 11 deletions
diff --git a/test/array.cpp b/test/array.cpp index a18724d3a..9b349db49 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Array> diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp index 7574bcc4a..f5e825d39 100644 --- a/test/cwiseop.cpp +++ b/test/cwiseop.cpp @@ -23,6 +23,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <functional> #include <Eigen/Array> @@ -60,9 +61,9 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) int r = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); - + Scalar s1 = ei_random<Scalar>(); - + // test Zero, Ones, Constant, and the set* variants m3 = MatrixType::Constant(rows, cols, s1); for (int j=0; j<cols; ++j) @@ -84,7 +85,7 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) VERIFY_IS_APPROX(m4.setOnes(rows,cols), mones); m4.fill(s1); VERIFY_IS_APPROX(m4, m3); - + VERIFY_IS_APPROX(v3.setConstant(rows, s1), VectorType::Constant(rows,s1)); VERIFY_IS_APPROX(v3.setZero(rows), vzero); VERIFY_IS_APPROX(v3.setOnes(rows), vones); @@ -107,7 +108,7 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) m3 = m1; m3.cwise() *= m2; VERIFY_IS_APPROX(m3, m1.cwise() * m2); - + VERIFY_IS_APPROX(mones, m2.cwise()/m2); if(NumTraits<Scalar>::HasFloatingPoint) { @@ -122,7 +123,7 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) VERIFY_IS_APPROX(m3.cwise().pow(-1), m3.cwise().inverse()); m3 = m1.cwise().abs(); VERIFY_IS_APPROX(m3.cwise().pow(RealScalar(0.5)), m3.cwise().sqrt()); - + // VERIFY_IS_APPROX(m1.cwise().tan(), m1.cwise().sin().cwise() / m1.cwise().cos()); VERIFY_IS_APPROX(mones, m1.cwise().sin().cwise().square() + m1.cwise().cos().cwise().square()); m3 = m1; @@ -139,7 +140,7 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) VERIFY_IS_APPROX( m1.cwise().max(m2), m2.cwise().max(m1) ); VERIFY_IS_APPROX( m1.cwise().max(m1-mones), m1 ); VERIFY_IS_APPROX( m1.cwise().max(m1+mones), m1+mones ); - + VERIFY( (m1.cwise() == m1).all() ); VERIFY( (m1.cwise() != m2).any() ); VERIFY(!(m1.cwise() == (m1+mones)).any() ); diff --git a/test/eigensolver_complex.cpp b/test/eigensolver_complex.cpp index 756527d57..11b7be5f7 100644 --- a/test/eigensolver_complex.cpp +++ b/test/eigensolver_complex.cpp @@ -52,7 +52,7 @@ template<typename MatrixType> void eigensolver(const MatrixType& m) // Regression test for issue #66 MatrixType z = MatrixType::Zero(rows,cols); ComplexEigenSolver<MatrixType> eiz(z); - VERIFY((eiz.eigenvalues().cwise()==0).all()); + VERIFY((eiz.eigenvalues().cwiseEqual(0)).all()); } void test_eigensolver_complex() diff --git a/test/eigensolver_selfadjoint.cpp b/test/eigensolver_selfadjoint.cpp index 632c1d2e7..f2146cb88 100644 --- a/test/eigensolver_selfadjoint.cpp +++ b/test/eigensolver_selfadjoint.cpp @@ -79,7 +79,7 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m) // compare with eigen VERIFY_IS_APPROX(_eval, eiSymm.eigenvalues()); - VERIFY_IS_APPROX(_evec.cwise().abs(), eiSymm.eigenvectors().cwise().abs()); + VERIFY_IS_APPROX(_evec.cwiseAbs(), eiSymm.eigenvectors().cwiseAbs()); // generalized pb Gsl::eigen_symm_gen(gSymmA, gSymmB, gEval, gEvec); @@ -92,7 +92,7 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m) // std::cerr << _eval.transpose() << "\n" << eiSymmGen.eigenvalues().transpose() << "\n\n"; // std::cerr << _evec.format(6) << "\n\n" << eiSymmGen.eigenvectors().format(6) << "\n\n\n"; VERIFY_IS_APPROX(_eval, eiSymmGen.eigenvalues()); - VERIFY_IS_APPROX(_evec.cwise().abs(), eiSymmGen.eigenvectors().cwise().abs()); + VERIFY_IS_APPROX(_evec.cwiseAbs(), eiSymmGen.eigenvectors().cwiseAbs()); Gsl::free(gSymmA); Gsl::free(gSymmB); diff --git a/test/geo_alignedbox.cpp b/test/geo_alignedbox.cpp index d496578da..d6b6e1bb3 100644 --- a/test/geo_alignedbox.cpp +++ b/test/geo_alignedbox.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_eulerangles.cpp b/test/geo_eulerangles.cpp index 98cdf6a86..049652aab 100644 --- a/test/geo_eulerangles.cpp +++ b/test/geo_eulerangles.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_homogeneous.cpp b/test/geo_homogeneous.cpp index 48d8cbcdf..6bae9c31a 100644 --- a/test/geo_homogeneous.cpp +++ b/test/geo_homogeneous.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> diff --git a/test/geo_hyperplane.cpp b/test/geo_hyperplane.cpp index 3cf5655c2..769bf3183 100644 --- a/test/geo_hyperplane.cpp +++ b/test/geo_hyperplane.cpp @@ -23,6 +23,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_orthomethods.cpp b/test/geo_orthomethods.cpp index 54a6febab..cae860464 100644 --- a/test/geo_orthomethods.cpp +++ b/test/geo_orthomethods.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_parametrizedline.cpp b/test/geo_parametrizedline.cpp index 137324a98..38496a6b0 100644 --- a/test/geo_parametrizedline.cpp +++ b/test/geo_parametrizedline.cpp @@ -23,6 +23,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp index 2e97fe295..9a06a7bd9 100644 --- a/test/geo_quaternion.cpp +++ b/test/geo_quaternion.cpp @@ -23,6 +23,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 84b3c5355..334771261 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -22,6 +22,7 @@ // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. +#define EIGEN2_SUPPORT #include "main.h" #include <Eigen/Geometry> #include <Eigen/LU> @@ -109,7 +110,7 @@ template<typename Scalar, int Mode> void transformations(void) t0.matrix().setZero(); t0 = Transform3::Identity(); VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); - + t0.linear() = q1.toRotationMatrix(); t1.setIdentity(); t1.linear() = q1.toRotationMatrix(); @@ -351,7 +352,7 @@ template<typename Scalar, int Mode> void transformations(void) VERIFY_IS_APPROX(r2d1f.template cast<Scalar>(),r2d1); Rotation2D<double> r2d1d = r2d1.template cast<double>(); VERIFY_IS_APPROX(r2d1d.template cast<Scalar>(),r2d1); - + } void test_geo_transformations() |