diff -Nru eigen3-3.1.2+6+10~precise1/.hg_archival.txt eigen3-3.2.0+7+11~ubuntu12.04.1/.hg_archival.txt --- eigen3-3.1.2+6+10~precise1/.hg_archival.txt 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/.hg_archival.txt 2013-09-11 07:34:01.000000000 +0000 @@ -1,4 +1,4 @@ repo: 8a21fd850624c931e448cbcfb38168cb2717c790 -node: 2249f9c22fe87155c80c5efbb7475d0a3e462cc0 -branch: 3.1 -tag: 3.1.3 +node: ffa86ffb557094721ca71dcea6aed2651b9fd610 +branch: 3.2 +tag: 3.2.0 diff -Nru eigen3-3.1.2+6+10~precise1/.krazy eigen3-3.2.0+7+11~ubuntu12.04.1/.krazy --- eigen3-3.1.2+6+10~precise1/.krazy 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/.krazy 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -SKIP /disabled/ -SKIP /bench/ -SKIP /build/ diff -Nru eigen3-3.1.2+6+10~precise1/CMakeLists.txt eigen3-3.2.0+7+11~ubuntu12.04.1/CMakeLists.txt --- eigen3-3.1.2+6+10~precise1/CMakeLists.txt 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/CMakeLists.txt 2013-09-11 07:34:01.000000000 +0000 @@ -1,6 +1,6 @@ project(Eigen) -cmake_minimum_required(VERSION 2.6.2) +cmake_minimum_required(VERSION 2.8.2) # guard against in-source builds @@ -105,26 +105,66 @@ add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") endif() -add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS") - set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") -if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing") +macro(ei_add_cxx_compiler_flag FLAG) + string(REGEX REPLACE "-" "" SFLAG ${FLAG}) + check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) + if(COMPILER_SUPPORT_${SFLAG}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") + endif() +endmacro(ei_add_cxx_compiler_flag) + +if(NOT MSVC) + # We assume that other compilers are partly compatible with GNUCC + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") set(CMAKE_CXX_FLAGS_DEBUG "-g3") set(CMAKE_CXX_FLAGS_RELEASE "-g0 -O2") - - check_cxx_compiler_flag("-Wno-variadic-macros" COMPILER_SUPPORT_WNOVARIADICMACRO) - if(COMPILER_SUPPORT_WNOVARIADICMACRO) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros") - endif() - - check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORT_WEXTRA) - if(COMPILER_SUPPORT_WEXTRA) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + + # clang outputs some warnings for unknwon flags that are not caught by check_cxx_compiler_flag + # adding -Werror turns such warnings into errors + check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) + if(COMPILER_SUPPORT_WERROR) + set(CMAKE_REQUIRED_FLAGS "-Werror") + endif() + + ei_add_cxx_compiler_flag("-pedantic") + ei_add_cxx_compiler_flag("-Wall") + ei_add_cxx_compiler_flag("-Wextra") + #ei_add_cxx_compiler_flag("-Weverything") # clang + + ei_add_cxx_compiler_flag("-Wundef") + ei_add_cxx_compiler_flag("-Wcast-align") + ei_add_cxx_compiler_flag("-Wchar-subscripts") + ei_add_cxx_compiler_flag("-Wnon-virtual-dtor") + ei_add_cxx_compiler_flag("-Wunused-local-typedefs") + ei_add_cxx_compiler_flag("-Wpointer-arith") + ei_add_cxx_compiler_flag("-Wwrite-strings") + ei_add_cxx_compiler_flag("-Wformat-security") + + ei_add_cxx_compiler_flag("-Wno-psabi") + ei_add_cxx_compiler_flag("-Wno-variadic-macros") + ei_add_cxx_compiler_flag("-Wno-long-long") + + ei_add_cxx_compiler_flag("-fno-check-new") + ei_add_cxx_compiler_flag("-fno-common") + ei_add_cxx_compiler_flag("-fstrict-aliasing") + ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark + ei_add_cxx_compiler_flag("-wd2304") # disbale ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor + + # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails + # Moreover we should not set both -strict-ansi and -ansi + check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) + ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi' + + if(COMPILER_SUPPORT_STRICTANSI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi") + else() + ei_add_cxx_compiler_flag("-ansi") endif() - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") + + set(CMAKE_REQUIRED_FLAGS "") option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) if(EIGEN_TEST_SSE2) @@ -164,7 +204,7 @@ option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) if(EIGEN_TEST_NEON) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mcpu=cortex-a8") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mcpu=cortex-a"8) message(STATUS "Enabling NEON in tests/examples") endif() @@ -177,9 +217,8 @@ endif() endif() -endif(CMAKE_COMPILER_IS_GNUCXX) +else(NOT MSVC) -if(MSVC) # C4127 - conditional expression is constant # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) # We can disable this warning in the unit tests since it is clear that it occurs @@ -209,7 +248,7 @@ endif(NOT CMAKE_CL_64) message(STATUS "Enabling SSE2 in tests/examples") endif(EIGEN_TEST_SSE2) -endif(MSVC) +endif(NOT MSVC) option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF) option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF) @@ -308,6 +347,7 @@ add_subdirectory(doc EXCLUDE_FROM_ALL) include(EigenConfigureTesting) + # fixme, not sure this line is still needed: enable_testing() # must be called from the root CMakeLists, see man page @@ -342,6 +382,8 @@ add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) endif(NOT WIN32) +configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) + ei_testing_print_summary() message(STATUS "") diff -Nru eigen3-3.1.2+6+10~precise1/CTestConfig.cmake eigen3-3.2.0+7+11~ubuntu12.04.1/CTestConfig.cmake --- eigen3-3.1.2+6+10~precise1/CTestConfig.cmake 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/CTestConfig.cmake 2013-09-11 07:34:01.000000000 +0000 @@ -4,10 +4,14 @@ ## # The following are required to uses Dart and the Cdash dashboard ## ENABLE_TESTING() ## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "Eigen3.1") +set(CTEST_PROJECT_NAME "Eigen") set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "manao.inria.fr") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen3.1") -set(CTEST_DROP_SITE_CDASH TRUE) \ No newline at end of file +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen") +set(CTEST_DROP_SITE_CDASH TRUE) +set(CTEST_PROJECT_SUBPROJECTS +Official +Unsupported +) diff -Nru eigen3-3.1.2+6+10~precise1/CTestCustom.cmake.in eigen3-3.2.0+7+11~ubuntu12.04.1/CTestCustom.cmake.in --- eigen3-3.1.2+6+10~precise1/CTestCustom.cmake.in 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/CTestCustom.cmake.in 2013-09-11 07:34:01.000000000 +0000 @@ -1,4 +1,3 @@ -## A tribute to Dynamic! -set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331") -set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331") +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000") +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000") diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/Core eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Core --- eigen3-3.1.2+6+10~precise1/Eigen/Core 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Core 2013-09-11 07:34:01.000000000 +0000 @@ -19,6 +19,12 @@ // defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. #include "src/Core/util/Macros.h" +// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) +// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. +#if defined(__MINGW32__) && EIGEN_GNUC_AT_LEAST(4,6) + #pragma GCC optimize ("-fno-ipa-cp-clone") +#endif + #include // this include file manages BLAS and MKL related macros @@ -87,19 +93,25 @@ // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. // notice that since these are C headers, the extern "C" is theoretically needed anyways. extern "C" { - #include - #include - #ifdef EIGEN_VECTORIZE_SSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_1 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_2 - #include + // In theory we should only include immintrin.h and not the other *mmintrin.h header files directly. + // Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus: + #ifdef __INTEL_COMPILER + #include + #else + #include + #include + #ifdef EIGEN_VECTORIZE_SSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_1 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_2 + #include + #endif #endif } // end extern "C" #elif defined __ALTIVEC__ @@ -236,15 +248,11 @@ * \endcode */ -/** \defgroup Support_modules Support modules [category] - * Category of modules which add support for external libraries. - */ - #include "src/Core/util/Constants.h" #include "src/Core/util/ForwardDeclarations.h" #include "src/Core/util/Meta.h" -#include "src/Core/util/XprHelper.h" #include "src/Core/util/StaticAssert.h" +#include "src/Core/util/XprHelper.h" #include "src/Core/util/Memory.h" #include "src/Core/NumTraits.h" @@ -297,6 +305,7 @@ #include "src/Core/Map.h" #include "src/Core/Block.h" #include "src/Core/VectorBlock.h" +#include "src/Core/Ref.h" #include "src/Core/Transpose.h" #include "src/Core/DiagonalMatrix.h" #include "src/Core/Diagonal.h" @@ -330,6 +339,7 @@ #include "src/Core/products/TriangularSolverMatrix.h" #include "src/Core/products/TriangularSolverVector.h" #include "src/Core/BandMatrix.h" +#include "src/Core/CoreIterators.h" #include "src/Core/BooleanRedux.h" #include "src/Core/Select.h" diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/Eigenvalues eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Eigenvalues --- eigen3-3.1.2+6+10~precise1/Eigen/Eigenvalues 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Eigenvalues 2013-09-11 07:34:01.000000000 +0000 @@ -33,6 +33,8 @@ #include "src/Eigenvalues/HessenbergDecomposition.h" #include "src/Eigenvalues/ComplexSchur.h" #include "src/Eigenvalues/ComplexEigenSolver.h" +#include "src/Eigenvalues/RealQZ.h" +#include "src/Eigenvalues/GeneralizedEigenSolver.h" #include "src/Eigenvalues/MatrixBaseEigenvalues.h" #ifdef EIGEN_USE_LAPACKE #include "src/Eigenvalues/RealSchur_MKL.h" diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/IterativeLinearSolvers eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/IterativeLinearSolvers --- eigen3-3.1.2+6+10~precise1/Eigen/IterativeLinearSolvers 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/IterativeLinearSolvers 2013-09-11 07:34:01.000000000 +0000 @@ -6,7 +6,7 @@ #include "src/Core/util/DisableStupidWarnings.h" -/** \ingroup Sparse_modules +/** * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module * * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/MetisSupport eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/MetisSupport --- eigen3-3.1.2+6+10~precise1/Eigen/MetisSupport 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/MetisSupport 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,28 @@ +#ifndef EIGEN_METISSUPPORT_MODULE_H +#define EIGEN_METISSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + + +/** \ingroup Support_modules + * \defgroup MetisSupport_Module MetisSupport module + * + * \code + * #include + * \endcode + * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). + * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink + */ + + +#include "src/MetisSupport/MetisSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_METISSUPPORT_MODULE_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/OrderingMethods eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/OrderingMethods --- eigen3-3.1.2+6+10~precise1/Eigen/OrderingMethods 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/OrderingMethods 2013-09-11 07:34:01.000000000 +0000 @@ -5,19 +5,62 @@ #include "src/Core/util/DisableStupidWarnings.h" -/** \ingroup Sparse_modules +/** * \defgroup OrderingMethods_Module OrderingMethods module * - * This module is currently for internal use only. - * - * + * This module is currently for internal use only + * + * It defines various built-in and external ordering methods for sparse matrices. + * They are typically used to reduce the number of elements during + * the sparse matrix decomposition (LLT, LU, QR). + * Precisely, in a preprocessing step, a permutation matrix P is computed using + * those ordering methods and applied to the columns of the matrix. + * Using for instance the sparse Cholesky decomposition, it is expected that + * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). + * + * + * Usage : * \code * #include * \endcode + * + * A simple usage is as a template parameter in the sparse decomposition classes : + * + * \code + * SparseLU > solver; + * \endcode + * + * \code + * SparseQR > solver; + * \endcode + * + * It is possible as well to call directly a particular ordering method for your own purpose, + * \code + * AMDOrdering ordering; + * PermutationMatrix perm; + * SparseMatrix A; + * //Fill the matrix ... + * + * ordering(A, perm); // Call AMD + * \endcode + * + * \note Some of these methods (like AMD or METIS), need the sparsity pattern + * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, + * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. + * If your matrix is already symmetric (at leat in structure), you can avoid that + * by calling the method with a SelfAdjointView type. + * + * \code + * // Call the ordering on the pattern of the lower triangular matrix A + * ordering(A.selfadjointView(), perm); + * \endcode */ +#ifndef EIGEN_MPL2_ONLY #include "src/OrderingMethods/Amd.h" +#endif +#include "src/OrderingMethods/Ordering.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_ORDERINGMETHODS_MODULE_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/SPQRSupport eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SPQRSupport --- eigen3-3.1.2+6+10~precise1/Eigen/SPQRSupport 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SPQRSupport 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,29 @@ +#ifndef EIGEN_SPQRSUPPORT_MODULE_H +#define EIGEN_SPQRSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SuiteSparseQR.hpp" + +/** \ingroup Support_modules + * \defgroup SPQRSupport_Module SuiteSparseQR module + * + * This module provides an interface to the SPQR library, which is part of the suitesparse package. + * + * \code + * #include + * \endcode + * + * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). + * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules + * + */ + +#include "src/misc/Solve.h" +#include "src/misc/SparseSolve.h" +#include "src/CholmodSupport/CholmodSupport.h" +#include "src/SPQRSupport/SuiteSparseQRSupport.h" + +#endif diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/Sparse eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Sparse --- eigen3-3.1.2+6+10~precise1/Eigen/Sparse 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/Sparse 2013-09-11 07:34:01.000000000 +0000 @@ -1,13 +1,15 @@ #ifndef EIGEN_SPARSE_MODULE_H #define EIGEN_SPARSE_MODULE_H -/** \defgroup Sparse_modules Sparse modules +/** \defgroup Sparse_Module Sparse meta-module * * Meta-module including all related modules: - * - SparseCore - * - OrderingMethods - * - SparseCholesky - * - IterativeLinearSolvers + * - \ref SparseCore_Module + * - \ref OrderingMethods_Module + * - \ref SparseCholesky_Module + * - \ref SparseLU_Module + * - \ref SparseQR_Module + * - \ref IterativeLinearSolvers_Module * * \code * #include @@ -17,6 +19,8 @@ #include "SparseCore" #include "OrderingMethods" #include "SparseCholesky" +#include "SparseLU" +#include "SparseQR" #include "IterativeLinearSolvers" #endif // EIGEN_SPARSE_MODULE_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/SparseCholesky eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseCholesky --- eigen3-3.1.2+6+10~precise1/Eigen/SparseCholesky 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseCholesky 2013-09-11 07:34:01.000000000 +0000 @@ -1,11 +1,21 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2013 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPARSECHOLESKY_MODULE_H #define EIGEN_SPARSECHOLESKY_MODULE_H #include "SparseCore" +#include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" -/** \ingroup Sparse_modules +/** * \defgroup SparseCholesky_Module SparseCholesky module * * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. @@ -20,11 +30,18 @@ * \endcode */ +#ifdef EIGEN_MPL2_ONLY +#error The SparseCholesky module has nothing to offer in MPL2 only mode +#endif + #include "src/misc/Solve.h" #include "src/misc/SparseSolve.h" - #include "src/SparseCholesky/SimplicialCholesky.h" +#ifndef EIGEN_MPL2_ONLY +#include "src/SparseCholesky/SimplicialCholesky_impl.h" +#endif + #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SPARSECHOLESKY_MODULE_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/SparseCore eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseCore --- eigen3-3.1.2+6+10~precise1/Eigen/SparseCore 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseCore 2013-09-11 07:34:01.000000000 +0000 @@ -11,7 +11,7 @@ #include #include -/** \ingroup Sparse_modules +/** * \defgroup SparseCore_Module SparseCore module * * This module provides a sparse matrix representation, and basic associatd matrix manipulations @@ -40,14 +40,12 @@ #include "src/SparseCore/SparseMatrix.h" #include "src/SparseCore/MappedSparseMatrix.h" #include "src/SparseCore/SparseVector.h" -#include "src/SparseCore/CoreIterators.h" #include "src/SparseCore/SparseBlock.h" #include "src/SparseCore/SparseTranspose.h" #include "src/SparseCore/SparseCwiseUnaryOp.h" #include "src/SparseCore/SparseCwiseBinaryOp.h" #include "src/SparseCore/SparseDot.h" #include "src/SparseCore/SparsePermutation.h" -#include "src/SparseCore/SparseAssign.h" #include "src/SparseCore/SparseRedux.h" #include "src/SparseCore/SparseFuzzy.h" #include "src/SparseCore/ConservativeSparseSparseProduct.h" diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/SparseLU eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseLU --- eigen3-3.1.2+6+10~precise1/Eigen/SparseLU 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseLU 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,49 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSELU_MODULE_H +#define EIGEN_SPARSELU_MODULE_H + +#include "SparseCore" + +/** + * \defgroup SparseLU_Module SparseLU module + * This module defines a supernodal factorization of general sparse matrices. + * The code is fully optimized for supernode-panel updates with specialized kernels. + * Please, see the documentation of the SparseLU class for more details. + */ + +#include "src/misc/Solve.h" +#include "src/misc/SparseSolve.h" + +// Ordering interface +#include "OrderingMethods" + +#include "src/SparseLU/SparseLU_gemm_kernel.h" + +#include "src/SparseLU/SparseLU_Structs.h" +#include "src/SparseLU/SparseLU_SupernodalMatrix.h" +#include "src/SparseLU/SparseLUImpl.h" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseLU/SparseLU_Memory.h" +#include "src/SparseLU/SparseLU_heap_relax_snode.h" +#include "src/SparseLU/SparseLU_relax_snode.h" +#include "src/SparseLU/SparseLU_pivotL.h" +#include "src/SparseLU/SparseLU_panel_dfs.h" +#include "src/SparseLU/SparseLU_kernel_bmod.h" +#include "src/SparseLU/SparseLU_panel_bmod.h" +#include "src/SparseLU/SparseLU_column_dfs.h" +#include "src/SparseLU/SparseLU_column_bmod.h" +#include "src/SparseLU/SparseLU_copy_to_ucol.h" +#include "src/SparseLU/SparseLU_pruneL.h" +#include "src/SparseLU/SparseLU_Utils.h" +#include "src/SparseLU/SparseLU.h" + +#endif // EIGEN_SPARSELU_MODULE_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/SparseQR eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseQR --- eigen3-3.1.2+6+10~precise1/Eigen/SparseQR 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/SparseQR 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,33 @@ +#ifndef EIGEN_SPARSEQR_MODULE_H +#define EIGEN_SPARSEQR_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SparseQR_Module SparseQR module + * \brief Provides QR decomposition for sparse matrices + * + * This module provides a simplicial version of the left-looking Sparse QR decomposition. + * The columns of the input matrix should be reordered to limit the fill-in during the + * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. + * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list + * of built-in and external ordering methods. + * + * \code + * #include + * \endcode + * + * + */ + +#include "src/misc/Solve.h" +#include "src/misc/SparseSolve.h" + +#include "OrderingMethods" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseQR/SparseQR.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Cholesky/LDLT.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Cholesky/LDLT.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Cholesky/LDLT.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Cholesky/LDLT.h 2013-09-11 07:34:01.000000000 +0000 @@ -196,7 +196,7 @@ LDLT& compute(const MatrixType& matrix); template - LDLT& rankUpdate(const MatrixBase& w,RealScalar alpha=1); + LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); /** \returns the internal LDLT decomposition matrix * @@ -248,6 +248,7 @@ template static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) { + using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; @@ -258,7 +259,7 @@ { transpositions.setIdentity(); if(sign) - *sign = real(mat.coeff(0,0))>0 ? 1:-1; + *sign = numext::real(mat.coeff(0,0))>0 ? 1:-1; return true; } @@ -277,15 +278,13 @@ // are compared; if any diagonal is negligible compared // to the largest overall, the algorithm bails. cutoff = abs(NumTraits::epsilon() * biggest_in_corner); - - if(sign) - *sign = real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1; } // Finish early if the matrix is not full rank. if(biggest_in_corner < cutoff) { for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i; + if(sign) *sign = 0; break; } @@ -301,11 +300,11 @@ for(int i=k+1;i::IsComplex) - mat.coeffRef(index_of_biggest_in_corner,k) = conj(mat.coeff(index_of_biggest_in_corner,k)); + mat.coeffRef(index_of_biggest_in_corner,k) = numext::conj(mat.coeff(index_of_biggest_in_corner,k)); } // partition the matrix: @@ -326,6 +325,16 @@ } if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff)) A21 /= mat.coeffRef(k,k); + + if(sign) + { + // LDLT is not guaranteed to work for indefinite matrices, but let's try to get the sign right + int newSign = numext::real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0; + if(k == 0) + *sign = newSign; + else if(*sign != newSign) + *sign = 0; + } } return true; @@ -339,9 +348,9 @@ // Here only rank-1 updates are implemented, to reduce the // requirement for intermediate storage and improve accuracy template - static bool updateInPlace(MatrixType& mat, MatrixBase& w, typename MatrixType::RealScalar sigma=1) + static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) { - using internal::isfinite; + using numext::isfinite; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; @@ -359,9 +368,9 @@ break; // Update the diagonal terms - RealScalar dj = real(mat.coeff(j,j)); + RealScalar dj = numext::real(mat.coeff(j,j)); Scalar wj = w.coeff(j); - RealScalar swj2 = sigma*abs2(wj); + RealScalar swj2 = sigma*numext::abs2(wj); RealScalar gamma = dj*alpha + swj2; mat.coeffRef(j,j) += swj2/alpha; @@ -372,13 +381,13 @@ Index rs = size-j-1; w.tail(rs) -= wj * mat.col(j).tail(rs); if(gamma != 0) - mat.col(j).tail(rs) += (sigma*conj(wj)/gamma)*w.tail(rs); + mat.col(j).tail(rs) += (sigma*numext::conj(wj)/gamma)*w.tail(rs); } return true; } template - static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, typename MatrixType::RealScalar sigma=1) + static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) { // Apply the permutation to the input w tmp = transpositions * w; @@ -397,7 +406,7 @@ } template - static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, typename MatrixType::RealScalar sigma=1) + static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) { Transpose matt(mat); return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); @@ -449,7 +458,7 @@ */ template template -LDLT& LDLT::rankUpdate(const MatrixBase& w,typename NumTraits::Real sigma) +LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename NumTraits::Real& sigma) { const Index size = w.rows(); if (m_isInitialized) diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Cholesky/LLT.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Cholesky/LLT.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Cholesky/LLT.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Cholesky/LLT.h 2013-09-11 07:34:01.000000000 +0000 @@ -190,6 +190,7 @@ template static typename MatrixType::Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) { + using std::sqrt; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; @@ -199,7 +200,7 @@ typedef Matrix TempVectorType; typedef typename TempVectorType::SegmentReturnType TempVecSegment; - int n = mat.cols(); + Index n = mat.cols(); eigen_assert(mat.rows()==n && vec.size()==n); TempVectorType temp; @@ -211,12 +212,12 @@ // i.e., for sigma > 0 temp = sqrt(sigma) * vec; - for(int i=0; i g; g.makeGivens(mat(i,i), -temp(i), &mat(i,i)); - int rs = n-i-1; + Index rs = n-i-1; if(rs>0) { ColXprSegment x(mat.col(i).tail(rs)); @@ -229,12 +230,12 @@ { temp = vec; RealScalar beta = 1; - for(int j=0; j static typename MatrixType::Index unblocked(MatrixType& mat) { + using std::sqrt; typedef typename MatrixType::Index Index; eigen_assert(mat.rows()==mat.cols()); @@ -275,7 +277,7 @@ Block A10(mat,k,0,1,k); Block A20(mat,k+1,0,rs,k); - RealScalar x = real(mat.coeff(k,k)); + RealScalar x = numext::real(mat.coeff(k,k)); if (k>0) x -= A10.squaredNorm(); if (x<=RealScalar(0)) return k; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/CholmodSupport/CholmodSupport.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/CholmodSupport/CholmodSupport.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/CholmodSupport/CholmodSupport.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/CholmodSupport/CholmodSupport.h 2013-09-11 07:34:01.000000000 +0000 @@ -51,7 +51,6 @@ template cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat) { - typedef SparseMatrix<_Scalar,_Options,_Index> MatrixType; cholmod_sparse res; res.nzmax = mat.nonZeros(); res.nrow = mat.rows();; @@ -77,9 +76,13 @@ { res.itype = CHOLMOD_INT; } + else if (internal::is_same<_Index,UF_long>::value) + { + res.itype = CHOLMOD_LONG; + } else { - eigen_assert(false && "Index type different than int is not supported yet"); + eigen_assert(false && "Index type not supported yet"); } // setup res.xtype @@ -123,7 +126,7 @@ res.ncol = mat.cols(); res.nzmax = res.nrow * res.ncol; res.d = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived().outerStride(); - res.x = mat.derived().data(); + res.x = (void*)(mat.derived().data()); res.z = 0; internal::cholmod_configure_matrix(res); @@ -137,8 +140,8 @@ MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) { return MappedSparseMatrix - (cm.nrow, cm.ncol, reinterpret_cast(cm.p)[cm.ncol], - reinterpret_cast(cm.p), reinterpret_cast(cm.i),reinterpret_cast(cm.x) ); + (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], + static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); } enum CholmodMode { @@ -173,6 +176,7 @@ CholmodBase(const MatrixType& matrix) : m_cholmodFactor(0), m_info(Success), m_isInitialized(false) { + m_shiftOffset[0] = m_shiftOffset[1] = RealScalar(0.0); cholmod_start(&m_cholmod); compute(matrix); } @@ -269,9 +273,10 @@ { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); - cholmod_factorize(&A, m_cholmodFactor, &m_cholmod); + cholmod_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, &m_cholmod); - this->m_info = Success; + // If the factorization failed, minor is the column at which it did. On success minor == n. + this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); m_factorizationIsOk = true; } @@ -286,10 +291,12 @@ { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); eigen_assert(size==b.rows()); // note: cd stands for Cholmod Dense - cholmod_dense b_cd = viewAsCholmod(b.const_cast_derived()); + Rhs& b_ref(b.const_cast_derived()); + cholmod_dense b_cd = viewAsCholmod(b_ref); cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod); if(!x_cd) { @@ -306,6 +313,7 @@ { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); eigen_assert(size==b.rows()); // note: cs stands for Cholmod Sparse @@ -321,13 +329,30 @@ } #endif // EIGEN_PARSED_BY_DOXYGEN + + /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. + * + * During the numerical factorization, an offset term is added to the diagonal coefficients:\n + * \c d_ii = \a offset + \c d_ii + * + * The default is \a offset=0. + * + * \returns a reference to \c *this. + */ + Derived& setShift(const RealScalar& offset) + { + m_shiftOffset[0] = offset; + return derived(); + } + template - void dumpMemory(Stream& s) + void dumpMemory(Stream& /*s*/) {} protected: mutable cholmod_common m_cholmod; cholmod_factor* m_cholmodFactor; + RealScalar m_shiftOffset[2]; mutable ComputationInfo m_info; bool m_isInitialized; int m_factorizationIsOk; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Array.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Array.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Array.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Array.h 2013-09-11 07:34:01.000000000 +0000 @@ -107,10 +107,10 @@ * * \sa resize(Index,Index) */ - EIGEN_STRONG_INLINE explicit Array() : Base() + EIGEN_STRONG_INLINE Array() : Base() { Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -120,7 +120,7 @@ : Base(internal::constructor_without_unaligned_array_assert()) { Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif @@ -137,15 +137,15 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) eigen_assert(dim >= 0); eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN template - EIGEN_STRONG_INLINE Array(const T0& x, const T1& y) + EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) { Base::_check_template_params(); - this->template _init2(x, y); + this->template _init2(val0, val1); } #else /** constructs an uninitialized matrix with \a rows rows and \a cols columns. @@ -155,27 +155,27 @@ * Matrix() instead. */ Array(Index rows, Index cols); /** constructs an initialized 2D vector with given coefficients */ - Array(const Scalar& x, const Scalar& y); + Array(const Scalar& val0, const Scalar& val1); #endif /** constructs an initialized 3D vector with given coefficients */ - EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z) + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) { Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) - m_storage.data()[0] = x; - m_storage.data()[1] = y; - m_storage.data()[2] = z; + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; } /** constructs an initialized 4D vector with given coefficients */ - EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) { Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) - m_storage.data()[0] = x; - m_storage.data()[1] = y; - m_storage.data()[2] = z; - m_storage.data()[3] = w; + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + m_storage.data()[3] = val3; } explicit Array(const Scalar *data); diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ArrayBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ArrayBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ArrayBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ArrayBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -143,7 +143,7 @@ ArrayBase& array() { return *this; } const ArrayBase& array() const { return *this; } - /** \returns an \link MatrixBase Matrix \endlink expression of this array + /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array * \sa MatrixBase::array() */ MatrixWrapper matrix() { return derived(); } const MatrixWrapper matrix() const { return derived(); } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ArrayWrapper.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ArrayWrapper.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ArrayWrapper.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ArrayWrapper.h 2013-09-11 07:34:01.000000000 +0000 @@ -55,22 +55,22 @@ inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } - inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } inline const Scalar* data() const { return m_expression.data(); } - inline CoeffReturnType coeff(Index row, Index col) const + inline CoeffReturnType coeff(Index rowId, Index colId) const { - return m_expression.coeff(row, col); + return m_expression.coeff(rowId, colId); } - inline Scalar& coeffRef(Index row, Index col) + inline Scalar& coeffRef(Index rowId, Index colId) { - return m_expression.const_cast_derived().coeffRef(row, col); + return m_expression.const_cast_derived().coeffRef(rowId, colId); } - inline const Scalar& coeffRef(Index row, Index col) const + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_expression.const_cast_derived().coeffRef(row, col); + return m_expression.const_cast_derived().coeffRef(rowId, colId); } inline CoeffReturnType coeff(Index index) const @@ -89,15 +89,15 @@ } template - inline const PacketScalar packet(Index row, Index col) const + inline const PacketScalar packet(Index rowId, Index colId) const { - return m_expression.template packet(row, col); + return m_expression.template packet(rowId, colId); } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { - m_expression.const_cast_derived().template writePacket(row, col, x); + m_expression.const_cast_derived().template writePacket(rowId, colId, val); } template @@ -107,9 +107,9 @@ } template - inline void writePacket(Index index, const PacketScalar& x) + inline void writePacket(Index index, const PacketScalar& val) { - m_expression.const_cast_derived().template writePacket(index, x); + m_expression.const_cast_derived().template writePacket(index, val); } template @@ -168,29 +168,29 @@ typedef typename internal::nested::type NestedExpressionType; - inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} + inline MatrixWrapper(ExpressionType& a_matrix) : m_expression(a_matrix) {} inline Index rows() const { return m_expression.rows(); } inline Index cols() const { return m_expression.cols(); } inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } - inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } inline const Scalar* data() const { return m_expression.data(); } - inline CoeffReturnType coeff(Index row, Index col) const + inline CoeffReturnType coeff(Index rowId, Index colId) const { - return m_expression.coeff(row, col); + return m_expression.coeff(rowId, colId); } - inline Scalar& coeffRef(Index row, Index col) + inline Scalar& coeffRef(Index rowId, Index colId) { - return m_expression.const_cast_derived().coeffRef(row, col); + return m_expression.const_cast_derived().coeffRef(rowId, colId); } - inline const Scalar& coeffRef(Index row, Index col) const + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_expression.derived().coeffRef(row, col); + return m_expression.derived().coeffRef(rowId, colId); } inline CoeffReturnType coeff(Index index) const @@ -209,15 +209,15 @@ } template - inline const PacketScalar packet(Index row, Index col) const + inline const PacketScalar packet(Index rowId, Index colId) const { - return m_expression.template packet(row, col); + return m_expression.template packet(rowId, colId); } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { - m_expression.const_cast_derived().template writePacket(row, col, x); + m_expression.const_cast_derived().template writePacket(rowId, colId, val); } template @@ -227,9 +227,9 @@ } template - inline void writePacket(Index index, const PacketScalar& x) + inline void writePacket(Index index, const PacketScalar& val) { - m_expression.const_cast_derived().template writePacket(index, x); + m_expression.const_cast_derived().template writePacket(index, val); } const typename internal::remove_all::type& diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Assign.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Assign.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Assign.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Assign.h 2013-09-11 07:34:01.000000000 +0000 @@ -155,7 +155,7 @@ template struct assign_DefaultTraversal_InnerUnrolling { - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer) + static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer) { dst.copyCoeffByOuterInner(outer, Index, src); assign_DefaultTraversal_InnerUnrolling::run(dst, src, outer); @@ -165,7 +165,7 @@ template struct assign_DefaultTraversal_InnerUnrolling { - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, int) {} + static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {} }; /*********************** @@ -218,7 +218,7 @@ template struct assign_innervec_InnerUnrolling { - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer) + static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer) { dst.template copyPacketByOuterInner(outer, Index, src); assign_innervec_InnerUnrolling struct assign_innervec_InnerUnrolling { - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, int) {} + static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {} }; /*************************************************************************** @@ -507,19 +507,19 @@ namespace internal { template + bool EvalBeforeAssigning = (int(internal::traits::Flags) & EvalBeforeAssigningBit) != 0, + bool NeedToTranspose = ((int(Derived::RowsAtCompileTime) == 1 && int(OtherDerived::ColsAtCompileTime) == 1) + | // FIXME | instead of || to please GCC 4.4.0 stupid warning "suggest parentheses around &&". + // revert to || as soon as not needed anymore. + (int(Derived::ColsAtCompileTime) == 1 && int(OtherDerived::RowsAtCompileTime) == 1)) + && int(Derived::SizeAtCompileTime) != 1> struct assign_selector; template struct assign_selector { static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); } + template + static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { other.evalTo(dst); return dst; } }; template struct assign_selector { @@ -528,6 +528,8 @@ template struct assign_selector { static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); } + template + static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { Transpose dstTrans(dst); other.evalTo(dstTrans); return dst; } }; template struct assign_selector { @@ -566,16 +568,14 @@ template EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) { - other.derived().evalTo(derived()); - return derived(); + return internal::assign_selector::evalTo(derived(), other.derived()); } template template EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) { - other.evalTo(derived()); - return derived(); + return internal::assign_selector::evalTo(derived(), other.derived()); } } // end namespace Eigen diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Assign_MKL.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Assign_MKL.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Assign_MKL.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Assign_MKL.h 2013-09-11 07:34:01.000000000 +0000 @@ -210,7 +210,7 @@ EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr) // The vm*powx functions are not avaibale in the windows version of MKL. -#ifdef _WIN32 +#ifndef _WIN32 EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmspowx_, float, float) EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdpowx_, double, double) EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcpowx_, scomplex, MKL_Complex8) diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Block.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Block.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Block.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Block.h 2013-09-11 07:34:01.000000000 +0000 @@ -21,7 +21,6 @@ * \param XprType the type of the expression in which we are taking a block * \param BlockRows the number of rows of the block we are taking at compile time (optional) * \param BlockCols the number of columns of the block we are taking at compile time (optional) - * \param _DirectAccessStatus \internal used for partial specialization * * This class represents an expression of either a fixed-size or dynamic-size block. It is the return * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and @@ -47,8 +46,8 @@ */ namespace internal { -template -struct traits > : traits +template +struct traits > : traits { typedef typename traits::Scalar Scalar; typedef typename traits::StorageKind StorageKind; @@ -92,30 +91,27 @@ Flags = Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit }; }; -} - -template class Block - : public internal::dense_xpr_base >::type -{ - public: - typedef typename internal::dense_xpr_base::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Block) +template::ret> class BlockImpl_dense; + +} // end namespace internal - class InnerIterator; +template class BlockImpl; +template class Block + : public BlockImpl::StorageKind> +{ + typedef BlockImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Block) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + /** Column or Row constructor */ - inline Block(XprType& xpr, Index i) - : m_xpr(xpr), - // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, - // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, - // all other cases are invalid. - // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. - m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), - m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), - m_blockRows(BlockRows==1 ? 1 : xpr.rows()), - m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + inline Block(XprType& xpr, Index i) : Impl(xpr,i) { eigen_assert( (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() - && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); + eigen_assert(a_startRow >= 0 && BlockRows >= 1 && a_startRow + BlockRows <= xpr.rows() + && a_startCol >= 0 && BlockCols >= 1 && a_startCol + BlockCols <= xpr.cols()); } /** Dynamic-size constructor */ inline Block(XprType& xpr, - Index startRow, Index startCol, + Index a_startRow, Index a_startCol, Index blockRows, Index blockCols) - : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), - m_blockRows(blockRows), m_blockCols(blockCols) + : Impl(xpr, a_startRow, a_startCol, blockRows, blockCols) { eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() - && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); + eigen_assert(a_startRow >= 0 && blockRows >= 0 && a_startRow <= xpr.rows() - blockRows + && a_startCol >= 0 && blockCols >= 0 && a_startCol <= xpr.cols() - blockCols); } +}; + +// The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense +// that must be specialized for direct and non-direct access... +template +class BlockImpl + : public internal::BlockImpl_dense +{ + typedef internal::BlockImpl_dense Impl; + typedef typename XprType::Index Index; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) + inline BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} + inline BlockImpl(XprType& xpr, Index a_startRow, Index a_startCol) : Impl(xpr, a_startRow, a_startCol) {} + inline BlockImpl(XprType& xpr, Index a_startRow, Index a_startCol, Index blockRows, Index blockCols) + : Impl(xpr, a_startRow, a_startCol, blockRows, blockCols) {} +}; - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) +namespace internal { + +/** \internal Internal implementation of dense Blocks in the general case. */ +template class BlockImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Block BlockType; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + class InnerIterator; + + /** Column or Row constructor + */ + inline BlockImpl_dense(XprType& xpr, Index i) + : m_xpr(xpr), + // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, + // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, + // all other cases are invalid. + // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), + m_blockRows(BlockRows==1 ? 1 : xpr.rows()), + m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + {} + + /** Fixed-size constructor + */ + inline BlockImpl_dense(XprType& xpr, Index a_startRow, Index a_startCol) + : m_xpr(xpr), m_startRow(a_startRow), m_startCol(a_startCol), + m_blockRows(BlockRows), m_blockCols(BlockCols) + {} + + /** Dynamic-size constructor + */ + inline BlockImpl_dense(XprType& xpr, + Index a_startRow, Index a_startCol, + Index blockRows, Index blockCols) + : m_xpr(xpr), m_startRow(a_startRow), m_startCol(a_startCol), + m_blockRows(blockRows), m_blockCols(blockCols) + {} inline Index rows() const { return m_blockRows.value(); } inline Index cols() const { return m_blockCols.value(); } - inline Scalar& coeffRef(Index row, Index col) + inline Scalar& coeffRef(Index rowId, Index colId) { EIGEN_STATIC_ASSERT_LVALUE(XprType) return m_xpr.const_cast_derived() - .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + .coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); } - inline const Scalar& coeffRef(Index row, Index col) const + inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_xpr.derived() - .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + .coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); } - EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const { - return m_xpr.coeff(row + m_startRow.value(), col + m_startCol.value()); + return m_xpr.coeff(rowId + m_startRow.value(), colId + m_startCol.value()); } inline Scalar& coeffRef(Index index) @@ -193,17 +248,17 @@ } template - inline PacketScalar packet(Index row, Index col) const + inline PacketScalar packet(Index rowId, Index colId) const { return m_xpr.template packet - (row + m_startRow.value(), col + m_startCol.value()); + (rowId + m_startRow.value(), colId + m_startCol.value()); } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { m_xpr.const_cast_derived().template writePacket - (row + m_startRow.value(), col + m_startCol.value(), x); + (rowId + m_startRow.value(), colId + m_startCol.value(), val); } template @@ -215,11 +270,11 @@ } template - inline void writePacket(Index index, const PacketScalar& x) + inline void writePacket(Index index, const PacketScalar& val) { m_xpr.const_cast_derived().template writePacket (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), x); + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val); } #ifdef EIGEN_PARSED_BY_DOXYGEN @@ -253,21 +308,21 @@ const internal::variable_if_dynamic m_blockCols; }; -/** \internal */ +/** \internal Internal implementation of dense Blocks in the direct access case.*/ template -class Block - : public MapBase > +class BlockImpl_dense + : public MapBase > { + typedef Block BlockType; public: - typedef MapBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Block) - - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) /** Column or Row constructor */ - inline Block(XprType& xpr, Index i) + inline BlockImpl_dense(XprType& xpr, Index i) : Base(internal::const_cast_ptr(&xpr.coeffRef( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0, (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0)), @@ -275,34 +330,25 @@ BlockCols==1 ? 1 : xpr.cols()), m_xpr(xpr) { - eigen_assert( (i>=0) && ( - ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() - && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); init(); } /** Dynamic-size constructor */ - inline Block(XprType& xpr, + inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol)), blockRows, blockCols), m_xpr(xpr) { - eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) - && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() - && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); init(); } @@ -314,7 +360,7 @@ /** \sa MapBase::innerStride() */ inline Index innerStride() const { - return internal::traits::HasSameStorageOrderAsXprType + return internal::traits::HasSameStorageOrderAsXprType ? m_xpr.innerStride() : m_xpr.outerStride(); } @@ -333,7 +379,7 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal used by allowAligned() */ - inline Block(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + inline BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) : Base(data, blockRows, blockCols), m_xpr(xpr) { init(); @@ -343,7 +389,7 @@ protected: void init() { - m_outerStride = internal::traits::HasSameStorageOrderAsXprType + m_outerStride = internal::traits::HasSameStorageOrderAsXprType ? m_xpr.outerStride() : m_xpr.innerStride(); } @@ -352,6 +398,8 @@ Index m_outerStride; }; +} // end namespace internal + } // end namespace Eigen #endif // EIGEN_BLOCK_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/BooleanRedux.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/BooleanRedux.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/BooleanRedux.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/BooleanRedux.h 2013-09-11 07:34:01.000000000 +0000 @@ -85,9 +85,7 @@ && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT }; if(unroll) - return internal::all_unroller::run(derived()); + return internal::all_unroller::run(derived()); else { for(Index j = 0; j < cols(); ++j) @@ -111,9 +109,7 @@ && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT }; if(unroll) - return internal::any_unroller::run(derived()); + return internal::any_unroller::run(derived()); else { for(Index j = 0; j < cols(); ++j) @@ -133,6 +129,26 @@ return derived().template cast().template cast().sum(); } +/** \returns true is \c *this contains at least one Not A Number (NaN). + * + * \sa allFinite() + */ +template +inline bool DenseBase::hasNaN() const +{ + return !((derived().array()==derived().array()).all()); +} + +/** \returns true if \c *this contains only finite numbers, i.e., no NaN and no +/-INF values. + * + * \sa hasNaN() + */ +template +inline bool DenseBase::allFinite() const +{ + return !((derived()-derived()).hasNaN()); +} + } // end namespace Eigen #endif // EIGEN_ALLANDANY_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CommaInitializer.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CommaInitializer.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CommaInitializer.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CommaInitializer.h 2013-09-11 07:34:01.000000000 +0000 @@ -118,6 +118,8 @@ * * Example: \include MatrixBase_set.cpp * Output: \verbinclude MatrixBase_set.out + * + * \note According the c++ standard, the argument expressions of this comma initializer are evaluated in arbitrary order. * * \sa CommaInitializer::finished(), class CommaInitializer */ diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CoreIterators.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CoreIterators.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CoreIterators.h 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CoreIterators.h 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,61 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COREITERATORS_H +#define EIGEN_COREITERATORS_H + +namespace Eigen { + +/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core + */ + +/** \ingroup SparseCore_Module + * \class InnerIterator + * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression + * + * todo + */ + +// generic version for dense matrix and expressions +template class DenseBase::InnerIterator +{ + protected: + typedef typename Derived::Scalar Scalar; + typedef typename Derived::Index Index; + + enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; + public: + EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) + : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) + {} + + EIGEN_STRONG_INLINE Scalar value() const + { + return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) + : m_expression.coeff(m_inner, m_outer); + } + + EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } + + EIGEN_STRONG_INLINE Index index() const { return m_inner; } + inline Index row() const { return IsRowMajor ? m_outer : index(); } + inline Index col() const { return IsRowMajor ? index() : m_outer; } + + EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } + + protected: + const Derived& m_expression; + Index m_inner; + const Index m_outer; + const Index m_end; +}; + +} // end namespace Eigen + +#endif // EIGEN_COREITERATORS_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseBinaryOp.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseBinaryOp.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseBinaryOp.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseBinaryOp.h 2013-09-11 07:34:01.000000000 +0000 @@ -94,8 +94,8 @@ // So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to // add together a float matrix and a double matrix. #define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ - EIGEN_STATIC_ASSERT((internal::functor_allows_mixing_real_and_complex::ret \ - ? int(internal::is_same::Real, typename NumTraits::Real>::value) \ + EIGEN_STATIC_ASSERT((internal::functor_is_product_like::ret \ + ? int(internal::scalar_product_traits::Defined) \ : int(internal::is_same::value)), \ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) @@ -122,13 +122,13 @@ typedef typename internal::remove_reference::type _LhsNested; typedef typename internal::remove_reference::type _RhsNested; - EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) - : m_lhs(lhs), m_rhs(rhs), m_functor(func) + EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) + : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) { EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); // require the sizes to match EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) - eigen_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); + eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); } EIGEN_STRONG_INLINE Index rows() const { @@ -169,17 +169,17 @@ typedef typename internal::dense_xpr_base >::type Base; EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) - EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const { - return derived().functor()(derived().lhs().coeff(row, col), - derived().rhs().coeff(row, col)); + return derived().functor()(derived().lhs().coeff(rowId, colId), + derived().rhs().coeff(rowId, colId)); } template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const { - return derived().functor().packetOp(derived().lhs().template packet(row, col), - derived().rhs().template packet(row, col)); + return derived().functor().packetOp(derived().lhs().template packet(rowId, colId), + derived().rhs().template packet(rowId, colId)); } EIGEN_STRONG_INLINE const Scalar coeff(Index index) const diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseNullaryOp.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseNullaryOp.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseNullaryOp.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseNullaryOp.h 2013-09-11 07:34:01.000000000 +0000 @@ -54,27 +54,27 @@ typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) - CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) - : m_rows(rows), m_cols(cols), m_functor(func) + CwiseNullaryOp(Index nbRows, Index nbCols, const NullaryOp& func = NullaryOp()) + : m_rows(nbRows), m_cols(nbCols), m_functor(func) { - eigen_assert(rows >= 0 - && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) - && cols >= 0 - && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); + eigen_assert(nbRows >= 0 + && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == nbRows) + && nbCols >= 0 + && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == nbCols)); } EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); } EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); } - EIGEN_STRONG_INLINE const Scalar coeff(Index rows, Index cols) const + EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const { - return m_functor(rows, cols); + return m_functor(rowId, colId); } template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const { - return m_functor.packetOp(row, col); + return m_functor.packetOp(rowId, colId); } EIGEN_STRONG_INLINE const Scalar coeff(Index index) const @@ -163,11 +163,11 @@ /** \returns an expression of a constant matrix of value \a value * - * The parameters \a rows and \a cols are the number of rows and of columns of + * The parameters \a nbRows and \a nbCols are the number of rows and of columns of * the returned matrix. Must be compatible with this DenseBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, - * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * it is redundant to pass \a nbRows and \a nbCols as arguments, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor. @@ -176,9 +176,9 @@ */ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Constant(Index rows, Index cols, const Scalar& value) +DenseBase::Constant(Index nbRows, Index nbCols, const Scalar& value) { - return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); + return DenseBase::NullaryExpr(nbRows, nbCols, internal::scalar_constant_op(value)); } /** \returns an expression of a constant matrix of value \a value @@ -292,14 +292,14 @@ return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } -/** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */ template bool DenseBase::isApproxToConstant -(const Scalar& value, RealScalar prec) const +(const Scalar& val, const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!internal::isApprox(this->coeff(i, j), value, prec)) + if(!internal::isApprox(this->coeff(i, j), val, prec)) return false; return true; } @@ -309,19 +309,19 @@ * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ template bool DenseBase::isConstant -(const Scalar& value, RealScalar prec) const +(const Scalar& val, const RealScalar& prec) const { - return isApproxToConstant(value, prec); + return isApproxToConstant(val, prec); } -/** Alias for setConstant(): sets all coefficients in this expression to \a value. +/** Alias for setConstant(): sets all coefficients in this expression to \a val. * * \sa setConstant(), Constant(), class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& value) +EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) { - setConstant(value); + setConstant(val); } /** Sets all coefficients in this expression to \a value. @@ -329,9 +329,9 @@ * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& value) +EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) { - return derived() = Constant(rows(), cols(), value); + return derived() = Constant(rows(), cols(), val); } /** Resizes to the given \a size, and sets all coefficients in this expression to the given \a value. @@ -345,17 +345,17 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setConstant(Index size, const Scalar& value) +PlainObjectBase::setConstant(Index size, const Scalar& val) { resize(size); - return setConstant(value); + return setConstant(val); } /** Resizes to the given size, and sets all coefficients in this expression to the given \a value. * - * \param rows the new number of rows - * \param cols the new number of columns - * \param value the value to which all coefficients are set + * \param nbRows the new number of rows + * \param nbCols the new number of columns + * \param val the value to which all coefficients are set * * Example: \include Matrix_setConstant_int_int.cpp * Output: \verbinclude Matrix_setConstant_int_int.out @@ -364,10 +364,10 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& value) +PlainObjectBase::setConstant(Index nbRows, Index nbCols, const Scalar& val) { - resize(rows, cols); - return setConstant(value); + resize(nbRows, nbCols); + return setConstant(val); } /** @@ -384,10 +384,10 @@ * \sa CwiseNullaryOp */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index size, const Scalar& low, const Scalar& high) +EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return derived() = Derived::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); } /** @@ -425,9 +425,9 @@ */ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Zero(Index rows, Index cols) +DenseBase::Zero(Index nbRows, Index nbCols) { - return Constant(rows, cols, Scalar(0)); + return Constant(nbRows, nbCols, Scalar(0)); } /** \returns an expression of a zero vector. @@ -479,7 +479,7 @@ * \sa class CwiseNullaryOp, Zero() */ template -bool DenseBase::isZero(RealScalar prec) const +bool DenseBase::isZero(const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) @@ -512,16 +512,16 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setZero(Index size) +PlainObjectBase::setZero(Index newSize) { - resize(size); + resize(newSize); return setConstant(Scalar(0)); } /** Resizes to the given size, and sets all coefficients in this expression to zero. * - * \param rows the new number of rows - * \param cols the new number of columns + * \param nbRows the new number of rows + * \param nbCols the new number of columns * * Example: \include Matrix_setZero_int_int.cpp * Output: \verbinclude Matrix_setZero_int_int.out @@ -530,9 +530,9 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setZero(Index rows, Index cols) +PlainObjectBase::setZero(Index nbRows, Index nbCols) { - resize(rows, cols); + resize(nbRows, nbCols); return setConstant(Scalar(0)); } @@ -540,7 +540,7 @@ /** \returns an expression of a matrix where all coefficients equal one. * - * The parameters \a rows and \a cols are the number of rows and of columns of + * The parameters \a nbRows and \a nbCols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, @@ -554,14 +554,14 @@ */ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Ones(Index rows, Index cols) +DenseBase::Ones(Index nbRows, Index nbCols) { - return Constant(rows, cols, Scalar(1)); + return Constant(nbRows, nbCols, Scalar(1)); } /** \returns an expression of a vector where all coefficients equal one. * - * The parameter \a size is the size of the returned vector. + * The parameter \a newSize is the size of the returned vector. * Must be compatible with this MatrixBase type. * * \only_for_vectors @@ -577,9 +577,9 @@ */ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Ones(Index size) +DenseBase::Ones(Index newSize) { - return Constant(size, Scalar(1)); + return Constant(newSize, Scalar(1)); } /** \returns an expression of a fixed-size matrix or vector where all coefficients equal one. @@ -609,7 +609,7 @@ */ template bool DenseBase::isOnes -(RealScalar prec) const +(const RealScalar& prec) const { return isApproxToConstant(Scalar(1), prec); } @@ -627,7 +627,7 @@ return setConstant(Scalar(1)); } -/** Resizes to the given \a size, and sets all coefficients in this expression to one. +/** Resizes to the given \a newSize, and sets all coefficients in this expression to one. * * \only_for_vectors * @@ -638,16 +638,16 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setOnes(Index size) +PlainObjectBase::setOnes(Index newSize) { - resize(size); + resize(newSize); return setConstant(Scalar(1)); } /** Resizes to the given size, and sets all coefficients in this expression to one. * - * \param rows the new number of rows - * \param cols the new number of columns + * \param nbRows the new number of rows + * \param nbCols the new number of columns * * Example: \include Matrix_setOnes_int_int.cpp * Output: \verbinclude Matrix_setOnes_int_int.out @@ -656,9 +656,9 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setOnes(Index rows, Index cols) +PlainObjectBase::setOnes(Index nbRows, Index nbCols) { - resize(rows, cols); + resize(nbRows, nbCols); return setConstant(Scalar(1)); } @@ -666,7 +666,7 @@ /** \returns an expression of the identity matrix (not necessarily square). * - * The parameters \a rows and \a cols are the number of rows and of columns of + * The parameters \a nbRows and \a nbCols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, @@ -680,9 +680,9 @@ */ template EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType -MatrixBase::Identity(Index rows, Index cols) +MatrixBase::Identity(Index nbRows, Index nbCols) { - return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); + return DenseBase::NullaryExpr(nbRows, nbCols, internal::scalar_identity_op()); } /** \returns an expression of the identity matrix (not necessarily square). @@ -714,7 +714,7 @@ */ template bool MatrixBase::isIdentity -(RealScalar prec) const +(const RealScalar& prec) const { for(Index j = 0; j < cols(); ++j) { @@ -776,8 +776,8 @@ /** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. * - * \param rows the new number of rows - * \param cols the new number of columns + * \param nbRows the new number of rows + * \param nbCols the new number of columns * * Example: \include Matrix_setIdentity_int_int.cpp * Output: \verbinclude Matrix_setIdentity_int_int.out @@ -785,9 +785,9 @@ * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() */ template -EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) +EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index nbRows, Index nbCols) { - derived().resize(rows, cols); + derived().resize(nbRows, nbCols); return setIdentity(); } @@ -798,10 +798,10 @@ * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index size, Index i) +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return BasisReturnType(SquareMatrixType::Identity(size,size), i); + return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i); } /** \returns an expression of the i-th unit (basis) vector. diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseUnaryOp.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseUnaryOp.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseUnaryOp.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseUnaryOp.h 2013-09-11 07:34:01.000000000 +0000 @@ -98,15 +98,15 @@ typedef typename internal::dense_xpr_base >::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Derived) - EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const { - return derived().functor()(derived().nestedExpression().coeff(row, col)); + return derived().functor()(derived().nestedExpression().coeff(rowId, colId)); } template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const { - return derived().functor().packetOp(derived().nestedExpression().template packet(row, col)); + return derived().functor().packetOp(derived().nestedExpression().template packet(rowId, colId)); } EIGEN_STRONG_INLINE const Scalar coeff(Index index) const diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseUnaryView.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseUnaryView.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/CwiseUnaryView.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/CwiseUnaryView.h 2013-09-11 07:34:01.000000000 +0000 @@ -56,8 +56,7 @@ class CwiseUnaryViewImpl; template -class CwiseUnaryView : internal::no_assignment_operator, - public CwiseUnaryViewImpl::StorageKind> +class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind> { public: @@ -99,6 +98,10 @@ typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) + + inline Scalar* data() { return &coeffRef(0); } + inline const Scalar* data() const { return &coeff(0); } inline Index innerStride() const { diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -13,6 +13,16 @@ namespace Eigen { +namespace internal { + +// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. +// This dummy function simply aims at checking that at compile time. +static inline void check_DenseIndex_is_signed() { + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); +} + +} // end namespace internal + /** \class DenseBase * \ingroup Core_Module * @@ -204,21 +214,21 @@ * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ - void resize(Index size) + void resize(Index newSize) { - EIGEN_ONLY_USED_FOR_DEBUG(size); - eigen_assert(size == this->size() + EIGEN_ONLY_USED_FOR_DEBUG(newSize); + eigen_assert(newSize == this->size() && "DenseBase::resize() does not actually allow to resize."); } /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ - void resize(Index rows, Index cols) + void resize(Index nbRows, Index nbCols) { - EIGEN_ONLY_USED_FOR_DEBUG(rows); - EIGEN_ONLY_USED_FOR_DEBUG(cols); - eigen_assert(rows == this->rows() && cols == this->cols() + EIGEN_ONLY_USED_FOR_DEBUG(nbRows); + EIGEN_ONLY_USED_FOR_DEBUG(nbCols); + eigen_assert(nbRows == this->rows() && nbCols == this->cols() && "DenseBase::resize() does not actually allow to resize."); } @@ -271,7 +281,7 @@ CommaInitializer operator<< (const DenseBase& other); Eigen::Transpose transpose(); - typedef const Transpose ConstTransposeReturnType; + typedef typename internal::add_const >::type ConstTransposeReturnType; ConstTransposeReturnType transpose() const; void transposeInPlace(); #ifndef EIGEN_NO_DEBUG @@ -281,29 +291,6 @@ public: #endif - typedef VectorBlock SegmentReturnType; - typedef const VectorBlock ConstSegmentReturnType; - template struct FixedSegmentReturnType { typedef VectorBlock Type; }; - template struct ConstFixedSegmentReturnType { typedef const VectorBlock Type; }; - - // Note: The "DenseBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. - SegmentReturnType segment(Index start, Index size); - typename DenseBase::ConstSegmentReturnType segment(Index start, Index size) const; - - SegmentReturnType head(Index size); - typename DenseBase::ConstSegmentReturnType head(Index size) const; - - SegmentReturnType tail(Index size); - typename DenseBase::ConstSegmentReturnType tail(Index size) const; - - template typename FixedSegmentReturnType::Type head(); - template typename ConstFixedSegmentReturnType::Type head() const; - - template typename FixedSegmentReturnType::Type tail(); - template typename ConstFixedSegmentReturnType::Type tail() const; - - template typename FixedSegmentReturnType::Type segment(Index start); - template typename ConstFixedSegmentReturnType::Type segment(Index start) const; static const ConstantReturnType Constant(Index rows, Index cols, const Scalar& value); @@ -348,17 +335,20 @@ template bool isApprox(const DenseBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; bool isMuchSmallerThan(const RealScalar& other, - RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; template bool isMuchSmallerThan(const DenseBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isApproxToConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; - bool isConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; - bool isZero(RealScalar prec = NumTraits::dummy_precision()) const; - bool isOnes(RealScalar prec = NumTraits::dummy_precision()) const; + bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; + + inline bool hasNaN() const; + inline bool allFinite() const; inline Derived& operator*=(const Scalar& other); inline Derived& operator/=(const Scalar& other); @@ -438,8 +428,6 @@ return derived().coeff(0,0); } -/////////// Array module /////////// - bool all(void) const; bool any(void) const; Index count() const; @@ -465,11 +453,11 @@ template inline const Select - select(const DenseBase& thenMatrix, typename ThenDerived::Scalar elseScalar) const; + select(const DenseBase& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const; template inline const Select - select(typename ElseDerived::Scalar thenScalar, const DenseBase& elseMatrix) const; + select(const typename ElseDerived::Scalar& thenScalar, const DenseBase& elseMatrix) const; template RealScalar lpNorm() const; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseCoeffsBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseCoeffsBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseCoeffsBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseCoeffsBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -427,22 +427,22 @@ template EIGEN_STRONG_INLINE void writePacket - (Index row, Index col, const typename internal::packet_traits::type& x) + (Index row, Index col, const typename internal::packet_traits::type& val) { eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - derived().template writePacket(row,col,x); + derived().template writePacket(row,col,val); } /** \internal */ template EIGEN_STRONG_INLINE void writePacketByOuterInner - (Index outer, Index inner, const typename internal::packet_traits::type& x) + (Index outer, Index inner, const typename internal::packet_traits::type& val) { writePacket(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner), - x); + val); } /** \internal @@ -456,10 +456,10 @@ */ template EIGEN_STRONG_INLINE void writePacket - (Index index, const typename internal::packet_traits::type& x) + (Index index, const typename internal::packet_traits::type& val) { eigen_internal_assert(index >= 0 && index < size()); - derived().template writePacket(index,x); + derived().template writePacket(index,val); } #ifndef EIGEN_PARSED_BY_DOXYGEN diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseStorage.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseStorage.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DenseStorage.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DenseStorage.h 2013-09-11 07:34:01.000000000 +0000 @@ -35,8 +35,16 @@ struct plain_array { T array[Size]; - plain_array() {} - plain_array(constructor_without_unaligned_array_assert) {} + + plain_array() + { + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + } + + plain_array(constructor_without_unaligned_array_assert) + { + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + } }; #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) @@ -64,8 +72,17 @@ struct plain_array { EIGEN_USER_ALIGN16 T array[Size]; - plain_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) } - plain_array(constructor_without_unaligned_array_assert) {} + + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf); + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + } + + plain_array(constructor_without_unaligned_array_assert) + { + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + } }; template @@ -97,7 +114,7 @@ { internal::plain_array m_data; public: - inline explicit DenseStorage() {} + inline DenseStorage() {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()) {} inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} @@ -114,7 +131,7 @@ template class DenseStorage { public: - inline explicit DenseStorage() {} + inline DenseStorage() {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) {} inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} inline void swap(DenseStorage& ) {} @@ -143,16 +160,16 @@ DenseIndex m_rows; DenseIndex m_cols; public: - inline explicit DenseStorage() : m_rows(0), m_cols(0) {} + inline DenseStorage() : m_rows(0), m_cols(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} - inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex cols) : m_rows(rows), m_cols(cols) {} + inline DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) : m_rows(nbRows), m_cols(nbCols) {} inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } - inline DenseIndex rows(void) const {return m_rows;} - inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } - inline void resize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } + inline DenseIndex rows() const {return m_rows;} + inline DenseIndex cols() const {return m_cols;} + inline void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; } + inline void resize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; } inline const T *data() const { return m_data.array; } inline T *data() { return m_data.array; } }; @@ -163,15 +180,15 @@ internal::plain_array m_data; DenseIndex m_rows; public: - inline explicit DenseStorage() : m_rows(0) {} + inline DenseStorage() : m_rows(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} - inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex) : m_rows(rows) {} + inline DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex) : m_rows(nbRows) {} inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } inline DenseIndex rows(void) const {return m_rows;} inline DenseIndex cols(void) const {return _Cols;} - inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } - inline void resize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } + inline void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; } + inline void resize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; } inline const T *data() const { return m_data.array; } inline T *data() { return m_data.array; } }; @@ -182,15 +199,15 @@ internal::plain_array m_data; DenseIndex m_cols; public: - inline explicit DenseStorage() : m_cols(0) {} + inline DenseStorage() : m_cols(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} - inline DenseStorage(DenseIndex, DenseIndex, DenseIndex cols) : m_cols(cols) {} + inline DenseStorage(DenseIndex, DenseIndex, DenseIndex nbCols) : m_cols(nbCols) {} inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } inline DenseIndex rows(void) const {return _Rows;} inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } - inline void resize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } + inline void conservativeResize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; } + inline void resize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; } inline const T *data() const { return m_data.array; } inline T *data() { return m_data.array; } }; @@ -202,24 +219,24 @@ DenseIndex m_rows; DenseIndex m_cols; public: - inline explicit DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + inline DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0), m_cols(0) {} - inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex cols) - : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + inline DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(nbRows), m_cols(nbCols) { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } inline DenseIndex rows(void) const {return m_rows;} inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex cols) + inline void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); - m_rows = rows; - m_cols = cols; + m_rows = nbRows; + m_cols = nbCols; } - void resize(DenseIndex size, DenseIndex rows, DenseIndex cols) + void resize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) { if(size != m_rows*m_cols) { @@ -230,8 +247,8 @@ m_data = 0; EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - m_rows = rows; - m_cols = cols; + m_rows = nbRows; + m_cols = nbCols; } inline const T *data() const { return m_data; } inline T *data() { return m_data; } @@ -243,20 +260,20 @@ T *m_data; DenseIndex m_cols; public: - inline explicit DenseStorage() : m_data(0), m_cols(0) {} + inline DenseStorage() : m_data(0), m_cols(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} - inline DenseStorage(DenseIndex size, DenseIndex, DenseIndex cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) + inline DenseStorage(DenseIndex size, DenseIndex, DenseIndex nbCols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(nbCols) { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } static inline DenseIndex rows(void) {return _Rows;} inline DenseIndex cols(void) const {return m_cols;} - inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex cols) + inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex nbCols) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); - m_cols = cols; + m_cols = nbCols; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex cols) + EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex nbCols) { if(size != _Rows*m_cols) { @@ -267,7 +284,7 @@ m_data = 0; EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - m_cols = cols; + m_cols = nbCols; } inline const T *data() const { return m_data; } inline T *data() { return m_data; } @@ -279,20 +296,20 @@ T *m_data; DenseIndex m_rows; public: - inline explicit DenseStorage() : m_data(0), m_rows(0) {} + inline DenseStorage() : m_data(0), m_rows(0) {} inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} - inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + inline DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(nbRows) { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } inline DenseIndex rows(void) const {return m_rows;} static inline DenseIndex cols(void) {return _Cols;} - inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex) + inline void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); - m_rows = rows; + m_rows = nbRows; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex rows, DenseIndex) + EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex nbRows, DenseIndex) { if(size != m_rows*_Cols) { @@ -303,7 +320,7 @@ m_data = 0; EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } - m_rows = rows; + m_rows = nbRows; } inline const T *data() const { return m_data; } inline T *data() { return m_data; } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Diagonal.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Diagonal.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Diagonal.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Diagonal.h 2013-09-11 07:34:01.000000000 +0000 @@ -41,12 +41,12 @@ typedef typename remove_reference::type _MatrixTypeNested; typedef typename MatrixType::StorageKind StorageKind; enum { - RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic - : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), - MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), + RowsAtCompileTime = (int(DiagIndex) == DynamicIndex || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic + : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), + MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), ColsAtCompileTime = 1, MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic - : DiagIndex == Dynamic ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, + : DiagIndex == DynamicIndex ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) : (EIGEN_PLAIN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), @@ -61,20 +61,21 @@ }; } -template class Diagonal - : public internal::dense_xpr_base< Diagonal >::type +template class Diagonal + : public internal::dense_xpr_base< Diagonal >::type { public: + enum { DiagIndex = _DiagIndex }; typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) - inline Diagonal(MatrixType& matrix, Index index = DiagIndex) : m_matrix(matrix), m_index(index) {} + inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) inline Index rows() const - { return m_index.value()<0 ? (std::min)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min)(m_matrix.rows(),m_matrix.cols()-m_index.value()); } + { return m_index.value()<0 ? (std::min)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min)(m_matrix.rows(),m_matrix.cols()-m_index.value()); } inline Index cols() const { return 1; } @@ -113,20 +114,20 @@ return m_matrix.coeff(row+rowOffset(), row+colOffset()); } - inline Scalar& coeffRef(Index index) + inline Scalar& coeffRef(Index idx) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) - return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); } - inline const Scalar& coeffRef(Index index) const + inline const Scalar& coeffRef(Index idx) const { - return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); } - inline CoeffReturnType coeff(Index index) const + inline CoeffReturnType coeff(Index idx) const { - return m_matrix.coeff(index+rowOffset(), index+colOffset()); + return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); } const typename internal::remove_all::type& @@ -142,7 +143,7 @@ protected: typename MatrixType::Nested m_matrix; - const internal::variable_if_dynamic m_index; + const internal::variable_if_dynamicindex m_index; private: // some compilers may fail to optimize std::max etc in case of compile-time constants... @@ -171,7 +172,7 @@ /** This is the const version of diagonal(). */ template -inline const typename MatrixBase::ConstDiagonalReturnType +inline typename MatrixBase::ConstDiagonalReturnType MatrixBase::diagonal() const { return ConstDiagonalReturnType(derived()); @@ -189,18 +190,18 @@ * * \sa MatrixBase::diagonal(), class Diagonal */ template -inline typename MatrixBase::template DiagonalIndexReturnType::Type +inline typename MatrixBase::template DiagonalIndexReturnType::Type MatrixBase::diagonal(Index index) { - return typename DiagonalIndexReturnType::Type(derived(), index); + return typename DiagonalIndexReturnType::Type(derived(), index); } /** This is the const version of diagonal(Index). */ template -inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type MatrixBase::diagonal(Index index) const { - return typename ConstDiagonalIndexReturnType::Type(derived(), index); + return typename ConstDiagonalIndexReturnType::Type(derived(), index); } /** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DiagonalMatrix.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DiagonalMatrix.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DiagonalMatrix.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DiagonalMatrix.h 2013-09-11 07:34:01.000000000 +0000 @@ -56,9 +56,14 @@ inline Index rows() const { return diagonal().size(); } inline Index cols() const { return diagonal().size(); } + /** \returns the diagonal matrix product of \c *this by the matrix \a matrix. + */ template const DiagonalProduct - operator*(const MatrixBase &matrix) const; + operator*(const MatrixBase &matrix) const + { + return DiagonalProduct(matrix.derived(), derived()); + } inline const DiagonalWrapper, const DiagonalVectorType> > inverse() const @@ -250,7 +255,7 @@ #endif /** Constructor from expression of diagonal coefficients to wrap. */ - inline DiagonalWrapper(DiagonalVectorType& diagonal) : m_diagonal(diagonal) {} + inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} /** \returns a const reference to the wrapped expression of diagonal coefficients. */ const DiagonalVectorType& diagonal() const { return m_diagonal; } @@ -284,13 +289,14 @@ * \sa asDiagonal() */ template -bool MatrixBase::isDiagonal(RealScalar prec) const +bool MatrixBase::isDiagonal(const RealScalar& prec) const { + using std::abs; if(cols() != rows()) return false; RealScalar maxAbsOnDiagonal = static_cast(-1); for(Index j = 0; j < cols(); ++j) { - RealScalar absOnDiagonal = internal::abs(coeff(j,j)); + RealScalar absOnDiagonal = abs(coeff(j,j)); if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; } for(Index j = 0; j < cols(); ++j) diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DiagonalProduct.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DiagonalProduct.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/DiagonalProduct.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/DiagonalProduct.h 2013-09-11 07:34:01.000000000 +0000 @@ -26,14 +26,15 @@ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, _StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor, - _PacketOnDiag = !((int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) - ||(int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), + _ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft) + ||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)), _SameTypes = is_same::value, // FIXME currently we need same types, but in the future the next rule should be the one - //_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::Flags)&PacketAccessBit))), - _Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && ((!_PacketOnDiag) || (bool(int(DiagonalType::Flags)&PacketAccessBit))), + //_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))), + _Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))), + _LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ? LinearAccessBit : 0, - Flags = (HereditaryBits & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0), + Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0) | AlignedBit,//(int(MatrixType::Flags)&int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit), CoeffReadCost = NumTraits::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost }; }; @@ -54,13 +55,21 @@ eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols())); } - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } + EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } - const Scalar coeff(Index row, Index col) const + EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const { return m_diagonal.diagonal().coeff(ProductOrder == OnTheLeft ? row : col) * m_matrix.coeff(row, col); } + + EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const + { + enum { + StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor + }; + return coeff(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } template EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const @@ -69,11 +78,19 @@ StorageOrder = Flags & RowMajorBit ? RowMajor : ColMajor }; const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col; - return packet_impl(row,col,indexInDiagonalVector,typename internal::conditional< ((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type()); } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index idx) const + { + enum { + StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor + }; + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } protected: template @@ -88,7 +105,7 @@ { enum { InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, - DiagonalVectorPacketLoadMode = (LoadMode == Aligned && ((InnerSize%16) == 0)) ? Aligned : Unaligned + DiagonalVectorPacketLoadMode = (LoadMode == Aligned && (((InnerSize%16) == 0) || (int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit)==AlignedBit) ? Aligned : Unaligned) }; return internal::pmul(m_matrix.template packet(row, col), m_diagonal.diagonal().template packet(id)); @@ -103,19 +120,9 @@ template template inline const DiagonalProduct -MatrixBase::operator*(const DiagonalBase &diagonal) const -{ - return DiagonalProduct(derived(), diagonal.derived()); -} - -/** \returns the diagonal matrix product of \c *this by the matrix \a matrix. - */ -template -template -inline const DiagonalProduct -DiagonalBase::operator*(const MatrixBase &matrix) const +MatrixBase::operator*(const DiagonalBase &a_diagonal) const { - return DiagonalProduct(matrix.derived(), derived()); + return DiagonalProduct(derived(), a_diagonal.derived()); } } // end namespace Eigen diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Dot.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Dot.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Dot.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Dot.h 2013-09-11 07:34:01.000000000 +0000 @@ -112,7 +112,7 @@ template EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const { - return internal::real((*this).cwiseAbs2().sum()); + return numext::real((*this).cwiseAbs2().sum()); } /** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm. @@ -124,7 +124,8 @@ template inline typename NumTraits::Scalar>::Real MatrixBase::norm() const { - return internal::sqrt(squaredNorm()); + using std::sqrt; + return sqrt(squaredNorm()); } /** \returns an expression of the quotient of *this by its own norm. @@ -165,6 +166,7 @@ typedef typename NumTraits::Scalar>::Real RealScalar; static inline RealScalar run(const MatrixBase& m) { + using std::pow; return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); } }; @@ -223,11 +225,11 @@ template template bool MatrixBase::isOrthogonal -(const MatrixBase& other, RealScalar prec) const +(const MatrixBase& other, const RealScalar& prec) const { typename internal::nested::type nested(derived()); typename internal::nested::type otherNested(other.derived()); - return internal::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); + return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); } /** \returns true if *this is approximately an unitary matrix, @@ -242,7 +244,7 @@ * Output: \verbinclude MatrixBase_isUnitary.out */ template -bool MatrixBase::isUnitary(RealScalar prec) const +bool MatrixBase::isUnitary(const RealScalar& prec) const { typename Derived::Nested nested(derived()); for(Index i = 0; i < cols(); ++i) diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/EigenBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/EigenBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/EigenBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/EigenBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -139,7 +139,8 @@ return derived(); } -/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=() */ +/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=(). + */ template template inline void MatrixBase::applyOnTheRight(const EigenBase &other) diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Functors.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Functors.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Functors.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Functors.h 2013-09-11 07:34:01.000000000 +0000 @@ -154,6 +154,7 @@ { using std::max; using std::min; + using std::sqrt; Scalar p = (max)(_x, _y); Scalar q = (min)(_x, _y); Scalar qp = q/p; @@ -170,7 +171,7 @@ */ template struct scalar_binary_pow_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_binary_pow_op) - inline Scalar operator() (const Scalar& a, const OtherScalar& b) const { return internal::pow(a, b); } + inline Scalar operator() (const Scalar& a, const OtherScalar& b) const { return numext::pow(a, b); } }; template struct functor_traits > { @@ -204,21 +205,28 @@ * * \sa class CwiseBinaryOp, Cwise::operator/() */ -template struct scalar_quotient_op { +template struct scalar_quotient_op { + enum { + // TODO vectorize mixed product + Vectorizable = is_same::value && packet_traits::HasDiv && packet_traits::HasDiv + }; + typedef typename scalar_product_traits::ReturnType result_type; EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } + EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a / b; } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const { return internal::pdiv(a,b); } }; -template -struct functor_traits > { +template +struct functor_traits > { enum { - Cost = 2 * NumTraits::MulCost, - PacketAccess = packet_traits::HasDiv + Cost = (NumTraits::MulCost + NumTraits::MulCost), // rough estimate! + PacketAccess = scalar_quotient_op::Vectorizable }; }; + + /** \internal * \brief Template functor to compute the and of two booleans * @@ -280,7 +288,7 @@ template struct scalar_abs_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs(a); } + EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { using std::abs; return abs(a); } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pabs(a); } @@ -302,7 +310,7 @@ template struct scalar_abs2_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return internal::abs2(a); } + EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs2(a); } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pmul(a,a); } @@ -318,7 +326,7 @@ */ template struct scalar_conjugate_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return internal::conj(a); } + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { using numext::conj; return conj(a); } template EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); } }; @@ -355,7 +363,7 @@ struct scalar_real_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::real(a); } + EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::real(a); } }; template struct functor_traits > @@ -370,7 +378,7 @@ struct scalar_imag_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return internal::imag(a); } + EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::imag(a); } }; template struct functor_traits > @@ -385,7 +393,7 @@ struct scalar_real_ref_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::real_ref(*const_cast(&a)); } + EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::real_ref(*const_cast(&a)); } }; template struct functor_traits > @@ -400,7 +408,7 @@ struct scalar_imag_ref_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op) typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return internal::imag_ref(*const_cast(&a)); } + EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::imag_ref(*const_cast(&a)); } }; template struct functor_traits > @@ -414,7 +422,7 @@ */ template struct scalar_exp_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op) - inline const Scalar operator() (const Scalar& a) const { return internal::exp(a); } + inline const Scalar operator() (const Scalar& a) const { using std::exp; return exp(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::pexp(a); } }; @@ -430,7 +438,7 @@ */ template struct scalar_log_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op) - inline const Scalar operator() (const Scalar& a) const { return internal::log(a); } + inline const Scalar operator() (const Scalar& a) const { using std::log; return log(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::plog(a); } }; @@ -543,7 +551,7 @@ { typedef typename packet_traits::type Packet; - linspaced_op_impl(Scalar low, Scalar step) : + linspaced_op_impl(const Scalar& low, const Scalar& step) : m_low(low), m_step(step), m_packetStep(pset1(packet_traits::size*step)), m_base(padd(pset1(low), pmul(pset1(step),plset(-packet_traits::size)))) {} @@ -552,7 +560,7 @@ EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { m_base = padd(m_base, pset1(m_step)); - return m_low+i*m_step; + return m_low+Scalar(i)*m_step; } template @@ -572,7 +580,7 @@ { typedef typename packet_traits::type Packet; - linspaced_op_impl(Scalar low, Scalar step) : + linspaced_op_impl(const Scalar& low, const Scalar& step) : m_low(low), m_step(step), m_lowPacket(pset1(m_low)), m_stepPacket(pset1(m_step)), m_interPacket(plset(0)) {} @@ -601,7 +609,7 @@ template struct linspaced_op { typedef typename packet_traits::type Packet; - linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {} + linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {} template EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); } @@ -640,12 +648,14 @@ template struct functor_has_linear_access { enum { ret = 1 }; }; template struct functor_has_linear_access > { enum { ret = 0 }; }; -// in CwiseBinaryOp, we require the Lhs and Rhs to have the same scalar type, except for multiplication -// where we only require them to have the same _real_ scalar type so one may multiply, say, float by complex. +// In Eigen, any binary op (Product, CwiseBinaryOp) require the Lhs and Rhs to have the same scalar type, except for multiplication +// where the mixing of different types is handled by scalar_product_traits +// In particular, real * complex is allowed. // FIXME move this to functor_traits adding a functor_default -template struct functor_allows_mixing_real_and_complex { enum { ret = 0 }; }; -template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; -template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; +template struct functor_is_product_like { enum { ret = 0 }; }; +template struct functor_is_product_like > { enum { ret = 1 }; }; +template struct functor_is_product_like > { enum { ret = 1 }; }; +template struct functor_is_product_like > { enum { ret = 1 }; }; /** \internal @@ -674,7 +684,7 @@ */ template struct scalar_sqrt_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op) - inline const Scalar operator() (const Scalar& a) const { return internal::sqrt(a); } + inline const Scalar operator() (const Scalar& a) const { using std::sqrt; return sqrt(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); } }; @@ -692,7 +702,7 @@ */ template struct scalar_cos_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op) - inline Scalar operator() (const Scalar& a) const { return internal::cos(a); } + inline Scalar operator() (const Scalar& a) const { using std::cos; return cos(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::pcos(a); } }; @@ -711,7 +721,7 @@ */ template struct scalar_sin_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op) - inline const Scalar operator() (const Scalar& a) const { return internal::sin(a); } + inline const Scalar operator() (const Scalar& a) const { using std::sin; return sin(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::psin(a); } }; @@ -731,7 +741,7 @@ */ template struct scalar_tan_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op) - inline const Scalar operator() (const Scalar& a) const { return internal::tan(a); } + inline const Scalar operator() (const Scalar& a) const { using std::tan; return tan(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::ptan(a); } }; @@ -750,7 +760,7 @@ */ template struct scalar_acos_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op) - inline const Scalar operator() (const Scalar& a) const { return internal::acos(a); } + inline const Scalar operator() (const Scalar& a) const { using std::acos; return acos(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::pacos(a); } }; @@ -769,7 +779,7 @@ */ template struct scalar_asin_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op) - inline const Scalar operator() (const Scalar& a) const { return internal::asin(a); } + inline const Scalar operator() (const Scalar& a) const { using std::asin; return asin(a); } typedef typename packet_traits::type Packet; inline Packet packetOp(const Packet& a) const { return internal::pasin(a); } }; @@ -791,7 +801,7 @@ // FIXME default copy constructors seems bugged with std::complex<> inline scalar_pow_op(const scalar_pow_op& other) : m_exponent(other.m_exponent) { } inline scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} - inline Scalar operator() (const Scalar& a) const { return internal::pow(a, m_exponent); } + inline Scalar operator() (const Scalar& a) const { return numext::pow(a, m_exponent); } const Scalar m_exponent; }; template diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Fuzzy.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Fuzzy.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Fuzzy.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Fuzzy.h 2013-09-11 07:34:01.000000000 +0000 @@ -19,7 +19,7 @@ template::IsInteger> struct isApprox_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { using std::min; typename internal::nested::type nested(x); @@ -31,7 +31,7 @@ template struct isApprox_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) { return x.matrix() == y.matrix(); } @@ -40,16 +40,16 @@ template::IsInteger> struct isMuchSmallerThan_object_selector { - static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { - return x.cwiseAbs2().sum() <= abs2(prec) * y.cwiseAbs2().sum(); + return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum(); } }; template struct isMuchSmallerThan_object_selector { - static bool run(const Derived& x, const OtherDerived&, typename Derived::RealScalar) + static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -58,16 +58,16 @@ template::IsInteger> struct isMuchSmallerThan_scalar_selector { - static bool run(const Derived& x, const typename Derived::RealScalar& y, typename Derived::RealScalar prec) + static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) { - return x.cwiseAbs2().sum() <= abs2(prec * y); + return x.cwiseAbs2().sum() <= numext::abs2(prec * y); } }; template struct isMuchSmallerThan_scalar_selector { - static bool run(const Derived& x, const typename Derived::RealScalar&, typename Derived::RealScalar) + static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); } @@ -97,7 +97,7 @@ template bool DenseBase::isApprox( const DenseBase& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isApprox_selector::run(derived(), other.derived(), prec); @@ -119,7 +119,7 @@ template bool DenseBase::isMuchSmallerThan( const typename NumTraits::Real& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_scalar_selector::run(derived(), other, prec); @@ -139,7 +139,7 @@ template bool DenseBase::isMuchSmallerThan( const DenseBase& other, - RealScalar prec + const RealScalar& prec ) const { return internal::isMuchSmallerThan_object_selector::run(derived(), other.derived(), prec); diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GeneralProduct.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GeneralProduct.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GeneralProduct.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GeneralProduct.h 2013-09-11 07:34:01.000000000 +0000 @@ -222,7 +222,29 @@ ***********************************************************************/ namespace internal { -template struct outer_product_selector; + +// Column major +template +EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const false_type&) +{ + typedef typename Dest::Index Index; + // FIXME make sure lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dest.cols(); + for (Index j=0; j +EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const true_type&) { + typedef typename Dest::Index Index; + // FIXME make sure rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dest.rows(); + for (Index i=0; i struct traits > @@ -235,6 +257,8 @@ class GeneralProduct : public ProductBase, Lhs, Rhs> { + template struct IsRowMajor : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {}; + public: EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) @@ -243,41 +267,39 @@ EIGEN_STATIC_ASSERT((internal::is_same::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) } - - template void scaleAndAddTo(Dest& dest, Scalar alpha) const - { - internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha); + + struct set { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; + struct add { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; + struct sub { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; + struct adds { + Scalar m_scale; + adds(const Scalar& s) : m_scale(s) {} + template void operator()(const Dst& dst, const Src& src) const { + dst.const_cast_derived() += m_scale * src; + } + }; + + template + inline void evalTo(Dest& dest) const { + internal::outer_product_selector_run(*this, dest, set(), IsRowMajor()); + } + + template + inline void addTo(Dest& dest) const { + internal::outer_product_selector_run(*this, dest, add(), IsRowMajor()); } -}; - -namespace internal { -template<> struct outer_product_selector { - template - static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { - typedef typename Dest::Index Index; - // FIXME make sure lhs is sequentially stored - // FIXME not very good if rhs is real and lhs complex while alpha is real too - const Index cols = dest.cols(); - for (Index j=0; j + inline void subTo(Dest& dest) const { + internal::outer_product_selector_run(*this, dest, sub(), IsRowMajor()); + } -template<> struct outer_product_selector { - template - static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { - typedef typename Dest::Index Index; - // FIXME make sure rhs is sequentially stored - // FIXME not very good if lhs is real and rhs complex while alpha is real too - const Index rows = dest.rows(); - for (Index i=0; i void scaleAndAddTo(Dest& dest, const Scalar& alpha) const + { + internal::outer_product_selector_run(*this, dest, adds(alpha), IsRowMajor()); + } }; -} // end namespace internal - /*********************************************************************** * Implementation of General Matrix Vector Product ***********************************************************************/ @@ -311,7 +333,7 @@ typedef typename Lhs::Scalar LhsScalar; typedef typename Rhs::Scalar RhsScalar; - GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) + GeneralProduct(const Lhs& a_lhs, const Rhs& a_rhs) : Base(a_lhs,a_rhs) { // EIGEN_STATIC_ASSERT((internal::is_same::value), // YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) @@ -320,7 +342,7 @@ enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; typedef typename internal::conditional::type MatrixType; - template void scaleAndAddTo(Dest& dst, Scalar alpha) const + template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); internal::gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { Transpose destT(dest); enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; @@ -384,7 +406,7 @@ template<> struct gemv_selector { template - static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static inline void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename ProductType::Index Index; typedef typename ProductType::LhsScalar LhsScalar; @@ -413,7 +435,7 @@ gemv_static_vector_if static_dest; - bool alphaIsCompatible = (!ComplexByReal) || (imag(actualAlpha)==RealScalar(0)); + bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; RhsScalar compatibleAlpha = get_factor::run(actualAlpha); @@ -457,7 +479,7 @@ template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename ProductType::LhsScalar LhsScalar; typedef typename ProductType::RhsScalar RhsScalar; @@ -508,7 +530,7 @@ template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename Dest::Index Index; // TODO makes sure dest is sequentially stored in memory, otherwise use a temp @@ -521,7 +543,7 @@ template<> struct gemv_selector { template - static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) { typedef typename Dest::Index Index; // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GenericPacketMath.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GenericPacketMath.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GenericPacketMath.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GenericPacketMath.h 2013-09-11 07:34:01.000000000 +0000 @@ -106,7 +106,7 @@ /** \internal \returns conj(a) (coeff-wise) */ template inline Packet -pconj(const Packet& a) { return conj(a); } +pconj(const Packet& a) { return numext::conj(a); } /** \internal \returns a * b (coeff-wise) */ template inline Packet @@ -130,7 +130,7 @@ /** \internal \returns the absolute value of \a a */ template inline Packet -pabs(const Packet& a) { return abs(a); } +pabs(const Packet& a) { using std::abs; return abs(a); } /** \internal \returns the bitwise and of \a a and \a b */ template inline Packet @@ -156,7 +156,11 @@ template inline Packet ploadu(const typename unpacket_traits::type* from) { return *from; } -/** \internal \returns a packet with elements of \a *from duplicated, e.g.: (from[0],from[0],from[1],from[1]) */ +/** \internal \returns a packet with elements of \a *from duplicated. + * For instance, for a packet of 8 elements, 4 scalar will be read from \a *from and + * duplicated to form: {from[0],from[0],from[1],from[1],,from[2],from[2],,from[3],from[3]} + * Currently, this function is only used for scalar * complex products. + */ template inline Packet ploaddup(const typename unpacket_traits::type* from) { return *from; } @@ -215,7 +219,12 @@ /** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ template inline Packet pcplxflip(const Packet& a) -{ return Packet(imag(a),real(a)); } +{ + // FIXME: uncomment the following in case we drop the internal imag and real functions. +// using std::imag; +// using std::real; + return Packet(imag(a),real(a)); +} /************************** * Special math functions @@ -223,35 +232,35 @@ /** \internal \returns the sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psin(const Packet& a) { return sin(a); } +Packet psin(const Packet& a) { using std::sin; return sin(a); } /** \internal \returns the cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pcos(const Packet& a) { return cos(a); } +Packet pcos(const Packet& a) { using std::cos; return cos(a); } /** \internal \returns the tan of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet ptan(const Packet& a) { return tan(a); } +Packet ptan(const Packet& a) { using std::tan; return tan(a); } /** \internal \returns the arc sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pasin(const Packet& a) { return asin(a); } +Packet pasin(const Packet& a) { using std::asin; return asin(a); } /** \internal \returns the arc cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pacos(const Packet& a) { return acos(a); } +Packet pacos(const Packet& a) { using std::acos; return acos(a); } /** \internal \returns the exp of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pexp(const Packet& a) { return exp(a); } +Packet pexp(const Packet& a) { using std::exp; return exp(a); } /** \internal \returns the log of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet plog(const Packet& a) { return log(a); } +Packet plog(const Packet& a) { using std::log; return log(a); } /** \internal \returns the square-root of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psqrt(const Packet& a) { return sqrt(a); } +Packet psqrt(const Packet& a) { using std::sqrt; return sqrt(a); } /*************************************************************************** * The following functions might not have to be overwritten for vectorized types @@ -302,8 +311,21 @@ static inline void run(PacketType&, const PacketType&) {} }; -/** \internal update \a first using the concatenation of the \a Offset last elements - * of \a first and packet_size minus \a Offset first elements of \a second */ +/** \internal update \a first using the concatenation of the packet_size minus \a Offset last elements + * of \a first and \a Offset first elements of \a second. + * + * This function is currently only used to optimize matrix-vector products on unligned matrices. + * It takes 2 packets that represent a contiguous memory array, and returns a packet starting + * at the position \a Offset. For instance, for packets of 4 elements, we have: + * Input: + * - first = {f0,f1,f2,f3} + * - second = {s0,s1,s2,s3} + * Output: + * - if Offset==0 then {f0,f1,f2,f3} + * - if Offset==1 then {f1,f2,f3,s0} + * - if Offset==2 then {f2,f3,s0,s1} + * - if Offset==3 then {f3,s0,s1,s3} + */ template inline void palign(PacketType& first, const PacketType& second) { diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GlobalFunctions.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GlobalFunctions.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/GlobalFunctions.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/GlobalFunctions.h 2013-09-11 07:34:01.000000000 +0000 @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2010 Gael Guennebaud +// Copyright (C) 2010-2012 Gael Guennebaud // Copyright (C) 2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla @@ -11,7 +11,7 @@ #ifndef EIGEN_GLOBAL_FUNCTIONS_H #define EIGEN_GLOBAL_FUNCTIONS_H -#define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \ +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR) \ template \ inline const Eigen::CwiseUnaryOp, const Derived> \ NAME(const Eigen::ArrayBase& x) { \ @@ -35,20 +35,21 @@ }; -namespace std +namespace Eigen { - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op) - EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op) - + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op) + template inline const Eigen::CwiseUnaryOp, const Derived> pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { @@ -64,16 +65,13 @@ exponents.derived() ); } -} - -namespace Eigen -{ + /** * \brief Component-wise division of a scalar by array elements. **/ template inline const Eigen::CwiseUnaryOp, const Derived> - operator/(typename Derived::Scalar s, const Eigen::ArrayBase& a) + operator/(const typename Derived::Scalar& s, const Eigen::ArrayBase& a) { return Eigen::CwiseUnaryOp, const Derived>( a.derived(), @@ -85,19 +83,10 @@ { EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op) EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs,scalar_abs_op) EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op) - EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sqrt,scalar_sqrt_op) } } -// TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...) +// TODO: cleanly disable those functions that are not supported on Array (numext::real_ref, internal::random, internal::isApprox...) #endif // EIGEN_GLOBAL_FUNCTIONS_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/IO.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/IO.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/IO.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/IO.h 2013-09-11 07:34:01.000000000 +0000 @@ -55,9 +55,8 @@ const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", const std::string& _matPrefix="", const std::string& _matSuffix="") : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), - coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) + rowSpacer(""), coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) { - rowSpacer = ""; int i = int(matSuffix.length())-1; while (i>=0 && matSuffix[i]!='\n') { @@ -129,6 +128,7 @@ static inline int run() { using std::ceil; + using std::log; return cast(ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); } }; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Map.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Map.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Map.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Map.h 2013-09-11 07:34:01.000000000 +0000 @@ -133,36 +133,36 @@ /** Constructor in the fixed-size case. * - * \param data pointer to the array to map - * \param stride optional Stride object, passing the strides. + * \param dataPtr pointer to the array to map + * \param a_stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data)), m_stride(stride) + inline Map(PointerArgType dataPtr, const StrideType& a_stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr)), m_stride(a_stride) { PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size vector case. * - * \param data pointer to the array to map - * \param size the size of the vector expression - * \param stride optional Stride object, passing the strides. + * \param dataPtr pointer to the array to map + * \param a_size the size of the vector expression + * \param a_stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, Index size, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data), size), m_stride(stride) + inline Map(PointerArgType dataPtr, Index a_size, const StrideType& a_stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), a_size), m_stride(a_stride) { PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size matrix case. * - * \param data pointer to the array to map - * \param rows the number of rows of the matrix expression - * \param cols the number of columns of the matrix expression - * \param stride optional Stride object, passing the strides. + * \param dataPtr pointer to the array to map + * \param nbRows the number of rows of the matrix expression + * \param nbCols the number of columns of the matrix expression + * \param a_stride optional Stride object, passing the strides. */ - inline Map(PointerArgType data, Index rows, Index cols, const StrideType& stride = StrideType()) - : Base(cast_to_pointer_type(data), rows, cols), m_stride(stride) + inline Map(PointerArgType dataPtr, Index nbRows, Index nbCols, const StrideType& a_stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), nbRows, nbCols), m_stride(a_stride) { PlainObjectType::Base::_check_template_params(); } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MapBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MapBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MapBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MapBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -87,9 +87,9 @@ */ inline const Scalar* data() const { return m_data; } - inline const Scalar& coeff(Index row, Index col) const + inline const Scalar& coeff(Index rowId, Index colId) const { - return m_data[col * colStride() + row * rowStride()]; + return m_data[colId * colStride() + rowId * rowStride()]; } inline const Scalar& coeff(Index index) const @@ -98,9 +98,9 @@ return m_data[index * innerStride()]; } - inline const Scalar& coeffRef(Index row, Index col) const + inline const Scalar& coeffRef(Index rowId, Index colId) const { - return this->m_data[col * colStride() + row * rowStride()]; + return this->m_data[colId * colStride() + rowId * rowStride()]; } inline const Scalar& coeffRef(Index index) const @@ -110,10 +110,10 @@ } template - inline PacketScalar packet(Index row, Index col) const + inline PacketScalar packet(Index rowId, Index colId) const { return internal::ploadt - (m_data + (col * colStride() + row * rowStride())); + (m_data + (colId * colStride() + rowId * rowStride())); } template @@ -123,29 +123,29 @@ return internal::ploadt(m_data + index * innerStride()); } - inline MapBase(PointerType data) : m_data(data), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) + inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) checkSanity(); } - inline MapBase(PointerType data, Index size) - : m_data(data), - m_rows(RowsAtCompileTime == Dynamic ? size : Index(RowsAtCompileTime)), - m_cols(ColsAtCompileTime == Dynamic ? size : Index(ColsAtCompileTime)) + inline MapBase(PointerType dataPtr, Index vecSize) + : m_data(dataPtr), + m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)), + m_cols(ColsAtCompileTime == Dynamic ? vecSize : Index(ColsAtCompileTime)) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - eigen_assert(size >= 0); - eigen_assert(data == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); + eigen_assert(vecSize >= 0); + eigen_assert(dataPtr == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == vecSize); checkSanity(); } - inline MapBase(PointerType data, Index rows, Index cols) - : m_data(data), m_rows(rows), m_cols(cols) + inline MapBase(PointerType dataPtr, Index nbRows, Index nbCols) + : m_data(dataPtr), m_rows(nbRows), m_cols(nbCols) { - eigen_assert( (data == 0) - || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) - && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); + eigen_assert( (dataPtr == 0) + || ( nbRows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == nbRows) + && nbCols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == nbCols))); checkSanity(); } @@ -210,23 +210,23 @@ } template - inline void writePacket(Index row, Index col, const PacketScalar& x) + inline void writePacket(Index row, Index col, const PacketScalar& val) { internal::pstoret - (this->m_data + (col * colStride() + row * rowStride()), x); + (this->m_data + (col * colStride() + row * rowStride()), val); } template - inline void writePacket(Index index, const PacketScalar& x) + inline void writePacket(Index index, const PacketScalar& val) { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) internal::pstoret - (this->m_data + index * innerStride(), x); + (this->m_data + index * innerStride(), val); } - 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) {} + explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} + inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} + inline MapBase(PointerType dataPtr, Index nbRows, Index nbCols) : Base(dataPtr, nbRows, nbCols) {} Derived& operator=(const MapBase& other) { diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MathFunctions.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MathFunctions.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MathFunctions.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MathFunctions.h 2013-09-11 07:34:01.000000000 +0000 @@ -51,16 +51,15 @@ typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type; }; -#define EIGEN_MATHFUNC_IMPL(func, scalar) func##_impl::type> -#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename func##_retval::type>::type - +#define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl::type> +#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval::type>::type /**************************************************************************** * Implementation of real * ****************************************************************************/ -template -struct real_impl +template::IsComplex> +struct real_default_impl { typedef typename NumTraits::Real RealScalar; static inline RealScalar run(const Scalar& x) @@ -69,34 +68,32 @@ } }; -template -struct real_impl > +template +struct real_default_impl { - static inline RealScalar run(const std::complex& x) + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) { using std::real; return real(x); } }; +template struct real_impl : real_default_impl {}; + template struct real_retval { typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); -} /**************************************************************************** * Implementation of imag * ****************************************************************************/ -template -struct imag_impl +template::IsComplex> +struct imag_default_impl { typedef typename NumTraits::Real RealScalar; static inline RealScalar run(const Scalar&) @@ -105,28 +102,25 @@ } }; -template -struct imag_impl > +template +struct imag_default_impl { - static inline RealScalar run(const std::complex& x) + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) { using std::imag; return imag(x); } }; +template struct imag_impl : imag_default_impl {}; + template struct imag_retval { typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); -} - /**************************************************************************** * Implementation of real_ref * ****************************************************************************/ @@ -151,18 +145,6 @@ typedef typename NumTraits::Real & type; }; -template -inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) -{ - return real_ref_impl::run(x); -} - -template -inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); -} - /**************************************************************************** * Implementation of imag_ref * ****************************************************************************/ @@ -203,23 +185,11 @@ typedef typename NumTraits::Real & type; }; -template -inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) -{ - return imag_ref_impl::run(x); -} - -template -inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); -} - /**************************************************************************** * Implementation of conj * ****************************************************************************/ -template +template::IsComplex> struct conj_impl { static inline Scalar run(const Scalar& x) @@ -228,10 +198,10 @@ } }; -template -struct conj_impl > +template +struct conj_impl { - static inline std::complex run(const std::complex& x) + static inline Scalar run(const Scalar& x) { using std::conj; return conj(x); @@ -244,39 +214,6 @@ typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); -} - -/**************************************************************************** -* Implementation of abs * -****************************************************************************/ - -template -struct abs_impl -{ - typedef typename NumTraits::Real RealScalar; - static inline RealScalar run(const Scalar& x) - { - using std::abs; - return abs(x); - } -}; - -template -struct abs_retval -{ - typedef typename NumTraits::Real type; -}; - -template -inline EIGEN_MATHFUNC_RETVAL(abs, Scalar) abs(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(abs, Scalar)::run(x); -} - /**************************************************************************** * Implementation of abs2 * ****************************************************************************/ @@ -306,12 +243,6 @@ typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); -} - /**************************************************************************** * Implementation of norm1 * ****************************************************************************/ @@ -322,6 +253,7 @@ typedef typename NumTraits::Real RealScalar; static inline RealScalar run(const Scalar& x) { + using std::abs; return abs(real(x)) + abs(imag(x)); } }; @@ -331,6 +263,7 @@ { static inline Scalar run(const Scalar& x) { + using std::abs; return abs(x); } }; @@ -344,12 +277,6 @@ typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); -} - /**************************************************************************** * Implementation of hypot * ****************************************************************************/ @@ -362,9 +289,12 @@ { using std::max; using std::min; + using std::abs; + using std::sqrt; RealScalar _x = abs(x); RealScalar _y = abs(y); RealScalar p = (max)(_x, _y); + if(p==RealScalar(0)) return 0; RealScalar q = (min)(_x, _y); RealScalar qp = q/p; return p * sqrt(RealScalar(1) + qp*qp); @@ -377,12 +307,6 @@ typedef typename NumTraits::Real type; }; -template -inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) -{ - return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); -} - /**************************************************************************** * Implementation of cast * ****************************************************************************/ @@ -405,97 +329,29 @@ } /**************************************************************************** -* Implementation of sqrt * -****************************************************************************/ - -template -struct sqrt_default_impl -{ - static inline Scalar run(const Scalar& x) - { - using std::sqrt; - return sqrt(x); - } -}; - -template -struct sqrt_default_impl -{ - static inline Scalar run(const Scalar&) - { -#ifdef EIGEN2_SUPPORT - eigen_assert(!NumTraits::IsInteger); -#else - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) -#endif - return Scalar(0); - } -}; - -template -struct sqrt_impl : sqrt_default_impl::IsInteger> {}; - -template -struct sqrt_retval -{ - typedef Scalar type; -}; - -template -inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); -} - -/**************************************************************************** -* Implementation of standard unary real functions (exp, log, sin, cos, ... * -****************************************************************************/ - -// 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) { using std::NAME; return NAME(x); } \ - }; \ - template struct NAME##_default_impl { \ - static inline Scalar run(const Scalar&) { \ - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) \ - return Scalar(0); \ - } \ - }; \ - template struct NAME##_impl \ - : NAME##_default_impl::IsInteger> \ - {}; \ - template struct NAME##_retval { typedef Scalar type; }; \ - template \ - inline EIGEN_MATHFUNC_RETVAL(NAME, Scalar) NAME(const Scalar& x) { \ - return EIGEN_MATHFUNC_IMPL(NAME, Scalar)::run(x); \ - } - -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(exp) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(log) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(sin) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(cos) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(tan) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(asin) -EIGEN_MATHFUNC_STANDARD_REAL_UNARY(acos) - -/**************************************************************************** -* Implementation of atan2 * +* Implementation of atanh2 * ****************************************************************************/ template -struct atan2_default_impl +struct atanh2_default_impl { typedef Scalar retval; + typedef typename NumTraits::Real RealScalar; static inline Scalar run(const Scalar& x, const Scalar& y) { - using std::atan2; - return atan2(x, y); + using std::abs; + using std::log; + using std::sqrt; + Scalar z = x / y; + if (y == Scalar(0) || abs(z) > sqrt(NumTraits::epsilon())) + return RealScalar(0.5) * log((y + x) / (y - x)); + else + return z + z*z*z / RealScalar(3); } }; template -struct atan2_default_impl +struct atanh2_default_impl { static inline Scalar run(const Scalar&, const Scalar&) { @@ -505,20 +361,14 @@ }; template -struct atan2_impl : atan2_default_impl::IsInteger> {}; +struct atanh2_impl : atanh2_default_impl::IsInteger> {}; template -struct atan2_retval +struct atanh2_retval { typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(atan2, Scalar) atan2(const Scalar& x, const Scalar& y) -{ - return EIGEN_MATHFUNC_IMPL(atan2, Scalar)::run(x, y); -} - /**************************************************************************** * Implementation of pow * ****************************************************************************/ @@ -562,12 +412,6 @@ typedef Scalar type; }; -template -inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) -{ - return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); -} - /**************************************************************************** * Implementation of random * ****************************************************************************/ @@ -666,11 +510,10 @@ #else enum { rand_bits = floor_log2<(unsigned int)(RAND_MAX)+1>::value, scalar_bits = sizeof(Scalar) * CHAR_BIT, - shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)) + shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)), + offset = NumTraits::IsSigned ? (1 << (EIGEN_PLAIN_ENUM_MIN(rand_bits,scalar_bits)-1)) : 0 }; - Scalar x = Scalar(std::rand() >> shift); - Scalar offset = NumTraits::IsSigned ? Scalar(1 << (rand_bits-1)) : Scalar(0); - return x - offset; + return Scalar((std::rand() >> shift) - offset); #endif } }; @@ -702,6 +545,97 @@ return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); } +} // end namespace internal + +/**************************************************************************** +* Generic math function * +****************************************************************************/ + +namespace numext { + +template +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +template +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) +{ + return internal::real_ref_impl::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +template +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) +{ + return internal::imag_ref_impl::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); +} + +template +inline EIGEN_MATHFUNC_RETVAL(atanh2, Scalar) atanh2(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(atanh2, Scalar)::run(x, y); +} + +template +inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); +} + +// std::isfinite is non standard, so let's define our own version, +// even though it is not very efficient. +template bool (isfinite)(const T& x) +{ + return x::highest() && x>NumTraits::lowest(); +} + +} // end namespace numext + +namespace internal { + /**************************************************************************** * Implementation of fuzzy comparisons * ****************************************************************************/ @@ -718,11 +652,13 @@ template static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { + using std::abs; return abs(x) <= abs(y) * prec; } static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { using std::min; + using std::abs; return abs(x - y) <= (min)(abs(x), abs(y)) * prec; } static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) @@ -757,12 +693,12 @@ template static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { - return abs2(x) <= abs2(y) * prec * prec; + return numext::abs2(x) <= numext::abs2(y) * prec * prec; } static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { using std::min; - return abs2(x - y) <= (min)(abs2(x), abs2(y)) * prec * prec; + return numext::abs2(x - y) <= (min)(numext::abs2(x), numext::abs2(y)) * prec * prec; } }; @@ -824,17 +760,7 @@ }; -/**************************************************************************** -* Special functions * -****************************************************************************/ - -// std::isfinite is non standard, so let's define our own version, -// even though it is not very efficient. -template bool (isfinite)(const T& x) -{ - return x::highest() && x>NumTraits::lowest(); -} - + } // end namespace internal } // end namespace Eigen diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Matrix.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Matrix.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Matrix.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Matrix.h 2013-09-11 07:34:01.000000000 +0000 @@ -200,16 +200,16 @@ * * \sa resize(Index,Index) */ - EIGEN_STRONG_INLINE explicit Matrix() : Base() + EIGEN_STRONG_INLINE Matrix() : Base() { Base::_check_template_params(); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } // FIXME is it still needed Matrix(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) - { Base::_check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } + { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors * @@ -224,7 +224,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) eigen_assert(dim >= 0); eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MatrixBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MatrixBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/MatrixBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/MatrixBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -162,6 +162,9 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN template Derived& lazyAssign(const ProductBase& other); + + template + Derived& lazyAssign(const MatrixPowerProduct& other); #endif // not EIGEN_PARSED_BY_DOXYGEN template @@ -212,8 +215,8 @@ typedef Diagonal DiagonalReturnType; DiagonalReturnType diagonal(); - typedef const Diagonal ConstDiagonalReturnType; - const ConstDiagonalReturnType diagonal() const; + typedef typename internal::add_const >::type ConstDiagonalReturnType; + ConstDiagonalReturnType diagonal() const; template struct DiagonalIndexReturnType { typedef Diagonal Type; }; template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; @@ -224,11 +227,11 @@ // Note: The "MatrixBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. // On the other hand they confuse MSVC8... #if (defined _MSC_VER) && (_MSC_VER >= 1500) // 2008 or later - typename MatrixBase::template DiagonalIndexReturnType::Type diagonal(Index index); - typename MatrixBase::template ConstDiagonalIndexReturnType::Type diagonal(Index index) const; + typename MatrixBase::template DiagonalIndexReturnType::Type diagonal(Index index); + typename MatrixBase::template ConstDiagonalIndexReturnType::Type diagonal(Index index) const; #else - typename DiagonalIndexReturnType::Type diagonal(Index index); - typename ConstDiagonalIndexReturnType::Type diagonal(Index index) const; + typename DiagonalIndexReturnType::Type diagonal(Index index); + typename ConstDiagonalIndexReturnType::Type diagonal(Index index) const; #endif #ifdef EIGEN2_SUPPORT @@ -255,7 +258,7 @@ template typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; const SparseView sparseView(const Scalar& m_reference = Scalar(0), - typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) const; + const typename NumTraits::Real& m_epsilon = NumTraits::dummy_precision()) const; static const IdentityReturnType Identity(); static const IdentityReturnType Identity(Index rows, Index cols); static const BasisReturnType Unit(Index size, Index i); @@ -271,16 +274,16 @@ Derived& setIdentity(); Derived& setIdentity(Index rows, Index cols); - bool isIdentity(RealScalar prec = NumTraits::dummy_precision()) const; - bool isDiagonal(RealScalar prec = NumTraits::dummy_precision()) const; + bool isIdentity(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isDiagonal(const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isUpperTriangular(RealScalar prec = NumTraits::dummy_precision()) const; - bool isLowerTriangular(RealScalar prec = NumTraits::dummy_precision()) const; + bool isUpperTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isLowerTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; template bool isOrthogonal(const MatrixBase& other, - RealScalar prec = NumTraits::dummy_precision()) const; - bool isUnitary(RealScalar prec = NumTraits::dummy_precision()) const; + const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isUnitary(const RealScalar& prec = NumTraits::dummy_precision()) const; /** \returns true if each coefficients of \c *this and \a other are all exactly equal. * \warning When using floating point scalar values you probably should rather use a @@ -314,7 +317,7 @@ MatrixBase& matrix() { return *this; } const MatrixBase& matrix() const { return *this; } - /** \returns an \link ArrayBase Array \endlink expression of this matrix + /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix * \sa ArrayBase::matrix() */ ArrayWrapper array() { return derived(); } const ArrayWrapper array() const { return derived(); } @@ -454,6 +457,7 @@ const MatrixFunctionReturnValue sin() const; const MatrixSquareRootReturnValue sqrt() const; const MatrixLogarithmReturnValue log() const; + const MatrixPowerReturnValue pow(const RealScalar& p) const; #ifdef EIGEN2_SUPPORT template diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/NoAlias.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/NoAlias.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/NoAlias.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/NoAlias.h 2013-09-11 07:34:01.000000000 +0000 @@ -80,8 +80,17 @@ template EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct& other) { return m_expression.derived() -= CoeffBasedProduct(other.lhs(), other.rhs()); } + + template + ExpressionType& operator=(const ReturnByValue& func) + { return m_expression = func; } #endif + ExpressionType& expression() const + { + return m_expression; + } + protected: ExpressionType& m_expression; }; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/NumTraits.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/NumTraits.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/NumTraits.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/NumTraits.h 2013-09-11 07:34:01.000000000 +0000 @@ -140,6 +140,9 @@ AddCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::AddCost, MulCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::MulCost }; + + static inline RealScalar epsilon() { return NumTraits::epsilon(); } + static inline RealScalar dummy_precision() { return NumTraits::dummy_precision(); } }; } // end namespace Eigen diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/PermutationMatrix.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/PermutationMatrix.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/PermutationMatrix.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/PermutationMatrix.h 2013-09-11 07:34:01.000000000 +0000 @@ -139,9 +139,9 @@ /** Resizes to given size. */ - inline void resize(Index size) + inline void resize(Index newSize) { - indices().resize(size); + indices().resize(newSize); } /** Sets *this to be the identity permutation matrix */ @@ -153,9 +153,9 @@ /** Sets *this to be the identity permutation matrix of given size. */ - void setIdentity(Index size) + void setIdentity(Index newSize) { - resize(size); + resize(newSize); setIdentity(); } @@ -317,7 +317,7 @@ * array's size. */ template - explicit inline PermutationMatrix(const MatrixBase& indices) : m_indices(indices) + explicit inline PermutationMatrix(const MatrixBase& a_indices) : m_indices(a_indices) {} /** Convert the Transpositions \a tr to a permutation matrix */ @@ -406,12 +406,12 @@ typedef typename IndicesType::Scalar Index; #endif - inline Map(const Index* indices) - : m_indices(indices) + inline Map(const Index* indicesPtr) + : m_indices(indicesPtr) {} - inline Map(const Index* indices, Index size) - : m_indices(indices,size) + inline Map(const Index* indicesPtr, Index size) + : m_indices(indicesPtr,size) {} /** Copies the other permutation into *this */ @@ -490,8 +490,8 @@ typedef typename Traits::IndicesType IndicesType; #endif - inline PermutationWrapper(const IndicesType& indices) - : m_indices(indices) + inline PermutationWrapper(const IndicesType& a_indices) + : m_indices(a_indices) {} /** const version of indices(). */ @@ -541,24 +541,25 @@ : public ReturnByValue > { typedef typename remove_all::type MatrixTypeNestedCleaned; + typedef typename MatrixType::Index Index; permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) : m_permutation(perm), m_matrix(matrix) {} - inline int rows() const { return m_matrix.rows(); } - inline int cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } template inline void evalTo(Dest& dst) const { - const int n = Side==OnTheLeft ? rows() : cols(); + const Index n = Side==OnTheLeft ? rows() : cols(); if(is_same::value && extract_data(dst) == extract_data(m_matrix)) { // apply the permutation inplace Matrix mask(m_permutation.size()); mask.fill(false); - int r = 0; + Index r = 0; while(r < m_permutation.size()) { // search for the next seed @@ -566,10 +567,10 @@ if(r>=m_permutation.size()) break; // we got one, let's follow it until we are back to the seed - int k0 = r++; - int kPrev = k0; + Index k0 = r++; + Index kPrev = k0; mask.coeffRef(k0) = true; - for(int k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) + for(Index k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) { Block(dst, k) .swap(Block diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/PlainObjectBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/PlainObjectBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/PlainObjectBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/PlainObjectBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -11,28 +11,41 @@ #ifndef EIGEN_DENSESTORAGEBASE_H #define EIGEN_DENSESTORAGEBASE_H -#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO -# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED for(int i=0;i::quiet_NaN(); #else -# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +# undef EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #endif namespace Eigen { namespace internal { -template -EIGEN_ALWAYS_INLINE void check_rows_cols_for_overflow(Index rows, Index cols) -{ - // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 - // we assume Index is signed - Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed - bool error = (rows < 0 || cols < 0) ? true - : (rows == 0 || cols == 0) ? false - : (rows > max_index / cols); - if (error) - throw_std_bad_alloc(); -} +template struct check_rows_cols_for_overflow { + template + static EIGEN_ALWAYS_INLINE void run(Index, Index) + { + } +}; + +template<> struct check_rows_cols_for_overflow { + template + static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols) + { + // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 + // we assume Index is signed + Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed + bool error = (rows == 0 || cols == 0) ? false + : (rows > max_index / cols); + if (error) + throw_std_bad_alloc(); + } +}; template struct conservative_resize_like_impl; @@ -119,12 +132,12 @@ EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); } EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); } - EIGEN_STRONG_INLINE const Scalar& coeff(Index row, Index col) const + EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const @@ -132,12 +145,12 @@ return m_storage.data()[index]; } - EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId) { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) @@ -145,12 +158,12 @@ return m_storage.data()[index]; } - EIGEN_STRONG_INLINE const Scalar& coeffRef(Index row, Index col) const + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const { if(Flags & RowMajorBit) - return m_storage.data()[col + row * m_storage.cols()]; + return m_storage.data()[colId + rowId * m_storage.cols()]; else // column-major - return m_storage.data()[row + col * m_storage.rows()]; + return m_storage.data()[rowId + colId * m_storage.rows()]; } EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const @@ -160,12 +173,12 @@ /** \internal */ template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const { return internal::ploadt (m_storage.data() + (Flags & RowMajorBit - ? col + row * m_storage.cols() - : row + col * m_storage.rows())); + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows())); } /** \internal */ @@ -177,19 +190,19 @@ /** \internal */ template - EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketScalar& x) + EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) { internal::pstoret (m_storage.data() + (Flags & RowMajorBit - ? col + row * m_storage.cols() - : row + col * m_storage.rows()), x); + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows()), val); } /** \internal */ template - EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& x) + EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) { - internal::pstoret(m_storage.data() + index, x); + internal::pstoret(m_storage.data() + index, val); } /** \returns a const pointer to the data array of this matrix */ @@ -216,17 +229,22 @@ * * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) */ - EIGEN_STRONG_INLINE void resize(Index rows, Index cols) + EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols) { - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO - internal::check_rows_cols_for_overflow(rows, cols); - Index size = rows*cols; + eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,nbRows==RowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,nbCols==ColsAtCompileTime) + && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,nbRows<=MaxRowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,nbCols<=MaxColsAtCompileTime) + && nbRows>=0 && nbCols>=0 && "Invalid sizes when resizing a matrix or array."); + internal::check_rows_cols_for_overflow::run(nbRows, nbCols); + #ifdef EIGEN_INITIALIZE_COEFFS + Index size = nbRows*nbCols; bool size_changed = size != this->size(); - m_storage.resize(size, rows, cols); - if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + m_storage.resize(size, nbRows, nbCols); + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #else - internal::check_rows_cols_for_overflow(rows, cols); - m_storage.resize(rows*cols, rows, cols); + internal::check_rows_cols_for_overflow::run(nbRows, nbCols); + m_storage.resize(nbRows*nbCols, nbRows, nbCols); #endif } @@ -244,16 +262,16 @@ inline void resize(Index size) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO + eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0); + #ifdef EIGEN_INITIALIZE_COEFFS bool size_changed = size != this->size(); #endif if(RowsAtCompileTime == 1) m_storage.resize(size, 1, size); else m_storage.resize(size, size, 1); - #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO - if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + #ifdef EIGEN_INITIALIZE_COEFFS + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #endif } @@ -265,9 +283,9 @@ * * \sa resize(Index,Index) */ - inline void resize(NoChange_t, Index cols) + inline void resize(NoChange_t, Index nbCols) { - resize(rows(), cols); + resize(rows(), nbCols); } /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange @@ -278,9 +296,9 @@ * * \sa resize(Index,Index) */ - inline void resize(Index rows, NoChange_t) + inline void resize(Index nbRows, NoChange_t) { - resize(rows, cols()); + resize(nbRows, cols()); } /** Resizes \c *this to have the same dimensions as \a other. @@ -294,7 +312,7 @@ EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) { const OtherDerived& other = _other.derived(); - internal::check_rows_cols_for_overflow(other.rows(), other.cols()); + internal::check_rows_cols_for_overflow::run(other.rows(), other.cols()); const Index othersize = other.rows()*other.cols(); if(RowsAtCompileTime == 1) { @@ -318,9 +336,9 @@ * Matrices are resized relative to the top-left element. In case values need to be * appended to the matrix they will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) + EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, Index nbCols) { - internal::conservative_resize_like_impl::run(*this, rows, cols); + internal::conservative_resize_like_impl::run(*this, nbRows, nbCols); } /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. @@ -330,10 +348,10 @@ * * In case the matrix is growing, new rows will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) + EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, NoChange_t) { // Note: see the comment in conservativeResize(Index,Index) - conservativeResize(rows, cols()); + conservativeResize(nbRows, cols()); } /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. @@ -343,10 +361,10 @@ * * In case the matrix is growing, new columns will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) + EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index nbCols) { // Note: see the comment in conservativeResize(Index,Index) - conservativeResize(rows(), cols); + conservativeResize(rows(), nbCols); } /** Resizes the vector to \a size while retaining old values. @@ -400,10 +418,10 @@ return Base::operator=(func); } - EIGEN_STRONG_INLINE explicit PlainObjectBase() : m_storage() + EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() { // _check_template_params(); -// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -412,15 +430,15 @@ PlainObjectBase(internal::constructor_without_unaligned_array_assert) : m_storage(internal::constructor_without_unaligned_array_assert()) { -// _check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +// _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif - EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) - : m_storage(size, rows, cols) + EIGEN_STRONG_INLINE PlainObjectBase(Index a_size, Index nbRows, Index nbCols) + : m_storage(a_size, nbRows, nbCols) { // _check_template_params(); -// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } /** \copydoc MatrixBase::operator=(const EigenBase&) @@ -439,7 +457,7 @@ : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) { _check_template_params(); - internal::check_rows_cols_for_overflow(other.derived().rows(), other.derived().cols()); + internal::check_rows_cols_for_overflow::run(other.derived().rows(), other.derived().cols()); Base::operator=(other.derived()); } @@ -601,23 +619,19 @@ } template - EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) + EIGEN_STRONG_INLINE void _init2(Index nbRows, Index nbCols, typename internal::enable_if::type* = 0) { EIGEN_STATIC_ASSERT(bool(NumTraits::IsInteger) && bool(NumTraits::IsInteger), FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) - eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) - && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); - internal::check_rows_cols_for_overflow(rows, cols); - m_storage.resize(rows*cols,rows,cols); - EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + resize(nbRows,nbCols); } template - EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename internal::enable_if::type* = 0) + EIGEN_STRONG_INLINE void _init2(const Scalar& val0, const Scalar& val1, typename internal::enable_if::type* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) - m_storage.data()[0] = x; - m_storage.data()[1] = y; + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; } template @@ -666,7 +680,7 @@ if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns { - internal::check_rows_cols_for_overflow(rows, cols); + internal::check_rows_cols_for_overflow::run(rows, cols); _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); } else diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Product.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Product.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Product.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Product.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2011 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_PRODUCT_H -#define EIGEN_PRODUCT_H - -template class Product; -template class ProductImpl; - -/** \class Product - * \ingroup Core_Module - * - * \brief Expression of the product of two arbitrary matrices or vectors - * - * \param Lhs the type of the left-hand side expression - * \param Rhs the type of the right-hand side expression - * - * This class represents an expression of the product of two arbitrary matrices. - * - */ - -namespace internal { -template -struct traits > -{ - typedef MatrixXpr XprKind; - typedef typename remove_all::type LhsCleaned; - typedef typename remove_all::type RhsCleaned; - typedef typename scalar_product_traits::Scalar, typename traits::Scalar>::ReturnType Scalar; - typedef typename promote_storage_type::StorageKind, - typename traits::StorageKind>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; - enum { - RowsAtCompileTime = LhsCleaned::RowsAtCompileTime, - ColsAtCompileTime = RhsCleaned::ColsAtCompileTime, - MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime, - MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime, - Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0), // TODO should be no storage order - CoeffReadCost = 0 // TODO CoeffReadCost should not be part of the expression traits - }; -}; -} // end namespace internal - - -template -class Product : public ProductImpl::StorageKind, - typename internal::traits::StorageKind>::ret> -{ - public: - - typedef typename ProductImpl< - Lhs, Rhs, - typename internal::promote_storage_type::ret>::Base Base; - EIGEN_GENERIC_PUBLIC_INTERFACE(Product) - - typedef typename Lhs::Nested LhsNested; - typedef typename Rhs::Nested RhsNested; - typedef typename internal::remove_all::type LhsNestedCleaned; - typedef typename internal::remove_all::type RhsNestedCleaned; - - Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) - { - eigen_assert(lhs.cols() == rhs.rows() - && "invalid matrix product" - && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); - } - - inline Index rows() const { return m_lhs.rows(); } - inline Index cols() const { return m_rhs.cols(); } - - const LhsNestedCleaned& lhs() const { return m_lhs; } - const RhsNestedCleaned& rhs() const { return m_rhs; } - - protected: - - const LhsNested m_lhs; - const RhsNested m_rhs; -}; - -template -class ProductImpl : public internal::dense_xpr_base >::type -{ - typedef Product Derived; - public: - - typedef typename internal::dense_xpr_base >::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Derived) -}; - -#endif // EIGEN_PRODUCT_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ProductBase.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ProductBase.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ProductBase.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ProductBase.h 2013-09-11 07:34:01.000000000 +0000 @@ -87,10 +87,10 @@ typedef typename Base::PlainObject PlainObject; - ProductBase(const Lhs& lhs, const Rhs& rhs) - : m_lhs(lhs), m_rhs(rhs) + ProductBase(const Lhs& a_lhs, const Rhs& a_rhs) + : m_lhs(a_lhs), m_rhs(a_rhs) { - eigen_assert(lhs.cols() == rhs.rows() + eigen_assert(a_lhs.cols() == a_rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); } @@ -108,7 +108,7 @@ inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); } template - inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); } + inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); } const _LhsNested& lhs() const { return m_lhs; } const _RhsNested& rhs() const { return m_rhs; } @@ -195,25 +195,25 @@ // Also note that here we accept any compatible scalar types template const ScaledProduct -operator*(const ProductBase& prod, typename Derived::Scalar x) +operator*(const ProductBase& prod, const typename Derived::Scalar& x) { return ScaledProduct(prod.derived(), x); } template typename internal::enable_if::value, const ScaledProduct >::type -operator*(const ProductBase& prod, typename Derived::RealScalar x) +operator*(const ProductBase& prod, const typename Derived::RealScalar& x) { return ScaledProduct(prod.derived(), x); } template const ScaledProduct -operator*(typename Derived::Scalar x,const ProductBase& prod) +operator*(const typename Derived::Scalar& x,const ProductBase& prod) { return ScaledProduct(prod.derived(), x); } template typename internal::enable_if::value, const ScaledProduct >::type -operator*(typename Derived::RealScalar x,const ProductBase& prod) +operator*(const typename Derived::RealScalar& x,const ProductBase& prod) { return ScaledProduct(prod.derived(), x); } namespace internal { @@ -241,7 +241,7 @@ typedef typename Base::PlainObject PlainObject; // EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) - ScaledProduct(const NestedProduct& prod, Scalar x) + ScaledProduct(const NestedProduct& prod, const Scalar& x) : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} template @@ -254,7 +254,7 @@ inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); } template - inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { m_prod.derived().scaleAndAddTo(dst,alpha * m_alpha); } + inline void scaleAndAddTo(Dest& dst, const Scalar& a_alpha) const { m_prod.derived().scaleAndAddTo(dst,a_alpha * m_alpha); } const Scalar& alpha() const { return m_alpha; } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Random.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Random.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Random.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Random.h 2013-09-11 07:34:01.000000000 +0000 @@ -112,7 +112,7 @@ return *this = Random(rows(), cols()); } -/** Resizes to the given \a size, and sets all coefficients in this expression to random values. +/** Resizes to the given \a newSize, and sets all coefficients in this expression to random values. * * \only_for_vectors * @@ -123,16 +123,16 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setRandom(Index size) +PlainObjectBase::setRandom(Index newSize) { - resize(size); + resize(newSize); return setRandom(); } /** Resizes to the given size, and sets all coefficients in this expression to random values. * - * \param rows the new number of rows - * \param cols the new number of columns + * \param nbRows the new number of rows + * \param nbCols the new number of columns * * Example: \include Matrix_setRandom_int_int.cpp * Output: \verbinclude Matrix_setRandom_int_int.out @@ -141,9 +141,9 @@ */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setRandom(Index rows, Index cols) +PlainObjectBase::setRandom(Index nbRows, Index nbCols) { - resize(rows, cols); + resize(nbRows, nbCols); return setRandom(); } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Redux.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Redux.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Redux.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Redux.h 2013-09-11 07:34:01.000000000 +0000 @@ -330,7 +330,8 @@ ::run(derived(), func); } -/** \returns the minimum of all coefficients of *this +/** \returns the minimum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. */ template EIGEN_STRONG_INLINE typename internal::traits::Scalar @@ -339,7 +340,8 @@ return this->redux(Eigen::internal::scalar_min_op()); } -/** \returns the maximum of all coefficients of *this +/** \returns the maximum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. */ template EIGEN_STRONG_INLINE typename internal::traits::Scalar diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Ref.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Ref.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Ref.h 1970-01-01 00:00:00.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Ref.h 2013-09-11 07:34:01.000000000 +0000 @@ -0,0 +1,255 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REF_H +#define EIGEN_REF_H + +namespace Eigen { + +template class RefBase; +template,OuterStride<> >::type > class Ref; + +/** \class Ref + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing expressions + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam Options specifies whether the pointer is \c #Aligned, or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), + * but accept a variable outer stride (leading dimension). + * This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class permits to write non template functions taking Eigen's object as parameters while limiting the number of copies. + * A Ref<> object can represent either a const expression or a l-value: + * \code + * // in-out argument: + * void foo1(Ref x); + * + * // read-only const argument: + * void foo2(const Ref& x); + * \endcode + * + * In the in-out case, the input argument must satisfies the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. + * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. + * Likewise, a Ref can reference any column major dense matrix expression of float whose column's elements are contiguously stored with + * the possibility to have a constant space inbetween each column, i.e.: the inner stride mmust be equal to 1, but the outer-stride (or leading dimension), + * can be greater than the number of rows. + * + * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. + * Here are some examples: + * \code + * MatrixXf A; + * VectorXf a; + * foo1(a.head()); // OK + * foo1(A.col()); // OK + * foo1(A.row()); // compilation error because here innerstride!=1 + * foo2(A.row()); // The row is copied into a contiguous temporary + * foo2(2*a); // The expression is evaluated into a temporary + * foo2(A.col().segment(2,4)); // No temporary + * \endcode + * + * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameter. + * Here is an example accepting an innerstride!=1: + * \code + * // in-out argument: + * void foo3(Ref > x); + * foo3(A.row()); // OK + * \endcode + * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involved more + * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overloads internally calling a + * template function, e.g.: + * \code + * // in the .h: + * void foo(const Ref& A); + * void foo(const Ref >& A); + * + * // in the .cpp: + * template void foo_impl(const TypeOfA& A) { + * ... // crazy code goes here + * } + * void foo(const Ref& A) { foo_impl(A); } + * void foo(const Ref >& A) { foo_impl(A); } + * \endcode + * + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ + +namespace internal { + +template +struct traits > + : public traits > +{ + typedef _PlainObjectType PlainObjectType; + typedef _StrideType StrideType; + enum { + Options = _Options + }; + + template struct match { + enum { + HasDirectAccess = internal::has_direct_access::ret, + StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), + InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) + || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) + || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), + OuterStrideMatch = Derived::IsVectorAtCompileTime + || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), + AlignmentMatch = (_Options!=Aligned) || ((PlainObjectType::Flags&AlignedBit)==0) || ((traits::Flags&AlignedBit)==AlignedBit), + MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch + }; + typedef typename internal::conditional::type type; + }; + +}; + +template +struct traits > : public traits {}; + +} + +template class RefBase + : public MapBase +{ + typedef typename internal::traits::PlainObjectType PlainObjectType; + typedef typename internal::traits::StrideType StrideType; + +public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) + + inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + RefBase() + : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), + // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: + m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, + StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) + {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) + +protected: + + typedef Stride StrideBase; + + template + void construct(Expression& expr) + { + if(PlainObjectType::RowsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + ::new (static_cast(this)) Base(expr.data(), 1, expr.size()); + } + else if(PlainObjectType::ColsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + ::new (static_cast(this)) Base(expr.data(), expr.size(), 1); + } + else + ::new (static_cast(this)) Base(expr.data(), expr.rows(), expr.cols()); + ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(), + StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride()); + } + + StrideBase m_stride; +}; + + +template class Ref + : public RefBase > +{ + typedef internal::traits Traits; + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + inline Ref(PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + { + Base::construct(expr); + } + template + inline Ref(const DenseBase& expr, + typename internal::enable_if::value&&bool(Traits::template match::MatchAtCompileTime)),Derived>::type* = 0, + int = Derived::ThisConstantIsPrivateInPlainObjectBase) + #else + template + inline Ref(DenseBase& expr) + #endif + { + Base::construct(expr.const_cast_derived()); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) + +}; + +// this is the const ref version +template class Ref + : public RefBase > +{ + typedef internal::traits Traits; + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + template + inline Ref(const DenseBase& expr) + { +// std::cout << match_helper::HasDirectAccess << "," << match_helper::OuterStrideMatch << "," << match_helper::InnerStrideMatch << "\n"; +// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; +// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; + construct(expr.derived(), typename Traits::template match::type()); + } + + protected: + + template + void construct(const Expression& expr,internal::true_type) + { + Base::construct(expr); + } + + template + void construct(const Expression& expr, internal::false_type) + { + m_object.lazyAssign(expr); + Base::construct(m_object); + } + + protected: + TPlainObjectType m_object; +}; + +} // end namespace Eigen + +#endif // EIGEN_REF_H diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Replicate.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Replicate.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Replicate.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Replicate.h 2013-09-11 07:34:01.000000000 +0000 @@ -70,8 +70,8 @@ EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) template - inline explicit Replicate(const OriginalMatrixType& matrix) - : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) + inline explicit Replicate(const OriginalMatrixType& a_matrix) + : m_matrix(a_matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) { EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) @@ -79,8 +79,8 @@ } template - inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) - : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) + inline Replicate(const OriginalMatrixType& a_matrix, Index rowFactor, Index colFactor) + : m_matrix(a_matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) { EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) @@ -89,27 +89,27 @@ inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } - inline Scalar coeff(Index row, Index col) const + inline Scalar coeff(Index rowId, Index colId) const { // try to avoid using modulo; this is a pure optimization strategy const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? row - : row%m_matrix.rows(); + : RowFactor==1 ? rowId + : rowId%m_matrix.rows(); const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? col - : col%m_matrix.cols(); + : ColFactor==1 ? colId + : colId%m_matrix.cols(); return m_matrix.coeff(actual_row, actual_col); } template - inline PacketScalar packet(Index row, Index col) const + inline PacketScalar packet(Index rowId, Index colId) const { const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? row - : row%m_matrix.rows(); + : RowFactor==1 ? rowId + : rowId%m_matrix.rows(); const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? col - : col%m_matrix.cols(); + : ColFactor==1 ? colId + : colId%m_matrix.cols(); return m_matrix.template packet(actual_row, actual_col); } diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ReturnByValue.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ReturnByValue.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/ReturnByValue.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/ReturnByValue.h 2013-09-11 07:34:01.000000000 +0000 @@ -48,7 +48,7 @@ } // end namespace internal template class ReturnByValue - : public internal::dense_xpr_base< ReturnByValue >::type + : internal::no_assignment_operator, public internal::dense_xpr_base< ReturnByValue >::type { public: typedef typename internal::traits::ReturnType ReturnType; diff -Nru eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Select.h eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Select.h --- eigen3-3.1.2+6+10~precise1/Eigen/src/Core/Select.h 2013-04-16 21:42:46.000000000 +0000 +++ eigen3-3.2.0+7+11~ubuntu12.04.1/Eigen/src/Core/Select.h 2013-09-11 07:34:01.000000000 +0000 @@ -60,10 +60,10 @@ typedef typename internal::dense_xpr_base