diff -Nru eigen3-3.0.0/bench/BenchTimer.h eigen3-3.0.1/bench/BenchTimer.h --- eigen3-3.0.0/bench/BenchTimer.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/bench/BenchTimer.h 2011-05-30 13:15:37.000000000 +0000 @@ -119,7 +119,7 @@ inline double getCpuTime() { -#ifdef WIN32 +#ifdef _WIN32 LARGE_INTEGER query_ticks; QueryPerformanceCounter(&query_ticks); return query_ticks.QuadPart/m_frequency; @@ -132,7 +132,7 @@ inline double getRealTime() { -#ifdef WIN32 +#ifdef _WIN32 SYSTEMTIME st; GetSystemTime(&st); return (double)st.wSecond + 1.e-3 * (double)st.wMilliseconds; diff -Nru eigen3-3.0.0/debian/changelog eigen3-3.0.1/debian/changelog --- eigen3-3.0.0/debian/changelog 2011-05-12 06:29:37.000000000 +0000 +++ eigen3-3.0.1/debian/changelog 2011-06-02 15:36:00.000000000 +0000 @@ -1,9 +1,31 @@ -eigen3 (3.0.0-1+natty1) natty; urgency=low +eigen3 (3.0.1-1+natty1) natty; urgency=low - * upload to natty - * replaces old eigen to ease transition + * Non-maintainer upload. + * upload for natty. - -- Jochen Sprickerhof Wed, 11 May 2011 22:14:51 -0700 + -- Jochen Sprickerhof Thu, 02 Jun 2011 17:03:20 +0200 + +eigen3 (3.0.1-1) unstable; urgency=low + + * [a67d377] Imported Upstream version 3.0.1 + * [15bbc31] Remove applied by upstream patch (GCC-4.6 compilation issue) + * [1d6c4c0] Switch to compat 8. + * [44e01c6] Add Build-Depends-Indep. + * [93587bd] Enabled verbose mode for tests. + + -- Anton Gladky Mon, 30 May 2011 21:10:28 +0200 + +eigen3 (3.0.0-2) unstable; urgency=low + + * [78ebf3d] Change fix "compilation error with GCC-4.6". + Applied by upstream. Add "using std::ptrdiff_t" instead of fixing it + in many places. + * [d6f36bc] Switch to Standards-Version: 3.9.2 (no changes). + * [f2374a3] Prevent doc-creation on each build. + Hopefully fixes FTBS on kfreebsd* and armel platforms. + * [87a5359] Enable debug-mode for test-units + + -- Anton Gladky Mon, 23 May 2011 19:48:48 +0200 eigen3 (3.0.0-1) unstable; urgency=low diff -Nru eigen3-3.0.0/debian/Changelog_upstream eigen3-3.0.1/debian/Changelog_upstream --- eigen3-3.0.0/debian/Changelog_upstream 2011-05-12 05:09:29.000000000 +0000 +++ eigen3-3.0.1/debian/Changelog_upstream 2011-05-31 20:55:14.000000000 +0000 @@ -1,41 +1,176 @@ -Changelog has been taken from http://eigen.tuxfamily.org/index.php?title=3.0 24/03/2011 -Some important changes between Eigen 2 and Eigen 3 - Core - Much better API, that will be supported for many years. - Improvements in basic expression template mechanisms allow compilers to generate better code. - Now using OpenMP when it is enabled, parallelizing crucial code such as matrix-matrix product. - New Array class provides general-purpose arrays and coefficient-wise operations for matrices. Array module merged into Core. - Indices are now the size of a pointer, e.g. 64 bit on 64 bit platforms, allowing arbitrarily large matrices and giving faster code (no redundant integer conversions). - Cache size parameters can be set at runtime, or are automatically set to sane defaults (using CPUID instruction or equivalent) when first used. - Important optimizations in many places, including in matrix-matrix product which is now nearly as fast as Intel MKL and GotoBLAS, including on multi-CPU systems (see above point about OpenMP). - Better, more extensible support for various scalar types. All standard integer types (signed and unsigned, from 8 to 64 bits) are supported. - Much saner and more comprehensive support for special matrix types: band matrices, permutation matrices... - Vectorization - Better vectorization logic. - Complex numbers are now vectorized. - Better quaternion vectorization. - New supported platform: ARM NEON - Improved SSE support, including use of SSE4 integer multiplication - Updated AltiVec support - Decompositions - Much better, uniform solving API - Much better, uniform API for setting tolerance threshold in rank-revealing decompositions - LU: new partial-pivoting LU, blocking (cache-friendly). - QR: new column-pivoting and full-pivoting householder QR; blocking (cache-friendly) of non-pivoting householder QR. - SVD: new JacobiSVD (very reliable SVD) - Eigenvalues: New general eigensolver, Schur decomposition, etc. Lots of improvements here in speed, reliability and features. - Cholesky: rewritten LLT and LDLT, more reliable and blocking (cache-friendly) - Householder: new general module for dealing with householder transformations - Geometry - Much improved Transform API. It's now much more clear what is an Affine transform, what is a Projective transform, etc. - New Umeyama algorithm for finding the Transform mapping one point set to another - Allow mapping an array as Quaternion - BLAS/LAPACK implementation built on Eigen - That's right, Eigen 3 offers a complete BLAS implementation, passing the BLAS test suite! - And also a partial implementation of LAPACK, passing the relevant LAPACK tests. - Sparse - Countless improvements there, but it's still not 100% stable. - Tests - Much expanded Eigen test suite, now has more than 550 executables - Imported the BLAS test suite, as part of ours - New 'failtests' check that ill-formed code produces expected compilation errors. +Changelog has been taken from + http://eigen.tuxfamily.org/index.php?title=3.0 +and + http://eigen.tuxfamily.org/index.php?title=ChangeLog + + +== Eigen 3.0.1 == + +Released May 30, 2011 + +Changes since 3.0.0: + +* Fix many bugs regarding ARM and NEON (Now all tests succeed on ARM/NEON). +* Fix compilation on gcc 4.6 +* Improved support for custom scalar types: +** Fix memory leak issue for scalar types throwing exceptions. +** Fix implicit scalar type conversion. +** Math functions can be defined in the scalar type's namespace. +* Fix bug in trapezoidal matrix time matrix product. +* Fix asin. +* Fix compilation with MSVC 2005 (SSE was wrongly enabled). +* Fix bug in EigenSolver: normalize the eigen vectors. +* Fix Qt support in Transform. +* Improved documentation. + + +== Eigen 3.0.0 == + +Released March 19, 2011, at the [[Paris_2011_Meeting|meeting]]. + +See the [[3.0|Eigen 3.0 release notes]]. + +Only change since 3.0-rc1: +* Fixed compilation of the unsupported 'openglsupport' test. + + +== Eigen 3.0-rc1 == + +Released March 14, 2011. + +Main changes since 3.0-beta4: + +* Core: added new EIGEN_RUNTIME_NO_MALLOC option and new set_is_malloc_allowed() option to finely control where dynamic memory allocation is allowed. Useful for unit-testing of functions that must not cause dynamic memory allocations. +* Core: SSE performance fixes (follow-up from bug 203). +* Core: Fixed crashes when using EIGEN_DONT_ALIGN or EIGEN_DONT_ALIGN_STATICALLY (bug 213 and friends). +* Core: EIGEN_DONT_ALIGN and EIGEN_DONT_ALIGN_STATICALLY are now covered by unit tests. +* Geometry: Fixed transform * matrix products (bug 207). +* Geometry: compilation fix for mixing CompactAffine with Homogeneous objects +* Geometry: compilation fix for 1D transform +* SVD: fix non-computing constructors (correctly forward computationOptions) (bug 206) +* Sparse: fix resizing when the destination sparse matrix is row major (bug 37) +* more Eigen2Support improvements +* more unit test fixes/improvements +* more documentation improvements +* more compiler warnings fixes +* fixed GDB pretty-printer for dynamic-size matrices (bug 210) + + +== Eigen 3.0-beta4 == + +Released February 28, 2011. + +Main changes since 3.0-beta3: + +* Non-vectorization bug fixes: +** fix bug 89: work around an extremely evil compiler bug on old GCC (<= 4.3) with the standard assert() macro +** fix Umfpack back-end in the complex case +* Vectorization bug fixes: +** fix a segfault in "slice vectorization" when the destination might not be aligned on a scalar (complex) +** fix bug 195: fast SSE unaligned loads fail on GCC/i386 and on Clang +** fix bug 186: worked around a GCC 4.3 i386 backend issue with SSE +** fix bug 203: SSE: a workaround used in pset1() resulted in poor assembly +** worked around a GCC 4.2.4 internal compiler error with vectorization of complex numbers +** lots of AltiVec compilation fixes +** NEON compilation fixes +* API additions and error messages improvements +** Transform: prevent bad user code from compiling +** fix bug 190: directly pass Transform Options to Matrix, allowing to use RowMajor. Fix issues in Transform with non-default Options. +** factorize implementation of standard real unary math functions, and add acos, asin +* Build/tests system +** Lots of unit test improvements +** fix installation of unsupported modules +** fixed many compiler warnings, especially on the Intel compiler and on LLVM/Clang +** CTest/CMake improvements +** added option to build in 32bit mode +* BLAS/LAPACK implementation improvements +** The Blas library and tests are now automatically built as part of the tests. +** expanded LAPACK interface (including syev) +** now Sparse solver backends use our own BLAS/LAPACK implementation +** fix bug 189 (cblat1 test failure) +* Documentation +** improved conservativeResize methods documentation +** documented sorting of eigenvalues +** misc documentation improvements +** improve documentation of plugins + + +== Eigen 3.0-beta3 == + +Released February 12, 2011. + +The biggest news is that the API is now '''100% stable'''. + +Main changes since 3.0-beta2: + +* The "too many to list them all" category: +**lots of bug fixes +**lots of performance fixes +**lots of compiler support fixes +**lots of warning fixes +**lots of unit tests improvements and fixes +**lots of documentation improvements +**lots of build system fixes +*API changes: +**replaced ei_ prefix by internal:: namespace. For example, ei_cos(x) becomes internal::cos(x). +**renamed PlanarRotation -> JacobiRotation +**renamed DenseStorageBase -> PlainObjectBase +**HouseholderSequence API cleanup +**refactored internal metaprogramming helpers to follow closely the standard library +**made UpperBidiagonalization internal +**made BandMatrix/TridiagonalMatrix internal +**Core: also see below, "const correctness". +**Sparse: EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET must be defined to use Eigen/Sparse +**Core: random() now spans over range of width RAND_MAX +*New API: +**Core: added Map static methods taking strides +**SVD: added jacobiSvd() method +**Sparse: many misc improvements and new features. Improved support for Cholmod, Amd, SuperLU and other back-ends. +**Core: allow mixed real-complex dot products +**Geometry: allow mixed real-complex cross products +**Geometry: allow to pass Options parameters to Transform, Quaternion and other templates, to control memory alignment +**QR: add threshold API to FullPivHouseholderQR +**Core: added tan function +*Const correctness: +**Eigen now properly enforces const-correctness everywhere, for example with Map objects. This will break compilation of code that relied on former behavior. +**A new kind of test suite was added to check that, 'failtest'. +*BLAS/LAPACK: +**Complete BLAS library built on top of Eigen. Imported BLAS test suite, which allowed to fix many issues. +**Partial LAPACK implementation. Passing part of the LAPACK test suite, which also allowed to fix some issues. +*Eigen 2 Support: +**tons of improvements in EIGEN2_SUPPORT +**new incremental migration path: see http://eigen.tuxfamily.org/dox-devel/Eigen2SupportModes.html +**imported a copy of the Eigen 2 test suite, made sure that Eigen 3 passes it. That also allowed to fix several issues. + + +== Eigen 3.0-beta2 == + +Released October 15, 2010. + +Main changes since 3.0-beta1: + +* Add support for the vectorization of std::complex<> with SSE, AltiVec and NEON. +* Add support for mixed real * complex matrix products with vectorization. +* Finalize the JacobiSVD class with: compile time options, thin/full decompositions, and least-square solving. +* Several improvement of the Transform class. In particular, there is no default mode anymore. +* New methods: middleRows(), middleCols(), TriangularMatrix::conjugate() +* New unsupported modules: OpenGL, MPFR C++ +* Many improvements in the support of empty objects. +* Many improvements of the vectorization logic. +* Add the possibility to extend QuaternionBase. +* Vectorize Quaternion multiplication with double. +* Significant improvements of the documentation. +* Improved compile time errors. +* Enforce static allocation of temporary buffers in gemm (when possible). +* Fix aligned_delete for null pointers and non trivial dtors. +* Fix eigen decomposition of 3x3 float matrices. +* Fix 4x4 matrix inversions (vectorization). +* Many fixes in QR: solving with m>n, use of rank, etc. +* Fixes for MSVC for windows mobile and CLang. +* Remove the Taucs backend (obsolete). +* Remove the old SVD class (was causing too much troubles, a new decompozition based on bidiagonalisation/householder should come back soon, JacobiSVD can be used meanwhile). + + +== Eigen 3.0-beta1 == + +Released July 5, 2010 diff -Nru eigen3-3.0.0/debian/compat eigen3-3.0.1/debian/compat --- eigen3-3.0.0/debian/compat 2011-05-12 05:09:29.000000000 +0000 +++ eigen3-3.0.1/debian/compat 2011-06-02 15:30:55.000000000 +0000 @@ -1 +1 @@ -7 +8 diff -Nru eigen3-3.0.0/debian/control eigen3-3.0.1/debian/control --- eigen3-3.0.0/debian/control 2011-05-12 06:28:35.000000000 +0000 +++ eigen3-3.0.1/debian/control 2011-06-02 15:33:47.000000000 +0000 @@ -3,7 +3,9 @@ Priority: extra Maintainer: Debian Science Maintainers Uploaders: Anton Gladky -Build-Depends: debhelper (>= 7.0.50), cmake (>= 2.6.2), doxygen-latex, ghostscript, ttf-freefont, graphviz, libjs-jquery +DM-Upload-Allowed: yes +Build-Depends: debhelper (>= 8), cmake (>= 2.6.2) +Build-Depends-Indep: doxygen-latex, ghostscript, ttf-freefont, graphviz, libjs-jquery Standards-Version: 3.9.2 Homepage: http://eigen.tuxfamily.org Vcs-Git: git://git.debian.org/git/debian-science/packages/eigen3.git @@ -13,8 +15,6 @@ Architecture: any Depends: ${misc:Depends} Suggests: libeigen3-doc -Conflicts: eigen (= 3.0.0) -Replaces: eigen (= 3.0.0) Description: lightweight C++ template library for linear algebra Eigen 3 is a lightweight C++ template library for vector and matrix math, a.k.a. linear algebra. diff -Nru eigen3-3.0.0/debian/patches/fix_compile_with_gcc-4-6.patch eigen3-3.0.1/debian/patches/fix_compile_with_gcc-4-6.patch --- eigen3-3.0.0/debian/patches/fix_compile_with_gcc-4-6.patch 2011-05-12 05:09:29.000000000 +0000 +++ eigen3-3.0.1/debian/patches/fix_compile_with_gcc-4-6.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: Fix compilation error with gcc-4.6 -Author: Eigen team -Applied-Upstream: https://bitbucket.org/eigen/eigen/changeset/47098e5d24bc -Last-Update: 2011-05-11 - ---- a/Eigen/Core -+++ b/Eigen/Core -@@ -241,6 +241,8 @@ inline static const char *SimdInstructio - // we use size_t frequently and we'll never remember to prepend it with std:: everytime just to - // ensure QNX/QCC support - using std::size_t; -+// gcc 4.6.0 wants std:: for ptrdiff_t -+using std::ptrdiff_t; - - /** \defgroup Core_Module Core module - * This is the main module of Eigen providing dense matrix and vector support diff -Nru eigen3-3.0.0/debian/patches/series eigen3-3.0.1/debian/patches/series --- eigen3-3.0.0/debian/patches/series 2011-05-12 05:09:29.000000000 +0000 +++ eigen3-3.0.1/debian/patches/series 2011-05-30 19:06:38.000000000 +0000 @@ -1,2 +1 @@ -fix_compile_with_gcc-4-6.patch disable_stdvector-overload.test.patch diff -Nru eigen3-3.0.0/debian/rules eigen3-3.0.1/debian/rules --- eigen3-3.0.0/debian/rules 2011-05-12 05:09:29.000000000 +0000 +++ eigen3-3.0.1/debian/rules 2011-06-01 18:26:11.000000000 +0000 @@ -2,20 +2,25 @@ BUILDDIR = $(CURDIR)/debian/build %: - dh --buildsystem=cmake --builddirectory=${BUILDDIR} $@ + dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR) override_dh_installchangelogs: dh_installchangelogs debian/Changelog_upstream -override_dh_auto_build: - cd ${BUILDDIR}; make doc - rm -f ${BUILDDIR}/doc/html/unsupported/FreeSans.ttf - rm -f ${BUILDDIR}/doc/html/unsupported/installdox - rm -f ${BUILDDIR}/doc/html/jquery.js - rm -f ${BUILDDIR}/doc/html/unsupported/jquery.js - override_dh_auto_test: echo -- Running tests. Even if one of them fails the build is not canceled. -cat /proc/meminfo -cat /proc/cpuinfo - cd ${BUILDDIR}; make check || true + cd $(BUILDDIR); $(MAKE) buildtests + dh_auto_test -- ARGS=-VV || true + +binary-indep: + dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR) --before dh_auto_build + cd $(BUILDDIR); $(MAKE) doc + rm -f $(BUILDDIR)/doc/html/unsupported/installdox + dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR) --after dh_auto_build + +binary-arch: + dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR) + +binary: binary-indep diff -Nru eigen3-3.0.0/doc/A05_PortingFrom2To3.dox eigen3-3.0.1/doc/A05_PortingFrom2To3.dox --- eigen3-3.0.0/doc/A05_PortingFrom2To3.dox 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/A05_PortingFrom2To3.dox 2011-05-30 13:15:37.000000000 +0000 @@ -287,7 +287,7 @@ A common issue with Eigen 2 was that when mapping an array with Map, there was no way to tell Eigen that your array was aligned. There was a ForceAligned option but it didn't mean that; it was just confusing and has been removed. -New in Eigen3 is the Aligned option. See the documentation of class Map. Use it like this: +New in Eigen3 is the #Aligned option. See the documentation of class Map. Use it like this: \code Map myMappedVector(some_aligned_array); \endcode diff -Nru eigen3-3.0.0/doc/C03_TutorialArrayClass.dox eigen3-3.0.1/doc/C03_TutorialArrayClass.dox --- eigen3-3.0.0/doc/C03_TutorialArrayClass.dox 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/C03_TutorialArrayClass.dox 2011-05-30 13:15:37.000000000 +0000 @@ -37,7 +37,7 @@ Eigen also provides typedefs for some common cases, in a way that is similar to the Matrix typedefs but with some slight differences, as the word "array" is used for both 1-dimensional and 2-dimensional arrays. -We adopt that convention that typedefs of the form ArrayNt stand for 1-dimensional arrays, where N and t are +We adopt the convention that typedefs of the form ArrayNt stand for 1-dimensional arrays, where N and t are the size and the scalar type, as in the Matrix typedefs explained on \ref TutorialMatrixClass "this page". For 2-dimensional arrays, we use typedefs of the form ArrayNNt. Some examples are shown in the following table: @@ -104,8 +104,8 @@ First of all, of course you can multiply an array by a scalar, this works in the same way as matrices. Where arrays are fundamentally different from matrices, is when you multiply two together. Matrices interpret -multiplication as the matrix product and arrays interpret multiplication as the coefficient-wise product. Thus, two -arrays can be multiplied if they have the same size. +multiplication as matrix product and arrays interpret multiplication as coefficient-wise product. Thus, two +arrays can be multiplied if and only if they have the same dimensions. @@ -119,8 +119,8 @@ \section TutorialArrayClassCwiseOther Other coefficient-wise operations -The Array class defined other coefficient-wise operations besides the addition, subtraction and multiplication -operators described about. For example, the \link ArrayBase::abs() .abs() \endlink method takes the absolute +The Array class defines other coefficient-wise operations besides the addition, subtraction and multiplication +operators described above. For example, the \link ArrayBase::abs() .abs() \endlink method takes the absolute value of each coefficient, while \link ArrayBase::sqrt() .sqrt() \endlink computes the square root of the coefficients. If you have two arrays of the same size, you can call \link ArrayBase::min() .min() \endlink to construct the array whose coefficients are the minimum of the corresponding coefficients of the two given diff -Nru eigen3-3.0.0/doc/C08_TutorialGeometry.dox eigen3-3.0.1/doc/C08_TutorialGeometry.dox --- eigen3-3.0.0/doc/C08_TutorialGeometry.dox 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/C08_TutorialGeometry.dox 2011-05-30 13:15:37.000000000 +0000 @@ -48,7 +48,7 @@ AngleAxis aa(angle_in_radian, Vector3f(ax,ay,az));\endcode +Quaternion q; q = AngleAxis(angle_in_radian, axis);\endcode
Example:Output:
3D rotation as a \ref Quaternion "quaternion"\code -Quaternion q = AngleAxis(angle_in_radian, axis);\endcode
N-D Scaling\code Scaling(sx, sy) @@ -88,13 +88,13 @@ or to a more generic type. Here are some additional examples:
\code -Rotation2Df r = Matrix2f(..); // assumes a pure rotation matrix -AngleAxisf aa = Quaternionf(..); -AngleAxisf aa = Matrix3f(..); // assumes a pure rotation matrix -Matrix2f m = Rotation2Df(..); -Matrix3f m = Quaternionf(..); Matrix3f m = Scaling3f(..); -Affine3f m = AngleAxis3f(..); Affine3f m = Scaling3f(..); -Affine3f m = Translation3f(..); Affine3f m = Matrix3f(..); +Rotation2Df r; r = Matrix2f(..); // assumes a pure rotation matrix +AngleAxisf aa; aa = Quaternionf(..); +AngleAxisf aa; aa = Matrix3f(..); // assumes a pure rotation matrix +Matrix2f m; m = Rotation2Df(..); +Matrix3f m; m = Quaternionf(..); Matrix3f m; m = Scaling3f(..); +Affine3f m; m = AngleAxis3f(..); Affine3f m; m = Scaling3f(..); +Affine3f m; m = Translation3f(..); Affine3f m; m = Matrix3f(..); \endcode
diff -Nru eigen3-3.0.0/doc/Doxyfile.in eigen3-3.0.1/doc/Doxyfile.in --- eigen3-3.0.0/doc/Doxyfile.in 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/Doxyfile.in 2011-05-30 13:15:37.000000000 +0000 @@ -488,7 +488,7 @@ # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. -SHOW_NAMESPACES = NO +SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from diff -Nru eigen3-3.0.0/doc/I03_InsideEigenExample.dox eigen3-3.0.1/doc/I03_InsideEigenExample.dox --- eigen3-3.0.0/doc/I03_InsideEigenExample.dox 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/I03_InsideEigenExample.dox 2011-05-30 13:15:37.000000000 +0000 @@ -400,7 +400,7 @@ internal::pstoret(m_storage.data() + index, x); } \endcode -Here, \a StoreMode is \a Aligned, indicating that we are doing a 128-bit-aligned write access, \a PacketScalar is a type representing a "SSE packet of 4 floats" and internal::pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in src/Core/arch/SSE/PacketMath.h: +Here, \a StoreMode is \a #Aligned, indicating that we are doing a 128-bit-aligned write access, \a PacketScalar is a type representing a "SSE packet of 4 floats" and internal::pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in src/Core/arch/SSE/PacketMath.h: The line in src/Core/arch/SSE/PacketMath.h that determines the PacketScalar type (via a typedef in Matrix.h) is: \code @@ -442,7 +442,7 @@ } }; \endcode -Here, \a m_lhs is the vector \a v, and \a m_rhs is the vector \a w. So the packet() function here is Matrix::packet(). The template parameter \a LoadMode is \a Aligned. So we're looking at +Here, \a m_lhs is the vector \a v, and \a m_rhs is the vector \a w. So the packet() function here is Matrix::packet(). The template parameter \a LoadMode is \a #Aligned. So we're looking at \code class Matrix { diff -Nru eigen3-3.0.0/doc/QuickReference.dox eigen3-3.0.1/doc/QuickReference.dox --- eigen3-3.0.0/doc/QuickReference.dox 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/doc/QuickReference.dox 2011-05-30 13:15:37.000000000 +0000 @@ -535,7 +535,7 @@ vec.reverseInPlace() \endcode -\subsection QuickRef_Reverse Replicate +\subsection QuickRef_Replicate Replicate Vectors, matrices, rows, and/or columns can be replicated in any direction (see DenseBase::replicate(), VectorwiseOp::replicate()) \code vec.replicate(times) vec.replicate @@ -594,7 +594,7 @@
\code m.triangularView() \endcode \n -\c Xxx = Upper, Lower, StrictlyUpper, StrictlyLower, UnitUpper, UnitLower +\c Xxx = ::Upper, ::Lower, ::StrictlyUpper, ::StrictlyLower, ::UnitUpper, ::UnitLower
Writing to a specific triangular part:\n (only the referenced triangular part is evaluated) @@ -645,14 +645,14 @@
Rank 1 and rank K update: \n -\f$ upper(M_1) += s1 M_2^* M_2 \f$ \n -\f$ lower(M_1) -= M_2 M_2^* \f$ +\f$ upper(M_1) \mathrel{{+}{=}} s_1 M_2^* M_2 \f$ \n +\f$ lower(M_1) \mathbin{{-}{=}} M_2 M_2^* \f$ \n \code M1.selfadjointView().rankUpdate(M2,s1); m1.selfadjointView().rankUpdate(m2.adjoint(),-1); \endcode
-Rank 2 update: (\f$ M += s u v^* + s v u^* \f$) +Rank 2 update: (\f$ M \mathrel{{+}{=}} s u v^* + s v u^* \f$) \code M.selfadjointView().rankUpdate(u,v,s); \endcode diff -Nru eigen3-3.0.0/Eigen/Core eigen3-3.0.1/Eigen/Core --- eigen3-3.0.0/Eigen/Core 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/Core 2011-05-30 13:15:37.000000000 +0000 @@ -51,16 +51,16 @@ #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER #endif #endif -#endif - -// Remember that usage of defined() in a #define is undefined by the standard -#if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) ) - #define EIGEN_SSE2_BUT_NOT_OLD_GCC +#else + // Remember that usage of defined() in a #define is undefined by the standard + #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) ) + #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC + #endif #endif #ifndef EIGEN_DONT_VECTORIZE - #if defined (EIGEN_SSE2_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) + #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) // Defines symbols for compile-time detection of which instructions are // used. @@ -143,6 +143,7 @@ #ifdef EIGEN_HAS_ERRNO #include #endif +#include #include #include #include @@ -184,6 +185,7 @@ // defined in bits/termios.h #undef B0 +/** \brief Namespace containing all symbols from the %Eigen library. */ namespace Eigen { inline static const char *SimdInstructionSetsInUse(void) { @@ -239,6 +241,8 @@ // we use size_t frequently and we'll never remember to prepend it with std:: everytime just to // ensure QNX/QCC support using std::size_t; +// gcc 4.6.0 wants std:: for ptrdiff_t +using std::ptrdiff_t; /** \defgroup Core_Module Core module * This is the main module of Eigen providing dense matrix and vector support diff -Nru eigen3-3.0.0/Eigen/src/Core/arch/NEON/Complex.h eigen3-3.0.1/Eigen/src/Core/arch/NEON/Complex.h --- eigen3-3.0.0/Eigen/src/Core/arch/NEON/Complex.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/arch/NEON/Complex.h 2011-05-30 13:15:37.000000000 +0000 @@ -43,6 +43,7 @@ typedef Packet2cf type; enum { Vectorizable = 1, + AlignedOnScalar = 1, size = 2, HasAdd = 1, diff -Nru eigen3-3.0.0/Eigen/src/Core/arch/NEON/PacketMath.h eigen3-3.0.1/Eigen/src/Core/arch/NEON/PacketMath.h --- eigen3-3.0.0/Eigen/src/Core/arch/NEON/PacketMath.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/arch/NEON/PacketMath.h 2011-05-30 13:15:37.000000000 +0000 @@ -100,12 +100,12 @@ template<> EIGEN_STRONG_INLINE Packet4f plset(const float& a) { - Packet4f countdown = { 3, 2, 1, 0 }; + Packet4f countdown = { 0, 1, 2, 3 }; return vaddq_f32(pset1(a), countdown); } template<> EIGEN_STRONG_INLINE Packet4i plset(const int& a) { - Packet4i countdown = { 3, 2, 1, 0 }; + Packet4i countdown = { 0, 1, 2, 3 }; return vaddq_s32(pset1(a), countdown); } @@ -191,14 +191,14 @@ { float32x2_t lo, hi; lo = vdup_n_f32(*from); - hi = vdup_n_f32(*from); + hi = vdup_n_f32(*(from+1)); return vcombine_f32(lo, hi); } template<> EIGEN_STRONG_INLINE Packet4i ploaddup(const int* from) { int32x2_t lo, hi; lo = vdup_n_s32(*from); - hi = vdup_n_s32(*from); + hi = vdup_n_s32(*(from+1)); return vcombine_s32(lo, hi); } diff -Nru eigen3-3.0.0/Eigen/src/Core/ArrayWrapper.h eigen3-3.0.1/Eigen/src/Core/ArrayWrapper.h --- eigen3-3.0.0/Eigen/src/Core/ArrayWrapper.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/ArrayWrapper.h 2011-05-30 13:15:37.000000000 +0000 @@ -53,6 +53,12 @@ EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + typedef typename internal::nested::type NestedExpressionType; inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} @@ -62,6 +68,9 @@ inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col); @@ -151,6 +160,12 @@ EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + typedef typename internal::nested::type NestedExpressionType; inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} @@ -160,6 +175,9 @@ inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col); diff -Nru eigen3-3.0.0/Eigen/src/Core/BandMatrix.h eigen3-3.0.1/Eigen/src/Core/BandMatrix.h --- eigen3-3.0.0/Eigen/src/Core/BandMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/BandMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -180,7 +180,7 @@ * \param Cols Number of columns, or \b Dynamic * \param Supers Number of super diagonal * \param Subs Number of sub diagonal - * \param _Options A combination of either \b RowMajor or \b ColMajor, and of \b SelfAdjoint + * \param _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint * The former controls \ref TopicStorageOrders "storage order", and defaults to * column-major. The latter controls whether the matrix represents a selfadjoint * matrix in which case either Supers of Subs have to be null. diff -Nru eigen3-3.0.0/Eigen/src/Core/DenseCoeffsBase.h eigen3-3.0.1/Eigen/src/Core/DenseCoeffsBase.h --- eigen3-3.0.0/Eigen/src/Core/DenseCoeffsBase.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/DenseCoeffsBase.h 2011-05-30 13:15:37.000000000 +0000 @@ -35,7 +35,7 @@ /** \brief Base class providing read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam ReadOnlyAccessors Constant indicating read-only access + * \tparam #ReadOnlyAccessors Constant indicating read-only access * * This class defines the \c operator() \c const function and friends, which can be used to read specific * entries of a matrix or array. @@ -212,7 +212,7 @@ * to ensure that a packet really starts there. This method is only available on expressions having the * PacketAccessBit. * - * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets * starting at an address which is a multiple of the packet size. */ @@ -239,7 +239,7 @@ * to ensure that a packet really starts there. This method is only available on expressions having the * PacketAccessBit and the LinearAccessBit. * - * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets * starting at an address which is a multiple of the packet size. */ @@ -275,7 +275,7 @@ /** \brief Base class providing read/write coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam WriteAccessors Constant indicating read/write access + * \tparam #WriteAccessors Constant indicating read/write access * * This class defines the non-const \c operator() function and friends, which can be used to write specific * entries of a matrix or array. This class inherits DenseCoeffsBase which @@ -433,7 +433,7 @@ * to ensure that a packet really starts there. This method is only available on expressions having the * PacketAccessBit. * - * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets * starting at an address which is a multiple of the packet size. */ @@ -567,7 +567,7 @@ /** \brief Base class providing direct read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam DirectAccessors Constant indicating direct access + * \tparam #DirectAccessors Constant indicating direct access * * This class defines functions to work with strides which can be used to access entries directly. This class * inherits DenseCoeffsBase which defines functions to access entries read-only using @@ -637,7 +637,7 @@ /** \brief Base class providing direct read/write coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam DirectAccessors Constant indicating direct access + * \tparam #DirectWriteAccessors Constant indicating direct access * * This class defines functions to work with strides which can be used to access entries directly. This class * inherits DenseCoeffsBase which defines functions to access entries read/write using diff -Nru eigen3-3.0.0/Eigen/src/Core/DenseStorage.h eigen3-3.0.1/Eigen/src/Core/DenseStorage.h --- eigen3-3.0.0/Eigen/src/Core/DenseStorage.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/DenseStorage.h 2011-05-30 13:15:37.000000000 +0000 @@ -58,7 +58,7 @@ #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ eigen_assert((reinterpret_cast(array) & sizemask) == 0 \ && "this assertion is explained here: " \ - "http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html" \ + "http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html" \ " **** READ THIS WEB PAGE !!! ****"); #endif diff -Nru eigen3-3.0.0/Eigen/src/Core/Functors.h eigen3-3.0.1/Eigen/src/Core/Functors.h --- eigen3-3.0.0/Eigen/src/Core/Functors.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/Functors.h 2011-05-30 13:15:37.000000000 +0000 @@ -116,7 +116,7 @@ */ template struct scalar_min_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_min_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); } + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::min; return min(a, b); } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const { return internal::pmin(a,b); } @@ -139,7 +139,7 @@ */ template struct scalar_max_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_max_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); } + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::max; return max(a, b); } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const { return internal::pmax(a,b); } @@ -165,8 +165,10 @@ // typedef typename NumTraits::Real result_type; EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const { - Scalar p = std::max(_x, _y); - Scalar q = std::min(_x, _y); + using std::max; + using std::min; + Scalar p = max(_x, _y); + Scalar q = min(_x, _y); Scalar qp = q/p; return p * sqrt(Scalar(1) + qp*qp); } @@ -605,7 +607,7 @@ EIGEN_STRONG_INLINE const Packet packetOp(Index row, Index col) const { eigen_assert(col==0 || row==0); - return impl(col + row); + return impl.packetOp(col + row); } // This proxy object handles the actual required temporaries, the different @@ -750,9 +752,9 @@ */ template struct scalar_asin_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op) - inline const Scalar operator() (const Scalar& a) const { return acos(a); } + inline const Scalar operator() (const Scalar& a) const { return asin(a); } typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pacos(a); } + inline Packet packetOp(const Packet& a) const { return internal::pasin(a); } }; template struct functor_traits > diff -Nru eigen3-3.0.0/Eigen/src/Core/Fuzzy.h eigen3-3.0.1/Eigen/src/Core/Fuzzy.h --- eigen3-3.0.0/Eigen/src/Core/Fuzzy.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/Fuzzy.h 2011-05-30 13:15:37.000000000 +0000 @@ -34,9 +34,10 @@ { static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) { + using std::min; const typename internal::nested::type nested(x); const typename internal::nested::type otherNested(y); - return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * std::min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/GenericPacketMath.h eigen3-3.0.1/Eigen/src/Core/GenericPacketMath.h --- eigen3-3.0.0/Eigen/src/Core/GenericPacketMath.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/GenericPacketMath.h 2011-05-30 13:15:37.000000000 +0000 @@ -134,12 +134,12 @@ /** \internal \returns the min of \a a and \a b (coeff-wise) */ template inline Packet pmin(const Packet& a, - const Packet& b) { return std::min(a, b); } + const Packet& b) { using std::min; return min(a, b); } /** \internal \returns the max of \a a and \a b (coeff-wise) */ template inline Packet pmax(const Packet& a, - const Packet& b) { return std::max(a, b); } + const Packet& b) { using std::max; return max(a, b); } /** \internal \returns the absolute value of \a a */ template inline Packet @@ -286,7 +286,7 @@ { return padd(pmul(a, b),c); } /** \internal \returns a packet version of \a *from. - * \If LoadMode equals Aligned, \a from must be 16 bytes aligned */ + * If LoadMode equals #Aligned, \a from must be 16 bytes aligned */ template inline Packet ploadt(const typename unpacket_traits::type* from) { @@ -297,7 +297,7 @@ } /** \internal copy the packet \a from to \a *to. - * If StoreMode equals Aligned, \a to must be 16 bytes aligned */ + * If StoreMode equals #Aligned, \a to must be 16 bytes aligned */ template inline void pstoret(Scalar* to, const Packet& from) { diff -Nru eigen3-3.0.0/Eigen/src/Core/IO.h eigen3-3.0.1/Eigen/src/Core/IO.h --- eigen3-3.0.0/Eigen/src/Core/IO.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/IO.h 2011-05-30 13:15:37.000000000 +0000 @@ -141,7 +141,8 @@ typedef typename NumTraits::Real RealScalar; static inline int run() { - return cast(std::ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); + using std::ceil; + return cast(ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/MapBase.h eigen3-3.0.1/Eigen/src/Core/MapBase.h --- eigen3-3.0.0/Eigen/src/Core/MapBase.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/MapBase.h 2011-05-30 13:15:37.000000000 +0000 @@ -238,7 +238,7 @@ (this->m_data + index * innerStride(), x); } - inline MapBase(PointerType data) : Base(data) {} + explicit inline MapBase(PointerType data) : Base(data) {} inline MapBase(PointerType data, Index size) : Base(data, size) {} inline MapBase(PointerType data, Index rows, Index cols) : Base(data, rows, cols) {} diff -Nru eigen3-3.0.0/Eigen/src/Core/Map.h eigen3-3.0.1/Eigen/src/Core/Map.h --- eigen3-3.0.0/Eigen/src/Core/Map.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/Map.h 2011-05-30 13:15:37.000000000 +0000 @@ -31,10 +31,10 @@ * * \brief A matrix or vector expression mapping an existing array of data. * - * \param PlainObjectType the equivalent matrix type of the mapped data - * \param MapOptions specifies whether the pointer is \c Aligned, or \c Unaligned. - * The default is \c Unaligned. - * \param StrideType optionnally specifies strides. By default, Map assumes the memory layout + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionnally specifies strides. By default, Map assumes the memory layout * of an ordinary, contiguous array. This can be overridden by specifying strides. * The type passed here must be a specialization of the Stride template, see examples below. * diff -Nru eigen3-3.0.0/Eigen/src/Core/MathFunctions.h eigen3-3.0.1/Eigen/src/Core/MathFunctions.h --- eigen3-3.0.0/Eigen/src/Core/MathFunctions.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/MathFunctions.h 2011-05-30 13:15:37.000000000 +0000 @@ -87,7 +87,8 @@ { static inline RealScalar run(const std::complex& x) { - return std::real(x); + using std::real; + return real(x); } }; @@ -122,7 +123,8 @@ { static inline RealScalar run(const std::complex& x) { - return std::imag(x); + using std::imag; + return imag(x); } }; @@ -244,7 +246,8 @@ { static inline std::complex run(const std::complex& x) { - return std::conj(x); + using std::conj; + return conj(x); } }; @@ -270,7 +273,8 @@ typedef typename NumTraits::Real RealScalar; static inline RealScalar run(const Scalar& x) { - return std::abs(x); + using std::abs; + return abs(x); } }; @@ -305,7 +309,8 @@ { static inline RealScalar run(const std::complex& x) { - return std::norm(x); + using std::norm; + return norm(x); } }; @@ -369,10 +374,12 @@ typedef typename NumTraits::Real RealScalar; static inline RealScalar run(const Scalar& x, const Scalar& y) { + using std::max; + using std::min; RealScalar _x = abs(x); RealScalar _y = abs(y); - RealScalar p = std::max(_x, _y); - RealScalar q = std::min(_x, _y); + RealScalar p = max(_x, _y); + RealScalar q = min(_x, _y); RealScalar qp = q/p; return p * sqrt(RealScalar(1) + qp*qp); } @@ -420,7 +427,8 @@ { static inline Scalar run(const Scalar& x) { - return std::sqrt(x); + using std::sqrt; + return sqrt(x); } }; @@ -460,7 +468,7 @@ // This macro instanciate all the necessary template mechanism which is common to all unary real functions. #define EIGEN_MATHFUNC_STANDARD_REAL_UNARY(NAME) \ template struct NAME##_default_impl { \ - static inline Scalar run(const Scalar& x) { return std::NAME(x); } \ + static inline Scalar run(const Scalar& x) { using std::NAME; return NAME(x); } \ }; \ template struct NAME##_default_impl { \ static inline Scalar run(const Scalar&) { \ @@ -495,7 +503,8 @@ typedef Scalar retval; static inline Scalar run(const Scalar& x, const Scalar& y) { - return std::atan2(x, y); + using std::atan2; + return atan2(x, y); } }; @@ -534,7 +543,8 @@ typedef Scalar retval; static inline Scalar run(const Scalar& x, const Scalar& y) { - return std::pow(x, y); + using std::pow; + return pow(x, y); } }; @@ -726,7 +736,8 @@ } static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - return abs(x - y) <= std::min(abs(x), abs(y)) * prec; + using std::min; + return abs(x - y) <= min(abs(x), abs(y)) * prec; } static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) { @@ -764,7 +775,8 @@ } static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - return abs2(x - y) <= std::min(abs2(x), abs2(y)) * prec * prec; + using std::min; + return abs2(x - y) <= min(abs2(x), abs2(y)) * prec * prec; } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/Matrix.h eigen3-3.0.1/Eigen/src/Core/Matrix.h --- eigen3-3.0.0/Eigen/src/Core/Matrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/Matrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -43,8 +43,8 @@ * \tparam _Cols Number of columns, or \b Dynamic * * The remaining template parameters are optional -- in most cases you don't have to worry about them. - * \tparam _Options \anchor matrix_tparam_options A combination of either \b RowMajor or \b ColMajor, and of either - * \b AutoAlign or \b DontAlign. + * \tparam _Options \anchor matrix_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \b #AutoAlign or \b #DontAlign. * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note"). diff -Nru eigen3-3.0.0/Eigen/src/Core/Product.h eigen3-3.0.1/Eigen/src/Core/Product.h --- eigen3-3.0.0/Eigen/src/Core/Product.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/Product.h 2011-05-30 13:15:37.000000000 +0000 @@ -375,8 +375,23 @@ template struct gemv_static_vector_if { + #if EIGEN_ALIGN_STATICALLY internal::plain_array m_data; EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + enum { + ForceAlignment = internal::packet_traits::Vectorizable, + PacketSize = internal::packet_traits::size + }; + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { + return ForceAlignment + ? reinterpret_cast((reinterpret_cast(m_data.array) & ~(size_t(15))) + 16) + : m_data.array; + } + #endif }; template<> struct gemv_selector @@ -411,28 +426,21 @@ gemv_static_vector_if static_dest; - bool alphaIsCompatible = (!ComplexByReal) || (imag(actualAlpha)==RealScalar(0)); + // this is written like this (i.e., with a ?:) to workaround an ICE with ICC 12 + bool alphaIsCompatible = (!ComplexByReal) ? true : (imag(actualAlpha)==RealScalar(0)); bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; RhsScalar compatibleAlpha = get_factor::run(actualAlpha); - ResScalar* actualDestPtr; - bool freeDestPtr = false; - if (evalToDest) - { - actualDestPtr = &dest.coeffRef(0); - } - else + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualDestPtr = static_dest.data())==0) - { - freeDestPtr = true; - actualDestPtr = ei_aligned_stack_new(ResScalar,dest.size()); - } if(!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); @@ -456,7 +464,6 @@ dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); else dest = MappedDest(actualDestPtr, dest.size()); - if(freeDestPtr) ei_aligned_stack_delete(ResScalar, actualDestPtr, dest.size()); } } }; @@ -490,23 +497,15 @@ gemv_static_vector_if static_rhs; - RhsScalar* actualRhsPtr; - bool freeRhsPtr = false; - if (DirectlyUseRhs) - { - actualRhsPtr = const_cast(&actualRhs.coeffRef(0)); - } - else + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualRhsPtr = static_rhs.data())==0) - { - freeRhsPtr = true; - actualRhsPtr = ei_aligned_stack_new(RhsScalar, actualRhs.size()); - } Map(actualRhsPtr, actualRhs.size()) = actualRhs; } @@ -517,8 +516,6 @@ actualRhsPtr, 1, &dest.coeffRef(0,0), dest.innerStride(), actualAlpha); - - if((!DirectlyUseRhs) && freeRhsPtr) ei_aligned_stack_delete(RhsScalar, actualRhsPtr, prod.rhs().size()); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/GeneralMatrixMatrix.h eigen3-3.0.1/Eigen/src/Core/products/GeneralMatrixMatrix.h --- eigen3-3.0.0/Eigen/src/Core/products/GeneralMatrixMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/GeneralMatrixMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -94,8 +94,9 @@ std::size_t sizeA = kc*mc; std::size_t sizeW = kc*Traits::WorkSpaceFactor; - LhsScalar* blockA = ei_aligned_stack_new(LhsScalar, sizeA); - RhsScalar* w = ei_aligned_stack_new(RhsScalar, sizeW); + ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, sizeA, 0); + ei_declare_aligned_stack_constructed_variable(RhsScalar, w, sizeW, 0); + RhsScalar* blockB = blocking.blockB(); eigen_internal_assert(blockB!=0); @@ -154,9 +155,6 @@ #pragma omp atomic --(info[j].users); } - - ei_aligned_stack_delete(LhsScalar, blockA, kc*mc); - ei_aligned_stack_delete(RhsScalar, w, sizeW); } else #endif // EIGEN_HAS_OPENMP @@ -167,9 +165,10 @@ std::size_t sizeA = kc*mc; std::size_t sizeB = kc*cols; std::size_t sizeW = kc*Traits::WorkSpaceFactor; - LhsScalar *blockA = blocking.blockA()==0 ? ei_aligned_stack_new(LhsScalar, sizeA) : blocking.blockA(); - RhsScalar *blockB = blocking.blockB()==0 ? ei_aligned_stack_new(RhsScalar, sizeB) : blocking.blockB(); - RhsScalar *blockW = blocking.blockW()==0 ? ei_aligned_stack_new(RhsScalar, sizeW) : blocking.blockW(); + + ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, sizeA, blocking.blockA()); + ei_declare_aligned_stack_constructed_variable(RhsScalar, blockB, sizeB, blocking.blockB()); + ei_declare_aligned_stack_constructed_variable(RhsScalar, blockW, sizeW, blocking.blockW()); // For each horizontal panel of the rhs, and corresponding panel of the lhs... // (==GEMM_VAR1) @@ -200,10 +199,6 @@ } } - - if(blocking.blockA()==0) ei_aligned_stack_delete(LhsScalar, blockA, sizeA); - if(blocking.blockB()==0) ei_aligned_stack_delete(RhsScalar, blockB, sizeB); - if(blocking.blockW()==0) ei_aligned_stack_delete(RhsScalar, blockW, sizeW); } } diff -Nru eigen3-3.0.0/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h eigen3-3.0.1/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h --- eigen3-3.0.0/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h 2011-05-30 13:15:37.000000000 +0000 @@ -83,10 +83,10 @@ if(mc > Traits::nr) mc = (mc/Traits::nr)*Traits::nr; - LhsScalar* blockA = ei_aligned_stack_new(LhsScalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*size; - RhsScalar* allocatedBlockB = ei_aligned_stack_new(RhsScalar, sizeB); + ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(RhsScalar, allocatedBlockB, sizeB, 0); RhsScalar* blockB = allocatedBlockB + sizeW; gemm_pack_lhs pack_lhs; @@ -125,8 +125,6 @@ } } } - ei_aligned_stack_delete(LhsScalar, blockA, kc*mc); - ei_aligned_stack_delete(RhsScalar, allocatedBlockB, sizeB); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/SelfadjointMatrixMatrix.h eigen3-3.0.1/Eigen/src/Core/products/SelfadjointMatrixMatrix.h --- eigen3-3.0.0/Eigen/src/Core/products/SelfadjointMatrixMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/SelfadjointMatrixMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -263,10 +263,10 @@ // kc must smaller than mc kc = std::min(kc,mc); - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*cols; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; gebp_kernel gebp_kernel; @@ -313,9 +313,6 @@ gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha); } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); } }; @@ -343,11 +340,10 @@ Index mc = rows; // cache block size along the M direction Index nc = cols; // cache block size along the N direction computeProductBlockingSizes(kc, mc, nc); - - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*cols; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; gebp_kernel gebp_kernel; @@ -369,9 +365,6 @@ gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha); } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/SelfadjointMatrixVector.h eigen3-3.0.1/Eigen/src/Core/products/SelfadjointMatrixVector.h --- eigen3-3.0.0/Eigen/src/Core/products/SelfadjointMatrixVector.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/SelfadjointMatrixVector.h 2011-05-30 13:15:37.000000000 +0000 @@ -62,14 +62,12 @@ // FIXME this copy is now handled outside product_selfadjoint_vector, so it could probably be removed. // if the rhs is not sequentially stored in memory we copy it to a temporary buffer, // this is because we need to extract packets - const Scalar* EIGEN_RESTRICT rhs = _rhs; + ei_declare_aligned_stack_constructed_variable(Scalar,rhs,size,rhsIncr==1 ? const_cast(_rhs) : 0); if (rhsIncr!=1) { - Scalar* r = ei_aligned_stack_new(Scalar, size); const Scalar* it = _rhs; for (Index i=0; i(rhs), size); } } // end namespace internal @@ -211,40 +206,28 @@ internal::gemv_static_vector_if static_dest; internal::gemv_static_vector_if static_rhs; + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + EvalToDest ? dest.data() : static_dest.data()); + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,rhs.size(), + UseRhs ? const_cast(rhs.data()) : static_rhs.data()); - bool freeDestPtr = false; - ResScalar* actualDestPtr; - if(EvalToDest) - actualDestPtr = dest.data(); - else + if(!EvalToDest) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualDestPtr=static_dest.data())==0) - { - freeDestPtr = true; - actualDestPtr = ei_aligned_stack_new(ResScalar,dest.size()); - } MappedDest(actualDestPtr, dest.size()) = dest; } - bool freeRhsPtr = false; - RhsScalar* actualRhsPtr; - if(UseRhs) - actualRhsPtr = const_cast(rhs.data()); - else + if(!UseRhs) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = rhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualRhsPtr=static_rhs.data())==0) - { - freeRhsPtr = true; - actualRhsPtr = ei_aligned_stack_new(RhsScalar,rhs.size()); - } Map(actualRhsPtr, rhs.size()) = rhs; } @@ -259,11 +242,7 @@ ); if(!EvalToDest) - { dest = MappedDest(actualDestPtr, dest.size()); - if(freeDestPtr) ei_aligned_stack_delete(ResScalar, actualDestPtr, dest.size()); - } - if(freeRhsPtr) ei_aligned_stack_delete(RhsScalar, actualRhsPtr, rhs.size()); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/SelfadjointProduct.h eigen3-3.0.1/Eigen/src/Core/products/SelfadjointProduct.h --- eigen3-3.0.0/Eigen/src/Core/products/SelfadjointProduct.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/SelfadjointProduct.h 2011-05-30 13:15:37.000000000 +0000 @@ -81,27 +81,17 @@ UseOtherDirectly = _ActualOtherType::InnerStrideAtCompileTime==1 }; internal::gemv_static_vector_if static_other; - - bool freeOtherPtr = false; - Scalar* actualOtherPtr; - if(UseOtherDirectly) - actualOtherPtr = const_cast(actualOther.data()); - else - { - if((actualOtherPtr=static_other.data())==0) - { - freeOtherPtr = true; - actualOtherPtr = ei_aligned_stack_new(Scalar,other.size()); - } + + ei_declare_aligned_stack_constructed_variable(Scalar, actualOtherPtr, other.size(), + (UseOtherDirectly ? const_cast(actualOther.data()) : static_other.data())); + + if(!UseOtherDirectly) Map(actualOtherPtr, actualOther.size()) = actualOther; - } selfadjoint_rank1_update::IsComplex, (!OtherBlasTraits::NeedToConjugate) && NumTraits::IsComplex> ::run(other.size(), mat.data(), mat.outerStride(), actualOtherPtr, actualAlpha); - - if((!UseOtherDirectly) && freeOtherPtr) ei_aligned_stack_delete(Scalar, actualOtherPtr, other.size()); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/TriangularMatrixMatrix.h eigen3-3.0.1/Eigen/src/Core/products/TriangularMatrixMatrix.h --- eigen3-3.0.0/Eigen/src/Core/products/TriangularMatrixMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/TriangularMatrixMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -96,33 +96,38 @@ LhsStorageOrder,ConjugateLhs, RhsStorageOrder,ConjugateRhs,ColMajor> { + + typedef gebp_traits Traits; + enum { + SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr), + IsLower = (Mode&Lower) == Lower, + SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1 + }; static EIGEN_DONT_INLINE void run( - Index rows, Index cols, Index depth, + Index _rows, Index _cols, Index _depth, const Scalar* _lhs, Index lhsStride, const Scalar* _rhs, Index rhsStride, Scalar* res, Index resStride, Scalar alpha) { + // strip zeros + Index diagSize = std::min(_rows,_depth); + Index rows = IsLower ? _rows : diagSize; + Index depth = IsLower ? diagSize : _depth; + Index cols = _cols; + const_blas_data_mapper lhs(_lhs,lhsStride); const_blas_data_mapper rhs(_rhs,rhsStride); - typedef gebp_traits Traits; - enum { - SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr), - IsLower = (Mode&Lower) == Lower, - SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1 - }; - Index kc = depth; // cache block size along the K direction Index mc = rows; // cache block size along the M direction Index nc = cols; // cache block size along the N direction computeProductBlockingSizes(kc, mc, nc); - - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*cols; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; Matrix triangularBuffer; @@ -153,10 +158,11 @@ pack_rhs(blockB, &rhs(actual_k2,0), rhsStride, actual_kc, cols); // the selected lhs's panel has to be split in three different parts: - // 1 - the part which is above the diagonal block => skip it + // 1 - the part which is zero => skip it // 2 - the diagonal block => special kernel - // 3 - the panel below the diagonal block => GEPP - // the block diagonal, if any + // 3 - the dense panel below (lower case) or above (upper case) the diagonal block => GEPP + + // the block diagonal, if any: if(IsLower || actual_k2 GEPP + // the part below (lower case) or above (upper case) the diagonal => GEPP { Index start = IsLower ? k2 : 0; Index end = IsLower ? rows : std::min(actual_k2,rows); @@ -208,10 +214,6 @@ } } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); -// delete[] allocatedBlockB; } }; @@ -223,33 +225,38 @@ LhsStorageOrder,ConjugateLhs, RhsStorageOrder,ConjugateRhs,ColMajor> { + typedef gebp_traits Traits; + enum { + SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr), + IsLower = (Mode&Lower) == Lower, + SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1 + }; static EIGEN_DONT_INLINE void run( - Index rows, Index cols, Index depth, + Index _rows, Index _cols, Index _depth, const Scalar* _lhs, Index lhsStride, const Scalar* _rhs, Index rhsStride, Scalar* res, Index resStride, Scalar alpha) { + // strip zeros + Index diagSize = std::min(_cols,_depth); + Index rows = _rows; + Index depth = IsLower ? _depth : diagSize; + Index cols = IsLower ? diagSize : _cols; + const_blas_data_mapper lhs(_lhs,lhsStride); const_blas_data_mapper rhs(_rhs,rhsStride); - typedef gebp_traits Traits; - enum { - SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr), - IsLower = (Mode&Lower) == Lower, - SetDiag = (Mode&(ZeroDiag|UnitDiag)) ? 0 : 1 - }; - Index kc = depth; // cache block size along the K direction Index mc = rows; // cache block size along the M direction Index nc = cols; // cache block size along the N direction computeProductBlockingSizes(kc, mc, nc); - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*cols; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar,sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; Matrix triangularBuffer; @@ -347,9 +354,6 @@ -1, -1, 0, 0, allocatedBlockB); } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/TriangularMatrixVector.h eigen3-3.0.1/Eigen/src/Core/products/TriangularMatrixVector.h --- eigen3-3.0.0/Eigen/src/Core/products/TriangularMatrixVector.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/TriangularMatrixVector.h 2011-05-30 13:15:37.000000000 +0000 @@ -41,9 +41,6 @@ static EIGEN_DONT_INLINE void run(Index rows, Index cols, const LhsScalar* _lhs, Index lhsStride, const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, ResScalar alpha) { - EIGEN_UNUSED_VARIABLE(resIncr); - eigen_assert(resIncr==1); - static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH; typedef Map, 0, OuterStride<> > LhsMap; @@ -95,9 +92,6 @@ static void run(Index rows, Index cols, const LhsScalar* _lhs, Index lhsStride, const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, ResScalar alpha) { - eigen_assert(rhsIncr==1); - EIGEN_UNUSED_VARIABLE(rhsIncr); - static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH; typedef Map, 0, OuterStride<> > LhsMap; @@ -185,7 +179,7 @@ template void scaleAndAddTo(Dest& dst, Scalar alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); - + typedef TriangularProduct<(Mode & UnitDiag) | ((Mode & Lower) ? Upper : Lower),true,Transpose,false,Transpose,true> TriangularProductTranspose; Transpose dstT(dst); internal::trmv_selector<(int(internal::traits::Flags)&RowMajorBit) ? ColMajor : RowMajor>::run( @@ -235,23 +229,15 @@ RhsScalar compatibleAlpha = get_factor::run(actualAlpha); - ResScalar* actualDestPtr; - bool freeDestPtr = false; - if (evalToDest) - { - actualDestPtr = dest.data(); - } - else + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualDestPtr = static_dest.data())==0) - { - freeDestPtr = true; - actualDestPtr = ei_aligned_stack_new(ResScalar,dest.size()); - } if(!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); @@ -277,7 +263,6 @@ dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); else dest = MappedDest(actualDestPtr, dest.size()); - if(freeDestPtr) ei_aligned_stack_delete(ResScalar, actualDestPtr, dest.size()); } } }; @@ -310,23 +295,15 @@ gemv_static_vector_if static_rhs; - RhsScalar* actualRhsPtr; - bool freeRhsPtr = false; - if (DirectlyUseRhs) - { - actualRhsPtr = const_cast(actualRhs.data()); - } - else + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN int size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - if((actualRhsPtr = static_rhs.data())==0) - { - freeRhsPtr = true; - actualRhsPtr = ei_aligned_stack_new(RhsScalar, actualRhs.size()); - } Map(actualRhsPtr, actualRhs.size()) = actualRhs; } @@ -340,8 +317,6 @@ actualRhsPtr,1, dest.data(),dest.innerStride(), actualAlpha); - - if((!DirectlyUseRhs) && freeRhsPtr) ei_aligned_stack_delete(RhsScalar, actualRhsPtr, prod.rhs().size()); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/products/TriangularSolverMatrix.h eigen3-3.0.1/Eigen/src/Core/products/TriangularSolverMatrix.h --- eigen3-3.0.0/Eigen/src/Core/products/TriangularSolverMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/products/TriangularSolverMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -70,10 +70,10 @@ Index nc = cols; // cache block size along the N direction computeProductBlockingSizes(kc, mc, nc); - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*cols; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; conj_if conj; @@ -174,9 +174,6 @@ } } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); } }; @@ -209,10 +206,10 @@ Index nc = rows; // cache block size along the N direction computeProductBlockingSizes(kc, mc, nc); - Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); std::size_t sizeW = kc*Traits::WorkSpaceFactor; std::size_t sizeB = sizeW + kc*size; - Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB); + ei_declare_aligned_stack_constructed_variable(Scalar, blockA, kc*mc, 0); + ei_declare_aligned_stack_constructed_variable(Scalar, allocatedBlockB, sizeB, 0); Scalar* blockB = allocatedBlockB + sizeW; conj_if conj; @@ -314,9 +311,6 @@ -1, -1, 0, 0, allocatedBlockB); } } - - ei_aligned_stack_delete(Scalar, blockA, kc*mc); - ei_aligned_stack_delete(Scalar, allocatedBlockB, sizeB); } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/SelfAdjointView.h eigen3-3.0.1/Eigen/src/Core/SelfAdjointView.h --- eigen3-3.0.0/Eigen/src/Core/SelfAdjointView.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/SelfAdjointView.h 2011-05-30 13:15:37.000000000 +0000 @@ -32,13 +32,13 @@ * \brief Expression of a selfadjoint matrix from a triangular part of a dense matrix * * \param MatrixType the type of the dense matrix storing the coefficients - * \param TriangularPart can be either \c Lower or \c Upper + * \param TriangularPart can be either \c #Lower or \c #Upper * * This class is an expression of a sefladjoint matrix from a triangular part of a matrix * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() * and most of the time this is the only way that it is used. * - * \sa class TriangularBase, MatrixBase::selfAdjointView() + * \sa class TriangularBase, MatrixBase::selfadjointView() */ namespace internal { diff -Nru eigen3-3.0.0/Eigen/src/Core/SolveTriangular.h eigen3-3.0.1/Eigen/src/Core/SolveTriangular.h --- eigen3-3.0.0/Eigen/src/Core/SolveTriangular.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/SolveTriangular.h 2011-05-30 13:15:37.000000000 +0000 @@ -74,26 +74,19 @@ // FIXME find a way to allow an inner stride if packet_traits::size==1 bool useRhsDirectly = Rhs::InnerStrideAtCompileTime==1 || rhs.innerStride()==1; - RhsScalar* actualRhs; - if(useRhsDirectly) - { - actualRhs = &rhs.coeffRef(0); - } - else - { - actualRhs = ei_aligned_stack_new(RhsScalar,rhs.size()); + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhs,rhs.size(), + (useRhsDirectly ? rhs.data() : 0)); + + if(!useRhsDirectly) MappedRhs(actualRhs,rhs.size()) = rhs; - } triangular_solve_vector ::run(actualLhs.cols(), actualLhs.data(), actualLhs.outerStride(), actualRhs); if(!useRhsDirectly) - { rhs = MappedRhs(actualRhs, rhs.size()); - ei_aligned_stack_delete(RhsScalar, actualRhs, rhs.size()); - } } }; diff -Nru eigen3-3.0.0/Eigen/src/Core/StableNorm.h eigen3-3.0.1/Eigen/src/Core/StableNorm.h --- eigen3-3.0.0/Eigen/src/Core/StableNorm.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/StableNorm.h 2011-05-30 13:15:37.000000000 +0000 @@ -56,6 +56,7 @@ inline typename NumTraits::Scalar>::Real MatrixBase::stableNorm() const { + using std::min; const Index blockSize = 4096; RealScalar scale = 0; RealScalar invScale = 1; @@ -68,7 +69,7 @@ if (bi>0) internal::stable_norm_kernel(this->head(bi), ssq, scale, invScale); for (; bisegment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf(), ssq, scale, invScale); + internal::stable_norm_kernel(this->segment(bi,min(blockSize, n - bi)).template forceAlignedAccessIf(), ssq, scale, invScale); return scale * internal::sqrt(ssq); } @@ -85,6 +86,9 @@ inline typename NumTraits::Scalar>::Real MatrixBase::blueNorm() const { + using std::pow; + using std::min; + using std::max; static Index nmax = -1; static RealScalar b1, b2, s1m, s2m, overfl, rbig, relerr; if(nmax <= 0) @@ -107,17 +111,17 @@ rbig = std::numeric_limits::max(); // largest floating-point number iexp = -((1-iemin)/2); - b1 = RealScalar(std::pow(RealScalar(ibeta),RealScalar(iexp))); // lower boundary of midrange + b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // lower boundary of midrange iexp = (iemax + 1 - it)/2; - b2 = RealScalar(std::pow(RealScalar(ibeta),RealScalar(iexp))); // upper boundary of midrange + b2 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // upper boundary of midrange iexp = (2-iemin)/2; - s1m = RealScalar(std::pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for lower range + s1m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for lower range iexp = - ((iemax+it)/2); - s2m = RealScalar(std::pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for upper range + s2m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for upper range overfl = rbig*s2m; // overflow boundary for abig - eps = RealScalar(std::pow(double(ibeta), 1-it)); + eps = RealScalar(pow(double(ibeta), 1-it)); relerr = internal::sqrt(eps); // tolerance for neglecting asml abig = RealScalar(1.0/eps - 1.0); if (RealScalar(nbig)>abig) nmax = int(abig); // largest safe n @@ -163,8 +167,8 @@ } else return internal::sqrt(amed); - asml = std::min(abig, amed); - abig = std::max(abig, amed); + asml = min(abig, amed); + abig = max(abig, amed); if(asml <= abig*relerr) return abig; else diff -Nru eigen3-3.0.0/Eigen/src/Core/TriangularMatrix.h eigen3-3.0.1/Eigen/src/Core/TriangularMatrix.h --- eigen3-3.0.0/Eigen/src/Core/TriangularMatrix.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/TriangularMatrix.h 2011-05-30 13:15:37.000000000 +0000 @@ -134,13 +134,13 @@ * \brief Base class for triangular part in a matrix * * \param MatrixType the type of the object in which we are taking the triangular part - * \param Mode the kind of triangular matrix expression to construct. Can be Upper, - * Lower, UpperSelfadjoint, or LowerSelfadjoint. This is in fact a bit field; - * it must have either Upper or Lower, and additionnaly it may have either - * UnitDiag or Selfadjoint. + * \param Mode the kind of triangular matrix expression to construct. Can be #Upper, + * #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower. + * This is in fact a bit field; it must have either #Upper or #Lower, + * and additionnaly it may have #UnitDiag or #ZeroDiag or neither. * * This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular - * matrices one should speak ok "trapezoid" parts. This class is the return type + * matrices one should speak of "trapezoid" parts. This class is the return type * of MatrixBase::triangularView() and most of the time this is the only way it is used. * * \sa MatrixBase::triangularView() @@ -448,6 +448,8 @@ col = (UnrollCount-1) / Derived1::RowsAtCompileTime, row = (UnrollCount-1) % Derived1::RowsAtCompileTime }; + + typedef typename Derived1::Scalar Scalar; inline static void run(Derived1 &dst, const Derived2 &src) { @@ -466,9 +468,9 @@ else if(ClearOpposite) { if (Mode&UnitDiag && row==col) - dst.coeffRef(row, col) = 1; + dst.coeffRef(row, col) = Scalar(1); else - dst.coeffRef(row, col) = 0; + dst.coeffRef(row, col) = Scalar(0); } } }; @@ -484,6 +486,7 @@ struct triangular_assignment_selector { typedef typename Derived1::Index Index; + typedef typename Derived1::Scalar Scalar; inline static void run(Derived1 &dst, const Derived2 &src) { for(Index j = 0; j < dst.cols(); ++j) @@ -493,7 +496,7 @@ dst.copyCoeff(i, j, src); if (ClearOpposite) for(Index i = maxi+1; i < dst.rows(); ++i) - dst.coeffRef(i, j) = 0; + dst.coeffRef(i, j) = Scalar(0); } } }; @@ -511,7 +514,7 @@ Index maxi = std::min(j, dst.rows()); if (ClearOpposite) for(Index i = 0; i < maxi; ++i) - dst.coeffRef(i, j) = 0; + dst.coeffRef(i, j) = static_cast(0); } } }; @@ -547,7 +550,7 @@ Index maxi = std::min(j, dst.rows()-1); if (ClearOpposite) for(Index i = 0; i <= maxi; ++i) - dst.coeffRef(i, j) = 0; + dst.coeffRef(i, j) = static_cast(0); } } }; @@ -756,8 +759,8 @@ /** * \returns an expression of a triangular view extracted from the current matrix * - * The parameter \a Mode can have the following values: \c Upper, \c StrictlyUpper, \c UnitUpper, - * \c Lower, \c StrictlyLower, \c UnitLower. + * The parameter \a Mode can have the following values: \c #Upper, \c #StrictlyUpper, \c #UnitUpper, + * \c #Lower, \c #StrictlyLower, \c #UnitLower. * * Example: \include MatrixBase_extract.cpp * Output: \verbinclude MatrixBase_extract.out diff -Nru eigen3-3.0.0/Eigen/src/Core/util/Constants.h eigen3-3.0.1/Eigen/src/Core/util/Constants.h --- eigen3-3.0.0/Eigen/src/Core/util/Constants.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/util/Constants.h 2011-05-30 13:15:37.000000000 +0000 @@ -161,23 +161,72 @@ | EvalBeforeNestingBit | EvalBeforeAssigningBit; -// Possible values for the Mode parameter of triangularView() +/** \defgroup enums Enumerations + * \ingroup Core_Module + * + * Various enumerations used in %Eigen. Many of these are used as template parameters. + */ + +/** \ingroup enums + * Enum containing possible values for the \p Mode parameter of + * MatrixBase::selfadjointView() and MatrixBase::triangularView(). */ enum { - Lower=0x1, Upper=0x2, UnitDiag=0x4, ZeroDiag=0x8, - UnitLower=UnitDiag|Lower, UnitUpper=UnitDiag|Upper, - StrictlyLower=ZeroDiag|Lower, StrictlyUpper=ZeroDiag|Upper, - SelfAdjoint=0x10}; + /** View matrix as a lower triangular matrix. */ + Lower=0x1, + /** View matrix as an upper triangular matrix. */ + Upper=0x2, + /** %Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper. */ + UnitDiag=0x4, + /** %Matrix has zeros on the diagonal; to be used in combination with #Lower or #Upper. */ + ZeroDiag=0x8, + /** View matrix as a lower triangular matrix with ones on the diagonal. */ + UnitLower=UnitDiag|Lower, + /** View matrix as an upper triangular matrix with ones on the diagonal. */ + UnitUpper=UnitDiag|Upper, + /** View matrix as a lower triangular matrix with zeros on the diagonal. */ + StrictlyLower=ZeroDiag|Lower, + /** View matrix as an upper triangular matrix with zeros on the diagonal. */ + StrictlyUpper=ZeroDiag|Upper, + /** Used in BandMatrix and SelfAdjointView to indicate that the matrix is self-adjoint. */ + SelfAdjoint=0x10 +}; + +/** \ingroup enums + * Enum for indicating whether an object is aligned or not. */ +enum { + /** Object is not correctly aligned for vectorization. */ + Unaligned=0, + /** Object is aligned for vectorization. */ + Aligned=1 +}; -enum { Unaligned=0, Aligned=1 }; enum { ConditionalJumpCost = 5 }; +/** \ingroup enums + * Enum used by DenseBase::corner() in Eigen2 compatibility mode. */ // FIXME after the corner() API change, this was not needed anymore, except by AlignedBox // TODO: find out what to do with that. Adapt the AlignedBox API ? enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight }; -enum DirectionType { Vertical, Horizontal, BothDirections }; +/** \ingroup enums + * Enum containing possible values for the \p Direction parameter of + * Reverse, PartialReduxExpr and VectorwiseOp. */ +enum DirectionType { + /** For Reverse, all columns are reversed; + * for PartialReduxExpr and VectorwiseOp, act on columns. */ + Vertical, + /** For Reverse, all rows are reversed; + * for PartialReduxExpr and VectorwiseOp, act on rows. */ + Horizontal, + /** For Reverse, both rows and columns are reversed; + * not used for PartialReduxExpr and VectorwiseOp. */ + BothDirections +}; + enum ProductEvaluationMode { NormalProduct, CacheFriendlyProduct }; +/** \internal \ingroup enums + * Enum to specify how to traverse the entries of a matrix. */ enum { /** \internal Default traversal, no vectorization, no index-based access */ DefaultTraversal, @@ -196,14 +245,25 @@ InvalidTraversal }; +/** \internal \ingroup enums + * Enum to specify whether to unroll loops when traversing over the entries of a matrix. */ enum { + /** \internal Do not unroll loops. */ NoUnrolling, + /** \internal Unroll only the inner loop, but not the outer loop. */ InnerUnrolling, + /** \internal Unroll both the inner and the outer loop. If there is only one loop, + * because linear traversal is used, then unroll that loop. */ CompleteUnrolling }; +/** \ingroup enums + * Enum containing possible values for the \p _Options template parameter of + * Matrix, Array and BandMatrix. */ enum { + /** Storage order is column major (see \ref TopicStorageOrders). */ ColMajor = 0, + /** Storage order is row major (see \ref TopicStorageOrders). */ RowMajor = 0x1, // it is only a coincidence that this is equal to RowMajorBit -- don't rely on that /** \internal Align the matrix itself if it is vectorizable fixed-size */ AutoAlign = 0, @@ -211,11 +271,13 @@ DontAlign = 0x2 }; -/** \brief Enum for specifying whether to apply or solve on the left or right. - */ +/** \ingroup enums + * Enum for specifying whether to apply or solve on the left or right. */ enum { - OnTheLeft = 1, /**< \brief Apply transformation on the left. */ - OnTheRight = 2 /**< \brief Apply transformation on the right. */ + /** Apply transformation on the left. */ + OnTheLeft = 1, + /** Apply transformation on the right. */ + OnTheRight = 2 }; /* the following could as well be written: @@ -239,53 +301,108 @@ EIGEN_UNUSED Default_t Default; } +/** \internal \ingroup enums + * Used in AmbiVector. */ enum { IsDense = 0, IsSparse }; +/** \ingroup enums + * Used as template parameter in DenseCoeffBase and MapBase to indicate + * which accessors should be provided. */ enum AccessorLevels { - ReadOnlyAccessors, WriteAccessors, DirectAccessors, DirectWriteAccessors + /** Read-only access via a member function. */ + ReadOnlyAccessors, + /** Read/write access via member functions. */ + WriteAccessors, + /** Direct read-only access to the coefficients. */ + DirectAccessors, + /** Direct read/write access to the coefficients. */ + DirectWriteAccessors }; +/** \ingroup enums + * Enum with options to give to various decompositions. */ enum DecompositionOptions { - Pivoting = 0x01, // LDLT, - NoPivoting = 0x02, // LDLT, - ComputeFullU = 0x04, // SVD, - ComputeThinU = 0x08, // SVD, - ComputeFullV = 0x10, // SVD, - ComputeThinV = 0x20, // SVD, - EigenvaluesOnly = 0x40, // all eigen solvers - ComputeEigenvectors = 0x80, // all eigen solvers + /** \internal Not used (meant for LDLT?). */ + Pivoting = 0x01, + /** \internal Not used (meant for LDLT?). */ + NoPivoting = 0x02, + /** Used in JacobiSVD to indicate that the square matrix U is to be computed. */ + ComputeFullU = 0x04, + /** Used in JacobiSVD to indicate that the thin matrix U is to be computed. */ + ComputeThinU = 0x08, + /** Used in JacobiSVD to indicate that the square matrix V is to be computed. */ + ComputeFullV = 0x10, + /** Used in JacobiSVD to indicate that the thin matrix V is to be computed. */ + ComputeThinV = 0x20, + /** Used in SelfAdjointEigenSolver and GeneralizedSelfAdjointEigenSolver to specify + * that only the eigenvalues are to be computed and not the eigenvectors. */ + EigenvaluesOnly = 0x40, + /** Used in SelfAdjointEigenSolver and GeneralizedSelfAdjointEigenSolver to specify + * that both the eigenvalues and the eigenvectors are to be computed. */ + ComputeEigenvectors = 0x80, + /** \internal */ EigVecMask = EigenvaluesOnly | ComputeEigenvectors, + /** Used in GeneralizedSelfAdjointEigenSolver to indicate that it should + * solve the generalized eigenproblem \f$ Ax = \lambda B x \f$. */ Ax_lBx = 0x100, + /** Used in GeneralizedSelfAdjointEigenSolver to indicate that it should + * solve the generalized eigenproblem \f$ ABx = \lambda x \f$. */ ABx_lx = 0x200, + /** Used in GeneralizedSelfAdjointEigenSolver to indicate that it should + * solve the generalized eigenproblem \f$ BAx = \lambda x \f$. */ BAx_lx = 0x400, + /** \internal */ GenEigMask = Ax_lBx | ABx_lx | BAx_lx }; +/** \ingroup enums + * Possible values for the \p QRPreconditioner template parameter of JacobiSVD. */ enum QRPreconditioners { + /** Do not specify what is to be done if the SVD of a non-square matrix is asked for. */ NoQRPreconditioner, + /** Use a QR decomposition without pivoting as the first step. */ HouseholderQRPreconditioner, + /** Use a QR decomposition with column pivoting as the first step. */ ColPivHouseholderQRPreconditioner, + /** Use a QR decomposition with full pivoting as the first step. */ FullPivHouseholderQRPreconditioner }; -/** \brief Enum for reporting the status of a computation. - */ +#ifdef Success +#error The preprocessor symbol 'Success' is defined, possibly by the X11 header file X.h +#endif + +/** \ingroups enums + * Enum for reporting the status of a computation. */ enum ComputationInfo { - Success = 0, /**< \brief Computation was successful. */ - NumericalIssue = 1, /**< \brief The provided data did not satisfy the prerequisites. */ - NoConvergence = 2 /**< \brief Iterative procedure did not converge. */ + /** Computation was successful. */ + Success = 0, + /** The provided data did not satisfy the prerequisites. */ + NumericalIssue = 1, + /** Iterative procedure did not converge. */ + NoConvergence = 2 }; +/** \ingroup enums + * Enum used to specify how a particular transformation is stored in a matrix. + * \sa Transform, Hyperplane::transform(). */ enum TransformTraits { + /** Transformation is an isometry. */ Isometry = 0x1, + /** Transformation is an affine transformation stored as a (Dim+1)^2 matrix whose last row is + * assumed to be [0 ... 0 1]. */ Affine = 0x2, + /** Transformation is an affine transformation stored as a (Dim) x (Dim+1) matrix. */ AffineCompact = 0x10 | Affine, + /** Transformation is a general projective transformation stored as a (Dim+1)^2 matrix. */ Projective = 0x20 }; +/** \internal \ingroup enums + * Enum used to choose between implementation depending on the computer architecture. */ namespace Architecture { enum Type { @@ -302,8 +419,12 @@ }; } +/** \internal \ingroup enums + * Enum used as template parameter in GeneralProduct. */ enum { CoeffBasedProductMode, LazyCoeffBasedProductMode, OuterProduct, InnerProduct, GemvProduct, GemmProduct }; +/** \internal \ingroup enums + * Enum used in experimental parallel implementation. */ enum Action {GetAction, SetAction}; /** The type used to identify a dense storage. */ diff -Nru eigen3-3.0.0/Eigen/src/Core/util/Macros.h eigen3-3.0.1/Eigen/src/Core/util/Macros.h --- eigen3-3.0.0/Eigen/src/Core/util/Macros.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/util/Macros.h 2011-05-30 13:15:37.000000000 +0000 @@ -28,7 +28,7 @@ #define EIGEN_WORLD_VERSION 3 #define EIGEN_MAJOR_VERSION 0 -#define EIGEN_MINOR_VERSION 0 +#define EIGEN_MINOR_VERSION 1 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \ (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \ diff -Nru eigen3-3.0.0/Eigen/src/Core/util/Memory.h eigen3-3.0.1/Eigen/src/Core/util/Memory.h --- eigen3-3.0.0/Eigen/src/Core/util/Memory.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/util/Memory.h 2011-05-30 13:15:37.000000000 +0000 @@ -468,36 +468,87 @@ *** Implementation of runtime stack allocation (falling back to malloc) *** *****************************************************************************/ +// you can overwrite Eigen's default behavior regarding alloca by defining EIGEN_ALLOCA +// to the appropriate stack allocation function +#ifndef EIGEN_ALLOCA + #if (defined __linux__) + #define EIGEN_ALLOCA alloca + #elif defined(_MSC_VER) + #define EIGEN_ALLOCA _alloca + #endif +#endif + +namespace internal { + +// This helper class construct the allocated memory, and takes care of destructing and freeing the handled data +// at destruction time. In practice this helper class is mainly useful to avoid memory leak in case of exceptions. +template class aligned_stack_memory_handler +{ + public: + /* Creates a stack_memory_handler responsible for the buffer \a ptr of size \a size. + * Note that \a ptr can be 0 regardless of the other parameters. + * This constructor takes care of constructing/initializing the elements of the buffer if required by the scalar type T (see NumTraits::RequireInitialization). + * In this case, the buffer elements will also be destructed when this handler will be destructed. + * Finally, if \a dealloc is true, then the pointer \a ptr is freed. + **/ + aligned_stack_memory_handler(T* ptr, size_t size, bool dealloc) + : m_ptr(ptr), m_size(size), m_deallocate(dealloc) + { + if(NumTraits::RequireInitialization) + Eigen::internal::construct_elements_of_array(m_ptr, size); + } + ~aligned_stack_memory_handler() + { + if(NumTraits::RequireInitialization) + Eigen::internal::destruct_elements_of_array(m_ptr, m_size); + if(m_deallocate) + Eigen::internal::aligned_free(m_ptr); + } + protected: + T* m_ptr; + size_t m_size; + bool m_deallocate; +}; + +} + /** \internal - * Allocates an aligned buffer of SIZE bytes on the stack if SIZE is smaller than - * EIGEN_STACK_ALLOCATION_LIMIT, and if stack allocation is supported by the platform - * (currently, this is Linux only). Otherwise the memory is allocated on the heap. - * Data allocated with ei_aligned_stack_alloc \b must be freed by calling - * ei_aligned_stack_free(PTR,SIZE). + * Declares, allocates and construct an aligned buffer named NAME of SIZE elements of type TYPE on the stack + * if SIZE is smaller than EIGEN_STACK_ALLOCATION_LIMIT, and if stack allocation is supported by the platform + * (currently, this is Linux and Visual Studio only). Otherwise the memory is allocated on the heap. + * The allocated buffer is automatically deleted when exiting the scope of this declaration. + * If BUFFER is non nul, then the declared variable is simply an alias for BUFFER, and no allocation/deletion occurs. + * Here is an example: * \code - * float * data = ei_aligned_stack_alloc(float,array.size()); - * // ... - * ei_aligned_stack_free(data,float,array.size()); + * { + * ei_declare_aligned_stack_constructed_variable(float,data,size,0); + * // use data[0] to data[size-1] + * } * \endcode + * The underlying stack allocation function can controlled with the EIGEN_ALLOCA preprocessor token. */ -#if (defined __linux__) - #define ei_aligned_stack_alloc(SIZE) (SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) \ - ? alloca(SIZE) \ - : Eigen::internal::aligned_malloc(SIZE) - #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) Eigen::internal::aligned_free(PTR) -#elif defined(_MSC_VER) - #define ei_aligned_stack_alloc(SIZE) (SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) \ - ? _alloca(SIZE) \ - : Eigen::internal::aligned_malloc(SIZE) - #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) Eigen::internal::aligned_free(PTR) +#ifdef EIGEN_ALLOCA + + #ifdef __arm__ + #define EIGEN_ALIGNED_ALLOCA(SIZE) reinterpret_cast((reinterpret_cast(EIGEN_ALLOCA(SIZE+16)) & ~(size_t(15))) + 16) + #else + #define EIGEN_ALIGNED_ALLOCA EIGEN_ALLOCA + #endif + + #define ei_declare_aligned_stack_constructed_variable(TYPE,NAME,SIZE,BUFFER) \ + TYPE* NAME = (BUFFER)!=0 ? (BUFFER) \ + : reinterpret_cast( \ + (sizeof(TYPE)*SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(TYPE)*SIZE) \ + : Eigen::internal::aligned_malloc(sizeof(TYPE)*SIZE) ); \ + Eigen::internal::aligned_stack_memory_handler EIGEN_CAT(NAME,_stack_memory_destructor)((BUFFER)==0 ? NAME : 0,SIZE,sizeof(TYPE)*SIZE>EIGEN_STACK_ALLOCATION_LIMIT) + #else - #define ei_aligned_stack_alloc(SIZE) Eigen::internal::aligned_malloc(SIZE) - #define ei_aligned_stack_free(PTR,SIZE) Eigen::internal::aligned_free(PTR) -#endif -#define ei_aligned_stack_new(TYPE,SIZE) Eigen::internal::construct_elements_of_array(reinterpret_cast(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE) -#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {Eigen::internal::destruct_elements_of_array(PTR, SIZE); \ - ei_aligned_stack_free(PTR,sizeof(TYPE)*SIZE);} while(0) + #define ei_declare_aligned_stack_constructed_variable(TYPE,NAME,SIZE,BUFFER) \ + TYPE* NAME = (BUFFER)!=0 ? BUFFER : reinterpret_cast(Eigen::internal::aligned_malloc(sizeof(TYPE)*SIZE)); \ + Eigen::internal::aligned_stack_memory_handler EIGEN_CAT(NAME,_stack_memory_destructor)((BUFFER)==0 ? NAME : 0,SIZE,true) + +#endif /***************************************************************************** diff -Nru eigen3-3.0.0/Eigen/src/Core/VectorwiseOp.h eigen3-3.0.1/Eigen/src/Core/VectorwiseOp.h --- eigen3-3.0.0/Eigen/src/Core/VectorwiseOp.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Core/VectorwiseOp.h 2011-05-30 13:15:37.000000000 +0000 @@ -31,9 +31,9 @@ * * \brief Generic expression of a partially reduxed matrix * - * \param MatrixType the type of the matrix we are applying the redux operation - * \param MemberOp type of the member functor - * \param Direction indicates the direction of the redux (Vertical or Horizontal) + * \tparam MatrixType the type of the matrix we are applying the redux operation + * \tparam MemberOp type of the member functor + * \tparam Direction indicates the direction of the redux (#Vertical or #Horizontal) * * This class represents an expression of a partial redux operator of a matrix. * It is the return type of some VectorwiseOp functions, @@ -164,7 +164,7 @@ * \brief Pseudo expression providing partial reduction operations * * \param ExpressionType the type of the object on which to do partial reductions - * \param Direction indicates the direction of the redux (Vertical or Horizontal) + * \param Direction indicates the direction of the redux (#Vertical or #Horizontal) * * This class represents a pseudo expression with partial reduction features. * It is the return type of DenseBase::colwise() and DenseBase::rowwise() diff -Nru eigen3-3.0.0/Eigen/src/Eigenvalues/EigenSolver.h eigen3-3.0.1/Eigen/src/Eigenvalues/EigenSolver.h --- eigen3-3.0.0/Eigen/src/Eigenvalues/EigenSolver.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Eigenvalues/EigenSolver.h 2011-05-30 13:15:37.000000000 +0000 @@ -343,6 +343,7 @@ { // we have a real eigen value matV.col(j) = m_eivec.col(j).template cast(); + matV.col(j).normalize(); } else { @@ -449,7 +450,7 @@ Scalar q = m_eivalues.coeff(n).imag(); // Scalar vector - if (q == 0) + if (q == Scalar(0)) { Scalar lastr=0, lastw=0; Index l = n; @@ -490,12 +491,12 @@ // Overflow control Scalar t = internal::abs(m_matT.coeff(i,n)); - if ((eps * t) * t > 1) + if ((eps * t) * t > Scalar(1)) m_matT.col(n).tail(size-i) /= t; } } } - else if (q < 0) // Complex vector + else if (q < Scalar(0) && n > 0) // Complex vector { Scalar lastra=0, lastsa=0, lastw=0; Index l = n-1; @@ -529,7 +530,7 @@ else { l = i; - if (m_eivalues.coeff(i).imag() == 0) + if (m_eivalues.coeff(i).imag() == RealScalar(0)) { std::complex cc = cdiv(-ra,-sa,w,q); m_matT.coeffRef(i,n-1) = internal::real(cc); @@ -562,13 +563,18 @@ } // Overflow control - Scalar t = std::max(internal::abs(m_matT.coeff(i,n-1)),internal::abs(m_matT.coeff(i,n))); - if ((eps * t) * t > 1) + using std::max; + Scalar t = max(internal::abs(m_matT.coeff(i,n-1)),internal::abs(m_matT.coeff(i,n))); + if ((eps * t) * t > Scalar(1)) m_matT.block(i, n-1, size-i, 2) /= t; } } } + else + { + eigen_assert("Internal bug in EigenSolver"); // this should not happen + } } // Back transformation to get eigenvectors of original matrix diff -Nru eigen3-3.0.0/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h eigen3-3.0.1/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h --- eigen3-3.0.0/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h 2011-05-30 13:15:37.000000000 +0000 @@ -98,8 +98,8 @@ * Only the lower triangular part of the matrix is referenced. * \param[in] matB Positive-definite matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. - * \param[in] options A or-ed set of flags {ComputeEigenvectors,EigenvaluesOnly} | {Ax_lBx,ABx_lx,BAx_lx}. - * Default is ComputeEigenvectors|Ax_lBx. + * \param[in] options A or-ed set of flags {#ComputeEigenvectors,#EigenvaluesOnly} | {#Ax_lBx,#ABx_lx,#BAx_lx}. + * Default is #ComputeEigenvectors|#Ax_lBx. * * This constructor calls compute(const MatrixType&, const MatrixType&, int) * to compute the eigenvalues and (if requested) the eigenvectors of the @@ -131,8 +131,8 @@ * Only the lower triangular part of the matrix is referenced. * \param[in] matB Positive-definite matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. - * \param[in] options A or-ed set of flags {ComputeEigenvectors,EigenvaluesOnly} | {Ax_lBx,ABx_lx,BAx_lx}. - * Default is ComputeEigenvectors|Ax_lBx. + * \param[in] options A or-ed set of flags {#ComputeEigenvectors,#EigenvaluesOnly} | {#Ax_lBx,#ABx_lx,#BAx_lx}. + * Default is #ComputeEigenvectors|#Ax_lBx. * * \returns Reference to \c *this * diff -Nru eigen3-3.0.0/Eigen/src/Eigenvalues/RealSchur.h eigen3-3.0.1/Eigen/src/Eigenvalues/RealSchur.h --- eigen3-3.0.0/Eigen/src/Eigenvalues/RealSchur.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Eigenvalues/RealSchur.h 2011-05-30 13:15:37.000000000 +0000 @@ -324,11 +324,11 @@ m_matT.coeffRef(iu,iu) += exshift; m_matT.coeffRef(iu-1,iu-1) += exshift; - if (q >= 0) // Two real eigenvalues + if (q >= Scalar(0)) // Two real eigenvalues { Scalar z = internal::sqrt(internal::abs(q)); JacobiRotation rot; - if (p >= 0) + if (p >= Scalar(0)) rot.makeGivens(p + z, m_matT.coeff(iu, iu-1)); else rot.makeGivens(p - z, m_matT.coeff(iu, iu-1)); @@ -369,7 +369,7 @@ { Scalar s = (shiftInfo.coeff(1) - shiftInfo.coeff(0)) / Scalar(2.0); s = s * s + shiftInfo.coeff(2); - if (s > 0) + if (s > Scalar(0)) { s = internal::sqrt(s); if (shiftInfo.coeff(1) < shiftInfo.coeff(0)) diff -Nru eigen3-3.0.0/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h eigen3-3.0.1/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h --- eigen3-3.0.0/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h 2011-05-30 13:15:37.000000000 +0000 @@ -147,11 +147,11 @@ * * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to * be computed. Only the lower triangular part of the matrix is referenced. - * \param[in] options Can be ComputeEigenvectors (default) or EigenvaluesOnly. + * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly. * * This constructor calls compute(const MatrixType&, int) to compute the * eigenvalues of the matrix \p matrix. The eigenvectors are computed if - * \p options equals ComputeEigenvectors. + * \p options equals #ComputeEigenvectors. * * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out @@ -171,11 +171,11 @@ * * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to * be computed. Only the lower triangular part of the matrix is referenced. - * \param[in] options Can be ComputeEigenvectors (default) or EigenvaluesOnly. + * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly. * \returns Reference to \c *this * * This function computes the eigenvalues of \p matrix. The eigenvalues() - * function can be used to retrieve them. If \p options equals ComputeEigenvectors, + * function can be used to retrieve them. If \p options equals #ComputeEigenvectors, * then the eigenvectors are also computed and can be retrieved by * calling eigenvectors(). * diff -Nru eigen3-3.0.0/Eigen/src/Geometry/AngleAxis.h eigen3-3.0.1/Eigen/src/Geometry/AngleAxis.h --- eigen3-3.0.0/Eigen/src/Geometry/AngleAxis.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Geometry/AngleAxis.h 2011-05-30 13:15:37.000000000 +0000 @@ -171,6 +171,9 @@ template AngleAxis& AngleAxis::operator=(const QuaternionBase& q) { + using std::acos; + using std::min; + using std::max; Scalar n2 = q.vec().squaredNorm(); if (n2 < NumTraits::dummy_precision()*NumTraits::dummy_precision()) { @@ -179,7 +182,7 @@ } else { - m_angle = Scalar(2)*std::acos(std::min(std::max(Scalar(-1),q.w()),Scalar(1))); + m_angle = Scalar(2)*acos(min(max(Scalar(-1),q.w()),Scalar(1))); m_axis = q.vec() / internal::sqrt(n2); } return *this; diff -Nru eigen3-3.0.0/Eigen/src/Geometry/Hyperplane.h eigen3-3.0.1/Eigen/src/Geometry/Hyperplane.h --- eigen3-3.0.0/Eigen/src/Geometry/Hyperplane.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Geometry/Hyperplane.h 2011-05-30 13:15:37.000000000 +0000 @@ -213,8 +213,8 @@ /** Applies the transformation matrix \a mat to \c *this and returns a reference to \c *this. * * \param mat the Dim x Dim transformation matrix - * \param traits specifies whether the matrix \a mat represents an Isometry - * or a more generic Affine transformation. The default is Affine. + * \param traits specifies whether the matrix \a mat represents an #Isometry + * or a more generic #Affine transformation. The default is #Affine. */ template inline Hyperplane& transform(const MatrixBase& mat, TransformTraits traits = Affine) @@ -233,8 +233,8 @@ /** Applies the transformation \a t to \c *this and returns a reference to \c *this. * * \param t the transformation of dimension Dim - * \param traits specifies whether the transformation \a t represents an Isometry - * or a more generic Affine transformation. The default is Affine. + * \param traits specifies whether the transformation \a t represents an #Isometry + * or a more generic #Affine transformation. The default is #Affine. * Other kind of transformations are not supported. */ template diff -Nru eigen3-3.0.0/Eigen/src/Geometry/Quaternion.h eigen3-3.0.1/Eigen/src/Geometry/Quaternion.h --- eigen3-3.0.0/Eigen/src/Geometry/Quaternion.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Geometry/Quaternion.h 2011-05-30 13:15:37.000000000 +0000 @@ -49,6 +49,9 @@ typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename internal::traits::Coefficients Coefficients; + enum { + Flags = Eigen::internal::traits::Flags + }; // typedef typename Matrix Coefficients; /** the type of a 3D vector */ @@ -222,7 +225,8 @@ typedef _Scalar Scalar; typedef Matrix<_Scalar,4,1,_Options> Coefficients; enum{ - PacketAccess = _Options & DontAlign ? Unaligned : Aligned + IsAligned = bool(EIGEN_ALIGN) && ((int(_Options)&Aligned)==Aligned), + Flags = IsAligned ? (AlignedBit | LvalueBit) : LvalueBit }; }; } @@ -294,33 +298,53 @@ ***************************************************************************/ namespace internal { -template -struct traits, _PacketAccess> >: -traits > -{ - typedef _Scalar Scalar; - typedef Map, _PacketAccess> Coefficients; - enum { - PacketAccess = _PacketAccess + template + struct traits, _Options> >: + traits > + { + typedef _Scalar Scalar; + typedef Map, _Options> Coefficients; + + typedef traits > TraitsBase; + enum { + IsAligned = TraitsBase::IsAligned, + + Flags = TraitsBase::Flags + }; + }; +} + +namespace internal { + template + struct traits, _Options> >: + traits > + { + typedef _Scalar Scalar; + typedef Map, _Options> Coefficients; + + typedef traits > TraitsBase; + enum { + IsAligned = TraitsBase::IsAligned, + Flags = TraitsBase::Flags & ~LvalueBit + }; }; -}; } /** \brief Quaternion expression mapping a constant memory buffer * * \param _Scalar the type of the Quaternion coefficients - * \param PacketAccess see class Map + * \param _Options see class Map * * This is a specialization of class Map for Quaternion. This class allows to view * a 4 scalar memory buffer as an Eigen's Quaternion object. * * \sa class Map, class Quaternion, class QuaternionBase */ -template -class Map, PacketAccess > - : public QuaternionBase, PacketAccess> > +template +class Map, _Options > + : public QuaternionBase, _Options> > { - typedef QuaternionBase, PacketAccess> > Base; + typedef QuaternionBase, _Options> > Base; public: typedef _Scalar Scalar; @@ -333,7 +357,7 @@ * The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order: * \code *coeffs == {x, y, z, w} \endcode * - * If the template parameter PacketAccess is set to Aligned, then the pointer coeffs must be aligned. */ + * If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned. */ EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : m_coeffs(coeffs) {} inline const Coefficients& coeffs() const { return m_coeffs;} @@ -345,18 +369,18 @@ /** \brief Expression of a quaternion from a memory buffer * * \param _Scalar the type of the Quaternion coefficients - * \param PacketAccess see class Map + * \param _Options see class Map * * This is a specialization of class Map for Quaternion. This class allows to view * a 4 scalar memory buffer as an Eigen's Quaternion object. * * \sa class Map, class Quaternion, class QuaternionBase */ -template -class Map, PacketAccess > - : public QuaternionBase, PacketAccess> > +template +class Map, _Options > + : public QuaternionBase, _Options> > { - typedef QuaternionBase, PacketAccess> > Base; + typedef QuaternionBase, _Options> > Base; public: typedef _Scalar Scalar; @@ -369,7 +393,7 @@ * The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order: * \code *coeffs == {x, y, z, w} \endcode * - * If the template parameter PacketAccess is set to Aligned, then the pointer coeffs must be aligned. */ + * If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned. */ EIGEN_STRONG_INLINE Map(Scalar* coeffs) : m_coeffs(coeffs) {} inline Coefficients& coeffs() { return m_coeffs; } @@ -399,7 +423,7 @@ // Generic Quaternion * Quaternion product // This product can be specialized for a given architecture via the Arch template argument. namespace internal { -template struct quat_product +template struct quat_product { EIGEN_STRONG_INLINE static Quaternion run(const QuaternionBase& a, const QuaternionBase& b){ return Quaternion @@ -423,7 +447,7 @@ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) return internal::quat_product::Scalar, - internal::traits::PacketAccess && internal::traits::PacketAccess>::run(*this, other); + internal::traits::IsAligned && internal::traits::IsAligned>::run(*this, other); } /** \sa operator*(Quaternion) */ @@ -551,6 +575,7 @@ template inline Derived& QuaternionBase::setFromTwoVectors(const MatrixBase& a, const MatrixBase& b) { + using std::max; Vector3 v0 = a.normalized(); Vector3 v1 = b.normalized(); Scalar c = v1.dot(v0); @@ -565,7 +590,7 @@ // which yields a singular value problem if (c < Scalar(-1)+NumTraits::dummy_precision()) { - c = std::max(c,-1); + c = max(c,-1); Matrix m; m << v0.transpose(), v1.transpose(); JacobiSVD > svd(m, ComputeFullV); Vector3 axis = svd.matrixV().col(2); @@ -625,10 +650,11 @@ inline typename internal::traits::Scalar QuaternionBase::angularDistance(const QuaternionBase& other) const { + using std::acos; double d = internal::abs(this->dot(other)); if (d>=1.0) return Scalar(0); - return static_cast(2 * std::acos(d)); + return static_cast(2 * acos(d)); } /** \returns the spherical linear interpolation between the two quaternions @@ -639,6 +665,7 @@ Quaternion::Scalar> QuaternionBase::slerp(Scalar t, const QuaternionBase& other) const { + using std::acos; static const Scalar one = Scalar(1) - NumTraits::epsilon(); Scalar d = this->dot(other); Scalar absD = internal::abs(d); @@ -654,7 +681,7 @@ else { // theta is the angle between the 2 quaternions - Scalar theta = std::acos(absD); + Scalar theta = acos(absD); Scalar sinTheta = internal::sin(theta); scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta; diff -Nru eigen3-3.0.0/Eigen/src/Geometry/Transform.h eigen3-3.0.1/Eigen/src/Geometry/Transform.h --- eigen3-3.0.0/Eigen/src/Geometry/Transform.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Geometry/Transform.h 2011-05-30 13:15:37.000000000 +0000 @@ -86,11 +86,11 @@ * \tparam _Scalar the scalar type, i.e., the type of the coefficients * \tparam _Dim the dimension of the space * \tparam _Mode the type of the transformation. Can be: - * - Affine: the transformation is stored as a (Dim+1)^2 matrix, - * where the last row is assumed to be [0 ... 0 1]. - * - AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix. - * - Projective: the transformation is stored as a (Dim+1)^2 matrix - * without any assumption. + * - #Affine: the transformation is stored as a (Dim+1)^2 matrix, + * where the last row is assumed to be [0 ... 0 1]. + * - #AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix. + * - #Projective: the transformation is stored as a (Dim+1)^2 matrix + * without any assumption. * \tparam _Options has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor. * These Options are passed directly to the underlying matrix type. * @@ -672,7 +672,7 @@ * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ -template +template Transform& Transform::operator=(const QMatrix& other) { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) @@ -718,9 +718,13 @@ { check_template_params(); EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) - m_matrix << other.m11(), other.m21(), other.dx(), - other.m12(), other.m22(), other.dy(), - other.m13(), other.m23(), other.m33(); + if (Mode == int(AffineCompact)) + m_matrix << other.m11(), other.m21(), other.dx(), + other.m12(), other.m22(), other.dy(); + else + m_matrix << other.m11(), other.m21(), other.dx(), + other.m12(), other.m22(), other.dy(), + other.m13(), other.m23(), other.m33(); return *this; } @@ -732,9 +736,14 @@ QTransform Transform::toQTransform(void) const { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) - return QTransform(matrix.coeff(0,0), matrix.coeff(1,0), matrix.coeff(2,0) - matrix.coeff(0,1), matrix.coeff(1,1), matrix.coeff(2,1) - matrix.coeff(0,2), matrix.coeff(1,2), matrix.coeff(2,2)); + if (Mode == int(AffineCompact)) + return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), + m_matrix.coeff(0,1), m_matrix.coeff(1,1), + m_matrix.coeff(0,2), m_matrix.coeff(1,2)); + else + return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0), + m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1), + m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2)); } #endif @@ -1082,10 +1091,10 @@ * * \param hint allows to optimize the inversion process when the transformation * is known to be not a general transformation (optional). The possible values are: - * - Projective if the transformation is not necessarily affine, i.e., if the + * - #Projective if the transformation is not necessarily affine, i.e., if the * last row is not guaranteed to be [0 ... 0 1] - * - Affine if the last row can be assumed to be [0 ... 0 1] - * - Isometry if the transformation is only a concatenations of translations + * - #Affine if the last row can be assumed to be [0 ... 0 1] + * - #Isometry if the transformation is only a concatenations of translations * and rotations. * The default is the template class parameter \c Mode. * diff -Nru eigen3-3.0.0/Eigen/src/Householder/Householder.h eigen3-3.0.1/Eigen/src/Householder/Householder.h --- eigen3-3.0.0/Eigen/src/Householder/Householder.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Householder/Householder.h 2011-05-30 13:15:37.000000000 +0000 @@ -72,8 +72,9 @@ if(tailSqNorm == RealScalar(0) && internal::imag(c0)==RealScalar(0)) { - tau = 0; + tau = RealScalar(0); beta = internal::real(c0); + essential.setZero(); } else { diff -Nru eigen3-3.0.0/Eigen/src/Jacobi/Jacobi.h eigen3-3.0.1/Eigen/src/Jacobi/Jacobi.h --- eigen3-3.0.0/Eigen/src/Jacobi/Jacobi.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Jacobi/Jacobi.h 2011-05-30 13:15:37.000000000 +0000 @@ -104,9 +104,9 @@ else { RealScalar tau = (x-z)/(RealScalar(2)*internal::abs(y)); - RealScalar w = internal::sqrt(internal::abs2(tau) + 1); + RealScalar w = internal::sqrt(internal::abs2(tau) + RealScalar(1)); RealScalar t; - if(tau>0) + if(tau>RealScalar(0)) { t = RealScalar(1) / (tau + w); } @@ -114,8 +114,8 @@ { t = RealScalar(1) / (tau - w); } - RealScalar sign_t = t > 0 ? 1 : -1; - RealScalar n = RealScalar(1) / internal::sqrt(internal::abs2(t)+1); + RealScalar sign_t = t > RealScalar(0) ? RealScalar(1) : RealScalar(-1); + RealScalar n = RealScalar(1) / internal::sqrt(internal::abs2(t)+RealScalar(1)); m_s = - sign_t * (internal::conj(y) / internal::abs(y)) * internal::abs(t) * n; m_c = n; return true; @@ -221,15 +221,15 @@ void JacobiRotation::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type) { - if(q==0) + if(q==Scalar(0)) { m_c = p::epsilon()) / rows; + RealScalar threshold_helper = m_colSqNorms.maxCoeff() * internal::abs2(NumTraits::epsilon()) / RealScalar(rows); m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); @@ -413,7 +413,7 @@ // Note that here, if we test instead for "biggest == 0", we get a failure every 1000 (or so) // repetitions of the unit test, with the result of solve() filled with large values of the order // of 1/(size*epsilon). - if(biggest_col_sq_norm < threshold_helper * (rows-k)) + if(biggest_col_sq_norm < threshold_helper * RealScalar(rows-k)) { m_nonzero_pivots = k; m_hCoeffs.tail(size-k).setZero(); diff -Nru eigen3-3.0.0/Eigen/src/Sparse/SparseSelfAdjointView.h eigen3-3.0.1/Eigen/src/Sparse/SparseSelfAdjointView.h --- eigen3-3.0.0/Eigen/src/Sparse/SparseSelfAdjointView.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/Sparse/SparseSelfAdjointView.h 2011-05-30 13:15:37.000000000 +0000 @@ -31,13 +31,13 @@ * \brief Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. * * \param MatrixType the type of the dense matrix storing the coefficients - * \param UpLo can be either \c Lower or \c Upper + * \param UpLo can be either \c #Lower or \c #Upper * * This class is an expression of a sefladjoint matrix from a triangular part of a matrix * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() * and most of the time this is the only way that it is used. * - * \sa SparseMatrixBase::selfAdjointView() + * \sa SparseMatrixBase::selfadjointView() */ template class SparseSelfAdjointTimeDenseProduct; diff -Nru eigen3-3.0.0/Eigen/src/SVD/JacobiSVD.h eigen3-3.0.1/Eigen/src/SVD/JacobiSVD.h --- eigen3-3.0.0/Eigen/src/SVD/JacobiSVD.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/Eigen/src/SVD/JacobiSVD.h 2011-05-30 13:15:37.000000000 +0000 @@ -271,13 +271,13 @@ RealScalar d = m.coeff(1,0) - m.coeff(0,1); if(t == RealScalar(0)) { - rot1.c() = 0; - rot1.s() = d > 0 ? 1 : -1; + rot1.c() = RealScalar(0); + rot1.s() = d > RealScalar(0) ? RealScalar(1) : RealScalar(-1); } else { RealScalar u = d / t; - rot1.c() = RealScalar(1) / sqrt(1 + abs2(u)); + rot1.c() = RealScalar(1) / sqrt(RealScalar(1) + abs2(u)); rot1.s() = rot1.c() * u; } m.applyOnTheLeft(0,1,rot1); @@ -292,7 +292,7 @@ * * \class JacobiSVD * - * \brief Two-sided Jacobi SVD decomposition of a square matrix + * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix * * \param MatrixType the type of the matrix of which we are computing the SVD decomposition * \param QRPreconditioner this optional parameter allows to specify the type of QR decomposition that will be used internally @@ -403,8 +403,8 @@ * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. - * By default, none is computed. This is a bit-field, the possible bits are ComputeFullU, ComputeThinU, - * ComputeFullV, ComputeThinV. + * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU, + * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non-default) FullPivHouseholderQR preconditioner. @@ -422,8 +422,8 @@ * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. - * By default, none is computed. This is a bit-field, the possible bits are ComputeFullU, ComputeThinU, - * ComputeFullV, ComputeThinV. + * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU, + * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non-default) FullPivHouseholderQR preconditioner. @@ -444,7 +444,7 @@ /** \returns the \a U matrix. * * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, - * the U matrix is n-by-n if you asked for ComputeFullU, and is n-by-m if you asked for ComputeThinU. + * the U matrix is n-by-n if you asked for #ComputeFullU, and is n-by-m if you asked for #ComputeThinU. * * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed. * @@ -460,7 +460,7 @@ /** \returns the \a V matrix. * * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, - * the V matrix is p-by-p if you asked for ComputeFullV, and is p-by-m if you asked for ComputeThinV. + * the V matrix is p-by-p if you asked for #ComputeFullV, and is p-by-m if you asked for ComputeThinV. * * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed. * @@ -618,8 +618,9 @@ // if this 2x2 sub-matrix is not diagonal already... // notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't // keep us iterating forever. - if(std::max(internal::abs(m_workMatrix.coeff(p,q)),internal::abs(m_workMatrix.coeff(q,p))) - > std::max(internal::abs(m_workMatrix.coeff(p,p)),internal::abs(m_workMatrix.coeff(q,q)))*precision) + using std::max; + if(max(internal::abs(m_workMatrix.coeff(p,q)),internal::abs(m_workMatrix.coeff(q,p))) + > max(internal::abs(m_workMatrix.coeff(p,p)),internal::abs(m_workMatrix.coeff(q,q)))*precision) { finished = false; diff -Nru eigen3-3.0.0/.hgtags eigen3-3.0.1/.hgtags --- eigen3-3.0.0/.hgtags 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/.hgtags 2011-05-30 13:15:37.000000000 +0000 @@ -15,3 +15,4 @@ 7ae24ca6f3891d5ac58ddc7db60ad413c8d6ec35 3.0-beta3 c40708b9088d622567fecc9208ad4a426621d364 3.0-beta4 b6456624eae74f49ae8683d8e7b2882a2ca0342a 3.0-rc1 +65ee2328342f9d8796f4e395319318b8b69cfdc0 3.0.0 diff -Nru eigen3-3.0.0/scripts/eigen_gen_docs eigen3-3.0.1/scripts/eigen_gen_docs --- eigen3-3.0.0/scripts/eigen_gen_docs 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/scripts/eigen_gen_docs 2011-05-30 13:15:37.000000000 +0000 @@ -5,15 +5,17 @@ # will be used USER=${USER:-'orzel'} +#ulimit -v 1024000 + # step 1 : build # todo if 'build is not there, create one: -#mkdir build -(cd build && cmake .. && make -j3 doc) || { echo "make failed"; exit 1; } +mkdir build -p +(cd build && cmake .. && make doc) || { echo "make failed"; exit 1; } #todo: n+1 where n = number of cpus #step 2 : upload # (the '/' at the end of path are very important, see rsync documentation) -rsync -az build/doc/html/ $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/dox-devel/ || { echo "upload failed"; exit 1; } +rsync -az build/doc/html/ $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/dox-3.0/ || { echo "upload failed"; exit 1; } echo "Uploaded successfully" diff -Nru eigen3-3.0.0/test/CMakeLists.txt eigen3-3.0.1/test/CMakeLists.txt --- eigen3-3.0.0/test/CMakeLists.txt 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/CMakeLists.txt 2011-05-30 13:15:37.000000000 +0000 @@ -42,6 +42,7 @@ ei_add_test(integer_types) ei_add_test(cwiseop) ei_add_test(unalignedcount) +ei_add_test(exceptions) ei_add_test(redux) ei_add_test(visitor) ei_add_test(block) diff -Nru eigen3-3.0.0/test/dynalloc.cpp eigen3-3.0.1/test/dynalloc.cpp --- eigen3-3.0.0/test/dynalloc.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/dynalloc.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -70,11 +70,10 @@ { for(int i = 1; i < 1000; i++) { - float *p = ei_aligned_stack_new(float,i); + ei_declare_aligned_stack_constructed_variable(float,p,i,0); VERIFY(size_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; - ei_aligned_stack_delete(float,p,i); } } diff -Nru eigen3-3.0.0/test/eigen2/eigen2_dynalloc.cpp eigen3-3.0.1/test/eigen2/eigen2_dynalloc.cpp --- eigen3-3.0.0/test/eigen2/eigen2_dynalloc.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/eigen2/eigen2_dynalloc.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -70,11 +70,10 @@ { for(int i = 1; i < 1000; i++) { - float *p = ei_aligned_stack_new(float,i); + ei_declare_aligned_stack_constructed_variable(float, p, i, 0); VERIFY(std::size_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; - ei_aligned_stack_delete(float,p,i); } } diff -Nru eigen3-3.0.0/test/eigensolver_generic.cpp eigen3-3.0.1/test/eigensolver_generic.cpp --- eigen3-3.0.0/test/eigensolver_generic.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/eigensolver_generic.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -61,6 +61,7 @@ VERIFY_IS_APPROX(a * ei1.pseudoEigenvectors(), ei1.pseudoEigenvectors() * ei1.pseudoEigenvalueMatrix()); VERIFY_IS_APPROX(a.template cast() * ei1.eigenvectors(), ei1.eigenvectors() * ei1.eigenvalues().asDiagonal()); + VERIFY_IS_APPROX(ei1.eigenvectors().colwise().norm(), RealVectorType::Ones(rows).transpose()); VERIFY_IS_APPROX(a.eigenvalues(), ei1.eigenvalues()); EigenSolver eiNoEivecs(a, false); diff -Nru eigen3-3.0.0/test/exceptions.cpp eigen3-3.0.1/test/exceptions.cpp --- eigen3-3.0.0/test/exceptions.cpp 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.0.1/test/exceptions.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -0,0 +1,124 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + + +// Various sanity tests with exceptions: +// - no memory leak when a custom scalar type trow an exceptions +// - todo: complete the list of tests! + +#define EIGEN_STACK_ALLOCATION_LIMIT 100000000 + +#include "main.h" + +struct my_exception +{ + my_exception() {} + ~my_exception() {} +}; + +class ScalarWithExceptions +{ + public: + ScalarWithExceptions() { init(); } + ScalarWithExceptions(const float& _v) { init(); *v = _v; } + ScalarWithExceptions(const ScalarWithExceptions& other) { init(); *v = *(other.v); } + ~ScalarWithExceptions() { + delete v; + instances--; + } + + void init() { + v = new float; + instances++; + } + + ScalarWithExceptions operator+(const ScalarWithExceptions& other) const + { + countdown--; + if(countdown<=0) + throw my_exception(); + return ScalarWithExceptions(*v+*other.v); + } + + ScalarWithExceptions operator-(const ScalarWithExceptions& other) const + { return ScalarWithExceptions(*v-*other.v); } + + ScalarWithExceptions operator*(const ScalarWithExceptions& other) const + { return ScalarWithExceptions((*v)*(*other.v)); } + + ScalarWithExceptions& operator+=(const ScalarWithExceptions& other) + { *v+=*other.v; return *this; } + ScalarWithExceptions& operator-=(const ScalarWithExceptions& other) + { *v-=*other.v; return *this; } + ScalarWithExceptions& operator=(const ScalarWithExceptions& other) + { *v = *(other.v); return *this; } + + bool operator==(const ScalarWithExceptions& other) const + { return *v==*other.v; } + bool operator!=(const ScalarWithExceptions& other) const + { return *v!=*other.v; } + + float* v; + static int instances; + static int countdown; +}; + +int ScalarWithExceptions::instances = 0; +int ScalarWithExceptions::countdown = 0; + + +#define CHECK_MEMLEAK(OP) { \ + ScalarWithExceptions::countdown = 100; \ + int before = ScalarWithExceptions::instances; \ + bool exception_thrown = false; \ + try { OP; } \ + catch (my_exception) { \ + exception_thrown = true; \ + VERIFY(ScalarWithExceptions::instances==before && "memory leak detected in " && EIGEN_MAKESTRING(OP)); \ + } \ + VERIFY(exception_thrown && " no exception thrown in " && EIGEN_MAKESTRING(OP)); \ + } + +void memoryleak() +{ + typedef Eigen::Matrix VectorType; + typedef Eigen::Matrix MatrixType; + + { + int n = 50; + VectorType v0(n), v1(n); + MatrixType m0(n,n), m1(n,n), m2(n,n); + v0.setOnes(); v1.setOnes(); + m0.setOnes(); m1.setOnes(); m2.setOnes(); + CHECK_MEMLEAK(v0 = m0 * m1 * v1); + CHECK_MEMLEAK(m2 = m0 * m1 * m2); + CHECK_MEMLEAK((v0+v1).dot(v0+v1)); + } + VERIFY(ScalarWithExceptions::instances==0 && "global memory leak detected in " && EIGEN_MAKESTRING(OP)); \ +} + +void test_exceptions() +{ + CALL_SUBTEST( memoryleak() ); +} diff -Nru eigen3-3.0.0/test/geo_hyperplane.cpp eigen3-3.0.1/test/geo_hyperplane.cpp --- eigen3-3.0.0/test/geo_hyperplane.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/geo_hyperplane.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -150,8 +150,9 @@ VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs()); VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs()); - #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Plane3a)); + #if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Plane3a)); #endif } diff -Nru eigen3-3.0.0/test/geo_parametrizedline.cpp eigen3-3.0.1/test/geo_parametrizedline.cpp --- eigen3-3.0.0/test/geo_parametrizedline.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/geo_parametrizedline.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -90,8 +90,9 @@ VERIFY_IS_APPROX(p1->direction(), p2->direction()); VERIFY_IS_APPROX(p1->direction(), p3->direction()); - #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Line4a)); + #if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Line4a)); #endif } @@ -100,6 +101,7 @@ for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( parametrizedline(ParametrizedLine()) ); CALL_SUBTEST_2( parametrizedline(ParametrizedLine()) ); + CALL_SUBTEST_2( parametrizedline_alignment() ); CALL_SUBTEST_3( parametrizedline(ParametrizedLine()) ); CALL_SUBTEST_3( parametrizedline_alignment() ); CALL_SUBTEST_4( parametrizedline(ParametrizedLine,5>()) ); diff -Nru eigen3-3.0.0/test/geo_quaternion.cpp eigen3-3.0.1/test/geo_quaternion.cpp --- eigen3-3.0.0/test/geo_quaternion.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/geo_quaternion.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -125,6 +125,7 @@ template void mapQuaternion(void){ typedef Map, Aligned> MQuaternionA; typedef Map > MQuaternionUA; + typedef Map > MCQuaternionUA; typedef Quaternion Quaternionx; EIGEN_ALIGN16 Scalar array1[4]; @@ -132,6 +133,7 @@ EIGEN_ALIGN16 Scalar array3[4+1]; Scalar* array3unaligned = array3+1; +// std::cerr << array1 << " " << array2 << " " << array3 << "\n"; MQuaternionA(array1).coeffs().setRandom(); (MQuaternionA(array2)) = MQuaternionA(array1); (MQuaternionUA(array3unaligned)) = MQuaternionA(array1); @@ -139,11 +141,14 @@ Quaternionx q1 = MQuaternionA(array1); Quaternionx q2 = MQuaternionA(array2); Quaternionx q3 = MQuaternionUA(array3unaligned); + Quaternionx q4 = MCQuaternionUA(array3unaligned); VERIFY_IS_APPROX(q1.coeffs(), q2.coeffs()); VERIFY_IS_APPROX(q1.coeffs(), q3.coeffs()); + VERIFY_IS_APPROX(q4.coeffs(), q3.coeffs()); #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((MQuaternionA(array3unaligned))); + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((MQuaternionA(array3unaligned))); #endif } @@ -166,21 +171,39 @@ VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs()); VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs()); - #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((::new(reinterpret_cast(arrayunaligned)) QuaternionA)); + #if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((::new(reinterpret_cast(arrayunaligned)) QuaternionA)); #endif } +template void check_const_correctness(const PlainObjectType&) +{ + // there's a lot that we can't test here while still having this test compile! + // the only possible approach would be to run a script trying to compile stuff and checking that it fails. + // CMake can help with that. + + // verify that map-to-const don't have LvalueBit + typedef typename internal::add_const::type ConstPlainObjectType; + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); +} + + void test_geo_quaternion() { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( quaternion() )); + CALL_SUBTEST_1( check_const_correctness(Quaternionf()) ); CALL_SUBTEST_2(( quaternion() )); + CALL_SUBTEST_2( check_const_correctness(Quaterniond()) ); CALL_SUBTEST_3(( quaternion() )); CALL_SUBTEST_4(( quaternion() )); CALL_SUBTEST_5(( quaternionAlignment() )); CALL_SUBTEST_6(( quaternionAlignment() )); - CALL_SUBTEST( mapQuaternion() ); - CALL_SUBTEST( mapQuaternion() ); + CALL_SUBTEST_1( mapQuaternion() ); + CALL_SUBTEST_2( mapQuaternion() ); } } diff -Nru eigen3-3.0.0/test/geo_transformations.cpp eigen3-3.0.1/test/geo_transformations.cpp --- eigen3-3.0.0/test/geo_transformations.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/geo_transformations.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -442,8 +442,9 @@ VERIFY_IS_APPROX( (*p1) * (*p1), (*p2)*(*p3)); - #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Projective3a)); + #if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((::new(reinterpret_cast(array3u)) Projective3a)); #endif } @@ -455,7 +456,8 @@ CALL_SUBTEST_2(( transformations() )); CALL_SUBTEST_2(( non_projective_only() )); - + CALL_SUBTEST_2(( transform_alignment() )); + CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transform_alignment() )); diff -Nru eigen3-3.0.0/test/map.cpp eigen3-3.0.1/test/map.cpp --- eigen3-3.0.0/test/map.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/map.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -50,7 +50,8 @@ VERIFY_IS_EQUAL(ma1, ma2); VERIFY_IS_EQUAL(ma1, ma3); #ifdef EIGEN_VECTORIZE - VERIFY_RAISES_ASSERT((Map(array3unaligned, size))) + if(internal::packet_traits::Vectorizable) + VERIFY_RAISES_ASSERT((Map(array3unaligned, size))) #endif internal::aligned_delete(array1, size); diff -Nru eigen3-3.0.0/test/nullary.cpp eigen3-3.0.1/test/nullary.cpp --- eigen3-3.0.0/test/nullary.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/nullary.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2010 Jitse Niesen +// Copyright (C) 2010-2011 Jitse Niesen // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -120,10 +120,9 @@ for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_4( testVectorType(VectorXd(internal::random(1,300))) ); - CALL_SUBTEST_5( testVectorType(VectorXd(internal::random(1,300))) ); + CALL_SUBTEST_5( testVectorType(Vector4d()) ); // regression test for bug 232 CALL_SUBTEST_6( testVectorType(Vector3d()) ); CALL_SUBTEST_7( testVectorType(VectorXf(internal::random(1,300))) ); - CALL_SUBTEST_8( testVectorType(VectorXf(internal::random(1,300))) ); - CALL_SUBTEST_9( testVectorType(Vector3f()) ); + CALL_SUBTEST_8( testVectorType(Vector3f()) ); } } diff -Nru eigen3-3.0.0/test/packetmath.cpp eigen3-3.0.1/test/packetmath.cpp --- eigen3-3.0.0/test/packetmath.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/packetmath.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -44,7 +44,7 @@ { if (!isApproxAbs(a[i],b[i],refvalue)) { - std::cout << "a[" << i << "]: " << a[i] << " != b[" << i << "]: " << b[i] << std::endl; + std::cout << "[" << Map >(a,size) << "]" << " != " << Map >(b,size) << "\n"; return false; } } @@ -57,7 +57,7 @@ { if (!internal::isApprox(a[i],b[i])) { - std::cout << "a[" << i << "]: " << a[i] << " != b[" << i << "]: " << b[i] << std::endl; + std::cout << "[" << Map >(a,size) << "]" << " != " << Map >(b,size) << "\n"; return false; } } @@ -180,7 +180,7 @@ internal::pstore(data2, internal::pset1(data1[offset])); VERIFY(areApprox(ref, data2, PacketSize) && "internal::pset1"); } - + VERIFY(internal::isApprox(data1[0], internal::pfirst(internal::pload(data1))) && "internal::pfirst"); if(PacketSize>1) @@ -275,6 +275,11 @@ for (int i=0; i(data1))) && "internal::predux_max"); + + for (int i=0; i void test_conj_helper(Scalar* data1, Scalar* data2, Scalar* ref, Scalar* pval) diff -Nru eigen3-3.0.0/test/vectorization_logic.cpp eigen3-3.0.1/test/vectorization_logic.cpp --- eigen3-3.0.0/test/vectorization_logic.cpp 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/test/vectorization_logic.cpp 2011-05-30 13:15:37.000000000 +0000 @@ -123,7 +123,8 @@ (PacketSize==8 ? 4 : PacketSize==4 ? 6 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?2:3) : /*PacketSize==1 ?*/ 1), (PacketSize==8 ? 6 : PacketSize==4 ? 2 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?3:2) : /*PacketSize==1 ?*/ 3) > Matrix3; - + + #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT VERIFY(test_assign(Vector1(),Vector1(), InnerVectorizedTraversal,CompleteUnrolling)); VERIFY(test_assign(Vector1(),Vector1()+Vector1(), @@ -173,10 +174,22 @@ VERIFY(test_assign(Matrix11(),Matrix().template block(2,3)+Matrix().template block(10,4), DefaultTraversal,CompleteUnrolling)); } + + VERIFY(test_redux(Matrix3(), + LinearVectorizedTraversal,CompleteUnrolling)); - VERIFY(test_assign(MatrixXX(10,10),MatrixXX(20,20).block(10,10,2,3), - SliceVectorizedTraversal,NoUnrolling)); + VERIFY(test_redux(Matrix44(), + LinearVectorizedTraversal,NoUnrolling)); + VERIFY(test_redux(Matrix44().template block<(Matrix1::Flags&RowMajorBit)?4:PacketSize,(Matrix1::Flags&RowMajorBit)?PacketSize:4>(1,2), + DefaultTraversal,CompleteUnrolling)); + + VERIFY(test_redux(Matrix44c().template block<2*PacketSize,1>(1,2), + LinearVectorizedTraversal,CompleteUnrolling)); + + VERIFY(test_redux(Matrix44r().template block<1,2*PacketSize>(2,1), + LinearVectorizedTraversal,CompleteUnrolling)); + VERIFY((test_assign< Map >, Matrix22 @@ -188,24 +201,15 @@ >(DefaultTraversal,CompleteUnrolling))); VERIFY((test_assign(Matrix11(), Matrix11()*Matrix11(), InnerVectorizedTraversal, CompleteUnrolling))); + #endif - VERIFY(test_redux(VectorX(10), - LinearVectorizedTraversal,NoUnrolling)); - - VERIFY(test_redux(Matrix3(), - LinearVectorizedTraversal,CompleteUnrolling)); + VERIFY(test_assign(MatrixXX(10,10),MatrixXX(20,20).block(10,10,2,3), + SliceVectorizedTraversal,NoUnrolling)); - VERIFY(test_redux(Matrix44(), + VERIFY(test_redux(VectorX(10), LinearVectorizedTraversal,NoUnrolling)); - VERIFY(test_redux(Matrix44().template block<(Matrix1::Flags&RowMajorBit)?4:PacketSize,(Matrix1::Flags&RowMajorBit)?PacketSize:4>(1,2), - DefaultTraversal,CompleteUnrolling)); - - VERIFY(test_redux(Matrix44c().template block<2*PacketSize,1>(1,2), - LinearVectorizedTraversal,CompleteUnrolling)); - - VERIFY(test_redux(Matrix44r().template block<1,2*PacketSize>(2,1), - LinearVectorizedTraversal,CompleteUnrolling)); + } }; @@ -219,10 +223,10 @@ #ifdef EIGEN_VECTORIZE - vectorization_logic::run(); - vectorization_logic::run(); - vectorization_logic >::run(); - vectorization_logic >::run(); + CALL_SUBTEST( vectorization_logic::run() ); + CALL_SUBTEST( vectorization_logic::run() ); + CALL_SUBTEST( vectorization_logic >::run() ); + CALL_SUBTEST( vectorization_logic >::run() ); if(internal::packet_traits::Vectorizable) { diff -Nru eigen3-3.0.0/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h eigen3-3.0.1/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h --- eigen3-3.0.0/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h 2011-05-30 13:15:37.000000000 +0000 @@ -26,7 +26,7 @@ #define EIGEN_MATRIX_EXPONENTIAL #ifdef _MSC_VER - template Scalar log2(Scalar v) { return std::log(v)/std::log(Scalar(2)); } + template Scalar log2(Scalar v) { using std::log; return log(v)/log(Scalar(2)); } #endif @@ -250,14 +250,17 @@ template void MatrixExponential::computeUV(float) { + using std::max; + using std::pow; + using std::ceil; if (m_l1norm < 4.258730016922831e-001) { pade3(m_M); } else if (m_l1norm < 1.880152677804762e+000) { pade5(m_M); } else { const float maxnorm = 3.925724783138660f; - m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm))); - MatrixType A = m_M / std::pow(Scalar(2), Scalar(static_cast(m_squarings))); + m_squarings = max(0, (int)ceil(log2(m_l1norm / maxnorm))); + MatrixType A = m_M / pow(Scalar(2), Scalar(static_cast(m_squarings))); pade7(A); } } @@ -265,6 +268,9 @@ template void MatrixExponential::computeUV(double) { + using std::max; + using std::pow; + using std::ceil; if (m_l1norm < 1.495585217958292e-002) { pade3(m_M); } else if (m_l1norm < 2.539398330063230e-001) { @@ -275,8 +281,8 @@ pade9(m_M); } else { const double maxnorm = 5.371920351148152; - m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm))); - MatrixType A = m_M / std::pow(Scalar(2), Scalar(m_squarings)); + m_squarings = max(0, (int)ceil(log2(m_l1norm / maxnorm))); + MatrixType A = m_M / pow(Scalar(2), Scalar(m_squarings)); pade13(A); } } diff -Nru eigen3-3.0.0/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h eigen3-3.0.1/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h --- eigen3-3.0.0/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h 2011-05-30 13:15:37.000000000 +0000 @@ -295,7 +295,7 @@ m_parent.resize(size); m_nonZerosPerCol.resize(size); - Index* tags = ei_aligned_stack_new(Index, size); + ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); // TODO allows to configure the permutation { @@ -338,9 +338,6 @@ } } - // release workspace - ei_aligned_stack_delete(Index, tags, size); - /* construct Lp index array from m_nonZerosPerCol column counts */ Index* Lp = m_matrix._outerIndexPtr(); Lp[0] = 0; @@ -369,9 +366,9 @@ Index* Li = m_matrix._innerIndexPtr(); Scalar* Lx = m_matrix._valuePtr(); - Scalar* y = ei_aligned_stack_new(Scalar, size); - Index* pattern = ei_aligned_stack_new(Index, size); - Index* tags = ei_aligned_stack_new(Index, size); + ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0); + ei_declare_aligned_stack_constructed_variable(Index, pattern, size, 0); + ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); SparseMatrix ap(size,size); ap.template selfadjointView() = a.template selfadjointView().twistedBy(m_Pinv); @@ -443,11 +440,6 @@ } } - // release workspace - ei_aligned_stack_delete(Scalar, y, size); - ei_aligned_stack_delete(Index, pattern, size); - ei_aligned_stack_delete(Index, tags, size); - m_info = ok ? Success : NumericalIssue; m_factorizationIsOk = true; } diff -Nru eigen3-3.0.0/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h eigen3-3.0.1/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h --- eigen3-3.0.0/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h 2011-05-02 19:29:03.000000000 +0000 +++ eigen3-3.0.1/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h 2011-05-30 13:15:37.000000000 +0000 @@ -245,7 +245,8 @@ m_matrix.resize(size, size); m_parent.resize(size); m_nonZerosPerCol.resize(size); - Index * tags = ei_aligned_stack_new(Index, size); + + ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); const Index* Ap = a._outerIndexPtr(); const Index* Ai = a._innerIndexPtr(); @@ -298,7 +299,6 @@ Lp[k+1] = Lp[k] + m_nonZerosPerCol[k]; m_matrix.resizeNonZeros(Lp[size]); - ei_aligned_stack_delete(Index, tags, size); } template @@ -317,9 +317,9 @@ Scalar* Lx = m_matrix._valuePtr(); m_diag.resize(size); - Scalar * y = ei_aligned_stack_new(Scalar, size); - Index * pattern = ei_aligned_stack_new(Index, size); - Index * tags = ei_aligned_stack_new(Index, size); + ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0); + ei_declare_aligned_stack_constructed_variable(Index, pattern, size, 0); + ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); Index* P = 0; Index* Pinv = 0; @@ -383,10 +383,6 @@ } } - ei_aligned_stack_delete(Scalar, y, size); - ei_aligned_stack_delete(Index, pattern, size); - ei_aligned_stack_delete(Index, tags, size); - return ok; /* success, diagonal of D is all nonzero */ }