From 13ad88736e41cd22d057f67e39ba694be76f7010 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 12 Aug 2008 02:14:02 +0000 Subject: [PATCH] last small fixes, this is alpha6, eigen2 is now ready for eigen1 apps to port to. --- CMakeLists.txt | 4 ++++ Doxyfile | 2 +- Eigen/CoreDeclarations | 5 ++++- Eigen/Geometry | 1 + Eigen/src/Core/MatrixBase.h | 3 +++ Eigen/src/Geometry/OrthoMethods.h | 11 ++++++----- Mainpage.dox | 2 +- doc/Doxyfile.in | 5 +++-- doc/snippets/MatrixBase_lazy.cpp | 13 ++++--------- test/adjoint.cpp | 6 ++++++ 10 files changed, 33 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95d5ff1a0..3bfd80a52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") MESSAGE("Enabling SSE3 in tests/examples") ENDIF(TEST_SSE3) + IF(TEST_SSSE3) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") + MESSAGE("Enabling SSSE3 in tests/examples") + ENDIF(TEST_SSSE3) IF(TEST_ALTIVEC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") MESSAGE("Enabling AltiVec in tests/examples") diff --git a/Doxyfile b/Doxyfile index 646fa5867..920a6520a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = Eigen -PROJECT_NUMBER = 2.0-alpha2 +PROJECT_NUMBER = 2.0-alpha6 OUTPUT_DIRECTORY = ./ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/Eigen/CoreDeclarations b/Eigen/CoreDeclarations index f4b8fa8c8..7f391f676 100644 --- a/Eigen/CoreDeclarations +++ b/Eigen/CoreDeclarations @@ -17,14 +17,17 @@ #include #endif #ifdef __SSSE3__ - #include + #include #endif + +/*** Disable AltiVec code for now as it's out of date #elif (defined __ALTIVEC__) #define EIGEN_VECTORIZE #define EIGEN_VECTORIZE_ALTIVEC #include // We _need_ to #undef bool as it's defined in for some reason. #undef bool +***/ #endif #endif diff --git a/Eigen/Geometry b/Eigen/Geometry index 4d7b3f3d4..7a3ca9ede 100644 --- a/Eigen/Geometry +++ b/Eigen/Geometry @@ -9,6 +9,7 @@ namespace Eigen { * This module provides support for: * - fixed-size homogeneous transformations * - 2D and 3D rotations + * - quaternions * - \ref MatrixBase::cross() "cross product" * - \ref MatrixBase::someOrthognal() "orthognal vector generation" * diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 2d4c8b08d..c1bb99141 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -462,6 +462,9 @@ template class MatrixBase template const CwiseUnaryOp::Scalar, NewType>, Derived> cast() const; + /** \returns the matrix or vector obtained by evaluating this expression. + * + */ EIGEN_ALWAYS_INLINE const typename ei_eval::type eval() const { return typename ei_eval::type(derived()); diff --git a/Eigen/src/Geometry/OrthoMethods.h b/Eigen/src/Geometry/OrthoMethods.h index b6206f7b2..57864afec 100644 --- a/Eigen/src/Geometry/OrthoMethods.h +++ b/Eigen/src/Geometry/OrthoMethods.h @@ -47,10 +47,11 @@ MatrixBase::cross(const MatrixBase& other) const } template -struct ei_perpendicular_selector +struct ei_someOrthogonal_selector { typedef typename ei_eval::type VectorType; typedef typename ei_traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; inline static VectorType run(const Derived& src) { VectorType perp; @@ -64,7 +65,7 @@ struct ei_perpendicular_selector if((!ei_isMuchSmallerThan(src.x(), src.z())) || (!ei_isMuchSmallerThan(src.y(), src.z()))) { - Scalar invnm = Scalar(1)/src.template start<2>().norm(); + RealScalar invnm = Scalar(1)/src.template start<2>().norm(); perp.template start<3>() << -ei_conj(src.y())*invnm, ei_conj(src.x())*invnm, 0; } /* if both x and y are close to zero, then the vector is close @@ -73,7 +74,7 @@ struct ei_perpendicular_selector */ else { - Scalar invnm = Scalar(1)/src.template end<2>().norm(); + RealScalar invnm = Scalar(1)/src.template end<2>().norm(); perp.template start<3>() << 0, -ei_conj(src.z())*invnm, ei_conj(src.y())*invnm; } if (Derived::SizeAtCompileTime>3 @@ -85,7 +86,7 @@ struct ei_perpendicular_selector }; template -struct ei_perpendicular_selector +struct ei_someOrthogonal_selector { typedef typename ei_eval::type VectorType; inline static VectorType run(const Derived& src) @@ -104,7 +105,7 @@ typename MatrixBase::EvalType MatrixBase::someOrthogonal() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); - return ei_perpendicular_selector::run(derived()); + return ei_someOrthogonal_selector::run(derived()); } #endif // EIGEN_ORTHOMETHODS_H diff --git a/Mainpage.dox b/Mainpage.dox index bf1db144b..e4789af1d 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -14,6 +14,6 @@ In order to generate the documentation of Eigen, please follow these steps: After doing that, you will find the HTML documentation in the doc/html/ subdirectory of the build directory.

Note however that the documentation is available online here: -http://eigen.tuxfamily.org/wiki +http://eigen.tuxfamily.org/api */ diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 2f1a2d023..353d3b1d4 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -31,7 +31,7 @@ PROJECT_NAME = Eigen # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0-alpha5 +PROJECT_NUMBER = 2.0-alpha6 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -1185,7 +1185,8 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = EIGEN_EMPTY_STRUCT \ EIGEN_PARSED_BY_DOXYGEN \ - EIGEN_VECTORIZE + EIGEN_VECTORIZE \ + EIGEN_QT_SUPPORT # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/doc/snippets/MatrixBase_lazy.cpp b/doc/snippets/MatrixBase_lazy.cpp index 41815c69a..0177b1e51 100644 --- a/doc/snippets/MatrixBase_lazy.cpp +++ b/doc/snippets/MatrixBase_lazy.cpp @@ -1,10 +1,5 @@ Matrix2d m; m << 1,2,3,4; -Matrix2d n; -n = (m*m).lazy(); // if we did "n = m*m;" then m*m would first be evaluated into - // a temporary, because the Product expression has the EvalBeforeAssigningBit. - // This temporary would then be copied into n. Introducing this temporary is - // useless here and wastes time. Doing "n = (m*m).lazy();" evaluates m*m directly - // into n, which is faster. But, beware! This is only correct because m and n - // are two distinct matrices. Doing "m = (m*m).lazy();" would not produce the - // expected result. -cout << n << endl; +cout << (m*m).lazy().row(0) << endl; + // this computes only one row of the product. By contrast, + // if we did "(m*m).row(0);" then m*m would first be evaluated into + // a temporary, because the Product expression has the EvalBeforeNestingBit. diff --git a/test/adjoint.cpp b/test/adjoint.cpp index 835af5e64..3b779f14e 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -80,6 +80,12 @@ template void adjoint(const MatrixType& m) VERIFY_IS_APPROX(m1.conjugate()(r,c), ei_conj(m1(r,c))); VERIFY_IS_APPROX(m1.adjoint()(c,r), ei_conj(m1(r,c))); + if(NumTraits::HasFloatingPoint) + { + // check that Random().normalized() works: tricky as the random xpr must be evaluated by + // normalized() in order to produce a consistent result. + VERIFY_IS_APPROX(VectorType::Random(rows).normalized().norm(), RealScalar(1)); + } } void test_adjoint()