aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-11-04 08:32:52 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-11-04 08:32:52 +0100
commit62a51184d76e120c7c0484117db8c779a2c42c93 (patch)
tree8bb3607b8408cd599ef4a0917797a154246aa7fc
parentfd88d721d2327e92a8c6c156dde266967dfb0d91 (diff)
parent1eea88bff71860ed6662a87f17df5eacd1917dfb (diff)
merge
-rw-r--r--CMakeLists.txt35
-rw-r--r--Eigen/Core6
-rw-r--r--Eigen/Eigen2Support22
-rw-r--r--Eigen/QtAlignedMalloc8
-rw-r--r--Eigen/SVD1
-rw-r--r--Eigen/src/Cholesky/LDLT.h72
-rw-r--r--Eigen/src/Cholesky/LLT.h60
-rw-r--r--Eigen/src/Core/Array.h20
-rw-r--r--Eigen/src/Core/ArrayBase.h38
-rw-r--r--Eigen/src/Core/ArrayWrapper.h17
-rw-r--r--Eigen/src/Core/Assign.h154
-rw-r--r--Eigen/src/Core/BandMatrix.h35
-rw-r--r--Eigen/src/Core/Block.h71
-rw-r--r--Eigen/src/Core/BooleanRedux.h24
-rw-r--r--Eigen/src/Core/CommaInitializer.h14
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h77
-rw-r--r--Eigen/src/Core/CwiseNullaryOp.h77
-rw-r--r--Eigen/src/Core/CwiseUnaryOp.h29
-rw-r--r--Eigen/src/Core/CwiseUnaryView.h41
-rw-r--r--Eigen/src/Core/DenseBase.h88
-rw-r--r--Eigen/src/Core/DenseCoeffsBase.h112
-rw-r--r--Eigen/src/Core/DenseStorage.h (renamed from Eigen/src/Core/MatrixStorage.h)152
-rw-r--r--Eigen/src/Core/Diagonal.h19
-rw-r--r--Eigen/src/Core/DiagonalMatrix.h40
-rw-r--r--Eigen/src/Core/DiagonalProduct.h28
-rw-r--r--Eigen/src/Core/Dot.h74
-rw-r--r--Eigen/src/Core/EigenBase.h6
-rw-r--r--Eigen/src/Core/Flagged.h9
-rw-r--r--Eigen/src/Core/ForceAlignedAccess.h13
-rw-r--r--Eigen/src/Core/Functors.h544
-rw-r--r--Eigen/src/Core/Fuzzy.h147
-rw-r--r--Eigen/src/Core/GenericPacketMath.h108
-rw-r--r--Eigen/src/Core/GlobalFunctions.h45
-rw-r--r--Eigen/src/Core/IO.h27
-rw-r--r--Eigen/src/Core/Map.h9
-rw-r--r--Eigen/src/Core/MapBase.h44
-rw-r--r--Eigen/src/Core/MathFunctions.h298
-rw-r--r--Eigen/src/Core/Matrix.h23
-rw-r--r--Eigen/src/Core/MatrixBase.h58
-rw-r--r--Eigen/src/Core/NestByValue.h9
-rw-r--r--Eigen/src/Core/NoAlias.h18
-rw-r--r--Eigen/src/Core/NumTraits.h8
-rw-r--r--Eigen/src/Core/PermutationMatrix.h57
-rw-r--r--Eigen/src/Core/PlainObjectBase.h (renamed from Eigen/src/Core/DenseStorageBase.h)95
-rw-r--r--Eigen/src/Core/Product.h171
-rw-r--r--Eigen/src/Core/ProductBase.h60
-rw-r--r--Eigen/src/Core/Random.h29
-rw-r--r--Eigen/src/Core/Redux.h118
-rw-r--r--Eigen/src/Core/Replicate.h37
-rw-r--r--Eigen/src/Core/ReturnByValue.h25
-rw-r--r--Eigen/src/Core/Reverse.h40
-rw-r--r--Eigen/src/Core/Select.h26
-rw-r--r--Eigen/src/Core/SelfAdjointView.h53
-rw-r--r--Eigen/src/Core/SelfCwiseBinaryOp.h39
-rw-r--r--Eigen/src/Core/SolveTriangular.h70
-rw-r--r--Eigen/src/Core/StableNorm.h48
-rw-r--r--Eigen/src/Core/Stride.h8
-rw-r--r--Eigen/src/Core/Swap.h18
-rw-r--r--Eigen/src/Core/Transpose.h96
-rw-r--r--Eigen/src/Core/Transpositions.h37
-rw-r--r--Eigen/src/Core/TriangularMatrix.h120
-rw-r--r--Eigen/src/Core/VectorBlock.h21
-rw-r--r--Eigen/src/Core/VectorwiseOp.h102
-rw-r--r--Eigen/src/Core/Visitor.h47
-rw-r--r--Eigen/src/Core/arch/AltiVec/Complex.h124
-rw-r--r--Eigen/src/Core/arch/AltiVec/PacketMath.h189
-rw-r--r--Eigen/src/Core/arch/NEON/Complex.h92
-rw-r--r--Eigen/src/Core/arch/NEON/PacketMath.h141
-rw-r--r--Eigen/src/Core/arch/SSE/Complex.h248
-rw-r--r--Eigen/src/Core/arch/SSE/MathFunctions.h226
-rw-r--r--Eigen/src/Core/arch/SSE/PacketMath.h312
-rw-r--r--Eigen/src/Core/products/CoeffBasedProduct.h146
-rw-r--r--Eigen/src/Core/products/GeneralBlockPanelKernel.h406
-rw-r--r--Eigen/src/Core/products/GeneralMatrixMatrix.h119
-rw-r--r--Eigen/src/Core/products/GeneralMatrixVector.h222
-rw-r--r--Eigen/src/Core/products/Parallelizer.h20
-rw-r--r--Eigen/src/Core/products/SelfadjointMatrixMatrix.h104
-rw-r--r--Eigen/src/Core/products/SelfadjointMatrixVector.h72
-rw-r--r--Eigen/src/Core/products/SelfadjointProduct.h87
-rw-r--r--Eigen/src/Core/products/SelfadjointRank2Update.h39
-rw-r--r--Eigen/src/Core/products/TriangularMatrixMatrix.h63
-rw-r--r--Eigen/src/Core/products/TriangularMatrixVector.h54
-rw-r--r--Eigen/src/Core/products/TriangularSolverMatrix.h42
-rw-r--r--Eigen/src/Core/util/BlasUtil.h124
-rw-r--r--Eigen/src/Core/util/Constants.h34
-rw-r--r--Eigen/src/Core/util/ForwardDeclarations.h122
-rw-r--r--Eigen/src/Core/util/Macros.h56
-rw-r--r--Eigen/src/Core/util/Memory.h215
-rw-r--r--Eigen/src/Core/util/Meta.h188
-rw-r--r--Eigen/src/Core/util/StaticAssert.h18
-rw-r--r--Eigen/src/Core/util/XprHelper.h289
-rw-r--r--Eigen/src/Eigen2Support/Block.h8
-rw-r--r--Eigen/src/Eigen2Support/Cwise.h42
-rw-r--r--Eigen/src/Eigen2Support/CwiseOperators.h38
-rw-r--r--Eigen/src/Eigen2Support/Minor.h13
-rw-r--r--Eigen/src/Eigen2Support/Transform.h37
-rw-r--r--Eigen/src/Eigenvalues/ComplexEigenSolver.h10
-rw-r--r--Eigen/src/Eigenvalues/ComplexSchur.h63
-rw-r--r--Eigen/src/Eigenvalues/EigenSolver.h58
-rw-r--r--Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h4
-rw-r--r--Eigen/src/Eigenvalues/HessenbergDecomposition.h14
-rw-r--r--Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h14
-rw-r--r--Eigen/src/Eigenvalues/RealSchur.h26
-rw-r--r--Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h44
-rw-r--r--Eigen/src/Eigenvalues/Tridiagonalization.h68
-rw-r--r--Eigen/src/Geometry/AlignedBox.h30
-rw-r--r--Eigen/src/Geometry/AngleAxis.h23
-rw-r--r--Eigen/src/Geometry/EulerAngles.h16
-rw-r--r--Eigen/src/Geometry/Homogeneous.h73
-rw-r--r--Eigen/src/Geometry/Hyperplane.h12
-rw-r--r--Eigen/src/Geometry/OrthoMethods.h72
-rw-r--r--Eigen/src/Geometry/ParametrizedLine.h6
-rw-r--r--Eigen/src/Geometry/Quaternion.h87
-rw-r--r--Eigen/src/Geometry/Rotation2D.h18
-rw-r--r--Eigen/src/Geometry/RotationBase.h32
-rw-r--r--Eigen/src/Geometry/Scaling.h4
-rw-r--r--Eigen/src/Geometry/Transform.h146
-rw-r--r--Eigen/src/Geometry/Translation.h8
-rw-r--r--Eigen/src/Geometry/Umeyama.h59
-rw-r--r--Eigen/src/Geometry/arch/Geometry_SSE.h59
-rw-r--r--Eigen/src/Householder/BlockHouseholder.h11
-rw-r--r--Eigen/src/Householder/Householder.h20
-rw-r--r--Eigen/src/Householder/HouseholderSequence.h62
-rw-r--r--Eigen/src/Jacobi/Jacobi.h209
-rw-r--r--Eigen/src/LU/Determinant.h54
-rw-r--r--Eigen/src/LU/FullPivLU.h91
-rw-r--r--Eigen/src/LU/Inverse.h152
-rw-r--r--Eigen/src/LU/PartialPivLU.h56
-rw-r--r--Eigen/src/LU/arch/Inverse_SSE.h8
-rw-r--r--Eigen/src/QR/ColPivHouseholderQR.h68
-rw-r--r--Eigen/src/QR/FullPivHouseholderQR.h64
-rw-r--r--Eigen/src/QR/HouseholderQR.h80
-rw-r--r--Eigen/src/SVD/JacobiSVD.h534
-rw-r--r--Eigen/src/SVD/SVD.h604
-rw-r--r--Eigen/src/SVD/UpperBidiagonalization.h10
-rw-r--r--Eigen/src/Sparse/AmbiVector.h16
-rw-r--r--Eigen/src/Sparse/CompressedStorage.h2
-rw-r--r--Eigen/src/Sparse/CoreIterators.h1
-rw-r--r--Eigen/src/Sparse/DynamicSparseMatrix.h28
-rw-r--r--Eigen/src/Sparse/MappedSparseMatrix.h10
-rw-r--r--Eigen/src/Sparse/SparseBlock.h48
-rw-r--r--Eigen/src/Sparse/SparseCwiseBinaryOp.h85
-rw-r--r--Eigen/src/Sparse/SparseCwiseUnaryOp.h16
-rw-r--r--Eigen/src/Sparse/SparseDenseProduct.h46
-rw-r--r--Eigen/src/Sparse/SparseDiagonalProduct.h71
-rw-r--r--Eigen/src/Sparse/SparseDot.h26
-rw-r--r--Eigen/src/Sparse/SparseFuzzy.h4
-rw-r--r--Eigen/src/Sparse/SparseMatrix.h64
-rw-r--r--Eigen/src/Sparse/SparseMatrixBase.h103
-rw-r--r--Eigen/src/Sparse/SparseProduct.h35
-rw-r--r--Eigen/src/Sparse/SparseRedux.h12
-rw-r--r--Eigen/src/Sparse/SparseSelfAdjointView.h34
-rw-r--r--Eigen/src/Sparse/SparseSparseProduct.h118
-rw-r--r--Eigen/src/Sparse/SparseTranspose.h2
-rw-r--r--Eigen/src/Sparse/SparseTriangularView.h24
-rw-r--r--Eigen/src/Sparse/SparseUtil.h36
-rw-r--r--Eigen/src/Sparse/SparseVector.h37
-rw-r--r--Eigen/src/Sparse/SparseView.h12
-rw-r--r--Eigen/src/Sparse/TriangularSolver.h76
-rw-r--r--Eigen/src/StlSupport/StdVector.h12
-rw-r--r--Eigen/src/StlSupport/details.h88
-rw-r--r--Eigen/src/misc/Image.h22
-rw-r--r--Eigen/src/misc/Kernel.h22
-rw-r--r--Eigen/src/misc/Solve.h24
-rw-r--r--Eigen/src/plugins/ArrayCwiseBinaryOps.h18
-rw-r--r--Eigen/src/plugins/ArrayCwiseUnaryOps.h26
-rw-r--r--Eigen/src/plugins/BlockMethods.h12
-rw-r--r--Eigen/src/plugins/CommonCwiseBinaryOps.h4
-rw-r--r--Eigen/src/plugins/CommonCwiseUnaryOps.h48
-rw-r--r--Eigen/src/plugins/MatrixCwiseBinaryOps.h12
-rw-r--r--Eigen/src/plugins/MatrixCwiseUnaryOps.h8
-rw-r--r--bench/BenchSparseUtil.h8
-rw-r--r--bench/benchBlasGemm.cpp6
-rw-r--r--bench/benchCholesky.cpp4
-rw-r--r--bench/benchEigenSolver.cpp4
-rw-r--r--bench/benchVecAdd.cpp70
-rw-r--r--bench/bench_gemm.cpp6
-rw-r--r--bench/bench_norm.cpp118
-rw-r--r--bench/bench_reverse.cpp4
-rw-r--r--bench/benchmarkSlice.cpp8
-rw-r--r--bench/btl/libs/eigen2/eigen2_interface.hh16
-rwxr-xr-xbench/btl/libs/hand_vec/hand_vec_interface.hh534
-rw-r--r--bench/check_cache_queries.cpp12
-rw-r--r--bench/eig33.cpp10
-rw-r--r--bench/quat_slerp.cpp20
-rw-r--r--bench/quatmul.cpp2
-rw-r--r--bench/sparse_cholesky.cpp6
-rw-r--r--bench/sparse_randomsetter.cpp10
-rw-r--r--bench/sparse_setter.cpp10
-rw-r--r--bench/sparse_trisolver.cpp4
-rw-r--r--blas/level1_impl.h38
-rw-r--r--blas/level2_impl.h56
-rw-r--r--blas/level3_impl.h162
-rw-r--r--cmake/EigenTesting.cmake18
-rw-r--r--cmake/FindGLEW.cmake105
-rw-r--r--cmake/FindGSL.cmake1
-rw-r--r--debug/msvc/eigen_autoexp_part.dat79
-rw-r--r--demos/mandelbrot/mandelbrot.cpp6
-rw-r--r--demos/opengl/gpuhelper.h8
-rw-r--r--demos/opengl/quaternion_demo.cpp2
-rw-r--r--demos/opengl/trackball.cpp2
-rw-r--r--doc/A05_PortingFrom2To3.dox120
-rw-r--r--doc/C00_QuickStartGuide.dox11
-rw-r--r--doc/C01_TutorialMatrixClass.dox62
-rw-r--r--doc/C02_TutorialMatrixArithmetic.dox72
-rw-r--r--doc/C03_TutorialArrayClass.dox54
-rw-r--r--doc/C04_TutorialBlockOperations.dox112
-rw-r--r--doc/C05_TutorialAdvancedInitialization.dox87
-rw-r--r--doc/C06_TutorialLinearAlgebra.dox83
-rw-r--r--doc/C07_TutorialReductionsVisitorsBroadcasting.dox112
-rw-r--r--doc/C08_TutorialGeometry.dox46
-rw-r--r--doc/C09_TutorialSparse.dox12
-rw-r--r--doc/D11_UnalignedArrayAssert.dox4
-rw-r--r--doc/I00_CustomizingEigen.dox36
-rw-r--r--doc/I02_HiPerformance.dox16
-rw-r--r--doc/I03_InsideEigenExample.dox130
-rw-r--r--doc/I11_Aliasing.dox46
-rw-r--r--doc/I12_ClassHierarchy.dox14
-rw-r--r--doc/I13_FunctionsTakingEigenTypes.dox39
-rw-r--r--doc/QuickReference.dox100
-rw-r--r--doc/TopicLinearAlgebraDecompositions.dox65
-rw-r--r--doc/eigendoxy.css817
-rw-r--r--doc/eigendoxy_footer.html.in6
-rw-r--r--doc/eigendoxy_header.html.in18
-rw-r--r--doc/eigendoxy_tabs.css128
-rw-r--r--doc/examples/TutorialLinAlgSVDSolve.cpp15
-rw-r--r--doc/examples/Tutorial_BlockOperations_block_assignment.cpp18
-rw-r--r--doc/examples/Tutorial_BlockOperations_colrow.cpp11
-rw-r--r--doc/examples/Tutorial_BlockOperations_print_block.cpp12
-rw-r--r--doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp22
-rw-r--r--doc/snippets/JacobiSVD_basic.cpp9
-rw-r--r--doc/snippets/Jacobi_makeGivens.cpp2
-rw-r--r--doc/snippets/Jacobi_makeJacobi.cpp2
-rw-r--r--doc/snippets/Tridiagonalization_decomposeInPlace.cpp2
-rw-r--r--test/CMakeLists.txt15
-rw-r--r--test/adjoint.cpp28
-rw-r--r--test/array.cpp46
-rw-r--r--test/array_for_matrix.cpp18
-rw-r--r--test/array_replicate.cpp4
-rw-r--r--test/array_reverse.cpp6
-rw-r--r--test/bandmatrix.cpp8
-rw-r--r--test/basicstuff.cpp32
-rw-r--r--test/block.cpp32
-rw-r--r--test/cholesky.cpp10
-rw-r--r--test/conservative_resize.cpp12
-rw-r--r--test/corners.cpp12
-rw-r--r--test/cwiseop.cpp6
-rw-r--r--test/determinant.cpp8
-rw-r--r--test/diagonalmatrices.cpp4
-rw-r--r--test/dynalloc.cpp12
-rw-r--r--test/eigen2support.cpp4
-rw-r--r--test/eigensolver_selfadjoint.cpp2
-rw-r--r--test/first_aligned.cpp6
-rw-r--r--test/geo_alignedbox.cpp4
-rw-r--r--test/geo_eulerangles.cpp2
-rw-r--r--test/geo_homogeneous.cpp2
-rw-r--r--test/geo_hyperplane.cpp8
-rw-r--r--test/geo_orthomethods.cpp4
-rw-r--r--test/geo_parametrizedline.cpp4
-rw-r--r--test/geo_quaternion.cpp12
-rw-r--r--test/geo_transformations.cpp22
-rw-r--r--test/hessenberg.cpp4
-rw-r--r--test/householder.cpp12
-rw-r--r--test/integer_types.cpp4
-rw-r--r--test/inverse.cpp6
-rw-r--r--test/jacobi.cpp96
-rw-r--r--test/jacobisvd.cpp173
-rw-r--r--test/linearstructure.cpp8
-rw-r--r--test/lu.cpp16
-rw-r--r--test/main.h152
-rw-r--r--test/map.cpp28
-rw-r--r--test/mapstride.cpp12
-rw-r--r--test/meta.cpp46
-rw-r--r--test/miscmatrices.cpp2
-rw-r--r--test/mixingtypes.cpp10
-rw-r--r--test/nomalloc.cpp9
-rw-r--r--test/nullary.cpp11
-rw-r--r--test/packetmath.cpp182
-rw-r--r--test/permutationmatrices.cpp12
-rw-r--r--test/prec_inverse_4x4.cpp2
-rw-r--r--test/product.h8
-rw-r--r--test/product_extra.cpp28
-rw-r--r--test/product_large.cpp22
-rw-r--r--test/product_notemporary.cpp22
-rw-r--r--test/product_selfadjoint.cpp14
-rw-r--r--test/product_symm.cpp22
-rw-r--r--test/product_syrk.cpp16
-rw-r--r--test/product_trmm.cpp20
-rw-r--r--test/product_trmv.cpp8
-rw-r--r--test/product_trsolve.cpp10
-rw-r--r--test/qr.cpp14
-rw-r--r--test/qr_colpivoting.cpp16
-rw-r--r--test/qr_fullpivoting.cpp14
-rw-r--r--test/redux.cpp38
-rw-r--r--test/schur_complex.cpp2
-rw-r--r--test/schur_real.cpp2
-rw-r--r--test/selfadjoint.cpp2
-rw-r--r--test/smallvectors.cpp8
-rw-r--r--test/sparse.h14
-rw-r--r--test/sparse_basic.cpp36
-rw-r--r--test/sparse_product.cpp6
-rw-r--r--test/sparse_solvers.cpp2
-rw-r--r--test/sparse_vector.cpp2
-rw-r--r--test/stable_norm.cpp34
-rw-r--r--test/stddeque.cpp147
-rw-r--r--test/svd.cpp123
-rw-r--r--test/swap.cpp2
-rw-r--r--test/triangular.cpp6
-rw-r--r--test/umeyama.cpp12
-rw-r--r--test/vectorization_logic.cpp30
-rw-r--r--test/visitor.cpp4
-rw-r--r--unsupported/Eigen/AdolcForward37
-rw-r--r--unsupported/Eigen/AlignedVector316
-rw-r--r--unsupported/Eigen/CholmodSupport3
-rw-r--r--unsupported/Eigen/FFT20
-rw-r--r--unsupported/Eigen/MPRealSupport51
-rw-r--r--unsupported/Eigen/MatrixFunctions2
-rw-r--r--unsupported/Eigen/OpenGLSupport176
-rw-r--r--unsupported/Eigen/SparseExtra2
-rw-r--r--unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h2
-rw-r--r--unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h212
-rw-r--r--unsupported/Eigen/src/AutoDiff/AutoDiffVector.h64
-rw-r--r--unsupported/Eigen/src/BVH/BVAlgorithms.h100
-rw-r--r--unsupported/Eigen/src/BVH/KdBVH.h30
-rw-r--r--unsupported/Eigen/src/FFT/ei_fftw_impl.h50
-rw-r--r--unsupported/Eigen/src/FFT/ei_kissfft_impl.h10
-rw-r--r--unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h14
-rw-r--r--unsupported/Eigen/src/IterativeSolvers/IterationController.h2
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h10
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h66
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h4
-rw-r--r--unsupported/Eigen/src/MoreVectorization/MathFunctions.h47
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h40
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h44
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/chkder.h19
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/covar.h10
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/dogleg.h8
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/fdjac1.h12
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/lmpar.h18
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/qrsolv.h8
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h4
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/r1updt.h12
-rw-r--r--unsupported/Eigen/src/NonLinearOptimization/rwupdt.h8
-rw-r--r--unsupported/Eigen/src/NumericalDiff/NumericalDiff.h4
-rw-r--r--unsupported/Eigen/src/Polynomials/Companion.h47
-rw-r--r--unsupported/Eigen/src/Polynomials/PolynomialSolver.h20
-rw-r--r--unsupported/Eigen/src/Polynomials/PolynomialUtils.h6
-rw-r--r--unsupported/Eigen/src/Skyline/SkylineInplaceLU.h8
-rw-r--r--unsupported/Eigen/src/Skyline/SkylineMatrix.h80
-rw-r--r--unsupported/Eigen/src/Skyline/SkylineMatrixBase.h24
-rw-r--r--unsupported/Eigen/src/Skyline/SkylineProduct.h65
-rw-r--r--unsupported/Eigen/src/Skyline/SkylineUtil.h21
-rw-r--r--unsupported/Eigen/src/SparseExtra/CholmodSupport.h666
-rw-r--r--unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h517
-rw-r--r--unsupported/Eigen/src/SparseExtra/RandomSetter.h4
-rw-r--r--unsupported/Eigen/src/SparseExtra/SparseLDLT.h30
-rw-r--r--unsupported/Eigen/src/SparseExtra/SparseLLT.h28
-rw-r--r--unsupported/Eigen/src/SparseExtra/SparseLU.h6
-rw-r--r--unsupported/Eigen/src/SparseExtra/SuperLUSupport.h36
-rw-r--r--unsupported/Eigen/src/SparseExtra/UmfPackSupport.h29
-rw-r--r--unsupported/doc/examples/BVH_Example.cpp2
-rw-r--r--unsupported/doc/examples/PolynomialSolver1.cpp2
-rw-r--r--unsupported/test/BVH.cpp16
-rw-r--r--unsupported/test/CMakeLists.txt46
-rw-r--r--unsupported/test/NonLinearOptimization.cpp8
-rw-r--r--unsupported/test/alignedvector3.cpp4
-rw-r--r--unsupported/test/forward_adolc.cpp2
-rw-r--r--unsupported/test/matrix_exponential.cpp2
-rw-r--r--unsupported/test/matrix_function.cpp18
-rw-r--r--unsupported/test/mpreal_support.cpp2
-rw-r--r--unsupported/test/openglsupport.cpp213
-rw-r--r--unsupported/test/polynomialsolver.cpp70
-rw-r--r--unsupported/test/polynomialutils.cpp14
-rw-r--r--unsupported/test/sparse_extra.cpp8
-rw-r--r--unsupported/test/sparse_ldlt.cpp4
-rw-r--r--unsupported/test/sparse_llt.cpp68
-rw-r--r--unsupported/test/sparse_lu.cpp2
377 files changed, 11291 insertions, 9344 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab006d20f..15dbbc4fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,13 +2,23 @@ project(Eigen)
cmake_minimum_required(VERSION 2.6.2)
-
# guard against in-source builds
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. (you may need to remove CMakeCache.txt ")
endif()
+# guard against bad build-type strings
+
+string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
+if( NOT cmake_build_type_tolower STREQUAL "debug"
+ AND NOT cmake_build_type_tolower STREQUAL "release"
+ AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo"
+ AND NOT cmake_build_type_tolower STREQUAL "")
+ message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo and \"\" (case-insensitive).")
+endif()
+
+
#############################################################################
# retrieve version infomation #
#############################################################################
@@ -81,15 +91,13 @@ endif(NOT WIN32)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
-if(cmake_build_type_tolower STREQUAL "debug")
- set(CMAKE_BUILD_TYPE "Debug")
+string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower)
+if(cmake_generator_tolower MATCHES "makefile" AND NOT MSVC_IDE)
+ option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON)
else()
- set(CMAKE_BUILD_TYPE "Release")
+ option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" OFF)
endif()
-option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON)
-
option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF)
if(EIGEN_DEFAULT_TO_ROW_MAJOR)
add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")
@@ -198,6 +206,18 @@ if(MSVC)
endif(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)
+
+if(EIGEN_TEST_X87)
+ set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON)
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387")
+ message("Forcing use of x87 instructions in tests/examples")
+ else()
+ message("EIGEN_TEST_X87 ignored on your compiler")
+ endif()
+endif()
+
if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
add_definitions(-DEIGEN_DONT_VECTORIZE=1)
message("Disabling vectorization in tests/examples")
@@ -290,7 +310,6 @@ message("")
message("Configured Eigen ${EIGEN_VERSION_NUMBER}")
message("")
-string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower)
if(cmake_generator_tolower MATCHES "makefile")
message("Some things you can do now:")
message("--------------+----------------------------------------------------------------")
diff --git a/Eigen/Core b/Eigen/Core
index 6951babd0..4401a4e14 100644
--- a/Eigen/Core
+++ b/Eigen/Core
@@ -167,7 +167,7 @@
#endif
// required for __cpuid, needs to be included after cmath
-#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_IX64))
+#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
#include <intrin.h>
#endif
@@ -266,12 +266,12 @@ using std::size_t;
#endif
#include "src/Core/util/BlasUtil.h"
-#include "src/Core/MatrixStorage.h"
+#include "src/Core/DenseStorage.h"
#include "src/Core/NestByValue.h"
#include "src/Core/ForceAlignedAccess.h"
#include "src/Core/ReturnByValue.h"
#include "src/Core/NoAlias.h"
-#include "src/Core/DenseStorageBase.h"
+#include "src/Core/PlainObjectBase.h"
#include "src/Core/Matrix.h"
#include "src/Core/CwiseBinaryOp.h"
#include "src/Core/CwiseUnaryOp.h"
diff --git a/Eigen/Eigen2Support b/Eigen/Eigen2Support
index b612c2961..1503d5cec 100644
--- a/Eigen/Eigen2Support
+++ b/Eigen/Eigen2Support
@@ -63,16 +63,16 @@ namespace Eigen {
EIGEN_USING_MATRIX_TYPEDEFS \
using Eigen::Matrix; \
using Eigen::MatrixBase; \
-using Eigen::ei_random; \
-using Eigen::ei_real; \
-using Eigen::ei_imag; \
-using Eigen::ei_conj; \
-using Eigen::ei_abs; \
-using Eigen::ei_abs2; \
-using Eigen::ei_sqrt; \
-using Eigen::ei_exp; \
-using Eigen::ei_log; \
-using Eigen::ei_sin; \
-using Eigen::ei_cos;
+using Eigen::internal::random; \
+using Eigen::internal::real; \
+using Eigen::internal::imag; \
+using Eigen::internal::conj; \
+using Eigen::internal::abs; \
+using Eigen::internal::abs2; \
+using Eigen::internal::sqrt; \
+using Eigen::internal::exp; \
+using Eigen::internal::log; \
+using Eigen::internal::sin; \
+using Eigen::internal::cos;
#endif // EIGEN2SUPPORT_H
diff --git a/Eigen/QtAlignedMalloc b/Eigen/QtAlignedMalloc
index 698607faa..5ae9f0cda 100644
--- a/Eigen/QtAlignedMalloc
+++ b/Eigen/QtAlignedMalloc
@@ -10,19 +10,19 @@
void *qMalloc(size_t size)
{
- return Eigen::ei_aligned_malloc(size);
+ return Eigen::internal::aligned_malloc(size);
}
void qFree(void *ptr)
{
- Eigen::ei_aligned_free(ptr);
+ Eigen::internal::aligned_free(ptr);
}
void *qRealloc(void *ptr, size_t size)
{
- void* newPtr = Eigen::ei_aligned_malloc(size);
+ void* newPtr = Eigen::internal::aligned_malloc(size);
memcpy(newPtr, ptr, size);
- Eigen::ei_aligned_free(ptr);
+ Eigen::internal::aligned_free(ptr);
return newPtr;
}
diff --git a/Eigen/SVD b/Eigen/SVD
index 4efc29e1f..93277dbc3 100644
--- a/Eigen/SVD
+++ b/Eigen/SVD
@@ -23,7 +23,6 @@ namespace Eigen {
*/
#include "src/misc/Solve.h"
-#include "src/SVD/SVD.h"
#include "src/SVD/JacobiSVD.h"
#include "src/SVD/UpperBidiagonalization.h"
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h
index 15a92f8fe..15925ba5d 100644
--- a/Eigen/src/Cholesky/LDLT.h
+++ b/Eigen/src/Cholesky/LDLT.h
@@ -27,7 +27,9 @@
#ifndef EIGEN_LDLT_H
#define EIGEN_LDLT_H
+namespace internal {
template<typename MatrixType, int UpLo> struct LDLT_Traits;
+}
/** \ingroup cholesky_Module
*
@@ -74,7 +76,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType;
typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType;
- typedef LDLT_Traits<MatrixType,UpLo> Traits;
+ typedef internal::LDLT_Traits<MatrixType,UpLo> Traits;
/** \brief Default Constructor.
*
@@ -108,14 +110,14 @@ template<typename _MatrixType, int _UpLo> class LDLT
/** \returns a view of the upper triangular matrix U */
inline typename Traits::MatrixU matrixU() const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return Traits::getU(m_matrix);
}
/** \returns a view of the lower triangular matrix L */
inline typename Traits::MatrixL matrixL() const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return Traits::getL(m_matrix);
}
@@ -123,28 +125,28 @@ template<typename _MatrixType, int _UpLo> class LDLT
*/
inline const TranspositionType& transpositionsP() const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_transpositions;
}
/** \returns the coefficients of the diagonal matrix D */
inline Diagonal<MatrixType,0> vectorD(void) const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_matrix.diagonal();
}
/** \returns true if the matrix is positive (semidefinite) */
inline bool isPositive(void) const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_sign == 1;
}
/** \returns true if the matrix is negative (semidefinite) */
inline bool isNegative(void) const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_sign == -1;
}
@@ -155,13 +157,13 @@ template<typename _MatrixType, int _UpLo> class LDLT
* \sa solveInPlace(), MatrixBase::ldlt()
*/
template<typename Rhs>
- inline const ei_solve_retval<LDLT, Rhs>
+ inline const internal::solve_retval<LDLT, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
- ei_assert(m_matrix.rows()==b.rows()
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_matrix.rows()==b.rows()
&& "LDLT::solve(): invalid number of rows of the right hand side matrix b");
- return ei_solve_retval<LDLT, Rhs>(*this, b.derived());
+ return internal::solve_retval<LDLT, Rhs>(*this, b.derived());
}
template<typename Derived>
@@ -175,7 +177,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
*/
inline const MatrixType& matrixLDLT() const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_matrix;
}
@@ -199,9 +201,11 @@ template<typename _MatrixType, int _UpLo> class LDLT
bool m_isInitialized;
};
-template<int UpLo> struct ei_ldlt_inplace;
+namespace internal {
+
+template<int UpLo> struct ldlt_inplace;
-template<> struct ei_ldlt_inplace<Lower>
+template<> struct ldlt_inplace<Lower>
{
template<typename MatrixType, typename TranspositionType, typename Workspace>
static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0)
@@ -209,14 +213,14 @@ template<> struct ei_ldlt_inplace<Lower>
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef typename MatrixType::Index Index;
- ei_assert(mat.rows()==mat.cols());
+ eigen_assert(mat.rows()==mat.cols());
const Index size = mat.rows();
if (size <= 1)
{
transpositions.setIdentity();
if(sign)
- *sign = ei_real(mat.coeff(0,0))>0 ? 1:-1;
+ *sign = real(mat.coeff(0,0))>0 ? 1:-1;
return true;
}
@@ -234,10 +238,10 @@ template<> struct ei_ldlt_inplace<Lower>
// The biggest overall is the point of reference to which further diagonals
// are compared; if any diagonal is negligible compared
// to the largest overall, the algorithm bails.
- cutoff = ei_abs(NumTraits<Scalar>::epsilon() * biggest_in_corner);
+ cutoff = abs(NumTraits<Scalar>::epsilon() * biggest_in_corner);
if(sign)
- *sign = ei_real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1;
+ *sign = real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1;
}
// Finish early if the matrix is not full rank.
@@ -259,11 +263,11 @@ template<> struct ei_ldlt_inplace<Lower>
for(int i=k+1;i<index_of_biggest_in_corner;++i)
{
Scalar tmp = mat.coeffRef(i,k);
- mat.coeffRef(i,k) = ei_conj(mat.coeffRef(index_of_biggest_in_corner,i));
- mat.coeffRef(index_of_biggest_in_corner,i) = ei_conj(tmp);
+ mat.coeffRef(i,k) = conj(mat.coeffRef(index_of_biggest_in_corner,i));
+ mat.coeffRef(index_of_biggest_in_corner,i) = conj(tmp);
}
if(NumTraits<Scalar>::IsComplex)
- mat.coeffRef(index_of_biggest_in_corner,k) = ei_conj(mat.coeff(index_of_biggest_in_corner,k));
+ mat.coeffRef(index_of_biggest_in_corner,k) = conj(mat.coeff(index_of_biggest_in_corner,k));
}
// partition the matrix:
@@ -282,7 +286,7 @@ template<> struct ei_ldlt_inplace<Lower>
if(rs>0)
A21.noalias() -= A20 * temp.head(k);
}
- if((rs>0) && (ei_abs(mat.coeffRef(k,k)) > cutoff))
+ if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff))
A21 /= mat.coeffRef(k,k);
}
@@ -290,13 +294,13 @@ template<> struct ei_ldlt_inplace<Lower>
}
};
-template<> struct ei_ldlt_inplace<Upper>
+template<> struct ldlt_inplace<Upper>
{
template<typename MatrixType, typename TranspositionType, typename Workspace>
static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0)
{
Transpose<MatrixType> matt(mat);
- return ei_ldlt_inplace<Lower>::unblocked(matt, transpositions, temp, sign);
+ return ldlt_inplace<Lower>::unblocked(matt, transpositions, temp, sign);
}
};
@@ -316,12 +320,14 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
inline static MatrixU getU(const MatrixType& m) { return m; }
};
+} // end namespace internal
+
/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix
*/
template<typename MatrixType, int _UpLo>
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
{
- ei_assert(a.rows()==a.cols());
+ eigen_assert(a.rows()==a.cols());
const Index size = a.rows();
m_matrix = a;
@@ -330,22 +336,23 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
m_isInitialized = false;
m_temporary.resize(size);
- ei_ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign);
+ internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign);
m_isInitialized = true;
return *this;
}
+namespace internal {
template<typename _MatrixType, int _UpLo, typename Rhs>
-struct ei_solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
- : ei_solve_retval_base<LDLT<_MatrixType,_UpLo>, Rhs>
+struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
+ : solve_retval_base<LDLT<_MatrixType,_UpLo>, Rhs>
{
typedef LDLT<_MatrixType,_UpLo> LDLTType;
EIGEN_MAKE_SOLVE_HELPERS(LDLTType,Rhs)
template<typename Dest> void evalTo(Dest& dst) const
{
- ei_assert(rhs().rows() == dec().matrixLDLT().rows());
+ eigen_assert(rhs().rows() == dec().matrixLDLT().rows());
// dst = P b
dst = dec().transpositionsP() * rhs();
@@ -362,6 +369,7 @@ struct ei_solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
dst = dec().transpositionsP().transpose() * dst;
}
};
+}
/** \internal use x = ldlt_object.solve(x);
*
@@ -380,9 +388,9 @@ template<typename MatrixType,int _UpLo>
template<typename Derived>
bool LDLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
const Index size = m_matrix.rows();
- ei_assert(size == bAndX.rows());
+ eigen_assert(size == bAndX.rows());
bAndX = this->solve(bAndX);
@@ -395,7 +403,7 @@ bool LDLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
template<typename MatrixType, int _UpLo>
MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
{
- ei_assert(m_isInitialized && "LDLT is not initialized.");
+ eigen_assert(m_isInitialized && "LDLT is not initialized.");
const Index size = m_matrix.rows();
MatrixType res(size,size);
diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h
index df135fce3..80a248546 100644
--- a/Eigen/src/Cholesky/LLT.h
+++ b/Eigen/src/Cholesky/LLT.h
@@ -25,7 +25,9 @@
#ifndef EIGEN_LLT_H
#define EIGEN_LLT_H
+namespace internal{
template<typename MatrixType, int UpLo> struct LLT_Traits;
+}
/** \ingroup cholesky_Module
*
@@ -68,12 +70,12 @@ template<typename _MatrixType, int _UpLo> class LLT
typedef typename MatrixType::Index Index;
enum {
- PacketSize = ei_packet_traits<Scalar>::size,
+ PacketSize = internal::packet_traits<Scalar>::size,
AlignmentMask = int(PacketSize)-1,
UpLo = _UpLo
};
- typedef LLT_Traits<MatrixType,UpLo> Traits;
+ typedef internal::LLT_Traits<MatrixType,UpLo> Traits;
/**
* \brief Default Constructor.
@@ -102,14 +104,14 @@ template<typename _MatrixType, int _UpLo> class LLT
/** \returns a view of the upper triangular matrix U */
inline typename Traits::MatrixU matrixU() const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
return Traits::getU(m_matrix);
}
/** \returns a view of the lower triangular matrix L */
inline typename Traits::MatrixL matrixL() const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
return Traits::getL(m_matrix);
}
@@ -124,13 +126,13 @@ template<typename _MatrixType, int _UpLo> class LLT
* \sa solveInPlace(), MatrixBase::llt()
*/
template<typename Rhs>
- inline const ei_solve_retval<LLT, Rhs>
+ inline const internal::solve_retval<LLT, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
- ei_assert(m_matrix.rows()==b.rows()
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_matrix.rows()==b.rows()
&& "LLT::solve(): invalid number of rows of the right hand side matrix b");
- return ei_solve_retval<LLT, Rhs>(*this, b.derived());
+ return internal::solve_retval<LLT, Rhs>(*this, b.derived());
}
template<typename Derived>
@@ -144,7 +146,7 @@ template<typename _MatrixType, int _UpLo> class LLT
*/
inline const MatrixType& matrixLLT() const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
return m_matrix;
}
@@ -158,7 +160,7 @@ template<typename _MatrixType, int _UpLo> class LLT
*/
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
return m_info;
}
@@ -175,9 +177,11 @@ template<typename _MatrixType, int _UpLo> class LLT
ComputationInfo m_info;
};
-template<int UpLo> struct ei_llt_inplace;
+namespace internal {
+
+template<int UpLo> struct llt_inplace;
-template<> struct ei_llt_inplace<Lower>
+template<> struct llt_inplace<Lower>
{
template<typename MatrixType>
static bool unblocked(MatrixType& mat)
@@ -185,7 +189,7 @@ template<> struct ei_llt_inplace<Lower>
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef typename MatrixType::Index Index;
- ei_assert(mat.rows()==mat.cols());
+ eigen_assert(mat.rows()==mat.cols());
const Index size = mat.rows();
for(Index k = 0; k < size; ++k)
{
@@ -195,11 +199,11 @@ template<> struct ei_llt_inplace<Lower>
Block<MatrixType,1,Dynamic> A10(mat,k,0,1,k);
Block<MatrixType,Dynamic,Dynamic> A20(mat,k+1,0,rs,k);
- RealScalar x = ei_real(mat.coeff(k,k));
+ RealScalar x = real(mat.coeff(k,k));
if (k>0) x -= mat.row(k).head(k).squaredNorm();
if (x<=RealScalar(0))
return false;
- mat.coeffRef(k,k) = x = ei_sqrt(x);
+ mat.coeffRef(k,k) = x = sqrt(x);
if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
if (rs>0) A21 *= RealScalar(1)/x;
}
@@ -210,7 +214,7 @@ template<> struct ei_llt_inplace<Lower>
static bool blocked(MatrixType& m)
{
typedef typename MatrixType::Index Index;
- ei_assert(m.rows()==m.cols());
+ eigen_assert(m.rows()==m.cols());
Index size = m.rows();
if(size<32)
return unblocked(m);
@@ -239,19 +243,19 @@ template<> struct ei_llt_inplace<Lower>
}
};
-template<> struct ei_llt_inplace<Upper>
+template<> struct llt_inplace<Upper>
{
template<typename MatrixType>
static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat)
{
Transpose<MatrixType> matt(mat);
- return ei_llt_inplace<Lower>::unblocked(matt);
+ return llt_inplace<Lower>::unblocked(matt);
}
template<typename MatrixType>
static EIGEN_STRONG_INLINE bool blocked(MatrixType& mat)
{
Transpose<MatrixType> matt(mat);
- return ei_llt_inplace<Lower>::blocked(matt);
+ return llt_inplace<Lower>::blocked(matt);
}
};
@@ -262,7 +266,7 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
inline static MatrixL getL(const MatrixType& m) { return m; }
inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
static bool inplace_decomposition(MatrixType& m)
- { return ei_llt_inplace<Lower>::blocked(m); }
+ { return llt_inplace<Lower>::blocked(m); }
};
template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
@@ -272,9 +276,11 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
inline static MatrixU getU(const MatrixType& m) { return m; }
static bool inplace_decomposition(MatrixType& m)
- { return ei_llt_inplace<Upper>::blocked(m); }
+ { return llt_inplace<Upper>::blocked(m); }
};
+} // end namespace internal
+
/** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix
*
*
@@ -295,9 +301,10 @@ LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
return *this;
}
+namespace internal {
template<typename _MatrixType, int UpLo, typename Rhs>
-struct ei_solve_retval<LLT<_MatrixType, UpLo>, Rhs>
- : ei_solve_retval_base<LLT<_MatrixType, UpLo>, Rhs>
+struct solve_retval<LLT<_MatrixType, UpLo>, Rhs>
+ : solve_retval_base<LLT<_MatrixType, UpLo>, Rhs>
{
typedef LLT<_MatrixType,UpLo> LLTType;
EIGEN_MAKE_SOLVE_HELPERS(LLTType,Rhs)
@@ -308,6 +315,7 @@ struct ei_solve_retval<LLT<_MatrixType, UpLo>, Rhs>
dec().solveInPlace(dst);
}
};
+}
/** \internal use x = llt_object.solve(x);
*
@@ -326,8 +334,8 @@ template<typename MatrixType, int _UpLo>
template<typename Derived>
void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
- ei_assert(m_matrix.rows()==bAndX.rows());
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_matrix.rows()==bAndX.rows());
matrixL().solveInPlace(bAndX);
matrixU().solveInPlace(bAndX);
}
@@ -338,7 +346,7 @@ void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
template<typename MatrixType, int _UpLo>
MatrixType LLT<MatrixType,_UpLo>::reconstructedMatrix() const
{
- ei_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
return matrixL() * matrixL().adjoint().toDenseMatrix();
}
diff --git a/Eigen/src/Core/Array.h b/Eigen/src/Core/Array.h
index 2e97f18ee..0861d7ab1 100644
--- a/Eigen/src/Core/Array.h
+++ b/Eigen/src/Core/Array.h
@@ -39,20 +39,22 @@
*
* \sa \ref TutorialArrayClass, \ref TopicClassHierarchy
*/
+namespace internal {
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
-struct ei_traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+struct traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef ArrayXpr XprKind;
typedef ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > XprBase;
};
+}
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
class Array
- : public DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+ : public PlainObjectBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
public:
- typedef DenseStorageBase<Array> Base;
+ typedef PlainObjectBase<Array> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Array)
enum { Options = _Options };
@@ -60,7 +62,7 @@ class Array
protected:
template <typename Derived, typename OtherDerived, bool IsVector>
- friend struct ei_conservative_resize_like_impl;
+ friend struct internal::conservative_resize_like_impl;
using Base::m_storage;
public:
@@ -126,8 +128,8 @@ class Array
#ifndef EIGEN_PARSED_BY_DOXYGEN
// FIXME is it still needed ??
/** \internal */
- Array(ei_constructor_without_unaligned_array_assert)
- : Base(ei_constructor_without_unaligned_array_assert())
+ Array(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
@@ -145,8 +147,8 @@ class Array
{
Base::_check_template_params();
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array)
- ei_assert(dim > 0);
- ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim);
+ eigen_assert(dim > 0);
+ eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim);
EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
}
@@ -241,7 +243,7 @@ class Array
private:
template<typename MatrixType, typename OtherDerived, bool SwapPointers>
- friend struct ei_matrix_swap_impl;
+ friend struct internal::matrix_swap_impl;
};
/** \defgroup arraytypedefs Global array typedefs
diff --git a/Eigen/src/Core/ArrayBase.h b/Eigen/src/Core/ArrayBase.h
index f0fbcd4ff..40a6fc8bb 100644
--- a/Eigen/src/Core/ArrayBase.h
+++ b/Eigen/src/Core/ArrayBase.h
@@ -53,16 +53,16 @@ template<typename Derived> class ArrayBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** The base class for a given storage type. */
typedef ArrayBase StorageBaseType;
-
+
typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl;
- using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
- typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
+ using internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
+ typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>::operator*;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseBase<Derived> Base;
@@ -99,17 +99,17 @@ template<typename Derived> class ArrayBase
* reference to a matrix, not a matrix! It is however guaranteed that the return type of eval() is either
* PlainObject or const PlainObject&.
*/
- typedef Array<typename ei_traits<Derived>::Scalar,
- ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime,
- AutoAlign | (ei_traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
- ei_traits<Derived>::MaxRowsAtCompileTime,
- ei_traits<Derived>::MaxColsAtCompileTime
+ typedef Array<typename internal::traits<Derived>::Scalar,
+ internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime,
+ AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ internal::traits<Derived>::MaxRowsAtCompileTime,
+ internal::traits<Derived>::MaxColsAtCompileTime
> PlainObject;
/** \internal Represents a matrix with all coefficients equal to one another*/
- typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Derived> ConstantReturnType;
+ typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Derived> ConstantReturnType;
#endif // not EIGEN_PARSED_BY_DOXYGEN
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase
@@ -129,7 +129,7 @@ template<typename Derived> class ArrayBase
*/
Derived& operator=(const ArrayBase& other)
{
- return ei_assign_selector<Derived,Derived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
}
Derived& operator+=(const Scalar& scalar)
@@ -185,7 +185,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
{
- SelfCwiseBinaryOp<ei_scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other;
return derived();
}
@@ -199,7 +199,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
{
- SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other.derived();
return derived();
}
@@ -213,7 +213,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
{
- SelfCwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_product_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other.derived();
return derived();
}
@@ -227,7 +227,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
{
- SelfCwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other.derived();
return derived();
}
diff --git a/Eigen/src/Core/ArrayWrapper.h b/Eigen/src/Core/ArrayWrapper.h
index dc5bba443..d5b8c6804 100644
--- a/Eigen/src/Core/ArrayWrapper.h
+++ b/Eigen/src/Core/ArrayWrapper.h
@@ -35,12 +35,15 @@
*
* \sa MatrixBase::array(), class MatrixWrapper
*/
+
+namespace internal {
template<typename ExpressionType>
-struct ei_traits<ArrayWrapper<ExpressionType> >
- : public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
+struct traits<ArrayWrapper<ExpressionType> >
+ : public traits<typename remove_all<typename ExpressionType::Nested>::type >
{
typedef ArrayXpr XprKind;
};
+}
template<typename ExpressionType>
class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
@@ -50,7 +53,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
- typedef typename ei_nested<ExpressionType>::type NestedExpressionType;
+ typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
@@ -121,12 +124,14 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
* \sa MatrixBase::matrix(), class ArrayWrapper
*/
+namespace internal {
template<typename ExpressionType>
-struct ei_traits<MatrixWrapper<ExpressionType> >
- : public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
+struct traits<MatrixWrapper<ExpressionType> >
+ : public traits<typename remove_all<typename ExpressionType::Nested>::type >
{
typedef MatrixXpr XprKind;
};
+}
template<typename ExpressionType>
class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
@@ -136,7 +141,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper)
- typedef typename ei_nested<ExpressionType>::type NestedExpressionType;
+ typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {}
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h
index 335a888f6..96451a9e7 100644
--- a/Eigen/src/Core/Assign.h
+++ b/Eigen/src/Core/Assign.h
@@ -27,12 +27,14 @@
#ifndef EIGEN_ASSIGN_H
#define EIGEN_ASSIGN_H
+namespace internal {
+
/***************************************************************************
* Part 1 : the logic deciding a strategy for traversal and unrolling *
***************************************************************************/
template <typename Derived, typename OtherDerived>
-struct ei_assign_traits
+struct assign_traits
{
public:
enum {
@@ -51,7 +53,7 @@ private:
: int(Derived::Flags)&RowMajorBit ? int(Derived::MaxColsAtCompileTime)
: int(Derived::MaxRowsAtCompileTime),
MaxSizeAtCompileTime = Derived::SizeAtCompileTime,
- PacketSize = ei_packet_traits<typename Derived::Scalar>::size
+ PacketSize = packet_traits<typename Derived::Scalar>::size
};
enum {
@@ -143,7 +145,7 @@ public:
************************/
template<typename Derived1, typename Derived2, int Index, int Stop>
-struct ei_assign_DefaultTraversal_CompleteUnrolling
+struct assign_DefaultTraversal_CompleteUnrolling
{
enum {
outer = Index / Derived1::InnerSizeAtCompileTime,
@@ -153,28 +155,28 @@ struct ei_assign_DefaultTraversal_CompleteUnrolling
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
dst.copyCoeffByOuterInner(outer, inner, src);
- ei_assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
+ assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
}
};
template<typename Derived1, typename Derived2, int Stop>
-struct ei_assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
+struct assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
{
EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
};
template<typename Derived1, typename Derived2, int Index, int Stop>
-struct ei_assign_DefaultTraversal_InnerUnrolling
+struct assign_DefaultTraversal_InnerUnrolling
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer)
{
dst.copyCoeffByOuterInner(outer, Index, src);
- ei_assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src, outer);
+ assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src, outer);
}
};
template<typename Derived1, typename Derived2, int Stop>
-struct ei_assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
+struct assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
{
EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {}
};
@@ -184,17 +186,17 @@ struct ei_assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
***********************/
template<typename Derived1, typename Derived2, int Index, int Stop>
-struct ei_assign_LinearTraversal_CompleteUnrolling
+struct assign_LinearTraversal_CompleteUnrolling
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
dst.copyCoeff(Index, src);
- ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
+ assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
}
};
template<typename Derived1, typename Derived2, int Stop>
-struct ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
+struct assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
{
EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
};
@@ -204,41 +206,41 @@ struct ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Sto
**************************/
template<typename Derived1, typename Derived2, int Index, int Stop>
-struct ei_assign_innervec_CompleteUnrolling
+struct assign_innervec_CompleteUnrolling
{
enum {
outer = Index / Derived1::InnerSizeAtCompileTime,
inner = Index % Derived1::InnerSizeAtCompileTime,
- JointAlignment = ei_assign_traits<Derived1,Derived2>::JointAlignment
+ JointAlignment = assign_traits<Derived1,Derived2>::JointAlignment
};
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
dst.template copyPacketByOuterInner<Derived2, Aligned, JointAlignment>(outer, inner, src);
- ei_assign_innervec_CompleteUnrolling<Derived1, Derived2,
- Index+ei_packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src);
+ assign_innervec_CompleteUnrolling<Derived1, Derived2,
+ Index+packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src);
}
};
template<typename Derived1, typename Derived2, int Stop>
-struct ei_assign_innervec_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
+struct assign_innervec_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
{
EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {}
};
template<typename Derived1, typename Derived2, int Index, int Stop>
-struct ei_assign_innervec_InnerUnrolling
+struct assign_innervec_InnerUnrolling
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer)
{
dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, Index, src);
- ei_assign_innervec_InnerUnrolling<Derived1, Derived2,
- Index+ei_packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src, outer);
+ assign_innervec_InnerUnrolling<Derived1, Derived2,
+ Index+packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src, outer);
}
};
template<typename Derived1, typename Derived2, int Stop>
-struct ei_assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
+struct assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
{
EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {}
};
@@ -248,22 +250,22 @@ struct ei_assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
***************************************************************************/
template<typename Derived1, typename Derived2,
- int Traversal = ei_assign_traits<Derived1, Derived2>::Traversal,
- int Unrolling = ei_assign_traits<Derived1, Derived2>::Unrolling>
-struct ei_assign_impl;
+ int Traversal = assign_traits<Derived1, Derived2>::Traversal,
+ int Unrolling = assign_traits<Derived1, Derived2>::Unrolling>
+struct assign_impl;
/************************
*** Default traversal ***
************************/
template<typename Derived1, typename Derived2, int Unrolling>
-struct ei_assign_impl<Derived1, Derived2, InvalidTraversal, Unrolling>
+struct assign_impl<Derived1, Derived2, InvalidTraversal, Unrolling>
{
inline static void run(Derived1 &, const Derived2 &) { }
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -277,24 +279,24 @@ struct ei_assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling>
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, DefaultTraversal, CompleteUnrolling>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, CompleteUnrolling>
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
- ei_assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
+ assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
::run(dst, src);
}
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling>
+struct assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling>
{
typedef typename Derived1::Index Index;
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
const Index outerSize = dst.outerSize();
for(Index outer = 0; outer < outerSize; ++outer)
- ei_assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
+ assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
::run(dst, src, outer);
}
};
@@ -304,7 +306,7 @@ struct ei_assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling>
***********************/
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling>
+struct assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -316,11 +318,11 @@ struct ei_assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling>
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling>
+struct assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling>
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
- ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
+ assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
::run(dst, src);
}
};
@@ -330,14 +332,14 @@ struct ei_assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling>
**************************/
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
{
const Index innerSize = dst.innerSize();
const Index outerSize = dst.outerSize();
- const Index packetSize = ei_packet_traits<typename Derived1::Scalar>::size;
+ const Index packetSize = packet_traits<typename Derived1::Scalar>::size;
for(Index outer = 0; outer < outerSize; ++outer)
for(Index inner = 0; inner < innerSize; inner+=packetSize)
dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, inner, src);
@@ -345,24 +347,24 @@ struct ei_assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling>
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, InnerVectorizedTraversal, CompleteUnrolling>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, CompleteUnrolling>
{
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
- ei_assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
+ assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
::run(dst, src);
}
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolling>
+struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolling>
{
typedef typename Derived1::Index Index;
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
const Index outerSize = dst.outerSize();
for(Index outer = 0; outer < outerSize; ++outer)
- ei_assign_innervec_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
+ assign_innervec_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
::run(dst, src, outer);
}
};
@@ -372,14 +374,14 @@ struct ei_assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolli
***************************/
template <bool IsAligned = false>
-struct ei_unaligned_assign_impl
+struct unaligned_assign_impl
{
template <typename Derived, typename OtherDerived>
static EIGEN_STRONG_INLINE void run(const Derived&, OtherDerived&, typename Derived::Index, typename Derived::Index) {}
};
template <>
-struct ei_unaligned_assign_impl<false>
+struct unaligned_assign_impl<false>
{
// MSVC must not inline this functions. If it does, it fails to optimize the
// packet access path.
@@ -397,45 +399,45 @@ struct ei_unaligned_assign_impl<false>
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling>
+struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling>
{
typedef typename Derived1::Index Index;
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
const Index size = dst.size();
- typedef ei_packet_traits<typename Derived1::Scalar> PacketTraits;
+ typedef packet_traits<typename Derived1::Scalar> PacketTraits;
enum {
packetSize = PacketTraits::size,
- dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(ei_assign_traits<Derived1,Derived2>::DstIsAligned) ,
- srcAlignment = ei_assign_traits<Derived1,Derived2>::JointAlignment
+ dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(assign_traits<Derived1,Derived2>::DstIsAligned) ,
+ srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
};
- const Index alignedStart = ei_assign_traits<Derived1,Derived2>::DstIsAligned ? 0
- : ei_first_aligned(&dst.coeffRef(0), size);
+ const Index alignedStart = assign_traits<Derived1,Derived2>::DstIsAligned ? 0
+ : first_aligned(&dst.coeffRef(0), size);
const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
- ei_unaligned_assign_impl<ei_assign_traits<Derived1,Derived2>::DstIsAligned!=0>::run(src,dst,0,alignedStart);
+ unaligned_assign_impl<assign_traits<Derived1,Derived2>::DstIsAligned!=0>::run(src,dst,0,alignedStart);
for(Index index = alignedStart; index < alignedEnd; index += packetSize)
{
dst.template copyPacket<Derived2, dstAlignment, srcAlignment>(index, src);
}
- ei_unaligned_assign_impl<>::run(src,dst,alignedEnd,size);
+ unaligned_assign_impl<>::run(src,dst,alignedEnd,size);
}
};
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnrolling>
+struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnrolling>
{
typedef typename Derived1::Index Index;
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
enum { size = Derived1::SizeAtCompileTime,
- packetSize = ei_packet_traits<typename Derived1::Scalar>::size,
+ packetSize = packet_traits<typename Derived1::Scalar>::size,
alignedSize = (size/packetSize)*packetSize };
- ei_assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, alignedSize>::run(dst, src);
- ei_assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, alignedSize, size>::run(dst, src);
+ assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, alignedSize>::run(dst, src);
+ assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, alignedSize, size>::run(dst, src);
}
};
@@ -444,24 +446,24 @@ struct ei_assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnr
***************************/
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
+struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
{
- typedef ei_packet_traits<typename Derived1::Scalar> PacketTraits;
+ typedef packet_traits<typename Derived1::Scalar> PacketTraits;
enum {
packetSize = PacketTraits::size,
alignable = PacketTraits::AlignedOnScalar,
- dstAlignment = alignable ? Aligned : int(ei_assign_traits<Derived1,Derived2>::DstIsAligned) ,
- srcAlignment = ei_assign_traits<Derived1,Derived2>::JointAlignment
+ dstAlignment = alignable ? Aligned : int(assign_traits<Derived1,Derived2>::DstIsAligned) ,
+ srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
};
const Index packetAlignedMask = packetSize - 1;
const Index innerSize = dst.innerSize();
const Index outerSize = dst.outerSize();
const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0;
- Index alignedStart = ((!alignable) || ei_assign_traits<Derived1,Derived2>::DstIsAligned) ? 0
- : ei_first_aligned(&dst.coeffRef(0,0), innerSize);
+ Index alignedStart = ((!alignable) || assign_traits<Derived1,Derived2>::DstIsAligned) ? 0
+ : first_aligned(&dst.coeffRef(0,0), innerSize);
for(Index outer = 0; outer < outerSize; ++outer)
{
@@ -483,6 +485,8 @@ struct ei_assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
}
};
+} // end namespace internal
+
/***************************************************************************
* Part 4 : implementation of DenseBase methods
***************************************************************************/
@@ -493,26 +497,26 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
::lazyAssign(const DenseBase<OtherDerived>& other)
{
enum{
- SameType = ei_is_same_type<typename Derived::Scalar,typename OtherDerived::Scalar>::ret
+ SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
};
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
-
-
#ifdef EIGEN_DEBUG_ASSIGN
- ei_assign_traits<Derived, OtherDerived>::debug();
+ internal::assign_traits<Derived, OtherDerived>::debug();
#endif
- ei_assert(rows() == other.rows() && cols() == other.cols());
- ei_assign_impl<Derived, OtherDerived, int(SameType) ? int(ei_assign_traits<Derived, OtherDerived>::Traversal)
- : int(InvalidTraversal)>::run(derived(),other.derived());
+ eigen_assert(rows() == other.rows() && cols() == other.cols());
+ internal::assign_impl<Derived, OtherDerived, int(SameType) ? int(internal::assign_traits<Derived, OtherDerived>::Traversal)
+ : int(InvalidTraversal)>::run(derived(),other.derived());
#ifndef EIGEN_NO_DEBUG
checkTransposeAliasing(other.derived());
#endif
return derived();
}
+namespace internal {
+
template<typename Derived, typename OtherDerived,
bool EvalBeforeAssigning = (int(OtherDerived::Flags) & EvalBeforeAssigningBit) != 0,
bool NeedToTranspose = Derived::IsVectorAtCompileTime
@@ -522,49 +526,51 @@ template<typename Derived, typename OtherDerived,
// revert to || as soon as not needed anymore.
(int(Derived::ColsAtCompileTime) == 1 && int(OtherDerived::RowsAtCompileTime) == 1))
&& int(Derived::SizeAtCompileTime) != 1>
-struct ei_assign_selector;
+struct assign_selector;
template<typename Derived, typename OtherDerived>
-struct ei_assign_selector<Derived,OtherDerived,false,false> {
+struct assign_selector<Derived,OtherDerived,false,false> {
EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
};
template<typename Derived, typename OtherDerived>
-struct ei_assign_selector<Derived,OtherDerived,true,false> {
+struct assign_selector<Derived,OtherDerived,true,false> {
EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); }
};
template<typename Derived, typename OtherDerived>
-struct ei_assign_selector<Derived,OtherDerived,false,true> {
+struct assign_selector<Derived,OtherDerived,false,true> {
EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); }
};
template<typename Derived, typename OtherDerived>
-struct ei_assign_selector<Derived,OtherDerived,true,true> {
+struct assign_selector<Derived,OtherDerived,true,true> {
EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); }
};
+} // end namespace internal
+
template<typename Derived>
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
{
- return ei_assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
}
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
{
- return ei_assign_selector<Derived,Derived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
}
template<typename Derived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
{
- return ei_assign_selector<Derived,Derived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
}
template<typename Derived>
template <typename OtherDerived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
{
- return ei_assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
}
template<typename Derived>
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h
index 2f94d12dc..d70927e31 100644
--- a/Eigen/src/Core/BandMatrix.h
+++ b/Eigen/src/Core/BandMatrix.h
@@ -43,8 +43,10 @@
*
* \sa class TridiagonalMatrix
*/
+
+namespace internal {
template<typename _Scalar, int Rows, int Cols, int Supers, int Subs, int Options>
-struct ei_traits<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Options> >
+struct traits<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Options> >
{
typedef _Scalar Scalar;
typedef Dense StorageKind;
@@ -58,6 +60,7 @@ struct ei_traits<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Options> >
Flags = LvalueBit
};
};
+}
template<typename _Scalar, int Rows, int Cols, int Supers, int Subs, int Options>
class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Options> >
@@ -65,14 +68,14 @@ class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Opt
public:
enum {
- Flags = ei_traits<BandMatrix>::Flags,
- CoeffReadCost = ei_traits<BandMatrix>::CoeffReadCost,
- RowsAtCompileTime = ei_traits<BandMatrix>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<BandMatrix>::ColsAtCompileTime,
- MaxRowsAtCompileTime = ei_traits<BandMatrix>::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = ei_traits<BandMatrix>::MaxColsAtCompileTime
+ Flags = internal::traits<BandMatrix>::Flags,
+ CoeffReadCost = internal::traits<BandMatrix>::CoeffReadCost,
+ RowsAtCompileTime = internal::traits<BandMatrix>::RowsAtCompileTime,
+ ColsAtCompileTime = internal::traits<BandMatrix>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = internal::traits<BandMatrix>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = internal::traits<BandMatrix>::MaxColsAtCompileTime
};
- typedef typename ei_traits<BandMatrix>::Scalar Scalar;
+ typedef typename internal::traits<BandMatrix>::Scalar Scalar;
typedef Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> DenseMatrixType;
typedef typename DenseMatrixType::Index Index;
@@ -144,9 +147,9 @@ class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Opt
: EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime - ActualIndex))
};
typedef Block<DataType,1, DiagonalSize> BuildType;
- typedef typename ei_meta_if<Conjugate,
- CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>,BuildType >,
- BuildType>::ret Type;
+ typedef typename internal::conditional<Conjugate,
+ CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>,BuildType >,
+ BuildType>::type Type;
};
/** \returns a vector expression of the \a N -th sub or super diagonal */
@@ -164,14 +167,14 @@ class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Opt
/** \returns a vector expression of the \a i -th sub or super diagonal */
inline Block<DataType,1,Dynamic> diagonal(Index i)
{
- ei_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers()));
+ eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers()));
return Block<DataType,1,Dynamic>(m_data, supers()-i, std::max<Index>(0,i), 1, diagonalLength(i));
}
/** \returns a vector expression of the \a i -th sub or super diagonal */
inline const Block<DataType,1,Dynamic> diagonal(Index i) const
{
- ei_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers()));
+ eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers()));
return Block<DataType,1,Dynamic>(m_data, supers()-i, std::max<Index>(0,i), 1, diagonalLength(i));
}
@@ -199,9 +202,9 @@ class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Opt
{ return i<0 ? std::min(cols(),rows()+i) : std::min(rows(),cols()-i); }
DataType m_data;
- ei_variable_if_dynamic<Index, Rows> m_rows;
- ei_variable_if_dynamic<Index, Supers> m_supers;
- ei_variable_if_dynamic<Index, Subs> m_subs;
+ internal::variable_if_dynamic<Index, Rows> m_rows;
+ internal::variable_if_dynamic<Index, Supers> m_supers;
+ internal::variable_if_dynamic<Index, Subs> m_subs;
};
/**
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index a770b9721..3ab242537 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -58,54 +58,57 @@
*
* \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock
*/
+
+namespace internal {
template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool HasDirectAccess>
-struct ei_traits<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> > : ei_traits<XprType>
+struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> > : traits<XprType>
{
- typedef typename ei_traits<XprType>::Scalar Scalar;
- typedef typename ei_traits<XprType>::StorageKind StorageKind;
- typedef typename ei_traits<XprType>::XprKind XprKind;
- typedef typename ei_nested<XprType>::type XprTypeNested;
- typedef typename ei_unref<XprTypeNested>::type _XprTypeNested;
+ typedef typename traits<XprType>::Scalar Scalar;
+ typedef typename traits<XprType>::StorageKind StorageKind;
+ typedef typename traits<XprType>::XprKind XprKind;
+ typedef typename nested<XprType>::type XprTypeNested;
+ typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;
enum{
- MatrixRows = ei_traits<XprType>::RowsAtCompileTime,
- MatrixCols = ei_traits<XprType>::ColsAtCompileTime,
+ MatrixRows = traits<XprType>::RowsAtCompileTime,
+ MatrixCols = traits<XprType>::ColsAtCompileTime,
RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows,
ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols,
MaxRowsAtCompileTime = BlockRows==0 ? 0
: RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime)
- : int(ei_traits<XprType>::MaxRowsAtCompileTime),
+ : int(traits<XprType>::MaxRowsAtCompileTime),
MaxColsAtCompileTime = BlockCols==0 ? 0
: ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime)
- : int(ei_traits<XprType>::MaxColsAtCompileTime),
- XprTypeIsRowMajor = (int(ei_traits<XprType>::Flags)&RowMajorBit) != 0,
+ : int(traits<XprType>::MaxColsAtCompileTime),
+ XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0,
IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
: (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
: XprTypeIsRowMajor,
HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
InnerStrideAtCompileTime = HasSameStorageOrderAsXprType
- ? int(ei_inner_stride_at_compile_time<XprType>::ret)
- : int(ei_outer_stride_at_compile_time<XprType>::ret),
+ ? int(inner_stride_at_compile_time<XprType>::ret)
+ : int(outer_stride_at_compile_time<XprType>::ret),
OuterStrideAtCompileTime = HasSameStorageOrderAsXprType
- ? int(ei_outer_stride_at_compile_time<XprType>::ret)
- : int(ei_inner_stride_at_compile_time<XprType>::ret),
- MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % ei_packet_traits<Scalar>::size) == 0)
+ ? int(outer_stride_at_compile_time<XprType>::ret)
+ : int(inner_stride_at_compile_time<XprType>::ret),
+ MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0)
&& (InnerStrideAtCompileTime == 1)
? PacketAccessBit : 0,
- MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && ((OuterStrideAtCompileTime % ei_packet_traits<Scalar>::size) == 0)) ? AlignedBit : 0,
+ MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && ((OuterStrideAtCompileTime % packet_traits<Scalar>::size) == 0)) ? AlignedBit : 0,
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
- Flags0 = ei_traits<XprType>::Flags & (HereditaryBits | MaskPacketAccessBit | LvalueBit | DirectAccessBit | MaskAlignedBit),
+ Flags0 = traits<XprType>::Flags & (HereditaryBits | MaskPacketAccessBit | LvalueBit | DirectAccessBit | MaskAlignedBit),
Flags1 = Flags0 | FlagsLinearAccessBit,
Flags = (Flags1 & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0)
};
};
+}
template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool HasDirectAccess> class Block
- : public ei_dense_xpr_base<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> >::type
+ : public internal::dense_xpr_base<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> >::type
{
public:
- typedef typename ei_dense_xpr_base<Block>::type Base;
+ typedef typename internal::dense_xpr_base<Block>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Block)
class InnerIterator;
@@ -123,7 +126,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
m_blockRows(BlockRows==1 ? 1 : xpr.rows()),
m_blockCols(BlockCols==1 ? 1 : xpr.cols())
{
- ei_assert( (i>=0) && (
+ eigen_assert( (i>=0) && (
((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows())
||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols())));
}
@@ -135,7 +138,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
m_blockRows(BlockRows), m_blockCols(BlockCols)
{
EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE)
- ei_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows()
+ eigen_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows()
&& startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols());
}
@@ -147,9 +150,9 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
: m_xpr(xpr), m_startRow(startRow), m_startCol(startCol),
m_blockRows(blockRows), m_blockCols(blockCols)
{
- ei_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows)
+ eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows)
&& (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols));
- ei_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows()
+ eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows()
&& startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols());
}
@@ -223,10 +226,10 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
protected:
const typename XprType::Nested m_xpr;
- const ei_variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
- const ei_variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
- const ei_variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
- const ei_variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
+ const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
+ const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
};
/** \internal */
@@ -251,7 +254,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
BlockCols==1 ? 1 : xpr.cols()),
m_xpr(xpr)
{
- ei_assert( (i>=0) && (
+ eigen_assert( (i>=0) && (
((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows())
||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols())));
init();
@@ -262,7 +265,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
inline Block(const XprType& xpr, Index startRow, Index startCol)
: Base(&xpr.const_cast_derived().coeffRef(startRow,startCol)), m_xpr(xpr)
{
- ei_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows()
+ eigen_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows()
&& startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols());
init();
}
@@ -275,9 +278,9 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
: Base(&xpr.const_cast_derived().coeffRef(startRow,startCol), blockRows, blockCols),
m_xpr(xpr)
{
- ei_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows)
+ eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows)
&& (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols));
- ei_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows()
+ eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows()
&& startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols());
init();
}
@@ -285,7 +288,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
/** \sa MapBase::innerStride() */
inline Index innerStride() const
{
- return ei_traits<Block>::HasSameStorageOrderAsXprType
+ return internal::traits<Block>::HasSameStorageOrderAsXprType
? m_xpr.innerStride()
: m_xpr.outerStride();
}
@@ -314,7 +317,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
protected:
void init()
{
- m_outerStride = ei_traits<Block>::HasSameStorageOrderAsXprType
+ m_outerStride = internal::traits<Block>::HasSameStorageOrderAsXprType
? m_xpr.outerStride()
: m_xpr.innerStride();
}
diff --git a/Eigen/src/Core/BooleanRedux.h b/Eigen/src/Core/BooleanRedux.h
index 9f9d1b594..5c3444a57 100644
--- a/Eigen/src/Core/BooleanRedux.h
+++ b/Eigen/src/Core/BooleanRedux.h
@@ -25,8 +25,10 @@
#ifndef EIGEN_ALLANDANY_H
#define EIGEN_ALLANDANY_H
+namespace internal {
+
template<typename Derived, int UnrollCount>
-struct ei_all_unroller
+struct all_unroller
{
enum {
col = (UnrollCount-1) / Derived::RowsAtCompileTime,
@@ -35,24 +37,24 @@ struct ei_all_unroller
inline static bool run(const Derived &mat)
{
- return ei_all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
+ return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
}
};
template<typename Derived>
-struct ei_all_unroller<Derived, 1>
+struct all_unroller<Derived, 1>
{
inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
};
template<typename Derived>
-struct ei_all_unroller<Derived, Dynamic>
+struct all_unroller<Derived, Dynamic>
{
inline static bool run(const Derived &) { return false; }
};
template<typename Derived, int UnrollCount>
-struct ei_any_unroller
+struct any_unroller
{
enum {
col = (UnrollCount-1) / Derived::RowsAtCompileTime,
@@ -61,22 +63,24 @@ struct ei_any_unroller
inline static bool run(const Derived &mat)
{
- return ei_any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
+ return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
}
};
template<typename Derived>
-struct ei_any_unroller<Derived, 1>
+struct any_unroller<Derived, 1>
{
inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
};
template<typename Derived>
-struct ei_any_unroller<Derived, Dynamic>
+struct any_unroller<Derived, Dynamic>
{
inline static bool run(const Derived &) { return false; }
};
+} // end namespace internal
+
/** \returns true if all coefficients are true
*
* Example: \include MatrixBase_all.cpp
@@ -94,7 +98,7 @@ inline bool DenseBase<Derived>::all() const
&& SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost) <= EIGEN_UNROLLING_LIMIT
};
if(unroll)
- return ei_all_unroller<Derived,
+ return internal::all_unroller<Derived,
unroll ? int(SizeAtCompileTime) : Dynamic
>::run(derived());
else
@@ -120,7 +124,7 @@ inline bool DenseBase<Derived>::any() const
&& SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost) <= EIGEN_UNROLLING_LIMIT
};
if(unroll)
- return ei_any_unroller<Derived,
+ return internal::any_unroller<Derived,
unroll ? int(SizeAtCompileTime) : Dynamic
>::run(derived());
else
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h
index da8df5592..92422bf2f 100644
--- a/Eigen/src/Core/CommaInitializer.h
+++ b/Eigen/src/Core/CommaInitializer.h
@@ -64,12 +64,12 @@ struct CommaInitializer
m_row+=m_currentBlockRows;
m_col = 0;
m_currentBlockRows = 1;
- ei_assert(m_row<m_xpr.rows()
+ eigen_assert(m_row<m_xpr.rows()
&& "Too many rows passed to comma initializer (operator<<)");
}
- ei_assert(m_col<m_xpr.cols()
+ eigen_assert(m_col<m_xpr.cols()
&& "Too many coefficients passed to comma initializer (operator<<)");
- ei_assert(m_currentBlockRows==1);
+ eigen_assert(m_currentBlockRows==1);
m_xpr.coeffRef(m_row, m_col++) = s;
return *this;
}
@@ -83,12 +83,12 @@ struct CommaInitializer
m_row+=m_currentBlockRows;
m_col = 0;
m_currentBlockRows = other.rows();
- ei_assert(m_row+m_currentBlockRows<=m_xpr.rows()
+ eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
&& "Too many rows passed to comma initializer (operator<<)");
}
- ei_assert(m_col<m_xpr.cols()
+ eigen_assert(m_col<m_xpr.cols()
&& "Too many coefficients passed to comma initializer (operator<<)");
- ei_assert(m_currentBlockRows==other.rows());
+ eigen_assert(m_currentBlockRows==other.rows());
if (OtherDerived::SizeAtCompileTime != Dynamic)
m_xpr.template block<OtherDerived::RowsAtCompileTime != Dynamic ? OtherDerived::RowsAtCompileTime : 1,
OtherDerived::ColsAtCompileTime != Dynamic ? OtherDerived::ColsAtCompileTime : 1>
@@ -101,7 +101,7 @@ struct CommaInitializer
inline ~CommaInitializer()
{
- ei_assert((m_row+m_currentBlockRows) == m_xpr.rows()
+ eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
&& m_col == m_xpr.cols()
&& "Too few coefficients passed to comma initializer (operator<<)");
}
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index 5def0db2a..7386b2e18 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -45,56 +45,59 @@
*
* \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp
*/
+
+namespace internal {
template<typename BinaryOp, typename Lhs, typename Rhs>
-struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
+struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
{
- // we must not inherit from ei_traits<Lhs> since it has
+ // we must not inherit from traits<Lhs> since it has
// the potential to cause problems with MSVC
- typedef typename ei_cleantype<Lhs>::type Ancestor;
- typedef typename ei_traits<Ancestor>::XprKind XprKind;
+ typedef typename remove_all<Lhs>::type Ancestor;
+ typedef typename traits<Ancestor>::XprKind XprKind;
enum {
- RowsAtCompileTime = ei_traits<Ancestor>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<Ancestor>::ColsAtCompileTime,
- MaxRowsAtCompileTime = ei_traits<Ancestor>::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = ei_traits<Ancestor>::MaxColsAtCompileTime
+ RowsAtCompileTime = traits<Ancestor>::RowsAtCompileTime,
+ ColsAtCompileTime = traits<Ancestor>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = traits<Ancestor>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = traits<Ancestor>::MaxColsAtCompileTime
};
// even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor),
// we still want to handle the case when the result type is different.
- typedef typename ei_result_of<
+ typedef typename result_of<
BinaryOp(
typename Lhs::Scalar,
typename Rhs::Scalar
)
>::type Scalar;
- typedef typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind,
- typename ei_traits<Rhs>::StorageKind>::ret StorageKind;
- typedef typename ei_promote_index_type<typename ei_traits<Lhs>::Index,
- typename ei_traits<Rhs>::Index>::type Index;
+ typedef typename promote_storage_type<typename traits<Lhs>::StorageKind,
+ typename traits<Rhs>::StorageKind>::ret StorageKind;
+ typedef typename promote_index_type<typename traits<Lhs>::Index,
+ typename traits<Rhs>::Index>::type Index;
typedef typename Lhs::Nested LhsNested;
typedef typename Rhs::Nested RhsNested;
- typedef typename ei_unref<LhsNested>::type _LhsNested;
- typedef typename ei_unref<RhsNested>::type _RhsNested;
+ typedef typename remove_reference<LhsNested>::type _LhsNested;
+ typedef typename remove_reference<RhsNested>::type _RhsNested;
enum {
LhsCoeffReadCost = _LhsNested::CoeffReadCost,
RhsCoeffReadCost = _RhsNested::CoeffReadCost,
LhsFlags = _LhsNested::Flags,
RhsFlags = _RhsNested::Flags,
- SameType = ei_is_same_type<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::ret,
+ SameType = is_same<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::value,
StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit),
Flags0 = (int(LhsFlags) | int(RhsFlags)) & (
HereditaryBits
| (int(LhsFlags) & int(RhsFlags) &
( AlignedBit
| (StorageOrdersAgree ? LinearAccessBit : 0)
- | (ei_functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)
+ | (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)
)
)
),
Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
- CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + ei_functor_traits<BinaryOp>::Cost
+ CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + functor_traits<BinaryOp>::Cost
};
};
+} // end namespace internal
// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor
// that would take two operands of different types. If there were such an example, then this check should be
@@ -104,33 +107,33 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
// 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((ei_functor_allows_mixing_real_and_complex<BINOP>::ret \
- ? int(ei_is_same_type<typename NumTraits<LHS>::Real, typename NumTraits<RHS>::Real>::ret) \
- : int(ei_is_same_type<LHS, RHS>::ret)), \
+ EIGEN_STATIC_ASSERT((internal::functor_allows_mixing_real_and_complex<BINOP>::ret \
+ ? int(internal::is_same<typename NumTraits<LHS>::Real, typename NumTraits<RHS>::Real>::value) \
+ : int(internal::is_same<LHS, RHS>::value)), \
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
template<typename BinaryOp, typename Lhs, typename Rhs, typename StorageKind>
class CwiseBinaryOpImpl;
template<typename BinaryOp, typename Lhs, typename Rhs>
-class CwiseBinaryOp : ei_no_assignment_operator,
+class CwiseBinaryOp : internal::no_assignment_operator,
public CwiseBinaryOpImpl<
BinaryOp, Lhs, Rhs,
- typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind,
- typename ei_traits<Rhs>::StorageKind>::ret>
+ typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
+ typename internal::traits<Rhs>::StorageKind>::ret>
{
public:
typedef typename CwiseBinaryOpImpl<
BinaryOp, Lhs, Rhs,
- typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind,
- typename ei_traits<Rhs>::StorageKind>::ret>::Base Base;
+ typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
+ typename internal::traits<Rhs>::StorageKind>::ret>::Base Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp)
- typedef typename ei_nested<Lhs>::type LhsNested;
- typedef typename ei_nested<Rhs>::type RhsNested;
- typedef typename ei_unref<LhsNested>::type _LhsNested;
- typedef typename ei_unref<RhsNested>::type _RhsNested;
+ typedef typename internal::nested<Lhs>::type LhsNested;
+ typedef typename internal::nested<Rhs>::type RhsNested;
+ typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
+ typedef typename internal::remove_reference<RhsNested>::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)
@@ -138,19 +141,19 @@ class CwiseBinaryOp : ei_no_assignment_operator,
EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar);
// require the sizes to match
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)
- ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
+ eigen_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
}
EIGEN_STRONG_INLINE Index rows() const {
// return the fixed size type if available to enable compile time optimizations
- if (ei_traits<typename ei_cleantype<LhsNested>::type>::RowsAtCompileTime==Dynamic)
+ if (internal::traits<typename internal::remove_all<LhsNested>::type>::RowsAtCompileTime==Dynamic)
return m_rhs.rows();
else
return m_lhs.rows();
}
EIGEN_STRONG_INLINE Index cols() const {
// return the fixed size type if available to enable compile time optimizations
- if (ei_traits<typename ei_cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic)
+ if (internal::traits<typename internal::remove_all<LhsNested>::type>::ColsAtCompileTime==Dynamic)
return m_rhs.cols();
else
return m_lhs.cols();
@@ -171,12 +174,12 @@ class CwiseBinaryOp : ei_no_assignment_operator,
template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
- : public ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
+ : public internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
{
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
public:
- typedef typename ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base;
+ typedef typename internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
@@ -215,7 +218,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
{
- SelfCwiseBinaryOp<ei_scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other.derived();
return derived();
}
@@ -229,7 +232,7 @@ template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
{
- SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
tmp = other.derived();
return derived();
}
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h
index a7e6b1b6d..a2f504985 100644
--- a/Eigen/src/Core/CwiseNullaryOp.h
+++ b/Eigen/src/Core/CwiseNullaryOp.h
@@ -42,32 +42,35 @@
*
* \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr()
*/
+
+namespace internal {
template<typename NullaryOp, typename PlainObjectType>
-struct ei_traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : ei_traits<PlainObjectType>
+struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType>
{
enum {
- Flags = (ei_traits<PlainObjectType>::Flags
+ Flags = (traits<PlainObjectType>::Flags
& ( HereditaryBits
- | (ei_functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
- | (ei_functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0)))
- | (ei_functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
- CoeffReadCost = ei_functor_traits<NullaryOp>::Cost
+ | (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
+ | (functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0)))
+ | (functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
+ CoeffReadCost = functor_traits<NullaryOp>::Cost
};
};
+}
template<typename NullaryOp, typename PlainObjectType>
-class CwiseNullaryOp : ei_no_assignment_operator,
- public ei_dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type
+class CwiseNullaryOp : internal::no_assignment_operator,
+ public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type
{
public:
- typedef typename ei_dense_xpr_base<CwiseNullaryOp>::type Base;
+ typedef typename internal::dense_xpr_base<CwiseNullaryOp>::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)
{
- ei_assert(rows >= 0
+ eigen_assert(rows >= 0
&& (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
&& cols >= 0
&& (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
@@ -99,8 +102,8 @@ class CwiseNullaryOp : ei_no_assignment_operator,
}
protected:
- const ei_variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
- const ei_variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
const NullaryOp m_functor;
};
@@ -185,7 +188,7 @@ template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
{
- return DenseBase<Derived>::NullaryExpr(rows, cols, ei_scalar_constant_op<Scalar>(value));
+ return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));
}
/** \returns an expression of a constant matrix of value \a value
@@ -207,7 +210,7 @@ template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Constant(Index size, const Scalar& value)
{
- return DenseBase<Derived>::NullaryExpr(size, ei_scalar_constant_op<Scalar>(value));
+ return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
}
/** \returns an expression of a constant matrix of value \a value
@@ -224,7 +227,7 @@ EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Constant(const Scalar& value)
{
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
- return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_constant_op<Scalar>(value));
+ return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op<Scalar>(value));
}
/**
@@ -247,7 +250,7 @@ EIGEN_STRONG_INLINE const typename DenseBase<Derived>::SequentialLinSpacedReturn
DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- return DenseBase<Derived>::NullaryExpr(size, ei_linspaced_op<Scalar,false>(low,high,size));
+ return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,false>(low,high,size));
}
/**
@@ -260,7 +263,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
- return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, ei_linspaced_op<Scalar,false>(low,high,Derived::SizeAtCompileTime));
+ return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,false>(low,high,Derived::SizeAtCompileTime));
}
/**
@@ -280,7 +283,7 @@ EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedRetu
DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- return DenseBase<Derived>::NullaryExpr(size, ei_linspaced_op<Scalar,true>(low,high,size));
+ return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,true>(low,high,size));
}
/**
@@ -293,7 +296,7 @@ DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
- return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, ei_linspaced_op<Scalar,true>(low,high,Derived::SizeAtCompileTime));
+ return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,true>(low,high,Derived::SizeAtCompileTime));
}
/** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
@@ -303,7 +306,7 @@ bool DenseBase<Derived>::isApproxToConstant
{
for(Index j = 0; j < cols(); ++j)
for(Index i = 0; i < rows(); ++i)
- if(!ei_isApprox(this->coeff(i, j), value, prec))
+ if(!internal::isApprox(this->coeff(i, j), value, prec))
return false;
return true;
}
@@ -349,7 +352,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& value
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setConstant(Index size, const Scalar& value)
+PlainObjectBase<Derived>::setConstant(Index size, const Scalar& value)
{
resize(size);
return setConstant(value);
@@ -368,7 +371,7 @@ DenseStorageBase<Derived>::setConstant(Index size, const Scalar& value)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setConstant(Index rows, Index cols, const Scalar& value)
+PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& value)
{
resize(rows, cols);
return setConstant(value);
@@ -390,7 +393,7 @@ template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index size, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- return derived() = Derived::NullaryExpr(size, ei_linspaced_op<Scalar,false>(low,high,size));
+ return derived() = Derived::NullaryExpr(size, internal::linspaced_op<Scalar,false>(low,high,size));
}
// zero:
@@ -469,7 +472,7 @@ bool DenseBase<Derived>::isZero(RealScalar prec) const
{
for(Index j = 0; j < cols(); ++j)
for(Index i = 0; i < rows(); ++i)
- if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast<Scalar>(1), prec))
+ if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast<Scalar>(1), prec))
return false;
return true;
}
@@ -498,7 +501,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setZero(Index size)
+PlainObjectBase<Derived>::setZero(Index size)
{
resize(size);
return setConstant(Scalar(0));
@@ -516,7 +519,7 @@ DenseStorageBase<Derived>::setZero(Index size)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setZero(Index rows, Index cols)
+PlainObjectBase<Derived>::setZero(Index rows, Index cols)
{
resize(rows, cols);
return setConstant(Scalar(0));
@@ -624,7 +627,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setOnes(Index size)
+PlainObjectBase<Derived>::setOnes(Index size)
{
resize(size);
return setConstant(Scalar(1));
@@ -642,7 +645,7 @@ DenseStorageBase<Derived>::setOnes(Index size)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setOnes(Index rows, Index cols)
+PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
{
resize(rows, cols);
return setConstant(Scalar(1));
@@ -668,7 +671,7 @@ template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
MatrixBase<Derived>::Identity(Index rows, Index cols)
{
- return DenseBase<Derived>::NullaryExpr(rows, cols, ei_scalar_identity_op<Scalar>());
+ return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
}
/** \returns an expression of the identity matrix (not necessarily square).
@@ -686,7 +689,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
MatrixBase<Derived>::Identity()
{
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
- return MatrixBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_identity_op<Scalar>());
+ return MatrixBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op<Scalar>());
}
/** \returns true if *this is approximately equal to the identity matrix
@@ -708,12 +711,12 @@ bool MatrixBase<Derived>::isIdentity
{
if(i == j)
{
- if(!ei_isApprox(this->coeff(i, j), static_cast<Scalar>(1), prec))
+ if(!internal::isApprox(this->coeff(i, j), static_cast<Scalar>(1), prec))
return false;
}
else
{
- if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast<RealScalar>(1), prec))
+ if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast<RealScalar>(1), prec))
return false;
}
}
@@ -721,8 +724,10 @@ bool MatrixBase<Derived>::isIdentity
return true;
}
+namespace internal {
+
template<typename Derived, bool Big = (Derived::SizeAtCompileTime>=16)>
-struct ei_setIdentity_impl
+struct setIdentity_impl
{
static EIGEN_STRONG_INLINE Derived& run(Derived& m)
{
@@ -731,7 +736,7 @@ struct ei_setIdentity_impl
};
template<typename Derived>
-struct ei_setIdentity_impl<Derived, true>
+struct setIdentity_impl<Derived, true>
{
typedef typename Derived::Index Index;
static EIGEN_STRONG_INLINE Derived& run(Derived& m)
@@ -743,6 +748,8 @@ struct ei_setIdentity_impl<Derived, true>
}
};
+} // end namespace internal
+
/** Writes the identity expression (not necessarily square) into *this.
*
* Example: \include MatrixBase_setIdentity.cpp
@@ -753,7 +760,7 @@ struct ei_setIdentity_impl<Derived, true>
template<typename Derived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
{
- return ei_setIdentity_impl<Derived>::run(derived());
+ return internal::setIdentity_impl<Derived>::run(derived());
}
/** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this.
diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h
index 4c92f36bb..958571d64 100644
--- a/Eigen/src/Core/CwiseUnaryOp.h
+++ b/Eigen/src/Core/CwiseUnaryOp.h
@@ -45,33 +45,36 @@
*
* \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp
*/
+
+namespace internal {
template<typename UnaryOp, typename XprType>
-struct ei_traits<CwiseUnaryOp<UnaryOp, XprType> >
- : ei_traits<XprType>
+struct traits<CwiseUnaryOp<UnaryOp, XprType> >
+ : traits<XprType>
{
- typedef typename ei_result_of<
+ typedef typename result_of<
UnaryOp(typename XprType::Scalar)
>::type Scalar;
typedef typename XprType::Nested XprTypeNested;
- typedef typename ei_unref<XprTypeNested>::type _XprTypeNested;
+ typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;
enum {
Flags = _XprTypeNested::Flags & (
HereditaryBits | LinearAccessBit | AlignedBit
- | (ei_functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
- CoeffReadCost = _XprTypeNested::CoeffReadCost + ei_functor_traits<UnaryOp>::Cost
+ | (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
+ CoeffReadCost = _XprTypeNested::CoeffReadCost + functor_traits<UnaryOp>::Cost
};
};
+}
template<typename UnaryOp, typename XprType, typename StorageKind>
class CwiseUnaryOpImpl;
template<typename UnaryOp, typename XprType>
-class CwiseUnaryOp : ei_no_assignment_operator,
- public CwiseUnaryOpImpl<UnaryOp, XprType, typename ei_traits<XprType>::StorageKind>
+class CwiseUnaryOp : internal::no_assignment_operator,
+ public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>
{
public:
- typedef typename CwiseUnaryOpImpl<UnaryOp, XprType,typename ei_traits<XprType>::StorageKind>::Base Base;
+ typedef typename CwiseUnaryOpImpl<UnaryOp, XprType,typename internal::traits<XprType>::StorageKind>::Base Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
@@ -84,11 +87,11 @@ class CwiseUnaryOp : ei_no_assignment_operator,
const UnaryOp& functor() const { return m_functor; }
/** \returns the nested expression */
- const typename ei_cleantype<typename XprType::Nested>::type&
+ const typename internal::remove_all<typename XprType::Nested>::type&
nestedExpression() const { return m_xpr; }
/** \returns the nested expression */
- typename ei_cleantype<typename XprType::Nested>::type&
+ typename internal::remove_all<typename XprType::Nested>::type&
nestedExpression() { return m_xpr.const_cast_derived(); }
protected:
@@ -100,12 +103,12 @@ class CwiseUnaryOp : ei_no_assignment_operator,
// It can be used for any expression types implementing the dense concept.
template<typename UnaryOp, typename XprType>
class CwiseUnaryOpImpl<UnaryOp,XprType,Dense>
- : public ei_dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
+ : public internal::dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
{
public:
typedef CwiseUnaryOp<UnaryOp, XprType> Derived;
- typedef typename ei_dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
+ typedef typename internal::dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
diff --git a/Eigen/src/Core/CwiseUnaryView.h b/Eigen/src/Core/CwiseUnaryView.h
index 37c58223e..d24ef0373 100644
--- a/Eigen/src/Core/CwiseUnaryView.h
+++ b/Eigen/src/Core/CwiseUnaryView.h
@@ -38,39 +38,42 @@
*
* \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp
*/
+
+namespace internal {
template<typename ViewOp, typename MatrixType>
-struct ei_traits<CwiseUnaryView<ViewOp, MatrixType> >
- : ei_traits<MatrixType>
+struct traits<CwiseUnaryView<ViewOp, MatrixType> >
+ : traits<MatrixType>
{
- typedef typename ei_result_of<
- ViewOp(typename ei_traits<MatrixType>::Scalar)
+ typedef typename result_of<
+ ViewOp(typename traits<MatrixType>::Scalar)
>::type Scalar;
typedef typename MatrixType::Nested MatrixTypeNested;
- typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested;
enum {
- Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LvalueBit | LinearAccessBit | DirectAccessBit)),
- CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost,
- MatrixTypeInnerStride = ei_inner_stride_at_compile_time<MatrixType>::ret,
+ Flags = (traits<_MatrixTypeNested>::Flags & (HereditaryBits | LvalueBit | LinearAccessBit | DirectAccessBit)),
+ CoeffReadCost = traits<_MatrixTypeNested>::CoeffReadCost + functor_traits<ViewOp>::Cost,
+ MatrixTypeInnerStride = inner_stride_at_compile_time<MatrixType>::ret,
// need to cast the sizeof's from size_t to int explicitly, otherwise:
// "error: no integral type can represent all of the enumerator values
InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic
? int(Dynamic)
: int(MatrixTypeInnerStride)
- * int(sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar)),
- OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<MatrixType>::ret
+ * int(sizeof(typename traits<MatrixType>::Scalar) / sizeof(Scalar)),
+ OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::ret
};
};
+}
template<typename ViewOp, typename MatrixType, typename StorageKind>
class CwiseUnaryViewImpl;
template<typename ViewOp, typename MatrixType>
-class CwiseUnaryView : ei_no_assignment_operator,
- public CwiseUnaryViewImpl<ViewOp, MatrixType, typename ei_traits<MatrixType>::StorageKind>
+class CwiseUnaryView : internal::no_assignment_operator,
+ public CwiseUnaryViewImpl<ViewOp, MatrixType, typename internal::traits<MatrixType>::StorageKind>
{
public:
- typedef typename CwiseUnaryViewImpl<ViewOp, MatrixType,typename ei_traits<MatrixType>::StorageKind>::Base Base;
+ typedef typename CwiseUnaryViewImpl<ViewOp, MatrixType,typename internal::traits<MatrixType>::StorageKind>::Base Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView)
inline CwiseUnaryView(const MatrixType& mat, const ViewOp& func = ViewOp())
@@ -85,33 +88,33 @@ class CwiseUnaryView : ei_no_assignment_operator,
const ViewOp& functor() const { return m_functor; }
/** \returns the nested expression */
- const typename ei_cleantype<typename MatrixType::Nested>::type&
+ const typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() const { return m_matrix; }
/** \returns the nested expression */
- typename ei_cleantype<typename MatrixType::Nested>::type&
+ typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() { return m_matrix.const_cast_derived(); }
protected:
// FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC
- const typename ei_nested<MatrixType>::type m_matrix;
+ const typename internal::nested<MatrixType>::type m_matrix;
ViewOp m_functor;
};
template<typename ViewOp, typename MatrixType>
class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
- : public ei_dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
+ : public internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
{
public:
typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
- typedef typename ei_dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type Base;
+ typedef typename internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
inline Index innerStride() const
{
- return derived().nestedExpression().innerStride() * sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar);
+ return derived().nestedExpression().innerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar);
}
inline Index outerStride() const
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index 3ef58ab03..6e028cfac 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -40,22 +40,22 @@
*/
template<typename Derived> class DenseBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
- : public ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
- typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>
+ : public internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
+ typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>
#else
: public DenseCoeffsBase<Derived>
#endif // not EIGEN_PARSED_BY_DOXYGEN
{
public:
- using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
- typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
+ using internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
+ typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>::operator*;
class InnerIterator;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index; /**< The type of indices */
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index; /**< The type of indices */
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseCoeffsBase<Derived> Base;
@@ -93,26 +93,26 @@ template<typename Derived> class DenseBase
enum {
- RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
+ RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
/**< The number of rows at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
- ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
+ ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
/**< The number of columns at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
- SizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime>::ret),
+ SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime>::ret),
/**< This is equal to the number of coefficients, i.e. the number of
* rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
- MaxRowsAtCompileTime = ei_traits<Derived>::MaxRowsAtCompileTime,
+ MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
/**< This value is equal to the maximum possible number of rows that this expression
* might have. If this expression might have an arbitrarily high number of rows,
* this value is set to \a Dynamic.
@@ -123,7 +123,7 @@ template<typename Derived> class DenseBase
* \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime
*/
- MaxColsAtCompileTime = ei_traits<Derived>::MaxColsAtCompileTime,
+ MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
/**< This value is equal to the maximum possible number of columns that this expression
* might have. If this expression might have an arbitrarily high number of columns,
* this value is set to \a Dynamic.
@@ -134,8 +134,8 @@ template<typename Derived> class DenseBase
* \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime
*/
- MaxSizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::MaxRowsAtCompileTime,
- ei_traits<Derived>::MaxColsAtCompileTime>::ret),
+ MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
+ internal::traits<Derived>::MaxColsAtCompileTime>::ret),
/**< This value is equal to the maximum possible number of coefficients that this expression
* might have. If this expression might have an arbitrarily high number of coefficients,
* this value is set to \a Dynamic.
@@ -146,14 +146,14 @@ template<typename Derived> class DenseBase
* \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime
*/
- IsVectorAtCompileTime = ei_traits<Derived>::MaxRowsAtCompileTime == 1
- || ei_traits<Derived>::MaxColsAtCompileTime == 1,
+ IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
+ || internal::traits<Derived>::MaxColsAtCompileTime == 1,
/**< This is set to true if either the number of rows or the number of
* columns is known at compile-time to be equal to 1. Indeed, in that case,
* we are dealing with a column-vector (if there is only one column) or with
* a row-vector (if there is only one row). */
- Flags = ei_traits<Derived>::Flags,
+ Flags = internal::traits<Derived>::Flags,
/**< This stores expression \ref flags flags which may or may not be inherited by new expressions
* constructed from this one. See the \ref flags "list of flags".
*/
@@ -163,13 +163,13 @@ template<typename Derived> class DenseBase
InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? SizeAtCompileTime
: int(IsRowMajor) ? ColsAtCompileTime : RowsAtCompileTime,
- CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
+ CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
/**< This is a rough measure of how expensive it is to read one coefficient from
* this expression.
*/
- InnerStrideAtCompileTime = ei_inner_stride_at_compile_time<Derived>::ret,
- OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<Derived>::ret
+ InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
+ OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
};
/** \returns the number of nonzero coefficients which is in practice the number
@@ -209,7 +209,7 @@ template<typename Derived> class DenseBase
void resize(Index size)
{
EIGEN_ONLY_USED_FOR_DEBUG(size);
- ei_assert(size == this->size()
+ eigen_assert(size == 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
@@ -220,20 +220,20 @@ template<typename Derived> class DenseBase
{
EIGEN_ONLY_USED_FOR_DEBUG(rows);
EIGEN_ONLY_USED_FOR_DEBUG(cols);
- ei_assert(rows == this->rows() && cols == this->cols()
+ eigen_assert(rows == this->rows() && cols == this->cols()
&& "DenseBase::resize() does not actually allow to resize.");
}
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** \internal Represents a matrix with all coefficients equal to one another*/
- typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Derived> ConstantReturnType;
+ typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Derived> ConstantReturnType;
/** \internal Represents a vector with linearly spaced coefficients that allows sequential access only. */
- typedef CwiseNullaryOp<ei_linspaced_op<Scalar,false>,Derived> SequentialLinSpacedReturnType;
+ typedef CwiseNullaryOp<internal::linspaced_op<Scalar,false>,Derived> SequentialLinSpacedReturnType;
/** \internal Represents a vector with linearly spaced coefficients that allows random access. */
- typedef CwiseNullaryOp<ei_linspaced_op<Scalar,true>,Derived> RandomAccessLinSpacedReturnType;
+ typedef CwiseNullaryOp<internal::linspaced_op<Scalar,true>,Derived> RandomAccessLinSpacedReturnType;
/** \internal the return type of MatrixBase::eigenvalues() */
- typedef Matrix<typename NumTraits<typename ei_traits<Derived>::Scalar>::Real, ei_traits<Derived>::ColsAtCompileTime, 1> EigenvaluesReturnType;
+ typedef Matrix<typename NumTraits<typename internal::traits<Derived>::Scalar>::Real, internal::traits<Derived>::ColsAtCompileTime, 1> EigenvaluesReturnType;
#endif // not EIGEN_PARSED_BY_DOXYGEN
@@ -381,12 +381,12 @@ template<typename Derived> class DenseBase
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy.
*/
- EIGEN_STRONG_INLINE const typename ei_eval<Derived>::type eval() const
+ EIGEN_STRONG_INLINE const typename internal::eval<Derived>::type eval() const
{
// Even though MSVC does not honor strong inlining when the return type
// is a dynamic matrix, we desperately need strong inlining for fixed
// size types on MSVC.
- return typename ei_eval<Derived>::type(derived());
+ return typename internal::eval<Derived>::type(derived());
}
template<typename OtherDerived>
@@ -395,8 +395,8 @@ template<typename Derived> class DenseBase
inline const NestByValue<Derived> nestByValue() const;
inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
inline ForceAlignedAccess<Derived> forceAlignedAccess();
- template<bool Enable> inline const typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf() const;
- template<bool Enable> inline typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf();
+ template<bool Enable> inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf() const;
+ template<bool Enable> inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
Scalar sum() const;
Scalar mean() const;
@@ -404,17 +404,17 @@ template<typename Derived> class DenseBase
Scalar prod() const;
- typename ei_traits<Derived>::Scalar minCoeff() const;
- typename ei_traits<Derived>::Scalar maxCoeff() const;
+ typename internal::traits<Derived>::Scalar minCoeff() const;
+ typename internal::traits<Derived>::Scalar maxCoeff() const;
- typename ei_traits<Derived>::Scalar minCoeff(Index* row, Index* col) const;
- typename ei_traits<Derived>::Scalar maxCoeff(Index* row, Index* col) const;
+ typename internal::traits<Derived>::Scalar minCoeff(Index* row, Index* col) const;
+ typename internal::traits<Derived>::Scalar maxCoeff(Index* row, Index* col) const;
- typename ei_traits<Derived>::Scalar minCoeff(Index* index) const;
- typename ei_traits<Derived>::Scalar maxCoeff(Index* index) const;
+ typename internal::traits<Derived>::Scalar minCoeff(Index* index) const;
+ typename internal::traits<Derived>::Scalar maxCoeff(Index* index) const;
template<typename BinaryOp>
- typename ei_result_of<BinaryOp(typename ei_traits<Derived>::Scalar)>::type
+ typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
redux(const BinaryOp& func) const;
template<typename Visitor>
@@ -433,9 +433,9 @@ template<typename Derived> class DenseBase
const VectorwiseOp<Derived,Vertical> colwise() const;
VectorwiseOp<Derived,Vertical> colwise();
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(Index rows, Index cols);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(Index size);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random();
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(Index rows, Index cols);
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(Index size);
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random();
template<typename ThenDerived,typename ElseDerived>
const Select<Derived,ThenDerived,ElseDerived>
@@ -482,7 +482,7 @@ template<typename Derived> class DenseBase
// disable the use of evalTo for dense objects with a nice compilation error
template<typename Dest> inline void evalTo(Dest& ) const
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<Dest,void>::ret),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
+ EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
}
protected:
@@ -493,7 +493,7 @@ template<typename Derived> class DenseBase
* Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down
*/
#ifdef EIGEN_INTERNAL_DEBUGGING
- EIGEN_STATIC_ASSERT(ei_are_flags_consistent<Flags>::ret,
+ EIGEN_STATIC_ASSERT(internal::are_flags_consistent<Flags>::ret,
INVALID_MATRIXBASE_TEMPLATE_PARAMETERS)
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor))
&& EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))),
diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h
index 918b246a8..62490fb35 100644
--- a/Eigen/src/Core/DenseCoeffsBase.h
+++ b/Eigen/src/Core/DenseCoeffsBase.h
@@ -40,15 +40,23 @@ template<typename Derived>
class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
{
public:
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
- typedef typename ei_meta_if<bool(ei_traits<Derived>::Flags&LvalueBit),
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
+
+ // Explanation for this CoeffReturnType typedef.
+ // - This is the return type of the coeff() method.
+ // - The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references
+ // to coeffs, which means exactly that we can have coeff() return a const reference (as opposed to returning a value).
+ // - The is_artihmetic check is required since "const int", "const double", etc. will cause warnings on some systems
+ // while the declaration of "const T", where T is a non arithmetic type does not. Always returning "const Scalar&" is
+ // not possible, since the underlying expressions might not offer a valid address the reference could be referring to.
+ typedef typename internal::conditional<bool(internal::traits<Derived>::Flags&LvalueBit),
const Scalar&,
- typename ei_meta_if<ei_is_arithmetic<Scalar>::ret, Scalar, const Scalar>::ret
- >::ret CoeffReturnType;
- typedef typename ei_makeconst_return_type<typename ei_packet_traits<Scalar>::type>::type PacketReturnType;
+ typename internal::conditional<internal::is_arithmetic<Scalar>::value, Scalar, const Scalar>::type
+ >::type CoeffReturnType;
+ typedef typename internal::makeconst_return_type<typename internal::packet_traits<Scalar>::type>::type PacketReturnType;
typedef EigenBase<Derived> Base;
using Base::rows;
@@ -88,7 +96,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
*/
EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
return derived().coeff(row, col);
}
@@ -105,7 +113,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
*/
EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const
{
- ei_assert(row >= 0 && row < rows()
+ eigen_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
return derived().coeff(row, col);
}
@@ -128,7 +136,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
EIGEN_STRONG_INLINE CoeffReturnType
coeff(Index index) const
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
return derived().coeff(index);
}
@@ -146,7 +154,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
{
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
- ei_assert(index >= 0 && index < size());
+ eigen_assert(index >= 0 && index < size());
return derived().coeff(index);
}
@@ -163,7 +171,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
EIGEN_STRONG_INLINE CoeffReturnType
operator()(Index index) const
{
- ei_assert(index >= 0 && index < size());
+ eigen_assert(index >= 0 && index < size());
return derived().coeff(index);
}
@@ -199,7 +207,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
return derived().template packet<LoadMode>(row,col);
}
@@ -224,13 +232,13 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
return derived().template packet<LoadMode>(index);
}
protected:
// explanation: DenseBase is doing "using ..." on the methods from DenseCoeffsBase.
- // But some methods are only available in the EnableDirectAccessAPI case.
+ // But some methods are only available in the DirectAccess case.
// So we add dummy methods here with these names, so that "using... " doesn't fail.
// It's not private so that the child class DenseBase can access them, and it's not public
// either since it's an implementation detail, so has to be protected.
@@ -267,10 +275,10 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
typedef DenseCoeffsBase<Derived, ReadOnlyAccessors> Base;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
using Base::coeff;
@@ -303,7 +311,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*/
EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col)
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
return derived().coeffRef(row, col);
}
@@ -323,7 +331,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
EIGEN_STRONG_INLINE Scalar&
operator()(Index row, Index col)
{
- ei_assert(row >= 0 && row < rows()
+ eigen_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
return derived().coeffRef(row, col);
}
@@ -347,7 +355,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
EIGEN_STRONG_INLINE Scalar&
coeffRef(Index index)
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
return derived().coeffRef(index);
}
@@ -363,7 +371,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
{
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
- ei_assert(index >= 0 && index < size());
+ eigen_assert(index >= 0 && index < size());
return derived().coeffRef(index);
}
@@ -379,7 +387,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
EIGEN_STRONG_INLINE Scalar&
operator()(Index index)
{
- ei_assert(index >= 0 && index < size());
+ eigen_assert(index >= 0 && index < size());
return derived().coeffRef(index);
}
@@ -414,9 +422,9 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket
- (Index row, Index col, const typename ei_packet_traits<Scalar>::type& x)
+ (Index row, Index col, const typename internal::packet_traits<Scalar>::type& x)
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
derived().template writePacket<StoreMode>(row,col,x);
}
@@ -424,7 +432,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacketByOuterInner
- (Index outer, Index inner, const typename ei_packet_traits<Scalar>::type& x)
+ (Index outer, Index inner, const typename internal::packet_traits<Scalar>::type& x)
{
writePacket<StoreMode>(rowIndexByOuterInner(outer, inner),
colIndexByOuterInner(outer, inner),
@@ -442,9 +450,9 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket
- (Index index, const typename ei_packet_traits<Scalar>::type& x)
+ (Index index, const typename internal::packet_traits<Scalar>::type& x)
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
derived().template writePacket<StoreMode>(index,x);
}
@@ -461,7 +469,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<typename OtherDerived>
EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, const DenseBase<OtherDerived>& other)
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
derived().coeffRef(row, col) = other.derived().coeff(row, col);
}
@@ -477,7 +485,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<typename OtherDerived>
EIGEN_STRONG_INLINE void copyCoeff(Index index, const DenseBase<OtherDerived>& other)
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
derived().coeffRef(index) = other.derived().coeff(index);
}
@@ -502,7 +510,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<typename OtherDerived, int StoreMode, int LoadMode>
EIGEN_STRONG_INLINE void copyPacket(Index row, Index col, const DenseBase<OtherDerived>& other)
{
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
derived().template writePacket<StoreMode>(row, col,
other.derived().template packet<LoadMode>(row, col));
@@ -519,7 +527,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
template<typename OtherDerived, int StoreMode, int LoadMode>
EIGEN_STRONG_INLINE void copyPacket(Index index, const DenseBase<OtherDerived>& other)
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
derived().template writePacket<StoreMode>(index,
other.derived().template packet<LoadMode>(index));
}
@@ -553,8 +561,8 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
public:
typedef DenseCoeffsBase<Derived, WriteAccessors> Base;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
using Base::rows;
@@ -606,57 +614,61 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
}
};
+namespace internal {
+
template<typename Derived, bool JustReturnZero>
-struct ei_first_aligned_impl
+struct first_aligned_impl
{
inline static typename Derived::Index run(const Derived&)
{ return 0; }
};
template<typename Derived>
-struct ei_first_aligned_impl<Derived, false>
+struct first_aligned_impl<Derived, false>
{
inline static typename Derived::Index run(const Derived& m)
{
- return ei_first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size());
+ return first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size());
}
};
/** \internal \returns the index of the first element of the array that is well aligned for vectorization.
*
- * There is also the variant ei_first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more
+ * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more
* documentation.
*/
template<typename Derived>
-inline static typename Derived::Index ei_first_aligned(const Derived& m)
+inline static typename Derived::Index first_aligned(const Derived& m)
{
- return ei_first_aligned_impl
+ return first_aligned_impl
<Derived, (Derived::Flags & AlignedBit) || !(Derived::Flags & DirectAccessBit)>
::run(m);
}
-template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
-struct ei_inner_stride_at_compile_time
+template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
+struct inner_stride_at_compile_time
{
- enum { ret = ei_traits<Derived>::InnerStrideAtCompileTime };
+ enum { ret = traits<Derived>::InnerStrideAtCompileTime };
};
template<typename Derived>
-struct ei_inner_stride_at_compile_time<Derived, false>
+struct inner_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
-template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
-struct ei_outer_stride_at_compile_time
+template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
+struct outer_stride_at_compile_time
{
- enum { ret = ei_traits<Derived>::OuterStrideAtCompileTime };
+ enum { ret = traits<Derived>::OuterStrideAtCompileTime };
};
template<typename Derived>
-struct ei_outer_stride_at_compile_time<Derived, false>
+struct outer_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
+} // end namespace internal
+
#endif // EIGEN_DENSECOEFFSBASE_H
diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/DenseStorage.h
index c6e7e20b2..446335568 100644
--- a/Eigen/src/Core/MatrixStorage.h
+++ b/Eigen/src/Core/DenseStorage.h
@@ -33,7 +33,9 @@
#define EIGEN_INT_DEBUG_MATRIX_CTOR
#endif
-struct ei_constructor_without_unaligned_array_assert {};
+namespace internal {
+
+struct constructor_without_unaligned_array_assert {};
/** \internal
* Static array. If the MatrixOptions require auto-alignment, the array will be automatically aligned:
@@ -43,42 +45,44 @@ template <typename T, int Size, int MatrixOptions,
int Alignment = (MatrixOptions&DontAlign) ? 0
: (((Size*sizeof(T))%16)==0) ? 16
: 0 >
-struct ei_matrix_array
+struct matrix_array
{
T array[Size];
- ei_matrix_array() {}
- ei_matrix_array(ei_constructor_without_unaligned_array_assert) {}
+ matrix_array() {}
+ matrix_array(constructor_without_unaligned_array_assert) {}
};
#ifdef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
#else
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \
- ei_assert((reinterpret_cast<size_t>(array) & sizemask) == 0 \
+ eigen_assert((reinterpret_cast<size_t>(array) & sizemask) == 0 \
&& "this assertion is explained here: " \
"http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html" \
" **** READ THIS WEB PAGE !!! ****");
#endif
template <typename T, int Size, int MatrixOptions>
-struct ei_matrix_array<T, Size, MatrixOptions, 16>
+struct matrix_array<T, Size, MatrixOptions, 16>
{
EIGEN_ALIGN16 T array[Size];
- ei_matrix_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) }
- ei_matrix_array(ei_constructor_without_unaligned_array_assert) {}
+ matrix_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) }
+ matrix_array(constructor_without_unaligned_array_assert) {}
};
template <typename T, int MatrixOptions, int Alignment>
-struct ei_matrix_array<T, 0, MatrixOptions, Alignment>
+struct matrix_array<T, 0, MatrixOptions, Alignment>
{
EIGEN_ALIGN16 T array[1];
- ei_matrix_array() {}
- ei_matrix_array(ei_constructor_without_unaligned_array_assert) {}
+ matrix_array() {}
+ matrix_array(constructor_without_unaligned_array_assert) {}
};
+} // end namespace internal
+
/** \internal
*
- * \class ei_matrix_storage
+ * \class DenseStorage
* \ingroup Core_Module
*
* \brief Stores the data of a matrix
@@ -88,18 +92,18 @@ struct ei_matrix_array<T, 0, MatrixOptions, Alignment>
*
* \sa Matrix
*/
-template<typename T, int Size, int _Rows, int _Cols, int _Options> class ei_matrix_storage;
+template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseStorage;
// purely fixed-size matrix
-template<typename T, int Size, int _Rows, int _Cols, int _Options> class ei_matrix_storage
+template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseStorage
{
- ei_matrix_array<T,Size,_Options> m_data;
+ internal::matrix_array<T,Size,_Options> m_data;
public:
- inline explicit ei_matrix_storage() {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert)
- : m_data(ei_constructor_without_unaligned_array_assert()) {}
- inline ei_matrix_storage(DenseIndex,DenseIndex,DenseIndex) {}
- inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); }
+ inline explicit DenseStorage() {}
+ inline DenseStorage(internal::constructor_without_unaligned_array_assert)
+ : m_data(internal::constructor_without_unaligned_array_assert()) {}
+ inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
+ inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
inline static DenseIndex rows(void) {return _Rows;}
inline static DenseIndex cols(void) {return _Cols;}
inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
@@ -109,13 +113,13 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class ei_matr
};
// null matrix
-template<typename T, int _Rows, int _Cols, int _Options> class ei_matrix_storage<T, 0, _Rows, _Cols, _Options>
+template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0, _Rows, _Cols, _Options>
{
public:
- inline explicit ei_matrix_storage() {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert) {}
- inline ei_matrix_storage(DenseIndex,DenseIndex,DenseIndex) {}
- inline void swap(ei_matrix_storage& ) {}
+ inline explicit DenseStorage() {}
+ inline DenseStorage(internal::constructor_without_unaligned_array_assert) {}
+ inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
+ inline void swap(DenseStorage& ) {}
inline static DenseIndex rows(void) {return _Rows;}
inline static DenseIndex cols(void) {return _Cols;}
inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
@@ -125,17 +129,17 @@ template<typename T, int _Rows, int _Cols, int _Options> class ei_matrix_storage
};
// dynamic-size matrix with fixed-size storage
-template<typename T, int Size, int _Options> class ei_matrix_storage<T, Size, Dynamic, Dynamic, _Options>
+template<typename T, int Size, int _Options> class DenseStorage<T, Size, Dynamic, Dynamic, _Options>
{
- ei_matrix_array<T,Size,_Options> m_data;
+ internal::matrix_array<T,Size,_Options> m_data;
DenseIndex m_rows;
DenseIndex m_cols;
public:
- inline explicit ei_matrix_storage() : m_rows(0), m_cols(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert)
- : m_data(ei_constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
- inline ei_matrix_storage(DenseIndex, DenseIndex rows, DenseIndex cols) : m_rows(rows), m_cols(cols) {}
- inline void swap(ei_matrix_storage& other)
+ inline explicit 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 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;}
@@ -146,16 +150,16 @@ template<typename T, int Size, int _Options> class ei_matrix_storage<T, Size, Dy
};
// dynamic-size matrix with fixed-size storage and fixed width
-template<typename T, int Size, int _Cols, int _Options> class ei_matrix_storage<T, Size, Dynamic, _Cols, _Options>
+template<typename T, int Size, int _Cols, int _Options> class DenseStorage<T, Size, Dynamic, _Cols, _Options>
{
- ei_matrix_array<T,Size,_Options> m_data;
+ internal::matrix_array<T,Size,_Options> m_data;
DenseIndex m_rows;
public:
- inline explicit ei_matrix_storage() : m_rows(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert)
- : m_data(ei_constructor_without_unaligned_array_assert()), m_rows(0) {}
- inline ei_matrix_storage(DenseIndex, DenseIndex rows, DenseIndex) : m_rows(rows) {}
- inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
+ inline explicit 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 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; }
@@ -165,16 +169,16 @@ template<typename T, int Size, int _Cols, int _Options> class ei_matrix_storage<
};
// dynamic-size matrix with fixed-size storage and fixed height
-template<typename T, int Size, int _Rows, int _Options> class ei_matrix_storage<T, Size, _Rows, Dynamic, _Options>
+template<typename T, int Size, int _Rows, int _Options> class DenseStorage<T, Size, _Rows, Dynamic, _Options>
{
- ei_matrix_array<T,Size,_Options> m_data;
+ internal::matrix_array<T,Size,_Options> m_data;
DenseIndex m_cols;
public:
- inline explicit ei_matrix_storage() : m_cols(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert)
- : m_data(ei_constructor_without_unaligned_array_assert()), m_cols(0) {}
- inline ei_matrix_storage(DenseIndex, DenseIndex, DenseIndex cols) : m_cols(cols) {}
- inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
+ inline explicit 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 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; }
@@ -184,26 +188,26 @@ template<typename T, int Size, int _Rows, int _Options> class ei_matrix_storage<
};
// purely dynamic matrix.
-template<typename T, int _Options> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic, _Options>
+template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynamic, _Options>
{
T *m_data;
DenseIndex m_rows;
DenseIndex m_cols;
public:
- inline explicit ei_matrix_storage() : m_data(0), m_rows(0), m_cols(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert)
+ inline explicit 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 ei_matrix_storage(DenseIndex size, DenseIndex rows, DenseIndex cols)
- : m_data(ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size)), m_rows(rows), m_cols(cols)
+ inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex cols)
+ : m_data(internal::conditional_aligned_new<T,(_Options&DontAlign)==0>(size)), m_rows(rows), m_cols(cols)
{ EIGEN_INT_DEBUG_MATRIX_CTOR }
- inline ~ei_matrix_storage() { ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
- inline void swap(ei_matrix_storage& other)
+ inline ~DenseStorage() { internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(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)
{
- m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
+ m_data = internal::conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
m_rows = rows;
m_cols = cols;
}
@@ -211,9 +215,9 @@ template<typename T, int _Options> class ei_matrix_storage<T, Dynamic, Dynamic,
{
if(size != m_rows*m_cols)
{
- ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
+ internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
if (size)
- m_data = ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
+ m_data = internal::conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INT_DEBUG_MATRIX_CTOR
@@ -226,31 +230,31 @@ template<typename T, int _Options> class ei_matrix_storage<T, Dynamic, Dynamic,
};
// matrix with dynamic width and fixed height (so that matrix has dynamic size).
-template<typename T, int _Rows, int _Options> class ei_matrix_storage<T, Dynamic, _Rows, Dynamic, _Options>
+template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Rows, Dynamic, _Options>
{
T *m_data;
DenseIndex m_cols;
public:
- inline explicit ei_matrix_storage() : m_data(0), m_cols(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
- inline ei_matrix_storage(DenseIndex size, DenseIndex, DenseIndex cols) : m_data(ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size)), m_cols(cols)
+ inline explicit 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<T,(_Options&DontAlign)==0>(size)), m_cols(cols)
{ EIGEN_INT_DEBUG_MATRIX_CTOR }
- inline ~ei_matrix_storage() { ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
- inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
+ inline ~DenseStorage() { internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
+ inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
inline static DenseIndex rows(void) {return _Rows;}
inline DenseIndex cols(void) const {return m_cols;}
inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex cols)
{
- m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
+ m_data = internal::conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
m_cols = cols;
}
EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex cols)
{
if(size != _Rows*m_cols)
{
- ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
+ internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
if (size)
- m_data = ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
+ m_data = internal::conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INT_DEBUG_MATRIX_CTOR
@@ -262,31 +266,31 @@ template<typename T, int _Rows, int _Options> class ei_matrix_storage<T, Dynamic
};
// matrix with dynamic height and fixed width (so that matrix has dynamic size).
-template<typename T, int _Cols, int _Options> class ei_matrix_storage<T, Dynamic, Dynamic, _Cols, _Options>
+template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dynamic, _Cols, _Options>
{
T *m_data;
DenseIndex m_rows;
public:
- inline explicit ei_matrix_storage() : m_data(0), m_rows(0) {}
- inline ei_matrix_storage(ei_constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
- inline ei_matrix_storage(DenseIndex size, DenseIndex rows, DenseIndex) : m_data(ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size)), m_rows(rows)
+ inline explicit 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<T,(_Options&DontAlign)==0>(size)), m_rows(rows)
{ EIGEN_INT_DEBUG_MATRIX_CTOR }
- inline ~ei_matrix_storage() { ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
- inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
+ inline ~DenseStorage() { internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(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;}
inline static DenseIndex cols(void) {return _Cols;}
inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex)
{
- m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
+ m_data = internal::conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
m_rows = rows;
}
EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex rows, DenseIndex)
{
if(size != m_rows*_Cols)
{
- ei_conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
+ internal::conditional_aligned_delete<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
if (size)
- m_data = ei_conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
+ m_data = internal::conditional_aligned_new<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INT_DEBUG_MATRIX_CTOR
diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h
index 0b7d14179..158bc6df7 100644
--- a/Eigen/src/Core/Diagonal.h
+++ b/Eigen/src/Core/Diagonal.h
@@ -43,12 +43,14 @@
*
* \sa MatrixBase::diagonal(), MatrixBase::diagonal(Index)
*/
+
+namespace internal {
template<typename MatrixType, int DiagIndex>
-struct ei_traits<Diagonal<MatrixType,DiagIndex> >
- : ei_traits<MatrixType>
+struct traits<Diagonal<MatrixType,DiagIndex> >
+ : traits<MatrixType>
{
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
typedef typename MatrixType::StorageKind StorageKind;
enum {
AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic
@@ -64,18 +66,19 @@ struct ei_traits<Diagonal<MatrixType,DiagIndex> >
MaxColsAtCompileTime = 1,
Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | LvalueBit | DirectAccessBit) & ~RowMajorBit,
CoeffReadCost = _MatrixTypeNested::CoeffReadCost,
- MatrixTypeOuterStride = ei_outer_stride_at_compile_time<MatrixType>::ret,
+ MatrixTypeOuterStride = outer_stride_at_compile_time<MatrixType>::ret,
InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1,
OuterStrideAtCompileTime = 0
};
};
+}
template<typename MatrixType, int DiagIndex> class Diagonal
- : public ei_dense_xpr_base< Diagonal<MatrixType,DiagIndex> >::type
+ : public internal::dense_xpr_base< Diagonal<MatrixType,DiagIndex> >::type
{
public:
- typedef typename ei_dense_xpr_base<Diagonal>::type Base;
+ typedef typename internal::dense_xpr_base<Diagonal>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal)
inline Diagonal(const MatrixType& matrix, Index index = DiagIndex) : m_matrix(matrix), m_index(index) {}
@@ -119,7 +122,7 @@ template<typename MatrixType, int DiagIndex> class Diagonal
protected:
const typename MatrixType::Nested m_matrix;
- const ei_variable_if_dynamic<Index, DiagIndex> m_index;
+ const internal::variable_if_dynamic<Index, DiagIndex> m_index;
private:
// some compilers may fail to optimize std::max etc in case of compile-time constants...
diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h
index 630c172ed..af16cf563 100644
--- a/Eigen/src/Core/DiagonalMatrix.h
+++ b/Eigen/src/Core/DiagonalMatrix.h
@@ -31,10 +31,10 @@ template<typename Derived>
class DiagonalBase : public EigenBase<Derived>
{
public:
- typedef typename ei_traits<Derived>::DiagonalVectorType DiagonalVectorType;
+ typedef typename internal::traits<Derived>::DiagonalVectorType DiagonalVectorType;
typedef typename DiagonalVectorType::Scalar Scalar;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
enum {
RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
@@ -70,7 +70,7 @@ class DiagonalBase : public EigenBase<Derived>
const DiagonalProduct<MatrixDerived, Derived, OnTheLeft>
operator*(const MatrixBase<MatrixDerived> &matrix) const;
- inline const DiagonalWrapper<CwiseUnaryOp<ei_scalar_inverse_op<Scalar>, DiagonalVectorType> >
+ inline const DiagonalWrapper<CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, DiagonalVectorType> >
inverse() const
{
return diagonal().cwiseInverse();
@@ -98,9 +98,11 @@ void DiagonalBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
*
* \sa class DiagonalWrapper
*/
+
+namespace internal {
template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime>
-struct ei_traits<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
- : ei_traits<Matrix<_Scalar,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
+struct traits<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
+ : traits<Matrix<_Scalar,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
{
typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType;
typedef Dense StorageKind;
@@ -109,18 +111,18 @@ struct ei_traits<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime>
Flags = LvalueBit
};
};
-
+}
template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime>
class DiagonalMatrix
: public DiagonalBase<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
{
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
- typedef typename ei_traits<DiagonalMatrix>::DiagonalVectorType DiagonalVectorType;
+ typedef typename internal::traits<DiagonalMatrix>::DiagonalVectorType DiagonalVectorType;
typedef const DiagonalMatrix& Nested;
typedef _Scalar Scalar;
- typedef typename ei_traits<DiagonalMatrix>::StorageKind StorageKind;
- typedef typename ei_traits<DiagonalMatrix>::Index Index;
+ typedef typename internal::traits<DiagonalMatrix>::StorageKind StorageKind;
+ typedef typename internal::traits<DiagonalMatrix>::Index Index;
#endif
protected:
@@ -204,8 +206,10 @@ class DiagonalMatrix
*
* \sa class DiagonalMatrix, class DiagonalBase, MatrixBase::asDiagonal()
*/
+
+namespace internal {
template<typename _DiagonalVectorType>
-struct ei_traits<DiagonalWrapper<_DiagonalVectorType> >
+struct traits<DiagonalWrapper<_DiagonalVectorType> >
{
typedef _DiagonalVectorType DiagonalVectorType;
typedef typename DiagonalVectorType::Scalar Scalar;
@@ -216,13 +220,14 @@ struct ei_traits<DiagonalWrapper<_DiagonalVectorType> >
ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
MaxRowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
MaxColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
- Flags = ei_traits<DiagonalVectorType>::Flags & LvalueBit
+ Flags = traits<DiagonalVectorType>::Flags & LvalueBit
};
};
+}
template<typename _DiagonalVectorType>
class DiagonalWrapper
- : public DiagonalBase<DiagonalWrapper<_DiagonalVectorType> >, ei_no_assignment_operator
+ : public DiagonalBase<DiagonalWrapper<_DiagonalVectorType> >, internal::no_assignment_operator
{
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
@@ -265,21 +270,20 @@ MatrixBase<Derived>::asDiagonal() const
* \sa asDiagonal()
*/
template<typename Derived>
-bool MatrixBase<Derived>::isDiagonal
-(RealScalar prec) const
+bool MatrixBase<Derived>::isDiagonal(RealScalar prec) const
{
if(cols() != rows()) return false;
RealScalar maxAbsOnDiagonal = static_cast<RealScalar>(-1);
for(Index j = 0; j < cols(); ++j)
{
- RealScalar absOnDiagonal = ei_abs(coeff(j,j));
+ RealScalar absOnDiagonal = internal::abs(coeff(j,j));
if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal;
}
for(Index j = 0; j < cols(); ++j)
for(Index i = 0; i < j; ++i)
{
- if(!ei_isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false;
- if(!ei_isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false;
+ if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false;
+ if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false;
}
return true;
}
diff --git a/Eigen/src/Core/DiagonalProduct.h b/Eigen/src/Core/DiagonalProduct.h
index 14c49e828..de0c6ed11 100644
--- a/Eigen/src/Core/DiagonalProduct.h
+++ b/Eigen/src/Core/DiagonalProduct.h
@@ -26,11 +26,12 @@
#ifndef EIGEN_DIAGONALPRODUCT_H
#define EIGEN_DIAGONALPRODUCT_H
+namespace internal {
template<typename MatrixType, typename DiagonalType, int ProductOrder>
-struct ei_traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
- : ei_traits<MatrixType>
+struct traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
+ : traits<MatrixType>
{
- typedef typename ei_scalar_product_traits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
+ typedef typename scalar_product_traits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
enum {
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
@@ -40,7 +41,7 @@ struct ei_traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
_StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor,
_PacketOnDiag = !((int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft)
||(int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)),
- _SameTypes = ei_is_same_type<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ret,
+ _SameTypes = is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::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))),
@@ -49,9 +50,10 @@ struct ei_traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
CoeffReadCost = NumTraits<Scalar>::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost
};
};
+}
template<typename MatrixType, typename DiagonalType, int ProductOrder>
-class DiagonalProduct : ei_no_assignment_operator,
+class DiagonalProduct : internal::no_assignment_operator,
public MatrixBase<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
{
public:
@@ -62,7 +64,7 @@ class DiagonalProduct : ei_no_assignment_operator,
inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal)
: m_matrix(matrix), m_diagonal(diagonal)
{
- ei_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols()));
+ eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols()));
}
inline Index rows() const { return m_matrix.rows(); }
@@ -81,27 +83,27 @@ class DiagonalProduct : ei_no_assignment_operator,
};
const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col;
- return packet_impl<LoadMode>(row,col,indexInDiagonalVector,typename ei_meta_if<
+ return packet_impl<LoadMode>(row,col,indexInDiagonalVector,typename internal::conditional<
((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft)
- ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), ei_meta_true, ei_meta_false>::ret());
+ ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type());
}
protected:
template<int LoadMode>
- EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, ei_meta_true) const
+ EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const
{
- return ei_pmul(m_matrix.template packet<LoadMode>(row, col),
- ei_pset1<PacketScalar>(m_diagonal.diagonal().coeff(id)));
+ return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
+ internal::pset1<PacketScalar>(m_diagonal.diagonal().coeff(id)));
}
template<int LoadMode>
- EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, ei_meta_false) const
+ EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const
{
enum {
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
DiagonalVectorPacketLoadMode = (LoadMode == Aligned && ((InnerSize%16) == 0)) ? Aligned : Unaligned
};
- return ei_pmul(m_matrix.template packet<LoadMode>(row, col),
+ return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
}
diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h
index 9fc2fb60e..74d5652c1 100644
--- a/Eigen/src/Core/Dot.h
+++ b/Eigen/src/Core/Dot.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_DOT_H
#define EIGEN_DOT_H
+namespace internal {
+
// helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot
// with mismatched types, the compiler emits errors about failing to instantiate cwiseProduct BEFORE
// looking at the static assertions. Thus this is a trick to get better compile errors.
@@ -37,23 +39,25 @@ template<typename T, typename U,
// revert to || as soon as not needed anymore.
(int(T::ColsAtCompileTime) == 1 && int(U::RowsAtCompileTime) == 1))
>
-struct ei_dot_nocheck
+struct dot_nocheck
{
- static inline typename ei_traits<T>::Scalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
+ static inline typename traits<T>::Scalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
{
- return a.template binaryExpr<ei_scalar_conj_product_op<typename ei_traits<T>::Scalar> >(b).sum();
+ return a.template binaryExpr<scalar_conj_product_op<typename traits<T>::Scalar> >(b).sum();
}
};
template<typename T, typename U>
-struct ei_dot_nocheck<T, U, true>
+struct dot_nocheck<T, U, true>
{
- static inline typename ei_traits<T>::Scalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
+ static inline typename traits<T>::Scalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
{
- return a.transpose().template binaryExpr<ei_scalar_conj_product_op<typename ei_traits<T>::Scalar> >(b).sum();
+ return a.transpose().template binaryExpr<scalar_conj_product_op<typename traits<T>::Scalar> >(b).sum();
}
};
+} // end namespace internal
+
/** \returns the dot product of *this with other.
*
* \only_for_vectors
@@ -66,18 +70,18 @@ struct ei_dot_nocheck<T, U, true>
*/
template<typename Derived>
template<typename OtherDerived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
- EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename OtherDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- ei_assert(size() == other.size());
+ eigen_assert(size() == other.size());
- return ei_dot_nocheck<Derived,OtherDerived>::run(*this, other);
+ return internal::dot_nocheck<Derived,OtherDerived>::run(*this, other);
}
//---------- implementation of L2 norm and related functions ----------
@@ -87,9 +91,9 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
* \sa dot(), norm()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
+EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
{
- return ei_real((*this).cwiseAbs2().sum());
+ return internal::real((*this).cwiseAbs2().sum());
}
/** \returns the \em l2 norm of *this, i.e., for vectors, the square root of the dot product of *this with itself.
@@ -97,9 +101,9 @@ EIGEN_STRONG_INLINE typename NumTraits<typename ei_traits<Derived>::Scalar>::Rea
* \sa dot(), squaredNorm()
*/
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
{
- return ei_sqrt(squaredNorm());
+ return internal::sqrt(squaredNorm());
}
/** \returns an expression of the quotient of *this by its own norm.
@@ -112,8 +116,8 @@ template<typename Derived>
inline const typename MatrixBase<Derived>::PlainObject
MatrixBase<Derived>::normalized() const
{
- typedef typename ei_nested<Derived>::type Nested;
- typedef typename ei_unref<Nested>::type _Nested;
+ typedef typename internal::nested<Derived>::type Nested;
+ typedef typename internal::remove_reference<Nested>::type _Nested;
_Nested n(derived());
return n / n.norm();
}
@@ -132,55 +136,59 @@ inline void MatrixBase<Derived>::normalize()
//---------- implementation of other norms ----------
+namespace internal {
+
template<typename Derived, int p>
-struct ei_lpNorm_selector
+struct lpNorm_selector
{
- typedef typename NumTraits<typename ei_traits<Derived>::Scalar>::Real RealScalar;
+ typedef typename NumTraits<typename traits<Derived>::Scalar>::Real RealScalar;
inline static RealScalar run(const MatrixBase<Derived>& m)
{
- return ei_pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p);
+ return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p);
}
};
template<typename Derived>
-struct ei_lpNorm_selector<Derived, 1>
+struct lpNorm_selector<Derived, 1>
{
- inline static typename NumTraits<typename ei_traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+ inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
{
return m.cwiseAbs().sum();
}
};
template<typename Derived>
-struct ei_lpNorm_selector<Derived, 2>
+struct lpNorm_selector<Derived, 2>
{
- inline static typename NumTraits<typename ei_traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+ inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
{
return m.norm();
}
};
template<typename Derived>
-struct ei_lpNorm_selector<Derived, Infinity>
+struct lpNorm_selector<Derived, Infinity>
{
- inline static typename NumTraits<typename ei_traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
+ inline static typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
{
return m.cwiseAbs().maxCoeff();
}
};
+} // end namespace internal
+
/** \returns the \f$ \ell^p \f$ norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values
- * of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^p\infty \f$
+ * of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$
* norm, that is the maximum of the absolute values of the coefficients of *this.
*
* \sa norm()
*/
template<typename Derived>
template<int p>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
MatrixBase<Derived>::lpNorm() const
{
- return ei_lpNorm_selector<Derived, p>::run(*this);
+ return internal::lpNorm_selector<Derived, p>::run(*this);
}
//---------- implementation of isOrthogonal / isUnitary ----------
@@ -196,9 +204,9 @@ template<typename OtherDerived>
bool MatrixBase<Derived>::isOrthogonal
(const MatrixBase<OtherDerived>& other, RealScalar prec) const
{
- typename ei_nested<Derived,2>::type nested(derived());
- typename ei_nested<OtherDerived,2>::type otherNested(other.derived());
- return ei_abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm();
+ typename internal::nested<Derived,2>::type nested(derived());
+ typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
+ return internal::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm();
}
/** \returns true if *this is approximately an unitary matrix,
@@ -218,10 +226,10 @@ bool MatrixBase<Derived>::isUnitary(RealScalar prec) const
typename Derived::Nested nested(derived());
for(Index i = 0; i < cols(); ++i)
{
- if(!ei_isApprox(nested.col(i).squaredNorm(), static_cast<RealScalar>(1), prec))
+ if(!internal::isApprox(nested.col(i).squaredNorm(), static_cast<RealScalar>(1), prec))
return false;
for(Index j = 0; j < i; ++j)
- if(!ei_isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast<Scalar>(1), prec))
+ if(!internal::isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast<Scalar>(1), prec))
return false;
}
return true;
diff --git a/Eigen/src/Core/EigenBase.h b/Eigen/src/Core/EigenBase.h
index d07fea9a2..69e964350 100644
--- a/Eigen/src/Core/EigenBase.h
+++ b/Eigen/src/Core/EigenBase.h
@@ -39,10 +39,10 @@
*/
template<typename Derived> struct EigenBase
{
-// typedef typename ei_plain_matrix_type<Derived>::type PlainObject;
+// typedef typename internal::plain_matrix_type<Derived>::type PlainObject;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
/** \returns a reference to the derived object */
Derived& derived() { return *static_cast<Derived*>(this); }
diff --git a/Eigen/src/Core/Flagged.h b/Eigen/src/Core/Flagged.h
index 9211c50e8..208f51afb 100644
--- a/Eigen/src/Core/Flagged.h
+++ b/Eigen/src/Core/Flagged.h
@@ -40,11 +40,14 @@
*
* \sa MatrixBase::flagged()
*/
+
+namespace internal {
template<typename ExpressionType, unsigned int Added, unsigned int Removed>
-struct ei_traits<Flagged<ExpressionType, Added, Removed> > : ei_traits<ExpressionType>
+struct traits<Flagged<ExpressionType, Added, Removed> > : traits<ExpressionType>
{
enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
};
+}
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
: public MatrixBase<Flagged<ExpressionType, Added, Removed> >
@@ -53,8 +56,8 @@ template<typename ExpressionType, unsigned int Added, unsigned int Removed> clas
typedef MatrixBase<Flagged> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Flagged)
- typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
- ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
+ typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
+ ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
typedef typename ExpressionType::InnerIterator InnerIterator;
inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {}
diff --git a/Eigen/src/Core/ForceAlignedAccess.h b/Eigen/src/Core/ForceAlignedAccess.h
index 06d78fbe2..2a6f1cf4e 100644
--- a/Eigen/src/Core/ForceAlignedAccess.h
+++ b/Eigen/src/Core/ForceAlignedAccess.h
@@ -37,16 +37,19 @@
*
* \sa MatrixBase::forceAlignedAccess()
*/
+
+namespace internal {
template<typename ExpressionType>
-struct ei_traits<ForceAlignedAccess<ExpressionType> > : public ei_traits<ExpressionType>
+struct traits<ForceAlignedAccess<ExpressionType> > : public traits<ExpressionType>
{};
+}
template<typename ExpressionType> class ForceAlignedAccess
- : public ei_dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
+ : public internal::dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
{
public:
- typedef typename ei_dense_xpr_base<ForceAlignedAccess>::type Base;
+ typedef typename internal::dense_xpr_base<ForceAlignedAccess>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
@@ -134,7 +137,7 @@ MatrixBase<Derived>::forceAlignedAccess()
*/
template<typename Derived>
template<bool Enable>
-inline typename ei_makeconst<typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret>::type
+inline typename internal::add_const<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
MatrixBase<Derived>::forceAlignedAccessIf() const
{
return derived();
@@ -145,7 +148,7 @@ MatrixBase<Derived>::forceAlignedAccessIf() const
*/
template<typename Derived>
template<bool Enable>
-inline typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret
+inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
MatrixBase<Derived>::forceAlignedAccessIf()
{
return derived();
diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h
index 41ae4af42..f2aaea145 100644
--- a/Eigen/src/Core/Functors.h
+++ b/Eigen/src/Core/Functors.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_FUNCTORS_H
#define EIGEN_FUNCTORS_H
+namespace internal {
+
// associative functors:
/** \internal
@@ -32,21 +34,21 @@
*
* \sa class CwiseBinaryOp, MatrixBase::operator+, class VectorwiseOp, MatrixBase::sum()
*/
-template<typename Scalar> struct ei_scalar_sum_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_sum_op)
+template<typename Scalar> struct scalar_sum_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_padd(a,b); }
+ { return internal::padd(a,b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const
- { return ei_predux(a); }
+ { return internal::predux(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_sum_op<Scalar> > {
+struct functor_traits<scalar_sum_op<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasAdd
+ PacketAccess = packet_traits<Scalar>::HasAdd
};
};
@@ -55,47 +57,47 @@ struct ei_functor_traits<ei_scalar_sum_op<Scalar> > {
*
* \sa class CwiseBinaryOp, Cwise::operator*(), class VectorwiseOp, MatrixBase::redux()
*/
-template<typename LhsScalar,typename RhsScalar> struct ei_scalar_product_op {
+template<typename LhsScalar,typename RhsScalar> struct scalar_product_op {
enum {
- Vectorizable = ei_is_same_type<LhsScalar,RhsScalar>::ret && ei_packet_traits<LhsScalar>::HasMul && ei_packet_traits<RhsScalar>::HasMul
+ Vectorizable = is_same<LhsScalar,RhsScalar>::value && packet_traits<LhsScalar>::HasMul && packet_traits<RhsScalar>::HasMul
};
- typedef typename ei_scalar_product_traits<LhsScalar,RhsScalar>::ReturnType result_type;
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_product_op)
+ typedef typename scalar_product_traits<LhsScalar,RhsScalar>::ReturnType result_type;
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op)
EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_pmul(a,b); }
+ { return internal::pmul(a,b); }
template<typename Packet>
EIGEN_STRONG_INLINE const result_type predux(const Packet& a) const
- { return ei_predux_mul(a); }
+ { return internal::predux_mul(a); }
};
template<typename LhsScalar,typename RhsScalar>
-struct ei_functor_traits<ei_scalar_product_op<LhsScalar,RhsScalar> > {
+struct functor_traits<scalar_product_op<LhsScalar,RhsScalar> > {
enum {
Cost = (NumTraits<LhsScalar>::MulCost + NumTraits<RhsScalar>::MulCost)/2, // rough estimate!
- PacketAccess = ei_scalar_product_op<LhsScalar,RhsScalar>::Vectorizable
+ PacketAccess = scalar_product_op<LhsScalar,RhsScalar>::Vectorizable
};
};
/** \internal
* \brief Template functor to compute the conjugate product of two scalars
*
- * This is a short cut for ei_conj(x) * y which is needed for optimization purpose
+ * This is a short cut for conj(x) * y which is needed for optimization purpose
*/
-template<typename Scalar> struct ei_scalar_conj_product_op {
+template<typename Scalar> struct scalar_conj_product_op {
enum { Conj = NumTraits<Scalar>::IsComplex };
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_conj_product_op)
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_conj_product_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const
- { return ei_conj_helper<Scalar,Scalar,Conj,false>().pmul(a,b); }
+ { return conj_helper<Scalar,Scalar,Conj,false>().pmul(a,b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_conj_helper<Packet,Packet,Conj,false>().pmul(a,b); }
+ { return conj_helper<Packet,Packet,Conj,false>().pmul(a,b); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_conj_product_op<Scalar> > {
+struct functor_traits<scalar_conj_product_op<Scalar> > {
enum {
Cost = NumTraits<Scalar>::MulCost,
- PacketAccess = ei_packet_traits<Scalar>::HasMul
+ PacketAccess = packet_traits<Scalar>::HasMul
};
};
@@ -104,21 +106,21 @@ struct ei_functor_traits<ei_scalar_conj_product_op<Scalar> > {
*
* \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class VectorwiseOp, MatrixBase::minCoeff()
*/
-template<typename Scalar> struct ei_scalar_min_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_min_op)
+template<typename Scalar> struct scalar_min_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_min_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_pmin(a,b); }
+ { return internal::pmin(a,b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const
- { return ei_predux_min(a); }
+ { return internal::predux_min(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_min_op<Scalar> > {
+struct functor_traits<scalar_min_op<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasMin
+ PacketAccess = packet_traits<Scalar>::HasMin
};
};
@@ -127,21 +129,21 @@ struct ei_functor_traits<ei_scalar_min_op<Scalar> > {
*
* \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class VectorwiseOp, MatrixBase::maxCoeff()
*/
-template<typename Scalar> struct ei_scalar_max_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_max_op)
+template<typename Scalar> struct scalar_max_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_max_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_pmax(a,b); }
+ { return internal::pmax(a,b); }
template<typename Packet>
EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const
- { return ei_predux_max(a); }
+ { return internal::predux_max(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_max_op<Scalar> > {
+struct functor_traits<scalar_max_op<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasMax
+ PacketAccess = packet_traits<Scalar>::HasMax
};
};
@@ -150,19 +152,19 @@ struct ei_functor_traits<ei_scalar_max_op<Scalar> > {
*
* \sa MatrixBase::stableNorm(), class Redux
*/
-template<typename Scalar> struct ei_scalar_hypot_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_hypot_op)
+template<typename Scalar> struct scalar_hypot_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_hypot_op)
// typedef typename NumTraits<Scalar>::Real result_type;
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const
{
Scalar p = std::max(_x, _y);
Scalar q = std::min(_x, _y);
Scalar qp = q/p;
- return p * ei_sqrt(Scalar(1) + qp*qp);
+ return p * sqrt(Scalar(1) + qp*qp);
}
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_hypot_op<Scalar> > {
+struct functor_traits<scalar_hypot_op<Scalar> > {
enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess=0 };
};
@@ -173,18 +175,18 @@ struct ei_functor_traits<ei_scalar_hypot_op<Scalar> > {
*
* \sa class CwiseBinaryOp, MatrixBase::operator-
*/
-template<typename Scalar> struct ei_scalar_difference_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_difference_op)
+template<typename Scalar> struct scalar_difference_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_difference_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_psub(a,b); }
+ { return internal::psub(a,b); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_difference_op<Scalar> > {
+struct functor_traits<scalar_difference_op<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasSub
+ PacketAccess = packet_traits<Scalar>::HasSub
};
};
@@ -193,18 +195,18 @@ struct ei_functor_traits<ei_scalar_difference_op<Scalar> > {
*
* \sa class CwiseBinaryOp, Cwise::operator/()
*/
-template<typename Scalar> struct ei_scalar_quotient_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_quotient_op)
+template<typename Scalar> struct scalar_quotient_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const
- { return ei_pdiv(a,b); }
+ { return internal::pdiv(a,b); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_quotient_op<Scalar> > {
+struct functor_traits<scalar_quotient_op<Scalar> > {
enum {
Cost = 2 * NumTraits<Scalar>::MulCost,
- PacketAccess = ei_packet_traits<Scalar>::HasDiv
+ PacketAccess = packet_traits<Scalar>::HasDiv
};
};
@@ -215,18 +217,18 @@ struct ei_functor_traits<ei_scalar_quotient_op<Scalar> > {
*
* \sa class CwiseUnaryOp, MatrixBase::operator-
*/
-template<typename Scalar> struct ei_scalar_opposite_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_opposite_op)
+template<typename Scalar> struct scalar_opposite_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_opposite_op)
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
- { return ei_pnegate(a); }
+ { return internal::pnegate(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_opposite_op<Scalar> >
+struct functor_traits<scalar_opposite_op<Scalar> >
{ enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasNegate };
+ PacketAccess = packet_traits<Scalar>::HasNegate };
};
/** \internal
@@ -234,20 +236,20 @@ struct ei_functor_traits<ei_scalar_opposite_op<Scalar> >
*
* \sa class CwiseUnaryOp, Cwise::abs
*/
-template<typename Scalar> struct ei_scalar_abs_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_abs_op)
+template<typename Scalar> struct scalar_abs_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return ei_abs(a); }
+ EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs(a); }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
- { return ei_pabs(a); }
+ { return internal::pabs(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_abs_op<Scalar> >
+struct functor_traits<scalar_abs_op<Scalar> >
{
enum {
Cost = NumTraits<Scalar>::AddCost,
- PacketAccess = ei_packet_traits<Scalar>::HasAbs
+ PacketAccess = packet_traits<Scalar>::HasAbs
};
};
@@ -256,35 +258,35 @@ struct ei_functor_traits<ei_scalar_abs_op<Scalar> >
*
* \sa class CwiseUnaryOp, Cwise::abs2
*/
-template<typename Scalar> struct ei_scalar_abs2_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_abs2_op)
+template<typename Scalar> struct scalar_abs2_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return ei_abs2(a); }
+ EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs2(a); }
template<typename Packet>
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
- { return ei_pmul(a,a); }
+ { return internal::pmul(a,a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_abs2_op<Scalar> >
-{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasAbs2 }; };
+struct functor_traits<scalar_abs2_op<Scalar> >
+{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasAbs2 }; };
/** \internal
* \brief Template functor to compute the conjugate of a complex value
*
* \sa class CwiseUnaryOp, MatrixBase::conjugate()
*/
-template<typename Scalar> struct ei_scalar_conjugate_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_conjugate_op)
- EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return ei_conj(a); }
+template<typename Scalar> struct scalar_conjugate_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op)
+ EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return conj(a); }
template<typename Packet>
- EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return ei_pconj(a); }
+ EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> >
+struct functor_traits<scalar_conjugate_op<Scalar> >
{
enum {
Cost = NumTraits<Scalar>::IsComplex ? NumTraits<Scalar>::AddCost : 0,
- PacketAccess = ei_packet_traits<Scalar>::HasConj
+ PacketAccess = packet_traits<Scalar>::HasConj
};
};
@@ -294,14 +296,14 @@ struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::cast()
*/
template<typename Scalar, typename NewType>
-struct ei_scalar_cast_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_cast_op)
+struct scalar_cast_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)
typedef NewType result_type;
- EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return ei_cast<Scalar, NewType>(a); }
+ EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast<Scalar, NewType>(a); }
};
template<typename Scalar, typename NewType>
-struct ei_functor_traits<ei_scalar_cast_op<Scalar,NewType> >
-{ enum { Cost = ei_is_same_type<Scalar, NewType>::ret ? 0 : NumTraits<NewType>::AddCost, PacketAccess = false }; };
+struct functor_traits<scalar_cast_op<Scalar,NewType> >
+{ enum { Cost = is_same<Scalar, NewType>::value ? 0 : NumTraits<NewType>::AddCost, PacketAccess = false }; };
/** \internal
* \brief Template functor to extract the real part of a complex
@@ -309,13 +311,13 @@ struct ei_functor_traits<ei_scalar_cast_op<Scalar,NewType> >
* \sa class CwiseUnaryOp, MatrixBase::real()
*/
template<typename Scalar>
-struct ei_scalar_real_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_real_op)
+struct scalar_real_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return ei_real(a); }
+ EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return real(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_real_op<Scalar> >
+struct functor_traits<scalar_real_op<Scalar> >
{ enum { Cost = 0, PacketAccess = false }; };
/** \internal
@@ -324,13 +326,13 @@ struct ei_functor_traits<ei_scalar_real_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::imag()
*/
template<typename Scalar>
-struct ei_scalar_imag_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_imag_op)
+struct scalar_imag_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return ei_imag(a); }
+ EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return imag(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_imag_op<Scalar> >
+struct functor_traits<scalar_imag_op<Scalar> >
{ enum { Cost = 0, PacketAccess = false }; };
/** \internal
@@ -339,13 +341,13 @@ struct ei_functor_traits<ei_scalar_imag_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::real()
*/
template<typename Scalar>
-struct ei_scalar_real_ref_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_real_ref_op)
+struct scalar_real_ref_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return ei_real_ref(*const_cast<Scalar*>(&a)); }
+ EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return real_ref(*const_cast<Scalar*>(&a)); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_real_ref_op<Scalar> >
+struct functor_traits<scalar_real_ref_op<Scalar> >
{ enum { Cost = 0, PacketAccess = false }; };
/** \internal
@@ -354,13 +356,13 @@ struct ei_functor_traits<ei_scalar_real_ref_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::imag()
*/
template<typename Scalar>
-struct ei_scalar_imag_ref_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_imag_ref_op)
+struct scalar_imag_ref_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op)
typedef typename NumTraits<Scalar>::Real result_type;
- EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return ei_imag_ref(*const_cast<Scalar*>(&a)); }
+ EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return imag_ref(*const_cast<Scalar*>(&a)); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_imag_ref_op<Scalar> >
+struct functor_traits<scalar_imag_ref_op<Scalar> >
{ enum { Cost = 0, PacketAccess = false }; };
/** \internal
@@ -369,15 +371,15 @@ struct ei_functor_traits<ei_scalar_imag_ref_op<Scalar> >
*
* \sa class CwiseUnaryOp, Cwise::exp()
*/
-template<typename Scalar> struct ei_scalar_exp_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_exp_op)
- inline const Scalar operator() (const Scalar& a) const { return ei_exp(a); }
- typedef typename ei_packet_traits<Scalar>::type Packet;
- inline Packet packetOp(const Packet& a) const { return ei_pexp(a); }
+template<typename Scalar> struct scalar_exp_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op)
+ inline const Scalar operator() (const Scalar& a) const { return exp(a); }
+ typedef typename packet_traits<Scalar>::type Packet;
+ inline Packet packetOp(const Packet& a) const { return internal::pexp(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_exp_op<Scalar> >
-{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasExp }; };
+struct functor_traits<scalar_exp_op<Scalar> >
+{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasExp }; };
/** \internal
*
@@ -385,81 +387,81 @@ struct ei_functor_traits<ei_scalar_exp_op<Scalar> >
*
* \sa class CwiseUnaryOp, Cwise::log()
*/
-template<typename Scalar> struct ei_scalar_log_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_log_op)
- inline const Scalar operator() (const Scalar& a) const { return ei_log(a); }
- typedef typename ei_packet_traits<Scalar>::type Packet;
- inline Packet packetOp(const Packet& a) const { return ei_plog(a); }
+template<typename Scalar> struct scalar_log_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op)
+ inline const Scalar operator() (const Scalar& a) const { return log(a); }
+ typedef typename packet_traits<Scalar>::type Packet;
+ inline Packet packetOp(const Packet& a) const { return internal::plog(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_log_op<Scalar> >
-{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasLog }; };
+struct functor_traits<scalar_log_op<Scalar> >
+{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasLog }; };
/** \internal
* \brief Template functor to multiply a scalar by a fixed other one
*
* \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/
*/
-/* NOTE why doing the ei_pset1() in packetOp *is* an optimization ?
- * indeed it seems better to declare m_other as a Packet and do the ei_pset1() once
+/* NOTE why doing the pset1() in packetOp *is* an optimization ?
+ * indeed it seems better to declare m_other as a Packet and do the pset1() once
* in the constructor. However, in practice:
* - GCC does not like m_other as a Packet and generate a load every time it needs it
- * - on the other hand GCC is able to moves the ei_pset1() away the loop :)
+ * - on the other hand GCC is able to moves the pset1() away the loop :)
* - simpler code ;)
* (ICC and gcc 4.4 seems to perform well in both cases, the issue is visible with y = a*x + b*y)
*/
template<typename Scalar>
-struct ei_scalar_multiple_op {
- typedef typename ei_packet_traits<Scalar>::type Packet;
+struct scalar_multiple_op {
+ typedef typename packet_traits<Scalar>::type Packet;
// FIXME default copy constructors seems bugged with std::complex<>
- EIGEN_STRONG_INLINE ei_scalar_multiple_op(const ei_scalar_multiple_op& other) : m_other(other.m_other) { }
- EIGEN_STRONG_INLINE ei_scalar_multiple_op(const Scalar& other) : m_other(other) { }
+ EIGEN_STRONG_INLINE scalar_multiple_op(const scalar_multiple_op& other) : m_other(other.m_other) { }
+ EIGEN_STRONG_INLINE scalar_multiple_op(const Scalar& other) : m_other(other) { }
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; }
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
- { return ei_pmul(a, ei_pset1<Packet>(m_other)); }
- typename ei_makeconst<typename NumTraits<Scalar>::Nested>::type m_other;
+ { return internal::pmul(a, pset1<Packet>(m_other)); }
+ typename add_const<typename NumTraits<Scalar>::Nested>::type m_other;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_multiple_op<Scalar> >
-{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasMul }; };
+struct functor_traits<scalar_multiple_op<Scalar> >
+{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
template<typename Scalar1, typename Scalar2>
-struct ei_scalar_multiple2_op {
- typedef typename ei_scalar_product_traits<Scalar1,Scalar2>::ReturnType result_type;
- EIGEN_STRONG_INLINE ei_scalar_multiple2_op(const ei_scalar_multiple2_op& other) : m_other(other.m_other) { }
- EIGEN_STRONG_INLINE ei_scalar_multiple2_op(const Scalar2& other) : m_other(other) { }
+struct scalar_multiple2_op {
+ typedef typename scalar_product_traits<Scalar1,Scalar2>::ReturnType result_type;
+ EIGEN_STRONG_INLINE scalar_multiple2_op(const scalar_multiple2_op& other) : m_other(other.m_other) { }
+ EIGEN_STRONG_INLINE scalar_multiple2_op(const Scalar2& other) : m_other(other) { }
EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; }
- typename ei_makeconst<typename NumTraits<Scalar2>::Nested>::type m_other;
+ typename add_const<typename NumTraits<Scalar2>::Nested>::type m_other;
};
template<typename Scalar1,typename Scalar2>
-struct ei_functor_traits<ei_scalar_multiple2_op<Scalar1,Scalar2> >
+struct functor_traits<scalar_multiple2_op<Scalar1,Scalar2> >
{ enum { Cost = NumTraits<Scalar1>::MulCost, PacketAccess = false }; };
template<typename Scalar, bool IsInteger>
-struct ei_scalar_quotient1_impl {
- typedef typename ei_packet_traits<Scalar>::type Packet;
+struct scalar_quotient1_impl {
+ typedef typename packet_traits<Scalar>::type Packet;
// FIXME default copy constructors seems bugged with std::complex<>
- EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const ei_scalar_quotient1_impl& other) : m_other(other.m_other) { }
- EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {}
+ EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { }
+ EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {}
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; }
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
- { return ei_pmul(a, ei_pset1<Packet>(m_other)); }
+ { return internal::pmul(a, pset1<Packet>(m_other)); }
const Scalar m_other;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,false> >
-{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasMul }; };
+struct functor_traits<scalar_quotient1_impl<Scalar,false> >
+{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
template<typename Scalar>
-struct ei_scalar_quotient1_impl<Scalar,true> {
+struct scalar_quotient1_impl<Scalar,true> {
// FIXME default copy constructors seems bugged with std::complex<>
- EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const ei_scalar_quotient1_impl& other) : m_other(other.m_other) { }
- EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
+ EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { }
+ EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; }
- typename ei_makeconst<typename NumTraits<Scalar>::Nested>::type m_other;
+ typename add_const<typename NumTraits<Scalar>::Nested>::type m_other;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,true> >
+struct functor_traits<scalar_quotient1_impl<Scalar,true> >
{ enum { Cost = 2 * NumTraits<Scalar>::MulCost, PacketAccess = false }; };
/** \internal
@@ -471,43 +473,43 @@ struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,true> >
* \sa class CwiseUnaryOp, MatrixBase::operator/
*/
template<typename Scalar>
-struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger > {
- EIGEN_STRONG_INLINE ei_scalar_quotient1_op(const Scalar& other)
- : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger >(other) {}
+struct scalar_quotient1_op : scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger > {
+ EIGEN_STRONG_INLINE scalar_quotient1_op(const Scalar& other)
+ : scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger >(other) {}
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_quotient1_op<Scalar> >
-: ei_functor_traits<ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger> >
+struct functor_traits<scalar_quotient1_op<Scalar> >
+: functor_traits<scalar_quotient1_impl<Scalar, NumTraits<Scalar>::IsInteger> >
{};
// nullary functors
template<typename Scalar>
-struct ei_scalar_constant_op {
- typedef typename ei_packet_traits<Scalar>::type Packet;
- EIGEN_STRONG_INLINE ei_scalar_constant_op(const ei_scalar_constant_op& other) : m_other(other.m_other) { }
- EIGEN_STRONG_INLINE ei_scalar_constant_op(const Scalar& other) : m_other(other) { }
+struct scalar_constant_op {
+ typedef typename packet_traits<Scalar>::type Packet;
+ EIGEN_STRONG_INLINE scalar_constant_op(const scalar_constant_op& other) : m_other(other.m_other) { }
+ EIGEN_STRONG_INLINE scalar_constant_op(const Scalar& other) : m_other(other) { }
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index, Index = 0) const { return m_other; }
template<typename Index>
- EIGEN_STRONG_INLINE const Packet packetOp(Index, Index = 0) const { return ei_pset1<Packet>(m_other); }
+ EIGEN_STRONG_INLINE const Packet packetOp(Index, Index = 0) const { return internal::pset1<Packet>(m_other); }
const Scalar m_other;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_constant_op<Scalar> >
+struct functor_traits<scalar_constant_op<Scalar> >
// FIXME replace this packet test by a safe one
-{ enum { Cost = 1, PacketAccess = ei_packet_traits<Scalar>::Vectorizable, IsRepeatable = true }; };
+{ enum { Cost = 1, PacketAccess = packet_traits<Scalar>::Vectorizable, IsRepeatable = true }; };
-template<typename Scalar> struct ei_scalar_identity_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_identity_op)
+template<typename Scalar> struct scalar_identity_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op)
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const { return row==col ? Scalar(1) : Scalar(0); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_identity_op<Scalar> >
+struct functor_traits<scalar_identity_op<Scalar> >
{ enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = false, IsRepeatable = true }; };
-template <typename Scalar, bool RandomAccess> struct ei_linspaced_op_impl;
+template <typename Scalar, bool RandomAccess> struct linspaced_op_impl;
// linear access for packet ops:
// 1) initialization
@@ -515,19 +517,19 @@ template <typename Scalar, bool RandomAccess> struct ei_linspaced_op_impl;
// 2) each step
// base += [size*step, ..., size*step]
template <typename Scalar>
-struct ei_linspaced_op_impl<Scalar,false>
+struct linspaced_op_impl<Scalar,false>
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename packet_traits<Scalar>::type Packet;
- ei_linspaced_op_impl(Scalar low, Scalar step) :
+ linspaced_op_impl(Scalar low, Scalar step) :
m_low(low), m_step(step),
- m_packetStep(ei_pset1<Packet>(ei_packet_traits<Scalar>::size*step)),
- m_base(ei_padd(ei_pset1<Packet>(low),ei_pmul(ei_pset1<Packet>(step),ei_plset<Scalar>(-ei_packet_traits<Scalar>::size)))) {}
+ m_packetStep(pset1<Packet>(packet_traits<Scalar>::size*step)),
+ m_base(padd(pset1<Packet>(low),pmul(pset1<Packet>(step),plset<Scalar>(-packet_traits<Scalar>::size)))) {}
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; }
template<typename Index>
- EIGEN_STRONG_INLINE const Packet packetOp(Index) const { return m_base = ei_padd(m_base,m_packetStep); }
+ EIGEN_STRONG_INLINE const Packet packetOp(Index) const { return m_base = padd(m_base,m_packetStep); }
const Scalar m_low;
const Scalar m_step;
@@ -539,19 +541,20 @@ struct ei_linspaced_op_impl<Scalar,false>
// 1) each step
// [low, ..., low] + ( [step, ..., step] * ( [i, ..., i] + [0, ..., size] ) )
template <typename Scalar>
-struct ei_linspaced_op_impl<Scalar,true>
+struct linspaced_op_impl<Scalar,true>
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename packet_traits<Scalar>::type Packet;
- ei_linspaced_op_impl(Scalar low, Scalar step) :
+ linspaced_op_impl(Scalar low, Scalar step) :
m_low(low), m_step(step),
- m_lowPacket(ei_pset1<Packet>(m_low)), m_stepPacket(ei_pset1<Packet>(m_step)), m_interPacket(ei_plset<Scalar>(0)) {}
+ m_lowPacket(pset1<Packet>(m_low)), m_stepPacket(pset1<Packet>(m_step)), m_interPacket(plset<Scalar>(0)) {}
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; }
+
template<typename Index>
EIGEN_STRONG_INLINE const Packet packetOp(Index i) const
- { return ei_padd(m_lowPacket, ei_pmul(m_stepPacket, ei_padd(ei_pset1<Packet>(i),m_interPacket))); }
+ { return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1<Packet>(i),m_interPacket))); }
const Scalar m_low;
const Scalar m_step;
@@ -565,72 +568,93 @@ struct ei_linspaced_op_impl<Scalar,true>
// Forward declaration (we default to random access which does not really give
// us a speed gain when using packet access but it allows to use the functor in
// nested expressions).
-template <typename Scalar, bool RandomAccess = true> struct ei_linspaced_op;
-template <typename Scalar, bool RandomAccess> struct ei_functor_traits< ei_linspaced_op<Scalar,RandomAccess> >
-{ enum { Cost = 1, PacketAccess = ei_packet_traits<Scalar>::HasSetLinear, IsRepeatable = true }; };
-template <typename Scalar, bool RandomAccess> struct ei_linspaced_op
+template <typename Scalar, bool RandomAccess = true> struct linspaced_op;
+template <typename Scalar, bool RandomAccess> struct functor_traits< linspaced_op<Scalar,RandomAccess> >
+{ enum { Cost = 1, PacketAccess = packet_traits<Scalar>::HasSetLinear, IsRepeatable = true }; };
+template <typename Scalar, bool RandomAccess> struct linspaced_op
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- ei_linspaced_op(Scalar low, Scalar high, int num_steps) : impl(low, (high-low)/(num_steps-1)) {}
+ typedef typename packet_traits<Scalar>::type Packet;
+ linspaced_op(Scalar low, Scalar high, int num_steps) : impl(low, (high-low)/(num_steps-1)) {}
+
+ template<typename Index>
+ EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }
+
+ // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since
+ // there row==0 and col is used for the actual iteration.
+ template<typename Index>
+ EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const
+ {
+ eigen_assert(col==0 || row==0);
+ return impl(col + row);
+ }
+
template<typename Index>
- EIGEN_STRONG_INLINE const Scalar operator() (Index i, Index = 0) const { return impl(i); }
+ EIGEN_STRONG_INLINE const Packet packetOp(Index i) const { return impl.packetOp(i); }
+
+ // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since
+ // there row==0 and col is used for the actual iteration.
template<typename Index>
- EIGEN_STRONG_INLINE const Packet packetOp(Index i, Index = 0) const { return impl.packetOp(i); }
+ EIGEN_STRONG_INLINE const Packet packetOp(Index row, Index col) const
+ {
+ eigen_assert(col==0 || row==0);
+ return impl(col + row);
+ }
+
// This proxy object handles the actual required temporaries, the different
// implementations (random vs. sequential access) as well as the
// correct piping to size 2/4 packet operations.
- const ei_linspaced_op_impl<Scalar,RandomAccess> impl;
+ const linspaced_op_impl<Scalar,RandomAccess> impl;
};
-// all functors allow linear access, except ei_scalar_identity_op. So we fix here a quick meta
+// all functors allow linear access, except scalar_identity_op. So we fix here a quick meta
// to indicate whether a functor allows linear access, just always answering 'yes' except for
-// ei_scalar_identity_op.
-// FIXME move this to ei_functor_traits adding a ei_functor_default
-template<typename Functor> struct ei_functor_has_linear_access { enum { ret = 1 }; };
-template<typename Scalar> struct ei_functor_has_linear_access<ei_scalar_identity_op<Scalar> > { enum { ret = 0 }; };
+// scalar_identity_op.
+// FIXME move this to functor_traits adding a functor_default
+template<typename Functor> struct functor_has_linear_access { enum { ret = 1 }; };
+template<typename Scalar> struct functor_has_linear_access<scalar_identity_op<Scalar> > { 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<float>.
-// FIXME move this to ei_functor_traits adding a ei_functor_default
-template<typename Functor> struct ei_functor_allows_mixing_real_and_complex { enum { ret = 0 }; };
-template<typename LhsScalar,typename RhsScalar> struct ei_functor_allows_mixing_real_and_complex<ei_scalar_product_op<LhsScalar,RhsScalar> > { enum { ret = 1 }; };
+// FIXME move this to functor_traits adding a functor_default
+template<typename Functor> struct functor_allows_mixing_real_and_complex { enum { ret = 0 }; };
+template<typename LhsScalar,typename RhsScalar> struct functor_allows_mixing_real_and_complex<scalar_product_op<LhsScalar,RhsScalar> > { enum { ret = 1 }; };
/** \internal
* \brief Template functor to add a scalar to a fixed other one
* \sa class CwiseUnaryOp, Array::operator+
*/
-/* If you wonder why doing the ei_pset1() in packetOp() is an optimization check ei_scalar_multiple_op */
+/* If you wonder why doing the pset1() in packetOp() is an optimization check scalar_multiple_op */
template<typename Scalar>
-struct ei_scalar_add_op {
- typedef typename ei_packet_traits<Scalar>::type Packet;
+struct scalar_add_op {
+ typedef typename packet_traits<Scalar>::type Packet;
// FIXME default copy constructors seems bugged with std::complex<>
- inline ei_scalar_add_op(const ei_scalar_add_op& other) : m_other(other.m_other) { }
- inline ei_scalar_add_op(const Scalar& other) : m_other(other) { }
+ inline scalar_add_op(const scalar_add_op& other) : m_other(other.m_other) { }
+ inline scalar_add_op(const Scalar& other) : m_other(other) { }
inline Scalar operator() (const Scalar& a) const { return a + m_other; }
inline const Packet packetOp(const Packet& a) const
- { return ei_padd(a, ei_pset1<Packet>(m_other)); }
+ { return internal::padd(a, pset1<Packet>(m_other)); }
const Scalar m_other;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_add_op<Scalar> >
-{ enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = ei_packet_traits<Scalar>::HasAdd }; };
+struct functor_traits<scalar_add_op<Scalar> >
+{ enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = packet_traits<Scalar>::HasAdd }; };
/** \internal
* \brief Template functor to compute the square root of a scalar
* \sa class CwiseUnaryOp, Cwise::sqrt()
*/
-template<typename Scalar> struct ei_scalar_sqrt_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_sqrt_op)
- inline const Scalar operator() (const Scalar& a) const { return ei_sqrt(a); }
- typedef typename ei_packet_traits<Scalar>::type Packet;
- inline Packet packetOp(const Packet& a) const { return ei_psqrt(a); }
+template<typename Scalar> struct scalar_sqrt_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op)
+ inline const Scalar operator() (const Scalar& a) const { return sqrt(a); }
+ typedef typename packet_traits<Scalar>::type Packet;
+ inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> >
+struct functor_traits<scalar_sqrt_op<Scalar> >
{ enum {
Cost = 5 * NumTraits<Scalar>::MulCost,
- PacketAccess = ei_packet_traits<Scalar>::HasSqrt
+ PacketAccess = packet_traits<Scalar>::HasSqrt
};
};
@@ -638,18 +662,18 @@ struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> >
* \brief Template functor to compute the cosine of a scalar
* \sa class CwiseUnaryOp, Cwise::cos()
*/
-template<typename Scalar> struct ei_scalar_cos_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_cos_op)
- inline Scalar operator() (const Scalar& a) const { return ei_cos(a); }
- typedef typename ei_packet_traits<Scalar>::type Packet;
- inline Packet packetOp(const Packet& a) const { return ei_pcos(a); }
+template<typename Scalar> struct scalar_cos_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op)
+ inline Scalar operator() (const Scalar& a) const { return cos(a); }
+ typedef typename packet_traits<Scalar>::type Packet;
+ inline Packet packetOp(const Packet& a) const { return internal::pcos(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_cos_op<Scalar> >
+struct functor_traits<scalar_cos_op<Scalar> >
{
enum {
Cost = 5 * NumTraits<Scalar>::MulCost,
- PacketAccess = ei_packet_traits<Scalar>::HasCos
+ PacketAccess = packet_traits<Scalar>::HasCos
};
};
@@ -657,18 +681,18 @@ struct ei_functor_traits<ei_scalar_cos_op<Scalar> >
* \brief Template functor to compute the sine of a scalar
* \sa class CwiseUnaryOp, Cwise::sin()
*/
-template<typename Scalar> struct ei_scalar_sin_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_sin_op)
- inline const Scalar operator() (const Scalar& a) const { return ei_sin(a); }
- typedef typename ei_packet_traits<Scalar>::type Packet;
- inline Packet packetOp(const Packet& a) const { return ei_psin(a); }
+template<typename Scalar> struct scalar_sin_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op)
+ inline const Scalar operator() (const Scalar& a) const { return sin(a); }
+ typedef typename packet_traits<Scalar>::type Packet;
+ inline Packet packetOp(const Packet& a) const { return internal::psin(a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_sin_op<Scalar> >
+struct functor_traits<scalar_sin_op<Scalar> >
{
enum {
Cost = 5 * NumTraits<Scalar>::MulCost,
- PacketAccess = ei_packet_traits<Scalar>::HasSin
+ PacketAccess = packet_traits<Scalar>::HasSin
};
};
@@ -677,15 +701,15 @@ struct ei_functor_traits<ei_scalar_sin_op<Scalar> >
* \sa class CwiseUnaryOp, Cwise::pow
*/
template<typename Scalar>
-struct ei_scalar_pow_op {
+struct scalar_pow_op {
// FIXME default copy constructors seems bugged with std::complex<>
- inline ei_scalar_pow_op(const ei_scalar_pow_op& other) : m_exponent(other.m_exponent) { }
- inline ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {}
- inline Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); }
+ 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); }
const Scalar m_exponent;
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_pow_op<Scalar> >
+struct functor_traits<scalar_pow_op<Scalar> >
{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false }; };
/** \internal
@@ -693,155 +717,157 @@ struct ei_functor_traits<ei_scalar_pow_op<Scalar> >
* \sa class CwiseUnaryOp, Cwise::inverse()
*/
template<typename Scalar>
-struct ei_scalar_inverse_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_inverse_op)
+struct scalar_inverse_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_inverse_op)
inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; }
template<typename Packet>
inline const Packet packetOp(const Packet& a) const
- { return ei_pdiv(ei_pset1<Packet>(Scalar(1)),a); }
+ { return internal::pdiv(pset1<Packet>(Scalar(1)),a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_inverse_op<Scalar> >
-{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasDiv }; };
+struct functor_traits<scalar_inverse_op<Scalar> >
+{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasDiv }; };
/** \internal
* \brief Template functor to compute the square of a scalar
* \sa class CwiseUnaryOp, Cwise::square()
*/
template<typename Scalar>
-struct ei_scalar_square_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_square_op)
+struct scalar_square_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_square_op)
inline Scalar operator() (const Scalar& a) const { return a*a; }
template<typename Packet>
inline const Packet packetOp(const Packet& a) const
- { return ei_pmul(a,a); }
+ { return internal::pmul(a,a); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_square_op<Scalar> >
-{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasMul }; };
+struct functor_traits<scalar_square_op<Scalar> >
+{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
/** \internal
* \brief Template functor to compute the cube of a scalar
* \sa class CwiseUnaryOp, Cwise::cube()
*/
template<typename Scalar>
-struct ei_scalar_cube_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_cube_op)
+struct scalar_cube_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_cube_op)
inline Scalar operator() (const Scalar& a) const { return a*a*a; }
template<typename Packet>
inline const Packet packetOp(const Packet& a) const
- { return ei_pmul(a,ei_pmul(a,a)); }
+ { return internal::pmul(a,pmul(a,a)); }
};
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_cube_op<Scalar> >
-{ enum { Cost = 2*NumTraits<Scalar>::MulCost, PacketAccess = ei_packet_traits<Scalar>::HasMul }; };
+struct functor_traits<scalar_cube_op<Scalar> >
+{ enum { Cost = 2*NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
// default functor traits for STL functors:
template<typename T>
-struct ei_functor_traits<std::multiplies<T> >
+struct functor_traits<std::multiplies<T> >
{ enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::divides<T> >
+struct functor_traits<std::divides<T> >
{ enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::plus<T> >
+struct functor_traits<std::plus<T> >
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::minus<T> >
+struct functor_traits<std::minus<T> >
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::negate<T> >
+struct functor_traits<std::negate<T> >
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::logical_or<T> >
+struct functor_traits<std::logical_or<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::logical_and<T> >
+struct functor_traits<std::logical_and<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::logical_not<T> >
+struct functor_traits<std::logical_not<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::greater<T> >
+struct functor_traits<std::greater<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::less<T> >
+struct functor_traits<std::less<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::greater_equal<T> >
+struct functor_traits<std::greater_equal<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::less_equal<T> >
+struct functor_traits<std::less_equal<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::equal_to<T> >
+struct functor_traits<std::equal_to<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::not_equal_to<T> >
+struct functor_traits<std::not_equal_to<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::binder2nd<T> >
-{ enum { Cost = ei_functor_traits<T>::Cost, PacketAccess = false }; };
+struct functor_traits<std::binder2nd<T> >
+{ enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::binder1st<T> >
-{ enum { Cost = ei_functor_traits<T>::Cost, PacketAccess = false }; };
+struct functor_traits<std::binder1st<T> >
+{ enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::unary_negate<T> >
-{ enum { Cost = 1 + ei_functor_traits<T>::Cost, PacketAccess = false }; };
+struct functor_traits<std::unary_negate<T> >
+{ enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
template<typename T>
-struct ei_functor_traits<std::binary_negate<T> >
-{ enum { Cost = 1 + ei_functor_traits<T>::Cost, PacketAccess = false }; };
+struct functor_traits<std::binary_negate<T> >
+{ enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
#ifdef EIGEN_STDEXT_SUPPORT
template<typename T0,typename T1>
-struct ei_functor_traits<std::project1st<T0,T1> >
+struct functor_traits<std::project1st<T0,T1> >
{ enum { Cost = 0, PacketAccess = false }; };
template<typename T0,typename T1>
-struct ei_functor_traits<std::project2nd<T0,T1> >
+struct functor_traits<std::project2nd<T0,T1> >
{ enum { Cost = 0, PacketAccess = false }; };
template<typename T0,typename T1>
-struct ei_functor_traits<std::select2nd<std::pair<T0,T1> > >
+struct functor_traits<std::select2nd<std::pair<T0,T1> > >
{ enum { Cost = 0, PacketAccess = false }; };
template<typename T0,typename T1>
-struct ei_functor_traits<std::select1st<std::pair<T0,T1> > >
+struct functor_traits<std::select1st<std::pair<T0,T1> > >
{ enum { Cost = 0, PacketAccess = false }; };
template<typename T0,typename T1>
-struct ei_functor_traits<std::unary_compose<T0,T1> >
-{ enum { Cost = ei_functor_traits<T0>::Cost + ei_functor_traits<T1>::Cost, PacketAccess = false }; };
+struct functor_traits<std::unary_compose<T0,T1> >
+{ enum { Cost = functor_traits<T0>::Cost + functor_traits<T1>::Cost, PacketAccess = false }; };
template<typename T0,typename T1,typename T2>
-struct ei_functor_traits<std::binary_compose<T0,T1,T2> >
-{ enum { Cost = ei_functor_traits<T0>::Cost + ei_functor_traits<T1>::Cost + ei_functor_traits<T2>::Cost, PacketAccess = false }; };
+struct functor_traits<std::binary_compose<T0,T1,T2> >
+{ enum { Cost = functor_traits<T0>::Cost + functor_traits<T1>::Cost + functor_traits<T2>::Cost, PacketAccess = false }; };
#endif // EIGEN_STDEXT_SUPPORT
-// allow to add new functors and specializations of ei_functor_traits from outside Eigen.
-// this macro is really needed because ei_functor_traits must be specialized after it is declared but before it is used...
+// allow to add new functors and specializations of functor_traits from outside Eigen.
+// this macro is really needed because functor_traits must be specialized after it is declared but before it is used...
#ifdef EIGEN_FUNCTORS_PLUGIN
#include EIGEN_FUNCTORS_PLUGIN
#endif
+} // end namespace internal
+
#endif // EIGEN_FUNCTORS_H
diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h
index 4a3b5e4dc..0a3620df9 100644
--- a/Eigen/src/Core/Fuzzy.h
+++ b/Eigen/src/Core/Fuzzy.h
@@ -28,8 +28,6 @@
// TODO support small integer types properly i.e. do exact compare on coeffs --- taking a HS norm is guaranteed to cause integer overflow.
-#ifndef EIGEN_LEGACY_COMPARES
-
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
* determined by \a prec.
*
@@ -42,10 +40,10 @@
* \note Because of the multiplicativeness of this comparison, one can't use this function
* to check whether \c *this is approximately equal to the zero matrix or vector.
* Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix
- * or vector. If you want to test whether \c *this is zero, use ei_isMuchSmallerThan(const
+ * or vector. If you want to test whether \c *this is zero, use internal::isMuchSmallerThan(const
* RealScalar&, RealScalar) instead.
*
- * \sa ei_isMuchSmallerThan(const RealScalar&, RealScalar) const
+ * \sa internal::isMuchSmallerThan(const RealScalar&, RealScalar) const
*/
template<typename Derived>
template<typename OtherDerived>
@@ -54,10 +52,10 @@ bool DenseBase<Derived>::isApprox(
RealScalar prec
) const
{
- const typename ei_nested<Derived,2>::type nested(derived());
- const typename ei_nested<OtherDerived,2>::type otherNested(other.derived());
-// std::cerr << typeid(Derived).name() << " => " << typeid(typename ei_nested<Derived,2>::type).name() << "\n";
-// std::cerr << typeid(OtherDerived).name() << " => " << typeid(typename ei_nested<OtherDerived,2>::type).name() << "\n";
+ const typename internal::nested<Derived,2>::type nested(derived());
+ const typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
+// std::cerr << typeid(Derived).name() << " => " << typeid(typename internal::nested<Derived,2>::type).name() << "\n";
+// std::cerr << typeid(OtherDerived).name() << " => " << typeid(typename internal::nested<OtherDerived,2>::type).name() << "\n";
// return false;
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * std::min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
}
@@ -104,137 +102,4 @@ bool DenseBase<Derived>::isMuchSmallerThan(
return derived().cwiseAbs2().sum() <= prec * prec * other.derived().cwiseAbs2().sum();
}
-#else
-
-template<typename Derived, typename OtherDerived=Derived, bool IsVector=Derived::IsVectorAtCompileTime>
-struct ei_fuzzy_selector;
-
-/** \returns \c true if \c *this is approximately equal to \a other, within the precision
- * determined by \a prec.
- *
- * \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$
- * are considered to be approximately equal within precision \f$ p \f$ if
- * \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f]
- * For matrices, the comparison is done on all columns.
- *
- * \note Because of the multiplicativeness of this comparison, one can't use this function
- * to check whether \c *this is approximately equal to the zero matrix or vector.
- * Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix
- * or vector. If you want to test whether \c *this is zero, use ei_isMuchSmallerThan(const
- * RealScalar&, RealScalar) instead.
- *
- * \sa ei_isMuchSmallerThan(const RealScalar&, RealScalar) const
- */
-template<typename Derived>
-template<typename OtherDerived>
-bool DenseBase<Derived>::isApprox(
- const DenseBase<OtherDerived>& other,
- RealScalar prec
-) const
-{
- return ei_fuzzy_selector<Derived,OtherDerived>::isApprox(derived(), other.derived(), prec);
-}
-
-/** \returns \c true if the norm of \c *this is much smaller than \a other,
- * within the precision determined by \a prec.
- *
- * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
- * considered to be much smaller than \f$ x \f$ within precision \f$ p \f$ if
- * \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f]
- * For matrices, the comparison is done on all columns.
- *
- * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
- */
-template<typename Derived>
-bool DenseBase<Derived>::isMuchSmallerThan(
- const typename NumTraits<Scalar>::Real& other,
- RealScalar prec
-) const
-{
- return ei_fuzzy_selector<Derived>::isMuchSmallerThan(derived(), other, prec);
-}
-
-/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other,
- * within the precision determined by \a prec.
- *
- * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
- * considered to be much smaller than a vector \f$ w \f$ within precision \f$ p \f$ if
- * \f[ \Vert v \Vert \leqslant p\,\Vert w\Vert. \f]
- * For matrices, the comparison is done on all columns.
- *
- * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const
- */
-template<typename Derived>
-template<typename OtherDerived>
-bool DenseBase<Derived>::isMuchSmallerThan(
- const DenseBase<OtherDerived>& other,
- RealScalar prec
-) const
-{
- return ei_fuzzy_selector<Derived,OtherDerived>::isMuchSmallerThan(derived(), other.derived(), prec);
-}
-
-
-template<typename Derived, typename OtherDerived>
-struct ei_fuzzy_selector<Derived,OtherDerived,true>
-{
- typedef typename Derived::RealScalar RealScalar;
- static bool isApprox(const Derived& self, const OtherDerived& other, RealScalar prec)
- {
- EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
- ei_assert(self.size() == other.size());
- return((self - other).squaredNorm() <= std::min(self.squaredNorm(), other.squaredNorm()) * prec * prec);
- }
- static bool isMuchSmallerThan(const Derived& self, const RealScalar& other, RealScalar prec)
- {
- return(self.squaredNorm() <= ei_abs2(other * prec));
- }
- static bool isMuchSmallerThan(const Derived& self, const OtherDerived& other, RealScalar prec)
- {
- EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
- ei_assert(self.size() == other.size());
- return(self.squaredNorm() <= other.squaredNorm() * prec * prec);
- }
-};
-
-template<typename Derived, typename OtherDerived>
-struct ei_fuzzy_selector<Derived,OtherDerived,false>
-{
- typedef typename Derived::RealScalar RealScalar;
- typedef typename Derived::Index Index;
- static bool isApprox(const Derived& self, const OtherDerived& other, RealScalar prec)
- {
- EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
- ei_assert(self.rows() == other.rows() && self.cols() == other.cols());
- typename Derived::Nested nested(self);
- typename OtherDerived::Nested otherNested(other);
- for(Index i = 0; i < self.cols(); ++i)
- if((nested.col(i) - otherNested.col(i)).squaredNorm()
- > std::min(nested.col(i).squaredNorm(), otherNested.col(i).squaredNorm()) * prec * prec)
- return false;
- return true;
- }
- static bool isMuchSmallerThan(const Derived& self, const RealScalar& other, RealScalar prec)
- {
- typename Derived::Nested nested(self);
- for(Index i = 0; i < self.cols(); ++i)
- if(nested.col(i).squaredNorm() > ei_abs2(other * prec))
- return false;
- return true;
- }
- static bool isMuchSmallerThan(const Derived& self, const OtherDerived& other, RealScalar prec)
- {
- EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
- ei_assert(self.rows() == other.rows() && self.cols() == other.cols());
- typename Derived::Nested nested(self);
- typename OtherDerived::Nested otherNested(other);
- for(Index i = 0; i < self.cols(); ++i)
- if(nested.col(i).squaredNorm() > otherNested.col(i).squaredNorm() * prec * prec)
- return false;
- return true;
- }
-};
-
-#endif
-
#endif // EIGEN_FUZZY_H
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h
index 8ace18174..7d3fdadf0 100644
--- a/Eigen/src/Core/GenericPacketMath.h
+++ b/Eigen/src/Core/GenericPacketMath.h
@@ -26,6 +26,8 @@
#ifndef EIGEN_GENERIC_PACKET_MATH_H
#define EIGEN_GENERIC_PACKET_MATH_H
+namespace internal {
+
/** \internal
* \file GenericPacketMath.h
*
@@ -50,7 +52,7 @@
#define EIGEN_DEBUG_UNALIGNED_STORE
#endif
-struct ei_default_packet_traits
+struct default_packet_traits
{
enum {
HasAdd = 1,
@@ -79,7 +81,7 @@ struct ei_default_packet_traits
};
};
-template<typename T> struct ei_packet_traits : ei_default_packet_traits
+template<typename T> struct packet_traits : default_packet_traits
{
typedef T type;
enum {
@@ -103,92 +105,92 @@ template<typename T> struct ei_packet_traits : ei_default_packet_traits
/** \internal \returns a + b (coeff-wise) */
template<typename Packet> inline Packet
-ei_padd(const Packet& a,
+padd(const Packet& a,
const Packet& b) { return a+b; }
/** \internal \returns a - b (coeff-wise) */
template<typename Packet> inline Packet
-ei_psub(const Packet& a,
+psub(const Packet& a,
const Packet& b) { return a-b; }
/** \internal \returns -a (coeff-wise) */
template<typename Packet> inline Packet
-ei_pnegate(const Packet& a) { return -a; }
+pnegate(const Packet& a) { return -a; }
/** \internal \returns conj(a) (coeff-wise) */
template<typename Packet> inline Packet
-ei_pconj(const Packet& a) { return ei_conj(a); }
+pconj(const Packet& a) { return conj(a); }
/** \internal \returns a * b (coeff-wise) */
template<typename Packet> inline Packet
-ei_pmul(const Packet& a,
+pmul(const Packet& a,
const Packet& b) { return a*b; }
/** \internal \returns a / b (coeff-wise) */
template<typename Packet> inline Packet
-ei_pdiv(const Packet& a,
+pdiv(const Packet& a,
const Packet& b) { return a/b; }
/** \internal \returns the min of \a a and \a b (coeff-wise) */
template<typename Packet> inline Packet
-ei_pmin(const Packet& a,
+pmin(const Packet& a,
const Packet& b) { return std::min(a, b); }
/** \internal \returns the max of \a a and \a b (coeff-wise) */
template<typename Packet> inline Packet
-ei_pmax(const Packet& a,
+pmax(const Packet& a,
const Packet& b) { return std::max(a, b); }
/** \internal \returns the absolute value of \a a */
template<typename Packet> inline Packet
-ei_pabs(const Packet& a) { return ei_abs(a); }
+pabs(const Packet& a) { return abs(a); }
/** \internal \returns the bitwise and of \a a and \a b */
template<typename Packet> inline Packet
-ei_pand(const Packet& a, const Packet& b) { return a & b; }
+pand(const Packet& a, const Packet& b) { return a & b; }
/** \internal \returns the bitwise or of \a a and \a b */
template<typename Packet> inline Packet
-ei_por(const Packet& a, const Packet& b) { return a | b; }
+por(const Packet& a, const Packet& b) { return a | b; }
/** \internal \returns the bitwise xor of \a a and \a b */
template<typename Packet> inline Packet
-ei_pxor(const Packet& a, const Packet& b) { return a ^ b; }
+pxor(const Packet& a, const Packet& b) { return a ^ b; }
/** \internal \returns the bitwise andnot of \a a and \a b */
template<typename Packet> inline Packet
-ei_pandnot(const Packet& a, const Packet& b) { return a & (!b); }
+pandnot(const Packet& a, const Packet& b) { return a & (!b); }
/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */
template<typename Packet> inline Packet
-ei_pload(const typename ei_unpacket_traits<Packet>::type* from) { return *from; }
+pload(const typename unpacket_traits<Packet>::type* from) { return *from; }
/** \internal \returns a packet version of \a *from, (un-aligned load) */
template<typename Packet> inline Packet
-ei_ploadu(const typename ei_unpacket_traits<Packet>::type* from) { return *from; }
+ploadu(const typename unpacket_traits<Packet>::type* from) { return *from; }
/** \internal \returns a packet with elements of \a *from duplicated, e.g.: (from[0],from[0],from[1],from[1]) */
template<typename Packet> inline Packet
-ei_ploaddup(const typename ei_unpacket_traits<Packet>::type* from) { return *from; }
+ploaddup(const typename unpacket_traits<Packet>::type* from) { return *from; }
/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */
template<typename Packet> inline Packet
-ei_pset1(const typename ei_unpacket_traits<Packet>::type& a) { return a; }
+pset1(const typename unpacket_traits<Packet>::type& a) { return a; }
/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */
-template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
-ei_plset(const Scalar& a) { return a; }
+template<typename Scalar> inline typename packet_traits<Scalar>::type
+plset(const Scalar& a) { return a; }
/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
-template<typename Scalar, typename Packet> inline void ei_pstore(Scalar* to, const Packet& from)
+template<typename Scalar, typename Packet> inline void pstore(Scalar* to, const Packet& from)
{ (*to) = from; }
/** \internal copy the packet \a from to \a *to, (un-aligned store) */
-template<typename Scalar, typename Packet> inline void ei_pstoreu(Scalar* to, const Packet& from)
+template<typename Scalar, typename Packet> inline void pstoreu(Scalar* to, const Packet& from)
{ (*to) = from; }
/** \internal tries to do cache prefetching of \a addr */
-template<typename Scalar> inline void ei_prefetch(const Scalar* addr)
+template<typename Scalar> inline void prefetch(const Scalar* addr)
{
#if !defined(_MSC_VER)
__builtin_prefetch(addr);
@@ -196,31 +198,31 @@ __builtin_prefetch(addr);
}
/** \internal \returns the first element of a packet */
-template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_pfirst(const Packet& a)
+template<typename Packet> inline typename unpacket_traits<Packet>::type pfirst(const Packet& a)
{ return a; }
/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */
template<typename Packet> inline Packet
-ei_preduxp(const Packet* vecs) { return vecs[0]; }
+preduxp(const Packet* vecs) { return vecs[0]; }
/** \internal \returns the sum of the elements of \a a*/
-template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux(const Packet& a)
+template<typename Packet> inline typename unpacket_traits<Packet>::type predux(const Packet& a)
{ return a; }
/** \internal \returns the product of the elements of \a a*/
-template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux_mul(const Packet& a)
+template<typename Packet> inline typename unpacket_traits<Packet>::type predux_mul(const Packet& a)
{ return a; }
/** \internal \returns the min of the elements of \a a*/
-template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux_min(const Packet& a)
+template<typename Packet> inline typename unpacket_traits<Packet>::type predux_min(const Packet& a)
{ return a; }
/** \internal \returns the max of the elements of \a a*/
-template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux_max(const Packet& a)
+template<typename Packet> inline typename unpacket_traits<Packet>::type predux_max(const Packet& a)
{ return a; }
/** \internal \returns the reversed elements of \a a*/
-template<typename Packet> inline Packet ei_preverse(const Packet& a)
+template<typename Packet> inline Packet preverse(const Packet& a)
{ return a; }
/**************************
@@ -229,23 +231,23 @@ template<typename Packet> inline Packet ei_preverse(const Packet& a)
/** \internal \returns the sin of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
-Packet ei_psin(const Packet& a) { return ei_sin(a); }
+Packet psin(const Packet& a) { return sin(a); }
/** \internal \returns the cos of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
-Packet ei_pcos(const Packet& a) { return ei_cos(a); }
+Packet pcos(const Packet& a) { return cos(a); }
/** \internal \returns the exp of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
-Packet ei_pexp(const Packet& a) { return ei_exp(a); }
+Packet pexp(const Packet& a) { return exp(a); }
/** \internal \returns the log of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
-Packet ei_plog(const Packet& a) { return ei_log(a); }
+Packet plog(const Packet& a) { return log(a); }
/** \internal \returns the square-root of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
-Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); }
+Packet psqrt(const Packet& a) { return sqrt(a); }
/***************************************************************************
* The following functions might not have to be overwritten for vectorized types
@@ -253,36 +255,36 @@ Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); }
/** \internal \returns a * b + c (coeff-wise) */
template<typename Packet> inline Packet
-ei_pmadd(const Packet& a,
+pmadd(const Packet& a,
const Packet& b,
const Packet& c)
-{ return ei_padd(ei_pmul(a, b),c); }
+{ return padd(pmul(a, b),c); }
/** \internal \returns a packet version of \a *from.
* \If LoadMode equals Aligned, \a from must be 16 bytes aligned */
template<typename Packet, int LoadMode>
-inline Packet ei_ploadt(const typename ei_unpacket_traits<Packet>::type* from)
+inline Packet ploadt(const typename unpacket_traits<Packet>::type* from)
{
if(LoadMode == Aligned)
- return ei_pload<Packet>(from);
+ return pload<Packet>(from);
else
- return ei_ploadu<Packet>(from);
+ return ploadu<Packet>(from);
}
/** \internal copy the packet \a from to \a *to.
* If StoreMode equals Aligned, \a to must be 16 bytes aligned */
template<typename Scalar, typename Packet, int LoadMode>
-inline void ei_pstoret(Scalar* to, const Packet& from)
+inline void pstoret(Scalar* to, const Packet& from)
{
if(LoadMode == Aligned)
- ei_pstore(to, from);
+ pstore(to, from);
else
- ei_pstoreu(to, from);
+ pstoreu(to, from);
}
-/** \internal default implementation of ei_palign() allowing partial specialization */
+/** \internal default implementation of palign() allowing partial specialization */
template<int Offset,typename PacketType>
-struct ei_palign_impl
+struct palign_impl
{
// by default data are aligned, so there is nothing to be done :)
inline static void run(PacketType&, const PacketType&) {}
@@ -291,20 +293,22 @@ struct ei_palign_impl
/** \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 */
template<int Offset,typename PacketType>
-inline void ei_palign(PacketType& first, const PacketType& second)
+inline void palign(PacketType& first, const PacketType& second)
{
- ei_palign_impl<Offset,PacketType>::run(first,second);
+ palign_impl<Offset,PacketType>::run(first,second);
}
/***************************************************************************
* Fast complex products (GCC generates a function call which is very slow)
***************************************************************************/
-template<> inline std::complex<float> ei_pmul(const std::complex<float>& a, const std::complex<float>& b)
-{ return std::complex<float>(ei_real(a)*ei_real(b) - ei_imag(a)*ei_imag(b), ei_imag(a)*ei_real(b) + ei_real(a)*ei_imag(b)); }
+template<> inline std::complex<float> pmul(const std::complex<float>& a, const std::complex<float>& b)
+{ return std::complex<float>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }
+
+template<> inline std::complex<double> pmul(const std::complex<double>& a, const std::complex<double>& b)
+{ return std::complex<double>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }
-template<> inline std::complex<double> ei_pmul(const std::complex<double>& a, const std::complex<double>& b)
-{ return std::complex<double>(ei_real(a)*ei_real(b) - ei_imag(a)*ei_imag(b), ei_imag(a)*ei_real(b) + ei_real(a)*ei_imag(b)); }
+} // end namespace internal
#endif // EIGEN_GENERIC_PACKET_MATH_H
diff --git a/Eigen/src/Core/GlobalFunctions.h b/Eigen/src/Core/GlobalFunctions.h
index 001c5b0b6..44d610f25 100644
--- a/Eigen/src/Core/GlobalFunctions.h
+++ b/Eigen/src/Core/GlobalFunctions.h
@@ -28,7 +28,7 @@
#define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \
template<typename Derived> \
- inline const Eigen::CwiseUnaryOp<Eigen::FUNCTOR<typename Derived::Scalar>, Derived> \
+ inline const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, Derived> \
NAME(const Eigen::ArrayBase<Derived>& x) { \
return x.derived(); \
}
@@ -38,7 +38,7 @@
template<typename Derived> \
struct NAME##_retval<ArrayBase<Derived> > \
{ \
- typedef const Eigen::CwiseUnaryOp<Eigen::FUNCTOR<typename Derived::Scalar>, Derived> type; \
+ typedef const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, Derived> type; \
}; \
template<typename Derived> \
struct NAME##_impl<ArrayBase<Derived> > \
@@ -52,17 +52,17 @@
namespace std
{
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,ei_scalar_real_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,ei_scalar_imag_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,ei_scalar_sin_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,ei_scalar_cos_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,ei_scalar_exp_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,ei_scalar_log_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,ei_scalar_abs_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,ei_scalar_sqrt_op)
+ 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(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)
template<typename Derived>
- inline const Eigen::CwiseUnaryOp<Eigen::ei_scalar_pow_op<typename Derived::Scalar>, Derived>
+ inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, Derived>
pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) { \
return x.derived().pow(exponent); \
}
@@ -70,17 +70,20 @@ namespace std
namespace Eigen
{
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_real,ei_scalar_real_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_imag,ei_scalar_imag_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_sin,ei_scalar_sin_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_cos,ei_scalar_cos_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_exp,ei_scalar_exp_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_log,ei_scalar_log_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_abs,ei_scalar_abs_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_abs2,ei_scalar_abs2_op)
- EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(ei_sqrt,ei_scalar_sqrt_op)
+ namespace internal
+ {
+ 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(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 (ei_real_ref, ei_random, ei_isApprox...)
+// TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...)
#endif // EIGEN_GLOBAL_FUNCTIONS_H
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h
index 7c742d867..baaf046ce 100644
--- a/Eigen/src/Core/IO.h
+++ b/Eigen/src/Core/IO.h
@@ -30,6 +30,11 @@ enum { DontAlignCols = 1 };
enum { StreamPrecision = -1,
FullPrecision = -2 };
+namespace internal {
+template<typename Derived>
+std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt);
+}
+
/** \class IOFormat
* \ingroup Core_Module
*
@@ -106,7 +111,7 @@ class WithFormat
friend std::ostream & operator << (std::ostream & s, const WithFormat& wf)
{
- return ei_print_matrix(s, wf.m_matrix.eval(), wf.m_format);
+ return internal::print_matrix(s, wf.m_matrix.eval(), wf.m_format);
}
protected:
@@ -128,18 +133,20 @@ DenseBase<Derived>::format(const IOFormat& fmt) const
return WithFormat<Derived>(derived(), fmt);
}
+namespace internal {
+
template<typename Scalar, bool IsInteger>
-struct ei_significant_decimals_default_impl
+struct significant_decimals_default_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline int run()
{
- return ei_cast<RealScalar,int>(std::ceil(-ei_log(NumTraits<RealScalar>::epsilon())/ei_log(RealScalar(10))));
+ return cast<RealScalar,int>(std::ceil(-log(NumTraits<RealScalar>::epsilon())/log(RealScalar(10))));
}
};
template<typename Scalar>
-struct ei_significant_decimals_default_impl<Scalar, true>
+struct significant_decimals_default_impl<Scalar, true>
{
static inline int run()
{
@@ -148,14 +155,14 @@ struct ei_significant_decimals_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_significant_decimals_impl
- : ei_significant_decimals_default_impl<Scalar, NumTraits<Scalar>::IsInteger>
+struct significant_decimals_impl
+ : significant_decimals_default_impl<Scalar, NumTraits<Scalar>::IsInteger>
{};
/** \internal
* print the matrix \a _m to the output stream \a s using the output format \a fmt */
template<typename Derived>
-std::ostream & ei_print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt)
+std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt)
{
if(_m.size() == 0)
{
@@ -182,7 +189,7 @@ std::ostream & ei_print_matrix(std::ostream & s, const Derived& _m, const IOForm
}
else
{
- explicit_precision = ei_significant_decimals_impl<Scalar>::run();
+ explicit_precision = significant_decimals_impl<Scalar>::run();
}
}
else
@@ -228,6 +235,8 @@ std::ostream & ei_print_matrix(std::ostream & s, const Derived& _m, const IOForm
return s;
}
+} // end namespace internal
+
/** \relates DenseBase
*
* Outputs the matrix, to the given stream.
@@ -244,7 +253,7 @@ std::ostream & operator <<
(std::ostream & s,
const DenseBase<Derived> & m)
{
- return ei_print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT);
+ return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT);
}
#endif // EIGEN_IO_H
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index 763948453..d163e371a 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -76,9 +76,11 @@
*
* \sa Matrix::Map()
*/
+
+namespace internal {
template<typename PlainObjectType, int MapOptions, typename StrideType>
-struct ei_traits<Map<PlainObjectType, MapOptions, StrideType> >
- : public ei_traits<PlainObjectType>
+struct traits<Map<PlainObjectType, MapOptions, StrideType> >
+ : public traits<PlainObjectType>
{
typedef typename PlainObjectType::Index Index;
typedef typename PlainObjectType::Scalar Scalar;
@@ -99,7 +101,7 @@ struct ei_traits<Map<PlainObjectType, MapOptions, StrideType> >
|| HasNoOuterStride
|| ( OuterStrideAtCompileTime!=Dynamic
&& ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ),
- Flags0 = ei_traits<PlainObjectType>::Flags,
+ Flags0 = traits<PlainObjectType>::Flags,
Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit),
Flags2 = HasNoStride ? int(Flags1) : int(Flags1 & ~LinearAccessBit),
Flags = KeepsPacketAccess ? int(Flags2) : (int(Flags2) & ~PacketAccessBit)
@@ -107,6 +109,7 @@ struct ei_traits<Map<PlainObjectType, MapOptions, StrideType> >
private:
enum { Options }; // Expressions don't support Options
};
+}
template<typename PlainObjectType, int MapOptions, typename StrideType> class Map
: public MapBase<Map<PlainObjectType, MapOptions, StrideType> >
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h
index 6b1a25ce2..b1cc3245d 100644
--- a/Eigen/src/Core/MapBase.h
+++ b/Eigen/src/Core/MapBase.h
@@ -34,22 +34,22 @@
* \sa class Map, class Block
*/
template<typename Derived> class MapBase
- : public ei_dense_xpr_base<Derived>::type
+ : public internal::dense_xpr_base<Derived>::type
{
public:
- typedef typename ei_dense_xpr_base<Derived>::type Base;
+ typedef typename internal::dense_xpr_base<Derived>::type Base;
enum {
- RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
+ RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
+ ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
SizeAtCompileTime = Base::SizeAtCompileTime
};
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
using Base::derived;
@@ -111,40 +111,40 @@ template<typename Derived> class MapBase
inline const Scalar& coeff(Index index) const
{
- ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
+ eigen_assert(Derived::IsVectorAtCompileTime || (internal::traits<Derived>::Flags & LinearAccessBit));
return m_data[index * innerStride()];
}
inline Scalar& coeffRef(Index index)
{
- ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
+ eigen_assert(Derived::IsVectorAtCompileTime || (internal::traits<Derived>::Flags & LinearAccessBit));
return const_cast<Scalar*>(m_data)[index * innerStride()];
}
template<int LoadMode>
inline PacketScalar packet(Index row, Index col) const
{
- return ei_ploadt<PacketScalar, LoadMode>
+ return internal::ploadt<PacketScalar, LoadMode>
(m_data + (col * colStride() + row * rowStride()));
}
template<int LoadMode>
inline PacketScalar packet(Index index) const
{
- return ei_ploadt<PacketScalar, LoadMode>(m_data + index * innerStride());
+ return internal::ploadt<PacketScalar, LoadMode>(m_data + index * innerStride());
}
template<int StoreMode>
inline void writePacket(Index row, Index col, const PacketScalar& x)
{
- ei_pstoret<Scalar, PacketScalar, StoreMode>
+ internal::pstoret<Scalar, PacketScalar, StoreMode>
(const_cast<Scalar*>(m_data) + (col * colStride() + row * rowStride()), x);
}
template<int StoreMode>
inline void writePacket(Index index, const PacketScalar& x)
{
- ei_pstoret<Scalar, PacketScalar, StoreMode>
+ internal::pstoret<Scalar, PacketScalar, StoreMode>
(const_cast<Scalar*>(m_data) + index * innerStride(), x);
}
@@ -160,15 +160,15 @@ template<typename Derived> class MapBase
m_cols(ColsAtCompileTime == Dynamic ? size : Index(ColsAtCompileTime))
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- ei_assert(size >= 0);
- ei_assert(data == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
+ eigen_assert(size >= 0);
+ eigen_assert(data == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
checkSanity();
}
inline MapBase(const Scalar* data, Index rows, Index cols)
: m_data(data), m_rows(rows), m_cols(cols)
{
- ei_assert( (data == 0)
+ eigen_assert( (data == 0)
|| ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
&& cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)));
checkSanity();
@@ -186,16 +186,16 @@ template<typename Derived> class MapBase
void checkSanity() const
{
- EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(ei_traits<Derived>::Flags&PacketAccessBit,
- ei_inner_stride_at_compile_time<Derived>::ret==1),
+ EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(internal::traits<Derived>::Flags&PacketAccessBit,
+ internal::inner_stride_at_compile_time<Derived>::ret==1),
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
- ei_assert(EIGEN_IMPLIES(ei_traits<Derived>::Flags&AlignedBit, (size_t(m_data) % (sizeof(Scalar)*ei_packet_traits<Scalar>::size)) == 0)
+ eigen_assert(EIGEN_IMPLIES(internal::traits<Derived>::Flags&AlignedBit, (size_t(m_data) % (sizeof(Scalar)*internal::packet_traits<Scalar>::size)) == 0)
&& "data is not aligned");
}
const Scalar* EIGEN_RESTRICT m_data;
- const ei_variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
- const ei_variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
};
#endif // EIGEN_MAPBASE_H
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index 53e576258..990509d48 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -25,20 +25,22 @@
#ifndef EIGEN_MATHFUNCTIONS_H
#define EIGEN_MATHFUNCTIONS_H
-/** \internal \struct ei_global_math_functions_filtering_base
+namespace internal {
+
+/** \internal \struct global_math_functions_filtering_base
*
* What it does:
* Defines a typedef 'type' as follows:
* - if type T has a member typedef Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl, then
- * ei_global_math_functions_filtering_base<T>::type is a typedef for it.
- * - otherwise, ei_global_math_functions_filtering_base<T>::type is a typedef for T.
+ * global_math_functions_filtering_base<T>::type is a typedef for it.
+ * - otherwise, global_math_functions_filtering_base<T>::type is a typedef for T.
*
* How it's used:
- * To allow to defined the global math functions (like ei_sin...) in certain cases, like the Array expressions.
- * When you do ei_sin(array1+array2), the object array1+array2 has a complicated expression type, all what you want to know
- * is that it inherits ArrayBase. So we implement a partial specialization of ei_sin_impl for ArrayBase<Derived>.
- * So we must make sure to use ei_sin_impl<ArrayBase<Derived> > and not ei_sin_impl<Derived>, otherwise our partial specialization
- * won't be used. How does ei_sin know that? That's exactly what ei_global_math_functions_filtering_base tells it.
+ * To allow to defined the global math functions (like sin...) in certain cases, like the Array expressions.
+ * When you do sin(array1+array2), the object array1+array2 has a complicated expression type, all what you want to know
+ * is that it inherits ArrayBase. So we implement a partial specialization of sin_impl for ArrayBase<Derived>.
+ * So we must make sure to use sin_impl<ArrayBase<Derived> > and not sin_impl<Derived>, otherwise our partial specialization
+ * won't be used. How does sin know that? That's exactly what global_math_functions_filtering_base tells it.
*
* How it's implemented:
* SFINAE in the style of enable_if. Highly susceptible of breaking compilers. With GCC, it sure does work, but if you replace
@@ -46,32 +48,32 @@
*/
template<typename T, typename dummy = void>
-struct ei_global_math_functions_filtering_base
+struct global_math_functions_filtering_base
{
typedef T type;
};
-template<typename T> struct ei_always_void { typedef void type; };
+template<typename T> struct always_void { typedef void type; };
template<typename T>
-struct ei_global_math_functions_filtering_base
+struct global_math_functions_filtering_base
<T,
- typename ei_always_void<typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl>::type
+ typename always_void<typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl>::type
>
{
typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type;
};
-#define EIGEN_MATHFUNC_IMPL(func, scalar) ei_##func##_impl<typename ei_global_math_functions_filtering_base<scalar>::type>
-#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename ei_##func##_retval<typename ei_global_math_functions_filtering_base<scalar>::type>::type
+#define EIGEN_MATHFUNC_IMPL(func, scalar) func##_impl<typename global_math_functions_filtering_base<scalar>::type>
+#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename func##_retval<typename global_math_functions_filtering_base<scalar>::type>::type
/****************************************************************************
-* Implementation of ei_real *
+* Implementation of real *
****************************************************************************/
template<typename Scalar>
-struct ei_real_impl
+struct real_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
@@ -81,7 +83,7 @@ struct ei_real_impl
};
template<typename RealScalar>
-struct ei_real_impl<std::complex<RealScalar> >
+struct real_impl<std::complex<RealScalar> >
{
static inline RealScalar run(const std::complex<RealScalar>& x)
{
@@ -90,23 +92,23 @@ struct ei_real_impl<std::complex<RealScalar> >
};
template<typename Scalar>
-struct ei_real_retval
+struct real_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(real, Scalar) ei_real(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_imag *
+* Implementation of imag *
****************************************************************************/
template<typename Scalar>
-struct ei_imag_impl
+struct imag_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar&)
@@ -116,7 +118,7 @@ struct ei_imag_impl
};
template<typename RealScalar>
-struct ei_imag_impl<std::complex<RealScalar> >
+struct imag_impl<std::complex<RealScalar> >
{
static inline RealScalar run(const std::complex<RealScalar>& x)
{
@@ -125,23 +127,23 @@ struct ei_imag_impl<std::complex<RealScalar> >
};
template<typename Scalar>
-struct ei_imag_retval
+struct imag_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) ei_imag(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_real_ref *
+* Implementation of real_ref *
****************************************************************************/
template<typename Scalar>
-struct ei_real_ref_impl
+struct real_ref_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar& run(Scalar& x)
@@ -155,29 +157,29 @@ struct ei_real_ref_impl
};
template<typename Scalar>
-struct ei_real_ref_retval
+struct real_ref_retval
{
typedef typename NumTraits<Scalar>::Real & type;
};
template<typename Scalar>
-inline typename ei_makeconst< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type ei_real_ref(const Scalar& x)
+inline typename add_const< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x)
{
- return ei_real_ref_impl<Scalar>::run(x);
+ return real_ref_impl<Scalar>::run(x);
}
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) ei_real_ref(Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_imag_ref *
+* Implementation of imag_ref *
****************************************************************************/
template<typename Scalar, bool IsComplex>
-struct ei_imag_ref_default_impl
+struct imag_ref_default_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar& run(Scalar& x)
@@ -191,7 +193,7 @@ struct ei_imag_ref_default_impl
};
template<typename Scalar>
-struct ei_imag_ref_default_impl<Scalar, false>
+struct imag_ref_default_impl<Scalar, false>
{
static inline Scalar run(Scalar&)
{
@@ -204,32 +206,32 @@ struct ei_imag_ref_default_impl<Scalar, false>
};
template<typename Scalar>
-struct ei_imag_ref_impl : ei_imag_ref_default_impl<Scalar, NumTraits<Scalar>::IsComplex> {};
+struct imag_ref_impl : imag_ref_default_impl<Scalar, NumTraits<Scalar>::IsComplex> {};
template<typename Scalar>
-struct ei_imag_ref_retval
+struct imag_ref_retval
{
typedef typename NumTraits<Scalar>::Real & type;
};
template<typename Scalar>
-inline typename ei_makeconst< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type ei_imag_ref(const Scalar& x)
+inline typename add_const< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x)
{
- return ei_imag_ref_impl<Scalar>::run(x);
+ return imag_ref_impl<Scalar>::run(x);
}
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) ei_imag_ref(Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_conj *
+* Implementation of conj *
****************************************************************************/
template<typename Scalar>
-struct ei_conj_impl
+struct conj_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -238,7 +240,7 @@ struct ei_conj_impl
};
template<typename RealScalar>
-struct ei_conj_impl<std::complex<RealScalar> >
+struct conj_impl<std::complex<RealScalar> >
{
static inline std::complex<RealScalar> run(const std::complex<RealScalar>& x)
{
@@ -247,23 +249,23 @@ struct ei_conj_impl<std::complex<RealScalar> >
};
template<typename Scalar>
-struct ei_conj_retval
+struct conj_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) ei_conj(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_abs *
+* Implementation of abs *
****************************************************************************/
template<typename Scalar>
-struct ei_abs_impl
+struct abs_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
@@ -273,23 +275,23 @@ struct ei_abs_impl
};
template<typename Scalar>
-struct ei_abs_retval
+struct abs_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(abs, Scalar) ei_abs(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(abs, Scalar) abs(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(abs, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_abs2 *
+* Implementation of abs2 *
****************************************************************************/
template<typename Scalar>
-struct ei_abs2_impl
+struct abs2_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
@@ -299,7 +301,7 @@ struct ei_abs2_impl
};
template<typename RealScalar>
-struct ei_abs2_impl<std::complex<RealScalar> >
+struct abs2_impl<std::complex<RealScalar> >
{
static inline RealScalar run(const std::complex<RealScalar>& x)
{
@@ -308,92 +310,92 @@ struct ei_abs2_impl<std::complex<RealScalar> >
};
template<typename Scalar>
-struct ei_abs2_retval
+struct abs2_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) ei_abs2(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_norm1 *
+* Implementation of norm1 *
****************************************************************************/
template<typename Scalar, bool IsComplex>
-struct ei_norm1_default_impl
+struct norm1_default_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
{
- return ei_abs(ei_real(x)) + ei_abs(ei_imag(x));
+ return abs(real(x)) + abs(imag(x));
}
};
template<typename Scalar>
-struct ei_norm1_default_impl<Scalar, false>
+struct norm1_default_impl<Scalar, false>
{
static inline Scalar run(const Scalar& x)
{
- return ei_abs(x);
+ return abs(x);
}
};
template<typename Scalar>
-struct ei_norm1_impl : ei_norm1_default_impl<Scalar, NumTraits<Scalar>::IsComplex> {};
+struct norm1_impl : norm1_default_impl<Scalar, NumTraits<Scalar>::IsComplex> {};
template<typename Scalar>
-struct ei_norm1_retval
+struct norm1_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) ei_norm1(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_hypot *
+* Implementation of hypot *
****************************************************************************/
template<typename Scalar>
-struct ei_hypot_impl
+struct hypot_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x, const Scalar& y)
{
- RealScalar _x = ei_abs(x);
- RealScalar _y = ei_abs(y);
+ RealScalar _x = abs(x);
+ RealScalar _y = abs(y);
RealScalar p = std::max(_x, _y);
RealScalar q = std::min(_x, _y);
RealScalar qp = q/p;
- return p * ei_sqrt(RealScalar(1) + qp*qp);
+ return p * sqrt(RealScalar(1) + qp*qp);
}
};
template<typename Scalar>
-struct ei_hypot_retval
+struct hypot_retval
{
typedef typename NumTraits<Scalar>::Real type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) ei_hypot(const Scalar& x, const Scalar& y)
+inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y)
{
return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y);
}
/****************************************************************************
-* Implementation of ei_cast *
+* Implementation of cast *
****************************************************************************/
template<typename OldType, typename NewType>
-struct ei_cast_impl
+struct cast_impl
{
static inline NewType run(const OldType& x)
{
@@ -401,20 +403,20 @@ struct ei_cast_impl
}
};
-// here, for once, we're plainly returning NewType: we don't want ei_cast to do weird things.
+// here, for once, we're plainly returning NewType: we don't want cast to do weird things.
template<typename OldType, typename NewType>
-inline NewType ei_cast(const OldType& x)
+inline NewType cast(const OldType& x)
{
- return ei_cast_impl<OldType, NewType>::run(x);
+ return cast_impl<OldType, NewType>::run(x);
}
/****************************************************************************
-* Implementation of ei_sqrt *
+* Implementation of sqrt *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_sqrt_default_impl
+struct sqrt_default_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -423,7 +425,7 @@ struct ei_sqrt_default_impl
};
template<typename Scalar>
-struct ei_sqrt_default_impl<Scalar, true>
+struct sqrt_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&)
{
@@ -433,26 +435,26 @@ struct ei_sqrt_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_sqrt_impl : ei_sqrt_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct sqrt_impl : sqrt_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_sqrt_retval
+struct sqrt_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) ei_sqrt(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_exp *
+* Implementation of exp *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_exp_default_impl
+struct exp_default_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -461,7 +463,7 @@ struct ei_exp_default_impl
};
template<typename Scalar>
-struct ei_exp_default_impl<Scalar, true>
+struct exp_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&)
{
@@ -471,26 +473,26 @@ struct ei_exp_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_exp_impl : ei_exp_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct exp_impl : exp_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_exp_retval
+struct exp_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(exp, Scalar) ei_exp(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(exp, Scalar) exp(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(exp, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_cos *
+* Implementation of cos *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_cos_default_impl
+struct cos_default_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -499,7 +501,7 @@ struct ei_cos_default_impl
};
template<typename Scalar>
-struct ei_cos_default_impl<Scalar, true>
+struct cos_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&)
{
@@ -509,26 +511,26 @@ struct ei_cos_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_cos_impl : ei_cos_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct cos_impl : cos_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_cos_retval
+struct cos_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(cos, Scalar) ei_cos(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(cos, Scalar) cos(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(cos, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_sin *
+* Implementation of sin *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_sin_default_impl
+struct sin_default_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -537,7 +539,7 @@ struct ei_sin_default_impl
};
template<typename Scalar>
-struct ei_sin_default_impl<Scalar, true>
+struct sin_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&)
{
@@ -547,26 +549,26 @@ struct ei_sin_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_sin_impl : ei_sin_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct sin_impl : sin_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_sin_retval
+struct sin_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(sin, Scalar) ei_sin(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(sin, Scalar) sin(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(sin, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_log *
+* Implementation of log *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_log_default_impl
+struct log_default_impl
{
static inline Scalar run(const Scalar& x)
{
@@ -575,7 +577,7 @@ struct ei_log_default_impl
};
template<typename Scalar>
-struct ei_log_default_impl<Scalar, true>
+struct log_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&)
{
@@ -585,26 +587,26 @@ struct ei_log_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_log_impl : ei_log_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct log_impl : log_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_log_retval
+struct log_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(log, Scalar) ei_log(const Scalar& x)
+inline EIGEN_MATHFUNC_RETVAL(log, Scalar) log(const Scalar& x)
{
return EIGEN_MATHFUNC_IMPL(log, Scalar)::run(x);
}
/****************************************************************************
-* Implementation of ei_atan2 *
+* Implementation of atan2 *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_atan2_default_impl
+struct atan2_default_impl
{
typedef Scalar retval;
static inline Scalar run(const Scalar& x, const Scalar& y)
@@ -614,7 +616,7 @@ struct ei_atan2_default_impl
};
template<typename Scalar>
-struct ei_atan2_default_impl<Scalar, true>
+struct atan2_default_impl<Scalar, true>
{
static inline Scalar run(const Scalar&, const Scalar&)
{
@@ -624,26 +626,26 @@ struct ei_atan2_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_atan2_impl : ei_atan2_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct atan2_impl : atan2_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_atan2_retval
+struct atan2_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(atan2, Scalar) ei_atan2(const Scalar& x, const Scalar& y)
+inline EIGEN_MATHFUNC_RETVAL(atan2, Scalar) atan2(const Scalar& x, const Scalar& y)
{
return EIGEN_MATHFUNC_IMPL(atan2, Scalar)::run(x, y);
}
/****************************************************************************
-* Implementation of ei_pow *
+* Implementation of pow *
****************************************************************************/
template<typename Scalar, bool IsInteger>
-struct ei_pow_default_impl
+struct pow_default_impl
{
typedef Scalar retval;
static inline Scalar run(const Scalar& x, const Scalar& y)
@@ -653,12 +655,12 @@ struct ei_pow_default_impl
};
template<typename Scalar>
-struct ei_pow_default_impl<Scalar, true>
+struct pow_default_impl<Scalar, true>
{
static inline Scalar run(Scalar x, Scalar y)
{
Scalar res = 1;
- ei_assert(!NumTraits<Scalar>::IsSigned || y >= 0);
+ eigen_assert(!NumTraits<Scalar>::IsSigned || y >= 0);
if(y & 1) res *= x;
y >>= 1;
while(y)
@@ -672,43 +674,43 @@ struct ei_pow_default_impl<Scalar, true>
};
template<typename Scalar>
-struct ei_pow_impl : ei_pow_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
+struct pow_impl : pow_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_pow_retval
+struct pow_retval
{
typedef Scalar type;
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) ei_pow(const Scalar& x, const Scalar& y)
+inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y)
{
return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y);
}
/****************************************************************************
-* Implementation of ei_random *
+* Implementation of random *
****************************************************************************/
template<typename Scalar,
bool IsComplex,
bool IsInteger>
-struct ei_random_default_impl {};
+struct random_default_impl {};
template<typename Scalar>
-struct ei_random_impl : ei_random_default_impl<Scalar, NumTraits<Scalar>::IsComplex, NumTraits<Scalar>::IsInteger> {};
+struct random_impl : random_default_impl<Scalar, NumTraits<Scalar>::IsComplex, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar>
-struct ei_random_retval
+struct random_retval
{
typedef Scalar type;
};
-template<typename Scalar> inline EIGEN_MATHFUNC_RETVAL(random, Scalar) ei_random(const Scalar& x, const Scalar& y);
-template<typename Scalar> inline EIGEN_MATHFUNC_RETVAL(random, Scalar) ei_random();
+template<typename Scalar> inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y);
+template<typename Scalar> inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random();
template<typename Scalar>
-struct ei_random_default_impl<Scalar, false, false>
+struct random_default_impl<Scalar, false, false>
{
static inline Scalar run(const Scalar& x, const Scalar& y)
{
@@ -721,7 +723,7 @@ struct ei_random_default_impl<Scalar, false, false>
};
template<typename Scalar>
-struct ei_random_default_impl<Scalar, false, true>
+struct random_default_impl<Scalar, false, true>
{
static inline Scalar run(const Scalar& x, const Scalar& y)
{
@@ -734,28 +736,28 @@ struct ei_random_default_impl<Scalar, false, true>
};
template<typename Scalar>
-struct ei_random_default_impl<Scalar, true, false>
+struct random_default_impl<Scalar, true, false>
{
static inline Scalar run(const Scalar& x, const Scalar& y)
{
- return Scalar(ei_random(ei_real(x), ei_real(y)),
- ei_random(ei_imag(x), ei_imag(y)));
+ return Scalar(random(real(x), real(y)),
+ random(imag(x), imag(y)));
}
static inline Scalar run()
{
typedef typename NumTraits<Scalar>::Real RealScalar;
- return Scalar(ei_random<RealScalar>(), ei_random<RealScalar>());
+ return Scalar(random<RealScalar>(), random<RealScalar>());
}
};
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(random, Scalar) ei_random(const Scalar& x, const Scalar& y)
+inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y)
{
return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(x, y);
}
template<typename Scalar>
-inline EIGEN_MATHFUNC_RETVAL(random, Scalar) ei_random()
+inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random()
{
return EIGEN_MATHFUNC_IMPL(random, Scalar)::run();
}
@@ -767,20 +769,20 @@ inline EIGEN_MATHFUNC_RETVAL(random, Scalar) ei_random()
template<typename Scalar,
bool IsComplex,
bool IsInteger>
-struct ei_scalar_fuzzy_default_impl {};
+struct scalar_fuzzy_default_impl {};
template<typename Scalar>
-struct ei_scalar_fuzzy_default_impl<Scalar, false, false>
+struct scalar_fuzzy_default_impl<Scalar, false, false>
{
typedef typename NumTraits<Scalar>::Real RealScalar;
template<typename OtherScalar>
static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec)
{
- return ei_abs(x) <= ei_abs(y) * prec;
+ return abs(x) <= abs(y) * prec;
}
static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec)
{
- return ei_abs(x - y) <= std::min(ei_abs(x), ei_abs(y)) * prec;
+ return abs(x - y) <= std::min(abs(x), abs(y)) * prec;
}
static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec)
{
@@ -789,7 +791,7 @@ struct ei_scalar_fuzzy_default_impl<Scalar, false, false>
};
template<typename Scalar>
-struct ei_scalar_fuzzy_default_impl<Scalar, false, true>
+struct scalar_fuzzy_default_impl<Scalar, false, true>
{
typedef typename NumTraits<Scalar>::Real RealScalar;
template<typename OtherScalar>
@@ -808,57 +810,57 @@ struct ei_scalar_fuzzy_default_impl<Scalar, false, true>
};
template<typename Scalar>
-struct ei_scalar_fuzzy_default_impl<Scalar, true, false>
+struct scalar_fuzzy_default_impl<Scalar, true, false>
{
typedef typename NumTraits<Scalar>::Real RealScalar;
template<typename OtherScalar>
static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec)
{
- return ei_abs2(x) <= ei_abs2(y) * prec * prec;
+ return abs2(x) <= abs2(y) * prec * prec;
}
static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec)
{
- return ei_abs2(x - y) <= std::min(ei_abs2(x), ei_abs2(y)) * prec * prec;
+ return abs2(x - y) <= std::min(abs2(x), abs2(y)) * prec * prec;
}
};
template<typename Scalar>
-struct ei_scalar_fuzzy_impl : ei_scalar_fuzzy_default_impl<Scalar, NumTraits<Scalar>::IsComplex, NumTraits<Scalar>::IsInteger> {};
+struct scalar_fuzzy_impl : scalar_fuzzy_default_impl<Scalar, NumTraits<Scalar>::IsComplex, NumTraits<Scalar>::IsInteger> {};
template<typename Scalar, typename OtherScalar>
-inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y,
+inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y,
typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision())
{
- return ei_scalar_fuzzy_impl<Scalar>::template isMuchSmallerThan<OtherScalar>(x, y, precision);
+ return scalar_fuzzy_impl<Scalar>::template isMuchSmallerThan<OtherScalar>(x, y, precision);
}
template<typename Scalar>
-inline bool ei_isApprox(const Scalar& x, const Scalar& y,
+inline bool isApprox(const Scalar& x, const Scalar& y,
typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision())
{
- return ei_scalar_fuzzy_impl<Scalar>::isApprox(x, y, precision);
+ return scalar_fuzzy_impl<Scalar>::isApprox(x, y, precision);
}
template<typename Scalar>
-inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y,
+inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y,
typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision())
{
- return ei_scalar_fuzzy_impl<Scalar>::isApproxOrLessThan(x, y, precision);
+ return scalar_fuzzy_impl<Scalar>::isApproxOrLessThan(x, y, precision);
}
/******************************************
*** The special case of the bool type ***
******************************************/
-template<> struct ei_random_impl<bool>
+template<> struct random_impl<bool>
{
static inline bool run()
{
- return ei_random<int>(0,1)==0 ? false : true;
+ return random<int>(0,1)==0 ? false : true;
}
};
-template<> struct ei_scalar_fuzzy_impl<bool>
+template<> struct scalar_fuzzy_impl<bool>
{
static inline bool isApprox(bool x, bool y, bool)
{
@@ -866,4 +868,6 @@ template<> struct ei_scalar_fuzzy_impl<bool>
}
};
+} // end namespace internal
+
#endif // EIGEN_MATHFUNCTIONS_H
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index 9d8ff6640..e0dbd101e 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -109,8 +109,10 @@
*
* \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy
*/
+
+namespace internal {
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
-struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef _Scalar Scalar;
typedef Dense StorageKind;
@@ -121,24 +123,25 @@ struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
ColsAtCompileTime = _Cols,
MaxRowsAtCompileTime = _MaxRows,
MaxColsAtCompileTime = _MaxCols,
- Flags = ei_compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret,
+ Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret,
CoeffReadCost = NumTraits<Scalar>::ReadCost,
Options = _Options,
InnerStrideAtCompileTime = 1,
OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime
};
};
+}
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
class Matrix
- : public DenseStorageBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
+ : public PlainObjectBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
public:
/** \brief Base class typedef.
- * \sa DenseStorageBase
+ * \sa PlainObjectBase
*/
- typedef DenseStorageBase<Matrix> Base;
+ typedef PlainObjectBase<Matrix> Base;
enum { Options = _Options };
@@ -217,8 +220,8 @@ class Matrix
}
// FIXME is it still needed
- Matrix(ei_constructor_without_unaligned_array_assert)
- : Base(ei_constructor_without_unaligned_array_assert())
+ 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 }
/** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors
@@ -232,8 +235,8 @@ class Matrix
{
Base::_check_template_params();
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix)
- ei_assert(dim > 0);
- ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim);
+ eigen_assert(dim > 0);
+ eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim);
EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
}
@@ -340,7 +343,7 @@ class Matrix
protected:
template <typename Derived, typename OtherDerived, bool IsVector>
- friend struct ei_conservative_resize_like_impl;
+ friend struct internal::conservative_resize_like_impl;
using Base::m_storage;
};
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index 2765db5b3..a1b84bd94 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -61,10 +61,10 @@ template<typename Derived> class MatrixBase
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
typedef MatrixBase StorageBaseType;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseBase<Derived> Base;
@@ -115,30 +115,30 @@ template<typename Derived> class MatrixBase
* the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed
* that the return type of eval() is either PlainObject or const PlainObject&.
*/
- typedef Matrix<typename ei_traits<Derived>::Scalar,
- ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime,
- AutoAlign | (ei_traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
- ei_traits<Derived>::MaxRowsAtCompileTime,
- ei_traits<Derived>::MaxColsAtCompileTime
+ typedef Matrix<typename internal::traits<Derived>::Scalar,
+ internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime,
+ AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ internal::traits<Derived>::MaxRowsAtCompileTime,
+ internal::traits<Derived>::MaxColsAtCompileTime
> PlainObject;
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** \internal Represents a matrix with all coefficients equal to one another*/
- typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Derived> ConstantReturnType;
+ typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Derived> ConstantReturnType;
/** \internal the return type of MatrixBase::adjoint() */
- typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<Derived> >,
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Eigen::Transpose<Derived> >,
Transpose<Derived>
- >::ret AdjointReturnType;
+ >::type AdjointReturnType;
/** \internal Return type of eigenvalues() */
- typedef Matrix<std::complex<RealScalar>, ei_traits<Derived>::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType;
+ typedef Matrix<std::complex<RealScalar>, internal::traits<Derived>::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType;
/** \internal the return type of identity */
- typedef CwiseNullaryOp<ei_scalar_identity_op<Scalar>,Derived> IdentityReturnType;
+ typedef CwiseNullaryOp<internal::scalar_identity_op<Scalar>,Derived> IdentityReturnType;
/** \internal the return type of unit vectors */
- typedef Block<CwiseNullaryOp<ei_scalar_identity_op<Scalar>, SquareMatrixType>,
- ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime> BasisReturnType;
+ typedef Block<CwiseNullaryOp<internal::scalar_identity_op<Scalar>, SquareMatrixType>,
+ internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime> BasisReturnType;
#endif // not EIGEN_PARSED_BY_DOXYGEN
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase
@@ -277,8 +277,8 @@ template<typename Derived> class MatrixBase
inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
inline ForceAlignedAccess<Derived> forceAlignedAccess();
- template<bool Enable> inline typename ei_makeconst<typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret>::type forceAlignedAccessIf() const;
- template<bool Enable> inline typename ei_meta_if<Enable,ForceAlignedAccess<Derived>,Derived&>::ret forceAlignedAccessIf();
+ template<bool Enable> inline typename internal::add_const<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type forceAlignedAccessIf() const;
+ template<bool Enable> inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
Scalar trace() const;
@@ -299,7 +299,7 @@ template<typename Derived> class MatrixBase
const FullPivLU<PlainObject> fullPivLu() const;
const PartialPivLU<PlainObject> partialPivLu() const;
const PartialPivLU<PlainObject> lu() const;
- const ei_inverse_impl<Derived> inverse() const;
+ const internal::inverse_impl<Derived> inverse() const;
template<typename ResultType>
void computeInverseAndDetWithCheck(
ResultType& inverse,
@@ -331,7 +331,7 @@ template<typename Derived> class MatrixBase
/////////// SVD module ///////////
- SVD<PlainObject> svd() const;
+ JacobiSVD<PlainObject> jacobiSvd(unsigned int computationOptions = 0) const;
/////////// Geometry module ///////////
@@ -346,9 +346,9 @@ template<typename Derived> class MatrixBase
SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1
};
typedef Block<Derived,
- ei_traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
- ei_traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne;
- typedef CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>,
+ internal::traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
+ internal::traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne;
+ typedef CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>,
StartMinusOne > HNormalizedReturnType;
HNormalizedReturnType hnormalized() const;
@@ -377,13 +377,13 @@ template<typename Derived> class MatrixBase
///////// Jacobi module /////////
template<typename OtherScalar>
- void applyOnTheLeft(Index p, Index q, const PlanarRotation<OtherScalar>& j);
+ void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j);
template<typename OtherScalar>
- void applyOnTheRight(Index p, Index q, const PlanarRotation<OtherScalar>& j);
+ void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
///////// MatrixFunctions module /////////
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
const MatrixExponentialReturnValue<Derived> exp() const;
const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const;
const MatrixFunctionReturnValue<Derived> cosh() const;
diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h
index 885002e26..a6104d2a4 100644
--- a/Eigen/src/Core/NestByValue.h
+++ b/Eigen/src/Core/NestByValue.h
@@ -38,16 +38,19 @@
*
* \sa MatrixBase::nestByValue()
*/
+
+namespace internal {
template<typename ExpressionType>
-struct ei_traits<NestByValue<ExpressionType> > : public ei_traits<ExpressionType>
+struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
{};
+}
template<typename ExpressionType> class NestByValue
- : public ei_dense_xpr_base< NestByValue<ExpressionType> >::type
+ : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
{
public:
- typedef typename ei_dense_xpr_base<NestByValue>::type Base;
+ typedef typename internal::dense_xpr_base<NestByValue>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
diff --git a/Eigen/src/Core/NoAlias.h b/Eigen/src/Core/NoAlias.h
index 53ad3bfee..da64affcf 100644
--- a/Eigen/src/Core/NoAlias.h
+++ b/Eigen/src/Core/NoAlias.h
@@ -51,17 +51,17 @@ class NoAlias
* \sa MatrixBase::lazyAssign() */
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
- { return ei_assign_selector<ExpressionType,OtherDerived,false>::run(m_expression,other.derived()); }
+ { return internal::assign_selector<ExpressionType,OtherDerived,false>::run(m_expression,other.derived()); }
/** \sa MatrixBase::operator+= */
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
{
- typedef SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
+ typedef SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
SelfAdder tmp(m_expression);
- typedef typename ei_nested<OtherDerived>::type OtherDerivedNested;
- typedef typename ei_cleantype<OtherDerivedNested>::type _OtherDerivedNested;
- ei_assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
+ typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
+ typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
+ internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
return m_expression;
}
@@ -69,11 +69,11 @@ class NoAlias
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
{
- typedef SelfCwiseBinaryOp<ei_scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
+ typedef SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
SelfAdder tmp(m_expression);
- typedef typename ei_nested<OtherDerived>::type OtherDerivedNested;
- typedef typename ei_cleantype<OtherDerivedNested>::type _OtherDerivedNested;
- ei_assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
+ typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
+ typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
+ internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
return m_expression;
}
diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h
index 9e6e35a04..edc2ad2c4 100644
--- a/Eigen/src/Core/NumTraits.h
+++ b/Eigen/src/Core/NumTraits.h
@@ -40,7 +40,7 @@
* is a typedef to \a U.
* \li A typedef \a NonInteger, giving the type that should be used for operations producing non-integral values,
* such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives
- * \a T again. Note however that many Eigen functions such as ei_sqrt simply refuse to
+ * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to
* take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is
* only intended as a helper for code that needs to explicitly promote types.
* \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what
@@ -71,11 +71,11 @@ template<typename T> struct GenericNumTraits
};
typedef T Real;
- typedef typename ei_meta_if<
+ typedef typename internal::conditional<
IsInteger,
- typename ei_meta_if<sizeof(T)<=2, float, double>::ret,
+ typename internal::conditional<sizeof(T)<=2, float, double>::type,
T
- >::ret NonInteger;
+ >::type NonInteger;
typedef T Nested;
inline static Real epsilon() { return std::numeric_limits<T>::epsilon(); }
diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h
index afe37ef6d..1f333adea 100644
--- a/Eigen/src/Core/PermutationMatrix.h
+++ b/Eigen/src/Core/PermutationMatrix.h
@@ -48,20 +48,25 @@
*
* \sa class DiagonalMatrix
*/
-template<typename PermutationType, typename MatrixType, int Side, bool Transposed=false> struct ei_permut_matrix_product_retval;
+
+namespace internal {
+
+template<typename PermutationType, typename MatrixType, int Side, bool Transposed=false> struct permut_matrix_product_retval;
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
-struct ei_traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
- : ei_traits<Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
+struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
+ : traits<Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
{};
+} // end namespace internal
+
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
class PermutationMatrix : public EigenBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
{
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
- typedef ei_traits<PermutationMatrix> Traits;
+ typedef internal::traits<PermutationMatrix> Traits;
typedef Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime>
DenseMatrixType;
enum {
@@ -211,7 +216,7 @@ class PermutationMatrix : public EigenBase<PermutationMatrix<SizeAtCompileTime,
*/
PermutationMatrix& applyTranspositionOnTheLeft(Index i, Index j)
{
- ei_assert(i>=0 && j>=0 && i<m_indices.size() && j<m_indices.size());
+ eigen_assert(i>=0 && j>=0 && i<m_indices.size() && j<m_indices.size());
for(Index k = 0; k < m_indices.size(); ++k)
{
if(m_indices.coeff(k) == i) m_indices.coeffRef(k) = j;
@@ -230,7 +235,7 @@ class PermutationMatrix : public EigenBase<PermutationMatrix<SizeAtCompileTime,
*/
PermutationMatrix& applyTranspositionOnTheRight(Index i, Index j)
{
- ei_assert(i>=0 && j>=0 && i<m_indices.size() && j<m_indices.size());
+ eigen_assert(i>=0 && j>=0 && i<m_indices.size() && j<m_indices.size());
std::swap(m_indices.coeffRef(i), m_indices.coeffRef(j));
return *this;
}
@@ -262,7 +267,7 @@ class PermutationMatrix : public EigenBase<PermutationMatrix<SizeAtCompileTime,
PermutationMatrix(Product_t, const PermutationMatrix& lhs, const PermutationMatrix& rhs)
: m_indices(lhs.m_indices.size())
{
- ei_assert(lhs.cols() == rhs.rows());
+ eigen_assert(lhs.cols() == rhs.rows());
for (int i=0; i<rows();++i) m_indices.coeffRef(i) = lhs.m_indices.coeff(rhs.m_indices.coeff(i));
}
#endif
@@ -301,11 +306,11 @@ class PermutationMatrix : public EigenBase<PermutationMatrix<SizeAtCompileTime,
/** \returns the matrix with the permutation applied to the columns.
*/
template<typename Derived, int SizeAtCompileTime, int MaxSizeAtCompileTime>
-inline const ei_permut_matrix_product_retval<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
+inline const internal::permut_matrix_product_retval<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
operator*(const MatrixBase<Derived>& matrix,
const PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> &permutation)
{
- return ei_permut_matrix_product_retval
+ return internal::permut_matrix_product_retval
<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
(permutation, matrix.derived());
}
@@ -313,29 +318,31 @@ operator*(const MatrixBase<Derived>& matrix,
/** \returns the matrix with the permutation applied to the rows.
*/
template<typename Derived, int SizeAtCompileTime, int MaxSizeAtCompileTime>
-inline const ei_permut_matrix_product_retval
+inline const internal::permut_matrix_product_retval
<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheLeft>
operator*(const PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> &permutation,
const MatrixBase<Derived>& matrix)
{
- return ei_permut_matrix_product_retval
+ return internal::permut_matrix_product_retval
<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheLeft>
(permutation, matrix.derived());
}
+namespace internal {
+
template<typename PermutationType, typename MatrixType, int Side, bool Transposed>
-struct ei_traits<ei_permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
+struct traits<permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
{
typedef typename MatrixType::PlainObject ReturnType;
};
template<typename PermutationType, typename MatrixType, int Side, bool Transposed>
-struct ei_permut_matrix_product_retval
- : public ReturnByValue<ei_permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
+struct permut_matrix_product_retval
+ : public ReturnByValue<permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
{
- typedef typename ei_cleantype<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
+ typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
- ei_permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix)
+ permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix)
: m_permutation(perm), m_matrix(matrix)
{}
@@ -346,7 +353,7 @@ struct ei_permut_matrix_product_retval
{
const int n = Side==OnTheLeft ? rows() : cols();
- if(ei_is_same_type<MatrixTypeNestedCleaned,Dest>::ret && ei_extract_data(dst) == ei_extract_data(m_matrix))
+ if(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix))
{
// apply the permutation inplace
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(m_permutation.size());
@@ -396,10 +403,12 @@ struct ei_permut_matrix_product_retval
/* Template partial specialization for transposed/inverse permutations */
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
-struct ei_traits<Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> > >
- : ei_traits<Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
+struct traits<Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> > >
+ : traits<Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
{};
+} // end namespace internal
+
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
class Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
: public EigenBase<Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> > >
@@ -409,7 +418,7 @@ class Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
public:
#ifndef EIGEN_PARSED_BY_DOXYGEN
- typedef ei_traits<PermutationType> Traits;
+ typedef internal::traits<PermutationType> Traits;
typedef Matrix<int,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime>
DenseMatrixType;
enum {
@@ -446,19 +455,19 @@ class Transpose<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime> >
/** \returns the matrix with the inverse permutation applied to the columns.
*/
template<typename Derived> friend
- inline const ei_permut_matrix_product_retval<PermutationType, Derived, OnTheRight, true>
+ inline const internal::permut_matrix_product_retval<PermutationType, Derived, OnTheRight, true>
operator*(const MatrixBase<Derived>& matrix, const Transpose& trPerm)
{
- return ei_permut_matrix_product_retval<PermutationType, Derived, OnTheRight, true>(trPerm.m_permutation, matrix.derived());
+ return internal::permut_matrix_product_retval<PermutationType, Derived, OnTheRight, true>(trPerm.m_permutation, matrix.derived());
}
/** \returns the matrix with the inverse permutation applied to the rows.
*/
template<typename Derived>
- inline const ei_permut_matrix_product_retval<PermutationType, Derived, OnTheLeft, true>
+ inline const internal::permut_matrix_product_retval<PermutationType, Derived, OnTheLeft, true>
operator*(const MatrixBase<Derived>& matrix) const
{
- return ei_permut_matrix_product_retval<PermutationType, Derived, OnTheLeft, true>(m_permutation, matrix.derived());
+ return internal::permut_matrix_product_retval<PermutationType, Derived, OnTheLeft, true>(m_permutation, matrix.derived());
}
const PermutationType& nestedPermutation() const { return m_permutation; }
diff --git a/Eigen/src/Core/DenseStorageBase.h b/Eigen/src/Core/PlainObjectBase.h
index 94b3e23a8..6bb42f1c9 100644
--- a/Eigen/src/Core/DenseStorageBase.h
+++ b/Eigen/src/Core/PlainObjectBase.h
@@ -32,24 +32,29 @@
# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
#endif
-template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct ei_conservative_resize_like_impl;
-template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct ei_matrix_swap_impl;
+namespace internal {
+
+template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct conservative_resize_like_impl;
+
+template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct matrix_swap_impl;
+
+} // end namespace internal
/**
* \brief %Dense storage base class for matrices and arrays.
* \sa \ref TopicClassHierarchy
*/
template<typename Derived>
-class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
+class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
{
public:
- enum { Options = ei_traits<Derived>::Options };
- typedef typename ei_dense_xpr_base<Derived>::type Base;
+ enum { Options = internal::traits<Derived>::Options };
+ typedef typename internal::dense_xpr_base<Derived>::type Base;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
using Base::RowsAtCompileTime;
@@ -67,7 +72,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
typedef class Eigen::Map<Derived, Aligned> AlignedMapType;
protected:
- ei_matrix_storage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
+ DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
public:
enum { NeedsToAlign = (!(Options&DontAlign))
@@ -109,7 +114,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const
{
- return ei_ploadt<PacketScalar, LoadMode>
+ return internal::ploadt<PacketScalar, LoadMode>
(m_storage.data() + (Flags & RowMajorBit
? col + row * m_storage.cols()
: row + col * m_storage.rows()));
@@ -118,13 +123,13 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
{
- return ei_ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
+ return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
}
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketScalar& x)
{
- ei_pstoret<Scalar, PacketScalar, StoreMode>
+ internal::pstoret<Scalar, PacketScalar, StoreMode>
(m_storage.data() + (Flags & RowMajorBit
? col + row * m_storage.cols()
: row + col * m_storage.rows()), x);
@@ -133,7 +138,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& x)
{
- ei_pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x);
+ internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x);
}
/** \returns a const pointer to the data array of this matrix */
@@ -185,8 +190,8 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
*/
inline void resize(Index size)
{
- EIGEN_STATIC_ASSERT_VECTOR_ONLY(DenseStorageBase)
- ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
+ eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO
bool size_changed = size != this->size();
#endif
@@ -239,12 +244,12 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
const Index othersize = other.rows()*other.cols();
if(RowsAtCompileTime == 1)
{
- ei_assert(other.rows() == 1 || other.cols() == 1);
+ eigen_assert(other.rows() == 1 || other.cols() == 1);
resize(1, othersize);
}
else if(ColsAtCompileTime == 1)
{
- ei_assert(other.rows() == 1 || other.cols() == 1);
+ eigen_assert(other.rows() == 1 || other.cols() == 1);
resize(othersize, 1);
}
else resize(other.rows(), other.cols());
@@ -261,7 +266,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
*/
EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols)
{
- ei_conservative_resize_like_impl<Derived>::run(*this, rows, cols);
+ internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
}
EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t)
@@ -286,19 +291,19 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
*/
EIGEN_STRONG_INLINE void conservativeResize(Index size)
{
- ei_conservative_resize_like_impl<Derived>::run(*this, size);
+ internal::conservative_resize_like_impl<Derived>::run(*this, size);
}
template<typename OtherDerived>
EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase<OtherDerived>& other)
{
- ei_conservative_resize_like_impl<Derived,OtherDerived>::run(*this, other);
+ internal::conservative_resize_like_impl<Derived,OtherDerived>::run(*this, other);
}
/** This is a special case of the templated operator=. Its purpose is to
* prevent a default operator= from hiding the templated operator=.
*/
- EIGEN_STRONG_INLINE Derived& operator=(const DenseStorageBase& other)
+ EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other)
{
return _set(other);
}
@@ -318,7 +323,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
return Base::operator=(func);
}
- EIGEN_STRONG_INLINE explicit DenseStorageBase() : m_storage()
+ EIGEN_STRONG_INLINE explicit PlainObjectBase() : m_storage()
{
// _check_template_params();
// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
@@ -327,14 +332,14 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
#ifndef EIGEN_PARSED_BY_DOXYGEN
// FIXME is it still needed ?
/** \internal */
- DenseStorageBase(ei_constructor_without_unaligned_array_assert)
- : m_storage(ei_constructor_without_unaligned_array_assert())
+ 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
}
#endif
- EIGEN_STRONG_INLINE DenseStorageBase(Index size, Index rows, Index cols)
+ EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
: m_storage(size, rows, cols)
{
// _check_template_params();
@@ -353,7 +358,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
/** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */
template<typename OtherDerived>
- EIGEN_STRONG_INLINE DenseStorageBase(const EigenBase<OtherDerived> &other)
+ EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived> &other)
: m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
{
_check_template_params();
@@ -430,7 +435,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other)
{
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
- ei_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
+ eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
: (rows() == other.rows() && cols() == other.cols())))
&& "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
#else
@@ -455,15 +460,15 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived& _set(const DenseBase<OtherDerived>& other)
{
- _set_selector(other.derived(), typename ei_meta_if<static_cast<bool>(int(OtherDerived::Flags) & EvalBeforeAssigningBit), ei_meta_true, ei_meta_false>::ret());
+ _set_selector(other.derived(), typename internal::conditional<static_cast<bool>(int(OtherDerived::Flags) & EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type());
return this->derived();
}
template<typename OtherDerived>
- EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const ei_meta_true&) { _set_noalias(other.eval()); }
+ EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::true_type&) { _set_noalias(other.eval()); }
template<typename OtherDerived>
- EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const ei_meta_false&) { _set_noalias(other); }
+ EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::false_type&) { _set_noalias(other); }
/** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which
* is the case when creating a new matrix) so one can enforce lazy evaluation.
@@ -478,27 +483,27 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
//_resize_to_match(other);
// the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
// it wouldn't allow to copy a row-vector into a column-vector.
- return ei_assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
+ return internal::assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
}
template<typename T0, typename T1>
- EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename ei_enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
+ EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
{
- ei_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
+ eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
&& cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
m_storage.resize(rows*cols,rows,cols);
EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
}
template<typename T0, typename T1>
- EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename ei_enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
+ EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename internal::enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
{
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(DenseStorageBase, 2)
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
m_storage.data()[0] = x;
m_storage.data()[1] = y;
}
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
- friend struct ei_matrix_swap_impl;
+ friend struct internal::matrix_swap_impl;
/** \internal generic implementation of swap for dense storage since for dynamic-sized matrices of same type it is enough to swap the
* data pointers.
@@ -506,8 +511,8 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
template<typename OtherDerived>
void _swap(DenseBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other)
{
- enum { SwapPointers = ei_is_same_type<Derived, OtherDerived>::ret && Base::SizeAtCompileTime==Dynamic };
- ei_matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.const_cast_derived());
+ enum { SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime==Dynamic };
+ internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.const_cast_derived());
}
public:
@@ -529,7 +534,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
};
template <typename Derived, typename OtherDerived, bool IsVector>
-struct ei_conservative_resize_like_impl
+struct internal::conservative_resize_like_impl
{
typedef typename Derived::Index Index;
static void run(DenseBase<Derived>& _this, Index rows, Index cols)
@@ -588,8 +593,10 @@ struct ei_conservative_resize_like_impl
}
};
+namespace internal {
+
template <typename Derived, typename OtherDerived>
-struct ei_conservative_resize_like_impl<Derived,OtherDerived,true>
+struct conservative_resize_like_impl<Derived,OtherDerived,true>
{
typedef typename Derived::Index Index;
static void run(DenseBase<Derived>& _this, Index size)
@@ -615,7 +622,7 @@ struct ei_conservative_resize_like_impl<Derived,OtherDerived,true>
};
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
-struct ei_matrix_swap_impl
+struct matrix_swap_impl
{
static inline void run(MatrixTypeA& a, MatrixTypeB& b)
{
@@ -624,7 +631,7 @@ struct ei_matrix_swap_impl
};
template<typename MatrixTypeA, typename MatrixTypeB>
-struct ei_matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
+struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
{
static inline void run(MatrixTypeA& a, MatrixTypeB& b)
{
@@ -632,4 +639,6 @@ struct ei_matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
}
};
+} // end namespace internal
+
#endif // EIGEN_DENSESTORAGEBASE_H
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index 8e82338e7..c8b5b6b52 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -45,20 +45,22 @@
*
* \sa ProductReturnType, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
*/
-template<typename Lhs, typename Rhs, int ProductType = ei_product_type<Lhs,Rhs>::value>
+template<typename Lhs, typename Rhs, int ProductType = internal::product_type<Lhs,Rhs>::value>
class GeneralProduct;
-template<int Rows, int Cols, int Depth> struct ei_product_type_selector;
-
enum {
Large = 2,
Small = 3
};
-template<typename Lhs, typename Rhs> struct ei_product_type
+namespace internal {
+
+template<int Rows, int Cols, int Depth> struct product_type_selector;
+
+template<typename Lhs, typename Rhs> struct product_type
{
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
+ typedef typename remove_all<Lhs>::type _Lhs;
+ typedef typename remove_all<Rhs>::type _Rhs;
enum {
Rows = _Lhs::MaxRowsAtCompileTime,
Cols = _Rhs::MaxColsAtCompileTime,
@@ -73,11 +75,11 @@ private:
cols_select = Cols == Dynamic || Cols >=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Cols==1 ? 1 : Small),
depth_select = Depth == Dynamic || Depth>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Depth==1 ? 1 : Small)
};
- typedef ei_product_type_selector<rows_select, cols_select, depth_select> product_type_selector;
+ typedef product_type_selector<rows_select, cols_select, depth_select> selector;
public:
enum {
- value = product_type_selector::ret
+ value = selector::ret
};
#ifdef EIGEN_DEBUG_PRODUCT
static void debug()
@@ -93,32 +95,35 @@ public:
#endif
};
+
/* The following allows to select the kind of product at compile time
* based on the three dimensions of the product.
* This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
// FIXME I'm not sure the current mapping is the ideal one.
-template<int M, int N> struct ei_product_type_selector<M,N,1> { enum { ret = OuterProduct }; };
-template<int Depth> struct ei_product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; };
-template<> struct ei_product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; };
-template<> struct ei_product_type_selector<Small,1, Small> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Small,Small,Small> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Small, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Small, Large, 1> { enum { ret = LazyCoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Large, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; };
-template<> struct ei_product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Large,1, Small> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Large,1, Large> { enum { ret = GemvProduct }; };
-template<> struct ei_product_type_selector<Small,1, Large> { enum { ret = CoeffBasedProductMode }; };
-template<> struct ei_product_type_selector<Small,Small,Large> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Large,Small,Large> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Small,Large,Large> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Large,Large,Large> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Large,Small,Small> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Small,Large,Small> { enum { ret = GemmProduct }; };
-template<> struct ei_product_type_selector<Large,Large,Small> { enum { ret = GemmProduct }; };
+template<int M, int N> struct product_type_selector<M,N,1> { enum { ret = OuterProduct }; };
+template<int Depth> struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; };
+template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; };
+template<> struct product_type_selector<Small,1, Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<Small,Small,Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<Small, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
+template<> struct product_type_selector<Small, Large, 1> { enum { ret = LazyCoeffBasedProductMode }; };
+template<> struct product_type_selector<Large, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
+template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; };
+template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<Large,1, Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<Large,1, Large> { enum { ret = GemvProduct }; };
+template<> struct product_type_selector<Small,1, Large> { enum { ret = CoeffBasedProductMode }; };
+template<> struct product_type_selector<Small,Small,Large> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Large,Small,Large> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Small,Large,Large> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Large,Large,Large> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Large,Small,Small> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Small,Large,Small> { enum { ret = GemmProduct }; };
+template<> struct product_type_selector<Large,Large,Small> { enum { ret = GemmProduct }; };
+
+} // end namespace internal
/** \class ProductReturnType
* \ingroup Core_Module
@@ -127,7 +132,7 @@ template<> struct ei_product_type_selector<Large,Large,Small> { en
*
* \param Lhs the type of the left-hand side
* \param Rhs the type of the right-hand side
- * \param ProductMode the type of the product (determined automatically by ei_product_mode)
+ * \param ProductMode the type of the product (determined automatically by internal::product_mode)
*
* This class defines the typename Type representing the optimized product expression
* between two matrix expressions. In practice, using ProductReturnType<Lhs,Rhs>::Type
@@ -141,8 +146,8 @@ template<typename Lhs, typename Rhs, int ProductType>
struct ProductReturnType
{
// TODO use the nested type to reduce instanciations ????
-// typedef typename ei_nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
-// typedef typename ei_nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
+// typedef typename internal::nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
+// typedef typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
typedef GeneralProduct<Lhs/*Nested*/, Rhs/*Nested*/, ProductType> Type;
};
@@ -150,16 +155,16 @@ struct ProductReturnType
template<typename Lhs, typename Rhs>
struct ProductReturnType<Lhs,Rhs,CoeffBasedProductMode>
{
- typedef typename ei_nested<Lhs, Rhs::ColsAtCompileTime, typename ei_plain_matrix_type<Lhs>::type >::type LhsNested;
- typedef typename ei_nested<Rhs, Lhs::RowsAtCompileTime, typename ei_plain_matrix_type<Rhs>::type >::type RhsNested;
+ typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
+ typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
typedef CoeffBasedProduct<LhsNested, RhsNested, EvalBeforeAssigningBit | EvalBeforeNestingBit> Type;
};
template<typename Lhs, typename Rhs>
struct ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
{
- typedef typename ei_nested<Lhs, Rhs::ColsAtCompileTime, typename ei_plain_matrix_type<Lhs>::type >::type LhsNested;
- typedef typename ei_nested<Rhs, Lhs::RowsAtCompileTime, typename ei_plain_matrix_type<Rhs>::type >::type RhsNested;
+ typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
+ typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
typedef CoeffBasedProduct<LhsNested, RhsNested, NestByRefBit> Type;
};
@@ -179,21 +184,25 @@ struct LazyProductReturnType : public ProductReturnType<Lhs,Rhs,LazyCoeffBasedPr
// product ends up to a row-vector times col-vector product... To tackle this use
// case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
+namespace internal {
+
template<typename Lhs, typename Rhs>
-struct ei_traits<GeneralProduct<Lhs,Rhs,InnerProduct> >
- : ei_traits<Matrix<typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> >
+struct traits<GeneralProduct<Lhs,Rhs,InnerProduct> >
+ : traits<Matrix<typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> >
{};
+}
+
template<typename Lhs, typename Rhs>
class GeneralProduct<Lhs, Rhs, InnerProduct>
- : ei_no_assignment_operator,
- public Matrix<typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1>
+ : internal::no_assignment_operator,
+ public Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1>
{
- typedef Matrix<typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base;
+ typedef Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base;
public:
GeneralProduct(const Lhs& lhs, const Rhs& rhs)
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<typename Lhs::RealScalar, typename Rhs::RealScalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
@@ -210,13 +219,17 @@ class GeneralProduct<Lhs, Rhs, InnerProduct>
/***********************************************************************
* Implementation of Outer Vector Vector Product
***********************************************************************/
-template<int StorageOrder> struct ei_outer_product_selector;
+
+namespace internal {
+template<int StorageOrder> struct outer_product_selector;
template<typename Lhs, typename Rhs>
-struct ei_traits<GeneralProduct<Lhs,Rhs,OuterProduct> >
- : ei_traits<ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs> >
+struct traits<GeneralProduct<Lhs,Rhs,OuterProduct> >
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs> >
{};
+}
+
template<typename Lhs, typename Rhs>
class GeneralProduct<Lhs, Rhs, OuterProduct>
: public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
@@ -226,17 +239,19 @@ class GeneralProduct<Lhs, Rhs, OuterProduct>
GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<typename Lhs::RealScalar, typename Rhs::RealScalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
}
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
{
- ei_outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
+ internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
}
};
-template<> struct ei_outer_product_selector<ColMajor> {
+namespace internal {
+
+template<> struct outer_product_selector<ColMajor> {
template<typename ProductType, typename Dest>
static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
typedef typename Dest::Index Index;
@@ -248,7 +263,7 @@ template<> struct ei_outer_product_selector<ColMajor> {
}
};
-template<> struct ei_outer_product_selector<RowMajor> {
+template<> struct outer_product_selector<RowMajor> {
template<typename ProductType, typename Dest>
static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) {
typedef typename Dest::Index Index;
@@ -260,6 +275,8 @@ template<> struct ei_outer_product_selector<RowMajor> {
}
};
+} // end namespace internal
+
/***********************************************************************
* Implementation of General Matrix Vector Product
***********************************************************************/
@@ -271,13 +288,17 @@ template<> struct ei_outer_product_selector<RowMajor> {
* Therefore we need a lower level meta selector.
* Furthermore, if the matrix is the rhs, then the product has to be transposed.
*/
+namespace internal {
+
template<typename Lhs, typename Rhs>
-struct ei_traits<GeneralProduct<Lhs,Rhs,GemvProduct> >
- : ei_traits<ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs> >
+struct traits<GeneralProduct<Lhs,Rhs,GemvProduct> >
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs> >
{};
template<int Side, int StorageOrder, bool BlasCompatible>
-struct ei_gemv_selector;
+struct gemv_selector;
+
+} // end namespace internal
template<typename Lhs, typename Rhs>
class GeneralProduct<Lhs, Rhs, GemvProduct>
@@ -291,37 +312,39 @@ class GeneralProduct<Lhs, Rhs, GemvProduct>
GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
{
-// EIGEN_STATIC_ASSERT((ei_is_same_type<typename Lhs::Scalar, typename Rhs::Scalar>::ret),
+// EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value),
// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
}
enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
- typedef typename ei_meta_if<int(Side)==OnTheRight,_LhsNested,_RhsNested>::ret MatrixType;
+ typedef typename internal::conditional<int(Side)==OnTheRight,_LhsNested,_RhsNested>::type MatrixType;
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols());
- ei_gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
- bool(ei_blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha);
+ eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols());
+ internal::gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
+ bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha);
}
};
+namespace internal {
+
// The vector is on the left => transposition
template<int StorageOrder, bool BlasCompatible>
-struct ei_gemv_selector<OnTheLeft,StorageOrder,BlasCompatible>
+struct gemv_selector<OnTheLeft,StorageOrder,BlasCompatible>
{
template<typename ProductType, typename Dest>
static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
{
Transpose<Dest> destT(dest);
enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor };
- ei_gemv_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
+ gemv_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
::run(GeneralProduct<Transpose<typename ProductType::_RhsNested>,Transpose<typename ProductType::_LhsNested>, GemvProduct>
(prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha);
}
};
-template<> struct ei_gemv_selector<OnTheRight,ColMajor,true>
+template<> struct gemv_selector<OnTheRight,ColMajor,true>
{
template<typename ProductType, typename Dest>
static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
@@ -344,15 +367,15 @@ template<> struct ei_gemv_selector<OnTheRight,ColMajor,true>
* RhsBlasTraits::extractScalarFactor(prod.rhs());
enum {
- // FIXME find a way to allow an inner stride on the result if ei_packet_traits<Scalar>::size==1
+ // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex)
};
- bool alphaIsCompatible = (!ComplexByReal) || (ei_imag(actualAlpha)==RealScalar(0));
+ bool alphaIsCompatible = (!ComplexByReal) || (imag(actualAlpha)==RealScalar(0));
bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
- RhsScalar compatibleAlpha = ei_get_factor<ResScalar,RhsScalar>::run(actualAlpha);
+ RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
ResScalar* actualDest;
if (evalToDest)
@@ -371,7 +394,7 @@ template<> struct ei_gemv_selector<OnTheRight,ColMajor,true>
MappedDest(actualDest, dest.size()) = dest;
}
- ei_general_matrix_vector_product
+ general_matrix_vector_product
<Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
actualLhs.rows(), actualLhs.cols(),
&actualLhs.const_cast_derived().coeffRef(0,0), actualLhs.outerStride(),
@@ -390,7 +413,7 @@ template<> struct ei_gemv_selector<OnTheRight,ColMajor,true>
}
};
-template<> struct ei_gemv_selector<OnTheRight,RowMajor,true>
+template<> struct gemv_selector<OnTheRight,RowMajor,true>
{
template<typename ProductType, typename Dest>
static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
@@ -412,9 +435,9 @@ template<> struct ei_gemv_selector<OnTheRight,RowMajor,true>
* RhsBlasTraits::extractScalarFactor(prod.rhs());
enum {
- // FIXME I think here we really have to check for ei_packet_traits<Scalar>::size==1
+ // FIXME I think here we really have to check for packet_traits<Scalar>::size==1
// because in this case it is fine to have an inner stride
- DirectlyUseRhs = ((ei_packet_traits<RhsScalar>::size==1) || (_ActualRhsType::Flags&ActualPacketAccessBit))
+ DirectlyUseRhs = ((packet_traits<RhsScalar>::size==1) || (_ActualRhsType::Flags&ActualPacketAccessBit))
&& (!(_ActualRhsType::Flags & RowMajorBit))
};
@@ -427,7 +450,7 @@ template<> struct ei_gemv_selector<OnTheRight,RowMajor,true>
Map<typename _ActualRhsType::PlainObject>(rhs_data, actualRhs.size()) = actualRhs;
}
- ei_general_matrix_vector_product
+ general_matrix_vector_product
<Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
actualLhs.rows(), actualLhs.cols(),
&actualLhs.const_cast_derived().coeffRef(0,0), actualLhs.outerStride(),
@@ -439,7 +462,7 @@ template<> struct ei_gemv_selector<OnTheRight,RowMajor,true>
}
};
-template<> struct ei_gemv_selector<OnTheRight,ColMajor,false>
+template<> struct gemv_selector<OnTheRight,ColMajor,false>
{
template<typename ProductType, typename Dest>
static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
@@ -452,7 +475,7 @@ template<> struct ei_gemv_selector<OnTheRight,ColMajor,false>
}
};
-template<> struct ei_gemv_selector<OnTheRight,RowMajor,false>
+template<> struct gemv_selector<OnTheRight,RowMajor,false>
{
template<typename ProductType, typename Dest>
static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha)
@@ -465,6 +488,8 @@ template<> struct ei_gemv_selector<OnTheRight,RowMajor,false>
}
};
+} // end namespace internal
+
/***************************************************************************
* Implementation of matrix base methods
***************************************************************************/
@@ -481,7 +506,7 @@ inline const typename ProductReturnType<Derived,OtherDerived>::Type
MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
{
// A note regarding the function declaration: In MSVC, this function will sometimes
- // not be inlined since ei_matrix_storage is an unwindable object for dynamic
+ // not be inlined since DenseStorage is an unwindable object for dynamic
// matrices and product types are holding a member to store the result.
// Thus it does not help tagging this function with EIGEN_STRONG_INLINE.
enum {
@@ -500,7 +525,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
#ifdef EIGEN_DEBUG_PRODUCT
- ei_product_type<Derived,OtherDerived>::debug();
+ internal::product_type<Derived,OtherDerived>::debug();
#endif
return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
}
diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h
index bc2a0f743..e2406839e 100644
--- a/Eigen/src/Core/ProductBase.h
+++ b/Eigen/src/Core/ProductBase.h
@@ -29,29 +29,32 @@
* \ingroup Core_Module
*
*/
+
+namespace internal {
template<typename Derived, typename _Lhs, typename _Rhs>
-struct ei_traits<ProductBase<Derived,_Lhs,_Rhs> >
+struct traits<ProductBase<Derived,_Lhs,_Rhs> >
{
typedef MatrixXpr XprKind;
- typedef typename ei_cleantype<_Lhs>::type Lhs;
- typedef typename ei_cleantype<_Rhs>::type Rhs;
- typedef typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType Scalar;
- typedef typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind,
- typename ei_traits<Rhs>::StorageKind>::ret StorageKind;
- typedef typename ei_promote_index_type<typename ei_traits<Lhs>::Index,
- typename ei_traits<Rhs>::Index>::type Index;
+ typedef typename remove_all<_Lhs>::type Lhs;
+ typedef typename remove_all<_Rhs>::type Rhs;
+ typedef typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType Scalar;
+ typedef typename promote_storage_type<typename traits<Lhs>::StorageKind,
+ typename traits<Rhs>::StorageKind>::ret StorageKind;
+ typedef typename promote_index_type<typename traits<Lhs>::Index,
+ typename traits<Rhs>::Index>::type Index;
enum {
- RowsAtCompileTime = ei_traits<Lhs>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<Rhs>::ColsAtCompileTime,
- MaxRowsAtCompileTime = ei_traits<Lhs>::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = ei_traits<Rhs>::MaxColsAtCompileTime,
+ RowsAtCompileTime = traits<Lhs>::RowsAtCompileTime,
+ ColsAtCompileTime = traits<Rhs>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = traits<Lhs>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = traits<Rhs>::MaxColsAtCompileTime,
Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0)
| EvalBeforeNestingBit | EvalBeforeAssigningBit | NestByRefBit,
// Note that EvalBeforeNestingBit and NestByRefBit
- // are not used in practice because ei_nested is overloaded for products
+ // are not used in practice because nested is overloaded for products
CoeffReadCost = 0 // FIXME why is it needed ?
};
};
+}
#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \
typedef ProductBase<Derived, Lhs, Rhs > Base; \
@@ -77,16 +80,16 @@ class ProductBase : public MatrixBase<Derived>
EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase)
protected:
typedef typename Lhs::Nested LhsNested;
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef ei_blas_traits<_LhsNested> LhsBlasTraits;
+ typedef typename internal::remove_all<LhsNested>::type _LhsNested;
+ typedef internal::blas_traits<_LhsNested> LhsBlasTraits;
typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
- typedef typename ei_cleantype<ActualLhsType>::type _ActualLhsType;
+ typedef typename internal::remove_all<ActualLhsType>::type _ActualLhsType;
typedef typename Rhs::Nested RhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
- typedef ei_blas_traits<_RhsNested> RhsBlasTraits;
+ typedef typename internal::remove_all<RhsNested>::type _RhsNested;
+ typedef internal::blas_traits<_RhsNested> RhsBlasTraits;
typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
- typedef typename ei_cleantype<ActualRhsType>::type _ActualRhsType;
+ typedef typename internal::remove_all<ActualRhsType>::type _ActualRhsType;
// Diagonal of a product: no need to evaluate the arguments because they are going to be evaluated only once
typedef CoeffBasedProduct<LhsNested, RhsNested, 0> FullyLazyCoeffBaseProductType;
@@ -98,7 +101,7 @@ class ProductBase : public MatrixBase<Derived>
ProductBase(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{
- ei_assert(lhs.cols() == rhs.rows()
+ eigen_assert(lhs.cols() == rhs.rows()
&& "invalid matrix product"
&& "if you wanted a coeff-wise or a dot product use the respective explicit functions");
}
@@ -157,11 +160,13 @@ class ProductBase : public MatrixBase<Derived>
// here we need to overload the nested rule for products
// such that the nested type is a const reference to a plain matrix
+namespace internal {
template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
-struct ei_nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
+struct nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
{
typedef PlainObject const& type;
};
+}
template<typename NestedProduct>
class ScaledProduct;
@@ -178,7 +183,7 @@ operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::Scalar x)
{ return ScaledProduct<Derived>(prod.derived(), x); }
template<typename Derived,typename Lhs,typename Rhs>
-typename ei_enable_if<!ei_is_same_type<typename Derived::Scalar,typename Derived::RealScalar>::ret,
+typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value,
const ScaledProduct<Derived> >::type
operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::RealScalar x)
{ return ScaledProduct<Derived>(prod.derived(), x); }
@@ -190,20 +195,21 @@ operator*(typename Derived::Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
{ return ScaledProduct<Derived>(prod.derived(), x); }
template<typename Derived,typename Lhs,typename Rhs>
-typename ei_enable_if<!ei_is_same_type<typename Derived::Scalar,typename Derived::RealScalar>::ret,
+typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value,
const ScaledProduct<Derived> >::type
operator*(typename Derived::RealScalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
{ return ScaledProduct<Derived>(prod.derived(), x); }
-
+namespace internal {
template<typename NestedProduct>
-struct ei_traits<ScaledProduct<NestedProduct> >
- : ei_traits<ProductBase<ScaledProduct<NestedProduct>,
+struct traits<ScaledProduct<NestedProduct> >
+ : traits<ProductBase<ScaledProduct<NestedProduct>,
typename NestedProduct::_LhsNested,
typename NestedProduct::_RhsNested> >
{
- typedef typename ei_traits<NestedProduct>::StorageKind StorageKind;
+ typedef typename traits<NestedProduct>::StorageKind StorageKind;
};
+}
template<typename NestedProduct>
class ScaledProduct
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index 06a20fed0..b7d90103a 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -25,15 +25,20 @@
#ifndef EIGEN_RANDOM_H
#define EIGEN_RANDOM_H
-template<typename Scalar> struct ei_scalar_random_op {
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_random_op)
+namespace internal {
+
+template<typename Scalar> struct scalar_random_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op)
template<typename Index>
- inline const Scalar operator() (Index, Index = 0) const { return ei_random<Scalar>(); }
+ inline const Scalar operator() (Index, Index = 0) const { return random<Scalar>(); }
};
+
template<typename Scalar>
-struct ei_functor_traits<ei_scalar_random_op<Scalar> >
+struct functor_traits<scalar_random_op<Scalar> >
{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false, IsRepeatable = false }; };
+} // end namespace internal
+
/** \returns a random matrix expression
*
* The parameters \a rows and \a cols are the number of rows and of columns of
@@ -53,10 +58,10 @@ struct ei_functor_traits<ei_scalar_random_op<Scalar> >
* \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random()
*/
template<typename Derived>
-inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
+inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
DenseBase<Derived>::Random(Index rows, Index cols)
{
- return NullaryExpr(rows, cols, ei_scalar_random_op<Scalar>());
+ return NullaryExpr(rows, cols, internal::scalar_random_op<Scalar>());
}
/** \returns a random vector expression
@@ -80,10 +85,10 @@ DenseBase<Derived>::Random(Index rows, Index cols)
* \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random()
*/
template<typename Derived>
-inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
+inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
DenseBase<Derived>::Random(Index size)
{
- return NullaryExpr(size, ei_scalar_random_op<Scalar>());
+ return NullaryExpr(size, internal::scalar_random_op<Scalar>());
}
/** \returns a fixed-size random matrix or vector expression
@@ -101,10 +106,10 @@ DenseBase<Derived>::Random(Index size)
* \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index)
*/
template<typename Derived>
-inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
+inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
DenseBase<Derived>::Random()
{
- return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_random_op<Scalar>());
+ return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op<Scalar>());
}
/** Sets all coefficients in this expression to random values.
@@ -131,7 +136,7 @@ inline Derived& DenseBase<Derived>::setRandom()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setRandom(Index size)
+PlainObjectBase<Derived>::setRandom(Index size)
{
resize(size);
return setRandom();
@@ -149,7 +154,7 @@ DenseStorageBase<Derived>::setRandom(Index size)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
-DenseStorageBase<Derived>::setRandom(Index rows, Index cols)
+PlainObjectBase<Derived>::setRandom(Index rows, Index cols)
{
resize(rows, cols);
return setRandom();
diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h
index 504a51229..25febb773 100644
--- a/Eigen/src/Core/Redux.h
+++ b/Eigen/src/Core/Redux.h
@@ -26,6 +26,8 @@
#ifndef EIGEN_REDUX_H
#define EIGEN_REDUX_H
+namespace internal {
+
// TODO
// * implement other kind of vectorization
// * factorize code
@@ -35,11 +37,11 @@
***************************************************************************/
template<typename Func, typename Derived>
-struct ei_redux_traits
+struct redux_traits
{
public:
enum {
- PacketSize = ei_packet_traits<typename Derived::Scalar>::size,
+ PacketSize = packet_traits<typename Derived::Scalar>::size,
InnerMaxSize = int(Derived::IsRowMajor)
? Derived::MaxColsAtCompileTime
: Derived::MaxRowsAtCompileTime
@@ -47,7 +49,7 @@ public:
enum {
MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit)
- && (ei_functor_traits<Func>::PacketAccess),
+ && (functor_traits<Func>::PacketAccess),
MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit),
MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize
};
@@ -63,10 +65,10 @@ public:
enum {
Cost = ( Derived::SizeAtCompileTime == Dynamic
|| Derived::CoeffReadCost == Dynamic
- || (Derived::SizeAtCompileTime!=1 && ei_functor_traits<Func>::Cost == Dynamic)
+ || (Derived::SizeAtCompileTime!=1 && functor_traits<Func>::Cost == Dynamic)
) ? Dynamic
: Derived::SizeAtCompileTime * Derived::CoeffReadCost
- + (Derived::SizeAtCompileTime-1) * ei_functor_traits<Func>::Cost,
+ + (Derived::SizeAtCompileTime-1) * functor_traits<Func>::Cost,
UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize))
};
@@ -85,7 +87,7 @@ public:
/*** no vectorization ***/
template<typename Func, typename Derived, int Start, int Length>
-struct ei_redux_novec_unroller
+struct redux_novec_unroller
{
enum {
HalfLength = Length/2
@@ -95,13 +97,13 @@ struct ei_redux_novec_unroller
EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func& func)
{
- return func(ei_redux_novec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
- ei_redux_novec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func));
+ return func(redux_novec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
+ redux_novec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func));
}
};
template<typename Func, typename Derived, int Start>
-struct ei_redux_novec_unroller<Func, Derived, Start, 1>
+struct redux_novec_unroller<Func, Derived, Start, 1>
{
enum {
outer = Start / Derived::InnerSizeAtCompileTime,
@@ -120,7 +122,7 @@ struct ei_redux_novec_unroller<Func, Derived, Start, 1>
// to prevent false warnings regarding failed inlining though
// for 0 length run() will never be called at all.
template<typename Func, typename Derived, int Start>
-struct ei_redux_novec_unroller<Func, Derived, Start, 0>
+struct redux_novec_unroller<Func, Derived, Start, 0>
{
typedef typename Derived::Scalar Scalar;
EIGEN_STRONG_INLINE static Scalar run(const Derived&, const Func&) { return Scalar(); }
@@ -129,36 +131,36 @@ struct ei_redux_novec_unroller<Func, Derived, Start, 0>
/*** vectorization ***/
template<typename Func, typename Derived, int Start, int Length>
-struct ei_redux_vec_unroller
+struct redux_vec_unroller
{
enum {
- PacketSize = ei_packet_traits<typename Derived::Scalar>::size,
+ PacketSize = packet_traits<typename Derived::Scalar>::size,
HalfLength = Length/2
};
typedef typename Derived::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename packet_traits<Scalar>::type PacketScalar;
EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func& func)
{
return func.packetOp(
- ei_redux_vec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
- ei_redux_vec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func) );
+ redux_vec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
+ redux_vec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func) );
}
};
template<typename Func, typename Derived, int Start>
-struct ei_redux_vec_unroller<Func, Derived, Start, 1>
+struct redux_vec_unroller<Func, Derived, Start, 1>
{
enum {
- index = Start * ei_packet_traits<typename Derived::Scalar>::size,
+ index = Start * packet_traits<typename Derived::Scalar>::size,
outer = index / int(Derived::InnerSizeAtCompileTime),
inner = index % int(Derived::InnerSizeAtCompileTime),
alignment = (Derived::Flags & AlignedBit) ? Aligned : Unaligned
};
typedef typename Derived::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename packet_traits<Scalar>::type PacketScalar;
EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func&)
{
@@ -171,19 +173,19 @@ struct ei_redux_vec_unroller<Func, Derived, Start, 1>
***************************************************************************/
template<typename Func, typename Derived,
- int Traversal = ei_redux_traits<Func, Derived>::Traversal,
- int Unrolling = ei_redux_traits<Func, Derived>::Unrolling
+ int Traversal = redux_traits<Func, Derived>::Traversal,
+ int Unrolling = redux_traits<Func, Derived>::Unrolling
>
-struct ei_redux_impl;
+struct redux_impl;
template<typename Func, typename Derived>
-struct ei_redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>
+struct redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>
{
typedef typename Derived::Scalar Scalar;
typedef typename Derived::Index Index;
static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func)
{
- ei_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
Scalar res;
res = mat.coeffByOuterInner(0, 0);
for(Index i = 1; i < mat.innerSize(); ++i)
@@ -196,23 +198,23 @@ struct ei_redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>
};
template<typename Func, typename Derived>
-struct ei_redux_impl<Func,Derived, DefaultTraversal, CompleteUnrolling>
- : public ei_redux_novec_unroller<Func,Derived, 0, Derived::SizeAtCompileTime>
+struct redux_impl<Func,Derived, DefaultTraversal, CompleteUnrolling>
+ : public redux_novec_unroller<Func,Derived, 0, Derived::SizeAtCompileTime>
{};
template<typename Func, typename Derived>
-struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
+struct redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
{
typedef typename Derived::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename packet_traits<Scalar>::type PacketScalar;
typedef typename Derived::Index Index;
static Scalar run(const Derived& mat, const Func& func)
{
const Index size = mat.size();
- ei_assert(size && "you are using an empty matrix");
- const Index packetSize = ei_packet_traits<Scalar>::size;
- const Index alignedStart = ei_first_aligned(mat);
+ eigen_assert(size && "you are using an empty matrix");
+ const Index packetSize = packet_traits<Scalar>::size;
+ const Index alignedStart = first_aligned(mat);
enum {
alignment = (Derived::Flags & DirectAccessBit) || (Derived::Flags & AlignedBit)
? Aligned : Unaligned
@@ -246,19 +248,19 @@ struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
};
template<typename Func, typename Derived>
-struct ei_redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
+struct redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
{
typedef typename Derived::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename packet_traits<Scalar>::type PacketScalar;
typedef typename Derived::Index Index;
static Scalar run(const Derived& mat, const Func& func)
{
- ei_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
const Index innerSize = mat.innerSize();
const Index outerSize = mat.outerSize();
enum {
- packetSize = ei_packet_traits<Scalar>::size
+ packetSize = packet_traits<Scalar>::size
};
const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize;
Scalar res;
@@ -277,7 +279,7 @@ struct ei_redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
else // too small to vectorize anything.
// since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
{
- res = ei_redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>::run(mat, func);
+ res = redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>::run(mat, func);
}
return res;
@@ -285,25 +287,31 @@ struct ei_redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
};
template<typename Func, typename Derived>
-struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling>
+struct redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling>
{
typedef typename Derived::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
+ typedef typename packet_traits<Scalar>::type PacketScalar;
enum {
- PacketSize = ei_packet_traits<Scalar>::size,
+ PacketSize = packet_traits<Scalar>::size,
Size = Derived::SizeAtCompileTime,
VectorizedSize = (Size / PacketSize) * PacketSize
};
EIGEN_STRONG_INLINE static Scalar run(const Derived& mat, const Func& func)
{
- ei_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
- Scalar res = func.predux(ei_redux_vec_unroller<Func, Derived, 0, Size / PacketSize>::run(mat,func));
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
+ Scalar res = func.predux(redux_vec_unroller<Func, Derived, 0, Size / PacketSize>::run(mat,func));
if (VectorizedSize != Size)
- res = func(res,ei_redux_novec_unroller<Func, Derived, VectorizedSize, Size-VectorizedSize>::run(mat,func));
+ res = func(res,redux_novec_unroller<Func, Derived, VectorizedSize, Size-VectorizedSize>::run(mat,func));
return res;
}
};
+} // end namespace internal
+
+/***************************************************************************
+* Part 4 : public API
+***************************************************************************/
+
/** \returns the result of a full redux operation on the whole matrix or vector using \a func
*
@@ -314,30 +322,30 @@ struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling
*/
template<typename Derived>
template<typename Func>
-EIGEN_STRONG_INLINE typename ei_result_of<Func(typename ei_traits<Derived>::Scalar)>::type
+EIGEN_STRONG_INLINE typename internal::result_of<Func(typename internal::traits<Derived>::Scalar)>::type
DenseBase<Derived>::redux(const Func& func) const
{
- typedef typename ei_cleantype<typename Derived::Nested>::type ThisNested;
- return ei_redux_impl<Func, ThisNested>
+ typedef typename internal::remove_all<typename Derived::Nested>::type ThisNested;
+ return internal::redux_impl<Func, ThisNested>
::run(derived(), func);
}
/** \returns the minimum of all coefficients of *this
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
DenseBase<Derived>::minCoeff() const
{
- return this->redux(Eigen::ei_scalar_min_op<Scalar>());
+ return this->redux(Eigen::internal::scalar_min_op<Scalar>());
}
/** \returns the maximum of all coefficients of *this
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
DenseBase<Derived>::maxCoeff() const
{
- return this->redux(Eigen::ei_scalar_max_op<Scalar>());
+ return this->redux(Eigen::internal::scalar_max_op<Scalar>());
}
/** \returns the sum of all coefficients of *this
@@ -345,12 +353,12 @@ DenseBase<Derived>::maxCoeff() const
* \sa trace(), prod(), mean()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
DenseBase<Derived>::sum() const
{
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
return Scalar(0);
- return this->redux(Eigen::ei_scalar_sum_op<Scalar>());
+ return this->redux(Eigen::internal::scalar_sum_op<Scalar>());
}
/** \returns the mean of all coefficients of *this
@@ -358,10 +366,10 @@ DenseBase<Derived>::sum() const
* \sa trace(), prod(), sum()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
DenseBase<Derived>::mean() const
{
- return Scalar(this->redux(Eigen::ei_scalar_sum_op<Scalar>())) / Scalar(this->size());
+ return Scalar(this->redux(Eigen::internal::scalar_sum_op<Scalar>())) / Scalar(this->size());
}
/** \returns the product of all coefficients of *this
@@ -372,12 +380,12 @@ DenseBase<Derived>::mean() const
* \sa sum(), mean(), trace()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
DenseBase<Derived>::prod() const
{
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
return Scalar(1);
- return this->redux(Eigen::ei_scalar_product_op<Scalar>());
+ return this->redux(Eigen::internal::scalar_product_op<Scalar>());
}
/** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal.
@@ -387,7 +395,7 @@ DenseBase<Derived>::prod() const
* \sa diagonal(), sum()
*/
template<typename Derived>
-EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
MatrixBase<Derived>::trace() const
{
return derived().diagonal().sum();
diff --git a/Eigen/src/Core/Replicate.h b/Eigen/src/Core/Replicate.h
index 87dea0533..87fcfccdd 100644
--- a/Eigen/src/Core/Replicate.h
+++ b/Eigen/src/Core/Replicate.h
@@ -39,15 +39,17 @@
*
* \sa DenseBase::replicate()
*/
+
+namespace internal {
template<typename MatrixType,int RowFactor,int ColFactor>
-struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
- : ei_traits<MatrixType>
+struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
+ : traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
- typedef typename ei_traits<MatrixType>::XprKind XprKind;
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
+ typedef typename traits<MatrixType>::XprKind XprKind;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
enum {
RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic
? Dynamic
@@ -65,29 +67,30 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
};
};
+}
template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
- : public ei_dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
+ : public internal::dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
{
public:
- typedef typename ei_dense_xpr_base<Replicate>::type Base;
+ typedef typename internal::dense_xpr_base<Replicate>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Replicate)
template<typename OriginalMatrixType>
inline explicit Replicate(const OriginalMatrixType& matrix)
: m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<MatrixType,OriginalMatrixType>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<MatrixType,OriginalMatrixType>::value),
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
- ei_assert(RowFactor!=Dynamic && ColFactor!=Dynamic);
+ eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic);
}
template<typename OriginalMatrixType>
inline Replicate(const OriginalMatrixType& matrix, int rowFactor, int colFactor)
: m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<MatrixType,OriginalMatrixType>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<MatrixType,OriginalMatrixType>::value),
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
}
@@ -97,10 +100,10 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
inline Scalar coeff(Index row, Index col) const
{
// try to avoid using modulo; this is a pure optimization strategy
- const Index actual_row = ei_traits<MatrixType>::RowsAtCompileTime==1 ? 0
+ const Index actual_row = internal::traits<MatrixType>::RowsAtCompileTime==1 ? 0
: RowFactor==1 ? row
: row%m_matrix.rows();
- const Index actual_col = ei_traits<MatrixType>::ColsAtCompileTime==1 ? 0
+ const Index actual_col = internal::traits<MatrixType>::ColsAtCompileTime==1 ? 0
: ColFactor==1 ? col
: col%m_matrix.cols();
@@ -109,10 +112,10 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
template<int LoadMode>
inline PacketScalar packet(Index row, Index col) const
{
- const Index actual_row = ei_traits<MatrixType>::RowsAtCompileTime==1 ? 0
+ const Index actual_row = internal::traits<MatrixType>::RowsAtCompileTime==1 ? 0
: RowFactor==1 ? row
: row%m_matrix.rows();
- const Index actual_col = ei_traits<MatrixType>::ColsAtCompileTime==1 ? 0
+ const Index actual_col = internal::traits<MatrixType>::ColsAtCompileTime==1 ? 0
: ColFactor==1 ? col
: col%m_matrix.cols();
@@ -122,8 +125,8 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
protected:
const typename MatrixType::Nested m_matrix;
- const ei_variable_if_dynamic<Index, RowFactor> m_rowFactor;
- const ei_variable_if_dynamic<Index, ColFactor> m_colFactor;
+ const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
+ const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
};
/**
diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h
index 82f194b56..c0d65f5cb 100644
--- a/Eigen/src/Core/ReturnByValue.h
+++ b/Eigen/src/Core/ReturnByValue.h
@@ -30,36 +30,43 @@
* \ingroup Core_Module
*
*/
+
+namespace internal {
+
template<typename Derived>
-struct ei_traits<ReturnByValue<Derived> >
- : public ei_traits<typename ei_traits<Derived>::ReturnType>
+struct traits<ReturnByValue<Derived> >
+ : public traits<typename traits<Derived>::ReturnType>
{
enum {
// We're disabling the DirectAccess because e.g. the constructor of
// the Block-with-DirectAccess expression requires to have a coeffRef method.
// Also, we don't want to have to implement the stride stuff.
- Flags = (ei_traits<typename ei_traits<Derived>::ReturnType>::Flags
+ Flags = (traits<typename traits<Derived>::ReturnType>::Flags
| EvalBeforeNestingBit) & ~DirectAccessBit
};
};
/* The ReturnByValue object doesn't even have a coeff() method.
* So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix.
- * So ei_nested always gives the plain return matrix type.
+ * So internal::nested always gives the plain return matrix type.
+ *
+ * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ??
*/
template<typename Derived,int n,typename PlainObject>
-struct ei_nested<ReturnByValue<Derived>, n, PlainObject>
+struct nested<ReturnByValue<Derived>, n, PlainObject>
{
- typedef typename ei_traits<Derived>::ReturnType type;
+ typedef typename traits<Derived>::ReturnType type;
};
+} // end namespace internal
+
template<typename Derived> class ReturnByValue
- : public ei_dense_xpr_base< ReturnByValue<Derived> >::type
+ : public internal::dense_xpr_base< ReturnByValue<Derived> >::type
{
public:
- typedef typename ei_traits<Derived>::ReturnType ReturnType;
+ typedef typename internal::traits<Derived>::ReturnType ReturnType;
- typedef typename ei_dense_xpr_base<ReturnByValue>::type Base;
+ typedef typename internal::dense_xpr_base<ReturnByValue>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
template<typename Dest>
diff --git a/Eigen/src/Core/Reverse.h b/Eigen/src/Core/Reverse.h
index abc44bde6..ed32b17fc 100644
--- a/Eigen/src/Core/Reverse.h
+++ b/Eigen/src/Core/Reverse.h
@@ -40,15 +40,18 @@
*
* \sa MatrixBase::reverse(), VectorwiseOp::reverse()
*/
+
+namespace internal {
+
template<typename MatrixType, int Direction>
-struct ei_traits<Reverse<MatrixType, Direction> >
- : ei_traits<MatrixType>
+struct traits<Reverse<MatrixType, Direction> >
+ : traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
- typedef typename ei_traits<MatrixType>::XprKind XprKind;
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
+ typedef typename traits<MatrixType>::XprKind XprKind;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
enum {
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
@@ -65,21 +68,24 @@ struct ei_traits<Reverse<MatrixType, Direction> >
};
};
-template<typename PacketScalar, bool ReversePacket> struct ei_reverse_packet_cond
+template<typename PacketScalar, bool ReversePacket> struct reverse_packet_cond
{
- static inline PacketScalar run(const PacketScalar& x) { return ei_preverse(x); }
+ static inline PacketScalar run(const PacketScalar& x) { return preverse(x); }
};
-template<typename PacketScalar> struct ei_reverse_packet_cond<PacketScalar,false>
+
+template<typename PacketScalar> struct reverse_packet_cond<PacketScalar,false>
{
static inline PacketScalar run(const PacketScalar& x) { return x; }
};
+} // end namespace internal
+
template<typename MatrixType, int Direction> class Reverse
- : public ei_dense_xpr_base< Reverse<MatrixType, Direction> >::type
+ : public internal::dense_xpr_base< Reverse<MatrixType, Direction> >::type
{
public:
- typedef typename ei_dense_xpr_base<Reverse>::type Base;
+ typedef typename internal::dense_xpr_base<Reverse>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Reverse)
using Base::IsRowMajor;
@@ -89,7 +95,7 @@ template<typename MatrixType, int Direction> class Reverse
protected:
enum {
- PacketSize = ei_packet_traits<Scalar>::size,
+ PacketSize = internal::packet_traits<Scalar>::size,
IsColMajor = !IsRowMajor,
ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
@@ -99,7 +105,7 @@ template<typename MatrixType, int Direction> class Reverse
|| ((Direction == Vertical) && IsColMajor)
|| ((Direction == Horizontal) && IsRowMajor)
};
- typedef ei_reverse_packet_cond<PacketScalar,ReversePacket> reverse_packet;
+ typedef internal::reverse_packet_cond<PacketScalar,ReversePacket> reverse_packet;
public:
inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { }
@@ -116,7 +122,7 @@ template<typename MatrixType, int Direction> class Reverse
inline Scalar& operator()(Index row, Index col)
{
- ei_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
+ eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return coeffRef(row, col);
}
@@ -144,7 +150,7 @@ template<typename MatrixType, int Direction> class Reverse
inline Scalar& operator()(Index index)
{
- ei_assert(index >= 0 && index < m_matrix.size());
+ eigen_assert(index >= 0 && index < m_matrix.size());
return coeffRef(index);
}
@@ -168,13 +174,13 @@ template<typename MatrixType, int Direction> class Reverse
template<int LoadMode>
inline const PacketScalar packet(Index index) const
{
- return ei_preverse(m_matrix.template packet<LoadMode>( m_matrix.size() - index - PacketSize ));
+ return internal::preverse(m_matrix.template packet<LoadMode>( m_matrix.size() - index - PacketSize ));
}
template<int LoadMode>
inline void writePacket(Index index, const PacketScalar& x)
{
- m_matrix.const_cast_derived().template writePacket<LoadMode>(m_matrix.size() - index - PacketSize, ei_preverse(x));
+ m_matrix.const_cast_derived().template writePacket<LoadMode>(m_matrix.size() - index - PacketSize, internal::preverse(x));
}
protected:
diff --git a/Eigen/src/Core/Select.h b/Eigen/src/Core/Select.h
index 000c70905..d0cd66a26 100644
--- a/Eigen/src/Core/Select.h
+++ b/Eigen/src/Core/Select.h
@@ -40,13 +40,14 @@
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const
*/
+namespace internal {
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
-struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
- : ei_traits<ThenMatrixType>
+struct traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
+ : traits<ThenMatrixType>
{
- typedef typename ei_traits<ThenMatrixType>::Scalar Scalar;
+ typedef typename traits<ThenMatrixType>::Scalar Scalar;
typedef Dense StorageKind;
- typedef typename ei_traits<ThenMatrixType>::XprKind XprKind;
+ typedef typename traits<ThenMatrixType>::XprKind XprKind;
typedef typename ConditionMatrixType::Nested ConditionMatrixNested;
typedef typename ThenMatrixType::Nested ThenMatrixNested;
typedef typename ElseMatrixType::Nested ElseMatrixNested;
@@ -56,19 +57,20 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime,
MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits,
- CoeffReadCost = ei_traits<typename ei_cleantype<ConditionMatrixNested>::type>::CoeffReadCost
- + EIGEN_SIZE_MAX(ei_traits<typename ei_cleantype<ThenMatrixNested>::type>::CoeffReadCost,
- ei_traits<typename ei_cleantype<ElseMatrixNested>::type>::CoeffReadCost)
+ CoeffReadCost = traits<typename remove_all<ConditionMatrixNested>::type>::CoeffReadCost
+ + EIGEN_SIZE_MAX(traits<typename remove_all<ThenMatrixNested>::type>::CoeffReadCost,
+ traits<typename remove_all<ElseMatrixNested>::type>::CoeffReadCost)
};
};
+}
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
-class Select : ei_no_assignment_operator,
- public ei_dense_xpr_base< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::type
+class Select : internal::no_assignment_operator,
+ public internal::dense_xpr_base< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::type
{
public:
- typedef typename ei_dense_xpr_base<Select>::type Base;
+ typedef typename internal::dense_xpr_base<Select>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Select)
Select(const ConditionMatrixType& conditionMatrix,
@@ -76,8 +78,8 @@ class Select : ei_no_assignment_operator,
const ElseMatrixType& elseMatrix)
: m_condition(conditionMatrix), m_then(thenMatrix), m_else(elseMatrix)
{
- ei_assert(m_condition.rows() == m_then.rows() && m_condition.rows() == m_else.rows());
- ei_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
+ eigen_assert(m_condition.rows() == m_then.rows() && m_condition.rows() == m_else.rows());
+ eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
}
Index rows() const { return m_condition.rows(); }
diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h
index d72a94e15..623cca027 100644
--- a/Eigen/src/Core/SelfAdjointView.h
+++ b/Eigen/src/Core/SelfAdjointView.h
@@ -40,11 +40,13 @@
*
* \sa class TriangularBase, MatrixBase::selfAdjointView()
*/
+
+namespace internal {
template<typename MatrixType, unsigned int UpLo>
-struct ei_traits<SelfAdjointView<MatrixType, UpLo> > : ei_traits<MatrixType>
+struct traits<SelfAdjointView<MatrixType, UpLo> > : traits<MatrixType>
{
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
typedef MatrixType ExpressionType;
enum {
Mode = UpLo | SelfAdjoint,
@@ -53,6 +55,7 @@ struct ei_traits<SelfAdjointView<MatrixType, UpLo> > : ei_traits<MatrixType>
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
};
};
+}
template <typename Lhs, int LhsMode, bool LhsIsVector,
typename Rhs, int RhsMode, bool RhsIsVector>
@@ -67,17 +70,17 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
typedef TriangularBase<SelfAdjointView> Base;
/** \brief The type of coefficients in this matrix */
- typedef typename ei_traits<SelfAdjointView>::Scalar Scalar;
+ typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
typedef typename MatrixType::Index Index;
enum {
- Mode = ei_traits<SelfAdjointView>::Mode
+ Mode = internal::traits<SelfAdjointView>::Mode
};
typedef typename MatrixType::PlainObject PlainObject;
inline SelfAdjointView(const MatrixType& matrix) : m_matrix(matrix)
- { ei_assert(ei_are_flags_consistent<Mode>::ret); }
+ { eigen_assert(internal::are_flags_consistent<Mode>::ret); }
inline Index rows() const { return m_matrix.rows(); }
inline Index cols() const { return m_matrix.cols(); }
@@ -164,7 +167,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
/** Real part of #Scalar */
typedef typename NumTraits<Scalar>::Real RealScalar;
/** Return type of eigenvalues() */
- typedef Matrix<RealScalar, ei_traits<MatrixType>::ColsAtCompileTime, 1> EigenvaluesReturnType;
+ typedef Matrix<RealScalar, internal::traits<MatrixType>::ColsAtCompileTime, 1> EigenvaluesReturnType;
EigenvaluesReturnType eigenvalues() const;
RealScalar operatorNorm() const;
@@ -175,16 +178,18 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
// template<typename OtherDerived, typename MatrixType, unsigned int UpLo>
-// ei_selfadjoint_matrix_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >
+// internal::selfadjoint_matrix_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >
// operator*(const MatrixBase<OtherDerived>& lhs, const SelfAdjointView<MatrixType,UpLo>& rhs)
// {
-// return ei_matrix_selfadjoint_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >(lhs.derived(),rhs);
+// return internal::matrix_selfadjoint_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >(lhs.derived(),rhs);
// }
// selfadjoint to dense matrix
+namespace internal {
+
template<typename Derived1, typename Derived2, int UnrollCount, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), UnrollCount, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), UnrollCount, ClearOpposite>
{
enum {
col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
@@ -193,23 +198,23 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper)
inline static void run(Derived1 &dst, const Derived2 &src)
{
- ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), UnrollCount-1, ClearOpposite>::run(dst, src);
+ triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Upper), UnrollCount-1, ClearOpposite>::run(dst, src);
if(row == col)
- dst.coeffRef(row, col) = ei_real(src.coeff(row, col));
+ dst.coeffRef(row, col) = real(src.coeff(row, col));
else if(row < col)
- dst.coeffRef(col, row) = ei_conj(dst.coeffRef(row, col) = src.coeff(row, col));
+ dst.coeffRef(col, row) = conj(dst.coeffRef(row, col) = src.coeff(row, col));
}
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, 0, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, 0, ClearOpposite>
{
inline static void run(Derived1 &, const Derived2 &) {}
};
template<typename Derived1, typename Derived2, int UnrollCount, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), UnrollCount, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), UnrollCount, ClearOpposite>
{
enum {
col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
@@ -218,23 +223,23 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower)
inline static void run(Derived1 &dst, const Derived2 &src)
{
- ei_triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), UnrollCount-1, ClearOpposite>::run(dst, src);
+ triangular_assignment_selector<Derived1, Derived2, (SelfAdjoint|Lower), UnrollCount-1, ClearOpposite>::run(dst, src);
if(row == col)
- dst.coeffRef(row, col) = ei_real(src.coeff(row, col));
+ dst.coeffRef(row, col) = real(src.coeff(row, col));
else if(row > col)
- dst.coeffRef(col, row) = ei_conj(dst.coeffRef(row, col) = src.coeff(row, col));
+ dst.coeffRef(col, row) = conj(dst.coeffRef(row, col) = src.coeff(row, col));
}
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, 0, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, 0, ClearOpposite>
{
inline static void run(Derived1 &, const Derived2 &) {}
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -244,7 +249,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper,
for(Index i = 0; i < j; ++i)
{
dst.copyCoeff(i, j, src);
- dst.coeffRef(j,i) = ei_conj(dst.coeff(i,j));
+ dst.coeffRef(j,i) = conj(dst.coeff(i,j));
}
dst.copyCoeff(j, j, src);
}
@@ -252,7 +257,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Upper,
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, Dynamic, ClearOpposite>
{
inline static void run(Derived1 &dst, const Derived2 &src)
{
@@ -262,13 +267,15 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower,
for(Index j = 0; j < i; ++j)
{
dst.copyCoeff(i, j, src);
- dst.coeffRef(j,i) = ei_conj(dst.coeff(i,j));
+ dst.coeffRef(j,i) = conj(dst.coeff(i,j));
}
dst.copyCoeff(i, i, src);
}
}
};
+} // end namespace internal
+
/***************************************************************************
* Implementation of MatrixBase methods
***************************************************************************/
diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h
index f77589747..213983588 100644
--- a/Eigen/src/Core/SelfCwiseBinaryOp.h
+++ b/Eigen/src/Core/SelfCwiseBinaryOp.h
@@ -39,28 +39,31 @@
*
* \sa class SwapWrapper for a similar trick.
*/
+
+namespace internal {
template<typename BinaryOp, typename Lhs, typename Rhs>
-struct ei_traits<SelfCwiseBinaryOp<BinaryOp,Lhs,Rhs> >
- : ei_traits<CwiseBinaryOp<BinaryOp,Lhs,Rhs> >
+struct traits<SelfCwiseBinaryOp<BinaryOp,Lhs,Rhs> >
+ : traits<CwiseBinaryOp<BinaryOp,Lhs,Rhs> >
{
enum {
// Note that it is still a good idea to preserve the DirectAccessBit
// so that assign can correctly align the data.
- Flags = ei_traits<CwiseBinaryOp<BinaryOp,Lhs,Rhs> >::Flags | (Lhs::Flags&DirectAccessBit) | (Lhs::Flags&LvalueBit),
+ Flags = traits<CwiseBinaryOp<BinaryOp,Lhs,Rhs> >::Flags | (Lhs::Flags&DirectAccessBit) | (Lhs::Flags&LvalueBit),
OuterStrideAtCompileTime = Lhs::OuterStrideAtCompileTime,
InnerStrideAtCompileTime = Lhs::InnerStrideAtCompileTime
};
};
+}
template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
- : public ei_dense_xpr_base< SelfCwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
+ : public internal::dense_xpr_base< SelfCwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
{
public:
- typedef typename ei_dense_xpr_base<SelfCwiseBinaryOp>::type Base;
+ typedef typename internal::dense_xpr_base<SelfCwiseBinaryOp>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
inline SelfCwiseBinaryOp(Lhs& xpr, const BinaryOp& func = BinaryOp()) : m_matrix(xpr), m_functor(func) {}
@@ -88,7 +91,7 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
void copyCoeff(Index row, Index col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
Scalar& tmp = m_matrix.coeffRef(row,col);
tmp = m_functor(tmp, _other.coeff(row,col));
@@ -98,7 +101,7 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
void copyCoeff(Index index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(index >= 0 && index < m_matrix.size());
+ eigen_internal_assert(index >= 0 && index < m_matrix.size());
Scalar& tmp = m_matrix.coeffRef(index);
tmp = m_functor(tmp, _other.coeff(index));
}
@@ -107,7 +110,7 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
void copyPacket(Index row, Index col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
m_matrix.template writePacket<StoreMode>(row, col,
m_functor.packetOp(m_matrix.template packet<StoreMode>(row, col),_other.template packet<LoadMode>(row, col)) );
@@ -117,7 +120,7 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
void copyPacket(Index index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(index >= 0 && index < m_matrix.size());
+ eigen_internal_assert(index >= 0 && index < m_matrix.size());
m_matrix.template writePacket<StoreMode>(index,
m_functor.packetOp(m_matrix.template packet<StoreMode>(index),_other.template packet<LoadMode>(index)) );
}
@@ -131,10 +134,10 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename RhsDerived::Scalar);
#ifdef EIGEN_DEBUG_ASSIGN
- ei_assign_traits<SelfCwiseBinaryOp, RhsDerived>::debug();
+ internal::assign_traits<SelfCwiseBinaryOp, RhsDerived>::debug();
#endif
- ei_assert(rows() == rhs.rows() && cols() == rhs.cols());
- ei_assign_impl<SelfCwiseBinaryOp, RhsDerived>::run(*this,rhs.derived());
+ eigen_assert(rows() == rhs.rows() && cols() == rhs.cols());
+ internal::assign_impl<SelfCwiseBinaryOp, RhsDerived>::run(*this,rhs.derived());
#ifndef EIGEN_NO_DEBUG
this->checkTransposeAliasing(rhs.derived());
#endif
@@ -146,7 +149,7 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp
// at first...
SelfCwiseBinaryOp& operator=(const Rhs& _rhs)
{
- typename ei_nested<Rhs>::type rhs(_rhs);
+ typename internal::nested<Rhs>::type rhs(_rhs);
return Base::operator=(rhs);
}
@@ -162,7 +165,7 @@ template<typename Derived>
inline Derived& DenseBase<Derived>::operator*=(const Scalar& other)
{
typedef typename Derived::PlainObject PlainObject;
- SelfCwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
+ SelfCwiseBinaryOp<internal::scalar_product_op<Scalar>, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
tmp = PlainObject::Constant(rows(),cols(),other);
return derived();
}
@@ -170,9 +173,9 @@ inline Derived& DenseBase<Derived>::operator*=(const Scalar& other)
template<typename Derived>
inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
{
- typedef typename ei_meta_if<NumTraits<Scalar>::IsInteger,
- ei_scalar_quotient_op<Scalar>,
- ei_scalar_product_op<Scalar> >::ret BinOp;
+ typedef typename internal::conditional<NumTraits<Scalar>::IsInteger,
+ internal::scalar_quotient_op<Scalar>,
+ internal::scalar_product_op<Scalar> >::type BinOp;
typedef typename Derived::PlainObject PlainObject;
SelfCwiseBinaryOp<BinOp, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
tmp = PlainObject::Constant(rows(),cols(), NumTraits<Scalar>::IsInteger ? other : Scalar(1)/other);
diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h
index 960da31f3..abbf57553 100644
--- a/Eigen/src/Core/SolveTriangular.h
+++ b/Eigen/src/Core/SolveTriangular.h
@@ -25,8 +25,10 @@
#ifndef EIGEN_SOLVETRIANGULAR_H
#define EIGEN_SOLVETRIANGULAR_H
+namespace internal {
+
template<typename Lhs, typename Rhs, int Side>
-class ei_trsolve_traits
+class trsolve_traits
{
private:
enum {
@@ -43,19 +45,19 @@ class ei_trsolve_traits
template<typename Lhs, typename Rhs,
int Side, // can be OnTheLeft/OnTheRight
int Mode, // can be Upper/Lower | UnitDiag
- int Unrolling = ei_trsolve_traits<Lhs,Rhs,Side>::Unrolling,
+ int Unrolling = trsolve_traits<Lhs,Rhs,Side>::Unrolling,
int StorageOrder = (int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
- int RhsVectors = ei_trsolve_traits<Lhs,Rhs,Side>::RhsVectors
+ int RhsVectors = trsolve_traits<Lhs,Rhs,Side>::RhsVectors
>
-struct ei_triangular_solver_selector;
+struct triangular_solver_selector;
// forward and backward substitution, row-major, rhs is a vector
template<typename Lhs, typename Rhs, int Mode>
-struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,RowMajor,1>
+struct triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,RowMajor,1>
{
typedef typename Lhs::Scalar LhsScalar;
typedef typename Rhs::Scalar RhsScalar;
- typedef ei_blas_traits<Lhs> LhsProductTraits;
+ typedef blas_traits<Lhs> LhsProductTraits;
typedef typename LhsProductTraits::ExtractType ActualLhsType;
typedef typename Lhs::Index Index;
enum {
@@ -82,7 +84,7 @@ struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,RowMajor
Index startRow = IsLower ? pi : pi-actualPanelWidth;
Index startCol = IsLower ? 0 : pi;
- ei_general_matrix_vector_product<Index,LhsScalar,RowMajor,LhsProductTraits::NeedToConjugate,RhsScalar,false>::run(
+ general_matrix_vector_product<Index,LhsScalar,RowMajor,LhsProductTraits::NeedToConjugate,RhsScalar,false>::run(
actualPanelWidth, r,
&(actualLhs.const_cast_derived().coeffRef(startRow,startCol)), actualLhs.outerStride(),
&(other.coeffRef(startCol)), other.innerStride(),
@@ -106,11 +108,11 @@ struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,RowMajor
// forward and backward substitution, column-major, rhs is a vector
template<typename Lhs, typename Rhs, int Mode>
-struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,ColMajor,1>
+struct triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,ColMajor,1>
{
typedef typename Lhs::Scalar LhsScalar;
typedef typename Rhs::Scalar RhsScalar;
- typedef ei_blas_traits<Lhs> LhsProductTraits;
+ typedef blas_traits<Lhs> LhsProductTraits;
typedef typename LhsProductTraits::ExtractType ActualLhsType;
typedef typename Lhs::Index Index;
enum {
@@ -148,7 +150,7 @@ struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,ColMajor
// let's directly call the low level product function because:
// 1 - it is faster to compile
// 2 - it is slighlty faster at runtime
- ei_general_matrix_vector_product<Index,LhsScalar,ColMajor,LhsProductTraits::NeedToConjugate,RhsScalar,false>::run(
+ general_matrix_vector_product<Index,LhsScalar,ColMajor,LhsProductTraits::NeedToConjugate,RhsScalar,false>::run(
r, actualPanelWidth,
&(actualLhs.const_cast_derived().coeffRef(endBlock,startBlock)), actualLhs.outerStride(),
&other.coeff(startBlock), other.innerStride(),
@@ -160,31 +162,31 @@ struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,NoUnrolling,ColMajor
// transpose OnTheRight cases for vectors
template<typename Lhs, typename Rhs, int Mode, int Unrolling, int StorageOrder>
-struct ei_triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,Unrolling,StorageOrder,1>
+struct triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,Unrolling,StorageOrder,1>
{
static void run(const Lhs& lhs, Rhs& rhs)
{
Transpose<Rhs> rhsTr(rhs);
Transpose<Lhs> lhsTr(lhs);
- ei_triangular_solver_selector<Transpose<Lhs>,Transpose<Rhs>,OnTheLeft,TriangularView<Lhs,Mode>::TransposeMode>::run(lhsTr,rhsTr);
+ triangular_solver_selector<Transpose<Lhs>,Transpose<Rhs>,OnTheLeft,TriangularView<Lhs,Mode>::TransposeMode>::run(lhsTr,rhsTr);
}
};
template <typename Scalar, typename Index, int Side, int Mode, bool Conjugate, int TriStorageOrder, int OtherStorageOrder>
-struct ei_triangular_solve_matrix;
+struct triangular_solve_matrix;
// the rhs is a matrix
template<typename Lhs, typename Rhs, int Side, int Mode, int StorageOrder>
-struct ei_triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,StorageOrder,Dynamic>
+struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,StorageOrder,Dynamic>
{
typedef typename Rhs::Scalar Scalar;
typedef typename Rhs::Index Index;
- typedef ei_blas_traits<Lhs> LhsProductTraits;
+ typedef blas_traits<Lhs> LhsProductTraits;
typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
static void run(const Lhs& lhs, Rhs& rhs)
{
const ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
- ei_triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,StorageOrder,
+ triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,StorageOrder,
(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor>
::run(lhs.rows(), Side==OnTheLeft? rhs.cols() : rhs.rows(), &actualLhs.coeff(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride());
}
@@ -196,10 +198,10 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,StorageOrder,
template<typename Lhs, typename Rhs, int Mode, int Index, int Size,
bool Stop = Index==Size>
-struct ei_triangular_solver_unroller;
+struct triangular_solver_unroller;
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
-struct ei_triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
+struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
enum {
IsLower = ((Mode&Lower)==Lower),
I = IsLower ? Index : Size - Index - 1,
@@ -213,21 +215,23 @@ struct ei_triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
if(!(Mode & UnitDiag))
rhs.coeffRef(I) /= lhs.coeff(I,I);
- ei_triangular_solver_unroller<Lhs,Rhs,Mode,Index+1,Size>::run(lhs,rhs);
+ triangular_solver_unroller<Lhs,Rhs,Mode,Index+1,Size>::run(lhs,rhs);
}
};
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
-struct ei_triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,true> {
+struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,true> {
static void run(const Lhs&, Rhs&) {}
};
template<typename Lhs, typename Rhs, int Mode, int StorageOrder>
-struct ei_triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,CompleteUnrolling,StorageOrder,1> {
+struct triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,CompleteUnrolling,StorageOrder,1> {
static void run(const Lhs& lhs, Rhs& rhs)
- { ei_triangular_solver_unroller<Lhs,Rhs,Mode,0,Rhs::SizeAtCompileTime>::run(lhs,rhs); }
+ { triangular_solver_unroller<Lhs,Rhs,Mode,0,Rhs::SizeAtCompileTime>::run(lhs,rhs); }
};
+} // end namespace internal
+
/***************************************************************************
* TriangularView methods
***************************************************************************/
@@ -246,17 +250,17 @@ template<int Side, typename OtherDerived>
void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
{
OtherDerived& other = _other.const_cast_derived();
- ei_assert(cols() == rows());
- ei_assert( (Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols()) );
- ei_assert(!(Mode & ZeroDiag));
- ei_assert(Mode & (Upper|Lower));
-
- enum { copy = ei_traits<OtherDerived>::Flags & RowMajorBit && OtherDerived::IsVectorAtCompileTime };
- typedef typename ei_meta_if<copy,
- typename ei_plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::ret OtherCopy;
+ eigen_assert(cols() == rows());
+ eigen_assert( (Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols()) );
+ eigen_assert(!(Mode & ZeroDiag));
+ eigen_assert(Mode & (Upper|Lower));
+
+ enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit && OtherDerived::IsVectorAtCompileTime };
+ typedef typename internal::conditional<copy,
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
OtherCopy otherCopy(other);
- ei_triangular_solver_selector<MatrixType, typename ei_unref<OtherCopy>::type,
+ internal::triangular_solver_selector<MatrixType, typename internal::remove_reference<OtherCopy>::type,
Side, Mode>::run(nestedExpression(), otherCopy);
if (copy)
@@ -296,10 +300,10 @@ void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived
*/
template<typename Derived, unsigned int Mode>
template<int Side, typename RhsDerived>
-typename ei_plain_matrix_type_column_major<RhsDerived>::type
+typename internal::plain_matrix_type_column_major<RhsDerived>::type
TriangularView<Derived,Mode>::solve(const MatrixBase<RhsDerived>& rhs) const
{
- typename ei_plain_matrix_type_column_major<RhsDerived>::type res(rhs);
+ typename internal::plain_matrix_type_column_major<RhsDerived>::type res(rhs);
solveInPlace<Side>(res);
return res;
}
diff --git a/Eigen/src/Core/StableNorm.h b/Eigen/src/Core/StableNorm.h
index c3c230796..fdf113bfe 100644
--- a/Eigen/src/Core/StableNorm.h
+++ b/Eigen/src/Core/StableNorm.h
@@ -25,13 +25,14 @@
#ifndef EIGEN_STABLENORM_H
#define EIGEN_STABLENORM_H
+namespace internal {
template<typename ExpressionType, typename Scalar>
-inline void ei_stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
+inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
{
Scalar max = bl.cwiseAbs().maxCoeff();
if (max>scale)
{
- ssq = ssq * ei_abs2(scale/max);
+ ssq = ssq * abs2(scale/max);
scale = max;
invScale = Scalar(1)/scale;
}
@@ -39,6 +40,7 @@ inline void ei_stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar&
// then we can neglect this sub vector
ssq += (bl*invScale).squaredNorm();
}
+}
/** \returns the \em l2 norm of \c *this avoiding underflow and overflow.
* This version use a blockwise two passes algorithm:
@@ -51,7 +53,7 @@ inline void ei_stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar&
* \sa norm(), blueNorm(), hypotNorm()
*/
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
MatrixBase<Derived>::stableNorm() const
{
const Index blockSize = 4096;
@@ -62,12 +64,12 @@ MatrixBase<Derived>::stableNorm() const
Alignment = (int(Flags)&DirectAccessBit) || (int(Flags)&AlignedBit) ? 1 : 0
};
Index n = size();
- Index bi = ei_first_aligned(derived());
+ Index bi = internal::first_aligned(derived());
if (bi>0)
- ei_stable_norm_kernel(this->head(bi), ssq, scale, invScale);
+ internal::stable_norm_kernel(this->head(bi), ssq, scale, invScale);
for (; bi<n; bi+=blockSize)
- ei_stable_norm_kernel(this->segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale);
- return scale * ei_sqrt(ssq);
+ internal::stable_norm_kernel(this->segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale);
+ return scale * internal::sqrt(ssq);
}
/** \returns the \em l2 norm of \c *this using the Blue's algorithm.
@@ -80,7 +82,7 @@ MatrixBase<Derived>::stableNorm() const
* \sa norm(), stableNorm(), hypotNorm()
*/
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
MatrixBase<Derived>::blueNorm() const
{
static Index nmax = -1;
@@ -116,7 +118,7 @@ MatrixBase<Derived>::blueNorm() const
overfl = rbig*s2m; // overflow boundary for abig
eps = RealScalar(std::pow(double(ibeta), 1-it));
- relerr = ei_sqrt(eps); // tolerance for neglecting asml
+ relerr = internal::sqrt(eps); // tolerance for neglecting asml
abig = RealScalar(1.0/eps - 1.0);
if (RealScalar(nbig)>abig) nmax = int(abig); // largest safe n
else nmax = nbig;
@@ -128,23 +130,23 @@ MatrixBase<Derived>::blueNorm() const
RealScalar abig = RealScalar(0);
for(Index j=0; j<n; ++j)
{
- RealScalar ax = ei_abs(coeff(j));
- if(ax > ab2) abig += ei_abs2(ax*s2m);
- else if(ax < b1) asml += ei_abs2(ax*s1m);
- else amed += ei_abs2(ax);
+ RealScalar ax = internal::abs(coeff(j));
+ if(ax > ab2) abig += internal::abs2(ax*s2m);
+ else if(ax < b1) asml += internal::abs2(ax*s1m);
+ else amed += internal::abs2(ax);
}
if(abig > RealScalar(0))
{
- abig = ei_sqrt(abig);
+ abig = internal::sqrt(abig);
if(abig > overfl)
{
- ei_assert(false && "overflow");
+ eigen_assert(false && "overflow");
return rbig;
}
if(amed > RealScalar(0))
{
abig = abig/s2m;
- amed = ei_sqrt(amed);
+ amed = internal::sqrt(amed);
}
else
return abig/s2m;
@@ -153,20 +155,20 @@ MatrixBase<Derived>::blueNorm() const
{
if (amed > RealScalar(0))
{
- abig = ei_sqrt(amed);
- amed = ei_sqrt(asml) / s1m;
+ abig = internal::sqrt(amed);
+ amed = internal::sqrt(asml) / s1m;
}
else
- return ei_sqrt(asml)/s1m;
+ return internal::sqrt(asml)/s1m;
}
else
- return ei_sqrt(amed);
+ return internal::sqrt(amed);
asml = std::min(abig, amed);
abig = std::max(abig, amed);
if(asml <= abig*relerr)
return abig;
else
- return abig * ei_sqrt(RealScalar(1) + ei_abs2(asml/abig));
+ return abig * internal::sqrt(RealScalar(1) + internal::abs2(asml/abig));
}
/** \returns the \em l2 norm of \c *this avoiding undeflow and overflow.
@@ -175,10 +177,10 @@ MatrixBase<Derived>::blueNorm() const
* \sa norm(), stableNorm()
*/
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
MatrixBase<Derived>::hypotNorm() const
{
- return this->cwiseAbs().redux(ei_scalar_hypot_op<RealScalar>());
+ return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
}
#endif // EIGEN_STABLENORM_H
diff --git a/Eigen/src/Core/Stride.h b/Eigen/src/Core/Stride.h
index 47515b548..9425253ec 100644
--- a/Eigen/src/Core/Stride.h
+++ b/Eigen/src/Core/Stride.h
@@ -67,14 +67,14 @@ class Stride
Stride()
: m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
{
- ei_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
+ eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
}
/** Constructor allowing to pass the strides at runtime */
Stride(Index outerStride, Index innerStride)
: m_outer(outerStride), m_inner(innerStride)
{
- ei_assert(innerStride>=0 && outerStride>=0);
+ eigen_assert(innerStride>=0 && outerStride>=0);
}
/** Copy constructor */
@@ -88,8 +88,8 @@ class Stride
inline Index inner() const { return m_inner.value(); }
protected:
- ei_variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
- ei_variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
+ internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
+ internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
};
/** \brief Convenience specialization of Stride to specify only an inner stride
diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h
index 086d7f32c..abbef4443 100644
--- a/Eigen/src/Core/Swap.h
+++ b/Eigen/src/Core/Swap.h
@@ -32,17 +32,19 @@
*
* \brief Internal helper class for swapping two expressions
*/
+namespace internal {
template<typename ExpressionType>
-struct ei_traits<SwapWrapper<ExpressionType> > : ei_traits<ExpressionType> {};
+struct traits<SwapWrapper<ExpressionType> > : traits<ExpressionType> {};
+}
template<typename ExpressionType> class SwapWrapper
- : public ei_dense_xpr_base<SwapWrapper<ExpressionType> >::type
+ : public internal::dense_xpr_base<SwapWrapper<ExpressionType> >::type
{
public:
- typedef typename ei_dense_xpr_base<SwapWrapper>::type Base;
+ typedef typename internal::dense_xpr_base<SwapWrapper>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper)
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {}
@@ -65,7 +67,7 @@ template<typename ExpressionType> class SwapWrapper
void copyCoeff(Index row, Index col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
Scalar tmp = m_expression.coeff(row, col);
m_expression.coeffRef(row, col) = _other.coeff(row, col);
@@ -76,7 +78,7 @@ template<typename ExpressionType> class SwapWrapper
void copyCoeff(Index index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(index >= 0 && index < m_expression.size());
+ eigen_internal_assert(index >= 0 && index < m_expression.size());
Scalar tmp = m_expression.coeff(index);
m_expression.coeffRef(index) = _other.coeff(index);
_other.coeffRef(index) = tmp;
@@ -86,7 +88,7 @@ template<typename ExpressionType> class SwapWrapper
void copyPacket(Index row, Index col, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(row >= 0 && row < rows()
+ eigen_internal_assert(row >= 0 && row < rows()
&& col >= 0 && col < cols());
Packet tmp = m_expression.template packet<StoreMode>(row, col);
m_expression.template writePacket<StoreMode>(row, col,
@@ -99,7 +101,7 @@ template<typename ExpressionType> class SwapWrapper
void copyPacket(Index index, const DenseBase<OtherDerived>& other)
{
OtherDerived& _other = other.const_cast_derived();
- ei_internal_assert(index >= 0 && index < m_expression.size());
+ eigen_internal_assert(index >= 0 && index < m_expression.size());
Packet tmp = m_expression.template packet<StoreMode>(index);
m_expression.template writePacket<StoreMode>(index,
_other.template packet<LoadMode>(index)
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index de8ae0a5b..394b375ab 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -39,14 +39,16 @@
*
* \sa MatrixBase::transpose(), MatrixBase::adjoint()
*/
+
+namespace internal {
template<typename MatrixType>
-struct ei_traits<Transpose<MatrixType> > : ei_traits<MatrixType>
+struct traits<Transpose<MatrixType> > : traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
- typedef typename ei_traits<MatrixType>::XprKind XprKind;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
+ typedef typename traits<MatrixType>::XprKind XprKind;
enum {
RowsAtCompileTime = MatrixType::ColsAtCompileTime,
ColsAtCompileTime = MatrixType::RowsAtCompileTime,
@@ -54,19 +56,20 @@ struct ei_traits<Transpose<MatrixType> > : ei_traits<MatrixType>
MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
Flags = int(_MatrixTypeNested::Flags & ~NestByRefBit) ^ RowMajorBit,
CoeffReadCost = _MatrixTypeNested::CoeffReadCost,
- InnerStrideAtCompileTime = ei_inner_stride_at_compile_time<MatrixType>::ret,
- OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<MatrixType>::ret
+ InnerStrideAtCompileTime = inner_stride_at_compile_time<MatrixType>::ret,
+ OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::ret
};
};
+}
template<typename MatrixType, typename StorageKind> class TransposeImpl;
template<typename MatrixType> class Transpose
- : public TransposeImpl<MatrixType,typename ei_traits<MatrixType>::StorageKind>
+ : public TransposeImpl<MatrixType,typename internal::traits<MatrixType>::StorageKind>
{
public:
- typedef typename TransposeImpl<MatrixType,typename ei_traits<MatrixType>::StorageKind>::Base Base;
+ typedef typename TransposeImpl<MatrixType,typename internal::traits<MatrixType>::StorageKind>::Base Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose)
inline Transpose(const MatrixType& matrix) : m_matrix(matrix) {}
@@ -77,35 +80,39 @@ template<typename MatrixType> class Transpose
inline Index cols() const { return m_matrix.rows(); }
/** \returns the nested expression */
- const typename ei_cleantype<typename MatrixType::Nested>::type&
+ const typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() const { return m_matrix; }
/** \returns the nested expression */
- typename ei_cleantype<typename MatrixType::Nested>::type&
+ typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() { return m_matrix.const_cast_derived(); }
protected:
const typename MatrixType::Nested m_matrix;
};
-template<typename MatrixType, bool HasDirectAccess = ei_has_direct_access<MatrixType>::ret>
-struct ei_TransposeImpl_base
+namespace internal {
+
+template<typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::ret>
+struct TransposeImpl_base
{
- typedef typename ei_dense_xpr_base<Transpose<MatrixType> >::type type;
+ typedef typename dense_xpr_base<Transpose<MatrixType> >::type type;
};
template<typename MatrixType>
-struct ei_TransposeImpl_base<MatrixType, false>
+struct TransposeImpl_base<MatrixType, false>
{
- typedef typename ei_dense_xpr_base<Transpose<MatrixType> >::type type;
+ typedef typename dense_xpr_base<Transpose<MatrixType> >::type type;
};
+} // end namespace internal
+
template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
- : public ei_TransposeImpl_base<MatrixType>::type
+ : public internal::TransposeImpl_base<MatrixType>::type
{
public:
- typedef typename ei_TransposeImpl_base<MatrixType>::type Base;
+ typedef typename internal::TransposeImpl_base<MatrixType>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
inline Index innerStride() const { return derived().nestedExpression().innerStride(); }
@@ -214,7 +221,7 @@ DenseBase<Derived>::transpose() const
* m = m.adjoint().eval();
* \endcode
*
- * \sa adjointInPlace(), transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
+ * \sa adjointInPlace(), transpose(), conjugate(), class Transpose, class internal::scalar_conjugate_op */
template<typename Derived>
inline const typename MatrixBase<Derived>::AdjointReturnType
MatrixBase<Derived>::adjoint() const
@@ -226,19 +233,21 @@ MatrixBase<Derived>::adjoint() const
* "in place" transpose implementation
***************************************************************************/
+namespace internal {
+
template<typename MatrixType,
bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) && MatrixType::RowsAtCompileTime!=Dynamic>
-struct ei_inplace_transpose_selector;
+struct inplace_transpose_selector;
template<typename MatrixType>
-struct ei_inplace_transpose_selector<MatrixType,true> { // square matrix
+struct inplace_transpose_selector<MatrixType,true> { // square matrix
static void run(MatrixType& m) {
m.template triangularView<StrictlyUpper>().swap(m.transpose());
}
};
template<typename MatrixType>
-struct ei_inplace_transpose_selector<MatrixType,false> { // non square matrix
+struct inplace_transpose_selector<MatrixType,false> { // non square matrix
static void run(MatrixType& m) {
if (m.rows()==m.cols())
m.template triangularView<StrictlyUpper>().swap(m.transpose());
@@ -247,6 +256,8 @@ struct ei_inplace_transpose_selector<MatrixType,false> { // non square matrix
}
};
+} // end namespace internal
+
/** This is the "in place" version of transpose(): it replaces \c *this by its own transpose.
* Thus, doing
* \code
@@ -268,7 +279,7 @@ struct ei_inplace_transpose_selector<MatrixType,false> { // non square matrix
template<typename Derived>
inline void DenseBase<Derived>::transposeInPlace()
{
- ei_inplace_transpose_selector<Derived>::run(derived());
+ internal::inplace_transpose_selector<Derived>::run(derived());
}
/***************************************************************************
@@ -303,45 +314,47 @@ inline void MatrixBase<Derived>::adjointInPlace()
// The following is to detect aliasing problems in most common cases.
+namespace internal {
+
template<typename BinOp,typename NestedXpr,typename Rhs>
-struct ei_blas_traits<SelfCwiseBinaryOp<BinOp,NestedXpr,Rhs> >
- : ei_blas_traits<NestedXpr>
+struct blas_traits<SelfCwiseBinaryOp<BinOp,NestedXpr,Rhs> >
+ : blas_traits<NestedXpr>
{
typedef SelfCwiseBinaryOp<BinOp,NestedXpr,Rhs> XprType;
static inline const XprType extract(const XprType& x) { return x; }
};
template<bool DestIsTransposed, typename OtherDerived>
-struct ei_check_transpose_aliasing_compile_time_selector
+struct check_transpose_aliasing_compile_time_selector
{
- enum { ret = ei_blas_traits<OtherDerived>::IsTransposed != DestIsTransposed
+ enum { ret = blas_traits<OtherDerived>::IsTransposed != DestIsTransposed
};
};
template<bool DestIsTransposed, typename BinOp, typename DerivedA, typename DerivedB>
-struct ei_check_transpose_aliasing_compile_time_selector<DestIsTransposed,CwiseBinaryOp<BinOp,DerivedA,DerivedB> >
+struct check_transpose_aliasing_compile_time_selector<DestIsTransposed,CwiseBinaryOp<BinOp,DerivedA,DerivedB> >
{
- enum { ret = ei_blas_traits<DerivedA>::IsTransposed != DestIsTransposed
- || ei_blas_traits<DerivedB>::IsTransposed != DestIsTransposed
+ enum { ret = blas_traits<DerivedA>::IsTransposed != DestIsTransposed
+ || blas_traits<DerivedB>::IsTransposed != DestIsTransposed
};
};
template<typename Scalar, bool DestIsTransposed, typename OtherDerived>
-struct ei_check_transpose_aliasing_run_time_selector
+struct check_transpose_aliasing_run_time_selector
{
static bool run(const Scalar* dest, const OtherDerived& src)
{
- return (ei_blas_traits<OtherDerived>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)ei_extract_data(src));
+ return (blas_traits<OtherDerived>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)extract_data(src));
}
};
template<typename Scalar, bool DestIsTransposed, typename BinOp, typename DerivedA, typename DerivedB>
-struct ei_check_transpose_aliasing_run_time_selector<Scalar,DestIsTransposed,CwiseBinaryOp<BinOp,DerivedA,DerivedB> >
+struct check_transpose_aliasing_run_time_selector<Scalar,DestIsTransposed,CwiseBinaryOp<BinOp,DerivedA,DerivedB> >
{
static bool run(const Scalar* dest, const CwiseBinaryOp<BinOp,DerivedA,DerivedB>& src)
{
- return ((ei_blas_traits<DerivedA>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)ei_extract_data(src.lhs())))
- || ((ei_blas_traits<DerivedB>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)ei_extract_data(src.rhs())));
+ return ((blas_traits<DerivedA>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)extract_data(src.lhs())))
+ || ((blas_traits<DerivedB>::IsTransposed != DestIsTransposed) && (dest!=0 && dest==(Scalar*)extract_data(src.rhs())));
}
};
@@ -353,16 +366,16 @@ struct ei_check_transpose_aliasing_run_time_selector<Scalar,DestIsTransposed,Cwi
template<typename Derived, typename OtherDerived,
bool MightHaveTransposeAliasing
- = ei_check_transpose_aliasing_compile_time_selector
- <ei_blas_traits<Derived>::IsTransposed,OtherDerived>::ret
+ = check_transpose_aliasing_compile_time_selector
+ <blas_traits<Derived>::IsTransposed,OtherDerived>::ret
>
struct checkTransposeAliasing_impl
{
static void run(const Derived& dst, const OtherDerived& other)
{
- ei_assert((!ei_check_transpose_aliasing_run_time_selector
- <typename Derived::Scalar,ei_blas_traits<Derived>::IsTransposed,OtherDerived>
- ::run(ei_extract_data(dst), other))
+ eigen_assert((!check_transpose_aliasing_run_time_selector
+ <typename Derived::Scalar,blas_traits<Derived>::IsTransposed,OtherDerived>
+ ::run(extract_data(dst), other))
&& "aliasing detected during tranposition, use transposeInPlace() "
"or evaluate the rhs into a temporary using .eval()");
@@ -377,12 +390,13 @@ struct checkTransposeAliasing_impl<Derived, OtherDerived, false>
}
};
+} // end namespace internal
template<typename Derived>
template<typename OtherDerived>
void DenseBase<Derived>::checkTransposeAliasing(const OtherDerived& other) const
{
- checkTransposeAliasing_impl<Derived, OtherDerived>::run(derived(), other);
+ internal::checkTransposeAliasing_impl<Derived, OtherDerived>::run(derived(), other);
}
#endif
diff --git a/Eigen/src/Core/Transpositions.h b/Eigen/src/Core/Transpositions.h
index 6703b1e58..9735b4eea 100644
--- a/Eigen/src/Core/Transpositions.h
+++ b/Eigen/src/Core/Transpositions.h
@@ -53,7 +53,10 @@
*
* \sa class PermutationMatrix
*/
-template<typename TranspositionType, typename MatrixType, int Side, bool Transposed=false> struct ei_transposition_matrix_product_retval;
+
+namespace internal {
+template<typename TranspositionType, typename MatrixType, int Side, bool Transposed=false> struct transposition_matrix_product_retval;
+}
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
class Transpositions
@@ -188,11 +191,11 @@ class Transpositions
/** \returns the \a matrix with the \a transpositions applied to the columns.
*/
template<typename Derived, int SizeAtCompileTime, int MaxSizeAtCompileTime>
-inline const ei_transposition_matrix_product_retval<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
+inline const internal::transposition_matrix_product_retval<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
operator*(const MatrixBase<Derived>& matrix,
const Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime> &transpositions)
{
- return ei_transposition_matrix_product_retval
+ return internal::transposition_matrix_product_retval
<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheRight>
(transpositions, matrix.derived());
}
@@ -200,30 +203,32 @@ operator*(const MatrixBase<Derived>& matrix,
/** \returns the \a matrix with the \a transpositions applied to the rows.
*/
template<typename Derived, int SizeAtCompileTime, int MaxSizeAtCompileTime>
-inline const ei_transposition_matrix_product_retval
+inline const internal::transposition_matrix_product_retval
<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheLeft>
operator*(const Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime> &transpositions,
const MatrixBase<Derived>& matrix)
{
- return ei_transposition_matrix_product_retval
+ return internal::transposition_matrix_product_retval
<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime>, Derived, OnTheLeft>
(transpositions, matrix.derived());
}
+namespace internal {
+
template<typename TranspositionType, typename MatrixType, int Side, bool Transposed>
-struct ei_traits<ei_transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> >
+struct traits<transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> >
{
typedef typename MatrixType::PlainObject ReturnType;
};
template<typename TranspositionType, typename MatrixType, int Side, bool Transposed>
-struct ei_transposition_matrix_product_retval
- : public ReturnByValue<ei_transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> >
+struct transposition_matrix_product_retval
+ : public ReturnByValue<transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> >
{
- typedef typename ei_cleantype<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
+ typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned;
typedef typename TranspositionType::Index Index;
- ei_transposition_matrix_product_retval(const TranspositionType& tr, const MatrixType& matrix)
+ transposition_matrix_product_retval(const TranspositionType& tr, const MatrixType& matrix)
: m_transpositions(tr), m_matrix(matrix)
{}
@@ -235,7 +240,7 @@ struct ei_transposition_matrix_product_retval
const int size = m_transpositions.size();
Index j = 0;
- if(!(ei_is_same_type<MatrixTypeNestedCleaned,Dest>::ret && ei_extract_data(dst) == ei_extract_data(m_matrix)))
+ if(!(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix)))
dst = m_matrix;
for(int k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k)
@@ -253,6 +258,8 @@ struct ei_transposition_matrix_product_retval
const typename MatrixType::Nested m_matrix;
};
+} // end namespace internal
+
/* Template partial specialization for transposed/inverse transpositions */
template<int SizeAtCompileTime, int MaxSizeAtCompileTime>
@@ -269,19 +276,19 @@ class Transpose<Transpositions<SizeAtCompileTime, MaxSizeAtCompileTime> >
/** \returns the \a matrix with the inverse transpositions applied to the columns.
*/
template<typename Derived> friend
- inline const ei_transposition_matrix_product_retval<TranspositionType, Derived, OnTheRight, true>
+ inline const internal::transposition_matrix_product_retval<TranspositionType, Derived, OnTheRight, true>
operator*(const MatrixBase<Derived>& matrix, const Transpose& trt)
{
- return ei_transposition_matrix_product_retval<TranspositionType, Derived, OnTheRight, true>(trt.m_transpositions, matrix.derived());
+ return internal::transposition_matrix_product_retval<TranspositionType, Derived, OnTheRight, true>(trt.m_transpositions, matrix.derived());
}
/** \returns the \a matrix with the inverse transpositions applied to the rows.
*/
template<typename Derived>
- inline const ei_transposition_matrix_product_retval<TranspositionType, Derived, OnTheLeft, true>
+ inline const internal::transposition_matrix_product_retval<TranspositionType, Derived, OnTheLeft, true>
operator*(const MatrixBase<Derived>& matrix) const
{
- return ei_transposition_matrix_product_retval<TranspositionType, Derived, OnTheLeft, true>(m_transpositions, matrix.derived());
+ return internal::transposition_matrix_product_retval<TranspositionType, Derived, OnTheLeft, true>(m_transpositions, matrix.derived());
}
const TranspositionType& nestedTranspositions() const { return m_transpositions; }
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h
index 6e4e5b2cc..e361af643 100644
--- a/Eigen/src/Core/TriangularMatrix.h
+++ b/Eigen/src/Core/TriangularMatrix.h
@@ -38,18 +38,18 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
public:
enum {
- Mode = ei_traits<Derived>::Mode,
- CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
- RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
- MaxRowsAtCompileTime = ei_traits<Derived>::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = ei_traits<Derived>::MaxColsAtCompileTime
+ Mode = internal::traits<Derived>::Mode,
+ CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
+ RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
+ ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime
};
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
- inline TriangularBase() { ei_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
+ inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
inline Index rows() const { return derived().rows(); }
inline Index cols() const { return derived().cols(); }
@@ -94,8 +94,8 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
{
EIGEN_ONLY_USED_FOR_DEBUG(row);
EIGEN_ONLY_USED_FOR_DEBUG(col);
- ei_assert(col>=0 && col<cols() && row>=0 && row<rows());
- ei_assert( (Mode==Upper && col>=row)
+ eigen_assert(col>=0 && col<cols() && row>=0 && row<rows());
+ eigen_assert( (Mode==Upper && col>=row)
|| (Mode==Lower && col<=row)
|| ((Mode==StrictlyUpper || Mode==UnitUpper) && col>row)
|| ((Mode==StrictlyLower || Mode==UnitLower) && col<row));
@@ -129,11 +129,12 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
*
* \sa MatrixBase::triangularView()
*/
+namespace internal {
template<typename MatrixType, unsigned int _Mode>
-struct ei_traits<TriangularView<MatrixType, _Mode> > : ei_traits<MatrixType>
+struct traits<TriangularView<MatrixType, _Mode> > : traits<MatrixType>
{
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
typedef MatrixType ExpressionType;
enum {
Mode = _Mode,
@@ -141,6 +142,7 @@ struct ei_traits<TriangularView<MatrixType, _Mode> > : ei_traits<MatrixType>
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
};
};
+}
template<int Mode, bool LhsIsTriangular,
typename Lhs, bool LhsIsVector,
@@ -153,22 +155,22 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
public:
typedef TriangularBase<TriangularView> Base;
- typedef typename ei_traits<TriangularView>::Scalar Scalar;
+ typedef typename internal::traits<TriangularView>::Scalar Scalar;
typedef _MatrixType MatrixType;
typedef typename MatrixType::PlainObject DenseMatrixType;
protected:
typedef typename MatrixType::Nested MatrixTypeNested;
- typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
- typedef typename ei_cleantype<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
+ typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
public:
using Base::evalToLazy;
- typedef typename ei_traits<TriangularView>::StorageKind StorageKind;
- typedef typename ei_traits<TriangularView>::Index Index;
+ typedef typename internal::traits<TriangularView>::StorageKind StorageKind;
+ typedef typename internal::traits<TriangularView>::Index Index;
enum {
Mode = _Mode,
@@ -179,7 +181,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
};
inline TriangularView(const MatrixType& matrix) : m_matrix(matrix)
- { ei_assert(ei_are_flags_consistent<Mode>::ret); }
+ { eigen_assert(internal::are_flags_consistent<Mode>::ret); }
inline Index rows() const { return m_matrix.rows(); }
inline Index cols() const { return m_matrix.cols(); }
@@ -191,9 +193,9 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
/** \sa MatrixBase::operator-=() */
template<typename Other> TriangularView& operator-=(const Other& other) { return *this = m_matrix - other; }
/** \sa MatrixBase::operator*=() */
- TriangularView& operator*=(const typename ei_traits<MatrixType>::Scalar& other) { return *this = m_matrix * other; }
+ TriangularView& operator*=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = m_matrix * other; }
/** \sa MatrixBase::operator/=() */
- TriangularView& operator/=(const typename ei_traits<MatrixType>::Scalar& other) { return *this = m_matrix / other; }
+ TriangularView& operator/=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = m_matrix / other; }
/** \sa MatrixBase::fill() */
void fill(const Scalar& value) { setConstant(value); }
@@ -292,14 +294,14 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
template<int Side, typename OtherDerived>
- typename ei_plain_matrix_type_column_major<OtherDerived>::type
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type
solve(const MatrixBase<OtherDerived>& other) const;
template<int Side, typename OtherDerived>
void solveInPlace(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived>
- typename ei_plain_matrix_type_column_major<OtherDerived>::type
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type
solve(const MatrixBase<OtherDerived>& other) const
{ return solve<OnTheLeft>(other); }
@@ -349,8 +351,10 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
* Implementation of triangular evaluation/assignment
***************************************************************************/
+namespace internal {
+
template<typename Derived1, typename Derived2, unsigned int Mode, int UnrollCount, bool ClearOpposite>
-struct ei_triangular_assignment_selector
+struct triangular_assignment_selector
{
enum {
col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
@@ -359,9 +363,9 @@ struct ei_triangular_assignment_selector
inline static void run(Derived1 &dst, const Derived2 &src)
{
- ei_triangular_assignment_selector<Derived1, Derived2, Mode, UnrollCount-1, ClearOpposite>::run(dst, src);
+ triangular_assignment_selector<Derived1, Derived2, Mode, UnrollCount-1, ClearOpposite>::run(dst, src);
- ei_assert( Mode == Upper || Mode == Lower
+ eigen_assert( Mode == Upper || Mode == Lower
|| Mode == StrictlyUpper || Mode == StrictlyLower
|| Mode == UnitUpper || Mode == UnitLower);
if((Mode == Upper && row <= col)
@@ -383,13 +387,13 @@ struct ei_triangular_assignment_selector
// prevent buggy user code from causing an infinite recursion
template<typename Derived1, typename Derived2, unsigned int Mode, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, Mode, 0, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, Mode, 0, ClearOpposite>
{
inline static void run(Derived1 &, const Derived2 &) {}
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, Upper, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, Upper, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -407,7 +411,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, Upper, Dynamic, Cle
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, Lower, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, Lower, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -425,7 +429,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, Lower, Dynamic, Cle
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, StrictlyUpper, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, StrictlyUpper, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -443,7 +447,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, StrictlyUpper, Dyna
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, StrictlyLower, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, StrictlyLower, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -461,7 +465,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, StrictlyLower, Dyna
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, UnitUpper, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, UnitUpper, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -481,7 +485,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, UnitUpper, Dynamic,
}
};
template<typename Derived1, typename Derived2, bool ClearOpposite>
-struct ei_triangular_assignment_selector<Derived1, Derived2, UnitLower, Dynamic, ClearOpposite>
+struct triangular_assignment_selector<Derived1, Derived2, UnitLower, Dynamic, ClearOpposite>
{
typedef typename Derived1::Index Index;
inline static void run(Derived1 &dst, const Derived2 &src)
@@ -501,6 +505,8 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, UnitLower, Dynamic,
}
};
+} // end namespace internal
+
// FIXME should we keep that possibility
template<typename MatrixType, unsigned int Mode>
template<typename OtherDerived>
@@ -509,7 +515,7 @@ TriangularView<MatrixType, Mode>::operator=(const MatrixBase<OtherDerived>& othe
{
if(OtherDerived::Flags & EvalBeforeAssigningBit)
{
- typename ei_plain_matrix_type<OtherDerived>::type other_evaluated(other.rows(), other.cols());
+ typename internal::plain_matrix_type<OtherDerived>::type other_evaluated(other.rows(), other.cols());
other_evaluated.template triangularView<Mode>().lazyAssign(other.derived());
lazyAssign(other_evaluated);
}
@@ -525,12 +531,12 @@ void TriangularView<MatrixType, Mode>::lazyAssign(const MatrixBase<OtherDerived>
{
enum {
unroll = MatrixType::SizeAtCompileTime != Dynamic
- && ei_traits<OtherDerived>::CoeffReadCost != Dynamic
- && MatrixType::SizeAtCompileTime*ei_traits<OtherDerived>::CoeffReadCost/2 <= EIGEN_UNROLLING_LIMIT
+ && internal::traits<OtherDerived>::CoeffReadCost != Dynamic
+ && MatrixType::SizeAtCompileTime*internal::traits<OtherDerived>::CoeffReadCost/2 <= EIGEN_UNROLLING_LIMIT
};
- ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
+ eigen_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
- ei_triangular_assignment_selector
+ internal::triangular_assignment_selector
<MatrixType, OtherDerived, int(Mode),
unroll ? int(MatrixType::SizeAtCompileTime) : Dynamic,
false // do not change the opposite triangular part
@@ -544,8 +550,8 @@ template<typename OtherDerived>
inline TriangularView<MatrixType, Mode>&
TriangularView<MatrixType, Mode>::operator=(const TriangularBase<OtherDerived>& other)
{
- ei_assert(Mode == int(OtherDerived::Mode));
- if(ei_traits<OtherDerived>::Flags & EvalBeforeAssigningBit)
+ eigen_assert(Mode == int(OtherDerived::Mode));
+ if(internal::traits<OtherDerived>::Flags & EvalBeforeAssigningBit)
{
typename OtherDerived::DenseMatrixType other_evaluated(other.rows(), other.cols());
other_evaluated.template triangularView<Mode>().lazyAssign(other.derived().nestedExpression());
@@ -562,13 +568,13 @@ void TriangularView<MatrixType, Mode>::lazyAssign(const TriangularBase<OtherDeri
{
enum {
unroll = MatrixType::SizeAtCompileTime != Dynamic
- && ei_traits<OtherDerived>::CoeffReadCost != Dynamic
- && MatrixType::SizeAtCompileTime * ei_traits<OtherDerived>::CoeffReadCost / 2
+ && internal::traits<OtherDerived>::CoeffReadCost != Dynamic
+ && MatrixType::SizeAtCompileTime * internal::traits<OtherDerived>::CoeffReadCost / 2
<= EIGEN_UNROLLING_LIMIT
};
- ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
+ eigen_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
- ei_triangular_assignment_selector
+ internal::triangular_assignment_selector
<MatrixType, OtherDerived, int(Mode),
unroll ? int(MatrixType::SizeAtCompileTime) : Dynamic,
false // preserve the opposite triangular part
@@ -585,9 +591,9 @@ template<typename Derived>
template<typename DenseDerived>
void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
{
- if(ei_traits<Derived>::Flags & EvalBeforeAssigningBit)
+ if(internal::traits<Derived>::Flags & EvalBeforeAssigningBit)
{
- typename ei_plain_matrix_type<Derived>::type other_evaluated(rows(), cols());
+ typename internal::plain_matrix_type<Derived>::type other_evaluated(rows(), cols());
evalToLazy(other_evaluated);
other.derived().swap(other_evaluated);
}
@@ -603,14 +609,14 @@ void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
{
enum {
unroll = DenseDerived::SizeAtCompileTime != Dynamic
- && ei_traits<Derived>::CoeffReadCost != Dynamic
- && DenseDerived::SizeAtCompileTime * ei_traits<Derived>::CoeffReadCost / 2
+ && internal::traits<Derived>::CoeffReadCost != Dynamic
+ && DenseDerived::SizeAtCompileTime * internal::traits<Derived>::CoeffReadCost / 2
<= EIGEN_UNROLLING_LIMIT
};
- ei_assert(this->rows() == other.rows() && this->cols() == other.cols());
+ eigen_assert(this->rows() == other.rows() && this->cols() == other.cols());
- ei_triangular_assignment_selector
- <DenseDerived, typename ei_traits<Derived>::ExpressionType, Derived::Mode,
+ internal::triangular_assignment_selector
+ <DenseDerived, typename internal::traits<Derived>::ExpressionType, Derived::Mode,
unroll ? int(DenseDerived::SizeAtCompileTime) : Dynamic,
true // clear the opposite triangular part
>::run(other.derived(), derived().nestedExpression());
@@ -680,14 +686,14 @@ bool MatrixBase<Derived>::isUpperTriangular(RealScalar prec) const
Index maxi = std::min(j, rows()-1);
for(Index i = 0; i <= maxi; ++i)
{
- RealScalar absValue = ei_abs(coeff(i,j));
+ RealScalar absValue = internal::abs(coeff(i,j));
if(absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
}
}
RealScalar threshold = maxAbsOnUpperPart * prec;
for(Index j = 0; j < cols(); ++j)
for(Index i = j+1; i < rows(); ++i)
- if(ei_abs(coeff(i, j)) > threshold) return false;
+ if(internal::abs(coeff(i, j)) > threshold) return false;
return true;
}
@@ -703,7 +709,7 @@ bool MatrixBase<Derived>::isLowerTriangular(RealScalar prec) const
for(Index j = 0; j < cols(); ++j)
for(Index i = j; i < rows(); ++i)
{
- RealScalar absValue = ei_abs(coeff(i,j));
+ RealScalar absValue = internal::abs(coeff(i,j));
if(absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
}
RealScalar threshold = maxAbsOnLowerPart * prec;
@@ -711,7 +717,7 @@ bool MatrixBase<Derived>::isLowerTriangular(RealScalar prec) const
{
Index maxi = std::min(j, rows()-1);
for(Index i = 0; i < maxi; ++i)
- if(ei_abs(coeff(i, j)) > threshold) return false;
+ if(internal::abs(coeff(i, j)) > threshold) return false;
}
return true;
}
diff --git a/Eigen/src/Core/VectorBlock.h b/Eigen/src/Core/VectorBlock.h
index 84040bca1..912277633 100644
--- a/Eigen/src/Core/VectorBlock.h
+++ b/Eigen/src/Core/VectorBlock.h
@@ -56,24 +56,27 @@
*
* \sa class Block, DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index)
*/
+
+namespace internal {
template<typename VectorType, int Size>
-struct ei_traits<VectorBlock<VectorType, Size> >
- : public ei_traits<Block<VectorType,
- ei_traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
- ei_traits<VectorType>::Flags & RowMajorBit ? Size : 1> >
+struct traits<VectorBlock<VectorType, Size> >
+ : public traits<Block<VectorType,
+ traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
+ traits<VectorType>::Flags & RowMajorBit ? Size : 1> >
{
};
+}
template<typename VectorType, int Size> class VectorBlock
: public Block<VectorType,
- ei_traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
- ei_traits<VectorType>::Flags & RowMajorBit ? Size : 1>
+ internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
+ internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1>
{
typedef Block<VectorType,
- ei_traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
- ei_traits<VectorType>::Flags & RowMajorBit ? Size : 1> Base;
+ internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
+ internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1> Base;
enum {
- IsColVector = !(ei_traits<VectorType>::Flags & RowMajorBit)
+ IsColVector = !(internal::traits<VectorType>::Flags & RowMajorBit)
};
public:
EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h
index 7f7ab842e..ab6089794 100644
--- a/Eigen/src/Core/VectorwiseOp.h
+++ b/Eigen/src/Core/VectorwiseOp.h
@@ -45,16 +45,17 @@
template< typename MatrixType, typename MemberOp, int Direction>
class PartialReduxExpr;
+namespace internal {
template<typename MatrixType, typename MemberOp, int Direction>
-struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
- : ei_traits<MatrixType>
+struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
+ : traits<MatrixType>
{
typedef typename MemberOp::result_type Scalar;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
- typedef typename ei_traits<MatrixType>::XprKind XprKind;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
+ typedef typename traits<MatrixType>::XprKind XprKind;
typedef typename MatrixType::Scalar InputScalar;
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested;
enum {
RowsAtCompileTime = Direction==Vertical ? 1 : MatrixType::RowsAtCompileTime,
ColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::ColsAtCompileTime,
@@ -70,20 +71,21 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
typedef typename MemberOp::template Cost<InputScalar,TraversalSize> CostOpType;
#endif
enum {
- CoeffReadCost = TraversalSize * ei_traits<_MatrixTypeNested>::CoeffReadCost + int(CostOpType::value)
+ CoeffReadCost = TraversalSize * traits<_MatrixTypeNested>::CoeffReadCost + int(CostOpType::value)
};
};
+}
template< typename MatrixType, typename MemberOp, int Direction>
-class PartialReduxExpr : ei_no_assignment_operator,
- public ei_dense_xpr_base< PartialReduxExpr<MatrixType, MemberOp, Direction> >::type
+class PartialReduxExpr : internal::no_assignment_operator,
+ public internal::dense_xpr_base< PartialReduxExpr<MatrixType, MemberOp, Direction> >::type
{
public:
- typedef typename ei_dense_xpr_base<PartialReduxExpr>::type Base;
+ typedef typename internal::dense_xpr_base<PartialReduxExpr>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(PartialReduxExpr)
- typedef typename ei_traits<PartialReduxExpr>::MatrixTypeNested MatrixTypeNested;
- typedef typename ei_traits<PartialReduxExpr>::_MatrixTypeNested _MatrixTypeNested;
+ typedef typename internal::traits<PartialReduxExpr>::MatrixTypeNested MatrixTypeNested;
+ typedef typename internal::traits<PartialReduxExpr>::_MatrixTypeNested _MatrixTypeNested;
PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp())
: m_matrix(mat), m_functor(func) {}
@@ -114,8 +116,8 @@ class PartialReduxExpr : ei_no_assignment_operator,
#define EIGEN_MEMBER_FUNCTOR(MEMBER,COST) \
template <typename ResultType> \
- struct ei_member_##MEMBER { \
- EIGEN_EMPTY_STRUCT_CTOR(ei_member_##MEMBER) \
+ struct member_##MEMBER { \
+ EIGEN_EMPTY_STRUCT_CTOR(member_##MEMBER) \
typedef ResultType result_type; \
template<typename Scalar, int Size> struct Cost \
{ enum { value = COST }; }; \
@@ -124,11 +126,13 @@ class PartialReduxExpr : ei_no_assignment_operator,
{ return mat.MEMBER(); } \
}
+namespace internal {
+
EIGEN_MEMBER_FUNCTOR(squaredNorm, Size * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(norm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(stableNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(blueNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
-EIGEN_MEMBER_FUNCTOR(hypotNorm, (Size-1) * ei_functor_traits<ei_scalar_hypot_op<Scalar> >::Cost );
+EIGEN_MEMBER_FUNCTOR(hypotNorm, (Size-1) * functor_traits<scalar_hypot_op<Scalar> >::Cost );
EIGEN_MEMBER_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(mean, (Size-1)*NumTraits<Scalar>::AddCost + NumTraits<Scalar>::MulCost);
EIGEN_MEMBER_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
@@ -139,20 +143,20 @@ EIGEN_MEMBER_FUNCTOR(count, (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(prod, (Size-1)*NumTraits<Scalar>::MulCost);
-/** \internal */
template <typename BinaryOp, typename Scalar>
-struct ei_member_redux {
- typedef typename ei_result_of<
+struct member_redux {
+ typedef typename result_of<
BinaryOp(Scalar)
>::type result_type;
template<typename _Scalar, int Size> struct Cost
- { enum { value = (Size-1) * ei_functor_traits<BinaryOp>::Cost }; };
- ei_member_redux(const BinaryOp func) : m_functor(func) {}
+ { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };
+ member_redux(const BinaryOp func) : m_functor(func) {}
template<typename Derived>
inline result_type operator()(const DenseBase<Derived>& mat) const
{ return mat.redux(m_functor); }
const BinaryOp m_functor;
};
+}
/** \class VectorwiseOp
* \ingroup Core_Module
@@ -178,11 +182,11 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
typedef typename ExpressionType::Scalar Scalar;
typedef typename ExpressionType::RealScalar RealScalar;
typedef typename ExpressionType::Index Index;
- typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
- ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
+ typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
+ ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
template<template<typename _Scalar> class Functor,
- typename Scalar=typename ei_traits<ExpressionType>::Scalar> struct ReturnType
+ typename Scalar=typename internal::traits<ExpressionType>::Scalar> struct ReturnType
{
typedef PartialReduxExpr<ExpressionType,
Functor<Scalar>,
@@ -193,7 +197,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
template<typename BinaryOp> struct ReduxReturnType
{
typedef PartialReduxExpr<ExpressionType,
- ei_member_redux<BinaryOp,typename ei_traits<ExpressionType>::Scalar>,
+ internal::member_redux<BinaryOp,typename internal::traits<ExpressionType>::Scalar>,
Direction
> Type;
};
@@ -207,9 +211,9 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
/** \internal
* \returns the i-th subvector according to the \c Direction */
- typedef typename ei_meta_if<Direction==Vertical,
+ typedef typename internal::conditional<Direction==Vertical,
typename ExpressionType::ColXpr,
- typename ExpressionType::RowXpr>::ret SubVector;
+ typename ExpressionType::RowXpr>::type SubVector;
SubVector subVector(Index i)
{
return SubVector(m_matrix.derived(),i);
@@ -265,7 +269,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_minCoeff.out
*
* \sa DenseBase::minCoeff() */
- const typename ReturnType<ei_member_minCoeff>::Type minCoeff() const
+ const typename ReturnType<internal::member_minCoeff>::Type minCoeff() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the largest coefficient
@@ -275,7 +279,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_maxCoeff.out
*
* \sa DenseBase::maxCoeff() */
- const typename ReturnType<ei_member_maxCoeff>::Type maxCoeff() const
+ const typename ReturnType<internal::member_maxCoeff>::Type maxCoeff() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the squared norm
@@ -285,7 +289,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_squaredNorm.out
*
* \sa DenseBase::squaredNorm() */
- const typename ReturnType<ei_member_squaredNorm,RealScalar>::Type squaredNorm() const
+ const typename ReturnType<internal::member_squaredNorm,RealScalar>::Type squaredNorm() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the norm
@@ -295,7 +299,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_norm.out
*
* \sa DenseBase::norm() */
- const typename ReturnType<ei_member_norm,RealScalar>::Type norm() const
+ const typename ReturnType<internal::member_norm,RealScalar>::Type norm() const
{ return _expression(); }
@@ -304,7 +308,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* blue's algorithm.
*
* \sa DenseBase::blueNorm() */
- const typename ReturnType<ei_member_blueNorm,RealScalar>::Type blueNorm() const
+ const typename ReturnType<internal::member_blueNorm,RealScalar>::Type blueNorm() const
{ return _expression(); }
@@ -313,7 +317,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* underflow and overflow.
*
* \sa DenseBase::stableNorm() */
- const typename ReturnType<ei_member_stableNorm,RealScalar>::Type stableNorm() const
+ const typename ReturnType<internal::member_stableNorm,RealScalar>::Type stableNorm() const
{ return _expression(); }
@@ -322,7 +326,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* underflow and overflow using a concatenation of hypot() calls.
*
* \sa DenseBase::hypotNorm() */
- const typename ReturnType<ei_member_hypotNorm,RealScalar>::Type hypotNorm() const
+ const typename ReturnType<internal::member_hypotNorm,RealScalar>::Type hypotNorm() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the sum
@@ -332,28 +336,28 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_sum.out
*
* \sa DenseBase::sum() */
- const typename ReturnType<ei_member_sum>::Type sum() const
+ const typename ReturnType<internal::member_sum>::Type sum() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the mean
* of each column (or row) of the referenced expression.
*
* \sa DenseBase::mean() */
- const typename ReturnType<ei_member_mean>::Type mean() const
+ const typename ReturnType<internal::member_mean>::Type mean() const
{ return _expression(); }
/** \returns a row (or column) vector expression representing
* whether \b all coefficients of each respective column (or row) are \c true.
*
* \sa DenseBase::all() */
- const typename ReturnType<ei_member_all>::Type all() const
+ const typename ReturnType<internal::member_all>::Type all() const
{ return _expression(); }
/** \returns a row (or column) vector expression representing
* whether \b at \b least one coefficient of each respective column (or row) is \c true.
*
* \sa DenseBase::any() */
- const typename ReturnType<ei_member_any>::Type any() const
+ const typename ReturnType<internal::member_any>::Type any() const
{ return _expression(); }
/** \returns a row (or column) vector expression representing
@@ -363,7 +367,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_count.out
*
* \sa DenseBase::count() */
- const PartialReduxExpr<ExpressionType, ei_member_count<Index>, Direction> count() const
+ const PartialReduxExpr<ExpressionType, internal::member_count<Index>, Direction> count() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the product
@@ -373,7 +377,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_prod.out
*
* \sa DenseBase::prod() */
- const typename ReturnType<ei_member_prod>::Type prod() const
+ const typename ReturnType<internal::member_prod>::Type prod() const
{ return _expression(); }
@@ -413,7 +417,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
ExpressionType& operator=(const DenseBase<OtherDerived>& other)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
- //ei_assert((m_matrix.isNull()) == (other.isNull())); FIXME
+ //eigen_assert((m_matrix.isNull()) == (other.isNull())); FIXME
for(Index j=0; j<subVectors(); ++j)
subVector(j) = other;
return const_cast<ExpressionType&>(m_matrix);
@@ -441,7 +445,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
/** Returns the expression of the sum of the vector \a other to each subvector of \c *this */
template<typename OtherDerived> EIGEN_STRONG_INLINE
- CwiseBinaryOp<ei_scalar_sum_op<Scalar>,
+ CwiseBinaryOp<internal::scalar_sum_op<Scalar>,
ExpressionType,
typename ExtendedType<OtherDerived>::Type>
operator+(const DenseBase<OtherDerived>& other) const
@@ -452,7 +456,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
/** Returns the expression of the difference between each subvector of \c *this and the vector \a other */
template<typename OtherDerived>
- CwiseBinaryOp<ei_scalar_difference_op<Scalar>,
+ CwiseBinaryOp<internal::scalar_difference_op<Scalar>,
ExpressionType,
typename ExtendedType<OtherDerived>::Type>
operator-(const DenseBase<OtherDerived>& other) const
@@ -470,21 +474,21 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
const CrossReturnType cross(const MatrixBase<OtherDerived>& other) const;
enum {
- HNormalized_Size = Direction==Vertical ? ei_traits<ExpressionType>::RowsAtCompileTime
- : ei_traits<ExpressionType>::ColsAtCompileTime,
+ HNormalized_Size = Direction==Vertical ? internal::traits<ExpressionType>::RowsAtCompileTime
+ : internal::traits<ExpressionType>::ColsAtCompileTime,
HNormalized_SizeMinusOne = HNormalized_Size==Dynamic ? Dynamic : HNormalized_Size-1
};
typedef Block<ExpressionType,
Direction==Vertical ? int(HNormalized_SizeMinusOne)
- : int(ei_traits<ExpressionType>::RowsAtCompileTime),
+ : int(internal::traits<ExpressionType>::RowsAtCompileTime),
Direction==Horizontal ? int(HNormalized_SizeMinusOne)
- : int(ei_traits<ExpressionType>::ColsAtCompileTime)>
+ : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
HNormalized_Block;
typedef Block<ExpressionType,
- Direction==Vertical ? 1 : int(ei_traits<ExpressionType>::RowsAtCompileTime),
- Direction==Horizontal ? 1 : int(ei_traits<ExpressionType>::ColsAtCompileTime)>
+ Direction==Vertical ? 1 : int(internal::traits<ExpressionType>::RowsAtCompileTime),
+ Direction==Horizontal ? 1 : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
HNormalized_Factors;
- typedef CwiseBinaryOp<ei_scalar_quotient_op<typename ei_traits<ExpressionType>::Scalar>,
+ typedef CwiseBinaryOp<internal::scalar_quotient_op<typename internal::traits<ExpressionType>::Scalar>,
HNormalized_Block,
Replicate<HNormalized_Factors,
Direction==Vertical ? HNormalized_SizeMinusOne : 1,
diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h
index db6fac4b1..6b3b3bfb4 100644
--- a/Eigen/src/Core/Visitor.h
+++ b/Eigen/src/Core/Visitor.h
@@ -25,8 +25,10 @@
#ifndef EIGEN_VISITOR_H
#define EIGEN_VISITOR_H
+namespace internal {
+
template<typename Visitor, typename Derived, int UnrollCount>
-struct ei_visitor_impl
+struct visitor_impl
{
enum {
col = (UnrollCount-1) / Derived::RowsAtCompileTime,
@@ -35,13 +37,13 @@ struct ei_visitor_impl
inline static void run(const Derived &mat, Visitor& visitor)
{
- ei_visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
+ visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
visitor(mat.coeff(row, col), row, col);
}
};
template<typename Visitor, typename Derived>
-struct ei_visitor_impl<Visitor, Derived, 1>
+struct visitor_impl<Visitor, Derived, 1>
{
inline static void run(const Derived &mat, Visitor& visitor)
{
@@ -50,7 +52,7 @@ struct ei_visitor_impl<Visitor, Derived, 1>
};
template<typename Visitor, typename Derived>
-struct ei_visitor_impl<Visitor, Derived, Dynamic>
+struct visitor_impl<Visitor, Derived, Dynamic>
{
typedef typename Derived::Index Index;
inline static void run(const Derived& mat, Visitor& visitor)
@@ -64,6 +66,7 @@ struct ei_visitor_impl<Visitor, Derived, Dynamic>
}
};
+} // end namespace internal
/** Applies the visitor \a visitor to the whole coefficients of the matrix or vector.
*
@@ -88,19 +91,21 @@ void DenseBase<Derived>::visit(Visitor& visitor) const
{
enum { unroll = SizeAtCompileTime != Dynamic
&& CoeffReadCost != Dynamic
- && (SizeAtCompileTime == 1 || ei_functor_traits<Visitor>::Cost != Dynamic)
- && SizeAtCompileTime * CoeffReadCost + (SizeAtCompileTime-1) * ei_functor_traits<Visitor>::Cost
+ && (SizeAtCompileTime == 1 || internal::functor_traits<Visitor>::Cost != Dynamic)
+ && SizeAtCompileTime * CoeffReadCost + (SizeAtCompileTime-1) * internal::functor_traits<Visitor>::Cost
<= EIGEN_UNROLLING_LIMIT };
- return ei_visitor_impl<Visitor, Derived,
+ return internal::visitor_impl<Visitor, Derived,
unroll ? int(SizeAtCompileTime) : Dynamic
>::run(derived(), visitor);
}
+namespace internal {
+
/** \internal
* \brief Base class to implement min and max visitors
*/
template <typename Derived>
-struct ei_coeff_visitor
+struct coeff_visitor
{
typedef typename Derived::Index Index;
typedef typename Derived::Scalar Scalar;
@@ -120,7 +125,7 @@ struct ei_coeff_visitor
* \sa DenseBase::minCoeff(Index*, Index*)
*/
template <typename Derived>
-struct ei_min_coeff_visitor : ei_coeff_visitor<Derived>
+struct min_coeff_visitor : coeff_visitor<Derived>
{
typedef typename Derived::Index Index;
typedef typename Derived::Scalar Scalar;
@@ -136,7 +141,7 @@ struct ei_min_coeff_visitor : ei_coeff_visitor<Derived>
};
template<typename Scalar>
-struct ei_functor_traits<ei_min_coeff_visitor<Scalar> > {
+struct functor_traits<min_coeff_visitor<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost
};
@@ -148,7 +153,7 @@ struct ei_functor_traits<ei_min_coeff_visitor<Scalar> > {
* \sa DenseBase::maxCoeff(Index*, Index*)
*/
template <typename Derived>
-struct ei_max_coeff_visitor : ei_coeff_visitor<Derived>
+struct max_coeff_visitor : coeff_visitor<Derived>
{
typedef typename Derived::Index Index;
typedef typename Derived::Scalar Scalar;
@@ -164,22 +169,24 @@ struct ei_max_coeff_visitor : ei_coeff_visitor<Derived>
};
template<typename Scalar>
-struct ei_functor_traits<ei_max_coeff_visitor<Scalar> > {
+struct functor_traits<max_coeff_visitor<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost
};
};
+} // end namespace internal
+
/** \returns the minimum of all coefficients of *this
* and puts in *row and *col its location.
*
* \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
DenseBase<Derived>::minCoeff(Index* row, Index* col) const
{
- ei_min_coeff_visitor<Derived> minVisitor;
+ internal::min_coeff_visitor<Derived> minVisitor;
this->visit(minVisitor);
*row = minVisitor.row;
if (col) *col = minVisitor.col;
@@ -192,11 +199,11 @@ DenseBase<Derived>::minCoeff(Index* row, Index* col) const
* \sa DenseBase::minCoeff(Index*,Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
DenseBase<Derived>::minCoeff(Index* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- ei_min_coeff_visitor<Derived> minVisitor;
+ internal::min_coeff_visitor<Derived> minVisitor;
this->visit(minVisitor);
*index = (RowsAtCompileTime==1) ? minVisitor.col : minVisitor.row;
return minVisitor.res;
@@ -208,10 +215,10 @@ DenseBase<Derived>::minCoeff(Index* index) const
* \sa DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
DenseBase<Derived>::maxCoeff(Index* row, Index* col) const
{
- ei_max_coeff_visitor<Derived> maxVisitor;
+ internal::max_coeff_visitor<Derived> maxVisitor;
this->visit(maxVisitor);
*row = maxVisitor.row;
if (col) *col = maxVisitor.col;
@@ -224,11 +231,11 @@ DenseBase<Derived>::maxCoeff(Index* row, Index* col) const
* \sa DenseBase::maxCoeff(Index*,Index*), DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
DenseBase<Derived>::maxCoeff(Index* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- ei_max_coeff_visitor<Derived> maxVisitor;
+ internal::max_coeff_visitor<Derived> maxVisitor;
this->visit(maxVisitor);
*index = (RowsAtCompileTime==1) ? maxVisitor.col : maxVisitor.row;
return maxVisitor.res;
diff --git a/Eigen/src/Core/arch/AltiVec/Complex.h b/Eigen/src/Core/arch/AltiVec/Complex.h
index ecada02f4..cf5ed512a 100644
--- a/Eigen/src/Core/arch/AltiVec/Complex.h
+++ b/Eigen/src/Core/arch/AltiVec/Complex.h
@@ -25,13 +25,15 @@
#ifndef EIGEN_COMPLEX_ALTIVEC_H
#define EIGEN_COMPLEX_ALTIVEC_H
-static Packet4ui ei_p4ui_CONJ_XOR = vec_mergeh((Packet4ui)ei_p4i_ZERO, (Packet4ui)ei_p4f_ZERO_);//{ 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
-static Packet16uc ei_p16uc_COMPLEX_RE = vec_sld((Packet16uc) vec_splat((Packet4ui)ei_p16uc_FORWARD, 0), (Packet16uc) vec_splat((Packet4ui)ei_p16uc_FORWARD, 2), 8);//{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 };
-static Packet16uc ei_p16uc_COMPLEX_IM = vec_sld((Packet16uc) vec_splat((Packet4ui)ei_p16uc_FORWARD, 1), (Packet16uc) vec_splat((Packet4ui)ei_p16uc_FORWARD, 3), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };
-static Packet16uc ei_p16uc_COMPLEX_REV = vec_sld(ei_p16uc_REVERSE, ei_p16uc_REVERSE, 8);//{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 };
-static Packet16uc ei_p16uc_COMPLEX_REV2 = vec_sld(ei_p16uc_FORWARD, ei_p16uc_FORWARD, 8);//{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
-static Packet16uc ei_p16uc_PSET_HI = (Packet16uc) vec_mergeh((Packet4ui) vec_splat((Packet4ui)ei_p16uc_FORWARD, 0), (Packet4ui) vec_splat((Packet4ui)ei_p16uc_FORWARD, 1));//{ 0,1,2,3, 4,5,6,7, 0,1,2,3, 4,5,6,7 };
-static Packet16uc ei_p16uc_PSET_LO = (Packet16uc) vec_mergeh((Packet4ui) vec_splat((Packet4ui)ei_p16uc_FORWARD, 2), (Packet4ui) vec_splat((Packet4ui)ei_p16uc_FORWARD, 3));//{ 8,9,10,11, 12,13,14,15, 8,9,10,11, 12,13,14,15 };
+namespace internal {
+
+static Packet4ui p4ui_CONJ_XOR = vec_mergeh((Packet4ui)p4i_ZERO, (Packet4ui)p4f_ZERO_);//{ 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
+static Packet16uc p16uc_COMPLEX_RE = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 2), 8);//{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 };
+static Packet16uc p16uc_COMPLEX_IM = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 1), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 3), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };
+static Packet16uc p16uc_COMPLEX_REV = vec_sld(p16uc_REVERSE, p16uc_REVERSE, 8);//{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 };
+static Packet16uc p16uc_COMPLEX_REV2 = vec_sld(p16uc_FORWARD, p16uc_FORWARD, 8);//{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
+static Packet16uc p16uc_PSET_HI = (Packet16uc) vec_mergeh((Packet4ui) vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet4ui) vec_splat((Packet4ui)p16uc_FORWARD, 1));//{ 0,1,2,3, 4,5,6,7, 0,1,2,3, 4,5,6,7 };
+static Packet16uc p16uc_PSET_LO = (Packet16uc) vec_mergeh((Packet4ui) vec_splat((Packet4ui)p16uc_FORWARD, 2), (Packet4ui) vec_splat((Packet4ui)p16uc_FORWARD, 3));//{ 8,9,10,11, 12,13,14,15, 8,9,10,11, 12,13,14,15 };
//---------- float ----------
struct Packet2cf
@@ -41,7 +43,7 @@ struct Packet2cf
Packet4f v;
};
-template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_traits
+template<> struct packet_traits<std::complex<float> > : default_packet_traits
{
typedef Packet2cf type;
enum {
@@ -61,106 +63,106 @@ template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_tr
};
};
-template<> struct ei_unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
+template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pset1<Packet2cf>(const std::complex<float>& from)
+template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
{
Packet2cf res;
/* On AltiVec we cannot load 64-bit registers, so wa have to take care of alignment */
if ((ptrdiff_t)&from % 16 == 0) {
- res.v = ei_pload((const float *)&from);
- res.v = vec_perm(res.v, res.v, ei_p16uc_PSET_HI);
+ res.v = pload((const float *)&from);
+ res.v = vec_perm(res.v, res.v, p16uc_PSET_HI);
} else {
- res.v = ei_ploadu((const float *)&from);
- res.v = vec_perm(res.v, res.v, ei_p16uc_PSET_LO);
+ res.v = ploadu((const float *)&from);
+ res.v = vec_perm(res.v, res.v, p16uc_PSET_LO);
}
return res;
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_add(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_sub(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pnegate(const Packet2cf& a) { return Packet2cf(ei_psub<Packet4f>(ei_p4f_ZERO, a.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pconj(const Packet2cf& a) { return Packet2cf((Packet4f)vec_xor((Packet4ui)a.v, ei_p4ui_CONJ_XOR)); }
+template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_add(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_sub(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(psub<Packet4f>(p4f_ZERO, a.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a) { return Packet2cf((Packet4f)vec_xor((Packet4ui)a.v, p4ui_CONJ_XOR)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
Packet4f v1, v2;
// Permute and multiply the real parts of a and b
- v1 = vec_perm(a.v, a.v, ei_p16uc_COMPLEX_RE);
+ v1 = vec_perm(a.v, a.v, p16uc_COMPLEX_RE);
// Get the imaginary parts of a
- v2 = vec_perm(a.v, a.v, ei_p16uc_COMPLEX_IM);
+ v2 = vec_perm(a.v, a.v, p16uc_COMPLEX_IM);
// multiply a_re * b
- v1 = vec_madd(v1, b.v, ei_p4f_ZERO);
+ v1 = vec_madd(v1, b.v, p4f_ZERO);
// multiply a_im * b and get the conjugate result
- v2 = vec_madd(v2, b.v, ei_p4f_ZERO);
- v2 = (Packet4f) vec_xor((Packet4ui)v2, ei_p4ui_CONJ_XOR);
+ v2 = vec_madd(v2, b.v, p4f_ZERO);
+ v2 = (Packet4f) vec_xor((Packet4ui)v2, p4ui_CONJ_XOR);
// permute back to a proper order
- v2 = vec_perm(v2, v2, ei_p16uc_COMPLEX_REV);
+ v2 = vec_perm(v2, v2, p16uc_COMPLEX_REV);
return Packet2cf(vec_add(v1, v2));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_and(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_or(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_xor(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_and(a.v, vec_nor(b.v,b.v))); }
+template<> EIGEN_STRONG_INLINE Packet2cf pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_and(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_or(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_xor(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_and(a.v, vec_nor(b.v,b.v))); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pload <std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(ei_pload((const float*)from)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_ploadu<std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ei_ploadu((const float*)from)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pload <std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload((const float*)from)); }
+template<> EIGEN_STRONG_INLINE Packet2cf ploadu<std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu((const float*)from)); }
-template<> EIGEN_STRONG_INLINE void ei_pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE ei_pstore((float*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu((float*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<std::complex<float> >(const std::complex<float> * addr) { vec_dstt((float *)addr, DST_CTRL(2,2,32), DST_CHAN); }
+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { vec_dstt((float *)addr, DST_CTRL(2,2,32), DST_CHAN); }
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_pfirst<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
{
std::complex<float> EIGEN_ALIGN16 res[2];
- ei_pstore((float *)&res, a.v);
+ pstore((float *)&res, a.v);
return res[0];
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preverse(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)
{
Packet4f rev_a;
- rev_a = vec_perm(a.v, a.v, ei_p16uc_COMPLEX_REV2);
+ rev_a = vec_perm(a.v, a.v, p16uc_COMPLEX_REV2);
return Packet2cf(rev_a);
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)
{
Packet4f b;
b = (Packet4f) vec_sld(a.v, a.v, 8);
- b = ei_padd(a.v, b);
- return ei_pfirst(Packet2cf(sum));
+ b = padd(a.v, b);
+ return pfirst(Packet2cf(sum));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preduxp<Packet2cf>(const Packet2cf* vecs)
+template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
{
Packet4f b1, b2;
b1 = (Packet4f) vec_sld(vecs[0].v, vecs[1].v, 8);
b2 = (Packet4f) vec_sld(vecs[1].v, vecs[0].v, 8);
b2 = (Packet4f) vec_sld(b2, b2, 8);
- b2 = ei_padd(b1, b2);
+ b2 = padd(b1, b2);
return Packet2cf(b2);
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux_mul<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)
{
Packet4f b;
Packet2cf prod;
b = (Packet4f) vec_sld(a.v, a.v, 8);
- prod = ei_pmul(a, Packet2cf(b));
+ prod = pmul(a, Packet2cf(b));
- return ei_pfirst(prod);
+ return pfirst(prod);
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet2cf>
+struct palign_impl<Offset,Packet2cf>
{
EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
{
@@ -171,45 +173,47 @@ struct ei_palign_impl<Offset,Packet2cf>
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, false,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pmul(a, ei_pconj(b));
+ return pmul(a, pconj(b));
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,false>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pmul(ei_pconj(a), b);
+ return pmul(pconj(a), b);
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pconj(ei_pmul(a, b));
+ return pconj(pmul(a, b));
}
};
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
// TODO optimize it for AltiVec
- Packet2cf res = ei_conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
- Packet4f s = vec_madd(b.v, b.v, ei_p4f_ZERO);
- return Packet2cf(ei_pdiv(res.v, vec_add(s,vec_perm(s, s, ei_p16uc_COMPLEX_REV))));
+ Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
+ Packet4f s = vec_madd(b.v, b.v, p4f_ZERO);
+ return Packet2cf(pdiv(res.v, vec_add(s,vec_perm(s, s, p16uc_COMPLEX_REV))));
}
+} // end namespace internal
+
#endif // EIGEN_COMPLEX_ALTIVEC_H
diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h
index 8205beae5..88a8e3669 100644
--- a/Eigen/src/Core/arch/AltiVec/PacketMath.h
+++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_PACKET_MATH_ALTIVEC_H
#define EIGEN_PACKET_MATH_ALTIVEC_H
+namespace internal {
+
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 4
#endif
@@ -53,38 +55,38 @@ typedef __vector unsigned char Packet16uc;
// and it doesn't really work to declare them global, so we define macros instead
#define _EIGEN_DECLARE_CONST_FAST_Packet4f(NAME,X) \
- Packet4f ei_p4f_##NAME = (Packet4f) vec_splat_s32(X)
+ Packet4f p4f_##NAME = (Packet4f) vec_splat_s32(X)
#define _EIGEN_DECLARE_CONST_FAST_Packet4i(NAME,X) \
- Packet4i ei_p4i_##NAME = vec_splat_s32(X)
+ Packet4i p4i_##NAME = vec_splat_s32(X)
#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
- Packet4f ei_p4f_##NAME = ei_pset1<Packet4f>(X)
+ Packet4f p4f_##NAME = pset1<Packet4f>(X)
#define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \
- Packet4f ei_p4f_##NAME = vreinterpretq_f32_u32(ei_pset1<int>(X))
+ Packet4f p4f_##NAME = vreinterpretq_f32_u32(pset1<int>(X))
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
- Packet4i ei_p4i_##NAME = ei_pset1<Packet4i>(X)
+ Packet4i p4i_##NAME = pset1<Packet4i>(X)
#define DST_CHAN 1
#define DST_CTRL(size, count, stride) (((size) << 24) | ((count) << 16) | (stride))
// Define global static constants:
-static Packet4f ei_p4f_COUNTDOWN = { 3.0, 2.0, 1.0, 0.0 };
-static Packet4i ei_p4i_COUNTDOWN = { 3, 2, 1, 0 };
-static Packet16uc ei_p16uc_REVERSE = {12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3};
-static Packet16uc ei_p16uc_FORWARD = vec_lvsl(0, (float*)0);
+static Packet4f p4f_COUNTDOWN = { 3.0, 2.0, 1.0, 0.0 };
+static Packet4i p4i_COUNTDOWN = { 3, 2, 1, 0 };
+static Packet16uc p16uc_REVERSE = {12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3};
+static Packet16uc p16uc_FORWARD = vec_lvsl(0, (float*)0);
static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0);
static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0);
static _EIGEN_DECLARE_CONST_FAST_Packet4i(ONE,1);
static _EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS16,-16);
static _EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS1,-1);
-static Packet4f ei_p4f_ONE = vec_ctf(ei_p4i_ONE, 0);
-static Packet4f ei_p4f_ZERO_ = (Packet4f) vec_sl((Packet4ui)ei_p4i_MINUS1, (Packet4ui)ei_p4i_MINUS1);
+static Packet4f p4f_ONE = vec_ctf(p4i_ONE, 0);
+static Packet4f p4f_ZERO_ = (Packet4f) vec_sl((Packet4ui)p4i_MINUS1, (Packet4ui)p4i_MINUS1);
-template<> struct ei_packet_traits<float> : ei_default_packet_traits
+template<> struct packet_traits<float> : default_packet_traits
{
typedef Packet4f type;
enum {
@@ -100,7 +102,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
HasSqrt = 0
};
};
-template<> struct ei_packet_traits<int> : ei_default_packet_traits
+template<> struct packet_traits<int> : default_packet_traits
{
typedef Packet4i type;
enum {
@@ -111,8 +113,8 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
};
};
-template<> struct ei_unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
-template<> struct ei_unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
+template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
+template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
/*
inline std::ostream & operator <<(std::ostream & s, const Packet4f & v)
{
@@ -158,7 +160,7 @@ inline std::ostream & operator <<(std::ostream & s, const Packetbi & v)
return s;
}
*/
-template<> EIGEN_STRONG_INLINE Packet4f ei_pset1<Packet4f>(const float& from) {
+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
float EIGEN_ALIGN16 af[4];
af[0] = from;
@@ -167,7 +169,7 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_pset1<Packet4f>(const float& from) {
return vc;
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pset1<Packet4i>(const int& from) {
+template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) {
int EIGEN_ALIGN16 ai[4];
ai[0] = from;
Packet4i vc = vec_ld(0, ai);
@@ -175,22 +177,22 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_pset1<Packet4i>(const int& from)
return vc;
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_plset<float>(const float& a) { return vec_add(ei_pset1<Packet4f>(a), ei_p4f_COUNTDOWN); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_plset<int>(const int& a) { return vec_add(ei_pset1<Packet4i>(a), ei_p4i_COUNTDOWN); }
+template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a) { return vec_add(pset1<Packet4f>(a), p4f_COUNTDOWN); }
+template<> EIGEN_STRONG_INLINE Packet4i plset<int>(const int& a) { return vec_add(pset1<Packet4i>(a), p4i_COUNTDOWN); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_add(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_add(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_add(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_add(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_sub(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_sub(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_sub(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_sub(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pnegate(const Packet4f& a) { return ei_psub<Packet4f>(ei_p4f_ZERO, a); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pnegate(const Packet4i& a) { return ei_psub<Packet4i>(ei_p4i_ZERO, a); }
+template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a) { return psub<Packet4f>(p4f_ZERO, a); }
+template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a) { return psub<Packet4i>(p4i_ZERO, a); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_madd(a,b,ei_p4f_ZERO); }
+template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_madd(a,b,p4f_ZERO); }
/* Commented out: it's actually slower than processing it scalar
*
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmul<Packet4i>(const Packet4i& a, const Packet4i& b)
+template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(const Packet4i& a, const Packet4i& b)
{
// Detailed in: http://freevec.org/content/32bit_signed_integer_multiplication_altivec
//Set up constants, variables
@@ -201,21 +203,21 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_pmul<Packet4i>(const Packet4i& a, con
b1 = vec_abs(b);
// Get the signs using xor
- Packet4bi sgn = (Packet4bi) vec_cmplt(vec_xor(a, b), ei_p4i_ZERO);
+ Packet4bi sgn = (Packet4bi) vec_cmplt(vec_xor(a, b), p4i_ZERO);
// Do the multiplication for the asbolute values.
- bswap = (Packet4i) vec_rl((Packet4ui) b1, (Packet4ui) ei_p4i_MINUS16 );
+ bswap = (Packet4i) vec_rl((Packet4ui) b1, (Packet4ui) p4i_MINUS16 );
low_prod = vec_mulo((Packet8i) a1, (Packet8i)b1);
- high_prod = vec_msum((Packet8i) a1, (Packet8i) bswap, ei_p4i_ZERO);
- high_prod = (Packet4i) vec_sl((Packet4ui) high_prod, (Packet4ui) ei_p4i_MINUS16);
+ high_prod = vec_msum((Packet8i) a1, (Packet8i) bswap, p4i_ZERO);
+ high_prod = (Packet4i) vec_sl((Packet4ui) high_prod, (Packet4ui) p4i_MINUS16);
prod = vec_add( low_prod, high_prod );
// NOR the product and select only the negative elements according to the sign mask
prod_ = vec_nor(prod, prod);
- prod_ = vec_sel(ei_p4i_ZERO, prod_, sgn);
+ prod_ = vec_sel(p4i_ZERO, prod_, sgn);
// Add 1 to the result to get the negative numbers
- v1sel = vec_sel(ei_p4i_ZERO, ei_p4i_ONE, sgn);
+ v1sel = vec_sel(p4i_ZERO, p4i_ONE, sgn);
prod_ = vec_add(prod_, v1sel);
// Merge the results back to the final vector.
@@ -224,7 +226,7 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_pmul<Packet4i>(const Packet4i& a, con
return prod;
}
*/
-template<> EIGEN_STRONG_INLINE Packet4f ei_pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)
{
Packet4f t, y_0, y_1, res;
@@ -232,45 +234,45 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_pdiv<Packet4f>(const Packet4f& a, con
y_0 = vec_re(b);
// Do one Newton-Raphson iteration to get the needed accuracy
- t = vec_nmsub(y_0, b, ei_p4f_ONE);
+ t = vec_nmsub(y_0, b, p4f_ONE);
y_1 = vec_madd(y_0, t, y_0);
- res = vec_madd(a, y_1, ei_p4f_ZERO);
+ res = vec_madd(a, y_1, p4f_ZERO);
return res;
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
-{ ei_assert(false && "packet integer division are not supported by AltiVec");
- return ei_pset1<Packet4i>(0);
+template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
+{ eigen_assert(false && "packet integer division are not supported by AltiVec");
+ return pset1<Packet4i>(0);
}
// for some weird raisons, it has to be overloaded for packet of integers
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_madd(a, b, c); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return ei_padd(ei_pmul(a,b), c); }
+template<> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_madd(a, b, c); }
+template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd(pmul(a,b), c); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_min(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_min(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_min(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_min(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_max(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_max(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_max(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_max(a, b); }
// Logical Operations are not supported for float, so we have to reinterpret casts using NEON intrinsics
-template<> EIGEN_STRONG_INLINE Packet4f ei_pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_por<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_or(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_or(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_or(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_or(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_xor(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_xor(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_xor(a, b); }
+template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_xor(a, b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, vec_nor(b, b)); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, vec_nor(b, b)); }
+template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, vec_nor(b, b)); }
+template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, vec_nor(b, b)); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pload<Packet4f>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return vec_ld(0, from); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pload<Packet4i>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return vec_ld(0, from); }
+template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return vec_ld(0, from); }
+template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return vec_ld(0, from); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu<Packet4f>(const float* from)
+template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from)
{
EIGEN_DEBUG_ALIGNED_LOAD
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
@@ -282,7 +284,7 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu<Packet4f>(const float* from)
return (Packet4f) vec_perm(MSQ, LSQ, mask); // align the data
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu<Packet4i>(const int* from)
+template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
{
EIGEN_DEBUG_ALIGNED_LOAD
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
@@ -294,10 +296,10 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu<Packet4i>(const int* from)
return (Packet4i) vec_perm(MSQ, LSQ, mask); // align the data
}
-template<> EIGEN_STRONG_INLINE void ei_pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
-template<> EIGEN_STRONG_INLINE void ei_pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
+template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
+template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<float>(float* to, const Packet4f& from)
+template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from)
{
EIGEN_DEBUG_UNALIGNED_STORE
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
@@ -315,7 +317,7 @@ template<> EIGEN_STRONG_INLINE void ei_pstoreu<float>(float* to, const Packet4f
vec_st( LSQ, 15, (unsigned char *)to ); // Store the LSQ part first
vec_st( MSQ, 0, (unsigned char *)to ); // Store the MSQ part
}
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<int>(int* to, const Packet4i& from)
+template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from)
{
EIGEN_DEBUG_UNALIGNED_STORE
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
@@ -334,29 +336,29 @@ template<> EIGEN_STRONG_INLINE void ei_pstoreu<int>(int* to, const Packet4i
vec_st( MSQ, 0, (unsigned char *)to ); // Store the MSQ part
}
-template<> EIGEN_STRONG_INLINE void ei_prefetch<float>(const float* addr) { vec_dstt(addr, DST_CTRL(2,2,32), DST_CHAN); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<int>(const int* addr) { vec_dstt(addr, DST_CTRL(2,2,32), DST_CHAN); }
+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { vec_dstt(addr, DST_CTRL(2,2,32), DST_CHAN); }
+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { vec_dstt(addr, DST_CTRL(2,2,32), DST_CHAN); }
-template<> EIGEN_STRONG_INLINE float ei_pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vec_st(a, 0, x); return x[0]; }
-template<> EIGEN_STRONG_INLINE int ei_pfirst<Packet4i>(const Packet4i& a) { int EIGEN_ALIGN16 x[4]; vec_st(a, 0, x); return x[0]; }
+template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vec_st(a, 0, x); return x[0]; }
+template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int EIGEN_ALIGN16 x[4]; vec_st(a, 0, x); return x[0]; }
-template<> EIGEN_STRONG_INLINE Packet4f ei_preverse(const Packet4f& a) { return (Packet4f)vec_perm((Packet16uc)a,(Packet16uc)a, ei_p16uc_REVERSE); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_preverse(const Packet4i& a) { return (Packet4i)vec_perm((Packet16uc)a,(Packet16uc)a, ei_p16uc_REVERSE); }
+template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a) { return (Packet4f)vec_perm((Packet16uc)a,(Packet16uc)a, p16uc_REVERSE); }
+template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a) { return (Packet4i)vec_perm((Packet16uc)a,(Packet16uc)a, p16uc_REVERSE); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pabs(const Packet4f& a) { return vec_abs(a); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pabs(const Packet4i& a) { return vec_abs(a); }
+template<> EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f& a) { return vec_abs(a); }
+template<> EIGEN_STRONG_INLINE Packet4i pabs(const Packet4i& a) { return vec_abs(a); }
-template<> EIGEN_STRONG_INLINE float ei_predux<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
{
Packet4f b, sum;
b = (Packet4f) vec_sld(a, a, 8);
sum = vec_add(a, b);
b = (Packet4f) vec_sld(sum, sum, 4);
sum = vec_add(sum, b);
- return ei_pfirst(sum);
+ return pfirst(sum);
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vecs)
+template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
{
Packet4f v[4], sum[4];
@@ -384,15 +386,15 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vec
return sum[0];
}
-template<> EIGEN_STRONG_INLINE int ei_predux<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a)
{
Packet4i sum;
- sum = vec_sums(a, ei_p4i_ZERO);
- sum = vec_sld(sum, ei_p4i_ZERO, 12);
- return ei_pfirst(sum);
+ sum = vec_sums(a, p4i_ZERO);
+ sum = vec_sld(sum, p4i_ZERO, 12);
+ return pfirst(sum);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vecs)
+template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(const Packet4i* vecs)
{
Packet4i v[4], sum[4];
@@ -422,56 +424,56 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vec
// Other reduction functions:
// mul
-template<> EIGEN_STRONG_INLINE float ei_predux_mul<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)
{
Packet4f prod;
- prod = ei_pmul(a, (Packet4f)vec_sld(a, a, 8));
- return ei_pfirst(ei_pmul(prod, (Packet4f)vec_sld(prod, prod, 4)));
+ prod = pmul(a, (Packet4f)vec_sld(a, a, 8));
+ return pfirst(pmul(prod, (Packet4f)vec_sld(prod, prod, 4)));
}
-template<> EIGEN_STRONG_INLINE int ei_predux_mul<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)
{
EIGEN_ALIGN16 int aux[4];
- ei_pstore(aux, a);
+ pstore(aux, a);
return aux[0] * aux[1] * aux[2] * aux[3];
}
// min
-template<> EIGEN_STRONG_INLINE float ei_predux_min<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)
{
Packet4f b, res;
b = vec_min(a, vec_sld(a, a, 8));
res = vec_min(b, vec_sld(b, b, 4));
- return ei_pfirst(res);
+ return pfirst(res);
}
-template<> EIGEN_STRONG_INLINE int ei_predux_min<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a)
{
Packet4i b, res;
b = vec_min(a, vec_sld(a, a, 8));
res = vec_min(b, vec_sld(b, b, 4));
- return ei_pfirst(res);
+ return pfirst(res);
}
// max
-template<> EIGEN_STRONG_INLINE float ei_predux_max<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)
{
Packet4f b, res;
b = vec_max(a, vec_sld(a, a, 8));
res = vec_max(b, vec_sld(b, b, 4));
- return ei_pfirst(res);
+ return pfirst(res);
}
-template<> EIGEN_STRONG_INLINE int ei_predux_max<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
{
Packet4i b, res;
b = vec_max(a, vec_sld(a, a, 8));
res = vec_max(b, vec_sld(b, b, 4));
- return ei_pfirst(res);
+ return pfirst(res);
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet4f>
+struct palign_impl<Offset,Packet4f>
{
EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
{
@@ -481,7 +483,7 @@ struct ei_palign_impl<Offset,Packet4f>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet4i>
+struct palign_impl<Offset,Packet4i>
{
EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
{
@@ -489,4 +491,7 @@ struct ei_palign_impl<Offset,Packet4i>
first = vec_sld(first, second, Offset*4);
}
};
+
+} // end namespace internal
+
#endif // EIGEN_PACKET_MATH_ALTIVEC_H
diff --git a/Eigen/src/Core/arch/NEON/Complex.h b/Eigen/src/Core/arch/NEON/Complex.h
index 9678040e7..d1943ba3b 100644
--- a/Eigen/src/Core/arch/NEON/Complex.h
+++ b/Eigen/src/Core/arch/NEON/Complex.h
@@ -22,11 +22,13 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
-#ifndef EIGEN_COMPLEX_ALTIVEC_H
-#define EIGEN_COMPLEX_ALTIVEC_H
+#ifndef EIGEN_COMPLEX_NEON_H
+#define EIGEN_COMPLEX_NEON_H
-static uint32x4_t ei_p4ui_CONJ_XOR = { 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
-static uint32x2_t ei_p2ui_CONJ_XOR = { 0x00000000, 0x80000000 };
+namespace internal {
+
+static uint32x4_t p4ui_CONJ_XOR = { 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
+static uint32x2_t p2ui_CONJ_XOR = { 0x00000000, 0x80000000 };
//---------- float ----------
struct Packet2cf
@@ -36,7 +38,7 @@ struct Packet2cf
Packet4f v;
};
-template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_traits
+template<> struct packet_traits<std::complex<float> > : default_packet_traits
{
typedef Packet2cf type;
enum {
@@ -56,9 +58,9 @@ template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_tr
};
};
-template<> struct ei_unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
+template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pset1<Packet2cf>(const std::complex<float>& from)
+template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
{
float32x2_t r64;
r64 = vld1_f32((float *)&from);
@@ -66,15 +68,15 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_pset1<Packet2cf>(const std::complex<
return Packet2cf(vcombine_f32(r64, r64));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(ei_padd<Packet4f>(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(ei_psub<Packet4f>(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pnegate(const Packet2cf& a) { return Packet2cf(ei_pnegate<Packet4f>(a.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pconj(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(padd<Packet4f>(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(psub<Packet4f>(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate<Packet4f>(a.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a)
{
- return Packet2cf(vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a.v), ei_p4ui_CONJ_XOR)));
+ return Packet2cf(vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a.v), p4ui_CONJ_XOR)));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
Packet4f v1, v2;
float32x2_t a_lo, a_hi;
@@ -88,7 +90,7 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_pmul<Packet2cf>(const Packet2cf& a,
// Multiply the imag a with b
v2 = vmulq_f32(v2, b.v);
// Conjugate v2
- v2 = vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(v2), ei_p4ui_CONJ_XOR));
+ v2 = vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(v2), p4ui_CONJ_XOR));
// Swap real/imag elements in v2.
a_lo = vrev64_f32(vget_low_f32(v2));
a_hi = vrev64_f32(vget_high_f32(v2));
@@ -97,39 +99,39 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_pmul<Packet2cf>(const Packet2cf& a,
return Packet2cf(vaddq_f32(v1, v2));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
return Packet2cf(vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_por <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
return Packet2cf(vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
return Packet2cf(vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
return Packet2cf(vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(a.v),vreinterpretq_u32_f32(b.v))));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pload <std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(ei_pload((const float*)from)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_ploadu<std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ei_ploadu((const float*)from)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pload <std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload((const float*)from)); }
+template<> EIGEN_STRONG_INLINE Packet2cf ploadu<std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu((const float*)from)); }
-template<> EIGEN_STRONG_INLINE void ei_pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE ei_pstore((float*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu((float*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<std::complex<float> >(const std::complex<float> * addr) { __pld((float *)addr); }
+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { __pld((float *)addr); }
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_pfirst<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
{
std::complex<float> EIGEN_ALIGN16 x[2];
vst1q_f32((float *)x, a.v);
return x[0];
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preverse(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)
{
float32x2_t a_lo, a_hi;
Packet4f a_r128;
@@ -141,12 +143,12 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_preverse(const Packet2cf& a)
return Packet2cf(a_r128);
}
-EIGEN_STRONG_INLINE Packet2cf ei_pcplxflip/*<Packet2cf>*/(const Packet2cf& x)
+EIGEN_STRONG_INLINE Packet2cf pcplxflip/*<Packet2cf>*/(const Packet2cf& x)
{
return Packet2cf(vrev64q_f32(a.v));
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)
{
float32x2_t a1, a2;
std::complex<float> s;
@@ -159,7 +161,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux<Packet2cf>(const Pa
return s;
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preduxp<Packet2cf>(const Packet2cf* vecs)
+template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
{
Packet4f sum1, sum2, sum;
@@ -171,7 +173,7 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_preduxp<Packet2cf>(const Packet2cf*
return Packet2cf(sum);
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux_mul<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)
{
float32x2_t a1, a2, v1, v2, prod;
std::complex<float> s;
@@ -187,7 +189,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux_mul<Packet2cf>(cons
// Multiply the imag a with b
v2 = vmul_f32(v2, a2);
// Conjugate v2
- v2 = vreinterpret_f32_u32(veor_u32(vreinterpret_u32_f32(v2), ei_p2ui_CONJ_XOR));
+ v2 = vreinterpret_f32_u32(veor_u32(vreinterpret_u32_f32(v2), p2ui_CONJ_XOR));
// Swap real/imag elements in v2.
v2 = vrev64_f32(v2);
// Add v1, v2
@@ -199,7 +201,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux_mul<Packet2cf>(cons
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet2cf>
+struct palign_impl<Offset,Packet2cf>
{
EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
{
@@ -210,43 +212,43 @@ struct ei_palign_impl<Offset,Packet2cf>
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, false,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pmul(a, ei_pconj(b));
+ return pmul(a, pconj(b));
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,false>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pmul(ei_pconj(a), b);
+ return pmul(pconj(a), b);
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
- return ei_pconj(ei_pmul(a, b));
+ return pconj(pmul(a, b));
}
};
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
// TODO optimize it for AltiVec
- Packet2cf res = ei_conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
+ Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
Packet4f s, rev_s;
float32x2_t a_lo, a_hi;
@@ -256,7 +258,9 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_pdiv<Packet2cf>(const Packet2cf& a,
a_hi = vrev64_f32(vget_high_f32(s));
rev_s = vcombine_f32(a_lo, a_hi);
- return Packet2cf(ei_pdiv(res.v, vaddq_f32(s,rev_s)));
+ return Packet2cf(pdiv(res.v, vaddq_f32(s,rev_s)));
}
-#endif // EIGEN_COMPLEX_ALTIVEC_H
+} // end namespace internal
+
+#endif // EIGEN_COMPLEX_NEON_H
diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h
index 8220ed07c..cae35d737 100644
--- a/Eigen/src/Core/arch/NEON/PacketMath.h
+++ b/Eigen/src/Core/arch/NEON/PacketMath.h
@@ -27,6 +27,8 @@
#ifndef EIGEN_PACKET_MATH_NEON_H
#define EIGEN_PACKET_MATH_NEON_H
+namespace internal {
+
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
#endif
@@ -45,19 +47,19 @@ typedef float32x4_t Packet4f;
typedef int32x4_t Packet4i;
#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
- const Packet4f ei_p4f_##NAME = ei_pset1<Packet4f>(X)
+ const Packet4f p4f_##NAME = pset1<Packet4f>(X)
#define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \
- const Packet4f ei_p4f_##NAME = vreinterpretq_f32_u32(ei_pset1<int>(X))
+ const Packet4f p4f_##NAME = vreinterpretq_f32_u32(pset1<int>(X))
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
- const Packet4i ei_p4i_##NAME = ei_pset1<Packet4i>(X)
+ const Packet4i p4i_##NAME = pset1<Packet4i>(X)
#ifndef __pld
#define __pld(x) asm volatile ( " pld [%[addr]]\n" :: [addr] "r" (x) : "cc" );
#endif
-template<> struct ei_packet_traits<float> : ei_default_packet_traits
+template<> struct packet_traits<float> : default_packet_traits
{
typedef Packet4f type;
enum {
@@ -74,7 +76,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
HasSqrt = 0
};
};
-template<> struct ei_packet_traits<int> : ei_default_packet_traits
+template<> struct packet_traits<int> : default_packet_traits
{
typedef Packet4i type;
enum {
@@ -85,36 +87,36 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
};
};
-template<> struct ei_unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
-template<> struct ei_unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
+template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
+template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
-template<> EIGEN_STRONG_INLINE Packet4f ei_pset1<Packet4f>(const float& from) { return vdupq_n_f32(from); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pset1<Packet4i>(const int& from) { return vdupq_n_s32(from); }
+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return vdupq_n_f32(from); }
+template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return vdupq_n_s32(from); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_plset<float>(const float& a)
+template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a)
{
Packet4f countdown = { 3, 2, 1, 0 };
- return vaddq_f32(ei_pset1<Packet4f>(a), countdown);
+ return vaddq_f32(pset1<Packet4f>(a), countdown);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_plset<int>(const int& a)
+template<> EIGEN_STRONG_INLINE Packet4i plset<int>(const int& a)
{
Packet4i countdown = { 3, 2, 1, 0 };
- return vaddq_s32(ei_pset1<Packet4i>(a), countdown);
+ return vaddq_s32(pset1<Packet4i>(a), countdown);
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return vaddq_f32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return vaddq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return vaddq_f32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return vaddq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return vsubq_f32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return vsubq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return vsubq_f32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return vsubq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pnegate(const Packet4f& a) { return vnegq_f32(a); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pnegate(const Packet4i& a) { return vnegq_s32(a); }
+template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a) { return vnegq_f32(a); }
+template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a) { return vnegq_s32(a); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return vmulq_f32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmul<Packet4i>(const Packet4i& a, const Packet4i& b) { return vmulq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return vmulq_f32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(const Packet4i& a, const Packet4i& b) { return vmulq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)
{
Packet4f inv, restep, div;
@@ -135,59 +137,59 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_pdiv<Packet4f>(const Packet4f& a, con
return div;
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
-{ ei_assert(false && "packet integer division are not supported by NEON");
- return ei_pset1<Packet4i>(0);
+template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
+{ eigen_assert(false && "packet integer division are not supported by NEON");
+ return pset1<Packet4i>(0);
}
// for some weird raisons, it has to be overloaded for packet of integers
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return ei_padd(ei_pmul(a,b), c); }
+template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd(pmul(a,b), c); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return vminq_f32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vminq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return vminq_f32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vminq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return vmaxq_f32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vmaxq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return vmaxq_f32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vmaxq_s32(a,b); }
// Logical Operations are not supported for float, so we have to reinterpret casts using NEON intrinsics
-template<> EIGEN_STRONG_INLINE Packet4f ei_pand<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b)
{
return vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vandq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vandq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_por<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b)
{
return vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vorrq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vorrq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pxor<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b)
{
return vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return veorq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return veorq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pandnot<Packet4f>(const Packet4f& a, const Packet4f& b)
+template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b)
{
return vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(a),vreinterpretq_u32_f32(b)));
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vbicq_s32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vbicq_s32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pload<float>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(from); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pload<int>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(from); }
+template<> EIGEN_STRONG_INLINE Packet4f pload<float>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(from); }
+template<> EIGEN_STRONG_INLINE Packet4i pload<int>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(from); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu(const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD return vld1q_f32(from); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD return vld1q_s32(from); }
+template<> EIGEN_STRONG_INLINE Packet4f ploadu(const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD return vld1q_f32(from); }
+template<> EIGEN_STRONG_INLINE Packet4i ploadu(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD return vld1q_s32(from); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_ploaddup<Packet4f>(const float* from)
+template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)
{
float32x2_t lo, ho;
lo = vdup_n_f32(*from);
hi = vdup_n_f32(*from);
return vcombine_f32(lo, hi);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_ploaddup<Packet4i>(const float* from)
+template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const float* from)
{
int32x2_t lo, ho;
lo = vdup_n_s32(*from);
@@ -195,20 +197,20 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_ploaddup<Packet4i>(const float* from)
return vcombine_s32(lo, hi);
}
-template<> EIGEN_STRONG_INLINE void ei_pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(to, from); }
+template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(to, from); }
+template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f32(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_s32(to, from); }
+template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f32(to, from); }
+template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_s32(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<float>(const float* addr) { __pld(addr); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<int>(const int* addr) { __pld(addr); }
+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { __pld(addr); }
+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { __pld(addr); }
// FIXME only store the 2 first elements ?
-template<> EIGEN_STRONG_INLINE float ei_pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vst1q_f32(x, a); return x[0]; }
-template<> EIGEN_STRONG_INLINE int ei_pfirst<Packet4i>(const Packet4i& a) { int EIGEN_ALIGN16 x[4]; vst1q_s32(x, a); return x[0]; }
+template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vst1q_f32(x, a); return x[0]; }
+template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int EIGEN_ALIGN16 x[4]; vst1q_s32(x, a); return x[0]; }
-template<> EIGEN_STRONG_INLINE Packet4f ei_preverse(const Packet4f& a) {
+template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a) {
float32x2_t a_lo, a_hi;
Packet4f a_r64;
@@ -217,7 +219,7 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_preverse(const Packet4f& a) {
a_hi = vget_high_f32(a_r64);
return vcombine_f32(a_hi, a_lo);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_preverse(const Packet4i& a) {
+template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a) {
int32x2_t a_lo, a_hi;
Packet4i a_r64;
@@ -226,10 +228,10 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_preverse(const Packet4i& a) {
a_hi = vget_high_s32(a_r64);
return vcombine_s32(a_hi, a_lo);
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_pabs(const Packet4f& a) { return vabsq_f32(a); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pabs(const Packet4i& a) { return vabsq_s32(a); }
+template<> EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f& a) { return vabsq_f32(a); }
+template<> EIGEN_STRONG_INLINE Packet4i pabs(const Packet4i& a) { return vabsq_s32(a); }
-template<> EIGEN_STRONG_INLINE float ei_predux<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
{
float32x2_t a_lo, a_hi, sum;
float s[2];
@@ -243,7 +245,7 @@ template<> EIGEN_STRONG_INLINE float ei_predux<Packet4f>(const Packet4f& a)
return s[0];
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vecs)
+template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
{
float32x4x2_t vtrn1, vtrn2, res1, res2;
Packet4f sum1, sum2, sum;
@@ -263,7 +265,7 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vec
return sum;
}
-template<> EIGEN_STRONG_INLINE int ei_predux<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a)
{
int32x2_t a_lo, a_hi, sum;
int32_t s[2];
@@ -277,7 +279,7 @@ template<> EIGEN_STRONG_INLINE int ei_predux<Packet4i>(const Packet4i& a)
return s[0];
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vecs)
+template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(const Packet4i* vecs)
{
int32x4x2_t vtrn1, vtrn2, res1, res2;
Packet4i sum1, sum2, sum;
@@ -299,7 +301,7 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vec
// Other reduction functions:
// mul
-template<> EIGEN_STRONG_INLINE float ei_predux_mul<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)
{
float32x2_t a_lo, a_hi, prod;
float s[2];
@@ -315,7 +317,7 @@ template<> EIGEN_STRONG_INLINE float ei_predux_mul<Packet4f>(const Packet4f& a)
return s[0];
}
-template<> EIGEN_STRONG_INLINE int ei_predux_mul<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)
{
int32x2_t a_lo, a_hi, prod;
int32_t s[2];
@@ -333,7 +335,7 @@ template<> EIGEN_STRONG_INLINE int ei_predux_mul<Packet4i>(const Packet4i& a)
}
// min
-template<> EIGEN_STRONG_INLINE float ei_predux_min<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)
{
float32x2_t a_lo, a_hi, min;
float s[2];
@@ -346,7 +348,7 @@ template<> EIGEN_STRONG_INLINE float ei_predux_min<Packet4f>(const Packet4f& a)
return s[0];
}
-template<> EIGEN_STRONG_INLINE int ei_predux_min<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a)
{
int32x2_t a_lo, a_hi, min;
int32_t s[2];
@@ -361,7 +363,7 @@ template<> EIGEN_STRONG_INLINE int ei_predux_min<Packet4i>(const Packet4i& a)
}
// max
-template<> EIGEN_STRONG_INLINE float ei_predux_max<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)
{
float32x2_t a_lo, a_hi, max;
float s[2];
@@ -374,7 +376,7 @@ template<> EIGEN_STRONG_INLINE float ei_predux_max<Packet4f>(const Packet4f& a)
return s[0];
}
-template<> EIGEN_STRONG_INLINE int ei_predux_max<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
{
int32x2_t a_lo, a_hi, max;
int32_t s[2];
@@ -389,7 +391,7 @@ template<> EIGEN_STRONG_INLINE int ei_predux_max<Packet4i>(const Packet4i& a)
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet4f>
+struct palign_impl<Offset,Packet4f>
{
EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
{
@@ -399,7 +401,7 @@ struct ei_palign_impl<Offset,Packet4f>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet4i>
+struct palign_impl<Offset,Packet4i>
{
EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
{
@@ -407,4 +409,7 @@ struct ei_palign_impl<Offset,Packet4i>
first = vextq_s32(first, second, Offset);
}
};
+
+} // end namespace internal
+
#endif // EIGEN_PACKET_MATH_NEON_H
diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h
index 819d59364..cc686fc84 100644
--- a/Eigen/src/Core/arch/SSE/Complex.h
+++ b/Eigen/src/Core/arch/SSE/Complex.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_COMPLEX_SSE_H
#define EIGEN_COMPLEX_SSE_H
+namespace internal {
+
//---------- float ----------
struct Packet2cf
{
@@ -33,7 +35,7 @@ struct Packet2cf
__m128 v;
};
-template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_traits
+template<> struct packet_traits<std::complex<float> > : default_packet_traits
{
typedef Packet2cf type;
enum {
@@ -54,85 +56,85 @@ template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_tr
};
};
-template<> struct ei_unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
+template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2}; };
-template<> EIGEN_STRONG_INLINE Packet2cf ei_padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_add_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_sub_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pnegate(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_add_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_sub_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a)
{
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x80000000,0x80000000,0x80000000));
return Packet2cf(_mm_xor_ps(a.v,mask));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pconj(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a)
{
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000));
return Packet2cf(_mm_xor_ps(a.v,mask));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
// TODO optimize it for SSE3 and 4
#ifdef EIGEN_VECTORIZE_SSE3
return Packet2cf(_mm_addsub_ps(_mm_mul_ps(_mm_moveldup_ps(a.v), b.v),
_mm_mul_ps(_mm_movehdup_ps(a.v),
- ei_vec4f_swizzle1(b.v, 1, 0, 3, 2))));
-// return Packet2cf(_mm_addsub_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
-// _mm_mul_ps(ei_vec4f_swizzle1(a.v, 1, 1, 3, 3),
-// ei_vec4f_swizzle1(b.v, 1, 0, 3, 2))));
+ vec4f_swizzle1(b.v, 1, 0, 3, 2))));
+// return Packet2cf(_mm_addsub_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
+// _mm_mul_ps(vec4f_swizzle1(a.v, 1, 1, 3, 3),
+// vec4f_swizzle1(b.v, 1, 0, 3, 2))));
#else
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x00000000,0x80000000,0x00000000));
- return Packet2cf(_mm_add_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
- _mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 1, 1, 3, 3),
- ei_vec4f_swizzle1(b.v, 1, 0, 3, 2)), mask)));
+ return Packet2cf(_mm_add_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
+ _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 1, 1, 3, 3),
+ vec4f_swizzle1(b.v, 1, 0, 3, 2)), mask)));
#endif
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_and_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_or_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_xor_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_andnot_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_and_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_or_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_xor_ps(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(_mm_andnot_ps(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pload <Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(ei_pload<Packet4f>(&ei_real_ref(*from))); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ei_ploadu<Packet4f>(&ei_real_ref(*from))); }
+template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>(&real_ref(*from))); }
+template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>(&real_ref(*from))); }
-template<> EIGEN_STRONG_INLINE void ei_pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE ei_pstore(&ei_real_ref(*to), from.v); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu(&ei_real_ref(*to), from.v); }
+template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore(&real_ref(*to), from.v); }
+template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(&real_ref(*to), from.v); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<std::complex<float> >(const std::complex<float> * addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pset1<Packet2cf>(const std::complex<float>& from)
+template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
{
Packet2cf res;
res.v = _mm_loadl_pi(res.v, (const __m64*)&from);
return Packet2cf(_mm_movelh_ps(res.v,res.v));
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_pfirst<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
{
std::complex<float> res;
_mm_storel_pi((__m64*)&res, a.v);
return res;
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preverse(const Packet2cf& a) { return Packet2cf(_mm_castpd_ps(ei_preverse(_mm_castps_pd(a.v)))); }
+template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a) { return Packet2cf(_mm_castpd_ps(preverse(_mm_castps_pd(a.v)))); }
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)
{
- return ei_pfirst(Packet2cf(_mm_add_ps(a.v, _mm_movehl_ps(a.v,a.v))));
+ return pfirst(Packet2cf(_mm_add_ps(a.v, _mm_movehl_ps(a.v,a.v))));
}
-template<> EIGEN_STRONG_INLINE Packet2cf ei_preduxp<Packet2cf>(const Packet2cf* vecs)
+template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
{
return Packet2cf(_mm_add_ps(_mm_movelh_ps(vecs[0].v,vecs[1].v), _mm_movehl_ps(vecs[1].v,vecs[0].v)));
}
-template<> EIGEN_STRONG_INLINE std::complex<float> ei_predux_mul<Packet2cf>(const Packet2cf& a)
+template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)
{
- return ei_pfirst(ei_pmul(a, Packet2cf(_mm_movehl_ps(a.v,a.v))));
+ return pfirst(pmul(a, Packet2cf(_mm_movehl_ps(a.v,a.v))));
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet2cf>
+struct palign_impl<Offset,Packet2cf>
{
EIGEN_STRONG_INLINE static void run(Packet2cf& first, const Packet2cf& second)
{
@@ -144,89 +146,89 @@ struct ei_palign_impl<Offset,Packet2cf>
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, false,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pmul(a, ei_pconj(b));
+ return pmul(a, pconj(b));
#else
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000));
- return Packet2cf(_mm_add_ps(_mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v), mask),
- _mm_mul_ps(ei_vec4f_swizzle1(a.v, 1, 1, 3, 3),
- ei_vec4f_swizzle1(b.v, 1, 0, 3, 2))));
+ return Packet2cf(_mm_add_ps(_mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v), mask),
+ _mm_mul_ps(vec4f_swizzle1(a.v, 1, 1, 3, 3),
+ vec4f_swizzle1(b.v, 1, 0, 3, 2))));
#endif
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,false>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pmul(ei_pconj(a), b);
+ return pmul(pconj(a), b);
#else
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000));
- return Packet2cf(_mm_add_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
- _mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 1, 1, 3, 3),
- ei_vec4f_swizzle1(b.v, 1, 0, 3, 2)), mask)));
+ return Packet2cf(_mm_add_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v),
+ _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 1, 1, 3, 3),
+ vec4f_swizzle1(b.v, 1, 0, 3, 2)), mask)));
#endif
}
};
-template<> struct ei_conj_helper<Packet2cf, Packet2cf, true,true>
+template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pconj(ei_pmul(a, b));
+ return pconj(pmul(a, b));
#else
const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0x00000000,0x80000000,0x00000000,0x80000000));
- return Packet2cf(_mm_sub_ps(_mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v), mask),
- _mm_mul_ps(ei_vec4f_swizzle1(a.v, 1, 1, 3, 3),
- ei_vec4f_swizzle1(b.v, 1, 0, 3, 2))));
+ return Packet2cf(_mm_sub_ps(_mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a.v, 0, 0, 2, 2), b.v), mask),
+ _mm_mul_ps(vec4f_swizzle1(a.v, 1, 1, 3, 3),
+ vec4f_swizzle1(b.v, 1, 0, 3, 2))));
#endif
}
};
-template<> struct ei_conj_helper<Packet4f, Packet2cf, false,false>
+template<> struct conj_helper<Packet4f, Packet2cf, false,false>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet4f& x, const Packet2cf& y, const Packet2cf& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet4f& x, const Packet2cf& y) const
- { return Packet2cf(ei_pmul(x, y.v)); }
+ { return Packet2cf(Eigen::internal::pmul(x, y.v)); }
};
-template<> struct ei_conj_helper<Packet2cf, Packet4f, false,false>
+template<> struct conj_helper<Packet2cf, Packet4f, false,false>
{
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet4f& y, const Packet2cf& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& x, const Packet4f& y) const
- { return Packet2cf(ei_pmul(x.v, y)); }
+ { return Packet2cf(Eigen::internal::pmul(x.v, y)); }
};
-template<> EIGEN_STRONG_INLINE Packet2cf ei_pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
+template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
{
// TODO optimize it for SSE3 and 4
- Packet2cf res = ei_conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
+ Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a,b);
__m128 s = _mm_mul_ps(b.v,b.v);
return Packet2cf(_mm_div_ps(res.v,_mm_add_ps(s,_mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(s), 0xb1)))));
}
-EIGEN_STRONG_INLINE Packet2cf ei_pcplxflip/*<Packet2cf>*/(const Packet2cf& x)
+EIGEN_STRONG_INLINE Packet2cf pcplxflip/*<Packet2cf>*/(const Packet2cf& x)
{
- return Packet2cf(ei_vec4f_swizzle1(x.v, 1, 0, 3, 2));
+ return Packet2cf(vec4f_swizzle1(x.v, 1, 0, 3, 2));
}
@@ -238,7 +240,7 @@ struct Packet1cd
__m128d v;
};
-template<> struct ei_packet_traits<std::complex<double> > : ei_default_packet_traits
+template<> struct packet_traits<std::complex<double> > : default_packet_traits
{
typedef Packet1cd type;
enum {
@@ -259,77 +261,77 @@ template<> struct ei_packet_traits<std::complex<double> > : ei_default_packet_t
};
};
-template<> struct ei_unpacket_traits<Packet1cd> { typedef std::complex<double> type; enum {size=1}; };
+template<> struct unpacket_traits<Packet1cd> { typedef std::complex<double> type; enum {size=1}; };
-template<> EIGEN_STRONG_INLINE Packet1cd ei_padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_add_pd(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_sub_pd(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pnegate(const Packet1cd& a) { return Packet1cd(ei_pnegate(a.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pconj(const Packet1cd& a)
+template<> EIGEN_STRONG_INLINE Packet1cd padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_add_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_sub_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pnegate(const Packet1cd& a) { return Packet1cd(pnegate(a.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pconj(const Packet1cd& a)
{
const __m128d mask = _mm_castsi128_pd(_mm_set_epi32(0x80000000,0x0,0x0,0x0));
return Packet1cd(_mm_xor_pd(a.v,mask));
}
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
+template<> EIGEN_STRONG_INLINE Packet1cd pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
{
// TODO optimize it for SSE3 and 4
#ifdef EIGEN_VECTORIZE_SSE3
- return Packet1cd(_mm_addsub_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 0, 0), b.v),
- _mm_mul_pd(ei_vec2d_swizzle1(a.v, 1, 1),
- ei_vec2d_swizzle1(b.v, 1, 0))));
+ return Packet1cd(_mm_addsub_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 0, 0), b.v),
+ _mm_mul_pd(vec2d_swizzle1(a.v, 1, 1),
+ vec2d_swizzle1(b.v, 1, 0))));
#else
const __m128d mask = _mm_castsi128_pd(_mm_set_epi32(0x0,0x0,0x80000000,0x0));
- return Packet1cd(_mm_add_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 0, 0), b.v),
- _mm_xor_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 1, 1),
- ei_vec2d_swizzle1(b.v, 1, 0)), mask)));
+ return Packet1cd(_mm_add_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 0, 0), b.v),
+ _mm_xor_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 1, 1),
+ vec2d_swizzle1(b.v, 1, 0)), mask)));
#endif
}
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pand <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_and_pd(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_por <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_or_pd(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pxor <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_xor_pd(a.v,b.v)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_andnot_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pand <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_and_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd por <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_or_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pxor <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_xor_pd(a.v,b.v)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(_mm_andnot_pd(a.v,b.v)); }
// FIXME force unaligned load, this is a temporary fix
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pload <Packet1cd>(const std::complex<double>* from)
-{ EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(ei_pload<Packet2d>((const double*)from)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_ploadu<Packet1cd>(const std::complex<double>* from)
-{ EIGEN_DEBUG_UNALIGNED_LOAD return Packet1cd(ei_ploadu<Packet2d>((const double*)from)); }
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pset1<Packet1cd>(const std::complex<double>& from)
-{ /* here we really have to use unaligned loads :( */ return ei_ploadu<Packet1cd>(&from); }
+template<> EIGEN_STRONG_INLINE Packet1cd pload <Packet1cd>(const std::complex<double>* from)
+{ EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>((const double*)from)); }
+template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<double>* from)
+{ EIGEN_DEBUG_UNALIGNED_LOAD return Packet1cd(ploadu<Packet2d>((const double*)from)); }
+template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>& from)
+{ /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); }
// FIXME force unaligned store, this is a temporary fix
-template<> EIGEN_STRONG_INLINE void ei_pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE ei_pstore((double*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu((double*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((double*)to, from.v); }
+template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, from.v); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<std::complex<double> >(const std::complex<double> * addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> * addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-template<> EIGEN_STRONG_INLINE std::complex<double> ei_pfirst<Packet1cd>(const Packet1cd& a)
+template<> EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a)
{
EIGEN_ALIGN16 double res[2];
_mm_store_pd(res, a.v);
return std::complex<double>(res[0],res[1]);
}
-template<> EIGEN_STRONG_INLINE Packet1cd ei_preverse(const Packet1cd& a) { return a; }
+template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; }
-template<> EIGEN_STRONG_INLINE std::complex<double> ei_predux<Packet1cd>(const Packet1cd& a)
+template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a)
{
- return ei_pfirst(a);
+ return pfirst(a);
}
-template<> EIGEN_STRONG_INLINE Packet1cd ei_preduxp<Packet1cd>(const Packet1cd* vecs)
+template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs)
{
return vecs[0];
}
-template<> EIGEN_STRONG_INLINE std::complex<double> ei_predux_mul<Packet1cd>(const Packet1cd& a)
+template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a)
{
- return ei_pfirst(a);
+ return pfirst(a);
}
template<int Offset>
-struct ei_palign_impl<Offset,Packet1cd>
+struct palign_impl<Offset,Packet1cd>
{
EIGEN_STRONG_INLINE static void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)
{
@@ -338,89 +340,91 @@ struct ei_palign_impl<Offset,Packet1cd>
}
};
-template<> struct ei_conj_helper<Packet1cd, Packet1cd, false,true>
+template<> struct conj_helper<Packet1cd, Packet1cd, false,true>
{
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pmul(a, ei_pconj(b));
+ return pmul(a, pconj(b));
#else
const __m128d mask = _mm_castsi128_pd(_mm_set_epi32(0x80000000,0x0,0x0,0x0));
- return Packet1cd(_mm_add_pd(_mm_xor_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 0, 0), b.v), mask),
- _mm_mul_pd(ei_vec2d_swizzle1(a.v, 1, 1),
- ei_vec2d_swizzle1(b.v, 1, 0))));
+ return Packet1cd(_mm_add_pd(_mm_xor_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 0, 0), b.v), mask),
+ _mm_mul_pd(vec2d_swizzle1(a.v, 1, 1),
+ vec2d_swizzle1(b.v, 1, 0))));
#endif
}
};
-template<> struct ei_conj_helper<Packet1cd, Packet1cd, true,false>
+template<> struct conj_helper<Packet1cd, Packet1cd, true,false>
{
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pmul(ei_pconj(a), b);
+ return pmul(pconj(a), b);
#else
const __m128d mask = _mm_castsi128_pd(_mm_set_epi32(0x80000000,0x0,0x0,0x0));
- return Packet1cd(_mm_add_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 0, 0), b.v),
- _mm_xor_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 1, 1),
- ei_vec2d_swizzle1(b.v, 1, 0)), mask)));
+ return Packet1cd(_mm_add_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 0, 0), b.v),
+ _mm_xor_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 1, 1),
+ vec2d_swizzle1(b.v, 1, 0)), mask)));
#endif
}
};
-template<> struct ei_conj_helper<Packet1cd, Packet1cd, true,true>
+template<> struct conj_helper<Packet1cd, Packet1cd, true,true>
{
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
- { return ei_padd(pmul(x,y),c); }
+ { return padd(pmul(x,y),c); }
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
{
#ifdef EIGEN_VECTORIZE_SSE3
- return ei_pconj(ei_pmul(a, b));
+ return pconj(pmul(a, b));
#else
const __m128d mask = _mm_castsi128_pd(_mm_set_epi32(0x80000000,0x0,0x0,0x0));
- return Packet1cd(_mm_sub_pd(_mm_xor_pd(_mm_mul_pd(ei_vec2d_swizzle1(a.v, 0, 0), b.v), mask),
- _mm_mul_pd(ei_vec2d_swizzle1(a.v, 1, 1),
- ei_vec2d_swizzle1(b.v, 1, 0))));
+ return Packet1cd(_mm_sub_pd(_mm_xor_pd(_mm_mul_pd(vec2d_swizzle1(a.v, 0, 0), b.v), mask),
+ _mm_mul_pd(vec2d_swizzle1(a.v, 1, 1),
+ vec2d_swizzle1(b.v, 1, 0))));
#endif
}
};
-template<> struct ei_conj_helper<Packet2d, Packet1cd, false,false>
+template<> struct conj_helper<Packet2d, Packet1cd, false,false>
{
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet2d& x, const Packet1cd& y, const Packet1cd& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet2d& x, const Packet1cd& y) const
- { return Packet1cd(ei_pmul(x, y.v)); }
+ { return Packet1cd(Eigen::internal::pmul(x, y.v)); }
};
-template<> struct ei_conj_helper<Packet1cd, Packet2d, false,false>
+template<> struct conj_helper<Packet1cd, Packet2d, false,false>
{
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet2d& y, const Packet1cd& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& x, const Packet2d& y) const
- { return Packet1cd(ei_pmul(x.v, y)); }
+ { return Packet1cd(Eigen::internal::pmul(x.v, y)); }
};
-template<> EIGEN_STRONG_INLINE Packet1cd ei_pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
+template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
{
// TODO optimize it for SSE3 and 4
- Packet1cd res = ei_conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);
+ Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);
__m128d s = _mm_mul_pd(b.v,b.v);
return Packet1cd(_mm_div_pd(res.v, _mm_add_pd(s,_mm_shuffle_pd(s, s, 0x1))));
}
-EIGEN_STRONG_INLINE Packet1cd ei_pcplxflip/*<Packet1cd>*/(const Packet1cd& x)
+EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x)
{
- return Packet1cd(ei_preverse(x.v));
+ return Packet1cd(preverse(x.v));
}
+} // end namespace internal
+
#endif // EIGEN_COMPLEX_SSE_H
diff --git a/Eigen/src/Core/arch/SSE/MathFunctions.h b/Eigen/src/Core/arch/SSE/MathFunctions.h
index cb73fd205..9d56d8218 100644
--- a/Eigen/src/Core/arch/SSE/MathFunctions.h
+++ b/Eigen/src/Core/arch/SSE/MathFunctions.h
@@ -30,8 +30,10 @@
#ifndef EIGEN_MATH_FUNCTIONS_SSE_H
#define EIGEN_MATH_FUNCTIONS_SSE_H
+namespace internal {
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
-Packet4f ei_plog<Packet4f>(const Packet4f& _x)
+Packet4f plog<Packet4f>(const Packet4f& _x)
{
Packet4f x = _x;
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
@@ -64,15 +66,15 @@ Packet4f ei_plog<Packet4f>(const Packet4f& _x)
Packet4f invalid_mask = _mm_cmple_ps(x, _mm_setzero_ps());
- x = ei_pmax(x, ei_p4f_min_norm_pos); /* cut off denormalized stuff */
+ x = pmax(x, p4f_min_norm_pos); /* cut off denormalized stuff */
emm0 = _mm_srli_epi32(_mm_castps_si128(x), 23);
/* keep only the fractional part */
- x = _mm_and_ps(x, ei_p4f_inv_mant_mask);
- x = _mm_or_ps(x, ei_p4f_half);
+ x = _mm_and_ps(x, p4f_inv_mant_mask);
+ x = _mm_or_ps(x, p4f_half);
- emm0 = _mm_sub_epi32(emm0, ei_p4i_0x7f);
- Packet4f e = ei_padd(_mm_cvtepi32_ps(emm0), ei_p4f_1);
+ emm0 = _mm_sub_epi32(emm0, p4i_0x7f);
+ Packet4f e = padd(_mm_cvtepi32_ps(emm0), p4f_1);
/* part2:
if( x < SQRTHF ) {
@@ -80,38 +82,38 @@ Packet4f ei_plog<Packet4f>(const Packet4f& _x)
x = x + x - 1.0;
} else { x = x - 1.0; }
*/
- Packet4f mask = _mm_cmplt_ps(x, ei_p4f_cephes_SQRTHF);
+ Packet4f mask = _mm_cmplt_ps(x, p4f_cephes_SQRTHF);
Packet4f tmp = _mm_and_ps(x, mask);
- x = ei_psub(x, ei_p4f_1);
- e = ei_psub(e, _mm_and_ps(ei_p4f_1, mask));
- x = ei_padd(x, tmp);
+ x = psub(x, p4f_1);
+ e = psub(e, _mm_and_ps(p4f_1, mask));
+ x = padd(x, tmp);
- Packet4f x2 = ei_pmul(x,x);
- Packet4f x3 = ei_pmul(x2,x);
+ Packet4f x2 = pmul(x,x);
+ Packet4f x3 = pmul(x2,x);
Packet4f y, y1, y2;
- y = ei_pmadd(ei_p4f_cephes_log_p0, x, ei_p4f_cephes_log_p1);
- y1 = ei_pmadd(ei_p4f_cephes_log_p3, x, ei_p4f_cephes_log_p4);
- y2 = ei_pmadd(ei_p4f_cephes_log_p6, x, ei_p4f_cephes_log_p7);
- y = ei_pmadd(y , x, ei_p4f_cephes_log_p2);
- y1 = ei_pmadd(y1, x, ei_p4f_cephes_log_p5);
- y2 = ei_pmadd(y2, x, ei_p4f_cephes_log_p8);
- y = ei_pmadd(y, x3, y1);
- y = ei_pmadd(y, x3, y2);
- y = ei_pmul(y, x3);
-
- y1 = ei_pmul(e, ei_p4f_cephes_log_q1);
- tmp = ei_pmul(x2, ei_p4f_half);
- y = ei_padd(y, y1);
- x = ei_psub(x, tmp);
- y2 = ei_pmul(e, ei_p4f_cephes_log_q2);
- x = ei_padd(x, y);
- x = ei_padd(x, y2);
+ y = pmadd(p4f_cephes_log_p0, x, p4f_cephes_log_p1);
+ y1 = pmadd(p4f_cephes_log_p3, x, p4f_cephes_log_p4);
+ y2 = pmadd(p4f_cephes_log_p6, x, p4f_cephes_log_p7);
+ y = pmadd(y , x, p4f_cephes_log_p2);
+ y1 = pmadd(y1, x, p4f_cephes_log_p5);
+ y2 = pmadd(y2, x, p4f_cephes_log_p8);
+ y = pmadd(y, x3, y1);
+ y = pmadd(y, x3, y2);
+ y = pmul(y, x3);
+
+ y1 = pmul(e, p4f_cephes_log_q1);
+ tmp = pmul(x2, p4f_half);
+ y = padd(y, y1);
+ x = psub(x, tmp);
+ y2 = pmul(e, p4f_cephes_log_q2);
+ x = padd(x, y);
+ x = padd(x, y2);
return _mm_or_ps(x, invalid_mask); // negative arg will be NAN
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
-Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
+Packet4f pexp<Packet4f>(const Packet4f& _x)
{
Packet4f x = _x;
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
@@ -137,40 +139,40 @@ Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
Packet4i emm0;
// clamp x
- x = ei_pmax(ei_pmin(x, ei_p4f_exp_hi), ei_p4f_exp_lo);
+ x = pmax(pmin(x, p4f_exp_hi), p4f_exp_lo);
/* express exp(x) as exp(g + n*log(2)) */
- fx = ei_pmadd(x, ei_p4f_cephes_LOG2EF, ei_p4f_half);
+ fx = pmadd(x, p4f_cephes_LOG2EF, p4f_half);
/* how to perform a floorf with SSE: just below */
emm0 = _mm_cvttps_epi32(fx);
tmp = _mm_cvtepi32_ps(emm0);
/* if greater, substract 1 */
Packet4f mask = _mm_cmpgt_ps(tmp, fx);
- mask = _mm_and_ps(mask, ei_p4f_1);
- fx = ei_psub(tmp, mask);
+ mask = _mm_and_ps(mask, p4f_1);
+ fx = psub(tmp, mask);
- tmp = ei_pmul(fx, ei_p4f_cephes_exp_C1);
- Packet4f z = ei_pmul(fx, ei_p4f_cephes_exp_C2);
- x = ei_psub(x, tmp);
- x = ei_psub(x, z);
+ tmp = pmul(fx, p4f_cephes_exp_C1);
+ Packet4f z = pmul(fx, p4f_cephes_exp_C2);
+ x = psub(x, tmp);
+ x = psub(x, z);
- z = ei_pmul(x,x);
+ z = pmul(x,x);
- Packet4f y = ei_p4f_cephes_exp_p0;
- y = ei_pmadd(y, x, ei_p4f_cephes_exp_p1);
- y = ei_pmadd(y, x, ei_p4f_cephes_exp_p2);
- y = ei_pmadd(y, x, ei_p4f_cephes_exp_p3);
- y = ei_pmadd(y, x, ei_p4f_cephes_exp_p4);
- y = ei_pmadd(y, x, ei_p4f_cephes_exp_p5);
- y = ei_pmadd(y, z, x);
- y = ei_padd(y, ei_p4f_1);
+ Packet4f y = p4f_cephes_exp_p0;
+ y = pmadd(y, x, p4f_cephes_exp_p1);
+ y = pmadd(y, x, p4f_cephes_exp_p2);
+ y = pmadd(y, x, p4f_cephes_exp_p3);
+ y = pmadd(y, x, p4f_cephes_exp_p4);
+ y = pmadd(y, x, p4f_cephes_exp_p5);
+ y = pmadd(y, z, x);
+ y = padd(y, p4f_1);
/* build 2^n */
emm0 = _mm_cvttps_epi32(fx);
- emm0 = _mm_add_epi32(emm0, ei_p4i_0x7f);
+ emm0 = _mm_add_epi32(emm0, p4i_0x7f);
emm0 = _mm_slli_epi32(emm0, 23);
- return ei_pmul(y, _mm_castsi128_ps(emm0));
+ return pmul(y, _mm_castsi128_ps(emm0));
}
/* evaluation of 4 sines at onces, using SSE2 intrinsics.
@@ -186,7 +188,7 @@ Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
*/
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
-Packet4f ei_psin<Packet4f>(const Packet4f& _x)
+Packet4f psin<Packet4f>(const Packet4f& _x)
{
Packet4f x = _x;
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
@@ -215,24 +217,24 @@ Packet4f ei_psin<Packet4f>(const Packet4f& _x)
Packet4i emm0, emm2;
sign_bit = x;
/* take the absolute value */
- x = ei_pabs(x);
+ x = pabs(x);
/* take the modulo */
/* extract the sign bit (upper one) */
- sign_bit = _mm_and_ps(sign_bit, ei_p4f_sign_mask);
+ sign_bit = _mm_and_ps(sign_bit, p4f_sign_mask);
/* scale by 4/Pi */
- y = ei_pmul(x, ei_p4f_cephes_FOPI);
+ y = pmul(x, p4f_cephes_FOPI);
/* store the integer part of y in mm0 */
emm2 = _mm_cvttps_epi32(y);
/* j=(j+1) & (~1) (see the cephes sources) */
- emm2 = _mm_add_epi32(emm2, ei_p4i_1);
- emm2 = _mm_and_si128(emm2, ei_p4i_not1);
+ emm2 = _mm_add_epi32(emm2, p4i_1);
+ emm2 = _mm_and_si128(emm2, p4i_not1);
y = _mm_cvtepi32_ps(emm2);
/* get the swap sign flag */
- emm0 = _mm_and_si128(emm2, ei_p4i_4);
+ emm0 = _mm_and_si128(emm2, p4i_4);
emm0 = _mm_slli_epi32(emm0, 29);
/* get the polynom selection mask
there is one polynom for 0 <= x <= Pi/4
@@ -240,7 +242,7 @@ Packet4f ei_psin<Packet4f>(const Packet4f& _x)
Both branches will be computed.
*/
- emm2 = _mm_and_si128(emm2, ei_p4i_2);
+ emm2 = _mm_and_si128(emm2, p4i_2);
emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());
Packet4f swap_sign_bit = _mm_castsi128_ps(emm0);
@@ -249,33 +251,33 @@ Packet4f ei_psin<Packet4f>(const Packet4f& _x)
/* The magic pass: "Extended precision modular arithmetic"
x = ((x - y * DP1) - y * DP2) - y * DP3; */
- xmm1 = ei_pmul(y, ei_p4f_minus_cephes_DP1);
- xmm2 = ei_pmul(y, ei_p4f_minus_cephes_DP2);
- xmm3 = ei_pmul(y, ei_p4f_minus_cephes_DP3);
- x = ei_padd(x, xmm1);
- x = ei_padd(x, xmm2);
- x = ei_padd(x, xmm3);
+ xmm1 = pmul(y, p4f_minus_cephes_DP1);
+ xmm2 = pmul(y, p4f_minus_cephes_DP2);
+ xmm3 = pmul(y, p4f_minus_cephes_DP3);
+ x = padd(x, xmm1);
+ x = padd(x, xmm2);
+ x = padd(x, xmm3);
/* Evaluate the first polynom (0 <= x <= Pi/4) */
- y = ei_p4f_coscof_p0;
+ y = p4f_coscof_p0;
Packet4f z = _mm_mul_ps(x,x);
- y = ei_pmadd(y, z, ei_p4f_coscof_p1);
- y = ei_pmadd(y, z, ei_p4f_coscof_p2);
- y = ei_pmul(y, z);
- y = ei_pmul(y, z);
- Packet4f tmp = ei_pmul(z, ei_p4f_half);
- y = ei_psub(y, tmp);
- y = ei_padd(y, ei_p4f_1);
+ y = pmadd(y, z, p4f_coscof_p1);
+ y = pmadd(y, z, p4f_coscof_p2);
+ y = pmul(y, z);
+ y = pmul(y, z);
+ Packet4f tmp = pmul(z, p4f_half);
+ y = psub(y, tmp);
+ y = padd(y, p4f_1);
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
- Packet4f y2 = ei_p4f_sincof_p0;
- y2 = ei_pmadd(y2, z, ei_p4f_sincof_p1);
- y2 = ei_pmadd(y2, z, ei_p4f_sincof_p2);
- y2 = ei_pmul(y2, z);
- y2 = ei_pmul(y2, x);
- y2 = ei_padd(y2, x);
+ Packet4f y2 = p4f_sincof_p0;
+ y2 = pmadd(y2, z, p4f_sincof_p1);
+ y2 = pmadd(y2, z, p4f_sincof_p2);
+ y2 = pmul(y2, z);
+ y2 = pmul(y2, x);
+ y2 = padd(y2, x);
/* select the correct result from the two polynoms */
y2 = _mm_and_ps(poly_mask, y2);
@@ -285,9 +287,9 @@ Packet4f ei_psin<Packet4f>(const Packet4f& _x)
return _mm_xor_ps(y, sign_bit);
}
-/* almost the same as ei_psin */
+/* almost the same as psin */
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
-Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
+Packet4f pcos<Packet4f>(const Packet4f& _x)
{
Packet4f x = _x;
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
@@ -312,25 +314,25 @@ Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
Packet4f xmm1, xmm2 = _mm_setzero_ps(), xmm3, y;
Packet4i emm0, emm2;
- x = ei_pabs(x);
+ x = pabs(x);
/* scale by 4/Pi */
- y = ei_pmul(x, ei_p4f_cephes_FOPI);
+ y = pmul(x, p4f_cephes_FOPI);
/* get the integer part of y */
emm2 = _mm_cvttps_epi32(y);
/* j=(j+1) & (~1) (see the cephes sources) */
- emm2 = _mm_add_epi32(emm2, ei_p4i_1);
- emm2 = _mm_and_si128(emm2, ei_p4i_not1);
+ emm2 = _mm_add_epi32(emm2, p4i_1);
+ emm2 = _mm_and_si128(emm2, p4i_not1);
y = _mm_cvtepi32_ps(emm2);
- emm2 = _mm_sub_epi32(emm2, ei_p4i_2);
+ emm2 = _mm_sub_epi32(emm2, p4i_2);
/* get the swap sign flag */
- emm0 = _mm_andnot_si128(emm2, ei_p4i_4);
+ emm0 = _mm_andnot_si128(emm2, p4i_4);
emm0 = _mm_slli_epi32(emm0, 29);
/* get the polynom selection mask */
- emm2 = _mm_and_si128(emm2, ei_p4i_2);
+ emm2 = _mm_and_si128(emm2, p4i_2);
emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());
Packet4f sign_bit = _mm_castsi128_ps(emm0);
@@ -338,31 +340,31 @@ Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
/* The magic pass: "Extended precision modular arithmetic"
x = ((x - y * DP1) - y * DP2) - y * DP3; */
- xmm1 = ei_pmul(y, ei_p4f_minus_cephes_DP1);
- xmm2 = ei_pmul(y, ei_p4f_minus_cephes_DP2);
- xmm3 = ei_pmul(y, ei_p4f_minus_cephes_DP3);
- x = ei_padd(x, xmm1);
- x = ei_padd(x, xmm2);
- x = ei_padd(x, xmm3);
+ xmm1 = pmul(y, p4f_minus_cephes_DP1);
+ xmm2 = pmul(y, p4f_minus_cephes_DP2);
+ xmm3 = pmul(y, p4f_minus_cephes_DP3);
+ x = padd(x, xmm1);
+ x = padd(x, xmm2);
+ x = padd(x, xmm3);
/* Evaluate the first polynom (0 <= x <= Pi/4) */
- y = ei_p4f_coscof_p0;
- Packet4f z = ei_pmul(x,x);
+ y = p4f_coscof_p0;
+ Packet4f z = pmul(x,x);
- y = ei_pmadd(y,z,ei_p4f_coscof_p1);
- y = ei_pmadd(y,z,ei_p4f_coscof_p2);
- y = ei_pmul(y, z);
- y = ei_pmul(y, z);
- Packet4f tmp = _mm_mul_ps(z, ei_p4f_half);
- y = ei_psub(y, tmp);
- y = ei_padd(y, ei_p4f_1);
+ y = pmadd(y,z,p4f_coscof_p1);
+ y = pmadd(y,z,p4f_coscof_p2);
+ y = pmul(y, z);
+ y = pmul(y, z);
+ Packet4f tmp = _mm_mul_ps(z, p4f_half);
+ y = psub(y, tmp);
+ y = padd(y, p4f_1);
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
- Packet4f y2 = ei_p4f_sincof_p0;
- y2 = ei_pmadd(y2, z, ei_p4f_sincof_p1);
- y2 = ei_pmadd(y2, z, ei_p4f_sincof_p2);
- y2 = ei_pmul(y2, z);
- y2 = ei_pmadd(y2, x, x);
+ Packet4f y2 = p4f_sincof_p0;
+ y2 = pmadd(y2, z, p4f_sincof_p1);
+ y2 = pmadd(y2, z, p4f_sincof_p2);
+ y2 = pmul(y2, z);
+ y2 = pmadd(y2, x, x);
/* select the correct result from the two polynoms */
y2 = _mm_and_ps(poly_mask, y2);
@@ -376,16 +378,18 @@ Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
// This is based on Quake3's fast inverse square root.
// For detail see here: http://www.beyond3d.com/content/articles/8/
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
-Packet4f ei_psqrt<Packet4f>(const Packet4f& _x)
+Packet4f psqrt<Packet4f>(const Packet4f& _x)
{
- Packet4f half = ei_pmul(_x, ei_pset1<Packet4f>(.5f));
+ Packet4f half = pmul(_x, pset1<Packet4f>(.5f));
/* select only the inverse sqrt of non-zero inputs */
- Packet4f non_zero_mask = _mm_cmpgt_ps(_x, ei_pset1<Packet4f>(std::numeric_limits<float>::epsilon()));
+ Packet4f non_zero_mask = _mm_cmpgt_ps(_x, pset1<Packet4f>(std::numeric_limits<float>::epsilon()));
Packet4f x = _mm_and_ps(non_zero_mask, _mm_rsqrt_ps(_x));
- x = ei_pmul(x, ei_psub(ei_pset1<Packet4f>(1.5f), ei_pmul(half, ei_pmul(x,x))));
- return ei_pmul(_x,x);
+ x = pmul(x, psub(pset1<Packet4f>(1.5f), pmul(half, pmul(x,x))));
+ return pmul(_x,x);
}
+} // end namespace internal
+
#endif // EIGEN_MATH_FUNCTIONS_SSE_H
diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h
index a7206e77d..5b1847252 100644
--- a/Eigen/src/Core/arch/SSE/PacketMath.h
+++ b/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_PACKET_MATH_SSE_H
#define EIGEN_PACKET_MATH_SSE_H
+namespace internal {
+
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
#endif
@@ -37,36 +39,36 @@ typedef __m128 Packet4f;
typedef __m128i Packet4i;
typedef __m128d Packet2d;
-template<> struct ei_is_arithmetic<__m128> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<__m128i> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<__m128d> { enum { ret = true }; };
+template<> struct is_arithmetic<__m128> { enum { value = true }; };
+template<> struct is_arithmetic<__m128i> { enum { value = true }; };
+template<> struct is_arithmetic<__m128d> { enum { value = true }; };
-#define ei_vec4f_swizzle1(v,p,q,r,s) \
+#define vec4f_swizzle1(v,p,q,r,s) \
(_mm_castsi128_ps(_mm_shuffle_epi32( _mm_castps_si128(v), ((s)<<6|(r)<<4|(q)<<2|(p)))))
-#define ei_vec4i_swizzle1(v,p,q,r,s) \
+#define vec4i_swizzle1(v,p,q,r,s) \
(_mm_shuffle_epi32( v, ((s)<<6|(r)<<4|(q)<<2|(p))))
-#define ei_vec2d_swizzle1(v,p,q) \
+#define vec2d_swizzle1(v,p,q) \
(_mm_castsi128_pd(_mm_shuffle_epi32( _mm_castpd_si128(v), ((q*2+1)<<6|(q*2)<<4|(p*2+1)<<2|(p*2)))))
-#define ei_vec4f_swizzle2(a,b,p,q,r,s) \
+#define vec4f_swizzle2(a,b,p,q,r,s) \
(_mm_shuffle_ps( (a), (b), ((s)<<6|(r)<<4|(q)<<2|(p))))
-#define ei_vec4i_swizzle2(a,b,p,q,r,s) \
+#define vec4i_swizzle2(a,b,p,q,r,s) \
(_mm_castps_si128( (_mm_shuffle_ps( _mm_castsi128_ps(a), _mm_castsi128_ps(b), ((s)<<6|(r)<<4|(q)<<2|(p))))))
#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
- const Packet4f ei_p4f_##NAME = ei_pset1<Packet4f>(X)
+ const Packet4f p4f_##NAME = pset1<Packet4f>(X)
#define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \
- const Packet4f ei_p4f_##NAME = _mm_castsi128_ps(ei_pset1<Packet4i>(X))
+ const Packet4f p4f_##NAME = _mm_castsi128_ps(pset1<Packet4i>(X))
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
- const Packet4i ei_p4i_##NAME = ei_pset1<Packet4i>(X)
+ const Packet4i p4i_##NAME = pset1<Packet4i>(X)
-template<> struct ei_packet_traits<float> : ei_default_packet_traits
+template<> struct packet_traits<float> : default_packet_traits
{
typedef Packet4f type;
enum {
@@ -82,7 +84,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
HasSqrt = 1
};
};
-template<> struct ei_packet_traits<double> : ei_default_packet_traits
+template<> struct packet_traits<double> : default_packet_traits
{
typedef Packet2d type;
enum {
@@ -93,7 +95,7 @@ template<> struct ei_packet_traits<double> : ei_default_packet_traits
HasDiv = 1
};
};
-template<> struct ei_packet_traits<int> : ei_default_packet_traits
+template<> struct packet_traits<int> : default_packet_traits
{
typedef Packet4i type;
enum {
@@ -104,125 +106,125 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
};
};
-template<> struct ei_unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
-template<> struct ei_unpacket_traits<Packet2d> { typedef double type; enum {size=2}; };
-template<> struct ei_unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
+template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4}; };
+template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2}; };
+template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
#ifdef __GNUC__
// Sometimes GCC implements _mm_set1_p* using multiple moves,
-// that is inefficient :( (e.g., see ei_gemm_pack_rhs)
-template<> EIGEN_STRONG_INLINE Packet4f ei_pset1<Packet4f>(const float& from) {
+// that is inefficient :( (e.g., see gemm_pack_rhs)
+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
Packet4f res = _mm_set_ss(from);
- return ei_vec4f_swizzle1(res,0,0,0,0);
+ return vec4f_swizzle1(res,0,0,0,0);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_pset1<Packet2d>(const double& from) {
+template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) {
// NOTE the SSE3 intrinsic _mm_loaddup_pd is never faster but sometimes much slower
Packet2d res = _mm_set_sd(from);
- return ei_vec2d_swizzle1(res, 0, 0);
+ return vec2d_swizzle1(res, 0, 0);
}
#else
-template<> EIGEN_STRONG_INLINE Packet4f ei_pset1<Packet4f>(const float& from) { return _mm_set1_ps(from); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set1_ps(from); }
+template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
#endif
-template<> EIGEN_STRONG_INLINE Packet4i ei_pset1<Packet4i>(const int& from) { return _mm_set1_epi32(from); }
+template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set1_epi32(from); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_plset<float>(const float& a) { return _mm_add_ps(ei_pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_plset<double>(const double& a) { return _mm_add_pd(ei_pset1<Packet2d>(a),_mm_set_pd(1,0)); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_plset<int>(const int& a) { return _mm_add_epi32(ei_pset1<Packet4i>(a),_mm_set_epi32(3,2,1,0)); }
+template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a) { return _mm_add_ps(pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); }
+template<> EIGEN_STRONG_INLINE Packet2d plset<double>(const double& a) { return _mm_add_pd(pset1<Packet2d>(a),_mm_set_pd(1,0)); }
+template<> EIGEN_STRONG_INLINE Packet4i plset<int>(const int& a) { return _mm_add_epi32(pset1<Packet4i>(a),_mm_set_epi32(3,2,1,0)); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_add_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_add_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_add_epi32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_add_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_add_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_add_epi32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_sub_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_sub_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_sub_epi32(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_sub_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_sub_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_sub_epi32(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pnegate(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a)
{
const Packet4f mask = _mm_castsi128_ps(_mm_setr_epi32(0x80000000,0x80000000,0x80000000,0x80000000));
return _mm_xor_ps(a,mask);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_pnegate(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE Packet2d pnegate(const Packet2d& a)
{
const Packet2d mask = _mm_castsi128_pd(_mm_setr_epi32(0x0,0x80000000,0x0,0x80000000));
return _mm_xor_pd(a,mask);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pnegate(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a)
{
- return ei_psub(_mm_setr_epi32(0,0,0,0), a);
+ return psub(_mm_setr_epi32(0,0,0,0), a);
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_mul_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pmul<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_mul_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmul<Packet4i>(const Packet4i& a, const Packet4i& b)
+template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_mul_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pmul<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_mul_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(const Packet4i& a, const Packet4i& b)
{
#ifdef EIGEN_VECTORIZE_SSE4_1
return _mm_mullo_epi32(a,b);
#else
// this version is slightly faster than 4 scalar products
- return ei_vec4i_swizzle1(
- ei_vec4i_swizzle2(
+ return vec4i_swizzle1(
+ vec4i_swizzle2(
_mm_mul_epu32(a,b),
- _mm_mul_epu32(ei_vec4i_swizzle1(a,1,0,3,2),
- ei_vec4i_swizzle1(b,1,0,3,2)),
+ _mm_mul_epu32(vec4i_swizzle1(a,1,0,3,2),
+ vec4i_swizzle1(b,1,0,3,2)),
0,2,0,2),
0,2,1,3);
#endif
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_pdiv<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_div_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pdiv<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_div_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
-{ ei_assert(false && "packet integer division are not supported by SSE");
- return ei_pset1<Packet4i>(0);
+template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_div_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pdiv<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_div_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
+{ eigen_assert(false && "packet integer division are not supported by SSE");
+ return pset1<Packet4i>(0);
}
// for some weird raisons, it has to be overloaded for packet of integers
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return ei_padd(ei_pmul(a,b), c); }
+template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd(pmul(a,b), c); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_min_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_min_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmin<Packet4i>(const Packet4i& a, const Packet4i& b)
+template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_min_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_min_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b)
{
// after some bench, this version *is* faster than a scalar implementation
Packet4i mask = _mm_cmplt_epi32(a,b);
return _mm_or_si128(_mm_and_si128(mask,a),_mm_andnot_si128(mask,b));
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_max_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pmax<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_max_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pmax<Packet4i>(const Packet4i& a, const Packet4i& b)
+template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_max_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_max_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b)
{
// after some bench, this version *is* faster than a scalar implementation
Packet4i mask = _mm_cmpgt_epi32(a,b);
return _mm_or_si128(_mm_and_si128(mask,a),_mm_andnot_si128(mask,b));
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_and_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pand<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_and_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_and_si128(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_and_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pand<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_and_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_and_si128(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_por<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_or_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_por<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_or_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_por<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_or_si128(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_or_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d por<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_or_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_or_si128(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_xor_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pxor<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_xor_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_xor_si128(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_xor_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_xor_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_xor_si128(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_andnot_ps(a,b); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pandnot<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_andnot_pd(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_andnot_si128(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_andnot_ps(a,b); }
+template<> EIGEN_STRONG_INLINE Packet2d pandnot<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_andnot_pd(a,b); }
+template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return _mm_andnot_si128(a,b); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pload<Packet4f>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_ps(from); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_pload<Packet2d>(const double* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_pd(from); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_pload<Packet4i>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_si128(reinterpret_cast<const Packet4i*>(from)); }
+template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_ps(from); }
+template<> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_pd(from); }
+template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int* from) { EIGEN_DEBUG_ALIGNED_LOAD return _mm_load_si128(reinterpret_cast<const Packet4i*>(from)); }
#if defined(_MSC_VER)
- template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu<Packet4f>(const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_ps(from); }
- template<> EIGEN_STRONG_INLINE Packet2d ei_ploadu<Packet2d>(const double* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_pd(from); }
- template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu<Packet4i>(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_si128(reinterpret_cast<const Packet4i*>(from)); }
+ template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_ps(from); }
+ template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_pd(from); }
+ template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD return _mm_loadu_si128(reinterpret_cast<const Packet4i*>(from)); }
#else
// Fast unaligned loads. Note that here we cannot directly use intrinsics: this would
// require pointer casting to incompatible pointer types and leads to invalid code
@@ -230,7 +232,7 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_pload<Packet4i>(const int* from)
// a correct instruction dependency.
// TODO: do the same for MSVC (ICC is compatible)
// NOTE: with the code below, MSVC's compiler crashes!
-template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu<Packet4f>(const float* from)
+template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from)
{
EIGEN_DEBUG_UNALIGNED_LOAD
__m128d res;
@@ -238,7 +240,7 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_ploadu<Packet4f>(const float* from)
res = _mm_loadh_pd(res, (const double*)(from+2)) ;
return _mm_castpd_ps(res);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_ploadu<Packet2d>(const double* from)
+template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from)
{
EIGEN_DEBUG_UNALIGNED_LOAD
__m128d res;
@@ -246,7 +248,7 @@ template<> EIGEN_STRONG_INLINE Packet2d ei_ploadu<Packet2d>(const double* from)
res = _mm_loadh_pd(res,from+1);
return res;
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu<Packet4i>(const int* from)
+template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
{
EIGEN_DEBUG_UNALIGNED_LOAD
__m128d res;
@@ -256,71 +258,71 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_ploadu<Packet4i>(const int* from)
}
#endif
-template<> EIGEN_STRONG_INLINE Packet4f ei_ploaddup<Packet4f>(const float* from)
+template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)
{
- return ei_vec4f_swizzle1(_mm_castpd_ps(_mm_load_sd((const double*)from)), 0, 0, 1, 1);
+ return vec4f_swizzle1(_mm_castpd_ps(_mm_load_sd((const double*)from)), 0, 0, 1, 1);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_ploaddup<Packet2d>(const double* from)
-{ return ei_pset1<Packet2d>(from[0]); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_ploaddup<Packet4i>(const int* from)
+template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from)
+{ return pset1<Packet2d>(from[0]); }
+template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int* from)
{
Packet4i tmp;
tmp = _mm_loadl_epi64(reinterpret_cast<const Packet4i*>(from));
- return ei_vec4i_swizzle1(tmp, 0, 0, 1, 1);
+ return vec4i_swizzle1(tmp, 0, 0, 1, 1);
}
-template<> EIGEN_STRONG_INLINE void ei_pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_ps(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_pstore<double>(double* to, const Packet2d& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_pd(to, from); }
-template<> EIGEN_STRONG_INLINE void ei_pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_si128(reinterpret_cast<Packet4i*>(to), from); }
+template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_ps(to, from); }
+template<> EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_pd(to, from); }
+template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_si128(reinterpret_cast<Packet4i*>(to), from); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<double>(double* to, const Packet2d& from) {
+template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d& from) {
EIGEN_DEBUG_UNALIGNED_STORE
_mm_storel_pd((to), from);
_mm_storeh_pd((to+1), from);
}
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu((double*)to, _mm_castps_pd(from)); }
-template<> EIGEN_STRONG_INLINE void ei_pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE ei_pstoreu((double*)to, _mm_castsi128_pd(from)); }
+template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castps_pd(from)); }
+template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castsi128_pd(from)); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-template<> EIGEN_STRONG_INLINE void ei_prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
#if defined(_MSC_VER) && (_MSC_VER <= 1500) && defined(_WIN64) && !defined(__INTEL_COMPILER)
// The temporary variable fixes an internal compilation error.
// Direct of the struct members fixed bug #62.
-template<> EIGEN_STRONG_INLINE float ei_pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }
-template<> EIGEN_STRONG_INLINE double ei_pfirst<Packet2d>(const Packet2d& a) { return a.m128d_f64[0]; }
-template<> EIGEN_STRONG_INLINE int ei_pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
+template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }
+template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { return a.m128d_f64[0]; }
+template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
#elif defined(_MSC_VER) && (_MSC_VER <= 1500) && !defined(__INTEL_COMPILER)
// The temporary variable fixes an internal compilation error.
-template<> EIGEN_STRONG_INLINE float ei_pfirst<Packet4f>(const Packet4f& a) { float x = _mm_cvtss_f32(a); return x; }
-template<> EIGEN_STRONG_INLINE double ei_pfirst<Packet2d>(const Packet2d& a) { double x = _mm_cvtsd_f64(a); return x; }
-template<> EIGEN_STRONG_INLINE int ei_pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
+template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float x = _mm_cvtss_f32(a); return x; }
+template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { double x = _mm_cvtsd_f64(a); return x; }
+template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { int x = _mm_cvtsi128_si32(a); return x; }
#else
-template<> EIGEN_STRONG_INLINE float ei_pfirst<Packet4f>(const Packet4f& a) { return _mm_cvtss_f32(a); }
-template<> EIGEN_STRONG_INLINE double ei_pfirst<Packet2d>(const Packet2d& a) { return _mm_cvtsd_f64(a); }
-template<> EIGEN_STRONG_INLINE int ei_pfirst<Packet4i>(const Packet4i& a) { return _mm_cvtsi128_si32(a); }
+template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return _mm_cvtss_f32(a); }
+template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { return _mm_cvtsd_f64(a); }
+template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { return _mm_cvtsi128_si32(a); }
#endif
-template<> EIGEN_STRONG_INLINE Packet4f ei_preverse(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)
{ return _mm_shuffle_ps(a,a,0x1B); }
-template<> EIGEN_STRONG_INLINE Packet2d ei_preverse(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE Packet2d preverse(const Packet2d& a)
{ return _mm_shuffle_pd(a,a,0x1); }
-template<> EIGEN_STRONG_INLINE Packet4i ei_preverse(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a)
{ return _mm_shuffle_epi32(a,0x1B); }
-template<> EIGEN_STRONG_INLINE Packet4f ei_pabs(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f& a)
{
const Packet4f mask = _mm_castsi128_ps(_mm_setr_epi32(0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF));
return _mm_and_ps(a,mask);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_pabs(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE Packet2d pabs(const Packet2d& a)
{
const Packet2d mask = _mm_castsi128_pd(_mm_setr_epi32(0xFFFFFFFF,0x7FFFFFFF,0xFFFFFFFF,0x7FFFFFFF));
return _mm_and_pd(a,mask);
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_pabs(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE Packet4i pabs(const Packet4i& a)
{
#ifdef EIGEN_VECTORIZE_SSSE3
return _mm_abs_epi32(a);
@@ -330,7 +332,7 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_pabs(const Packet4i& a)
#endif
}
-EIGEN_STRONG_INLINE void ei_punpackp(Packet4f* vecs)
+EIGEN_STRONG_INLINE void punpackp(Packet4f* vecs)
{
vecs[1] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0x55));
vecs[2] = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(vecs[0]), 0xAA));
@@ -340,47 +342,47 @@ EIGEN_STRONG_INLINE void ei_punpackp(Packet4f* vecs)
#ifdef EIGEN_VECTORIZE_SSE3
// TODO implement SSE2 versions as well as integer versions
-template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vecs)
+template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
{
return _mm_hadd_ps(_mm_hadd_ps(vecs[0], vecs[1]),_mm_hadd_ps(vecs[2], vecs[3]));
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_preduxp<Packet2d>(const Packet2d* vecs)
+template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(const Packet2d* vecs)
{
return _mm_hadd_pd(vecs[0], vecs[1]);
}
// SSSE3 version:
-// EIGEN_STRONG_INLINE Packet4i ei_preduxp(const Packet4i* vecs)
+// EIGEN_STRONG_INLINE Packet4i preduxp(const Packet4i* vecs)
// {
// return _mm_hadd_epi32(_mm_hadd_epi32(vecs[0], vecs[1]),_mm_hadd_epi32(vecs[2], vecs[3]));
// }
-template<> EIGEN_STRONG_INLINE float ei_predux<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
{
Packet4f tmp0 = _mm_hadd_ps(a,a);
- return ei_pfirst(_mm_hadd_ps(tmp0, tmp0));
+ return pfirst(_mm_hadd_ps(tmp0, tmp0));
}
-template<> EIGEN_STRONG_INLINE double ei_predux<Packet2d>(const Packet2d& a) { return ei_pfirst(_mm_hadd_pd(a, a)); }
+template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a) { return pfirst(_mm_hadd_pd(a, a)); }
// SSSE3 version:
-// EIGEN_STRONG_INLINE float ei_predux(const Packet4i& a)
+// EIGEN_STRONG_INLINE float predux(const Packet4i& a)
// {
// Packet4i tmp0 = _mm_hadd_epi32(a,a);
-// return ei_pfirst(_mm_hadd_epi32(tmp0, tmp0));
+// return pfirst(_mm_hadd_epi32(tmp0, tmp0));
// }
#else
// SSE2 versions
-template<> EIGEN_STRONG_INLINE float ei_predux<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
{
Packet4f tmp = _mm_add_ps(a, _mm_movehl_ps(a,a));
- return ei_pfirst(_mm_add_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
+ return pfirst(_mm_add_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
}
-template<> EIGEN_STRONG_INLINE double ei_predux<Packet2d>(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a)
{
- return ei_pfirst(_mm_add_sd(a, _mm_unpackhi_pd(a,a)));
+ return pfirst(_mm_add_sd(a, _mm_unpackhi_pd(a,a)));
}
-template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vecs)
+template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)
{
Packet4f tmp0, tmp1, tmp2;
tmp0 = _mm_unpacklo_ps(vecs[0], vecs[1]);
@@ -394,19 +396,19 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_preduxp<Packet4f>(const Packet4f* vec
return _mm_add_ps(tmp0, tmp2);
}
-template<> EIGEN_STRONG_INLINE Packet2d ei_preduxp<Packet2d>(const Packet2d* vecs)
+template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(const Packet2d* vecs)
{
return _mm_add_pd(_mm_unpacklo_pd(vecs[0], vecs[1]), _mm_unpackhi_pd(vecs[0], vecs[1]));
}
#endif // SSE3
-template<> EIGEN_STRONG_INLINE int ei_predux<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a)
{
Packet4i tmp = _mm_add_epi32(a, _mm_unpackhi_epi64(a,a));
- return ei_pfirst(tmp) + ei_pfirst(_mm_shuffle_epi32(tmp, 1));
+ return pfirst(tmp) + pfirst(_mm_shuffle_epi32(tmp, 1));
}
-template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vecs)
+template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(const Packet4i* vecs)
{
Packet4i tmp0, tmp1, tmp2;
tmp0 = _mm_unpacklo_epi32(vecs[0], vecs[1]);
@@ -423,69 +425,69 @@ template<> EIGEN_STRONG_INLINE Packet4i ei_preduxp<Packet4i>(const Packet4i* vec
// Other reduction functions:
// mul
-template<> EIGEN_STRONG_INLINE float ei_predux_mul<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)
{
Packet4f tmp = _mm_mul_ps(a, _mm_movehl_ps(a,a));
- return ei_pfirst(_mm_mul_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
+ return pfirst(_mm_mul_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
}
-template<> EIGEN_STRONG_INLINE double ei_predux_mul<Packet2d>(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a)
{
- return ei_pfirst(_mm_mul_sd(a, _mm_unpackhi_pd(a,a)));
+ return pfirst(_mm_mul_sd(a, _mm_unpackhi_pd(a,a)));
}
-template<> EIGEN_STRONG_INLINE int ei_predux_mul<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)
{
// after some experiments, it is seems this is the fastest way to implement it
- // for GCC (eg., reusing ei_pmul is very slow !)
+ // for GCC (eg., reusing pmul is very slow !)
// TODO try to call _mm_mul_epu32 directly
EIGEN_ALIGN16 int aux[4];
- ei_pstore(aux, a);
+ pstore(aux, a);
return (aux[0] * aux[1]) * (aux[2] * aux[3]);;
}
// min
-template<> EIGEN_STRONG_INLINE float ei_predux_min<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)
{
Packet4f tmp = _mm_min_ps(a, _mm_movehl_ps(a,a));
- return ei_pfirst(_mm_min_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
+ return pfirst(_mm_min_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
}
-template<> EIGEN_STRONG_INLINE double ei_predux_min<Packet2d>(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE double predux_min<Packet2d>(const Packet2d& a)
{
- return ei_pfirst(_mm_min_sd(a, _mm_unpackhi_pd(a,a)));
+ return pfirst(_mm_min_sd(a, _mm_unpackhi_pd(a,a)));
}
-template<> EIGEN_STRONG_INLINE int ei_predux_min<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a)
{
// after some experiments, it is seems this is the fastest way to implement it
- // for GCC (eg., it does not like using std::min after the ei_pstore !!)
+ // for GCC (eg., it does not like using std::min after the pstore !!)
EIGEN_ALIGN16 int aux[4];
- ei_pstore(aux, a);
+ pstore(aux, a);
register int aux0 = aux[0]<aux[1] ? aux[0] : aux[1];
register int aux2 = aux[2]<aux[3] ? aux[2] : aux[3];
return aux0<aux2 ? aux0 : aux2;
}
// max
-template<> EIGEN_STRONG_INLINE float ei_predux_max<Packet4f>(const Packet4f& a)
+template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)
{
Packet4f tmp = _mm_max_ps(a, _mm_movehl_ps(a,a));
- return ei_pfirst(_mm_max_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
+ return pfirst(_mm_max_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1)));
}
-template<> EIGEN_STRONG_INLINE double ei_predux_max<Packet2d>(const Packet2d& a)
+template<> EIGEN_STRONG_INLINE double predux_max<Packet2d>(const Packet2d& a)
{
- return ei_pfirst(_mm_max_sd(a, _mm_unpackhi_pd(a,a)));
+ return pfirst(_mm_max_sd(a, _mm_unpackhi_pd(a,a)));
}
-template<> EIGEN_STRONG_INLINE int ei_predux_max<Packet4i>(const Packet4i& a)
+template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
{
// after some experiments, it is seems this is the fastest way to implement it
- // for GCC (eg., it does not like using std::min after the ei_pstore !!)
+ // for GCC (eg., it does not like using std::min after the pstore !!)
EIGEN_ALIGN16 int aux[4];
- ei_pstore(aux, a);
+ pstore(aux, a);
register int aux0 = aux[0]>aux[1] ? aux[0] : aux[1];
register int aux2 = aux[2]>aux[3] ? aux[2] : aux[3];
return aux0>aux2 ? aux0 : aux2;
}
#if (defined __GNUC__)
-// template <> EIGEN_STRONG_INLINE Packet4f ei_pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c)
+// template <> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c)
// {
// Packet4f res = b;
// asm("mulps %[a], %[b] \n\taddps %[c], %[b]" : [b] "+x" (res) : [a] "x" (a), [c] "x" (c));
@@ -502,7 +504,7 @@ template<> EIGEN_STRONG_INLINE int ei_predux_max<Packet4i>(const Packet4i& a)
#ifdef EIGEN_VECTORIZE_SSSE3
// SSSE3 versions
template<int Offset>
-struct ei_palign_impl<Offset,Packet4f>
+struct palign_impl<Offset,Packet4f>
{
EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
{
@@ -512,7 +514,7 @@ struct ei_palign_impl<Offset,Packet4f>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet4i>
+struct palign_impl<Offset,Packet4i>
{
EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
{
@@ -522,7 +524,7 @@ struct ei_palign_impl<Offset,Packet4i>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet2d>
+struct palign_impl<Offset,Packet2d>
{
EIGEN_STRONG_INLINE static void run(Packet2d& first, const Packet2d& second)
{
@@ -533,7 +535,7 @@ struct ei_palign_impl<Offset,Packet2d>
#else
// SSE2 versions
template<int Offset>
-struct ei_palign_impl<Offset,Packet4f>
+struct palign_impl<Offset,Packet4f>
{
EIGEN_STRONG_INLINE static void run(Packet4f& first, const Packet4f& second)
{
@@ -556,7 +558,7 @@ struct ei_palign_impl<Offset,Packet4f>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet4i>
+struct palign_impl<Offset,Packet4i>
{
EIGEN_STRONG_INLINE static void run(Packet4i& first, const Packet4i& second)
{
@@ -579,7 +581,7 @@ struct ei_palign_impl<Offset,Packet4i>
};
template<int Offset>
-struct ei_palign_impl<Offset,Packet2d>
+struct palign_impl<Offset,Packet2d>
{
EIGEN_STRONG_INLINE static void run(Packet2d& first, const Packet2d& second)
{
@@ -592,4 +594,6 @@ struct ei_palign_impl<Offset,Packet2d>
};
#endif
+} // end namespace internal
+
#endif // EIGEN_PACKET_MATH_SSE_H
diff --git a/Eigen/src/Core/products/CoeffBasedProduct.h b/Eigen/src/Core/products/CoeffBasedProduct.h
index d2e693861..8605011da 100644
--- a/Eigen/src/Core/products/CoeffBasedProduct.h
+++ b/Eigen/src/Core/products/CoeffBasedProduct.h
@@ -26,6 +26,8 @@
#ifndef EIGEN_COEFFBASED_PRODUCT_H
#define EIGEN_COEFFBASED_PRODUCT_H
+namespace internal {
+
/*********************************************************************************
* Coefficient based product implementation.
* It is designed for the following use cases:
@@ -40,22 +42,22 @@
*/
template<int Traversal, int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl;
+struct product_coeff_impl;
template<int StorageOrder, int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl;
+struct product_packet_impl;
template<typename LhsNested, typename RhsNested, int NestingFlags>
-struct ei_traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
+struct traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
{
typedef MatrixXpr XprKind;
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
- typedef typename ei_scalar_product_traits<typename _LhsNested::Scalar, typename _RhsNested::Scalar>::ReturnType Scalar;
- typedef typename ei_promote_storage_type<typename ei_traits<_LhsNested>::StorageKind,
- typename ei_traits<_RhsNested>::StorageKind>::ret StorageKind;
- typedef typename ei_promote_index_type<typename ei_traits<_LhsNested>::Index,
- typename ei_traits<_RhsNested>::Index>::type Index;
+ typedef typename remove_all<LhsNested>::type _LhsNested;
+ typedef typename remove_all<RhsNested>::type _RhsNested;
+ typedef typename scalar_product_traits<typename _LhsNested::Scalar, typename _RhsNested::Scalar>::ReturnType Scalar;
+ typedef typename promote_storage_type<typename traits<_LhsNested>::StorageKind,
+ typename traits<_RhsNested>::StorageKind>::ret StorageKind;
+ typedef typename promote_index_type<typename traits<_LhsNested>::Index,
+ typename traits<_RhsNested>::Index>::type Index;
enum {
LhsCoeffReadCost = _LhsNested::CoeffReadCost,
@@ -73,18 +75,18 @@ struct ei_traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
LhsRowMajor = LhsFlags & RowMajorBit,
RhsRowMajor = RhsFlags & RowMajorBit,
- SameType = ei_is_same_type<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::ret,
+ SameType = is_same<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::value,
CanVectorizeRhs = RhsRowMajor && (RhsFlags & PacketAccessBit)
&& (ColsAtCompileTime == Dynamic
- || ( (ColsAtCompileTime % ei_packet_traits<Scalar>::size) == 0
+ || ( (ColsAtCompileTime % packet_traits<Scalar>::size) == 0
&& (RhsFlags&AlignedBit)
)
),
CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit)
&& (RowsAtCompileTime == Dynamic
- || ( (RowsAtCompileTime % ei_packet_traits<Scalar>::size) == 0
+ || ( (RowsAtCompileTime % packet_traits<Scalar>::size) == 0
&& (LhsFlags&AlignedBit)
)
),
@@ -113,13 +115,15 @@ struct ei_traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
&& (!RhsRowMajor)
&& (LhsFlags & RhsFlags & ActualPacketAccessBit)
&& (LhsFlags & RhsFlags & AlignedBit)
- && (InnerSize % ei_packet_traits<Scalar>::size == 0)
+ && (InnerSize % packet_traits<Scalar>::size == 0)
};
};
+} // end namespace internal
+
template<typename LhsNested, typename RhsNested, int NestingFlags>
class CoeffBasedProduct
- : ei_no_assignment_operator,
+ : internal::no_assignment_operator,
public MatrixBase<CoeffBasedProduct<LhsNested, RhsNested, NestingFlags> >
{
public:
@@ -130,19 +134,19 @@ class CoeffBasedProduct
private:
- typedef typename ei_traits<CoeffBasedProduct>::_LhsNested _LhsNested;
- typedef typename ei_traits<CoeffBasedProduct>::_RhsNested _RhsNested;
+ typedef typename internal::traits<CoeffBasedProduct>::_LhsNested _LhsNested;
+ typedef typename internal::traits<CoeffBasedProduct>::_RhsNested _RhsNested;
enum {
- PacketSize = ei_packet_traits<Scalar>::size,
- InnerSize = ei_traits<CoeffBasedProduct>::InnerSize,
+ PacketSize = internal::packet_traits<Scalar>::size,
+ InnerSize = internal::traits<CoeffBasedProduct>::InnerSize,
Unroll = CoeffReadCost != Dynamic && CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
- CanVectorizeInner = ei_traits<CoeffBasedProduct>::CanVectorizeInner
+ CanVectorizeInner = internal::traits<CoeffBasedProduct>::CanVectorizeInner
};
- typedef ei_product_coeff_impl<CanVectorizeInner ? InnerVectorizedTraversal : DefaultTraversal,
- Unroll ? InnerSize-1 : Dynamic,
- _LhsNested, _RhsNested, Scalar> ScalarCoeffImpl;
+ typedef internal::product_coeff_impl<CanVectorizeInner ? InnerVectorizedTraversal : DefaultTraversal,
+ Unroll ? InnerSize-1 : Dynamic,
+ _LhsNested, _RhsNested, Scalar> ScalarCoeffImpl;
typedef CoeffBasedProduct<LhsNested,RhsNested,NestByRefBit> LazyCoeffBasedProductType;
@@ -158,9 +162,9 @@ class CoeffBasedProduct
{
// we don't allow taking products of matrices of different real types, as that wouldn't be vectorizable.
// We still allow to mix T and complex<T>.
- EIGEN_STATIC_ASSERT((ei_is_same_type<typename Lhs::RealScalar, typename Rhs::RealScalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- ei_assert(lhs.cols() == rhs.rows()
+ eigen_assert(lhs.cols() == rhs.rows()
&& "invalid matrix product"
&& "if you wanted a coeff-wise or a dot product use the respective explicit functions");
}
@@ -191,9 +195,9 @@ class CoeffBasedProduct
EIGEN_STRONG_INLINE const PacketScalar packet(Index row, Index col) const
{
PacketScalar res;
- ei_product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor,
- Unroll ? InnerSize-1 : Dynamic,
- _LhsNested, _RhsNested, PacketScalar, LoadMode>
+ internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor,
+ Unroll ? InnerSize-1 : Dynamic,
+ _LhsNested, _RhsNested, PacketScalar, LoadMode>
::run(row, col, m_lhs, m_rhs, res);
return res;
}
@@ -225,10 +229,12 @@ class CoeffBasedProduct
mutable PlainObject m_result;
};
+namespace internal {
+
// here we need to overload the nested rule for products
// such that the nested type is a const reference to a plain matrix
template<typename Lhs, typename Rhs, int N, typename PlainObject>
-struct ei_nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssigningBit>, N, PlainObject>
+struct nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssigningBit>, N, PlainObject>
{
typedef PlainObject const& type;
};
@@ -242,18 +248,18 @@ struct ei_nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssign
**************************************/
template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl<DefaultTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
+struct product_coeff_impl<DefaultTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
{
- ei_product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
+ product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
res += lhs.coeff(row, UnrollingIndex) * rhs.coeff(UnrollingIndex, col);
}
};
template<typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
+struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
@@ -263,12 +269,12 @@ struct ei_product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
};
template<typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
+struct product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
{
- ei_assert(lhs.cols()>0 && "you are using a non initialized matrix");
+ eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
res = lhs.coeff(row, 0) * rhs.coeff(0, col);
for(Index i = 1; i < lhs.cols(); ++i)
res += lhs.coeff(row, i) * rhs.coeff(i, col);
@@ -280,44 +286,44 @@ struct ei_product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
*******************************************/
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet>
-struct ei_product_coeff_vectorized_unroller
+struct product_coeff_vectorized_unroller
{
typedef typename Lhs::Index Index;
- enum { PacketSize = ei_packet_traits<typename Lhs::Scalar>::size };
+ enum { PacketSize = packet_traits<typename Lhs::Scalar>::size };
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
{
- ei_product_coeff_vectorized_unroller<UnrollingIndex-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
- pres = ei_padd(pres, ei_pmul( lhs.template packet<Aligned>(row, UnrollingIndex) , rhs.template packet<Aligned>(UnrollingIndex, col) ));
+ product_coeff_vectorized_unroller<UnrollingIndex-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
+ pres = padd(pres, pmul( lhs.template packet<Aligned>(row, UnrollingIndex) , rhs.template packet<Aligned>(UnrollingIndex, col) ));
}
};
template<typename Lhs, typename Rhs, typename Packet>
-struct ei_product_coeff_vectorized_unroller<0, Lhs, Rhs, Packet>
+struct product_coeff_vectorized_unroller<0, Lhs, Rhs, Packet>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::PacketScalar &pres)
{
- pres = ei_pmul(lhs.template packet<Aligned>(row, 0) , rhs.template packet<Aligned>(0, col));
+ pres = pmul(lhs.template packet<Aligned>(row, 0) , rhs.template packet<Aligned>(0, col));
}
};
template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
+struct product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::PacketScalar Packet;
typedef typename Lhs::Index Index;
- enum { PacketSize = ei_packet_traits<typename Lhs::Scalar>::size };
+ enum { PacketSize = packet_traits<typename Lhs::Scalar>::size };
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
{
Packet pres;
- ei_product_coeff_vectorized_unroller<UnrollingIndex+1-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
- ei_product_coeff_impl<DefaultTraversal,UnrollingIndex,Lhs,Rhs,RetScalar>::run(row, col, lhs, rhs, res);
- res = ei_predux(pres);
+ product_coeff_vectorized_unroller<UnrollingIndex+1-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
+ product_coeff_impl<DefaultTraversal,UnrollingIndex,Lhs,Rhs,RetScalar>::run(row, col, lhs, rhs, res);
+ res = predux(pres);
}
};
template<typename Lhs, typename Rhs, int LhsRows = Lhs::RowsAtCompileTime, int RhsCols = Rhs::ColsAtCompileTime>
-struct ei_product_coeff_vectorized_dyn_selector
+struct product_coeff_vectorized_dyn_selector
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
@@ -329,7 +335,7 @@ struct ei_product_coeff_vectorized_dyn_selector
// NOTE the 3 following specializations are because taking .col(0) on a vector is a bit slower
// NOTE maybe they are now useless since we have a specialization for Block<Matrix>
template<typename Lhs, typename Rhs, int RhsCols>
-struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,RhsCols>
+struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,RhsCols>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index /*row*/, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
@@ -339,7 +345,7 @@ struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,RhsCols>
};
template<typename Lhs, typename Rhs, int LhsRows>
-struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,LhsRows,1>
+struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,LhsRows,1>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
@@ -349,7 +355,7 @@ struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,LhsRows,1>
};
template<typename Lhs, typename Rhs>
-struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,1>
+struct product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,1>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index /*row*/, Index /*col*/, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
@@ -359,12 +365,12 @@ struct ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs,1,1>
};
template<typename Lhs, typename Rhs, typename RetScalar>
-struct ei_product_coeff_impl<InnerVectorizedTraversal, Dynamic, Lhs, Rhs, RetScalar>
+struct product_coeff_impl<InnerVectorizedTraversal, Dynamic, Lhs, Rhs, RetScalar>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res)
{
- ei_product_coeff_vectorized_dyn_selector<Lhs,Rhs>::run(row, col, lhs, rhs, res);
+ product_coeff_vectorized_dyn_selector<Lhs,Rhs>::run(row, col, lhs, rhs, res);
}
};
@@ -373,71 +379,73 @@ struct ei_product_coeff_impl<InnerVectorizedTraversal, Dynamic, Lhs, Rhs, RetSca
*******************/
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
{
- ei_product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
- res = ei_pmadd(ei_pset1<Packet>(lhs.coeff(row, UnrollingIndex)), rhs.template packet<LoadMode>(UnrollingIndex, col), res);
+ product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
+ res = pmadd(pset1<Packet>(lhs.coeff(row, UnrollingIndex)), rhs.template packet<LoadMode>(UnrollingIndex, col), res);
}
};
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
{
- ei_product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
- res = ei_pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex), ei_pset1<Packet>(rhs.coeff(UnrollingIndex, col)), res);
+ product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
+ res = pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex), pset1<Packet>(rhs.coeff(UnrollingIndex, col)), res);
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
{
- res = ei_pmul(ei_pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
+ res = pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
{
- res = ei_pmul(lhs.template packet<LoadMode>(row, 0), ei_pset1<Packet>(rhs.coeff(0, col)));
+ res = pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
{
- ei_assert(lhs.cols()>0 && "you are using a non initialized matrix");
- res = ei_pmul(ei_pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
+ eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
+ res = pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
for(Index i = 1; i < lhs.cols(); ++i)
- res = ei_pmadd(ei_pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode>(i, col), res);
+ res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode>(i, col), res);
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
-struct ei_product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
+struct product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
{
typedef typename Lhs::Index Index;
EIGEN_STRONG_INLINE static void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
{
- ei_assert(lhs.cols()>0 && "you are using a non initialized matrix");
- res = ei_pmul(lhs.template packet<LoadMode>(row, 0), ei_pset1<Packet>(rhs.coeff(0, col)));
+ eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
+ res = pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
for(Index i = 1; i < lhs.cols(); ++i)
- res = ei_pmadd(lhs.template packet<LoadMode>(row, i), ei_pset1<Packet>(rhs.coeff(i, col)), res);
+ res = pmadd(lhs.template packet<LoadMode>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
}
};
+} // end namespace internal
+
#endif // EIGEN_COEFFBASED_PRODUCT_H
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h
index 7e2d496fe..074534861 100644
--- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -25,18 +25,20 @@
#ifndef EIGEN_GENERAL_BLOCK_PANEL_H
#define EIGEN_GENERAL_BLOCK_PANEL_H
+namespace internal {
+
template<typename _LhsScalar, typename _RhsScalar, bool _ConjLhs=false, bool _ConjRhs=false>
-class ei_gebp_traits;
+class gebp_traits;
/** \internal */
-inline void ei_manage_caching_sizes(Action action, std::ptrdiff_t* l1=0, std::ptrdiff_t* l2=0)
+inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1=0, std::ptrdiff_t* l2=0)
{
static std::ptrdiff_t m_l1CacheSize = 0;
static std::ptrdiff_t m_l2CacheSize = 0;
if(m_l1CacheSize==0)
{
- m_l1CacheSize = ei_queryL1CacheSize();
- m_l2CacheSize = ei_queryTopLevelCacheSize();
+ m_l1CacheSize = queryL1CacheSize();
+ m_l2CacheSize = queryTopLevelCacheSize();
if(m_l1CacheSize<=0) m_l1CacheSize = 8 * 1024;
if(m_l2CacheSize<=0) m_l2CacheSize = 1 * 1024 * 1024;
@@ -45,50 +47,22 @@ inline void ei_manage_caching_sizes(Action action, std::ptrdiff_t* l1=0, std::pt
if(action==SetAction)
{
// set the cpu cache size and cache all block sizes from a global cache size in byte
- ei_internal_assert(l1!=0 && l2!=0);
+ eigen_internal_assert(l1!=0 && l2!=0);
m_l1CacheSize = *l1;
m_l2CacheSize = *l2;
}
else if(action==GetAction)
{
- ei_internal_assert(l1!=0 && l2!=0);
+ eigen_internal_assert(l1!=0 && l2!=0);
*l1 = m_l1CacheSize;
*l2 = m_l2CacheSize;
}
else
{
- ei_internal_assert(false);
+ eigen_internal_assert(false);
}
}
-/** \returns the currently set level 1 cpu cache size (in bytes) used to estimate the ideal blocking size parameters.
- * \sa setCpuCacheSize */
-inline std::ptrdiff_t l1CacheSize()
-{
- std::ptrdiff_t l1, l2;
- ei_manage_caching_sizes(GetAction, &l1, &l2);
- return l1;
-}
-
-/** \returns the currently set level 2 cpu cache size (in bytes) used to estimate the ideal blocking size parameters.
- * \sa setCpuCacheSize */
-inline std::ptrdiff_t l2CacheSize()
-{
- std::ptrdiff_t l1, l2;
- ei_manage_caching_sizes(GetAction, &l1, &l2);
- return l2;
-}
-
-/** Set the cpu L1 and L2 cache sizes (in bytes).
- * These values are use to adjust the size of the blocks
- * for the algorithms working per blocks.
- *
- * \sa computeProductBlockingSizes */
-inline void setCpuCacheSizes(std::ptrdiff_t l1, std::ptrdiff_t l2)
-{
- ei_manage_caching_sizes(SetAction, &l1, &l2);
-}
-
/** \brief Computes the blocking parameters for a m x k times k x n matrix product
*
* \param[in,out] k Input: the third dimension of the product. Output: the blocking size along the same dimension.
@@ -100,7 +74,7 @@ inline void setCpuCacheSizes(std::ptrdiff_t l1, std::ptrdiff_t l2)
* for matrix products and related algorithms. The blocking sizes depends on various
* parameters:
* - the L1 and L2 cache sizes,
- * - the register level blocking sizes defined by ei_gebp_traits,
+ * - the register level blocking sizes defined by gebp_traits,
* - the number of scalars that fit into a packet (when vectorization is enabled).
*
* \sa setCpuCacheSizes */
@@ -116,15 +90,15 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
// stay in L1 cache.
std::ptrdiff_t l1, l2;
- typedef ei_gebp_traits<LhsScalar,RhsScalar> Traits;
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
enum {
kdiv = KcFactor * 2 * Traits::nr
* Traits::RhsProgress * sizeof(RhsScalar),
- mr = ei_gebp_traits<LhsScalar,RhsScalar>::mr,
+ mr = gebp_traits<LhsScalar,RhsScalar>::mr,
mr_mask = (0xffffffff/mr)*mr
};
- ei_manage_caching_sizes(GetAction, &l1, &l2);
+ manage_caching_sizes(GetAction, &l1, &l2);
k = std::min<std::ptrdiff_t>(k, l1/kdiv);
std::ptrdiff_t _m = k>0 ? l2/(4 * sizeof(LhsScalar) * k) : 0;
if(_m<m) m = _m & mr_mask;
@@ -143,28 +117,28 @@ inline void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, st
// FIXME (a bit overkill maybe ?)
- template<typename CJ, typename A, typename B, typename C, typename T> struct ei_gebp_madd_selector {
+ template<typename CJ, typename A, typename B, typename C, typename T> struct gebp_madd_selector {
EIGEN_STRONG_INLINE EIGEN_ALWAYS_INLINE_ATTRIB static void run(const CJ& cj, A& a, B& b, C& c, T& /*t*/)
{
c = cj.pmadd(a,b,c);
}
};
- template<typename CJ, typename T> struct ei_gebp_madd_selector<CJ,T,T,T,T> {
+ template<typename CJ, typename T> struct gebp_madd_selector<CJ,T,T,T,T> {
EIGEN_STRONG_INLINE EIGEN_ALWAYS_INLINE_ATTRIB static void run(const CJ& cj, T& a, T& b, T& c, T& t)
{
- t = b; t = cj.pmul(a,t); c = ei_padd(c,t);
+ t = b; t = cj.pmul(a,t); c = padd(c,t);
}
};
template<typename CJ, typename A, typename B, typename C, typename T>
- EIGEN_STRONG_INLINE void ei_gebp_madd(const CJ& cj, A& a, B& b, C& c, T& t)
+ EIGEN_STRONG_INLINE void gebp_madd(const CJ& cj, A& a, B& b, C& c, T& t)
{
- ei_gebp_madd_selector<CJ,A,B,C,T>::run(cj,a,b,c,t);
+ gebp_madd_selector<CJ,A,B,C,T>::run(cj,a,b,c,t);
}
- #define MADD(CJ,A,B,C,T) ei_gebp_madd(CJ,A,B,C,T);
-// #define MADD(CJ,A,B,C,T) T = B; T = CJ.pmul(A,T); C = ei_padd(C,T);
+ #define MADD(CJ,A,B,C,T) gebp_madd(CJ,A,B,C,T);
+// #define MADD(CJ,A,B,C,T) T = B; T = CJ.pmul(A,T); C = padd(C,T);
#endif
/* Vectorization logic
@@ -178,20 +152,20 @@ inline void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, st
* real*cplx : load lhs as (a0,a0,a1,a1), and mul as usual
*/
template<typename _LhsScalar, typename _RhsScalar, bool _ConjLhs, bool _ConjRhs>
-class ei_gebp_traits
+class gebp_traits
{
public:
typedef _LhsScalar LhsScalar;
typedef _RhsScalar RhsScalar;
- typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
ConjLhs = _ConjLhs,
ConjRhs = _ConjRhs,
- Vectorizable = ei_packet_traits<LhsScalar>::Vectorizable && ei_packet_traits<RhsScalar>::Vectorizable,
- LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1,
- RhsPacketSize = Vectorizable ? ei_packet_traits<RhsScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1,
+ Vectorizable = packet_traits<LhsScalar>::Vectorizable && packet_traits<RhsScalar>::Vectorizable,
+ LhsPacketSize = Vectorizable ? packet_traits<LhsScalar>::size : 1,
+ RhsPacketSize = Vectorizable ? packet_traits<RhsScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1,
NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS,
@@ -207,67 +181,67 @@ public:
RhsProgress = RhsPacketSize
};
- typedef typename ei_packet_traits<LhsScalar>::type _LhsPacket;
- typedef typename ei_packet_traits<RhsScalar>::type _RhsPacket;
- typedef typename ei_packet_traits<ResScalar>::type _ResPacket;
+ typedef typename packet_traits<LhsScalar>::type _LhsPacket;
+ typedef typename packet_traits<RhsScalar>::type _RhsPacket;
+ typedef typename packet_traits<ResScalar>::type _ResPacket;
- typedef typename ei_meta_if<Vectorizable,_LhsPacket,LhsScalar>::ret LhsPacket;
- typedef typename ei_meta_if<Vectorizable,_RhsPacket,RhsScalar>::ret RhsPacket;
- typedef typename ei_meta_if<Vectorizable,_ResPacket,ResScalar>::ret ResPacket;
+ typedef typename conditional<Vectorizable,_LhsPacket,LhsScalar>::type LhsPacket;
+ typedef typename conditional<Vectorizable,_RhsPacket,RhsScalar>::type RhsPacket;
+ typedef typename conditional<Vectorizable,_ResPacket,ResScalar>::type ResPacket;
typedef ResPacket AccPacket;
EIGEN_STRONG_INLINE void initAcc(AccPacket& p)
{
- p = ei_pset1<ResPacket>(ResScalar(0));
+ p = pset1<ResPacket>(ResScalar(0));
}
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
- ei_pstore(&b[k*RhsPacketSize], ei_pset1<RhsPacket>(rhs[k]));
+ pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
{
- dest = ei_pload<RhsPacket>(b);
+ dest = pload<RhsPacket>(b);
}
EIGEN_STRONG_INLINE void loadLhs(const LhsScalar* a, LhsPacket& dest) const
{
- dest = ei_pload<LhsPacket>(a);
+ dest = pload<LhsPacket>(a);
}
EIGEN_STRONG_INLINE void madd(const LhsPacket& a, const RhsPacket& b, AccPacket& c, AccPacket& tmp) const
{
- tmp = b; tmp = ei_pmul(a,tmp); c = ei_padd(c,tmp);
+ tmp = b; tmp = pmul(a,tmp); c = padd(c,tmp);
}
EIGEN_STRONG_INLINE void acc(const AccPacket& c, const ResPacket& alpha, ResPacket& r) const
{
- r = ei_pmadd(c,alpha,r);
+ r = pmadd(c,alpha,r);
}
protected:
-// ei_conj_helper<LhsScalar,RhsScalar,ConjLhs,ConjRhs> cj;
-// ei_conj_helper<LhsPacket,RhsPacket,ConjLhs,ConjRhs> pcj;
+// conj_helper<LhsScalar,RhsScalar,ConjLhs,ConjRhs> cj;
+// conj_helper<LhsPacket,RhsPacket,ConjLhs,ConjRhs> pcj;
};
template<typename RealScalar, bool _ConjLhs>
-class ei_gebp_traits<std::complex<RealScalar>, RealScalar, _ConjLhs, false>
+class gebp_traits<std::complex<RealScalar>, RealScalar, _ConjLhs, false>
{
public:
typedef std::complex<RealScalar> LhsScalar;
typedef RealScalar RhsScalar;
- typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
ConjLhs = _ConjLhs,
ConjRhs = false,
- Vectorizable = ei_packet_traits<LhsScalar>::Vectorizable && ei_packet_traits<RhsScalar>::Vectorizable,
- LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1,
- RhsPacketSize = Vectorizable ? ei_packet_traits<RhsScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1,
+ Vectorizable = packet_traits<LhsScalar>::Vectorizable && packet_traits<RhsScalar>::Vectorizable,
+ LhsPacketSize = Vectorizable ? packet_traits<LhsScalar>::size : 1,
+ RhsPacketSize = Vectorizable ? packet_traits<RhsScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1,
NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS,
nr = NumberOfRegisters/4,
@@ -278,48 +252,48 @@ public:
RhsProgress = RhsPacketSize
};
- typedef typename ei_packet_traits<LhsScalar>::type _LhsPacket;
- typedef typename ei_packet_traits<RhsScalar>::type _RhsPacket;
- typedef typename ei_packet_traits<ResScalar>::type _ResPacket;
+ typedef typename packet_traits<LhsScalar>::type _LhsPacket;
+ typedef typename packet_traits<RhsScalar>::type _RhsPacket;
+ typedef typename packet_traits<ResScalar>::type _ResPacket;
- typedef typename ei_meta_if<Vectorizable,_LhsPacket,LhsScalar>::ret LhsPacket;
- typedef typename ei_meta_if<Vectorizable,_RhsPacket,RhsScalar>::ret RhsPacket;
- typedef typename ei_meta_if<Vectorizable,_ResPacket,ResScalar>::ret ResPacket;
+ typedef typename conditional<Vectorizable,_LhsPacket,LhsScalar>::type LhsPacket;
+ typedef typename conditional<Vectorizable,_RhsPacket,RhsScalar>::type RhsPacket;
+ typedef typename conditional<Vectorizable,_ResPacket,ResScalar>::type ResPacket;
typedef ResPacket AccPacket;
EIGEN_STRONG_INLINE void initAcc(AccPacket& p)
{
- p = ei_pset1<ResPacket>(ResScalar(0));
+ p = pset1<ResPacket>(ResScalar(0));
}
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
- ei_pstore(&b[k*RhsPacketSize], ei_pset1<RhsPacket>(rhs[k]));
+ pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
{
- dest = ei_pload<RhsPacket>(b);
+ dest = pload<RhsPacket>(b);
}
EIGEN_STRONG_INLINE void loadLhs(const LhsScalar* a, LhsPacket& dest) const
{
- dest = ei_pload<LhsPacket>(a);
+ dest = pload<LhsPacket>(a);
}
EIGEN_STRONG_INLINE void madd(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp) const
{
- madd_impl(a, b, c, tmp, typename ei_meta_if<Vectorizable,ei_meta_true,ei_meta_false>::ret());
+ madd_impl(a, b, c, tmp, typename conditional<Vectorizable,true_type,false_type>::type());
}
- EIGEN_STRONG_INLINE void madd_impl(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp, const ei_meta_true&) const
+ EIGEN_STRONG_INLINE void madd_impl(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp, const true_type&) const
{
- tmp = b; tmp = ei_pmul(a.v,tmp); c.v = ei_padd(c.v,tmp);
+ tmp = b; tmp = pmul(a.v,tmp); c.v = padd(c.v,tmp);
}
- EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, const ei_meta_false&) const
+ EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, const false_type&) const
{
c += a * b;
}
@@ -330,11 +304,11 @@ public:
}
protected:
- ei_conj_helper<ResPacket,ResPacket,ConjLhs,false> cj;
+ conj_helper<ResPacket,ResPacket,ConjLhs,false> cj;
};
template<typename RealScalar, bool _ConjLhs, bool _ConjRhs>
-class ei_gebp_traits<std::complex<RealScalar>, std::complex<RealScalar>, _ConjLhs, _ConjRhs >
+class gebp_traits<std::complex<RealScalar>, std::complex<RealScalar>, _ConjLhs, _ConjRhs >
{
public:
typedef std::complex<RealScalar> Scalar;
@@ -345,10 +319,10 @@ public:
enum {
ConjLhs = _ConjLhs,
ConjRhs = _ConjRhs,
- Vectorizable = ei_packet_traits<RealScalar>::Vectorizable
- && ei_packet_traits<Scalar>::Vectorizable,
- RealPacketSize = Vectorizable ? ei_packet_traits<RealScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1,
+ Vectorizable = packet_traits<RealScalar>::Vectorizable
+ && packet_traits<Scalar>::Vectorizable,
+ RealPacketSize = Vectorizable ? packet_traits<RealScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1,
nr = 2,
mr = 2 * ResPacketSize,
@@ -358,25 +332,25 @@ public:
RhsProgress = Vectorizable ? 2*ResPacketSize : 1
};
- typedef typename ei_packet_traits<RealScalar>::type RealPacket;
- typedef typename ei_packet_traits<Scalar>::type ScalarPacket;
+ typedef typename packet_traits<RealScalar>::type RealPacket;
+ typedef typename packet_traits<Scalar>::type ScalarPacket;
struct DoublePacket
{
RealPacket first;
RealPacket second;
};
- typedef typename ei_meta_if<Vectorizable,RealPacket, Scalar>::ret LhsPacket;
- typedef typename ei_meta_if<Vectorizable,DoublePacket,Scalar>::ret RhsPacket;
- typedef typename ei_meta_if<Vectorizable,ScalarPacket,Scalar>::ret ResPacket;
- typedef typename ei_meta_if<Vectorizable,DoublePacket,Scalar>::ret AccPacket;
+ typedef typename conditional<Vectorizable,RealPacket, Scalar>::type LhsPacket;
+ typedef typename conditional<Vectorizable,DoublePacket,Scalar>::type RhsPacket;
+ typedef typename conditional<Vectorizable,ScalarPacket,Scalar>::type ResPacket;
+ typedef typename conditional<Vectorizable,DoublePacket,Scalar>::type AccPacket;
EIGEN_STRONG_INLINE void initAcc(Scalar& p) { p = Scalar(0); }
EIGEN_STRONG_INLINE void initAcc(DoublePacket& p)
{
- p.first = ei_pset1<RealPacket>(RealScalar(0));
- p.second = ei_pset1<RealPacket>(RealScalar(0));
+ p.first = pset1<RealPacket>(RealScalar(0));
+ p.second = pset1<RealPacket>(RealScalar(0));
}
/* Unpack the rhs coeff such that each complex coefficient is spread into
@@ -389,8 +363,8 @@ public:
{
if(Vectorizable)
{
- ei_pstore((RealScalar*)&b[k*ResPacketSize*2+0], ei_pset1<RealPacket>(ei_real(rhs[k])));
- ei_pstore((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], ei_pset1<RealPacket>(ei_imag(rhs[k])));
+ pstore((RealScalar*)&b[k*ResPacketSize*2+0], pset1<RealPacket>(real(rhs[k])));
+ pstore((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], pset1<RealPacket>(imag(rhs[k])));
}
else
b[k] = rhs[k];
@@ -401,20 +375,20 @@ public:
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, DoublePacket& dest) const
{
- dest.first = ei_pload<RealPacket>((const RealScalar*)b);
- dest.second = ei_pload<RealPacket>((const RealScalar*)(b+ResPacketSize));
+ dest.first = pload<RealPacket>((const RealScalar*)b);
+ dest.second = pload<RealPacket>((const RealScalar*)(b+ResPacketSize));
}
// nothing special here
EIGEN_STRONG_INLINE void loadLhs(const LhsScalar* a, LhsPacket& dest) const
{
- dest = ei_pload<LhsPacket>((const typename ei_unpacket_traits<LhsPacket>::type*)(a));
+ dest = pload<LhsPacket>((const typename unpacket_traits<LhsPacket>::type*)(a));
}
EIGEN_STRONG_INLINE void madd(const LhsPacket& a, const RhsPacket& b, DoublePacket& c, RhsPacket& /*tmp*/) const
{
- c.first = ei_padd(ei_pmul(a,b.first), c.first);
- c.second = ei_padd(ei_pmul(a,b.second),c.second);
+ c.first = padd(pmul(a,b.first), c.first);
+ c.second = padd(pmul(a,b.second),c.second);
}
EIGEN_STRONG_INLINE void madd(const LhsPacket& a, const RhsPacket& b, ResPacket& c, RhsPacket& /*tmp*/) const
@@ -430,34 +404,34 @@ public:
ResPacket tmp;
if((!ConjLhs)&&(!ConjRhs))
{
- tmp = ei_pcplxflip(ei_pconj(ResPacket(c.second)));
- tmp = ei_padd(ResPacket(c.first),tmp);
+ tmp = pcplxflip(pconj(ResPacket(c.second)));
+ tmp = padd(ResPacket(c.first),tmp);
}
else if((!ConjLhs)&&(ConjRhs))
{
- tmp = ei_pconj(ei_pcplxflip(ResPacket(c.second)));
- tmp = ei_padd(ResPacket(c.first),tmp);
+ tmp = pconj(pcplxflip(ResPacket(c.second)));
+ tmp = padd(ResPacket(c.first),tmp);
}
else if((ConjLhs)&&(!ConjRhs))
{
- tmp = ei_pcplxflip(ResPacket(c.second));
- tmp = ei_padd(ei_pconj(ResPacket(c.first)),tmp);
+ tmp = pcplxflip(ResPacket(c.second));
+ tmp = padd(pconj(ResPacket(c.first)),tmp);
}
else if((ConjLhs)&&(ConjRhs))
{
- tmp = ei_pcplxflip(ResPacket(c.second));
- tmp = ei_psub(ei_pconj(ResPacket(c.first)),tmp);
+ tmp = pcplxflip(ResPacket(c.second));
+ tmp = psub(pconj(ResPacket(c.first)),tmp);
}
- r = ei_pmadd(tmp,alpha,r);
+ r = pmadd(tmp,alpha,r);
}
protected:
- ei_conj_helper<LhsScalar,RhsScalar,ConjLhs,ConjRhs> cj;
+ conj_helper<LhsScalar,RhsScalar,ConjLhs,ConjRhs> cj;
};
template<typename RealScalar, bool _ConjRhs>
-class ei_gebp_traits<RealScalar, std::complex<RealScalar>, false, _ConjRhs >
+class gebp_traits<RealScalar, std::complex<RealScalar>, false, _ConjRhs >
{
public:
typedef std::complex<RealScalar> Scalar;
@@ -468,11 +442,11 @@ public:
enum {
ConjLhs = false,
ConjRhs = _ConjRhs,
- Vectorizable = ei_packet_traits<RealScalar>::Vectorizable
- && ei_packet_traits<Scalar>::Vectorizable,
- LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1,
- RhsPacketSize = Vectorizable ? ei_packet_traits<RhsScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1,
+ Vectorizable = packet_traits<RealScalar>::Vectorizable
+ && packet_traits<Scalar>::Vectorizable,
+ LhsPacketSize = Vectorizable ? packet_traits<LhsScalar>::size : 1,
+ RhsPacketSize = Vectorizable ? packet_traits<RhsScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1,
NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS,
nr = 4,
@@ -483,48 +457,48 @@ public:
RhsProgress = ResPacketSize
};
- typedef typename ei_packet_traits<LhsScalar>::type _LhsPacket;
- typedef typename ei_packet_traits<RhsScalar>::type _RhsPacket;
- typedef typename ei_packet_traits<ResScalar>::type _ResPacket;
+ typedef typename packet_traits<LhsScalar>::type _LhsPacket;
+ typedef typename packet_traits<RhsScalar>::type _RhsPacket;
+ typedef typename packet_traits<ResScalar>::type _ResPacket;
- typedef typename ei_meta_if<Vectorizable,_LhsPacket,LhsScalar>::ret LhsPacket;
- typedef typename ei_meta_if<Vectorizable,_RhsPacket,RhsScalar>::ret RhsPacket;
- typedef typename ei_meta_if<Vectorizable,_ResPacket,ResScalar>::ret ResPacket;
+ typedef typename conditional<Vectorizable,_LhsPacket,LhsScalar>::type LhsPacket;
+ typedef typename conditional<Vectorizable,_RhsPacket,RhsScalar>::type RhsPacket;
+ typedef typename conditional<Vectorizable,_ResPacket,ResScalar>::type ResPacket;
typedef ResPacket AccPacket;
EIGEN_STRONG_INLINE void initAcc(AccPacket& p)
{
- p = ei_pset1<ResPacket>(ResScalar(0));
+ p = pset1<ResPacket>(ResScalar(0));
}
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
- ei_pstore(&b[k*RhsPacketSize], ei_pset1<RhsPacket>(rhs[k]));
+ pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
{
- dest = ei_pload<RhsPacket>(b);
+ dest = pload<RhsPacket>(b);
}
EIGEN_STRONG_INLINE void loadLhs(const LhsScalar* a, LhsPacket& dest) const
{
- dest = ei_ploaddup<LhsPacket>(a);
+ dest = ploaddup<LhsPacket>(a);
}
EIGEN_STRONG_INLINE void madd(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp) const
{
- madd_impl(a, b, c, tmp, typename ei_meta_if<Vectorizable,ei_meta_true,ei_meta_false>::ret());
+ madd_impl(a, b, c, tmp, typename conditional<Vectorizable,true_type,false_type>::type());
}
- EIGEN_STRONG_INLINE void madd_impl(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp, const ei_meta_true&) const
+ EIGEN_STRONG_INLINE void madd_impl(const LhsPacket& a, const RhsPacket& b, AccPacket& c, RhsPacket& tmp, const true_type&) const
{
- tmp = b; tmp.v = ei_pmul(a,tmp.v); c = ei_padd(c,tmp);
+ tmp = b; tmp.v = pmul(a,tmp.v); c = padd(c,tmp);
}
- EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, const ei_meta_false&) const
+ EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, const false_type&) const
{
c += a * b;
}
@@ -535,7 +509,7 @@ public:
}
protected:
- ei_conj_helper<ResPacket,ResPacket,false,ConjRhs> cj;
+ conj_helper<ResPacket,ResPacket,false,ConjRhs> cj;
};
/* optimized GEneral packed Block * packed Panel product kernel
@@ -546,9 +520,9 @@ protected:
* |cplx |real | easy vectorization
*/
template<typename LhsScalar, typename RhsScalar, typename Index, int mr, int nr, bool ConjugateLhs, bool ConjugateRhs>
-struct ei_gebp_kernel
+struct gebp_kernel
{
- typedef ei_gebp_traits<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> Traits;
+ typedef gebp_traits<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> Traits;
typedef typename Traits::ResScalar ResScalar;
typedef typename Traits::LhsPacket LhsPacket;
typedef typename Traits::RhsPacket RhsPacket;
@@ -570,8 +544,8 @@ struct ei_gebp_kernel
if(strideA==-1) strideA = depth;
if(strideB==-1) strideB = depth;
- ei_conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
-// ei_conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
+ conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
+// conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
Index packet_cols = (cols/nr) * nr;
const Index peeled_mc = (rows/mr)*mr;
// FIXME:
@@ -592,7 +566,7 @@ struct ei_gebp_kernel
for(Index i=0; i<peeled_mc; i+=mr)
{
const LhsScalar* blA = &blockA[i*strideA+offsetA*mr];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
// gets res block as register
AccPacket C0, C1, C2, C3, C4, C5, C6, C7;
@@ -610,10 +584,10 @@ struct ei_gebp_kernel
ResScalar* r2 = r1 + resStride;
ResScalar* r3 = r2 + resStride;
- ei_prefetch(r0+16);
- ei_prefetch(r1+16);
- ei_prefetch(r2+16);
- ei_prefetch(r3+16);
+ prefetch(r0+16);
+ prefetch(r1+16);
+ prefetch(r2+16);
+ prefetch(r3+16);
// performs "inner" product
// TODO let's check wether the folowing peeled loop could not be
@@ -781,16 +755,16 @@ EIGEN_ASM_COMMENT("mybegin4");
}
ResPacket R0, R1, R2, R3, R4, R5, R6, R7;
- ResPacket alphav = ei_pset1<ResPacket>(alpha);
+ ResPacket alphav = pset1<ResPacket>(alpha);
- R0 = ei_ploadu<ResPacket>(r0);
- R1 = ei_ploadu<ResPacket>(r1);
- if(nr==4) R2 = ei_ploadu<ResPacket>(r2);
- if(nr==4) R3 = ei_ploadu<ResPacket>(r3);
- R4 = ei_ploadu<ResPacket>(r0 + ResPacketSize);
- R5 = ei_ploadu<ResPacket>(r1 + ResPacketSize);
- if(nr==4) R6 = ei_ploadu<ResPacket>(r2 + ResPacketSize);
- if(nr==4) R7 = ei_ploadu<ResPacket>(r3 + ResPacketSize);
+ R0 = ploadu<ResPacket>(r0);
+ R1 = ploadu<ResPacket>(r1);
+ if(nr==4) R2 = ploadu<ResPacket>(r2);
+ if(nr==4) R3 = ploadu<ResPacket>(r3);
+ R4 = ploadu<ResPacket>(r0 + ResPacketSize);
+ R5 = ploadu<ResPacket>(r1 + ResPacketSize);
+ if(nr==4) R6 = ploadu<ResPacket>(r2 + ResPacketSize);
+ if(nr==4) R7 = ploadu<ResPacket>(r3 + ResPacketSize);
traits.acc(C0, alphav, R0);
traits.acc(C1, alphav, R1);
@@ -801,21 +775,21 @@ EIGEN_ASM_COMMENT("mybegin4");
if(nr==4) traits.acc(C6, alphav, R6);
if(nr==4) traits.acc(C7, alphav, R7);
- ei_pstoreu(r0, R0);
- ei_pstoreu(r1, R1);
- if(nr==4) ei_pstoreu(r2, R2);
- if(nr==4) ei_pstoreu(r3, R3);
- ei_pstoreu(r0 + ResPacketSize, R4);
- ei_pstoreu(r1 + ResPacketSize, R5);
- if(nr==4) ei_pstoreu(r2 + ResPacketSize, R6);
- if(nr==4) ei_pstoreu(r3 + ResPacketSize, R7);
+ pstoreu(r0, R0);
+ pstoreu(r1, R1);
+ if(nr==4) pstoreu(r2, R2);
+ if(nr==4) pstoreu(r3, R3);
+ pstoreu(r0 + ResPacketSize, R4);
+ pstoreu(r1 + ResPacketSize, R5);
+ if(nr==4) pstoreu(r2 + ResPacketSize, R6);
+ if(nr==4) pstoreu(r3 + ResPacketSize, R7);
}
if(rows-peeled_mc>=LhsProgress)
{
Index i = peeled_mc;
const LhsScalar* blA = &blockA[i*strideA+offsetA*LhsProgress];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
// gets res block as register
AccPacket C0, C1, C2, C3;
@@ -939,32 +913,32 @@ EIGEN_ASM_COMMENT("mybegin4");
}
ResPacket R0, R1, R2, R3;
- ResPacket alphav = ei_pset1<ResPacket>(alpha);
+ ResPacket alphav = pset1<ResPacket>(alpha);
ResScalar* r0 = &res[(j2+0)*resStride + i];
ResScalar* r1 = r0 + resStride;
ResScalar* r2 = r1 + resStride;
ResScalar* r3 = r2 + resStride;
- R0 = ei_ploadu<ResPacket>(r0);
- R1 = ei_ploadu<ResPacket>(r1);
- if(nr==4) R2 = ei_ploadu<ResPacket>(r2);
- if(nr==4) R3 = ei_ploadu<ResPacket>(r3);
+ R0 = ploadu<ResPacket>(r0);
+ R1 = ploadu<ResPacket>(r1);
+ if(nr==4) R2 = ploadu<ResPacket>(r2);
+ if(nr==4) R3 = ploadu<ResPacket>(r3);
traits.acc(C0, alphav, R0);
traits.acc(C1, alphav, R1);
if(nr==4) traits.acc(C2, alphav, R2);
if(nr==4) traits.acc(C3, alphav, R3);
- ei_pstoreu(r0, R0);
- ei_pstoreu(r1, R1);
- if(nr==4) ei_pstoreu(r2, R2);
- if(nr==4) ei_pstoreu(r3, R3);
+ pstoreu(r0, R0);
+ pstoreu(r1, R1);
+ if(nr==4) pstoreu(r2, R2);
+ if(nr==4) pstoreu(r3, R3);
}
for(Index i=peeled_mc2; i<rows; i++)
{
const LhsScalar* blA = &blockA[i*strideA+offsetA];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
// gets a 1 x nr res block as registers
ResScalar C0(0), C1(0), C2(0), C3(0);
@@ -1017,13 +991,13 @@ EIGEN_ASM_COMMENT("mybegin4");
traits.unpackRhs(depth, &blockB[j2*strideB+offsetB], unpackedB);
// const RhsScalar* blB = &blockB[j2*strideB+offsetB];
// for(Index k=0; k<depth; k++)
-// ei_pstore(&unpackedB[k*RhsPacketSize], ei_pset1<RhsPacket>(blB[k]));
+// pstore(&unpackedB[k*RhsPacketSize], pset1<RhsPacket>(blB[k]));
}
for(Index i=0; i<peeled_mc; i+=mr)
{
const LhsScalar* blA = &blockA[i*strideA+offsetA*mr];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
// TODO move the res loads to the stores
@@ -1049,24 +1023,24 @@ EIGEN_ASM_COMMENT("mybegin4");
blA += 2*LhsProgress;
}
ResPacket R0, R4;
- ResPacket alphav = ei_pset1<ResPacket>(alpha);
+ ResPacket alphav = pset1<ResPacket>(alpha);
ResScalar* r0 = &res[(j2+0)*resStride + i];
- R0 = ei_ploadu<ResPacket>(r0);
- R4 = ei_ploadu<ResPacket>(r0+ResPacketSize);
+ R0 = ploadu<ResPacket>(r0);
+ R4 = ploadu<ResPacket>(r0+ResPacketSize);
traits.acc(C0, alphav, R0);
traits.acc(C4, alphav, R4);
- ei_pstoreu(r0, R0);
- ei_pstoreu(r0+ResPacketSize, R4);
+ pstoreu(r0, R0);
+ pstoreu(r0+ResPacketSize, R4);
}
if(rows-peeled_mc>=LhsProgress)
{
Index i = peeled_mc;
const LhsScalar* blA = &blockA[i*strideA+offsetA*LhsProgress];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
AccPacket C0;
traits.initAcc(C0);
@@ -1083,15 +1057,15 @@ EIGEN_ASM_COMMENT("mybegin4");
blA += LhsProgress;
}
- ResPacket alphav = ei_pset1<ResPacket>(alpha);
- ResPacket R0 = ei_ploadu<ResPacket>(&res[(j2+0)*resStride + i]);
+ ResPacket alphav = pset1<ResPacket>(alpha);
+ ResPacket R0 = ploadu<ResPacket>(&res[(j2+0)*resStride + i]);
traits.acc(C0, alphav, R0);
- ei_pstoreu(&res[(j2+0)*resStride + i], R0);
+ pstoreu(&res[(j2+0)*resStride + i], R0);
}
for(Index i=peeled_mc2; i<rows; i++)
{
const LhsScalar* blA = &blockA[i*strideA+offsetA];
- ei_prefetch(&blA[0]);
+ prefetch(&blA[0]);
// gets a 1 x 1 res block as registers
ResScalar C0(0);
@@ -1126,15 +1100,15 @@ EIGEN_ASM_COMMENT("mybegin4");
// 32 33 34 35 ...
// 36 36 38 39 ...
template<typename Scalar, typename Index, int Pack1, int Pack2, int StorageOrder, bool Conjugate, bool PanelMode>
-struct ei_gemm_pack_lhs
+struct gemm_pack_lhs
{
void operator()(Scalar* blockA, const Scalar* EIGEN_RESTRICT _lhs, Index lhsStride, Index depth, Index rows,
Index stride=0, Index offset=0)
{
-// enum { PacketSize = ei_packet_traits<Scalar>::size };
- ei_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
- ei_conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
- ei_const_blas_data_mapper<Scalar, Index, StorageOrder> lhs(_lhs,lhsStride);
+// enum { PacketSize = packet_traits<Scalar>::size };
+ eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
+ conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
+ const_blas_data_mapper<Scalar, Index, StorageOrder> lhs(_lhs,lhsStride);
Index count = 0;
Index peeled_mc = (rows/Pack1)*Pack1;
for(Index i=0; i<peeled_mc; i+=Pack1)
@@ -1172,15 +1146,15 @@ struct ei_gemm_pack_lhs
// 8 9 10 11 20 21 22 23 26 29
// . . . . . . . . . .
template<typename Scalar, typename Index, int nr, bool Conjugate, bool PanelMode>
-struct ei_gemm_pack_rhs<Scalar, Index, nr, ColMajor, Conjugate, PanelMode>
+struct gemm_pack_rhs<Scalar, Index, nr, ColMajor, Conjugate, PanelMode>
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- enum { PacketSize = ei_packet_traits<Scalar>::size };
+ typedef typename packet_traits<Scalar>::type Packet;
+ enum { PacketSize = packet_traits<Scalar>::size };
void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
Index stride=0, Index offset=0)
{
- ei_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
- ei_conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
+ eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
+ conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
Index packet_cols = (cols/nr) * nr;
Index count = 0;
for(Index j2=0; j2<packet_cols; j2+=nr)
@@ -1220,14 +1194,14 @@ struct ei_gemm_pack_rhs<Scalar, Index, nr, ColMajor, Conjugate, PanelMode>
// this version is optimized for row major matrices
template<typename Scalar, typename Index, int nr, bool Conjugate, bool PanelMode>
-struct ei_gemm_pack_rhs<Scalar, Index, nr, RowMajor, Conjugate, PanelMode>
+struct gemm_pack_rhs<Scalar, Index, nr, RowMajor, Conjugate, PanelMode>
{
- enum { PacketSize = ei_packet_traits<Scalar>::size };
+ enum { PacketSize = packet_traits<Scalar>::size };
void operator()(Scalar* blockB, const Scalar* rhs, Index rhsStride, Index depth, Index cols,
Index stride=0, Index offset=0)
{
- ei_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
- ei_conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
+ eigen_assert(((!PanelMode) && stride==0 && offset==0) || (PanelMode && stride>=depth && offset<=stride));
+ conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
Index packet_cols = (cols/nr) * nr;
Index count = 0;
for(Index j2=0; j2<packet_cols; j2+=nr)
@@ -1261,4 +1235,34 @@ struct ei_gemm_pack_rhs<Scalar, Index, nr, RowMajor, Conjugate, PanelMode>
}
};
+} // end namespace internal
+
+/** \returns the currently set level 1 cpu cache size (in bytes) used to estimate the ideal blocking size parameters.
+ * \sa setCpuCacheSize */
+inline std::ptrdiff_t l1CacheSize()
+{
+ std::ptrdiff_t l1, l2;
+ internal::manage_caching_sizes(GetAction, &l1, &l2);
+ return l1;
+}
+
+/** \returns the currently set level 2 cpu cache size (in bytes) used to estimate the ideal blocking size parameters.
+ * \sa setCpuCacheSize */
+inline std::ptrdiff_t l2CacheSize()
+{
+ std::ptrdiff_t l1, l2;
+ internal::manage_caching_sizes(GetAction, &l1, &l2);
+ return l2;
+}
+
+/** Set the cpu L1 and L2 cache sizes (in bytes).
+ * These values are use to adjust the size of the blocks
+ * for the algorithms working per blocks.
+ *
+ * \sa computeProductBlockingSizes */
+inline void setCpuCacheSizes(std::ptrdiff_t l1, std::ptrdiff_t l2)
+{
+ internal::manage_caching_sizes(SetAction, &l1, &l2);
+}
+
#endif // EIGEN_GENERAL_BLOCK_PANEL_H
diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h
index 1cdfb84d1..d1bee31cc 100644
--- a/Eigen/src/Core/products/GeneralMatrixMatrix.h
+++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h
@@ -25,27 +25,29 @@
#ifndef EIGEN_GENERAL_MATRIX_MATRIX_H
#define EIGEN_GENERAL_MATRIX_MATRIX_H
-template<typename _LhsScalar, typename _RhsScalar> class ei_level3_blocking;
+namespace internal {
+
+template<typename _LhsScalar, typename _RhsScalar> class level3_blocking;
/* Specialization for a row-major destination matrix => simple transposition of the product */
template<
typename Index,
typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs>
-struct ei_general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor>
+struct general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor>
{
- typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
static EIGEN_STRONG_INLINE void run(
Index rows, Index cols, Index depth,
const LhsScalar* lhs, Index lhsStride,
const RhsScalar* rhs, Index rhsStride,
ResScalar* res, Index resStride,
ResScalar alpha,
- ei_level3_blocking<RhsScalar,LhsScalar>& blocking,
+ level3_blocking<RhsScalar,LhsScalar>& blocking,
GemmParallelInfo<Index>* info = 0)
{
// transpose the product such that the result is column major
- ei_general_matrix_matrix_product<Index,
+ general_matrix_matrix_product<Index,
RhsScalar, RhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateRhs,
LhsScalar, LhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateLhs,
ColMajor>
@@ -59,29 +61,29 @@ template<
typename Index,
typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs>
-struct ei_general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor>
+struct general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor>
{
-typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
static void run(Index rows, Index cols, Index depth,
const LhsScalar* _lhs, Index lhsStride,
const RhsScalar* _rhs, Index rhsStride,
ResScalar* res, Index resStride,
ResScalar alpha,
- ei_level3_blocking<LhsScalar,RhsScalar>& blocking,
+ level3_blocking<LhsScalar,RhsScalar>& blocking,
GemmParallelInfo<Index>* info = 0)
{
- ei_const_blas_data_mapper<LhsScalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
- ei_const_blas_data_mapper<RhsScalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
+ const_blas_data_mapper<LhsScalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<RhsScalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
- typedef ei_gebp_traits<LhsScalar,RhsScalar> Traits;
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
Index kc = blocking.kc(); // cache block size along the K direction
Index mc = std::min(rows,blocking.mc()); // cache block size along the M direction
//Index nc = blocking.nc(); // cache block size along the N direction
- ei_gemm_pack_lhs<LhsScalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
- ei_gemm_pack_rhs<RhsScalar, Index, Traits::nr, RhsStorageOrder> pack_rhs;
- ei_gebp_kernel<LhsScalar, RhsScalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp;
+ gemm_pack_lhs<LhsScalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
+ gemm_pack_rhs<RhsScalar, Index, Traits::nr, RhsStorageOrder> pack_rhs;
+ gebp_kernel<LhsScalar, RhsScalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp;
#ifdef EIGEN_HAS_OPENMP
if(info)
@@ -89,12 +91,13 @@ static void run(Index rows, Index cols, Index depth,
// this is the parallel version!
Index tid = omp_get_thread_num();
Index threads = omp_get_num_threads();
-
- LhsScalar* blockA = ei_aligned_stack_new(LhsScalar, kc*mc);
+
+ std::size_t sizeA = kc*mc;
std::size_t sizeW = kc*Traits::WorkSpaceFactor;
+ LhsScalar* blockA = ei_aligned_stack_new(LhsScalar, sizeA);
RhsScalar* w = ei_aligned_stack_new(RhsScalar, sizeW);
RhsScalar* blockB = blocking.blockB();
- ei_internal_assert(blockB!=0);
+ eigen_internal_assert(blockB!=0);
// For each horizontal panel of the rhs, and corresponding vertical panel of the lhs...
for(Index k=0; k<depth; k+=kc)
@@ -114,7 +117,7 @@ static void run(Index rows, Index cols, Index depth,
while(info[tid].users!=0) {}
info[tid].users += threads;
- pack_rhs(blockB+info[tid].rhs_start*kc, &rhs(k,info[tid].rhs_start), rhsStride, actual_kc, info[tid].rhs_length);
+ pack_rhs(blockB+info[tid].rhs_start*actual_kc, &rhs(k,info[tid].rhs_start), rhsStride, actual_kc, info[tid].rhs_length);
// Notify the other threads that the part B'_j is ready to go.
info[tid].sync = k;
@@ -130,7 +133,7 @@ static void run(Index rows, Index cols, Index depth,
if(shift>0)
while(info[j].sync!=k) {}
- gebp(res+info[j].rhs_start*resStride, resStride, blockA, blockB+info[j].rhs_start*kc, mc, actual_kc, info[j].rhs_length, alpha, -1,-1,0,0, w);
+ gebp(res+info[j].rhs_start*resStride, resStride, blockA, blockB+info[j].rhs_start*actual_kc, mc, actual_kc, info[j].rhs_length, alpha, -1,-1,0,0, w);
}
// Then keep going as usual with the remaining A'
@@ -198,7 +201,7 @@ static void run(Index rows, Index cols, Index depth,
}
}
- if(blocking.blockA()==0) ei_aligned_stack_delete(LhsScalar, blockA, kc*mc);
+ if(blocking.blockA()==0) ei_aligned_stack_delete(LhsScalar, blockA, sizeA);
if(blocking.blockB()==0) ei_aligned_stack_delete(RhsScalar, blockB, sizeB);
if(blocking.blockW()==0) ei_aligned_stack_delete(RhsScalar, blockW, sizeW);
}
@@ -208,18 +211,18 @@ static void run(Index rows, Index cols, Index depth,
/*********************************************************************************
* Specialization of GeneralProduct<> for "large" GEMM, i.e.,
-* implementation of the high level wrapper to ei_general_matrix_matrix_product
+* implementation of the high level wrapper to general_matrix_matrix_product
**********************************************************************************/
template<typename Lhs, typename Rhs>
-struct ei_traits<GeneralProduct<Lhs,Rhs,GemmProduct> >
- : ei_traits<ProductBase<GeneralProduct<Lhs,Rhs,GemmProduct>, Lhs, Rhs> >
+struct traits<GeneralProduct<Lhs,Rhs,GemmProduct> >
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemmProduct>, Lhs, Rhs> >
{};
template<typename Scalar, typename Index, typename Gemm, typename Lhs, typename Rhs, typename Dest, typename BlockingType>
-struct ei_gemm_functor
+struct gemm_functor
{
- ei_gemm_functor(const Lhs& lhs, const Rhs& rhs, Dest& dest, Scalar actualAlpha,
+ gemm_functor(const Lhs& lhs, const Rhs& rhs, Dest& dest, Scalar actualAlpha,
BlockingType& blocking)
: m_lhs(lhs), m_rhs(rhs), m_dest(dest), m_actualAlpha(actualAlpha), m_blocking(blocking)
{}
@@ -250,10 +253,10 @@ struct ei_gemm_functor
};
template<int StorageOrder, typename LhsScalar, typename RhsScalar, int MaxRows, int MaxCols, int MaxDepth,
-bool FiniteAtCompileTime = MaxRows!=Dynamic && MaxCols!=Dynamic && MaxDepth != Dynamic> class ei_gemm_blocking_space;
+bool FiniteAtCompileTime = MaxRows!=Dynamic && MaxCols!=Dynamic && MaxDepth != Dynamic> class gemm_blocking_space;
template<typename _LhsScalar, typename _RhsScalar>
-class ei_level3_blocking
+class level3_blocking
{
typedef _LhsScalar LhsScalar;
typedef _RhsScalar RhsScalar;
@@ -269,7 +272,7 @@ class ei_level3_blocking
public:
- ei_level3_blocking()
+ level3_blocking()
: m_blockA(0), m_blockB(0), m_blockW(0), m_mc(0), m_nc(0), m_kc(0)
{}
@@ -283,19 +286,19 @@ class ei_level3_blocking
};
template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth>
-class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, true>
- : public ei_level3_blocking<
- typename ei_meta_if<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::ret,
- typename ei_meta_if<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::ret>
+class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, true>
+ : public level3_blocking<
+ typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
+ typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
{
enum {
Transpose = StorageOrder==RowMajor,
ActualRows = Transpose ? MaxCols : MaxRows,
ActualCols = Transpose ? MaxRows : MaxCols
};
- typedef typename ei_meta_if<Transpose,_RhsScalar,_LhsScalar>::ret LhsScalar;
- typedef typename ei_meta_if<Transpose,_LhsScalar,_RhsScalar>::ret RhsScalar;
- typedef ei_gebp_traits<LhsScalar,RhsScalar> Traits;
+ typedef typename conditional<Transpose,_RhsScalar,_LhsScalar>::type LhsScalar;
+ typedef typename conditional<Transpose,_LhsScalar,_RhsScalar>::type RhsScalar;
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
enum {
SizeA = ActualRows * MaxDepth,
SizeB = ActualCols * MaxDepth,
@@ -308,7 +311,7 @@ class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols
public:
- ei_gemm_blocking_space(DenseIndex /*rows*/, DenseIndex /*cols*/, DenseIndex /*depth*/)
+ gemm_blocking_space(DenseIndex /*rows*/, DenseIndex /*cols*/, DenseIndex /*depth*/)
{
this->m_mc = ActualRows;
this->m_nc = ActualCols;
@@ -325,17 +328,17 @@ class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols
};
template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth>
-class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, false>
- : public ei_level3_blocking<
- typename ei_meta_if<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::ret,
- typename ei_meta_if<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::ret>
+class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, false>
+ : public level3_blocking<
+ typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
+ typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
{
enum {
Transpose = StorageOrder==RowMajor
};
- typedef typename ei_meta_if<Transpose,_RhsScalar,_LhsScalar>::ret LhsScalar;
- typedef typename ei_meta_if<Transpose,_LhsScalar,_RhsScalar>::ret RhsScalar;
- typedef ei_gebp_traits<LhsScalar,RhsScalar> Traits;
+ typedef typename conditional<Transpose,_RhsScalar,_LhsScalar>::type LhsScalar;
+ typedef typename conditional<Transpose,_LhsScalar,_RhsScalar>::type RhsScalar;
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
DenseIndex m_sizeA;
DenseIndex m_sizeB;
@@ -343,7 +346,7 @@ class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols
public:
- ei_gemm_blocking_space(DenseIndex rows, DenseIndex cols, DenseIndex depth)
+ gemm_blocking_space(DenseIndex rows, DenseIndex cols, DenseIndex depth)
{
this->m_mc = Transpose ? cols : rows;
this->m_nc = Transpose ? rows : cols;
@@ -358,19 +361,19 @@ class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols
void allocateA()
{
if(this->m_blockA==0)
- this->m_blockA = ei_aligned_new<LhsScalar>(m_sizeA);
+ this->m_blockA = aligned_new<LhsScalar>(m_sizeA);
}
void allocateB()
{
if(this->m_blockB==0)
- this->m_blockB = ei_aligned_new<RhsScalar>(m_sizeB);
+ this->m_blockB = aligned_new<RhsScalar>(m_sizeB);
}
void allocateW()
{
if(this->m_blockW==0)
- this->m_blockW = ei_aligned_new<RhsScalar>(m_sizeW);
+ this->m_blockW = aligned_new<RhsScalar>(m_sizeW);
}
void allocateAll()
@@ -380,14 +383,16 @@ class ei_gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols
allocateW();
}
- ~ei_gemm_blocking_space()
+ ~gemm_blocking_space()
{
- ei_aligned_delete(this->m_blockA, m_sizeA);
- ei_aligned_delete(this->m_blockB, m_sizeB);
- ei_aligned_delete(this->m_blockW, m_sizeW);
+ aligned_delete(this->m_blockA, m_sizeA);
+ aligned_delete(this->m_blockB, m_sizeB);
+ aligned_delete(this->m_blockW, m_sizeW);
}
};
+} // end namespace internal
+
template<typename Lhs, typename Rhs>
class GeneralProduct<Lhs, Rhs, GemmProduct>
: public ProductBase<GeneralProduct<Lhs,Rhs,GemmProduct>, Lhs, Rhs>
@@ -404,13 +409,13 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
{
- typedef ei_scalar_product_op<LhsScalar,RhsScalar> BinOp;
+ typedef internal::scalar_product_op<LhsScalar,RhsScalar> BinOp;
EIGEN_CHECK_BINARY_COMPATIBILIY(BinOp,LhsScalar,RhsScalar);
}
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -418,12 +423,12 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- typedef ei_gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,LhsScalar,RhsScalar,
+ typedef internal::gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,LhsScalar,RhsScalar,
Dest::MaxRowsAtCompileTime,Dest::MaxColsAtCompileTime,MaxDepthAtCompileTime> BlockingType;
- typedef ei_gemm_functor<
+ typedef internal::gemm_functor<
Scalar, Index,
- ei_general_matrix_matrix_product<
+ internal::general_matrix_matrix_product<
Index,
LhsScalar, (_ActualLhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(LhsBlasTraits::NeedToConjugate),
RhsScalar, (_ActualRhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(RhsBlasTraits::NeedToConjugate),
@@ -432,7 +437,7 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
BlockingType blocking(dst.rows(), dst.cols(), lhs.cols());
- ei_parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), this->rows(), this->cols(), Dest::Flags&RowMajorBit);
+ internal::parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), this->rows(), this->cols(), Dest::Flags&RowMajorBit);
}
};
diff --git a/Eigen/src/Core/products/GeneralMatrixVector.h b/Eigen/src/Core/products/GeneralMatrixVector.h
index 96a038b05..540638b5a 100644
--- a/Eigen/src/Core/products/GeneralMatrixVector.h
+++ b/Eigen/src/Core/products/GeneralMatrixVector.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_GENERAL_MATRIX_VECTOR_H
#define EIGEN_GENERAL_MATRIX_VECTOR_H
+namespace internal {
+
/* Optimized col-major matrix * vector product:
* This algorithm processes 4 columns at onces that allows to both reduce
* the number of load/stores of the result by a factor 4 and to reduce
@@ -39,25 +41,25 @@
* |cplx |real |real | optimal case, vectorization possible via real-cplx mul
*/
template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
-struct ei_general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
+struct general_matrix_vector_product<Index,LhsScalar,ColMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
{
-typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
- Vectorizable = ei_packet_traits<LhsScalar>::Vectorizable && ei_packet_traits<RhsScalar>::Vectorizable
- && int(ei_packet_traits<LhsScalar>::size)==int(ei_packet_traits<RhsScalar>::size),
- LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1,
- RhsPacketSize = Vectorizable ? ei_packet_traits<RhsScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1
+ Vectorizable = packet_traits<LhsScalar>::Vectorizable && packet_traits<RhsScalar>::Vectorizable
+ && int(packet_traits<LhsScalar>::size)==int(packet_traits<RhsScalar>::size),
+ LhsPacketSize = Vectorizable ? packet_traits<LhsScalar>::size : 1,
+ RhsPacketSize = Vectorizable ? packet_traits<RhsScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1
};
-typedef typename ei_packet_traits<LhsScalar>::type _LhsPacket;
-typedef typename ei_packet_traits<RhsScalar>::type _RhsPacket;
-typedef typename ei_packet_traits<ResScalar>::type _ResPacket;
+typedef typename packet_traits<LhsScalar>::type _LhsPacket;
+typedef typename packet_traits<RhsScalar>::type _RhsPacket;
+typedef typename packet_traits<ResScalar>::type _ResPacket;
-typedef typename ei_meta_if<Vectorizable,_LhsPacket,LhsScalar>::ret LhsPacket;
-typedef typename ei_meta_if<Vectorizable,_RhsPacket,RhsScalar>::ret RhsPacket;
-typedef typename ei_meta_if<Vectorizable,_ResPacket,ResScalar>::ret ResPacket;
+typedef typename conditional<Vectorizable,_LhsPacket,LhsScalar>::type LhsPacket;
+typedef typename conditional<Vectorizable,_RhsPacket,RhsScalar>::type RhsPacket;
+typedef typename conditional<Vectorizable,_ResPacket,ResScalar>::type ResPacket;
EIGEN_DONT_INLINE static void run(
Index rows, Index cols,
@@ -69,23 +71,23 @@ EIGEN_DONT_INLINE static void run(
#endif
, RhsScalar alpha)
{
- ei_internal_assert(resIncr==1);
+ eigen_internal_assert(resIncr==1);
#ifdef _EIGEN_ACCUMULATE_PACKETS
#error _EIGEN_ACCUMULATE_PACKETS has already been defined
#endif
#define _EIGEN_ACCUMULATE_PACKETS(A0,A13,A2) \
- ei_pstore(&res[j], \
- ei_padd(ei_pload<ResPacket>(&res[j]), \
- ei_padd( \
- ei_padd(pcj.pmul(EIGEN_CAT(ei_ploa , A0)<LhsPacket>(&lhs0[j]), ptmp0), \
- pcj.pmul(EIGEN_CAT(ei_ploa , A13)<LhsPacket>(&lhs1[j]), ptmp1)), \
- ei_padd(pcj.pmul(EIGEN_CAT(ei_ploa , A2)<LhsPacket>(&lhs2[j]), ptmp2), \
- pcj.pmul(EIGEN_CAT(ei_ploa , A13)<LhsPacket>(&lhs3[j]), ptmp3)) )))
-
- ei_conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
- ei_conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
+ pstore(&res[j], \
+ padd(pload<ResPacket>(&res[j]), \
+ padd( \
+ padd(pcj.pmul(EIGEN_CAT(ploa , A0)<LhsPacket>(&lhs0[j]), ptmp0), \
+ pcj.pmul(EIGEN_CAT(ploa , A13)<LhsPacket>(&lhs1[j]), ptmp1)), \
+ padd(pcj.pmul(EIGEN_CAT(ploa , A2)<LhsPacket>(&lhs2[j]), ptmp2), \
+ pcj.pmul(EIGEN_CAT(ploa , A13)<LhsPacket>(&lhs3[j]), ptmp3)) )))
+
+ conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
+ conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
if(ConjugateRhs)
- alpha = ei_conj(alpha);
+ alpha = conj(alpha);
enum { AllAligned = 0, EvenAligned, FirstAligned, NoneAligned };
const Index columnsAtOnce = 4;
@@ -97,7 +99,7 @@ EIGEN_DONT_INLINE static void run(
// How many coeffs of the result do we have to skip to be aligned.
// Here we assume data are at least aligned on the base scalar type.
- Index alignedStart = ei_first_aligned(res,size);
+ Index alignedStart = first_aligned(res,size);
Index alignedSize = ResPacketSize>1 ? alignedStart + ((size-alignedStart) & ~ResPacketAlignedMask) : 0;
const Index peeledSize = peels>1 ? alignedStart + ((alignedSize-alignedStart) & ~PeelAlignedMask) : alignedStart;
@@ -107,7 +109,7 @@ EIGEN_DONT_INLINE static void run(
: FirstAligned;
// we cannot assume the first element is aligned because of sub-matrices
- const Index lhsAlignmentOffset = ei_first_aligned(lhs,size);
+ const Index lhsAlignmentOffset = first_aligned(lhs,size);
// find how many columns do we have to skip to be aligned with the result (if possible)
Index skipColumns = 0;
@@ -119,7 +121,7 @@ EIGEN_DONT_INLINE static void run(
}
else if (LhsPacketSize>1)
{
- ei_internal_assert(size_t(lhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0 || size<LhsPacketSize);
+ eigen_internal_assert(size_t(lhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0 || size<LhsPacketSize);
while (skipColumns<LhsPacketSize &&
alignedStart != ((lhsAlignmentOffset + alignmentStep*skipColumns)%LhsPacketSize))
@@ -136,7 +138,7 @@ EIGEN_DONT_INLINE static void run(
// note that the skiped columns are processed later.
}
- ei_internal_assert( (alignmentPattern==NoneAligned)
+ eigen_internal_assert( (alignmentPattern==NoneAligned)
|| (skipColumns + columnsAtOnce >= cols)
|| LhsPacketSize > size
|| (size_t(lhs+alignedStart+lhsStride*skipColumns)%sizeof(LhsPacket))==0);
@@ -154,10 +156,10 @@ EIGEN_DONT_INLINE static void run(
Index columnBound = ((cols-skipColumns)/columnsAtOnce)*columnsAtOnce + skipColumns;
for (Index i=skipColumns; i<columnBound; i+=columnsAtOnce)
{
- RhsPacket ptmp0 = ei_pset1<RhsPacket>(alpha*rhs[i*rhsIncr]),
- ptmp1 = ei_pset1<RhsPacket>(alpha*rhs[(i+offset1)*rhsIncr]),
- ptmp2 = ei_pset1<RhsPacket>(alpha*rhs[(i+2)*rhsIncr]),
- ptmp3 = ei_pset1<RhsPacket>(alpha*rhs[(i+offset3)*rhsIncr]);
+ RhsPacket ptmp0 = pset1<RhsPacket>(alpha*rhs[i*rhsIncr]),
+ ptmp1 = pset1<RhsPacket>(alpha*rhs[(i+offset1)*rhsIncr]),
+ ptmp2 = pset1<RhsPacket>(alpha*rhs[(i+2)*rhsIncr]),
+ ptmp3 = pset1<RhsPacket>(alpha*rhs[(i+offset3)*rhsIncr]);
// this helps a lot generating better binary code
const LhsScalar *lhs0 = lhs + i*lhsStride, *lhs1 = lhs + (i+offset1)*lhsStride,
@@ -169,10 +171,10 @@ EIGEN_DONT_INLINE static void run(
// process initial unaligned coeffs
for (Index j=0; j<alignedStart; ++j)
{
- res[j] = cj.pmadd(lhs0[j], ei_pfirst(ptmp0), res[j]);
- res[j] = cj.pmadd(lhs1[j], ei_pfirst(ptmp1), res[j]);
- res[j] = cj.pmadd(lhs2[j], ei_pfirst(ptmp2), res[j]);
- res[j] = cj.pmadd(lhs3[j], ei_pfirst(ptmp3), res[j]);
+ res[j] = cj.pmadd(lhs0[j], pfirst(ptmp0), res[j]);
+ res[j] = cj.pmadd(lhs1[j], pfirst(ptmp1), res[j]);
+ res[j] = cj.pmadd(lhs2[j], pfirst(ptmp2), res[j]);
+ res[j] = cj.pmadd(lhs3[j], pfirst(ptmp3), res[j]);
}
if (alignedSize>alignedStart)
@@ -193,32 +195,32 @@ EIGEN_DONT_INLINE static void run(
LhsPacket A00, A01, A02, A03, A10, A11, A12, A13;
ResPacket T0, T1;
- A01 = ei_pload<LhsPacket>(&lhs1[alignedStart-1]);
- A02 = ei_pload<LhsPacket>(&lhs2[alignedStart-2]);
- A03 = ei_pload<LhsPacket>(&lhs3[alignedStart-3]);
+ A01 = pload<LhsPacket>(&lhs1[alignedStart-1]);
+ A02 = pload<LhsPacket>(&lhs2[alignedStart-2]);
+ A03 = pload<LhsPacket>(&lhs3[alignedStart-3]);
for (Index j = alignedStart; j<peeledSize; j+=peels*ResPacketSize)
{
- A11 = ei_pload<LhsPacket>(&lhs1[j-1+LhsPacketSize]); ei_palign<1>(A01,A11);
- A12 = ei_pload<LhsPacket>(&lhs2[j-2+LhsPacketSize]); ei_palign<2>(A02,A12);
- A13 = ei_pload<LhsPacket>(&lhs3[j-3+LhsPacketSize]); ei_palign<3>(A03,A13);
+ A11 = pload<LhsPacket>(&lhs1[j-1+LhsPacketSize]); palign<1>(A01,A11);
+ A12 = pload<LhsPacket>(&lhs2[j-2+LhsPacketSize]); palign<2>(A02,A12);
+ A13 = pload<LhsPacket>(&lhs3[j-3+LhsPacketSize]); palign<3>(A03,A13);
- A00 = ei_pload<LhsPacket>(&lhs0[j]);
- A10 = ei_pload<LhsPacket>(&lhs0[j+LhsPacketSize]);
- T0 = pcj.pmadd(A00, ptmp0, ei_pload<ResPacket>(&res[j]));
- T1 = pcj.pmadd(A10, ptmp0, ei_pload<ResPacket>(&res[j+ResPacketSize]));
+ A00 = pload<LhsPacket>(&lhs0[j]);
+ A10 = pload<LhsPacket>(&lhs0[j+LhsPacketSize]);
+ T0 = pcj.pmadd(A00, ptmp0, pload<ResPacket>(&res[j]));
+ T1 = pcj.pmadd(A10, ptmp0, pload<ResPacket>(&res[j+ResPacketSize]));
T0 = pcj.pmadd(A01, ptmp1, T0);
- A01 = ei_pload<LhsPacket>(&lhs1[j-1+2*LhsPacketSize]); ei_palign<1>(A11,A01);
+ A01 = pload<LhsPacket>(&lhs1[j-1+2*LhsPacketSize]); palign<1>(A11,A01);
T0 = pcj.pmadd(A02, ptmp2, T0);
- A02 = ei_pload<LhsPacket>(&lhs2[j-2+2*LhsPacketSize]); ei_palign<2>(A12,A02);
+ A02 = pload<LhsPacket>(&lhs2[j-2+2*LhsPacketSize]); palign<2>(A12,A02);
T0 = pcj.pmadd(A03, ptmp3, T0);
- ei_pstore(&res[j],T0);
- A03 = ei_pload<LhsPacket>(&lhs3[j-3+2*LhsPacketSize]); ei_palign<3>(A13,A03);
+ pstore(&res[j],T0);
+ A03 = pload<LhsPacket>(&lhs3[j-3+2*LhsPacketSize]); palign<3>(A13,A03);
T1 = pcj.pmadd(A11, ptmp1, T1);
T1 = pcj.pmadd(A12, ptmp2, T1);
T1 = pcj.pmadd(A13, ptmp3, T1);
- ei_pstore(&res[j+ResPacketSize],T1);
+ pstore(&res[j+ResPacketSize],T1);
}
}
for (Index j = peeledSize; j<alignedSize; j+=ResPacketSize)
@@ -235,10 +237,10 @@ EIGEN_DONT_INLINE static void run(
/* process remaining coeffs (or all if there is no explicit vectorization) */
for (Index j=alignedSize; j<size; ++j)
{
- res[j] = cj.pmadd(lhs0[j], ei_pfirst(ptmp0), res[j]);
- res[j] = cj.pmadd(lhs1[j], ei_pfirst(ptmp1), res[j]);
- res[j] = cj.pmadd(lhs2[j], ei_pfirst(ptmp2), res[j]);
- res[j] = cj.pmadd(lhs3[j], ei_pfirst(ptmp3), res[j]);
+ res[j] = cj.pmadd(lhs0[j], pfirst(ptmp0), res[j]);
+ res[j] = cj.pmadd(lhs1[j], pfirst(ptmp1), res[j]);
+ res[j] = cj.pmadd(lhs2[j], pfirst(ptmp2), res[j]);
+ res[j] = cj.pmadd(lhs3[j], pfirst(ptmp3), res[j]);
}
}
@@ -249,7 +251,7 @@ EIGEN_DONT_INLINE static void run(
{
for (Index k=start; k<end; ++k)
{
- RhsPacket ptmp0 = ei_pset1<RhsPacket>(alpha*rhs[k*rhsIncr]);
+ RhsPacket ptmp0 = pset1<RhsPacket>(alpha*rhs[k*rhsIncr]);
const LhsScalar* lhs0 = lhs + k*lhsStride;
if (Vectorizable)
@@ -257,19 +259,19 @@ EIGEN_DONT_INLINE static void run(
/* explicit vectorization */
// process first unaligned result's coeffs
for (Index j=0; j<alignedStart; ++j)
- res[j] += cj.pmul(lhs0[j], ei_pfirst(ptmp0));
+ res[j] += cj.pmul(lhs0[j], pfirst(ptmp0));
// process aligned result's coeffs
if ((size_t(lhs0+alignedStart)%sizeof(LhsPacket))==0)
for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)
- ei_pstore(&res[i], pcj.pmadd(ei_ploadu<LhsPacket>(&lhs0[i]), ptmp0, ei_pload<ResPacket>(&res[i])));
+ pstore(&res[i], pcj.pmadd(ploadu<LhsPacket>(&lhs0[i]), ptmp0, pload<ResPacket>(&res[i])));
else
for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)
- ei_pstore(&res[i], pcj.pmadd(ei_ploadu<LhsPacket>(&lhs0[i]), ptmp0, ei_pload<ResPacket>(&res[i])));
+ pstore(&res[i], pcj.pmadd(ploadu<LhsPacket>(&lhs0[i]), ptmp0, pload<ResPacket>(&res[i])));
}
// process remaining scalars (or all if no explicit vectorization)
for (Index i=alignedSize; i<size; ++i)
- res[i] += cj.pmul(lhs0[i], ei_pfirst(ptmp0));
+ res[i] += cj.pmul(lhs0[i], pfirst(ptmp0));
}
if (skipColumns)
{
@@ -295,25 +297,25 @@ EIGEN_DONT_INLINE static void run(
* - no vectorization
*/
template<typename Index, typename LhsScalar, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
-struct ei_general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
+struct general_matrix_vector_product<Index,LhsScalar,RowMajor,ConjugateLhs,RhsScalar,ConjugateRhs>
{
-typedef typename ei_scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
+typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
- Vectorizable = ei_packet_traits<LhsScalar>::Vectorizable && ei_packet_traits<RhsScalar>::Vectorizable
- && int(ei_packet_traits<LhsScalar>::size)==int(ei_packet_traits<RhsScalar>::size),
- LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1,
- RhsPacketSize = Vectorizable ? ei_packet_traits<RhsScalar>::size : 1,
- ResPacketSize = Vectorizable ? ei_packet_traits<ResScalar>::size : 1
+ Vectorizable = packet_traits<LhsScalar>::Vectorizable && packet_traits<RhsScalar>::Vectorizable
+ && int(packet_traits<LhsScalar>::size)==int(packet_traits<RhsScalar>::size),
+ LhsPacketSize = Vectorizable ? packet_traits<LhsScalar>::size : 1,
+ RhsPacketSize = Vectorizable ? packet_traits<RhsScalar>::size : 1,
+ ResPacketSize = Vectorizable ? packet_traits<ResScalar>::size : 1
};
-typedef typename ei_packet_traits<LhsScalar>::type _LhsPacket;
-typedef typename ei_packet_traits<RhsScalar>::type _RhsPacket;
-typedef typename ei_packet_traits<ResScalar>::type _ResPacket;
+typedef typename packet_traits<LhsScalar>::type _LhsPacket;
+typedef typename packet_traits<RhsScalar>::type _RhsPacket;
+typedef typename packet_traits<ResScalar>::type _ResPacket;
-typedef typename ei_meta_if<Vectorizable,_LhsPacket,LhsScalar>::ret LhsPacket;
-typedef typename ei_meta_if<Vectorizable,_RhsPacket,RhsScalar>::ret RhsPacket;
-typedef typename ei_meta_if<Vectorizable,_ResPacket,ResScalar>::ret ResPacket;
+typedef typename conditional<Vectorizable,_LhsPacket,LhsScalar>::type LhsPacket;
+typedef typename conditional<Vectorizable,_RhsPacket,RhsScalar>::type RhsPacket;
+typedef typename conditional<Vectorizable,_ResPacket,ResScalar>::type ResPacket;
EIGEN_DONT_INLINE static void run(
Index rows, Index cols,
@@ -323,20 +325,20 @@ EIGEN_DONT_INLINE static void run(
ResScalar alpha)
{
EIGEN_UNUSED_VARIABLE(rhsIncr);
- ei_internal_assert(rhsIncr==1);
+ eigen_internal_assert(rhsIncr==1);
#ifdef _EIGEN_ACCUMULATE_PACKETS
#error _EIGEN_ACCUMULATE_PACKETS has already been defined
#endif
#define _EIGEN_ACCUMULATE_PACKETS(A0,A13,A2) {\
- RhsPacket b = ei_pload<RhsPacket>(&rhs[j]); \
- ptmp0 = pcj.pmadd(EIGEN_CAT(ei_ploa,A0) <LhsPacket>(&lhs0[j]), b, ptmp0); \
- ptmp1 = pcj.pmadd(EIGEN_CAT(ei_ploa,A13)<LhsPacket>(&lhs1[j]), b, ptmp1); \
- ptmp2 = pcj.pmadd(EIGEN_CAT(ei_ploa,A2) <LhsPacket>(&lhs2[j]), b, ptmp2); \
- ptmp3 = pcj.pmadd(EIGEN_CAT(ei_ploa,A13)<LhsPacket>(&lhs3[j]), b, ptmp3); }
+ RhsPacket b = pload<RhsPacket>(&rhs[j]); \
+ ptmp0 = pcj.pmadd(EIGEN_CAT(ploa,A0) <LhsPacket>(&lhs0[j]), b, ptmp0); \
+ ptmp1 = pcj.pmadd(EIGEN_CAT(ploa,A13)<LhsPacket>(&lhs1[j]), b, ptmp1); \
+ ptmp2 = pcj.pmadd(EIGEN_CAT(ploa,A2) <LhsPacket>(&lhs2[j]), b, ptmp2); \
+ ptmp3 = pcj.pmadd(EIGEN_CAT(ploa,A13)<LhsPacket>(&lhs3[j]), b, ptmp3); }
- ei_conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
- ei_conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
+ conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;
+ conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;
enum { AllAligned=0, EvenAligned=1, FirstAligned=2, NoneAligned=3 };
const Index rowsAtOnce = 4;
@@ -349,7 +351,7 @@ EIGEN_DONT_INLINE static void run(
// How many coeffs of the result do we have to skip to be aligned.
// Here we assume data are at least aligned on the base scalar type
// if that's not the case then vectorization is discarded, see below.
- Index alignedStart = ei_first_aligned(rhs, depth);
+ Index alignedStart = first_aligned(rhs, depth);
Index alignedSize = RhsPacketSize>1 ? alignedStart + ((depth-alignedStart) & ~RhsPacketAlignedMask) : 0;
const Index peeledSize = peels>1 ? alignedStart + ((alignedSize-alignedStart) & ~PeelAlignedMask) : alignedStart;
@@ -359,7 +361,7 @@ EIGEN_DONT_INLINE static void run(
: FirstAligned;
// we cannot assume the first element is aligned because of sub-matrices
- const Index lhsAlignmentOffset = ei_first_aligned(lhs,depth);
+ const Index lhsAlignmentOffset = first_aligned(lhs,depth);
// find how many rows do we have to skip to be aligned with rhs (if possible)
Index skipRows = 0;
@@ -371,7 +373,7 @@ EIGEN_DONT_INLINE static void run(
}
else if (LhsPacketSize>1)
{
- ei_internal_assert(size_t(lhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0 || depth<LhsPacketSize);
+ eigen_internal_assert(size_t(lhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0 || depth<LhsPacketSize);
while (skipRows<LhsPacketSize &&
alignedStart != ((lhsAlignmentOffset + alignmentStep*skipRows)%LhsPacketSize))
@@ -387,7 +389,7 @@ EIGEN_DONT_INLINE static void run(
skipRows = std::min(skipRows,Index(rows));
// note that the skiped columns are processed later.
}
- ei_internal_assert( alignmentPattern==NoneAligned
+ eigen_internal_assert( alignmentPattern==NoneAligned
|| LhsPacketSize==1
|| (skipRows + rowsAtOnce >= rows)
|| LhsPacketSize > depth
@@ -416,8 +418,8 @@ EIGEN_DONT_INLINE static void run(
if (Vectorizable)
{
/* explicit vectorization */
- ResPacket ptmp0 = ei_pset1<ResPacket>(ResScalar(0)), ptmp1 = ei_pset1<ResPacket>(ResScalar(0)),
- ptmp2 = ei_pset1<ResPacket>(ResScalar(0)), ptmp3 = ei_pset1<ResPacket>(ResScalar(0));
+ ResPacket ptmp0 = pset1<ResPacket>(ResScalar(0)), ptmp1 = pset1<ResPacket>(ResScalar(0)),
+ ptmp2 = pset1<ResPacket>(ResScalar(0)), ptmp3 = pset1<ResPacket>(ResScalar(0));
// process initial unaligned coeffs
// FIXME this loop get vectorized by the compiler !
@@ -450,27 +452,27 @@ EIGEN_DONT_INLINE static void run(
* than basic unaligned loads.
*/
LhsPacket A01, A02, A03, A11, A12, A13;
- A01 = ei_pload<LhsPacket>(&lhs1[alignedStart-1]);
- A02 = ei_pload<LhsPacket>(&lhs2[alignedStart-2]);
- A03 = ei_pload<LhsPacket>(&lhs3[alignedStart-3]);
+ A01 = pload<LhsPacket>(&lhs1[alignedStart-1]);
+ A02 = pload<LhsPacket>(&lhs2[alignedStart-2]);
+ A03 = pload<LhsPacket>(&lhs3[alignedStart-3]);
for (Index j = alignedStart; j<peeledSize; j+=peels*RhsPacketSize)
{
- RhsPacket b = ei_pload<RhsPacket>(&rhs[j]);
- A11 = ei_pload<LhsPacket>(&lhs1[j-1+LhsPacketSize]); ei_palign<1>(A01,A11);
- A12 = ei_pload<LhsPacket>(&lhs2[j-2+LhsPacketSize]); ei_palign<2>(A02,A12);
- A13 = ei_pload<LhsPacket>(&lhs3[j-3+LhsPacketSize]); ei_palign<3>(A03,A13);
+ RhsPacket b = pload<RhsPacket>(&rhs[j]);
+ A11 = pload<LhsPacket>(&lhs1[j-1+LhsPacketSize]); palign<1>(A01,A11);
+ A12 = pload<LhsPacket>(&lhs2[j-2+LhsPacketSize]); palign<2>(A02,A12);
+ A13 = pload<LhsPacket>(&lhs3[j-3+LhsPacketSize]); palign<3>(A03,A13);
- ptmp0 = pcj.pmadd(ei_pload<LhsPacket>(&lhs0[j]), b, ptmp0);
+ ptmp0 = pcj.pmadd(pload<LhsPacket>(&lhs0[j]), b, ptmp0);
ptmp1 = pcj.pmadd(A01, b, ptmp1);
- A01 = ei_pload<LhsPacket>(&lhs1[j-1+2*LhsPacketSize]); ei_palign<1>(A11,A01);
+ A01 = pload<LhsPacket>(&lhs1[j-1+2*LhsPacketSize]); palign<1>(A11,A01);
ptmp2 = pcj.pmadd(A02, b, ptmp2);
- A02 = ei_pload<LhsPacket>(&lhs2[j-2+2*LhsPacketSize]); ei_palign<2>(A12,A02);
+ A02 = pload<LhsPacket>(&lhs2[j-2+2*LhsPacketSize]); palign<2>(A12,A02);
ptmp3 = pcj.pmadd(A03, b, ptmp3);
- A03 = ei_pload<LhsPacket>(&lhs3[j-3+2*LhsPacketSize]); ei_palign<3>(A13,A03);
+ A03 = pload<LhsPacket>(&lhs3[j-3+2*LhsPacketSize]); palign<3>(A13,A03);
- b = ei_pload<RhsPacket>(&rhs[j+RhsPacketSize]);
- ptmp0 = pcj.pmadd(ei_pload<LhsPacket>(&lhs0[j+LhsPacketSize]), b, ptmp0);
+ b = pload<RhsPacket>(&rhs[j+RhsPacketSize]);
+ ptmp0 = pcj.pmadd(pload<LhsPacket>(&lhs0[j+LhsPacketSize]), b, ptmp0);
ptmp1 = pcj.pmadd(A11, b, ptmp1);
ptmp2 = pcj.pmadd(A12, b, ptmp2);
ptmp3 = pcj.pmadd(A13, b, ptmp3);
@@ -484,10 +486,10 @@ EIGEN_DONT_INLINE static void run(
_EIGEN_ACCUMULATE_PACKETS(du,du,du);
break;
}
- tmp0 += ei_predux(ptmp0);
- tmp1 += ei_predux(ptmp1);
- tmp2 += ei_predux(ptmp2);
- tmp3 += ei_predux(ptmp3);
+ tmp0 += predux(ptmp0);
+ tmp1 += predux(ptmp1);
+ tmp2 += predux(ptmp2);
+ tmp3 += predux(ptmp3);
}
} // end explicit vectorization
@@ -513,7 +515,7 @@ EIGEN_DONT_INLINE static void run(
for (Index i=start; i<end; ++i)
{
EIGEN_ALIGN16 ResScalar tmp0 = ResScalar(0);
- ResPacket ptmp0 = ei_pset1<ResPacket>(tmp0);
+ ResPacket ptmp0 = pset1<ResPacket>(tmp0);
const LhsScalar* lhs0 = lhs + i*lhsStride;
// process first unaligned result's coeffs
// FIXME this loop get vectorized by the compiler !
@@ -525,11 +527,11 @@ EIGEN_DONT_INLINE static void run(
// process aligned rhs coeffs
if ((size_t(lhs0+alignedStart)%sizeof(LhsPacket))==0)
for (Index j = alignedStart;j<alignedSize;j+=RhsPacketSize)
- ptmp0 = pcj.pmadd(ei_pload<LhsPacket>(&lhs0[j]), ei_pload<RhsPacket>(&rhs[j]), ptmp0);
+ ptmp0 = pcj.pmadd(pload<LhsPacket>(&lhs0[j]), pload<RhsPacket>(&rhs[j]), ptmp0);
else
for (Index j = alignedStart;j<alignedSize;j+=RhsPacketSize)
- ptmp0 = pcj.pmadd(ei_ploadu<LhsPacket>(&lhs0[j]), ei_pload<RhsPacket>(&rhs[j]), ptmp0);
- tmp0 += ei_predux(ptmp0);
+ ptmp0 = pcj.pmadd(ploadu<LhsPacket>(&lhs0[j]), pload<RhsPacket>(&rhs[j]), ptmp0);
+ tmp0 += predux(ptmp0);
}
// process remaining scalars
@@ -552,4 +554,6 @@ EIGEN_DONT_INLINE static void run(
}
};
+} // end namespace internal
+
#endif // EIGEN_GENERAL_MATRIX_VECTOR_H
diff --git a/Eigen/src/Core/products/Parallelizer.h b/Eigen/src/Core/products/Parallelizer.h
index b13c0706e..420f88ca6 100644
--- a/Eigen/src/Core/products/Parallelizer.h
+++ b/Eigen/src/Core/products/Parallelizer.h
@@ -25,19 +25,21 @@
#ifndef EIGEN_PARALLELIZER_H
#define EIGEN_PARALLELIZER_H
+namespace internal {
+
/** \internal */
-inline void ei_manage_multi_threading(Action action, int* v)
+inline void manage_multi_threading(Action action, int* v)
{
static int m_maxThreads = -1;
if(action==SetAction)
{
- ei_internal_assert(v!=0);
+ eigen_internal_assert(v!=0);
m_maxThreads = *v;
}
else if(action==GetAction)
{
- ei_internal_assert(v!=0);
+ eigen_internal_assert(v!=0);
#ifdef EIGEN_HAS_OPENMP
if(m_maxThreads>0)
*v = m_maxThreads;
@@ -49,7 +51,7 @@ inline void ei_manage_multi_threading(Action action, int* v)
}
else
{
- ei_internal_assert(false);
+ eigen_internal_assert(false);
}
}
@@ -58,7 +60,7 @@ inline void ei_manage_multi_threading(Action action, int* v)
inline int nbThreads()
{
int ret;
- ei_manage_multi_threading(GetAction, &ret);
+ manage_multi_threading(GetAction, &ret);
return ret;
}
@@ -66,7 +68,7 @@ inline int nbThreads()
* \sa nbThreads */
inline void setNbThreads(int v)
{
- ei_manage_multi_threading(SetAction, &v);
+ manage_multi_threading(SetAction, &v);
}
template<typename Index> struct GemmParallelInfo
@@ -81,7 +83,7 @@ template<typename Index> struct GemmParallelInfo
};
template<bool Condition, typename Functor, typename Index>
-void ei_parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpose)
+void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpose)
{
#ifndef EIGEN_HAS_OPENMP
// FIXME the transpose variable is only needed to properly split
@@ -122,7 +124,7 @@ void ei_parallelize_gemm(const Functor& func, Index rows, Index cols, bool trans
Index blockCols = (cols / threads) & ~Index(0x3);
Index blockRows = (rows / threads) & ~Index(0x7);
-
+
GemmParallelInfo<Index>* info = new GemmParallelInfo<Index>[threads];
#pragma omp parallel for schedule(static,1) num_threads(threads)
@@ -147,4 +149,6 @@ void ei_parallelize_gemm(const Functor& func, Index rows, Index cols, bool trans
#endif
}
+} // end namespace internal
+
#endif // EIGEN_PARALLELIZER_H
diff --git a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
index ede8b77bf..741c5f630 100644
--- a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
+++ b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h
@@ -25,12 +25,14 @@
#ifndef EIGEN_SELFADJOINT_MATRIX_MATRIX_H
#define EIGEN_SELFADJOINT_MATRIX_MATRIX_H
+namespace internal {
+
// pack a selfadjoint block diagonal for use with the gebp_kernel
template<typename Scalar, typename Index, int Pack1, int Pack2, int StorageOrder>
-struct ei_symm_pack_lhs
+struct symm_pack_lhs
{
template<int BlockRows> inline
- void pack(Scalar* blockA, const ei_const_blas_data_mapper<Scalar,Index,StorageOrder>& lhs, Index cols, Index i, Index& count)
+ void pack(Scalar* blockA, const const_blas_data_mapper<Scalar,Index,StorageOrder>& lhs, Index cols, Index i, Index& count)
{
// normal copy
for(Index k=0; k<i; k++)
@@ -41,9 +43,9 @@ struct ei_symm_pack_lhs
for(Index k=i; k<i+BlockRows; k++)
{
for(Index w=0; w<h; w++)
- blockA[count++] = ei_conj(lhs(k, i+w)); // transposed
+ blockA[count++] = conj(lhs(k, i+w)); // transposed
- blockA[count++] = ei_real(lhs(k,k)); // real (diagonal)
+ blockA[count++] = real(lhs(k,k)); // real (diagonal)
for(Index w=h+1; w<BlockRows; w++)
blockA[count++] = lhs(i+w, k); // normal
@@ -52,11 +54,11 @@ struct ei_symm_pack_lhs
// transposed copy
for(Index k=i+BlockRows; k<cols; k++)
for(Index w=0; w<BlockRows; w++)
- blockA[count++] = ei_conj(lhs(k, i+w)); // transposed
+ blockA[count++] = conj(lhs(k, i+w)); // transposed
}
void operator()(Scalar* blockA, const Scalar* _lhs, Index lhsStride, Index cols, Index rows)
{
- ei_const_blas_data_mapper<Scalar,Index,StorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<Scalar,Index,StorageOrder> lhs(_lhs,lhsStride);
Index count = 0;
Index peeled_mc = (rows/Pack1)*Pack1;
for(Index i=0; i<peeled_mc; i+=Pack1)
@@ -76,23 +78,23 @@ struct ei_symm_pack_lhs
for(Index k=0; k<i; k++)
blockA[count++] = lhs(i, k); // normal
- blockA[count++] = ei_real(lhs(i, i)); // real (diagonal)
+ blockA[count++] = real(lhs(i, i)); // real (diagonal)
for(Index k=i+1; k<cols; k++)
- blockA[count++] = ei_conj(lhs(k, i)); // transposed
+ blockA[count++] = conj(lhs(k, i)); // transposed
}
}
};
template<typename Scalar, typename Index, int nr, int StorageOrder>
-struct ei_symm_pack_rhs
+struct symm_pack_rhs
{
- enum { PacketSize = ei_packet_traits<Scalar>::size };
+ enum { PacketSize = packet_traits<Scalar>::size };
void operator()(Scalar* blockB, const Scalar* _rhs, Index rhsStride, Index rows, Index cols, Index k2)
{
Index end_k = k2 + rows;
Index count = 0;
- ei_const_blas_data_mapper<Scalar,Index,StorageOrder> rhs(_rhs,rhsStride);
+ const_blas_data_mapper<Scalar,Index,StorageOrder> rhs(_rhs,rhsStride);
Index packet_cols = (cols/nr)*nr;
// first part: normal case
@@ -118,12 +120,12 @@ struct ei_symm_pack_rhs
// transpose
for(Index k=k2; k<j2; k++)
{
- blockB[count+0] = ei_conj(rhs(j2+0,k));
- blockB[count+1] = ei_conj(rhs(j2+1,k));
+ blockB[count+0] = conj(rhs(j2+0,k));
+ blockB[count+1] = conj(rhs(j2+1,k));
if (nr==4)
{
- blockB[count+2] = ei_conj(rhs(j2+2,k));
- blockB[count+3] = ei_conj(rhs(j2+3,k));
+ blockB[count+2] = conj(rhs(j2+2,k));
+ blockB[count+3] = conj(rhs(j2+3,k));
}
count += nr;
}
@@ -135,11 +137,11 @@ struct ei_symm_pack_rhs
for (Index w=0 ; w<h; ++w)
blockB[count+w] = rhs(k,j2+w);
- blockB[count+h] = ei_real(rhs(k,k));
+ blockB[count+h] = real(rhs(k,k));
// transpose
for (Index w=h+1 ; w<nr; ++w)
- blockB[count+w] = ei_conj(rhs(j2+w,k));
+ blockB[count+w] = conj(rhs(j2+w,k));
count += nr;
++h;
}
@@ -162,12 +164,12 @@ struct ei_symm_pack_rhs
{
for(Index k=k2; k<end_k; k++)
{
- blockB[count+0] = ei_conj(rhs(j2+0,k));
- blockB[count+1] = ei_conj(rhs(j2+1,k));
+ blockB[count+0] = conj(rhs(j2+0,k));
+ blockB[count+1] = conj(rhs(j2+1,k));
if (nr==4)
{
- blockB[count+2] = ei_conj(rhs(j2+2,k));
- blockB[count+3] = ei_conj(rhs(j2+3,k));
+ blockB[count+2] = conj(rhs(j2+2,k));
+ blockB[count+3] = conj(rhs(j2+3,k));
}
count += nr;
}
@@ -180,13 +182,13 @@ struct ei_symm_pack_rhs
Index half = std::min(end_k,j2);
for(Index k=k2; k<half; k++)
{
- blockB[count] = ei_conj(rhs(j2,k));
+ blockB[count] = conj(rhs(j2,k));
count += 1;
}
if(half==j2 && half<k2+rows)
{
- blockB[count] = ei_real(rhs(j2,j2));
+ blockB[count] = real(rhs(j2,j2));
count += 1;
}
else
@@ -209,12 +211,12 @@ template <typename Scalar, typename Index,
int LhsStorageOrder, bool LhsSelfAdjoint, bool ConjugateLhs,
int RhsStorageOrder, bool RhsSelfAdjoint, bool ConjugateRhs,
int ResStorageOrder>
-struct ei_product_selfadjoint_matrix;
+struct product_selfadjoint_matrix;
template <typename Scalar, typename Index,
int LhsStorageOrder, bool LhsSelfAdjoint, bool ConjugateLhs,
int RhsStorageOrder, bool RhsSelfAdjoint, bool ConjugateRhs>
-struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,LhsSelfAdjoint,ConjugateLhs, RhsStorageOrder,RhsSelfAdjoint,ConjugateRhs,RowMajor>
+struct product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,LhsSelfAdjoint,ConjugateLhs, RhsStorageOrder,RhsSelfAdjoint,ConjugateRhs,RowMajor>
{
static EIGEN_STRONG_INLINE void run(
@@ -224,7 +226,7 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,LhsSelfAdjoint
Scalar* res, Index resStride,
Scalar alpha)
{
- ei_product_selfadjoint_matrix<Scalar, Index,
+ product_selfadjoint_matrix<Scalar, Index,
EIGEN_LOGICAL_XOR(RhsSelfAdjoint,RhsStorageOrder==RowMajor) ? ColMajor : RowMajor,
RhsSelfAdjoint, NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(RhsSelfAdjoint,ConjugateRhs),
EIGEN_LOGICAL_XOR(LhsSelfAdjoint,LhsStorageOrder==RowMajor) ? ColMajor : RowMajor,
@@ -237,7 +239,7 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,LhsSelfAdjoint
template <typename Scalar, typename Index,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
-struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,ConjugateLhs, RhsStorageOrder,false,ConjugateRhs,ColMajor>
+struct product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,ConjugateLhs, RhsStorageOrder,false,ConjugateRhs,ColMajor>
{
static EIGEN_DONT_INLINE void run(
@@ -249,10 +251,10 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,Conjugate
{
Index size = rows;
- ei_const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
- ei_const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
+ const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
Index kc = size; // cache block size along the K direction
Index mc = rows; // cache block size along the M direction
@@ -267,10 +269,10 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,Conjugate
Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB);
Scalar* blockB = allocatedBlockB + sizeW;
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
- ei_symm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder==RowMajor?ColMajor:RowMajor, true> pack_lhs_transposed;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
+ symm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder==RowMajor?ColMajor:RowMajor, true> pack_lhs_transposed;
for(Index k2=0; k2<size; k2+=kc)
{
@@ -305,7 +307,7 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,Conjugate
for(Index i2=k2+kc; i2<size; i2+=mc)
{
const Index actual_mc = std::min(i2+mc,size)-i2;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder,false>()
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder,false>()
(blockA, &lhs(i2, k2), lhsStride, actual_kc, actual_mc);
gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha);
@@ -321,7 +323,7 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,true,Conjugate
template <typename Scalar, typename Index,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
-struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,false,ConjugateLhs, RhsStorageOrder,true,ConjugateRhs,ColMajor>
+struct product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,false,ConjugateLhs, RhsStorageOrder,true,ConjugateRhs,ColMajor>
{
static EIGEN_DONT_INLINE void run(
@@ -333,9 +335,9 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,false,Conjugat
{
Index size = cols;
- ei_const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
Index kc = size; // cache block size along the K direction
Index mc = rows; // cache block size along the M direction
@@ -348,9 +350,9 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,false,Conjugat
Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB);
Scalar* blockB = allocatedBlockB + sizeW;
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
- ei_symm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
+ symm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
for(Index k2=0; k2<size; k2+=kc)
{
@@ -373,14 +375,18 @@ struct ei_product_selfadjoint_matrix<Scalar,Index,LhsStorageOrder,false,Conjugat
}
};
+} // end namespace internal
+
/***************************************************************************
-* Wrapper to ei_product_selfadjoint_matrix
+* Wrapper to product_selfadjoint_matrix
***************************************************************************/
+namespace internal {
template<typename Lhs, int LhsMode, typename Rhs, int RhsMode>
-struct ei_traits<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false> >
- : ei_traits<ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>, Lhs, Rhs> >
+struct traits<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false> >
+ : traits<ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>, Lhs, Rhs> >
{};
+}
template<typename Lhs, int LhsMode, typename Rhs, int RhsMode>
struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
@@ -399,7 +405,7 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -407,14 +413,14 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_product_selfadjoint_matrix<Scalar, Index,
+ internal::product_selfadjoint_matrix<Scalar, Index,
EIGEN_LOGICAL_XOR(LhsIsUpper,
- ei_traits<Lhs>::Flags &RowMajorBit) ? RowMajor : ColMajor, LhsIsSelfAdjoint,
+ internal::traits<Lhs>::Flags &RowMajorBit) ? RowMajor : ColMajor, LhsIsSelfAdjoint,
NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(LhsIsUpper,bool(LhsBlasTraits::NeedToConjugate)),
EIGEN_LOGICAL_XOR(RhsIsUpper,
- ei_traits<Rhs>::Flags &RowMajorBit) ? RowMajor : ColMajor, RhsIsSelfAdjoint,
+ internal::traits<Rhs>::Flags &RowMajorBit) ? RowMajor : ColMajor, RhsIsSelfAdjoint,
NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(RhsIsUpper,bool(RhsBlasTraits::NeedToConjugate)),
- ei_traits<Dest>::Flags&RowMajorBit ? RowMajor : ColMajor>
+ internal::traits<Dest>::Flags&RowMajorBit ? RowMajor : ColMajor>
::run(
lhs.rows(), rhs.cols(), // sizes
&lhs.coeff(0,0), lhs.outerStride(), // lhs info
diff --git a/Eigen/src/Core/products/SelfadjointMatrixVector.h b/Eigen/src/Core/products/SelfadjointMatrixVector.h
index df7509f9a..57f4b7da3 100644
--- a/Eigen/src/Core/products/SelfadjointMatrixVector.h
+++ b/Eigen/src/Core/products/SelfadjointMatrixVector.h
@@ -25,19 +25,21 @@
#ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_H
#define EIGEN_SELFADJOINT_MATRIX_VECTOR_H
+namespace internal {
+
/* Optimized selfadjoint matrix * vector product:
* This algorithm processes 2 columns at onces that allows to both reduce
* the number of load/stores of the result by a factor 2 and to reduce
* the instruction dependency.
*/
template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool ConjugateRhs>
-static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
+static EIGEN_DONT_INLINE void product_selfadjoint_vector(
Index size,
const Scalar* lhs, Index lhsStride,
const Scalar* _rhs, Index rhsIncr,
Scalar* res, Scalar alpha)
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename packet_traits<Scalar>::type Packet;
const Index PacketSize = sizeof(Packet)/sizeof(Scalar);
enum {
@@ -46,13 +48,13 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
FirstTriangular = IsRowMajor == IsLower
};
- ei_conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> cj0;
- ei_conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> cj1;
+ conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> cj0;
+ conj_helper<Scalar,Scalar,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> cj1;
- ei_conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> pcj0;
- ei_conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> pcj1;
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, IsRowMajor), ConjugateRhs> pcj0;
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex && EIGEN_LOGICAL_XOR(ConjugateLhs, !IsRowMajor), ConjugateRhs> pcj1;
- Scalar cjAlpha = ConjugateRhs ? ei_conj(alpha) : alpha;
+ Scalar cjAlpha = ConjugateRhs ? conj(alpha) : alpha;
// if the rhs is not sequentially stored in memory we copy it to a temporary buffer,
// this is because we need to extract packets
@@ -77,19 +79,19 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
register const Scalar* EIGEN_RESTRICT A1 = lhs + (j+1)*lhsStride;
Scalar t0 = cjAlpha * rhs[j];
- Packet ptmp0 = ei_pset1<Packet>(t0);
+ Packet ptmp0 = pset1<Packet>(t0);
Scalar t1 = cjAlpha * rhs[j+1];
- Packet ptmp1 = ei_pset1<Packet>(t1);
+ Packet ptmp1 = pset1<Packet>(t1);
Scalar t2 = 0;
- Packet ptmp2 = ei_pset1<Packet>(t2);
+ Packet ptmp2 = pset1<Packet>(t2);
Scalar t3 = 0;
- Packet ptmp3 = ei_pset1<Packet>(t3);
+ Packet ptmp3 = pset1<Packet>(t3);
size_t starti = FirstTriangular ? 0 : j+2;
size_t endi = FirstTriangular ? j : size;
size_t alignedEnd = starti;
- size_t alignedStart = (starti) + ei_first_aligned(&res[starti], endi-starti);
+ size_t alignedStart = (starti) + first_aligned(&res[starti], endi-starti);
alignedEnd = alignedStart + ((endi-alignedStart)/(PacketSize))*(PacketSize);
res[j] += cj0.pmul(A0[j], t0);
@@ -108,8 +110,8 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
for (size_t i=starti; i<alignedStart; ++i)
{
res[i] += t0 * A0[i] + t1 * A1[i];
- t2 += ei_conj(A0[i]) * rhs[i];
- t3 += ei_conj(A1[i]) * rhs[i];
+ t2 += conj(A0[i]) * rhs[i];
+ t3 += conj(A1[i]) * rhs[i];
}
// Yes this an optimization for gcc 4.3 and 4.4 (=> huge speed up)
// gcc 4.2 does this optimization automatically.
@@ -119,15 +121,15 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
Scalar* EIGEN_RESTRICT resIt = res + alignedStart;
for (size_t i=alignedStart; i<alignedEnd; i+=PacketSize)
{
- Packet A0i = ei_ploadu<Packet>(a0It); a0It += PacketSize;
- Packet A1i = ei_ploadu<Packet>(a1It); a1It += PacketSize;
- Packet Bi = ei_ploadu<Packet>(rhsIt); rhsIt += PacketSize; // FIXME should be aligned in most cases
- Packet Xi = ei_pload <Packet>(resIt);
+ Packet A0i = ploadu<Packet>(a0It); a0It += PacketSize;
+ Packet A1i = ploadu<Packet>(a1It); a1It += PacketSize;
+ Packet Bi = ploadu<Packet>(rhsIt); rhsIt += PacketSize; // FIXME should be aligned in most cases
+ Packet Xi = pload <Packet>(resIt);
Xi = pcj0.pmadd(A0i,ptmp0, pcj0.pmadd(A1i,ptmp1,Xi));
ptmp2 = pcj1.pmadd(A0i, Bi, ptmp2);
ptmp3 = pcj1.pmadd(A1i, Bi, ptmp3);
- ei_pstore(resIt,Xi); resIt += PacketSize;
+ pstore(resIt,Xi); resIt += PacketSize;
}
for (size_t i=alignedEnd; i<endi; i++)
{
@@ -136,8 +138,8 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
t3 += cj1.pmul(A1[i], rhs[i]);
}
- res[j] += alpha * (t2 + ei_predux(ptmp2));
- res[j+1] += alpha * (t3 + ei_predux(ptmp3));
+ res[j] += alpha * (t2 + predux(ptmp2));
+ res[j+1] += alpha * (t3 + predux(ptmp3));
}
for (Index j=FirstTriangular ? 0 : bound;j<(FirstTriangular ? bound : size);j++)
{
@@ -157,14 +159,18 @@ static EIGEN_DONT_INLINE void ei_product_selfadjoint_vector(
ei_aligned_stack_delete(Scalar, const_cast<Scalar*>(rhs), size);
}
+} // end namespace internal
+
/***************************************************************************
-* Wrapper to ei_product_selfadjoint_vector
+* Wrapper to product_selfadjoint_vector
***************************************************************************/
+namespace internal {
template<typename Lhs, int LhsMode, typename Rhs>
-struct ei_traits<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true> >
- : ei_traits<ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>, Lhs, Rhs> >
+struct traits<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true> >
+ : traits<ProductBase<SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>, Lhs, Rhs> >
{};
+}
template<typename Lhs, int LhsMode, typename Rhs>
struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
@@ -180,7 +186,7 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -188,9 +194,9 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_assert(dst.innerStride()==1 && "not implemented yet");
+ eigen_assert(dst.innerStride()==1 && "not implemented yet");
- ei_product_selfadjoint_vector<Scalar, Index, (ei_traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, int(LhsUpLo), bool(LhsBlasTraits::NeedToConjugate), bool(RhsBlasTraits::NeedToConjugate)>
+ internal::product_selfadjoint_vector<Scalar, Index, (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, int(LhsUpLo), bool(LhsBlasTraits::NeedToConjugate), bool(RhsBlasTraits::NeedToConjugate)>
(
lhs.rows(), // size
&lhs.coeff(0,0), lhs.outerStride(), // lhs info
@@ -201,10 +207,12 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
}
};
+namespace internal {
template<typename Lhs, typename Rhs, int RhsMode>
-struct ei_traits<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false> >
- : ei_traits<ProductBase<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>, Lhs, Rhs> >
+struct traits<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false> >
+ : traits<ProductBase<SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>, Lhs, Rhs> >
{};
+}
template<typename Lhs, typename Rhs, int RhsMode>
struct SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>
@@ -220,7 +228,7 @@ struct SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -228,10 +236,10 @@ struct SelfadjointProductMatrix<Lhs,0,true,Rhs,RhsMode,false>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_assert(dst.innerStride()==1 && "not implemented yet");
+ eigen_assert(dst.innerStride()==1 && "not implemented yet");
// transpose the product
- ei_product_selfadjoint_vector<Scalar, Index, (ei_traits<_ActualRhsType>::Flags&RowMajorBit) ? ColMajor : RowMajor, int(RhsUpLo)==Upper ? Lower : Upper,
+ internal::product_selfadjoint_vector<Scalar, Index, (internal::traits<_ActualRhsType>::Flags&RowMajorBit) ? ColMajor : RowMajor, int(RhsUpLo)==Upper ? Lower : Upper,
bool(RhsBlasTraits::NeedToConjugate), bool(LhsBlasTraits::NeedToConjugate)>
(
rhs.rows(), // size
diff --git a/Eigen/src/Core/products/SelfadjointProduct.h b/Eigen/src/Core/products/SelfadjointProduct.h
index 8f431c2e4..16320fa17 100644
--- a/Eigen/src/Core/products/SelfadjointProduct.h
+++ b/Eigen/src/Core/products/SelfadjointProduct.h
@@ -25,6 +25,8 @@
#ifndef EIGEN_SELFADJOINT_PRODUCT_H
#define EIGEN_SELFADJOINT_PRODUCT_H
+namespace internal {
+
/**********************************************************************
* This file implements a self adjoint product: C += A A^T updating only
* half of the selfadjoint matrix C.
@@ -33,28 +35,28 @@
// forward declarations (defined at the end of this file)
template<typename Scalar, typename Index, int mr, int nr, bool ConjLhs, bool ConjRhs, int UpLo>
-struct ei_sybb_kernel;
+struct sybb_kernel;
/* Optimized selfadjoint product (_SYRK) */
template <typename Scalar, typename Index,
int RhsStorageOrder,
int ResStorageOrder, bool AAT, int UpLo>
-struct ei_selfadjoint_product;
+struct selfadjoint_product;
// as usual if the result is row major => we transpose the product
template <typename Scalar, typename Index, int MatStorageOrder, bool AAT, int UpLo>
-struct ei_selfadjoint_product<Scalar, Index, MatStorageOrder, RowMajor, AAT, UpLo>
+struct selfadjoint_product<Scalar, Index, MatStorageOrder, RowMajor, AAT, UpLo>
{
static EIGEN_STRONG_INLINE void run(Index size, Index depth, const Scalar* mat, Index matStride, Scalar* res, Index resStride, Scalar alpha)
{
- ei_selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, !AAT, UpLo==Lower?Upper:Lower>
+ selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, !AAT, UpLo==Lower?Upper:Lower>
::run(size, depth, mat, matStride, res, resStride, alpha);
}
};
template <typename Scalar, typename Index,
int MatStorageOrder, bool AAT, int UpLo>
-struct ei_selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, AAT, UpLo>
+struct selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, AAT, UpLo>
{
static EIGEN_DONT_INLINE void run(
@@ -63,12 +65,12 @@ struct ei_selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, AAT, UpL
Scalar* res, Index resStride,
Scalar alpha)
{
- ei_const_blas_data_mapper<Scalar, Index, MatStorageOrder> mat(_mat,matStride);
+ const_blas_data_mapper<Scalar, Index, MatStorageOrder> mat(_mat,matStride);
// if(AAT)
-// alpha = ei_conj(alpha);
+// alpha = conj(alpha);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
Index kc = depth; // cache block size along the K direction
Index mc = size; // cache block size along the M direction
@@ -90,10 +92,10 @@ struct ei_selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, AAT, UpL
ConjRhs = NumTraits<Scalar>::IsComplex && AAT
};
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjLhs, ConjRhs> gebp_kernel;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,MatStorageOrder==RowMajor ? ColMajor : RowMajor> pack_rhs;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, MatStorageOrder, false> pack_lhs;
- ei_sybb_kernel<Scalar, Index, Traits::mr, Traits::nr, ConjLhs, ConjRhs, UpLo> sybb;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjLhs, ConjRhs> gebp_kernel;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,MatStorageOrder==RowMajor ? ColMajor : RowMajor> pack_rhs;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, MatStorageOrder, false> pack_lhs;
+ sybb_kernel<Scalar, Index, Traits::mr, Traits::nr, ConjLhs, ConjRhs, UpLo> sybb;
for(Index k2=0; k2<depth; k2+=kc)
{
@@ -131,33 +133,6 @@ struct ei_selfadjoint_product<Scalar, Index, MatStorageOrder, ColMajor, AAT, UpL
}
};
-// high level API
-
-template<typename MatrixType, unsigned int UpLo>
-template<typename DerivedU>
-SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
-::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
-{
- typedef ei_blas_traits<DerivedU> UBlasTraits;
- typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
- typedef typename ei_cleantype<ActualUType>::type _ActualUType;
- const ActualUType actualU = UBlasTraits::extract(u.derived());
-
- Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived());
-
- enum { IsRowMajor = (ei_traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
-
- ei_selfadjoint_product<Scalar, Index,
- _ActualUType::Flags&RowMajorBit ? RowMajor : ColMajor,
- MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor,
- !UBlasTraits::NeedToConjugate, UpLo>
- ::run(_expression().cols(), actualU.cols(), &actualU.coeff(0,0), actualU.outerStride(),
- const_cast<Scalar*>(_expression().data()), _expression().outerStride(), actualAlpha);
-
- return *this;
-}
-
-
// Optimized SYmmetric packed Block * packed Block product kernel.
// This kernel is built on top of the gebp kernel:
// - the current selfadjoint block (res) is processed per panel of actual_mc x BlockSize
@@ -168,15 +143,15 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
// small temporary buffer which is then accumulated into the result using a
// triangular traversal.
template<typename Scalar, typename Index, int mr, int nr, bool ConjLhs, bool ConjRhs, int UpLo>
-struct ei_sybb_kernel
+struct sybb_kernel
{
enum {
- PacketSize = ei_packet_traits<Scalar>::size,
+ PacketSize = packet_traits<Scalar>::size,
BlockSize = EIGEN_PLAIN_ENUM_MAX(mr,nr)
};
void operator()(Scalar* res, Index resStride, const Scalar* blockA, const Scalar* blockB, Index size, Index depth, Scalar alpha, Scalar* workspace)
{
- ei_gebp_kernel<Scalar, Scalar, Index, mr, nr, ConjLhs, ConjRhs> gebp_kernel;
+ gebp_kernel<Scalar, Scalar, Index, mr, nr, ConjLhs, ConjRhs> gebp_kernel;
Matrix<Scalar,BlockSize,BlockSize,ColMajor> buffer;
// let's process the block per panel of actual_mc x BlockSize,
@@ -217,4 +192,32 @@ struct ei_sybb_kernel
}
};
+} // end namespace internal
+
+// high level API
+
+template<typename MatrixType, unsigned int UpLo>
+template<typename DerivedU>
+SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
+::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
+{
+ typedef internal::blas_traits<DerivedU> UBlasTraits;
+ typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
+ typedef typename internal::remove_all<ActualUType>::type _ActualUType;
+ const ActualUType actualU = UBlasTraits::extract(u.derived());
+
+ Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived());
+
+ enum { IsRowMajor = (internal::traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
+
+ internal::selfadjoint_product<Scalar, Index,
+ _ActualUType::Flags&RowMajorBit ? RowMajor : ColMajor,
+ MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor,
+ !UBlasTraits::NeedToConjugate, UpLo>
+ ::run(_expression().cols(), actualU.cols(), &actualU.coeff(0,0), actualU.outerStride(),
+ const_cast<Scalar*>(_expression().data()), _expression().outerStride(), actualAlpha);
+
+ return *this;
+}
+
#endif // EIGEN_SELFADJOINT_PRODUCT_H
diff --git a/Eigen/src/Core/products/SelfadjointRank2Update.h b/Eigen/src/Core/products/SelfadjointRank2Update.h
index a617f1cc6..41968a596 100644
--- a/Eigen/src/Core/products/SelfadjointRank2Update.h
+++ b/Eigen/src/Core/products/SelfadjointRank2Update.h
@@ -25,15 +25,17 @@
#ifndef EIGEN_SELFADJOINTRANK2UPTADE_H
#define EIGEN_SELFADJOINTRANK2UPTADE_H
+namespace internal {
+
/* Optimized selfadjoint matrix += alpha * uv' + vu'
* It corresponds to the Level2 syr2 BLAS routine
*/
template<typename Scalar, typename Index, typename UType, typename VType, int UpLo>
-struct ei_selfadjoint_rank2_update_selector;
+struct selfadjoint_rank2_update_selector;
template<typename Scalar, typename Index, typename UType, typename VType>
-struct ei_selfadjoint_rank2_update_selector<Scalar,Index,UType,VType,Lower>
+struct selfadjoint_rank2_update_selector<Scalar,Index,UType,VType,Lower>
{
static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha)
{
@@ -41,52 +43,53 @@ struct ei_selfadjoint_rank2_update_selector<Scalar,Index,UType,VType,Lower>
for (Index i=0; i<size; ++i)
{
Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i+i, size-i) +=
- (alpha * ei_conj(u.coeff(i))) * v.tail(size-i)
- + (alpha * ei_conj(v.coeff(i))) * u.tail(size-i);
+ (alpha * conj(u.coeff(i))) * v.tail(size-i)
+ + (alpha * conj(v.coeff(i))) * u.tail(size-i);
}
}
};
template<typename Scalar, typename Index, typename UType, typename VType>
-struct ei_selfadjoint_rank2_update_selector<Scalar,Index,UType,VType,Upper>
+struct selfadjoint_rank2_update_selector<Scalar,Index,UType,VType,Upper>
{
static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha)
{
const Index size = u.size();
for (Index i=0; i<size; ++i)
Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i, i+1) +=
- (alpha * ei_conj(u.coeff(i))) * v.head(i+1)
- + (alpha * ei_conj(v.coeff(i))) * u.head(i+1);
+ (alpha * conj(u.coeff(i))) * v.head(i+1)
+ + (alpha * conj(v.coeff(i))) * u.head(i+1);
}
};
-template<bool Cond, typename T> struct ei_conj_expr_if
- : ei_meta_if<!Cond, const T&,
- CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<T>::Scalar>,T> > {};
+template<bool Cond, typename T> struct conj_expr_if
+ : conditional<!Cond, const T&,
+ CwiseUnaryOp<scalar_conjugate_op<typename traits<T>::Scalar>,T> > {};
+} // end namespace internal
template<typename MatrixType, unsigned int UpLo>
template<typename DerivedU, typename DerivedV>
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, Scalar alpha)
{
- typedef ei_blas_traits<DerivedU> UBlasTraits;
+ typedef internal::blas_traits<DerivedU> UBlasTraits;
typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
- typedef typename ei_cleantype<ActualUType>::type _ActualUType;
+ typedef typename internal::remove_all<ActualUType>::type _ActualUType;
const ActualUType actualU = UBlasTraits::extract(u.derived());
- typedef ei_blas_traits<DerivedV> VBlasTraits;
+ typedef internal::blas_traits<DerivedV> VBlasTraits;
typedef typename VBlasTraits::DirectLinearAccessType ActualVType;
- typedef typename ei_cleantype<ActualVType>::type _ActualVType;
+ typedef typename internal::remove_all<ActualVType>::type _ActualVType;
const ActualVType actualV = VBlasTraits::extract(v.derived());
Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived())
* VBlasTraits::extractScalarFactor(v.derived());
- enum { IsRowMajor = (ei_traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
- ei_selfadjoint_rank2_update_selector<Scalar, Index,
- typename ei_cleantype<typename ei_conj_expr_if<IsRowMajor ^ UBlasTraits::NeedToConjugate,_ActualUType>::ret>::type,
- typename ei_cleantype<typename ei_conj_expr_if<IsRowMajor ^ VBlasTraits::NeedToConjugate,_ActualVType>::ret>::type,
+ enum { IsRowMajor = (internal::traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
+ internal::selfadjoint_rank2_update_selector<Scalar, Index,
+ typename internal::remove_all<typename internal::conj_expr_if<IsRowMajor ^ UBlasTraits::NeedToConjugate,_ActualUType>::type>::type,
+ typename internal::remove_all<typename internal::conj_expr_if<IsRowMajor ^ VBlasTraits::NeedToConjugate,_ActualVType>::type>::type,
(IsRowMajor ? int(UpLo==Upper ? Lower : Upper) : UpLo)>
::run(const_cast<Scalar*>(_expression().data()),_expression().outerStride(),actualU,actualV,actualAlpha);
diff --git a/Eigen/src/Core/products/TriangularMatrixMatrix.h b/Eigen/src/Core/products/TriangularMatrixMatrix.h
index cef5eeba1..e35399243 100644
--- a/Eigen/src/Core/products/TriangularMatrixMatrix.h
+++ b/Eigen/src/Core/products/TriangularMatrixMatrix.h
@@ -25,14 +25,16 @@
#ifndef EIGEN_TRIANGULAR_MATRIX_MATRIX_H
#define EIGEN_TRIANGULAR_MATRIX_MATRIX_H
+namespace internal {
+
// template<typename Scalar, int mr, int StorageOrder, bool Conjugate, int Mode>
-// struct ei_gemm_pack_lhs_triangular
+// struct gemm_pack_lhs_triangular
// {
// Matrix<Scalar,mr,mr,
// void operator()(Scalar* blockA, const EIGEN_RESTRICT Scalar* _lhs, int lhsStride, int depth, int rows)
// {
-// ei_conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
-// ei_const_blas_data_mapper<Scalar, StorageOrder> lhs(_lhs,lhsStride);
+// conj_if<NumTraits<Scalar>::IsComplex && Conjugate> cj;
+// const_blas_data_mapper<Scalar, StorageOrder> lhs(_lhs,lhsStride);
// int count = 0;
// const int peeled_mc = (rows/mr)*mr;
// for(int i=0; i<peeled_mc; i+=mr)
@@ -57,13 +59,13 @@ template <typename Scalar, typename Index,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs,
int ResStorageOrder>
-struct ei_product_triangular_matrix_matrix;
+struct product_triangular_matrix_matrix;
template <typename Scalar, typename Index,
int Mode, bool LhsIsTriangular,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
-struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
+struct product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
LhsStorageOrder,ConjugateLhs,
RhsStorageOrder,ConjugateRhs,RowMajor>
{
@@ -74,7 +76,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
Scalar* res, Index resStride,
Scalar alpha)
{
- ei_product_triangular_matrix_matrix<Scalar, Index,
+ product_triangular_matrix_matrix<Scalar, Index,
(Mode&(UnitDiag|ZeroDiag)) | ((Mode&Upper) ? Lower : Upper),
(!LhsIsTriangular),
RhsStorageOrder==RowMajor ? ColMajor : RowMajor,
@@ -90,7 +92,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,LhsIsTriangular,
template <typename Scalar, typename Index, int Mode,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
-struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
+struct product_triangular_matrix_matrix<Scalar,Index,Mode,true,
LhsStorageOrder,ConjugateLhs,
RhsStorageOrder,ConjugateRhs,ColMajor>
{
@@ -102,10 +104,10 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
Scalar* res, Index resStride,
Scalar alpha)
{
- ei_const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
- ei_const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
+ const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
enum {
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
IsLower = (Mode&Lower) == Lower,
@@ -130,9 +132,9 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
else
triangularBuffer.diagonal().setOnes();
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
for(Index k2=IsLower ? depth : 0;
IsLower ? k2>0 : k2<depth;
@@ -199,7 +201,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
for(Index i2=start; i2<end; i2+=mc)
{
const Index actual_mc = std::min(i2+mc,end)-i2;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr,Traits::LhsProgress, LhsStorageOrder,false>()
+ gemm_pack_lhs<Scalar, Index, Traits::mr,Traits::LhsProgress, LhsStorageOrder,false>()
(blockA, &lhs(i2, actual_k2), lhsStride, actual_kc, actual_mc);
gebp_kernel(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha);
@@ -217,7 +219,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
template <typename Scalar, typename Index, int Mode,
int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
-struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,false,
+struct product_triangular_matrix_matrix<Scalar,Index,Mode,false,
LhsStorageOrder,ConjugateLhs,
RhsStorageOrder,ConjugateRhs,ColMajor>
{
@@ -229,10 +231,10 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,false,
Scalar* res, Index resStride,
Scalar alpha)
{
- ei_const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
- ei_const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
+ const_blas_data_mapper<Scalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
+ const_blas_data_mapper<Scalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
enum {
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
IsLower = (Mode&Lower) == Lower,
@@ -257,10 +259,10 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,false,
else
triangularBuffer.diagonal().setOnes();
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder,false,true> pack_rhs_panel;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp_kernel;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder,false,true> pack_rhs_panel;
for(Index k2=IsLower ? 0 : depth;
IsLower ? k2<depth : k2>0;
@@ -352,14 +354,16 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,false,
};
/***************************************************************************
-* Wrapper to ei_product_triangular_matrix_matrix
+* Wrapper to product_triangular_matrix_matrix
***************************************************************************/
template<int Mode, bool LhsIsTriangular, typename Lhs, typename Rhs>
-struct ei_traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false> >
- : ei_traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>, Lhs, Rhs> >
+struct traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false> >
+ : traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>, Lhs, Rhs> >
{};
+} // end namespace internal
+
template<int Mode, bool LhsIsTriangular, typename Lhs, typename Rhs>
struct TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>
: public ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>, Lhs, Rhs >
@@ -376,11 +380,11 @@ struct TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_product_triangular_matrix_matrix<Scalar, Index,
+ internal::product_triangular_matrix_matrix<Scalar, Index,
Mode, LhsIsTriangular,
- (ei_traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, LhsBlasTraits::NeedToConjugate,
- (ei_traits<_ActualRhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, RhsBlasTraits::NeedToConjugate,
- (ei_traits<Dest >::Flags&RowMajorBit) ? RowMajor : ColMajor>
+ (internal::traits<_ActualLhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, LhsBlasTraits::NeedToConjugate,
+ (internal::traits<_ActualRhsType>::Flags&RowMajorBit) ? RowMajor : ColMajor, RhsBlasTraits::NeedToConjugate,
+ (internal::traits<Dest >::Flags&RowMajorBit) ? RowMajor : ColMajor>
::run(
lhs.rows(), rhs.cols(), lhs.cols(),// LhsIsTriangular ? rhs.cols() : lhs.rows(), // sizes
&lhs.coeff(0,0), lhs.outerStride(), // lhs info
@@ -391,4 +395,5 @@ struct TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>
}
};
+
#endif // EIGEN_TRIANGULAR_MATRIX_MATRIX_H
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h
index 67c131ab2..2b175fdf3 100644
--- a/Eigen/src/Core/products/TriangularMatrixVector.h
+++ b/Eigen/src/Core/products/TriangularMatrixVector.h
@@ -25,26 +25,28 @@
#ifndef EIGEN_TRIANGULARMATRIXVECTOR_H
#define EIGEN_TRIANGULARMATRIXVECTOR_H
+namespace internal {
+
template<bool LhsIsTriangular, typename Lhs, typename Rhs, typename Result,
int Mode, bool ConjLhs, bool ConjRhs, int StorageOrder>
-struct ei_product_triangular_vector_selector;
+struct product_triangular_vector_selector;
template<typename Lhs, typename Rhs, typename Result, int Mode, bool ConjLhs, bool ConjRhs, int StorageOrder>
-struct ei_product_triangular_vector_selector<false,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,StorageOrder>
+struct product_triangular_vector_selector<false,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,StorageOrder>
{
- static EIGEN_DONT_INLINE void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename ei_traits<Lhs>::Scalar alpha)
+ static EIGEN_DONT_INLINE void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename traits<Lhs>::Scalar alpha)
{
typedef Transpose<Rhs> TrRhs; TrRhs trRhs(rhs);
typedef Transpose<Lhs> TrLhs; TrLhs trLhs(lhs);
typedef Transpose<Result> TrRes; TrRes trRes(res);
- ei_product_triangular_vector_selector<true,TrRhs,TrLhs,TrRes,
+ product_triangular_vector_selector<true,TrRhs,TrLhs,TrRes,
(Mode & UnitDiag) | (Mode & Lower) ? Upper : Lower, ConjRhs, ConjLhs, StorageOrder==RowMajor ? ColMajor : RowMajor>
::run(trRhs,trLhs,trRes,alpha);
}
};
template<typename Lhs, typename Rhs, typename Result, int Mode, bool ConjLhs, bool ConjRhs>
-struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,ColMajor>
+struct product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,ColMajor>
{
typedef typename Rhs::Scalar Scalar;
typedef typename Rhs::Index Index;
@@ -52,11 +54,11 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
IsLower = ((Mode&Lower)==Lower),
HasUnitDiag = (Mode & UnitDiag)==UnitDiag
};
- static EIGEN_DONT_INLINE void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename ei_traits<Lhs>::Scalar alpha)
+ static EIGEN_DONT_INLINE void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename traits<Lhs>::Scalar alpha)
{
static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
- typename ei_conj_expr_if<ConjLhs,Lhs>::ret cjLhs(lhs);
- typename ei_conj_expr_if<ConjRhs,Rhs>::ret cjRhs(rhs);
+ typename conj_expr_if<ConjLhs,Lhs>::type cjLhs(lhs);
+ typename conj_expr_if<ConjRhs,Rhs>::type cjRhs(rhs);
Index size = lhs.cols();
for (Index pi=0; pi<size; pi+=PanelWidth)
@@ -76,7 +78,7 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
if (r>0)
{
Index s = IsLower ? pi+actualPanelWidth : 0;
- ei_general_matrix_vector_product<Index,Scalar,ColMajor,ConjLhs,Scalar,ConjRhs>::run(
+ general_matrix_vector_product<Index,Scalar,ColMajor,ConjLhs,Scalar,ConjRhs>::run(
r, actualPanelWidth,
&(lhs.const_cast_derived().coeffRef(s,pi)), lhs.outerStride(),
&rhs.coeff(pi), rhs.innerStride(),
@@ -87,7 +89,7 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
};
template<typename Lhs, typename Rhs, typename Result, int Mode, bool ConjLhs, bool ConjRhs>
-struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,RowMajor>
+struct product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,ConjRhs,RowMajor>
{
typedef typename Rhs::Scalar Scalar;
typedef typename Rhs::Index Index;
@@ -95,11 +97,11 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
IsLower = ((Mode&Lower)==Lower),
HasUnitDiag = (Mode & UnitDiag)==UnitDiag
};
- static void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename ei_traits<Lhs>::Scalar alpha)
+ static void run(const Lhs& lhs, const Rhs& rhs, Result& res, typename traits<Lhs>::Scalar alpha)
{
static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
- typename ei_conj_expr_if<ConjLhs,Lhs>::ret cjLhs(lhs);
- typename ei_conj_expr_if<ConjRhs,Rhs>::ret cjRhs(rhs);
+ typename conj_expr_if<ConjLhs,Lhs>::type cjLhs(lhs);
+ typename conj_expr_if<ConjRhs,Rhs>::type cjRhs(rhs);
Index size = lhs.cols();
for (Index pi=0; pi<size; pi+=PanelWidth)
{
@@ -118,7 +120,7 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
if (r>0)
{
Index s = IsLower ? 0 : pi + actualPanelWidth;
- ei_general_matrix_vector_product<Index,Scalar,RowMajor,ConjLhs,Scalar,ConjRhs>::run(
+ general_matrix_vector_product<Index,Scalar,RowMajor,ConjLhs,Scalar,ConjRhs>::run(
actualPanelWidth, r,
&(lhs.const_cast_derived().coeffRef(pi,s)), lhs.outerStride(),
&(rhs.const_cast_derived().coeffRef(s)), 1,
@@ -129,19 +131,21 @@ struct ei_product_triangular_vector_selector<true,Lhs,Rhs,Result,Mode,ConjLhs,Co
};
/***************************************************************************
-* Wrapper to ei_product_triangular_vector
+* Wrapper to product_triangular_vector
***************************************************************************/
template<int Mode, bool LhsIsTriangular, typename Lhs, typename Rhs>
-struct ei_traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,true> >
- : ei_traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,true>, Lhs, Rhs> >
+struct traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,true> >
+ : traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,true>, Lhs, Rhs> >
{};
template<int Mode, bool LhsIsTriangular, typename Lhs, typename Rhs>
-struct ei_traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,true,Rhs,false> >
- : ei_traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,true,Rhs,false>, Lhs, Rhs> >
+struct traits<TriangularProduct<Mode,LhsIsTriangular,Lhs,true,Rhs,false> >
+ : traits<ProductBase<TriangularProduct<Mode,LhsIsTriangular,Lhs,true,Rhs,false>, Lhs, Rhs> >
{};
+} // end namespace internal
+
template<int Mode, typename Lhs, typename Rhs>
struct TriangularProduct<Mode,true,Lhs,false,Rhs,true>
: public ProductBase<TriangularProduct<Mode,true,Lhs,false,Rhs,true>, Lhs, Rhs >
@@ -152,7 +156,7 @@ struct TriangularProduct<Mode,true,Lhs,false,Rhs,true>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -160,12 +164,12 @@ struct TriangularProduct<Mode,true,Lhs,false,Rhs,true>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_product_triangular_vector_selector
+ internal::product_triangular_vector_selector
<true,_ActualLhsType,_ActualRhsType,Dest,
Mode,
LhsBlasTraits::NeedToConjugate,
RhsBlasTraits::NeedToConjugate,
- (int(ei_traits<Lhs>::Flags)&RowMajorBit) ? RowMajor : ColMajor>
+ (int(internal::traits<Lhs>::Flags)&RowMajorBit) ? RowMajor : ColMajor>
::run(lhs,rhs,dst,actualAlpha);
}
};
@@ -181,7 +185,7 @@ struct TriangularProduct<Mode,false,Lhs,true,Rhs,false>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{
- ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
@@ -189,12 +193,12 @@ struct TriangularProduct<Mode,false,Lhs,true,Rhs,false>
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs);
- ei_product_triangular_vector_selector
+ internal::product_triangular_vector_selector
<false,_ActualLhsType,_ActualRhsType,Dest,
Mode,
LhsBlasTraits::NeedToConjugate,
RhsBlasTraits::NeedToConjugate,
- (int(ei_traits<Rhs>::Flags)&RowMajorBit) ? RowMajor : ColMajor>
+ (int(internal::traits<Rhs>::Flags)&RowMajorBit) ? RowMajor : ColMajor>
::run(lhs,rhs,dst,actualAlpha);
}
};
diff --git a/Eigen/src/Core/products/TriangularSolverMatrix.h b/Eigen/src/Core/products/TriangularSolverMatrix.h
index 7163a800a..8b9143c2b 100644
--- a/Eigen/src/Core/products/TriangularSolverMatrix.h
+++ b/Eigen/src/Core/products/TriangularSolverMatrix.h
@@ -25,16 +25,18 @@
#ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_H
#define EIGEN_TRIANGULAR_SOLVER_MATRIX_H
+namespace internal {
+
// if the rhs is row major, let's transpose the product
template <typename Scalar, typename Index, int Side, int Mode, bool Conjugate, int TriStorageOrder>
-struct ei_triangular_solve_matrix<Scalar,Index,Side,Mode,Conjugate,TriStorageOrder,RowMajor>
+struct triangular_solve_matrix<Scalar,Index,Side,Mode,Conjugate,TriStorageOrder,RowMajor>
{
static EIGEN_DONT_INLINE void run(
Index size, Index cols,
const Scalar* tri, Index triStride,
Scalar* _other, Index otherStride)
{
- ei_triangular_solve_matrix<
+ triangular_solve_matrix<
Scalar, Index, Side==OnTheLeft?OnTheRight:OnTheLeft,
(Mode&UnitDiag) | ((Mode&Upper) ? Lower : Upper),
NumTraits<Scalar>::IsComplex && Conjugate,
@@ -46,7 +48,7 @@ struct ei_triangular_solve_matrix<Scalar,Index,Side,Mode,Conjugate,TriStorageOrd
/* Optimized triangular solver with multiple right hand side and the triangular matrix on the left
*/
template <typename Scalar, typename Index, int Mode, bool Conjugate, int TriStorageOrder>
-struct ei_triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageOrder,ColMajor>
+struct triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStorageOrder,ColMajor>
{
static EIGEN_DONT_INLINE void run(
Index size, Index otherSize,
@@ -54,10 +56,10 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStora
Scalar* _other, Index otherStride)
{
Index cols = otherSize;
- ei_const_blas_data_mapper<Scalar, Index, TriStorageOrder> tri(_tri,triStride);
- ei_blas_data_mapper<Scalar, Index, ColMajor> other(_other,otherStride);
+ const_blas_data_mapper<Scalar, Index, TriStorageOrder> tri(_tri,triStride);
+ blas_data_mapper<Scalar, Index, ColMajor> other(_other,otherStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
enum {
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
IsLower = (Mode&Lower) == Lower
@@ -74,10 +76,10 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStora
Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB);
Scalar* blockB = allocatedBlockB + sizeW;
- ei_conj_if<Conjugate> conj;
- ei_gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, Conjugate, false> gebp_kernel;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, TriStorageOrder> pack_lhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr, ColMajor, false, true> pack_rhs;
+ conj_if<Conjugate> conj;
+ gebp_kernel<Scalar, Scalar, Index, Traits::mr, Traits::nr, Conjugate, false> gebp_kernel;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, TriStorageOrder> pack_lhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr, ColMajor, false, true> pack_rhs;
for(Index k2=IsLower ? 0 : size;
IsLower ? k2<size : k2>0;
@@ -181,7 +183,7 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStora
/* Optimized triangular solver with multiple left hand sides and the trinagular matrix on the right
*/
template <typename Scalar, typename Index, int Mode, bool Conjugate, int TriStorageOrder>
-struct ei_triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor>
+struct triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor>
{
static EIGEN_DONT_INLINE void run(
Index size, Index otherSize,
@@ -189,10 +191,10 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStor
Scalar* _other, Index otherStride)
{
Index rows = otherSize;
- ei_const_blas_data_mapper<Scalar, Index, TriStorageOrder> rhs(_tri,triStride);
- ei_blas_data_mapper<Scalar, Index, ColMajor> lhs(_other,otherStride);
+ const_blas_data_mapper<Scalar, Index, TriStorageOrder> rhs(_tri,triStride);
+ blas_data_mapper<Scalar, Index, ColMajor> lhs(_other,otherStride);
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef gebp_traits<Scalar,Scalar> Traits;
enum {
RhsStorageOrder = TriStorageOrder,
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
@@ -213,11 +215,11 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStor
Scalar* allocatedBlockB = ei_aligned_stack_new(Scalar, sizeB);
Scalar* blockB = allocatedBlockB + sizeW;
- ei_conj_if<Conjugate> conj;
- ei_gebp_kernel<Scalar,Scalar, Index, Traits::mr, Traits::nr, false, Conjugate> gebp_kernel;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
- ei_gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder,false,true> pack_rhs_panel;
- ei_gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, ColMajor, false, true> pack_lhs_panel;
+ conj_if<Conjugate> conj;
+ gebp_kernel<Scalar,Scalar, Index, Traits::mr, Traits::nr, false, Conjugate> gebp_kernel;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder> pack_rhs;
+ gemm_pack_rhs<Scalar, Index, Traits::nr,RhsStorageOrder,false,true> pack_rhs_panel;
+ gemm_pack_lhs<Scalar, Index, Traits::mr, Traits::LhsProgress, ColMajor, false, true> pack_lhs_panel;
for(Index k2=IsLower ? size : 0;
IsLower ? k2>0 : k2<size;
@@ -318,4 +320,6 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStor
}
};
+} // end namespace internal
+
#endif // EIGEN_TRIANGULAR_SOLVER_MATRIX_H
diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h
index 972814dc9..d776c4507 100644
--- a/Eigen/src/Core/util/BlasUtil.h
+++ b/Eigen/src/Core/util/BlasUtil.h
@@ -28,109 +28,111 @@
// This file contains many lightweight helper classes used to
// implement and control fast level 2 and level 3 BLAS-like routines.
+namespace internal {
+
// forward declarations
template<typename LhsScalar, typename RhsScalar, typename Index, int mr, int nr, bool ConjugateLhs=false, bool ConjugateRhs=false>
-struct ei_gebp_kernel;
+struct gebp_kernel;
template<typename Scalar, typename Index, int nr, int StorageOrder, bool Conjugate = false, bool PanelMode=false>
-struct ei_gemm_pack_rhs;
+struct gemm_pack_rhs;
template<typename Scalar, typename Index, int Pack1, int Pack2, int StorageOrder, bool Conjugate = false, bool PanelMode = false>
-struct ei_gemm_pack_lhs;
+struct gemm_pack_lhs;
template<
typename Index,
typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs,
int ResStorageOrder>
-struct ei_general_matrix_matrix_product;
+struct general_matrix_matrix_product;
template<typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, typename RhsScalar, bool ConjugateRhs>
-struct ei_general_matrix_vector_product;
+struct general_matrix_vector_product;
-template<bool Conjugate> struct ei_conj_if;
+template<bool Conjugate> struct conj_if;
-template<> struct ei_conj_if<true> {
+template<> struct conj_if<true> {
template<typename T>
- inline T operator()(const T& x) { return ei_conj(x); }
+ inline T operator()(const T& x) { return conj(x); }
};
-template<> struct ei_conj_if<false> {
+template<> struct conj_if<false> {
template<typename T>
inline const T& operator()(const T& x) { return x; }
};
-template<typename Scalar> struct ei_conj_helper<Scalar,Scalar,false,false>
+template<typename Scalar> struct conj_helper<Scalar,Scalar,false,false>
{
- EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const { return ei_pmadd(x,y,c); }
- EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const { return ei_pmul(x,y); }
+ EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const { return internal::pmadd(x,y,c); }
+ EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const { return internal::pmul(x,y); }
};
-template<typename RealScalar> struct ei_conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, false,true>
+template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, false,true>
{
typedef std::complex<RealScalar> Scalar;
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
{ return c + pmul(x,y); }
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
- { return Scalar(ei_real(x)*ei_real(y) + ei_imag(x)*ei_imag(y), ei_imag(x)*ei_real(y) - ei_real(x)*ei_imag(y)); }
+ { return Scalar(real(x)*real(y) + imag(x)*imag(y), imag(x)*real(y) - real(x)*imag(y)); }
};
-template<typename RealScalar> struct ei_conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,false>
+template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,false>
{
typedef std::complex<RealScalar> Scalar;
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
{ return c + pmul(x,y); }
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
- { return Scalar(ei_real(x)*ei_real(y) + ei_imag(x)*ei_imag(y), ei_real(x)*ei_imag(y) - ei_imag(x)*ei_real(y)); }
+ { return Scalar(real(x)*real(y) + imag(x)*imag(y), real(x)*imag(y) - imag(x)*real(y)); }
};
-template<typename RealScalar> struct ei_conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,true>
+template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,true>
{
typedef std::complex<RealScalar> Scalar;
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
{ return c + pmul(x,y); }
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
- { return Scalar(ei_real(x)*ei_real(y) - ei_imag(x)*ei_imag(y), - ei_real(x)*ei_imag(y) - ei_imag(x)*ei_real(y)); }
+ { return Scalar(real(x)*real(y) - imag(x)*imag(y), - real(x)*imag(y) - imag(x)*real(y)); }
};
-template<typename RealScalar,bool Conj> struct ei_conj_helper<std::complex<RealScalar>, RealScalar, Conj,false>
+template<typename RealScalar,bool Conj> struct conj_helper<std::complex<RealScalar>, RealScalar, Conj,false>
{
typedef std::complex<RealScalar> Scalar;
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const RealScalar& y, const Scalar& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const RealScalar& y) const
- { return ei_conj_if<Conj>()(x)*y; }
+ { return conj_if<Conj>()(x)*y; }
};
-template<typename RealScalar,bool Conj> struct ei_conj_helper<RealScalar, std::complex<RealScalar>, false,Conj>
+template<typename RealScalar,bool Conj> struct conj_helper<RealScalar, std::complex<RealScalar>, false,Conj>
{
typedef std::complex<RealScalar> Scalar;
EIGEN_STRONG_INLINE Scalar pmadd(const RealScalar& x, const Scalar& y, const Scalar& c) const
- { return ei_padd(c, pmul(x,y)); }
+ { return padd(c, pmul(x,y)); }
EIGEN_STRONG_INLINE Scalar pmul(const RealScalar& x, const Scalar& y) const
- { return x*ei_conj_if<Conj>()(y); }
+ { return x*conj_if<Conj>()(y); }
};
-template<typename From,typename To> struct ei_get_factor {
+template<typename From,typename To> struct get_factor {
EIGEN_STRONG_INLINE static To run(const From& x) { return x; }
};
-template<typename Scalar> struct ei_get_factor<Scalar,typename NumTraits<Scalar>::Real> {
- EIGEN_STRONG_INLINE static typename NumTraits<Scalar>::Real run(const Scalar& x) { return ei_real(x); }
+template<typename Scalar> struct get_factor<Scalar,typename NumTraits<Scalar>::Real> {
+ EIGEN_STRONG_INLINE static typename NumTraits<Scalar>::Real run(const Scalar& x) { return real(x); }
};
// Lightweight helper class to access matrix coefficients.
// Yes, this is somehow redundant with Map<>, but this version is much much lighter,
// and so I hope better compilation performance (time and code quality).
template<typename Scalar, typename Index, int StorageOrder>
-class ei_blas_data_mapper
+class blas_data_mapper
{
public:
- ei_blas_data_mapper(Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
+ blas_data_mapper(Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
EIGEN_STRONG_INLINE Scalar& operator()(Index i, Index j)
{ return m_data[StorageOrder==RowMajor ? j + i*m_stride : i + j*m_stride]; }
protected:
@@ -140,10 +142,10 @@ class ei_blas_data_mapper
// lightweight helper class to access matrix coefficients (const version)
template<typename Scalar, typename Index, int StorageOrder>
-class ei_const_blas_data_mapper
+class const_blas_data_mapper
{
public:
- ei_const_blas_data_mapper(const Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
+ const_blas_data_mapper(const Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
EIGEN_STRONG_INLINE const Scalar& operator()(Index i, Index j) const
{ return m_data[StorageOrder==RowMajor ? j + i*m_stride : i + j*m_stride]; }
protected:
@@ -155,9 +157,9 @@ class ei_const_blas_data_mapper
/* Helper class to analyze the factors of a Product expression.
* In particular it allows to pop out operator-, scalar multiples,
* and conjugate */
-template<typename XprType> struct ei_blas_traits
+template<typename XprType> struct blas_traits
{
- typedef typename ei_traits<XprType>::Scalar Scalar;
+ typedef typename traits<XprType>::Scalar Scalar;
typedef const XprType& ExtractType;
typedef XprType _ExtractType;
enum {
@@ -168,24 +170,24 @@ template<typename XprType> struct ei_blas_traits
&& ( /* Uncomment this when the low-level matrix-vector product functions support strided vectors
bool(XprType::IsVectorAtCompileTime)
|| */
- int(ei_inner_stride_at_compile_time<XprType>::ret) == 1)
+ int(inner_stride_at_compile_time<XprType>::ret) == 1)
) ? 1 : 0
};
- typedef typename ei_meta_if<bool(HasUsableDirectAccess),
+ typedef typename conditional<bool(HasUsableDirectAccess),
ExtractType,
typename _ExtractType::PlainObject
- >::ret DirectLinearAccessType;
+ >::type DirectLinearAccessType;
static inline ExtractType extract(const XprType& x) { return x; }
static inline Scalar extractScalarFactor(const XprType&) { return Scalar(1); }
};
// pop conjugate
template<typename Scalar, typename NestedXpr>
-struct ei_blas_traits<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestedXpr> >
- : ei_blas_traits<NestedXpr>
+struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> >
+ : blas_traits<NestedXpr>
{
- typedef ei_blas_traits<NestedXpr> Base;
- typedef CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestedXpr> XprType;
+ typedef blas_traits<NestedXpr> Base;
+ typedef CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType;
enum {
@@ -193,16 +195,16 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestedXpr> >
NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
};
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
- static inline Scalar extractScalarFactor(const XprType& x) { return ei_conj(Base::extractScalarFactor(x.nestedExpression())); }
+ static inline Scalar extractScalarFactor(const XprType& x) { return conj(Base::extractScalarFactor(x.nestedExpression())); }
};
// pop scalar multiple
template<typename Scalar, typename NestedXpr>
-struct ei_blas_traits<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> >
- : ei_blas_traits<NestedXpr>
+struct blas_traits<CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> >
+ : blas_traits<NestedXpr>
{
- typedef ei_blas_traits<NestedXpr> Base;
- typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> XprType;
+ typedef blas_traits<NestedXpr> Base;
+ typedef CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType;
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x)
@@ -211,11 +213,11 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> >
// pop opposite
template<typename Scalar, typename NestedXpr>
-struct ei_blas_traits<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> >
- : ei_blas_traits<NestedXpr>
+struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> >
+ : blas_traits<NestedXpr>
{
- typedef ei_blas_traits<NestedXpr> Base;
- typedef CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> XprType;
+ typedef blas_traits<NestedXpr> Base;
+ typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType;
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x)
@@ -224,18 +226,18 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> >
// pop/push transpose
template<typename NestedXpr>
-struct ei_blas_traits<Transpose<NestedXpr> >
- : ei_blas_traits<NestedXpr>
+struct blas_traits<Transpose<NestedXpr> >
+ : blas_traits<NestedXpr>
{
typedef typename NestedXpr::Scalar Scalar;
- typedef ei_blas_traits<NestedXpr> Base;
+ typedef blas_traits<NestedXpr> Base;
typedef Transpose<NestedXpr> XprType;
typedef Transpose<typename Base::_ExtractType> ExtractType;
typedef Transpose<typename Base::_ExtractType> _ExtractType;
- typedef typename ei_meta_if<bool(Base::HasUsableDirectAccess),
+ typedef typename conditional<bool(Base::HasUsableDirectAccess),
ExtractType,
typename ExtractType::PlainObject
- >::ret DirectLinearAccessType;
+ >::type DirectLinearAccessType;
enum {
IsTransposed = Base::IsTransposed ? 0 : 1
};
@@ -243,22 +245,24 @@ struct ei_blas_traits<Transpose<NestedXpr> >
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
};
-template<typename T, bool HasUsableDirectAccess=ei_blas_traits<T>::HasUsableDirectAccess>
-struct ei_extract_data_selector {
+template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectAccess>
+struct extract_data_selector {
static const typename T::Scalar* run(const T& m)
{
- return &ei_blas_traits<T>::extract(m).const_cast_derived().coeffRef(0,0); // FIXME this should be .data()
+ return &blas_traits<T>::extract(m).const_cast_derived().coeffRef(0,0); // FIXME this should be .data()
}
};
template<typename T>
-struct ei_extract_data_selector<T,false> {
+struct extract_data_selector<T,false> {
static typename T::Scalar* run(const T&) { return 0; }
};
-template<typename T> const typename T::Scalar* ei_extract_data(const T& m)
+template<typename T> const typename T::Scalar* extract_data(const T& m)
{
- return ei_extract_data_selector<T>::run(m);
+ return extract_data_selector<T>::run(m);
}
+} // end namespace internal
+
#endif // EIGEN_BLASUTIL_H
diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h
index 60da5c76a..99b4f3319 100644
--- a/Eigen/src/Core/util/Constants.h
+++ b/Eigen/src/Core/util/Constants.h
@@ -125,27 +125,33 @@ const unsigned int LinearAccessBit = 0x10;
/** \ingroup flags
*
- * Means that the underlying array of coefficients can be directly accessed. This means two things.
- * First, references to the coefficients must be available through coeffRef(int, int). This rules out read-only
- * expressions whose coefficients are computed on demand by coeff(int, int). Second, the memory layout of the
- * array of coefficients must be exactly the natural one suggested by rows(), cols(), outerStride(), innerStride(), and the RowMajorBit.
- * This rules out expressions such as Diagonal, whose coefficients, though referencable, do not have
- * such a regular memory layout.
+ * Means the expression has a coeffRef() method, i.e. is writable as its individual coefficients are directly addressable.
+ * This rules out read-only expressions.
+ *
+ * Note that DirectAccessBit implies LvalueBit, but the converse is false: LvalueBit doesn't imply DirectAccessBit because
+ * DirectAccessBit means that the whole memory layout is a plain strided array.
+ *
+ * Expressions having LvalueBit also have their coeff() method returning a const reference instead of returning a new value.
*/
-const unsigned int DirectAccessBit = 0x20;
+const unsigned int LvalueBit = 0x20;
/** \ingroup flags
*
- * means the first coefficient packet is guaranteed to be aligned */
-const unsigned int AlignedBit = 0x40;
+ * Means that the underlying array of coefficients can be directly accessed. This means two things.
+ *
+ * First, this means LvalueBit, i.e. this means that the expression has a coeffRef() method, i.e. is writable as its
+ * individual coefficients are directly addressable. This rules out read-only expressions.
+ *
+ * Second, the memory layout of the array of coefficients must be exactly the natural one suggested by rows(), cols(),
+ * outerStride(), innerStride(), and the RowMajorBit. This rules out expressions such as Diagonal, whose coefficients,
+ * though referencable, do not have such a regular memory layout.
+ */
+const unsigned int DirectAccessBit = 0x40;
/** \ingroup flags
*
- * Means the expression is writable. Note that DirectAccessBit implies LvalueBit.
- * Internaly, it is mainly used to enable the writable coeff accessors, and makes
- * the read-only coeff accessors to return by const reference.
- */
-const unsigned int LvalueBit = 0x80;
+ * means the first coefficient packet is guaranteed to be aligned */
+const unsigned int AlignedBit = 0x80;
const unsigned int NestByRefBit = 0x100;
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h
index e69957a31..0d0b905ea 100644
--- a/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -26,19 +26,22 @@
#ifndef EIGEN_FORWARDDECLARATIONS_H
#define EIGEN_FORWARDDECLARATIONS_H
-template<typename T> struct ei_traits;
-template<typename T> struct NumTraits;
+namespace internal {
+template<typename T> struct traits;
-template<typename Derived> struct ei_has_direct_access
+template<typename Derived> struct has_direct_access
{
- enum { ret = (ei_traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 };
+ enum { ret = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 };
};
+} // end namespace internal
+
+template<typename T> struct NumTraits;
template<typename Derived> struct EigenBase;
template<typename Derived> class DenseBase;
template<typename Derived,
- AccessorLevels Level = (ei_traits<Derived>::Flags & DirectAccessBit) ? DirectAccessors
- : (ei_traits<Derived>::Flags & LvalueBit) ? WriteAccessors
+ AccessorLevels Level = (internal::traits<Derived>::Flags & DirectAccessBit) ? DirectAccessors
+ : (internal::traits<Derived>::Flags & LvalueBit) ? WriteAccessors
: ReadOnlyAccessors>
class DenseCoeffsBase;
@@ -61,7 +64,7 @@ template<typename ExpressionType> class ForceAlignedAccess;
template<typename ExpressionType> class SwapWrapper;
template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false,
- bool HasDirectAccess = ei_has_direct_access<XprType>::ret> class Block;
+ bool HasDirectAccess = internal::has_direct_access<XprType>::ret> class Block;
template<typename MatrixType, int Size=Dynamic> class VectorBlock;
template<typename MatrixType> class Transpose;
@@ -95,58 +98,67 @@ template<typename MatrixType> struct CommaInitializer;
template<typename Derived> class ReturnByValue;
template<typename ExpressionType> class ArrayWrapper;
-template<typename DecompositionType, typename Rhs> struct ei_solve_retval_base;
-template<typename DecompositionType, typename Rhs> struct ei_solve_retval;
-template<typename DecompositionType> struct ei_kernel_retval_base;
-template<typename DecompositionType> struct ei_kernel_retval;
-template<typename DecompositionType> struct ei_image_retval_base;
-template<typename DecompositionType> struct ei_image_retval;
+namespace internal {
+template<typename DecompositionType, typename Rhs> struct solve_retval_base;
+template<typename DecompositionType, typename Rhs> struct solve_retval;
+template<typename DecompositionType> struct kernel_retval_base;
+template<typename DecompositionType> struct kernel_retval;
+template<typename DecompositionType> struct image_retval_base;
+template<typename DecompositionType> struct image_retval;
+} // end namespace internal
template<typename _Scalar, int Rows=Dynamic, int Cols=Dynamic, int Supers=Dynamic, int Subs=Dynamic, int Options=0> class BandMatrix;
-template<typename Lhs, typename Rhs> struct ei_product_type;
+namespace internal {
+template<typename Lhs, typename Rhs> struct product_type;
+}
+
template<typename Lhs, typename Rhs,
- int ProductType = ei_product_type<Lhs,Rhs>::value>
+ int ProductType = internal::product_type<Lhs,Rhs>::value>
struct ProductReturnType;
// this is a workaround for sun CC
template<typename Lhs, typename Rhs> struct LazyProductReturnType;
+namespace internal {
+
// Provides scalar/packet-wise product and product with accumulation
// with optional conjugation of the arguments.
-template<typename LhsScalar, typename RhsScalar, bool ConjLhs=false, bool ConjRhs=false> struct ei_conj_helper;
-
-template<typename Scalar> struct ei_scalar_sum_op;
-template<typename Scalar> struct ei_scalar_difference_op;
-template<typename Scalar> struct ei_scalar_conj_product_op;
-template<typename Scalar> struct ei_scalar_quotient_op;
-template<typename Scalar> struct ei_scalar_opposite_op;
-template<typename Scalar> struct ei_scalar_conjugate_op;
-template<typename Scalar> struct ei_scalar_real_op;
-template<typename Scalar> struct ei_scalar_imag_op;
-template<typename Scalar> struct ei_scalar_abs_op;
-template<typename Scalar> struct ei_scalar_abs2_op;
-template<typename Scalar> struct ei_scalar_sqrt_op;
-template<typename Scalar> struct ei_scalar_exp_op;
-template<typename Scalar> struct ei_scalar_log_op;
-template<typename Scalar> struct ei_scalar_cos_op;
-template<typename Scalar> struct ei_scalar_sin_op;
-template<typename Scalar> struct ei_scalar_pow_op;
-template<typename Scalar> struct ei_scalar_inverse_op;
-template<typename Scalar> struct ei_scalar_square_op;
-template<typename Scalar> struct ei_scalar_cube_op;
-template<typename Scalar, typename NewType> struct ei_scalar_cast_op;
-template<typename Scalar> struct ei_scalar_multiple_op;
-template<typename Scalar> struct ei_scalar_quotient1_op;
-template<typename Scalar> struct ei_scalar_min_op;
-template<typename Scalar> struct ei_scalar_max_op;
-template<typename Scalar> struct ei_scalar_random_op;
-template<typename Scalar> struct ei_scalar_add_op;
-template<typename Scalar> struct ei_scalar_constant_op;
-template<typename Scalar> struct ei_scalar_identity_op;
-
-template<typename LhsScalar,typename RhsScalar=LhsScalar> struct ei_scalar_product_op;
-template<typename LhsScalar,typename RhsScalar> struct ei_scalar_multiple2_op;
+template<typename LhsScalar, typename RhsScalar, bool ConjLhs=false, bool ConjRhs=false> struct conj_helper;
+
+template<typename Scalar> struct scalar_sum_op;
+template<typename Scalar> struct scalar_difference_op;
+template<typename Scalar> struct scalar_conj_product_op;
+template<typename Scalar> struct scalar_quotient_op;
+template<typename Scalar> struct scalar_opposite_op;
+template<typename Scalar> struct scalar_conjugate_op;
+template<typename Scalar> struct scalar_real_op;
+template<typename Scalar> struct scalar_imag_op;
+template<typename Scalar> struct scalar_abs_op;
+template<typename Scalar> struct scalar_abs2_op;
+template<typename Scalar> struct scalar_sqrt_op;
+template<typename Scalar> struct scalar_exp_op;
+template<typename Scalar> struct scalar_log_op;
+template<typename Scalar> struct scalar_cos_op;
+template<typename Scalar> struct scalar_sin_op;
+template<typename Scalar> struct scalar_pow_op;
+template<typename Scalar> struct scalar_inverse_op;
+template<typename Scalar> struct scalar_square_op;
+template<typename Scalar> struct scalar_cube_op;
+template<typename Scalar, typename NewType> struct scalar_cast_op;
+template<typename Scalar> struct scalar_multiple_op;
+template<typename Scalar> struct scalar_quotient1_op;
+template<typename Scalar> struct scalar_min_op;
+template<typename Scalar> struct scalar_max_op;
+template<typename Scalar> struct scalar_random_op;
+template<typename Scalar> struct scalar_add_op;
+template<typename Scalar> struct scalar_constant_op;
+template<typename Scalar> struct scalar_identity_op;
+
+template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_product_op;
+template<typename LhsScalar,typename RhsScalar> struct scalar_multiple2_op;
+
+} // end namespace internal
struct IOFormat;
@@ -165,16 +177,17 @@ template<typename MatrixType, int Direction = BothDirections> class Reverse;
template<typename MatrixType> class FullPivLU;
template<typename MatrixType> class PartialPivLU;
-template<typename MatrixType> struct ei_inverse_impl;
+namespace internal {
+template<typename MatrixType> struct inverse_impl;
+}
template<typename MatrixType> class HouseholderQR;
template<typename MatrixType> class ColPivHouseholderQR;
template<typename MatrixType> class FullPivHouseholderQR;
-template<typename MatrixType> class SVD;
-template<typename MatrixType, int QRPreconditioner = FullPivHouseholderQRPreconditioner> class JacobiSVD;
+template<typename MatrixType, int QRPreconditioner = ColPivHouseholderQRPreconditioner> class JacobiSVD;
template<typename MatrixType, int UpLo = Lower> class LLT;
template<typename MatrixType, int UpLo = Lower> class LDLT;
template<typename VectorsType, typename CoeffsType, int Side=OnTheLeft> class HouseholderSequence;
-template<typename Scalar> class PlanarRotation;
+template<typename Scalar> class JacobiRotation;
// Geometry module:
template<typename Derived, int _Dim> class RotationBase;
@@ -193,12 +206,15 @@ template<typename MatrixType,int Direction> class Homogeneous;
// MatrixFunctions module
template<typename Derived> struct MatrixExponentialReturnValue;
template<typename Derived> class MatrixFunctionReturnValue;
+
+namespace internal {
template <typename Scalar>
-struct ei_stem_function
+struct stem_function
{
typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
typedef ComplexScalar type(ComplexScalar, int);
};
+}
#ifdef EIGEN2_SUPPORT
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 319c6c5fc..0cea94852 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -27,7 +27,7 @@
#define EIGEN_MACROS_H
#define EIGEN_WORLD_VERSION 2
-#define EIGEN_MAJOR_VERSION 91
+#define EIGEN_MAJOR_VERSION 92
#define EIGEN_MINOR_VERSION 0
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
@@ -128,18 +128,18 @@
# endif
#endif
-#ifndef ei_assert
+#ifndef eigen_assert
#ifdef EIGEN_NO_DEBUG
-#define ei_assert(x)
+#define eigen_assert(x)
#else
-#define ei_assert(x) assert(x)
+#define eigen_assert(x) assert(x)
#endif
#endif
#ifdef EIGEN_INTERNAL_DEBUGGING
-#define ei_internal_assert(x) ei_assert(x)
+#define eigen_internal_assert(x) eigen_assert(x)
#else
-#define ei_internal_assert(x)
+#define eigen_internal_assert(x)
#endif
#ifdef EIGEN_NO_DEBUG
@@ -160,7 +160,7 @@
#define EIGEN_ALWAYS_INLINE_ATTRIB
#endif
-#if EIGEN_GNUC_AT_LEAST(4,0)
+#if EIGEN_GNUC_AT_LEAST(4,1)
#define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
#else
#define EIGEN_FLATTEN_ATTRIB
@@ -295,35 +295,35 @@
**/
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
- typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
+ typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \
typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \
- typedef typename Eigen::ei_nested<Derived>::type Nested; \
- typedef typename Eigen::ei_traits<Derived>::StorageKind StorageKind; \
- typedef typename Eigen::ei_traits<Derived>::Index Index; \
- enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
- ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
- Flags = Eigen::ei_traits<Derived>::Flags, \
- CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
+ typedef typename Eigen::internal::nested<Derived>::type Nested; \
+ typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
+ typedef typename Eigen::internal::traits<Derived>::Index Index; \
+ enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
+ ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
+ Flags = Eigen::internal::traits<Derived>::Flags, \
+ CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
- typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
+ typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \
typedef typename Base::PacketScalar PacketScalar; \
typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \
- typedef typename Eigen::ei_nested<Derived>::type Nested; \
- typedef typename Eigen::ei_traits<Derived>::StorageKind StorageKind; \
- typedef typename Eigen::ei_traits<Derived>::Index Index; \
- enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
- ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
- MaxRowsAtCompileTime = Eigen::ei_traits<Derived>::MaxRowsAtCompileTime, \
- MaxColsAtCompileTime = Eigen::ei_traits<Derived>::MaxColsAtCompileTime, \
- Flags = Eigen::ei_traits<Derived>::Flags, \
- CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
+ typedef typename Eigen::internal::nested<Derived>::type Nested; \
+ typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
+ typedef typename Eigen::internal::traits<Derived>::Index Index; \
+ enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
+ ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
+ MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
+ MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
+ Flags = Eigen::internal::traits<Derived>::Flags, \
+ CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
@@ -371,9 +371,9 @@
// the expression type of a cwise product
#define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
CwiseBinaryOp< \
- ei_scalar_product_op< \
- typename ei_traits<LHS>::Scalar, \
- typename ei_traits<RHS>::Scalar \
+ internal::scalar_product_op< \
+ typename internal::traits<LHS>::Scalar, \
+ typename internal::traits<RHS>::Scalar \
>, \
LHS, \
RHS \
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 362ccf18e..51ec78f1a 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -80,6 +80,8 @@
#define EIGEN_HAS_MM_MALLOC 0
#endif
+namespace internal {
+
/*****************************************************************************
*** Implementation of handmade aligned functions ***
*****************************************************************************/
@@ -89,7 +91,7 @@
/** \internal Like malloc, but the returned pointer is guaranteed to be 16-byte aligned.
* Fast, but wastes 16 additional bytes of memory. Does not throw any exception.
*/
-inline void* ei_handmade_aligned_malloc(size_t size)
+inline void* handmade_aligned_malloc(size_t size)
{
void *original = std::malloc(size+16);
if (original == 0) return 0;
@@ -98,8 +100,8 @@ inline void* ei_handmade_aligned_malloc(size_t size)
return aligned;
}
-/** \internal Frees memory allocated with ei_handmade_aligned_malloc */
-inline void ei_handmade_aligned_free(void *ptr)
+/** \internal Frees memory allocated with handmade_aligned_malloc */
+inline void handmade_aligned_free(void *ptr)
{
if (ptr) std::free(*(reinterpret_cast<void**>(ptr) - 1));
}
@@ -109,9 +111,9 @@ inline void ei_handmade_aligned_free(void *ptr)
* Since we know that our handmade version is based on std::realloc
* we can use std::realloc to implement efficient reallocation.
*/
-inline void* ei_handmade_aligned_realloc(void* ptr, size_t size, size_t = 0)
+inline void* handmade_aligned_realloc(void* ptr, size_t size, size_t = 0)
{
- if (ptr == 0) return ei_handmade_aligned_malloc(size);
+ if (ptr == 0) return handmade_aligned_malloc(size);
void *original = *(reinterpret_cast<void**>(ptr) - 1);
original = std::realloc(original,size+16);
if (original == 0) return 0;
@@ -124,26 +126,26 @@ inline void* ei_handmade_aligned_realloc(void* ptr, size_t size, size_t = 0)
*** Implementation of generic aligned realloc (when no realloc can be used)***
*****************************************************************************/
-void* ei_aligned_malloc(size_t size);
-void ei_aligned_free(void *ptr);
+void* aligned_malloc(size_t size);
+void aligned_free(void *ptr);
/** \internal
* \brief Reallocates aligned memory.
* Allows reallocation with aligned ptr types. This implementation will
* always create a new memory chunk and copy the old data.
*/
-inline void* ei_generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
+inline void* generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
{
if (ptr==0)
- return ei_aligned_malloc(size);
+ return aligned_malloc(size);
if (size==0)
{
- ei_aligned_free(ptr);
+ aligned_free(ptr);
return 0;
}
- void* newptr = ei_aligned_malloc(size);
+ void* newptr = aligned_malloc(size);
if (newptr == 0)
{
#ifdef EIGEN_HAS_ERRNO
@@ -155,7 +157,7 @@ inline void* ei_generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
if (ptr != 0)
{
std::memcpy(newptr, ptr, std::min(size,old_size));
- ei_aligned_free(ptr);
+ aligned_free(ptr);
}
return newptr;
@@ -168,10 +170,10 @@ inline void* ei_generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
/** \internal Allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment.
* On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
*/
-inline void* ei_aligned_malloc(size_t size)
+inline void* aligned_malloc(size_t size)
{
#ifdef EIGEN_NO_MALLOC
- ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
+ eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif
void *result;
@@ -186,7 +188,7 @@ inline void* ei_aligned_malloc(size_t size)
#elif (defined _MSC_VER)
result = _aligned_malloc(size, 16);
#else
- result = ei_handmade_aligned_malloc(size);
+ result = handmade_aligned_malloc(size);
#endif
#ifdef EIGEN_EXCEPTIONS
@@ -196,8 +198,8 @@ inline void* ei_aligned_malloc(size_t size)
return result;
}
-/** \internal Frees memory allocated with ei_aligned_malloc. */
-inline void ei_aligned_free(void *ptr)
+/** \internal Frees memory allocated with aligned_malloc. */
+inline void aligned_free(void *ptr)
{
#if !EIGEN_ALIGN
std::free(ptr);
@@ -210,7 +212,7 @@ inline void ei_aligned_free(void *ptr)
#elif defined(_MSC_VER)
_aligned_free(ptr);
#else
- ei_handmade_aligned_free(ptr);
+ handmade_aligned_free(ptr);
#endif
}
@@ -219,7 +221,7 @@ inline void ei_aligned_free(void *ptr)
* \brief Reallocates an aligned block of memory.
* \throws std::bad_alloc if EIGEN_EXCEPTIONS are defined.
**/
-inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size)
+inline void* aligned_realloc(void *ptr, size_t new_size, size_t old_size)
{
EIGEN_UNUSED_VARIABLE(old_size);
@@ -229,7 +231,7 @@ inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size)
#elif EIGEN_MALLOC_ALREADY_ALIGNED
result = std::realloc(ptr,new_size);
#elif EIGEN_HAS_POSIX_MEMALIGN
- result = ei_generic_aligned_realloc(ptr,new_size,old_size);
+ result = generic_aligned_realloc(ptr,new_size,old_size);
#elif EIGEN_HAS_MM_MALLOC
// The defined(_mm_free) is just here to verify that this MSVC version
// implements _mm_malloc/_mm_free based on the corresponding _aligned_
@@ -237,12 +239,12 @@ inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size)
#if defined(_MSC_VER) && defined(_mm_free)
result = _aligned_realloc(ptr,new_size,16);
#else
- result = ei_generic_aligned_realloc(ptr,new_size,old_size);
+ result = generic_aligned_realloc(ptr,new_size,old_size);
#endif
#elif defined(_MSC_VER)
result = _aligned_realloc(ptr,new_size,16);
#else
- result = ei_handmade_aligned_realloc(ptr,new_size,old_size);
+ result = handmade_aligned_realloc(ptr,new_size,old_size);
#endif
#ifdef EIGEN_EXCEPTIONS
@@ -259,15 +261,15 @@ inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size)
/** \internal Allocates \a size bytes. If Align is true, then the returned ptr is 16-byte-aligned.
* On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
*/
-template<bool Align> inline void* ei_conditional_aligned_malloc(size_t size)
+template<bool Align> inline void* conditional_aligned_malloc(size_t size)
{
- return ei_aligned_malloc(size);
+ return aligned_malloc(size);
}
-template<> inline void* ei_conditional_aligned_malloc<false>(size_t size)
+template<> inline void* conditional_aligned_malloc<false>(size_t size)
{
#ifdef EIGEN_NO_MALLOC
- ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
+ eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif
void *result = std::malloc(size);
@@ -277,23 +279,23 @@ template<> inline void* ei_conditional_aligned_malloc<false>(size_t size)
return result;
}
-/** \internal Frees memory allocated with ei_conditional_aligned_malloc */
-template<bool Align> inline void ei_conditional_aligned_free(void *ptr)
+/** \internal Frees memory allocated with conditional_aligned_malloc */
+template<bool Align> inline void conditional_aligned_free(void *ptr)
{
- ei_aligned_free(ptr);
+ aligned_free(ptr);
}
-template<> inline void ei_conditional_aligned_free<false>(void *ptr)
+template<> inline void conditional_aligned_free<false>(void *ptr)
{
std::free(ptr);
}
-template<bool Align> inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size)
+template<bool Align> inline void* conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size)
{
- return ei_aligned_realloc(ptr, new_size, old_size);
+ return aligned_realloc(ptr, new_size, old_size);
}
-template<> inline void* ei_conditional_aligned_realloc<false>(void* ptr, size_t new_size, size_t)
+template<> inline void* conditional_aligned_realloc<false>(void* ptr, size_t new_size, size_t)
{
return std::realloc(ptr, new_size);
}
@@ -305,7 +307,7 @@ template<> inline void* ei_conditional_aligned_realloc<false>(void* ptr, size_t
/** \internal Constructs the elements of an array.
* The \a size parameter tells on how many objects to call the constructor of T.
*/
-template<typename T> inline T* ei_construct_elements_of_array(T *ptr, size_t size)
+template<typename T> inline T* construct_elements_of_array(T *ptr, size_t size)
{
for (size_t i=0; i < size; ++i) ::new (ptr + i) T;
return ptr;
@@ -314,7 +316,7 @@ template<typename T> inline T* ei_construct_elements_of_array(T *ptr, size_t siz
/** \internal Destructs the elements of an array.
* The \a size parameters tells on how many objects to call the destructor of T.
*/
-template<typename T> inline void ei_destruct_elements_of_array(T *ptr, size_t size)
+template<typename T> inline void destruct_elements_of_array(T *ptr, size_t size)
{
// always destruct an array starting from the end.
if(ptr)
@@ -329,41 +331,41 @@ template<typename T> inline void ei_destruct_elements_of_array(T *ptr, size_t si
* On allocation error, the returned pointer is undefined, but if exceptions are enabled then a std::bad_alloc is thrown.
* The default constructor of T is called.
*/
-template<typename T> inline T* ei_aligned_new(size_t size)
+template<typename T> inline T* aligned_new(size_t size)
{
- T *result = reinterpret_cast<T*>(ei_aligned_malloc(sizeof(T)*size));
- return ei_construct_elements_of_array(result, size);
+ T *result = reinterpret_cast<T*>(aligned_malloc(sizeof(T)*size));
+ return construct_elements_of_array(result, size);
}
-template<typename T, bool Align> inline T* ei_conditional_aligned_new(size_t size)
+template<typename T, bool Align> inline T* conditional_aligned_new(size_t size)
{
- T *result = reinterpret_cast<T*>(ei_conditional_aligned_malloc<Align>(sizeof(T)*size));
- return ei_construct_elements_of_array(result, size);
+ T *result = reinterpret_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T)*size));
+ return construct_elements_of_array(result, size);
}
-/** \internal Deletes objects constructed with ei_aligned_new
+/** \internal Deletes objects constructed with aligned_new
* The \a size parameters tells on how many objects to call the destructor of T.
*/
-template<typename T> inline void ei_aligned_delete(T *ptr, size_t size)
+template<typename T> inline void aligned_delete(T *ptr, size_t size)
{
- ei_destruct_elements_of_array<T>(ptr, size);
- ei_aligned_free(ptr);
+ destruct_elements_of_array<T>(ptr, size);
+ aligned_free(ptr);
}
-/** \internal Deletes objects constructed with ei_conditional_aligned_new
+/** \internal Deletes objects constructed with conditional_aligned_new
* The \a size parameters tells on how many objects to call the destructor of T.
*/
-template<typename T, bool Align> inline void ei_conditional_aligned_delete(T *ptr, size_t size)
+template<typename T, bool Align> inline void conditional_aligned_delete(T *ptr, size_t size)
{
- ei_destruct_elements_of_array<T>(ptr, size);
- ei_conditional_aligned_free<Align>(ptr);
+ destruct_elements_of_array<T>(ptr, size);
+ conditional_aligned_free<Align>(ptr);
}
-template<typename T, bool Align> inline T* ei_conditional_aligned_realloc_new(T* pts, size_t new_size, size_t old_size)
+template<typename T, bool Align> inline T* conditional_aligned_realloc_new(T* pts, size_t new_size, size_t old_size)
{
- T *result = reinterpret_cast<T*>(ei_conditional_aligned_realloc<Align>(reinterpret_cast<void*>(pts), sizeof(T)*new_size, sizeof(T)*old_size));
+ T *result = reinterpret_cast<T*>(conditional_aligned_realloc<Align>(reinterpret_cast<void*>(pts), sizeof(T)*new_size, sizeof(T)*old_size));
if (new_size > old_size)
- ei_construct_elements_of_array(result+old_size, new_size-old_size);
+ construct_elements_of_array(result+old_size, new_size-old_size);
return result;
}
@@ -383,13 +385,13 @@ template<typename T, bool Align> inline T* ei_conditional_aligned_realloc_new(T*
* other hand, we do not assume that the array address is a multiple of sizeof(Scalar), as that fails for
* example with Scalar=double on certain 32-bit platforms, see bug #79.
*
- * There is also the variant ei_first_aligned(const MatrixBase&) defined in DenseCoeffsBase.h.
+ * There is also the variant first_aligned(const MatrixBase&) defined in DenseCoeffsBase.h.
*/
template<typename Scalar, typename Index>
-inline static Index ei_first_aligned(const Scalar* array, Index size)
+inline static Index first_aligned(const Scalar* array, Index size)
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- enum { PacketSize = ei_packet_traits<Scalar>::size,
+ typedef typename packet_traits<Scalar>::type Packet;
+ enum { PacketSize = packet_traits<Scalar>::size,
PacketAlignedMask = PacketSize-1
};
@@ -412,6 +414,8 @@ inline static Index ei_first_aligned(const Scalar* array, Index size)
}
}
+} // end namespace internal
+
/*****************************************************************************
*** Implementation of runtime stack allocation (falling back to malloc) ***
*****************************************************************************/
@@ -431,20 +435,20 @@ inline static Index ei_first_aligned(const Scalar* array, Index size)
#if (defined __linux__)
#define ei_aligned_stack_alloc(SIZE) (SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) \
? alloca(SIZE) \
- : ei_aligned_malloc(SIZE)
- #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) ei_aligned_free(PTR)
+ : Eigen::internal::aligned_malloc(SIZE)
+ #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) Eigen::internal::aligned_free(PTR)
#elif defined(_MSC_VER)
#define ei_aligned_stack_alloc(SIZE) (SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) \
? _alloca(SIZE) \
- : ei_aligned_malloc(SIZE)
- #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) ei_aligned_free(PTR)
+ : Eigen::internal::aligned_malloc(SIZE)
+ #define ei_aligned_stack_free(PTR,SIZE) if(SIZE>EIGEN_STACK_ALLOCATION_LIMIT) Eigen::internal::aligned_free(PTR)
#else
- #define ei_aligned_stack_alloc(SIZE) ei_aligned_malloc(SIZE)
- #define ei_aligned_stack_free(PTR,SIZE) ei_aligned_free(PTR)
+ #define ei_aligned_stack_alloc(SIZE) Eigen::internal::aligned_malloc(SIZE)
+ #define ei_aligned_stack_free(PTR,SIZE) Eigen::internal::aligned_free(PTR)
#endif
-#define ei_aligned_stack_new(TYPE,SIZE) ei_construct_elements_of_array(reinterpret_cast<TYPE*>(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE)
-#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {ei_destruct_elements_of_array<TYPE>(PTR, SIZE); \
+#define ei_aligned_stack_new(TYPE,SIZE) Eigen::internal::construct_elements_of_array(reinterpret_cast<TYPE*>(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE)
+#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {Eigen::internal::destruct_elements_of_array<TYPE>(PTR, SIZE); \
ei_aligned_stack_free(PTR,sizeof(TYPE)*SIZE);} while(0)
@@ -456,26 +460,26 @@ inline static Index ei_first_aligned(const Scalar* array, Index size)
#ifdef EIGEN_EXCEPTIONS
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
void* operator new(size_t size, const std::nothrow_t&) throw() { \
- try { return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); } \
+ try { return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); } \
catch (...) { return 0; } \
return 0; \
}
#else
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
void* operator new(size_t size, const std::nothrow_t&) throw() { \
- return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
+ return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); \
}
#endif
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) \
void *operator new(size_t size) { \
- return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
+ return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); \
} \
void *operator new[](size_t size) { \
- return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
+ return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); \
} \
- void operator delete(void * ptr) throw() { Eigen::ei_conditional_aligned_free<NeedsToAlign>(ptr); } \
- void operator delete[](void * ptr) throw() { Eigen::ei_conditional_aligned_free<NeedsToAlign>(ptr); } \
+ void operator delete(void * ptr) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \
+ void operator delete[](void * ptr) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \
/* in-place new and delete. since (at least afaik) there is no actual */ \
/* memory allocated we can safely let the default implementation handle */ \
/* this particular case. */ \
@@ -484,9 +488,9 @@ inline static Index ei_first_aligned(const Scalar* array, Index size)
/* nothrow-new (returns zero instead of std::bad_alloc) */ \
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
void operator delete(void *ptr, const std::nothrow_t&) throw() { \
- Eigen::ei_conditional_aligned_free<NeedsToAlign>(ptr); \
+ Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); \
} \
- typedef void ei_operator_new_marker_type;
+ typedef void eigen_aligned_operator_new_marker_type;
#else
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
#endif
@@ -564,7 +568,7 @@ public:
pointer allocate( size_type num, const_pointer* hint = 0 )
{
static_cast<void>( hint ); // suppress unused variable warning
- return static_cast<pointer>( ei_aligned_malloc( num * sizeof(T) ) );
+ return static_cast<pointer>( internal::aligned_malloc( num * sizeof(T) ) );
}
void construct( pointer p, const T& value )
@@ -579,7 +583,7 @@ public:
void deallocate( pointer p, size_type /*num*/ )
{
- ei_aligned_free( p );
+ internal::aligned_free( p );
}
bool operator!=(const aligned_allocator<T>& ) const
@@ -605,13 +609,16 @@ public:
# endif
#endif
+namespace internal {
+
#ifdef EIGEN_CPUID
-inline bool ei_cpuid_is_vendor(int abcd[4], const char* vendor)
+
+inline bool cpuid_is_vendor(int abcd[4], const char* vendor)
{
return abcd[1]==((int*)(vendor))[0] && abcd[3]==((int*)(vendor))[1] && abcd[2]==((int*)(vendor))[2];
}
-inline void ei_queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
+inline void queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
{
int abcd[4];
l1 = l2 = l3 = 0;
@@ -643,7 +650,7 @@ inline void ei_queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
} while(cache_type>0 && cache_id<16);
}
-inline void ei_queryCacheSizes_intel_codes(int& l1, int& l2, int& l3)
+inline void queryCacheSizes_intel_codes(int& l1, int& l2, int& l3)
{
int abcd[4];
abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
@@ -723,15 +730,15 @@ inline void ei_queryCacheSizes_intel_codes(int& l1, int& l2, int& l3)
l3 *= 1024;
}
-inline void ei_queryCacheSizes_intel(int& l1, int& l2, int& l3, int max_std_funcs)
+inline void queryCacheSizes_intel(int& l1, int& l2, int& l3, int max_std_funcs)
{
if(max_std_funcs>=4)
- ei_queryCacheSizes_intel_direct(l1,l2,l3);
+ queryCacheSizes_intel_direct(l1,l2,l3);
else
- ei_queryCacheSizes_intel_codes(l1,l2,l3);
+ queryCacheSizes_intel_codes(l1,l2,l3);
}
-inline void ei_queryCacheSizes_amd(int& l1, int& l2, int& l3)
+inline void queryCacheSizes_amd(int& l1, int& l2, int& l3)
{
int abcd[4];
abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
@@ -746,7 +753,7 @@ inline void ei_queryCacheSizes_amd(int& l1, int& l2, int& l3)
/** \internal
* Queries and returns the cache sizes in Bytes of the L1, L2, and L3 data caches respectively */
-inline void ei_queryCacheSizes(int& l1, int& l2, int& l3)
+inline void queryCacheSizes(int& l1, int& l2, int& l3)
{
#ifdef EIGEN_CPUID
int abcd[4];
@@ -754,27 +761,27 @@ inline void ei_queryCacheSizes(int& l1, int& l2, int& l3)
// identify the CPU vendor
EIGEN_CPUID(abcd,0x0,0);
int max_std_funcs = abcd[1];
- if(ei_cpuid_is_vendor(abcd,"GenuineIntel"))
- ei_queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
- else if(ei_cpuid_is_vendor(abcd,"AuthenticAMD") || ei_cpuid_is_vendor(abcd,"AMDisbetter!"))
- ei_queryCacheSizes_amd(l1,l2,l3);
+ if(cpuid_is_vendor(abcd,"GenuineIntel"))
+ queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
+ else if(cpuid_is_vendor(abcd,"AuthenticAMD") || cpuid_is_vendor(abcd,"AMDisbetter!"))
+ queryCacheSizes_amd(l1,l2,l3);
else
// by default let's use Intel's API
- ei_queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
+ queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
// here is the list of other vendors:
-// ||ei_cpuid_is_vendor(abcd,"VIA VIA VIA ")
-// ||ei_cpuid_is_vendor(abcd,"CyrixInstead")
-// ||ei_cpuid_is_vendor(abcd,"CentaurHauls")
-// ||ei_cpuid_is_vendor(abcd,"GenuineTMx86")
-// ||ei_cpuid_is_vendor(abcd,"TransmetaCPU")
-// ||ei_cpuid_is_vendor(abcd,"RiseRiseRise")
-// ||ei_cpuid_is_vendor(abcd,"Geode by NSC")
-// ||ei_cpuid_is_vendor(abcd,"SiS SiS SiS ")
-// ||ei_cpuid_is_vendor(abcd,"UMC UMC UMC ")
-// ||ei_cpuid_is_vendor(abcd,"NexGenDriven")
-// ||ei_cpuid_is_vendor(abcd,"CentaurHauls")
-// ||ei_cpuid_is_vendor(abcd,"CentaurHauls")
+// ||cpuid_is_vendor(abcd,"VIA VIA VIA ")
+// ||cpuid_is_vendor(abcd,"CyrixInstead")
+// ||cpuid_is_vendor(abcd,"CentaurHauls")
+// ||cpuid_is_vendor(abcd,"GenuineTMx86")
+// ||cpuid_is_vendor(abcd,"TransmetaCPU")
+// ||cpuid_is_vendor(abcd,"RiseRiseRise")
+// ||cpuid_is_vendor(abcd,"Geode by NSC")
+// ||cpuid_is_vendor(abcd,"SiS SiS SiS ")
+// ||cpuid_is_vendor(abcd,"UMC UMC UMC ")
+// ||cpuid_is_vendor(abcd,"NexGenDriven")
+// ||cpuid_is_vendor(abcd,"CentaurHauls")
+// ||cpuid_is_vendor(abcd,"CentaurHauls")
#else
l1 = l2 = l3 = -1;
#endif
@@ -782,20 +789,22 @@ inline void ei_queryCacheSizes(int& l1, int& l2, int& l3)
/** \internal
* \returns the size in Bytes of the L1 data cache */
-inline int ei_queryL1CacheSize()
+inline int queryL1CacheSize()
{
int l1(-1), l2, l3;
- ei_queryCacheSizes(l1,l2,l3);
+ queryCacheSizes(l1,l2,l3);
return l1;
}
/** \internal
* \returns the size in Bytes of the L2 or L3 cache if this later is present */
-inline int ei_queryTopLevelCacheSize()
+inline int queryTopLevelCacheSize()
{
int l1, l2(-1), l3(-1);
- ei_queryCacheSizes(l1,l2,l3);
+ queryCacheSizes(l1,l2,l3);
return std::max(l2,l3);
}
+} // end namespace internal
+
#endif // EIGEN_MEMORY_H
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h
index 3d28680b6..bb9a66cf1 100644
--- a/Eigen/src/Core/util/Meta.h
+++ b/Eigen/src/Core/util/Meta.h
@@ -26,6 +26,8 @@
#ifndef EIGEN_META_H
#define EIGEN_META_H
+namespace internal {
+
/** \internal
* \file Meta.h
* This file contains generic metaprogramming classes which are not specifically related to Eigen.
@@ -33,72 +35,72 @@
* we however don't want to add a dependency to Boost.
*/
-struct ei_meta_true { enum { ret = 1 }; };
-struct ei_meta_false { enum { ret = 0 }; };
+struct true_type { enum { value = 1 }; };
+struct false_type { enum { value = 0 }; };
template<bool Condition, typename Then, typename Else>
-struct ei_meta_if { typedef Then ret; };
+struct conditional { typedef Then type; };
template<typename Then, typename Else>
-struct ei_meta_if <false, Then, Else> { typedef Else ret; };
-
-template<typename T, typename U> struct ei_is_same_type { enum { ret = 0 }; };
-template<typename T> struct ei_is_same_type<T,T> { enum { ret = 1 }; };
-
-template<typename T> struct ei_unref { typedef T type; };
-template<typename T> struct ei_unref<T&> { typedef T type; };
-
-template<typename T> struct ei_unpointer { typedef T type; };
-template<typename T> struct ei_unpointer<T*> { typedef T type; };
-template<typename T> struct ei_unpointer<T*const> { typedef T type; };
-
-template<typename T> struct ei_unconst { typedef T type; };
-template<typename T> struct ei_unconst<const T> { typedef T type; };
-template<typename T> struct ei_unconst<T const &> { typedef T & type; };
-template<typename T> struct ei_unconst<T const *> { typedef T * type; };
-
-template<typename T> struct ei_cleantype { typedef T type; };
-template<typename T> struct ei_cleantype<const T> { typedef typename ei_cleantype<T>::type type; };
-template<typename T> struct ei_cleantype<const T&> { typedef typename ei_cleantype<T>::type type; };
-template<typename T> struct ei_cleantype<T&> { typedef typename ei_cleantype<T>::type type; };
-template<typename T> struct ei_cleantype<const T*> { typedef typename ei_cleantype<T>::type type; };
-template<typename T> struct ei_cleantype<T*> { typedef typename ei_cleantype<T>::type type; };
-
-template<typename T> struct ei_is_arithmetic { enum { ret = false }; };
-template<> struct ei_is_arithmetic<float> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<double> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<long double> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<bool> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<char> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<signed char> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<unsigned char> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<signed short> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<unsigned short>{ enum { ret = true }; };
-template<> struct ei_is_arithmetic<signed int> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<unsigned int> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<signed long> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<unsigned long> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<signed long long> { enum { ret = true }; };
-template<> struct ei_is_arithmetic<unsigned long long> { enum { ret = true }; };
-
-template<typename T> struct ei_makeconst { typedef const T type; };
-template<typename T> struct ei_makeconst<const T> { typedef const T type; };
-template<typename T> struct ei_makeconst<T&> { typedef const T& type; };
-template<typename T> struct ei_makeconst<const T&> { typedef const T& type; };
-template<typename T> struct ei_makeconst<T*> { typedef const T* type; };
-template<typename T> struct ei_makeconst<const T*> { typedef const T* type; };
-
-template<typename T> struct ei_makeconst_return_type
+struct conditional <false, Then, Else> { typedef Else type; };
+
+template<typename T, typename U> struct is_same { enum { value = 0 }; };
+template<typename T> struct is_same<T,T> { enum { value = 1 }; };
+
+template<typename T> struct remove_reference { typedef T type; };
+template<typename T> struct remove_reference<T&> { typedef T type; };
+
+template<typename T> struct remove_pointer { typedef T type; };
+template<typename T> struct remove_pointer<T*> { typedef T type; };
+template<typename T> struct remove_pointer<T*const> { typedef T type; };
+
+template<typename T> struct remove_const { typedef T type; };
+template<typename T> struct remove_const<const T> { typedef T type; };
+template<typename T> struct remove_const<T const &> { typedef T & type; };
+template<typename T> struct remove_const<T const *> { typedef T * type; };
+
+template<typename T> struct remove_all { typedef T type; };
+template<typename T> struct remove_all<const T> { typedef typename remove_all<T>::type type; };
+template<typename T> struct remove_all<const T&> { typedef typename remove_all<T>::type type; };
+template<typename T> struct remove_all<T&> { typedef typename remove_all<T>::type type; };
+template<typename T> struct remove_all<const T*> { typedef typename remove_all<T>::type type; };
+template<typename T> struct remove_all<T*> { typedef typename remove_all<T>::type type; };
+
+template<typename T> struct is_arithmetic { enum { value = false }; };
+template<> struct is_arithmetic<float> { enum { value = true }; };
+template<> struct is_arithmetic<double> { enum { value = true }; };
+template<> struct is_arithmetic<long double> { enum { value = true }; };
+template<> struct is_arithmetic<bool> { enum { value = true }; };
+template<> struct is_arithmetic<char> { enum { value = true }; };
+template<> struct is_arithmetic<signed char> { enum { value = true }; };
+template<> struct is_arithmetic<unsigned char> { enum { value = true }; };
+template<> struct is_arithmetic<signed short> { enum { value = true }; };
+template<> struct is_arithmetic<unsigned short>{ enum { value = true }; };
+template<> struct is_arithmetic<signed int> { enum { value = true }; };
+template<> struct is_arithmetic<unsigned int> { enum { value = true }; };
+template<> struct is_arithmetic<signed long> { enum { value = true }; };
+template<> struct is_arithmetic<unsigned long> { enum { value = true }; };
+template<> struct is_arithmetic<signed long long> { enum { value = true }; };
+template<> struct is_arithmetic<unsigned long long> { enum { value = true }; };
+
+template<typename T> struct add_const { typedef const T type; };
+template<typename T> struct add_const<const T> { typedef const T type; };
+template<typename T> struct add_const<T&> { typedef const T& type; };
+template<typename T> struct add_const<const T&> { typedef const T& type; };
+template<typename T> struct add_const<T*> { typedef const T* type; };
+template<typename T> struct add_const<const T*> { typedef const T* type; };
+
+template<typename T> struct makeconst_return_type
{
- typedef typename ei_meta_if<ei_is_arithmetic<T>::ret, T, typename ei_makeconst<T>::type>::ret type;
+ typedef typename conditional<is_arithmetic<T>::value, T, typename add_const<T>::type>::type type;
};
/** \internal Allows to enable/disable an overload
* according to a compile time condition.
*/
-template<bool Condition, typename T> struct ei_enable_if;
+template<bool Condition, typename T> struct enable_if;
-template<typename T> struct ei_enable_if<true,T>
+template<typename T> struct enable_if<true,T>
{ typedef T type; };
/** \internal
@@ -108,67 +110,67 @@ template<typename T> struct ei_enable_if<true,T>
* upcoming next STL generation (using a templated result member).
* If none of these members is provided, then the type of the first argument is returned. FIXME, that behavior is a pretty bad hack.
*/
-template<typename T> struct ei_result_of {};
+template<typename T> struct result_of {};
-struct ei_has_none {int a[1];};
-struct ei_has_std_result_type {int a[2];};
-struct ei_has_tr1_result {int a[3];};
+struct has_none {int a[1];};
+struct has_std_result_type {int a[2];};
+struct has_tr1_result {int a[3];};
-template<typename Func, typename ArgType, int SizeOf=sizeof(ei_has_none)>
-struct ei_unary_result_of_select {typedef ArgType type;};
+template<typename Func, typename ArgType, int SizeOf=sizeof(has_none)>
+struct unary_result_of_select {typedef ArgType type;};
template<typename Func, typename ArgType>
-struct ei_unary_result_of_select<Func, ArgType, sizeof(ei_has_std_result_type)> {typedef typename Func::result_type type;};
+struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {typedef typename Func::result_type type;};
template<typename Func, typename ArgType>
-struct ei_unary_result_of_select<Func, ArgType, sizeof(ei_has_tr1_result)> {typedef typename Func::template result<Func(ArgType)>::type type;};
+struct unary_result_of_select<Func, ArgType, sizeof(has_tr1_result)> {typedef typename Func::template result<Func(ArgType)>::type type;};
template<typename Func, typename ArgType>
-struct ei_result_of<Func(ArgType)> {
+struct result_of<Func(ArgType)> {
template<typename T>
- static ei_has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
+ static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
template<typename T>
- static ei_has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType)>::type const * = 0);
- static ei_has_none testFunctor(...);
+ static has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType)>::type const * = 0);
+ static has_none testFunctor(...);
// note that the following indirection is needed for gcc-3.3
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
- typedef typename ei_unary_result_of_select<Func, ArgType, FunctorType>::type type;
+ typedef typename unary_result_of_select<Func, ArgType, FunctorType>::type type;
};
-template<typename Func, typename ArgType0, typename ArgType1, int SizeOf=sizeof(ei_has_none)>
-struct ei_binary_result_of_select {typedef ArgType0 type;};
+template<typename Func, typename ArgType0, typename ArgType1, int SizeOf=sizeof(has_none)>
+struct binary_result_of_select {typedef ArgType0 type;};
template<typename Func, typename ArgType0, typename ArgType1>
-struct ei_binary_result_of_select<Func, ArgType0, ArgType1, sizeof(ei_has_std_result_type)>
+struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)>
{typedef typename Func::result_type type;};
template<typename Func, typename ArgType0, typename ArgType1>
-struct ei_binary_result_of_select<Func, ArgType0, ArgType1, sizeof(ei_has_tr1_result)>
+struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_tr1_result)>
{typedef typename Func::template result<Func(ArgType0,ArgType1)>::type type;};
template<typename Func, typename ArgType0, typename ArgType1>
-struct ei_result_of<Func(ArgType0,ArgType1)> {
+struct result_of<Func(ArgType0,ArgType1)> {
template<typename T>
- static ei_has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
+ static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
template<typename T>
- static ei_has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType0,ArgType1)>::type const * = 0);
- static ei_has_none testFunctor(...);
+ static has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType0,ArgType1)>::type const * = 0);
+ static has_none testFunctor(...);
// note that the following indirection is needed for gcc-3.3
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
- typedef typename ei_binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
+ typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
};
/** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer.
- * Usage example: \code ei_meta_sqrt<1023>::ret \endcode
+ * Usage example: \code meta_sqrt<1023>::ret \endcode
*/
template<int Y,
int InfX = 0,
int SupX = ((Y==1) ? 1 : Y/2),
bool Done = ((SupX-InfX)<=1 ? true : ((SupX*SupX <= Y) && ((SupX+1)*(SupX+1) > Y))) >
// use ?: instead of || just to shut up a stupid gcc 4.3 warning
-class ei_meta_sqrt
+class meta_sqrt
{
enum {
MidX = (InfX+SupX)/2,
@@ -177,49 +179,51 @@ class ei_meta_sqrt
NewSup = int(TakeInf) ? int(MidX) : SupX
};
public:
- enum { ret = ei_meta_sqrt<Y,NewInf,NewSup>::ret };
+ enum { ret = meta_sqrt<Y,NewInf,NewSup>::ret };
};
template<int Y, int InfX, int SupX>
-class ei_meta_sqrt<Y, InfX, SupX, true> { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
+class meta_sqrt<Y, InfX, SupX, true> { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
/** \internal determines whether the product of two numeric types is allowed and what the return type is */
-template<typename T, typename U> struct ei_scalar_product_traits;
+template<typename T, typename U> struct scalar_product_traits;
-template<typename T> struct ei_scalar_product_traits<T,T>
+template<typename T> struct scalar_product_traits<T,T>
{
//enum { Cost = NumTraits<T>::MulCost };
typedef T ReturnType;
};
-template<typename T> struct ei_scalar_product_traits<T,std::complex<T> >
+template<typename T> struct scalar_product_traits<T,std::complex<T> >
{
//enum { Cost = 2*NumTraits<T>::MulCost };
typedef std::complex<T> ReturnType;
};
-template<typename T> struct ei_scalar_product_traits<std::complex<T>, T>
+template<typename T> struct scalar_product_traits<std::complex<T>, T>
{
//enum { Cost = 2*NumTraits<T>::MulCost };
typedef std::complex<T> ReturnType;
};
-// FIXME quick workaround around current limitation of ei_result_of
+// FIXME quick workaround around current limitation of result_of
// template<typename Scalar, typename ArgType0, typename ArgType1>
-// struct ei_result_of<ei_scalar_product_op<Scalar>(ArgType0,ArgType1)> {
-// typedef typename ei_scalar_product_traits<typename ei_cleantype<ArgType0>::type, typename ei_cleantype<ArgType1>::type>::ReturnType type;
+// struct result_of<scalar_product_op<Scalar>(ArgType0,ArgType1)> {
+// typedef typename scalar_product_traits<typename remove_all<ArgType0>::type, typename remove_all<ArgType1>::type>::ReturnType type;
// };
-template<typename T> struct ei_is_diagonal
+template<typename T> struct is_diagonal
{ enum { ret = false }; };
-template<typename T> struct ei_is_diagonal<DiagonalBase<T> >
+template<typename T> struct is_diagonal<DiagonalBase<T> >
{ enum { ret = true }; };
-template<typename T> struct ei_is_diagonal<DiagonalWrapper<T> >
+template<typename T> struct is_diagonal<DiagonalWrapper<T> >
{ enum { ret = true }; };
-template<typename T, int S> struct ei_is_diagonal<DiagonalMatrix<T,S> >
+template<typename T, int S> struct is_diagonal<DiagonalMatrix<T,S> >
{ enum { ret = true }; };
+} // end namespace internal
+
#endif // EIGEN_META_H
diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h
index 323273e6a..71e8eef1b 100644
--- a/Eigen/src/Core/util/StaticAssert.h
+++ b/Eigen/src/Core/util/StaticAssert.h
@@ -29,11 +29,11 @@
/* Some notes on Eigen's static assertion mechanism:
*
* - in EIGEN_STATIC_ASSERT(CONDITION,MSG) the parameter CONDITION must be a compile time boolean
- * expression, and MSG an enum listed in struct ei_static_assert<true>
+ * expression, and MSG an enum listed in struct internal::static_assertion<true>
*
* - define EIGEN_NO_STATIC_ASSERT to disable them (and save compilation time)
* in that case, the static assertion is converted to the following runtime assert:
- * ei_assert(CONDITION && "MSG")
+ * eigen_assert(CONDITION && "MSG")
*
* - currently EIGEN_STATIC_ASSERT can only be used in function scope
*
@@ -48,11 +48,13 @@
#else // not CXX0X
+ namespace internal {
+
template<bool condition>
- struct ei_static_assert {};
+ struct static_assertion {};
template<>
- struct ei_static_assert<true>
+ struct static_assertion<true>
{
enum {
YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX,
@@ -94,18 +96,20 @@
};
};
+ } // end namespace internal
+
// Specialized implementation for MSVC to avoid "conditional
// expression is constant" warnings. This implementation doesn't
// appear to work under GCC, hence the multiple implementations.
#ifdef _MSC_VER
#define EIGEN_STATIC_ASSERT(CONDITION,MSG) \
- {Eigen::ei_static_assert<(CONDITION)>::MSG;}
+ {Eigen::internal::static_assertion<(CONDITION)>::MSG;}
#else
#define EIGEN_STATIC_ASSERT(CONDITION,MSG) \
- if (Eigen::ei_static_assert<(CONDITION)>::MSG) {}
+ if (Eigen::internal::static_assertion<(CONDITION)>::MSG) {}
#endif
@@ -113,7 +117,7 @@
#else // EIGEN_NO_STATIC_ASSERT
- #define EIGEN_STATIC_ASSERT(CONDITION,MSG) ei_assert((CONDITION) && #MSG);
+ #define EIGEN_STATIC_ASSERT(CONDITION,MSG) eigen_assert((CONDITION) && #MSG);
#endif // EIGEN_NO_STATIC_ASSERT
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index 61ffe702f..7dc52e55d 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -1,4 +1,4 @@
-// // This file is part of Eigen, a lightweight C++ template library
+// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
@@ -37,46 +37,48 @@
#define EIGEN_EMPTY_STRUCT_CTOR(X)
#endif
-//classes inheriting ei_no_assignment_operator don't generate a default operator=.
-class ei_no_assignment_operator
+typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
+
+namespace internal {
+
+//classes inheriting no_assignment_operator don't generate a default operator=.
+class no_assignment_operator
{
private:
- ei_no_assignment_operator& operator=(const ei_no_assignment_operator&);
+ no_assignment_operator& operator=(const no_assignment_operator&);
};
-typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
-
/** \internal return the index type with the largest number of bits */
template<typename I1, typename I2>
-struct ei_promote_index_type
+struct promote_index_type
{
- typedef typename ei_meta_if<(sizeof(I1)<sizeof(I2)), I2, I1>::ret type;
+ typedef typename conditional<(sizeof(I1)<sizeof(I2)), I2, I1>::type type;
};
/** \internal If the template parameter Value is Dynamic, this class is just a wrapper around a T variable that
* can be accessed using value() and setValue().
* Otherwise, this class is an empty structure and value() just returns the template parameter Value.
*/
-template<typename T, int Value> class ei_variable_if_dynamic
+template<typename T, int Value> class variable_if_dynamic
{
public:
- EIGEN_EMPTY_STRUCT_CTOR(ei_variable_if_dynamic)
- explicit ei_variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); ei_assert(v == T(Value)); }
+ EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamic)
+ explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); assert(v == T(Value)); }
static T value() { return T(Value); }
void setValue(T) {}
};
-template<typename T> class ei_variable_if_dynamic<T, Dynamic>
+template<typename T> class variable_if_dynamic<T, Dynamic>
{
T m_value;
- ei_variable_if_dynamic() { ei_assert(false); }
+ variable_if_dynamic() { assert(false); }
public:
- explicit ei_variable_if_dynamic(T value) : m_value(value) {}
+ explicit variable_if_dynamic(T value) : m_value(value) {}
T value() const { return m_value; }
void setValue(T value) { m_value = value; }
};
-template<typename T> struct ei_functor_traits
+template<typename T> struct functor_traits
{
enum
{
@@ -85,9 +87,9 @@ template<typename T> struct ei_functor_traits
};
};
-template<typename T> struct ei_packet_traits;
+template<typename T> struct packet_traits;
-template<typename T> struct ei_unpacket_traits
+template<typename T> struct unpacket_traits
{
typedef T type;
enum {size=1};
@@ -100,7 +102,7 @@ template<typename _Scalar, int _Rows, int _Cols,
: EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
int _MaxRows = _Rows,
int _MaxCols = _Cols
-> class ei_make_proper_matrix_type
+> class make_proper_matrix_type
{
enum {
IsColVector = _Cols==1 && _Rows!=1,
@@ -114,7 +116,7 @@ template<typename _Scalar, int _Rows, int _Cols,
};
template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
-class ei_compute_matrix_flags
+class compute_matrix_flags
{
enum {
row_major_bit = Options&RowMajor ? RowMajorBit : 0,
@@ -123,10 +125,10 @@ class ei_compute_matrix_flags
aligned_bit =
(
((Options&DontAlign)==0)
- && ei_packet_traits<Scalar>::Vectorizable
+ && packet_traits<Scalar>::Vectorizable
&& (
#if EIGEN_ALIGN_STATICALLY
- ((!is_dynamic_size_storage) && (((MaxCols*MaxRows) % ei_packet_traits<Scalar>::size) == 0))
+ ((!is_dynamic_size_storage) && (((MaxCols*MaxRows) % packet_traits<Scalar>::size) == 0))
#else
0
#endif
@@ -141,95 +143,95 @@ class ei_compute_matrix_flags
)
) ? AlignedBit : 0,
- packet_access_bit = ei_packet_traits<Scalar>::Vectorizable && aligned_bit ? PacketAccessBit : 0
+ packet_access_bit = packet_traits<Scalar>::Vectorizable && aligned_bit ? PacketAccessBit : 0
};
public:
enum { ret = LinearAccessBit | LvalueBit | DirectAccessBit | NestByRefBit | packet_access_bit | row_major_bit | aligned_bit };
};
-template<int _Rows, int _Cols> struct ei_size_at_compile_time
+template<int _Rows, int _Cols> struct size_at_compile_time
{
enum { ret = (_Rows==Dynamic || _Cols==Dynamic) ? Dynamic : _Rows * _Cols };
};
-/* ei_plain_matrix_type : the difference from ei_eval is that ei_plain_matrix_type is always a plain matrix type,
- * whereas ei_eval is a const reference in the case of a matrix
+/* plain_matrix_type : the difference from eval is that plain_matrix_type is always a plain matrix type,
+ * whereas eval is a const reference in the case of a matrix
*/
-template<typename T, typename StorageKind = typename ei_traits<T>::StorageKind> struct ei_plain_matrix_type;
-template<typename T, typename BaseClassType> struct ei_plain_matrix_type_dense;
-template<typename T> struct ei_plain_matrix_type<T,Dense>
+template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct plain_matrix_type;
+template<typename T, typename BaseClassType> struct plain_matrix_type_dense;
+template<typename T> struct plain_matrix_type<T,Dense>
{
- typedef typename ei_plain_matrix_type_dense<T,typename ei_traits<T>::XprKind>::type type;
+ typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind>::type type;
};
-template<typename T> struct ei_plain_matrix_type_dense<T,MatrixXpr>
+template<typename T> struct plain_matrix_type_dense<T,MatrixXpr>
{
- typedef Matrix<typename ei_traits<T>::Scalar,
- ei_traits<T>::RowsAtCompileTime,
- ei_traits<T>::ColsAtCompileTime,
- AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
- ei_traits<T>::MaxRowsAtCompileTime,
- ei_traits<T>::MaxColsAtCompileTime
+ typedef Matrix<typename traits<T>::Scalar,
+ traits<T>::RowsAtCompileTime,
+ traits<T>::ColsAtCompileTime,
+ AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ traits<T>::MaxRowsAtCompileTime,
+ traits<T>::MaxColsAtCompileTime
> type;
};
-template<typename T> struct ei_plain_matrix_type_dense<T,ArrayXpr>
+template<typename T> struct plain_matrix_type_dense<T,ArrayXpr>
{
- typedef Array<typename ei_traits<T>::Scalar,
- ei_traits<T>::RowsAtCompileTime,
- ei_traits<T>::ColsAtCompileTime,
- AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
- ei_traits<T>::MaxRowsAtCompileTime,
- ei_traits<T>::MaxColsAtCompileTime
+ typedef Array<typename traits<T>::Scalar,
+ traits<T>::RowsAtCompileTime,
+ traits<T>::ColsAtCompileTime,
+ AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+ traits<T>::MaxRowsAtCompileTime,
+ traits<T>::MaxColsAtCompileTime
> type;
};
-/* ei_eval : the return type of eval(). For matrices, this is just a const reference
+/* eval : the return type of eval(). For matrices, this is just a const reference
* in order to avoid a useless copy
*/
-template<typename T, typename StorageKind = typename ei_traits<T>::StorageKind> struct ei_eval;
+template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct eval;
-template<typename T> struct ei_eval<T,Dense>
+template<typename T> struct eval<T,Dense>
{
- typedef typename ei_plain_matrix_type<T>::type type;
+ typedef typename plain_matrix_type<T>::type type;
// typedef typename T::PlainObject type;
-// typedef T::Matrix<typename ei_traits<T>::Scalar,
-// ei_traits<T>::RowsAtCompileTime,
-// ei_traits<T>::ColsAtCompileTime,
-// AutoAlign | (ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
-// ei_traits<T>::MaxRowsAtCompileTime,
-// ei_traits<T>::MaxColsAtCompileTime
+// typedef T::Matrix<typename traits<T>::Scalar,
+// traits<T>::RowsAtCompileTime,
+// traits<T>::ColsAtCompileTime,
+// AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
+// traits<T>::MaxRowsAtCompileTime,
+// traits<T>::MaxColsAtCompileTime
// > type;
};
// for matrices, no need to evaluate, just use a const reference to avoid a useless copy
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
-struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
+struct eval<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
{
typedef const Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
-struct ei_eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
+struct eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
{
typedef const Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type;
};
-/* ei_plain_matrix_type_column_major : same as ei_plain_matrix_type but guaranteed to be column-major
+/* plain_matrix_type_column_major : same as plain_matrix_type but guaranteed to be column-major
*/
-template<typename T> struct ei_plain_matrix_type_column_major
+template<typename T> struct plain_matrix_type_column_major
{
- enum { Rows = ei_traits<T>::RowsAtCompileTime,
- Cols = ei_traits<T>::ColsAtCompileTime,
- MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
- MaxCols = ei_traits<T>::MaxColsAtCompileTime
+ enum { Rows = traits<T>::RowsAtCompileTime,
+ Cols = traits<T>::ColsAtCompileTime,
+ MaxRows = traits<T>::MaxRowsAtCompileTime,
+ MaxCols = traits<T>::MaxColsAtCompileTime
};
- typedef Matrix<typename ei_traits<T>::Scalar,
+ typedef Matrix<typename traits<T>::Scalar,
Rows,
Cols,
(MaxRows==1&&MaxCols!=1) ? RowMajor : ColMajor,
@@ -238,16 +240,16 @@ template<typename T> struct ei_plain_matrix_type_column_major
> type;
};
-/* ei_plain_matrix_type_row_major : same as ei_plain_matrix_type but guaranteed to be row-major
+/* plain_matrix_type_row_major : same as plain_matrix_type but guaranteed to be row-major
*/
-template<typename T> struct ei_plain_matrix_type_row_major
+template<typename T> struct plain_matrix_type_row_major
{
- enum { Rows = ei_traits<T>::RowsAtCompileTime,
- Cols = ei_traits<T>::ColsAtCompileTime,
- MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
- MaxCols = ei_traits<T>::MaxColsAtCompileTime
+ enum { Rows = traits<T>::RowsAtCompileTime,
+ Cols = traits<T>::ColsAtCompileTime,
+ MaxRows = traits<T>::MaxRowsAtCompileTime,
+ MaxCols = traits<T>::MaxColsAtCompileTime
};
- typedef Matrix<typename ei_traits<T>::Scalar,
+ typedef Matrix<typename traits<T>::Scalar,
Rows,
Cols,
(MaxCols==1&&MaxRows!=1) ? RowMajor : ColMajor,
@@ -257,16 +259,16 @@ template<typename T> struct ei_plain_matrix_type_row_major
};
// we should be able to get rid of this one too
-template<typename T> struct ei_must_nest_by_value { enum { ret = false }; };
+template<typename T> struct must_nest_by_value { enum { ret = false }; };
template<class T>
-struct ei_is_reference
+struct is_reference
{
enum { ret = false };
};
template<class T>
-struct ei_is_reference<T&>
+struct is_reference<T&>
{
enum { ret = true };
};
@@ -277,13 +279,13 @@ struct ei_is_reference<T&>
* objects which should generate no copying overhead.
**/
template <typename T>
-struct ei_ref_selector
+struct ref_selector
{
- typedef typename ei_meta_if<
- bool(ei_traits<T>::Flags & NestByRefBit),
+ typedef typename conditional<
+ bool(traits<T>::Flags & NestByRefBit),
T const&,
T
- >::ret type;
+ >::type type;
};
/** \internal Determines how a given expression should be nested into another one.
@@ -298,70 +300,70 @@ struct ei_ref_selector
*
* Example. Suppose that a, b, and c are of type Matrix3d. The user forms the expression a*(b+c).
* b+c is an expression "sum of matrices", which we will denote by S. In order to determine how to nest it,
- * the Product expression uses: ei_nested<S, 3>::ret, which turns out to be Matrix3d because the internal logic of
- * ei_nested determined that in this case it was better to evaluate the expression b+c into a temporary. On the other hand,
- * since a is of type Matrix3d, the Product expression nests it as ei_nested<Matrix3d, 3>::ret, which turns out to be
- * const Matrix3d&, because the internal logic of ei_nested determined that since a was already a matrix, there was no point
+ * the Product expression uses: nested<S, 3>::ret, which turns out to be Matrix3d because the internal logic of
+ * nested determined that in this case it was better to evaluate the expression b+c into a temporary. On the other hand,
+ * since a is of type Matrix3d, the Product expression nests it as nested<Matrix3d, 3>::ret, which turns out to be
+ * const Matrix3d&, because the internal logic of nested determined that since a was already a matrix, there was no point
* in copying it into another matrix.
*/
-template<typename T, int n=1, typename PlainObject = typename ei_eval<T>::type> struct ei_nested
+template<typename T, int n=1, typename PlainObject = typename eval<T>::type> struct nested
{
// this is a direct port of the logic used when Dynamic was 33331, to make an atomic commit.
enum {
- _ScalarReadCost = NumTraits<typename ei_traits<T>::Scalar>::ReadCost,
+ _ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost,
ScalarReadCost = _ScalarReadCost == Dynamic ? 33331 : int(_ScalarReadCost),
- _CoeffReadCost = int(ei_traits<T>::CoeffReadCost),
+ _CoeffReadCost = int(traits<T>::CoeffReadCost),
CoeffReadCost = _CoeffReadCost == Dynamic ? 33331 : int(_CoeffReadCost),
N = n == Dynamic ? 33331 : n,
CostEval = (N+1) * int(ScalarReadCost),
CostNoEval = (N-1) * int(CoeffReadCost)
};
- typedef typename ei_meta_if<
- ( int(ei_traits<T>::Flags) & EvalBeforeNestingBit ) ||
+ typedef typename conditional<
+ ( int(traits<T>::Flags) & EvalBeforeNestingBit ) ||
( int(CostEval) <= int(CostNoEval) ),
PlainObject,
- typename ei_ref_selector<T>::type
- >::ret type;
+ typename ref_selector<T>::type
+ >::type type;
/* this is what the above logic should be updated to look like:
enum {
- ScalarReadCost = NumTraits<typename ei_traits<T>::Scalar>::ReadCost,
- CoeffReadCost = ei_traits<T>::CoeffReadCost,
+ ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost,
+ CoeffReadCost = traits<T>::CoeffReadCost,
CostEval = n == Dynamic || ScalarReadCost == Dynamic ? int(Dynamic) : (n+1) * int(ScalarReadCost),
CostNoEval = n == Dynamic || (CoeffReadCost == Dynamic && n>1) ? int(Dynamic) : (n-1) * int(CoeffReadCost)
};
- typedef typename ei_meta_if<
- ( int(ei_traits<T>::Flags) & EvalBeforeNestingBit ) ||
+ typedef typename conditional<
+ ( int(traits<T>::Flags) & EvalBeforeNestingBit ) ||
( int(CostNoEval) == Dynamic ? true
: int(CostEval) == Dynamic ? false
: int(CostEval) <= int(CostNoEval) ),
PlainObject,
- typename ei_ref_selector<T>::type
- >::ret type;
+ typename ref_selector<T>::type
+ >::type type;
*/
};
-template<unsigned int Flags> struct ei_are_flags_consistent
+template<unsigned int Flags> struct are_flags_consistent
{
enum { ret = EIGEN_IMPLIES(bool(Flags&DirectAccessBit), bool(Flags&LvalueBit)) };
};
-template<typename Derived, typename XprKind = typename ei_traits<Derived>::XprKind>
-struct ei_dense_xpr_base
+template<typename Derived, typename XprKind = typename traits<Derived>::XprKind>
+struct dense_xpr_base
{
- /* ei_dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the ArrayXpr cases */
+ /* dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the ArrayXpr cases */
};
template<typename Derived>
-struct ei_dense_xpr_base<Derived, MatrixXpr>
+struct dense_xpr_base<Derived, MatrixXpr>
{
typedef MatrixBase<Derived> type;
};
template<typename Derived>
-struct ei_dense_xpr_base<Derived, ArrayXpr>
+struct dense_xpr_base<Derived, ArrayXpr>
{
typedef ArrayBase<Derived> type;
};
@@ -369,27 +371,27 @@ struct ei_dense_xpr_base<Derived, ArrayXpr>
/** \internal Helper base class to add a scalar multiple operator
* overloads for complex types */
template<typename Derived,typename Scalar,typename OtherScalar,
- bool EnableIt = !ei_is_same_type<Scalar,OtherScalar>::ret >
-struct ei_special_scalar_op_base : public DenseCoeffsBase<Derived>
+ bool EnableIt = !is_same<Scalar,OtherScalar>::value >
+struct special_scalar_op_base : public DenseCoeffsBase<Derived>
{
// dummy operator* so that the
- // "using ei_special_scalar_op_base::operator*" compiles
+ // "using special_scalar_op_base::operator*" compiles
void operator*() const;
};
template<typename Derived,typename Scalar,typename OtherScalar>
-struct ei_special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public DenseCoeffsBase<Derived>
+struct special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public DenseCoeffsBase<Derived>
{
- const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,OtherScalar>, Derived>
+ const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
operator*(const OtherScalar& scalar) const
{
- return CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,OtherScalar>, Derived>
- (*static_cast<const Derived*>(this), ei_scalar_multiple2_op<Scalar,OtherScalar>(scalar));
+ return CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
+ (*static_cast<const Derived*>(this), scalar_multiple2_op<Scalar,OtherScalar>(scalar));
}
- inline friend const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,OtherScalar>, Derived>
+ inline friend const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
operator*(const OtherScalar& scalar, const Derived& matrix)
- { return static_cast<const ei_special_scalar_op_base&>(matrix).operator*(scalar); }
+ { return static_cast<const special_scalar_op_base&>(matrix).operator*(scalar); }
};
template<typename ExpressionType> struct HNormalizedReturnType {
@@ -399,52 +401,77 @@ template<typename ExpressionType> struct HNormalizedReturnType {
SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1
};
typedef Block<ExpressionType,
- ei_traits<ExpressionType>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
- ei_traits<ExpressionType>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne;
- typedef CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<ExpressionType>::Scalar>,
+ traits<ExpressionType>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
+ traits<ExpressionType>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne;
+ typedef CwiseUnaryOp<scalar_quotient1_op<typename traits<ExpressionType>::Scalar>,
StartMinusOne > Type;
};
-template<typename XprType, typename CastType> struct ei_cast_return_type
+template<typename XprType, typename CastType> struct cast_return_type
{
typedef typename XprType::Scalar CurrentScalarType;
- typedef typename ei_cleantype<CastType>::type _CastType;
+ typedef typename remove_all<CastType>::type _CastType;
typedef typename _CastType::Scalar NewScalarType;
- typedef typename ei_meta_if<ei_is_same_type<CurrentScalarType,NewScalarType>::ret,
- const XprType&,CastType>::ret type;
+ typedef typename conditional<is_same<CurrentScalarType,NewScalarType>::value,
+ const XprType&,CastType>::type type;
};
-template <typename A, typename B> struct ei_promote_storage_type;
+template <typename A, typename B> struct promote_storage_type;
-template <typename A> struct ei_promote_storage_type<A,A>
+template <typename A> struct promote_storage_type<A,A>
{
typedef A ret;
};
-/** \internal gives the plain matrix type to store a row/column/diagonal of a matrix type.
+/** \internal gives the plain matrix or array type to store a row/column/diagonal of a matrix type.
* \param Scalar optional parameter allowing to pass a different scalar type than the one of the MatrixType.
*/
-template<typename MatrixType, typename Scalar = typename MatrixType::Scalar>
-struct ei_plain_row_type
+template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
+struct plain_row_type
{
- typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime,
- MatrixType::PlainObject::Options | RowMajor, 1, MatrixType::MaxColsAtCompileTime> type;
+ typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
+ ExpressionType::PlainObject::Options | RowMajor, 1, ExpressionType::MaxColsAtCompileTime> MatrixRowType;
+ typedef Array<Scalar, 1, ExpressionType::ColsAtCompileTime,
+ ExpressionType::PlainObject::Options | RowMajor, 1, ExpressionType::MaxColsAtCompileTime> ArrayRowType;
+
+ typedef typename conditional<
+ is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
+ MatrixRowType,
+ ArrayRowType
+ >::type type;
};
-template<typename MatrixType, typename Scalar = typename MatrixType::Scalar>
-struct ei_plain_col_type
+template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
+struct plain_col_type
{
- typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1,
- MatrixType::PlainObject::Options & ~RowMajor, MatrixType::MaxRowsAtCompileTime, 1> type;
+ typedef Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1,
+ ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1> MatrixColType;
+ typedef Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
+ ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1> ArrayColType;
+
+ typedef typename conditional<
+ is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
+ MatrixColType,
+ ArrayColType
+ >::type type;
};
-template<typename MatrixType, typename Scalar = typename MatrixType::Scalar>
-struct ei_plain_diag_type
+template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
+struct plain_diag_type
{
- enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime),
- max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime)
+ enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime),
+ max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime)
};
- typedef Matrix<Scalar, diag_size, 1, MatrixType::PlainObject::Options & ~RowMajor, max_diag_size, 1> type;
+ typedef Matrix<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1> MatrixDiagType;
+ typedef Array<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1> ArrayDiagType;
+
+ typedef typename conditional<
+ is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
+ MatrixDiagType,
+ ArrayDiagType
+ >::type type;
};
+} // end namespace internal
+
#endif // EIGEN_XPRHELPER_H
diff --git a/Eigen/src/Eigen2Support/Block.h b/Eigen/src/Eigen2Support/Block.h
index ba0e39650..bc28051e0 100644
--- a/Eigen/src/Eigen2Support/Block.h
+++ b/Eigen/src/Eigen2Support/Block.h
@@ -49,7 +49,7 @@ inline Block<Derived> DenseBase<Derived>
switch(type)
{
default:
- ei_assert(false && "Bad corner type.");
+ eigen_assert(false && "Bad corner type.");
case TopLeft:
return Block<Derived>(derived(), 0, 0, cRows, cCols);
case TopRight:
@@ -69,7 +69,7 @@ DenseBase<Derived>::corner(CornerType type, Index cRows, Index cCols) const
switch(type)
{
default:
- ei_assert(false && "Bad corner type.");
+ eigen_assert(false && "Bad corner type.");
case TopLeft:
return Block<Derived>(derived(), 0, 0, cRows, cCols);
case TopRight:
@@ -101,7 +101,7 @@ DenseBase<Derived>::corner(CornerType type)
switch(type)
{
default:
- ei_assert(false && "Bad corner type.");
+ eigen_assert(false && "Bad corner type.");
case TopLeft:
return Block<Derived, CRows, CCols>(derived(), 0, 0);
case TopRight:
@@ -122,7 +122,7 @@ DenseBase<Derived>::corner(CornerType type) const
switch(type)
{
default:
- ei_assert(false && "Bad corner type.");
+ eigen_assert(false && "Bad corner type.");
case TopLeft:
return Block<Derived, CRows, CCols>(derived(), 0, 0);
case TopRight:
diff --git a/Eigen/src/Eigen2Support/Cwise.h b/Eigen/src/Eigen2Support/Cwise.h
index 1489f8f79..c80f56a69 100644
--- a/Eigen/src/Eigen2Support/Cwise.h
+++ b/Eigen/src/Eigen2Support/Cwise.h
@@ -29,17 +29,17 @@
/** \internal
* convenient macro to defined the return type of a cwise binary operation */
#define EIGEN_CWISE_BINOP_RETURN_TYPE(OP) \
- CwiseBinaryOp<OP<typename ei_traits<ExpressionType>::Scalar>, ExpressionType, OtherDerived>
+ CwiseBinaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType, OtherDerived>
/** \internal
* convenient macro to defined the return type of a cwise unary operation */
#define EIGEN_CWISE_UNOP_RETURN_TYPE(OP) \
- CwiseUnaryOp<OP<typename ei_traits<ExpressionType>::Scalar>, ExpressionType>
+ CwiseUnaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType>
/** \internal
* convenient macro to defined the return type of a cwise comparison to a scalar */
#define EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(OP) \
- CwiseBinaryOp<OP<typename ei_traits<ExpressionType>::Scalar>, ExpressionType, \
+ CwiseBinaryOp<OP<typename internal::traits<ExpressionType>::Scalar>, ExpressionType, \
typename ExpressionType::ConstantReturnType >
/** \class Cwise
@@ -61,10 +61,10 @@ template<typename ExpressionType> class Cwise
{
public:
- typedef typename ei_traits<ExpressionType>::Scalar Scalar;
- typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
- ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
- typedef CwiseUnaryOp<ei_scalar_add_op<Scalar>, ExpressionType> ScalarAddReturnType;
+ typedef typename internal::traits<ExpressionType>::Scalar Scalar;
+ typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
+ ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
+ typedef CwiseUnaryOp<internal::scalar_add_op<Scalar>, ExpressionType> ScalarAddReturnType;
inline Cwise(const ExpressionType& matrix) : m_matrix(matrix) {}
@@ -76,28 +76,28 @@ template<typename ExpressionType> class Cwise
operator*(const MatrixBase<OtherDerived> &other) const;
template<typename OtherDerived>
- const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
+ const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
operator/(const MatrixBase<OtherDerived> &other) const;
template<typename OtherDerived>
- const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_min_op)
+ const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)
min(const MatrixBase<OtherDerived> &other) const;
template<typename OtherDerived>
- const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_max_op)
+ const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)
max(const MatrixBase<OtherDerived> &other) const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs_op) abs() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs2_op) abs2() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_square_op) square() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cube_op) cube() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_inverse_op) inverse() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sqrt_op) sqrt() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_exp_op) exp() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_log_op) log() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cos_op) cos() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sin_op) sin() const;
- const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op) pow(const Scalar& exponent) const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs_op) abs() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs2_op) abs2() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_square_op) square() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cube_op) cube() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_inverse_op) inverse() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sqrt_op) sqrt() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_exp_op) exp() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_log_op) log() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cos_op) cos() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sin_op) sin() const;
+ const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op) pow(const Scalar& exponent) const;
const ScalarAddReturnType
operator+(const Scalar& scalar) const;
diff --git a/Eigen/src/Eigen2Support/CwiseOperators.h b/Eigen/src/Eigen2Support/CwiseOperators.h
index 74feee4a0..0c7e9db6d 100644
--- a/Eigen/src/Eigen2Support/CwiseOperators.h
+++ b/Eigen/src/Eigen2Support/CwiseOperators.h
@@ -32,7 +32,7 @@
/** \deprecated ArrayBase::abs() */
template<typename ExpressionType>
-EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs_op)
+EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs_op)
Cwise<ExpressionType>::abs() const
{
return _expression();
@@ -40,7 +40,7 @@ Cwise<ExpressionType>::abs() const
/** \deprecated ArrayBase::abs2() */
template<typename ExpressionType>
-EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs2_op)
+EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs2_op)
Cwise<ExpressionType>::abs2() const
{
return _expression();
@@ -48,7 +48,7 @@ Cwise<ExpressionType>::abs2() const
/** \deprecated ArrayBase::exp() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_exp_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_exp_op)
Cwise<ExpressionType>::exp() const
{
return _expression();
@@ -56,7 +56,7 @@ Cwise<ExpressionType>::exp() const
/** \deprecated ArrayBase::log() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_log_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_log_op)
Cwise<ExpressionType>::log() const
{
return _expression();
@@ -74,10 +74,10 @@ Cwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
/** \deprecated ArrayBase::operator/() */
template<typename ExpressionType>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
+EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
Cwise<ExpressionType>::operator/(const MatrixBase<OtherDerived> &other) const
{
- return EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)(_expression(), other.derived());
+ return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
}
/** \deprecated ArrayBase::operator*=() */
@@ -99,19 +99,19 @@ inline ExpressionType& Cwise<ExpressionType>::operator/=(const MatrixBase<OtherD
/** \deprecated ArrayBase::min() */
template<typename ExpressionType>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_min_op)
+EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)
Cwise<ExpressionType>::min(const MatrixBase<OtherDerived> &other) const
{
- return EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_min_op)(_expression(), other.derived());
+ return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)(_expression(), other.derived());
}
/** \deprecated ArrayBase::max() */
template<typename ExpressionType>
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_max_op)
+EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)
Cwise<ExpressionType>::max(const MatrixBase<OtherDerived> &other) const
{
- return EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_max_op)(_expression(), other.derived());
+ return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)(_expression(), other.derived());
}
/***************************************************************************
@@ -122,7 +122,7 @@ Cwise<ExpressionType>::max(const MatrixBase<OtherDerived> &other) const
/** \deprecated ArrayBase::sqrt() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sqrt_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sqrt_op)
Cwise<ExpressionType>::sqrt() const
{
return _expression();
@@ -130,7 +130,7 @@ Cwise<ExpressionType>::sqrt() const
/** \deprecated ArrayBase::cos() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cos_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cos_op)
Cwise<ExpressionType>::cos() const
{
return _expression();
@@ -139,7 +139,7 @@ Cwise<ExpressionType>::cos() const
/** \deprecated ArrayBase::sin() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sin_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sin_op)
Cwise<ExpressionType>::sin() const
{
return _expression();
@@ -148,16 +148,16 @@ Cwise<ExpressionType>::sin() const
/** \deprecated ArrayBase::log() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)
Cwise<ExpressionType>::pow(const Scalar& exponent) const
{
- return EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op)(_expression(), ei_scalar_pow_op<Scalar>(exponent));
+ return EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)(_expression(), internal::scalar_pow_op<Scalar>(exponent));
}
/** \deprecated ArrayBase::inverse() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_inverse_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_inverse_op)
Cwise<ExpressionType>::inverse() const
{
return _expression();
@@ -165,7 +165,7 @@ Cwise<ExpressionType>::inverse() const
/** \deprecated ArrayBase::square() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_square_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_square_op)
Cwise<ExpressionType>::square() const
{
return _expression();
@@ -173,7 +173,7 @@ Cwise<ExpressionType>::square() const
/** \deprecated ArrayBase::cube() */
template<typename ExpressionType>
-inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cube_op)
+inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cube_op)
Cwise<ExpressionType>::cube() const
{
return _expression();
@@ -299,7 +299,7 @@ template<typename ExpressionType>
inline const typename Cwise<ExpressionType>::ScalarAddReturnType
Cwise<ExpressionType>::operator+(const Scalar& scalar) const
{
- return typename Cwise<ExpressionType>::ScalarAddReturnType(m_matrix, ei_scalar_add_op<Scalar>(scalar));
+ return typename Cwise<ExpressionType>::ScalarAddReturnType(m_matrix, internal::scalar_add_op<Scalar>(scalar));
}
/** \deprecated ArrayBase::operator+=(Scalar) */
diff --git a/Eigen/src/Eigen2Support/Minor.h b/Eigen/src/Eigen2Support/Minor.h
index 555d1d7f5..3b3acd605 100644
--- a/Eigen/src/Eigen2Support/Minor.h
+++ b/Eigen/src/Eigen2Support/Minor.h
@@ -38,12 +38,14 @@
*
* \sa MatrixBase::minor()
*/
+
+namespace internal {
template<typename MatrixType>
-struct ei_traits<Minor<MatrixType> >
- : ei_traits<MatrixType>
+struct traits<Minor<MatrixType> >
+ : traits<MatrixType>
{
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
typedef typename MatrixType::StorageKind StorageKind;
enum {
RowsAtCompileTime = (MatrixType::RowsAtCompileTime != Dynamic) ?
@@ -59,6 +61,7 @@ struct ei_traits<Minor<MatrixType> >
// where loops are unrolled and the 'if' evaluates at compile time
};
};
+}
template<typename MatrixType> class Minor
: public MatrixBase<Minor<MatrixType> >
@@ -72,7 +75,7 @@ template<typename MatrixType> class Minor
Index row, Index col)
: m_matrix(matrix), m_row(row), m_col(col)
{
- ei_assert(row >= 0 && row < matrix.rows()
+ eigen_assert(row >= 0 && row < matrix.rows()
&& col >= 0 && col < matrix.cols());
}
diff --git a/Eigen/src/Eigen2Support/Transform.h b/Eigen/src/Eigen2Support/Transform.h
new file mode 100644
index 000000000..1aad1cc29
--- /dev/null
+++ b/Eigen/src/Eigen2Support/Transform.h
@@ -0,0 +1,37 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
+//
+// Eigen is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EIGEN_TRANSFORM2_H
+#define EIGEN_TRANSFORM2_H
+
+/** \ingroup Geometry_Module */
+typedef Projective2f Transform2f;
+/** \ingroup Geometry_Module */
+typedef Projective2d Transform2d;
+/** \ingroup Geometry_Module */
+typedef Projective3f Transform3f;
+/** \ingroup Geometry_Module */
+typedef Projective3d Transform3d;
+
+#endif // EIGEN_TRANSFORM2_H
diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h
index 7bf1d140e..d737d4cf0 100644
--- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h
+++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h
@@ -169,8 +169,8 @@ template<typename _MatrixType> class ComplexEigenSolver
*/
const EigenvectorType& eigenvectors() const
{
- ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
return m_eivec;
}
@@ -193,7 +193,7 @@ template<typename _MatrixType> class ComplexEigenSolver
*/
const EigenvalueType& eigenvalues() const
{
- ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_eivalues;
}
@@ -229,7 +229,7 @@ template<typename _MatrixType> class ComplexEigenSolver
*/
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_schur.info();
}
@@ -293,7 +293,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm
{
// If the i-th and k-th eigenvalue are equal, then z equals 0.
// Use a small value instead, to prevent division by zero.
- ei_real_ref(z) = NumTraits<RealScalar>::epsilon() * matrixnorm;
+ internal::real_ref(z) = NumTraits<RealScalar>::epsilon() * matrixnorm;
}
m_matX.coeffRef(i,k) = m_matX.coeff(i,k) / z;
}
diff --git a/Eigen/src/Eigenvalues/ComplexSchur.h b/Eigen/src/Eigenvalues/ComplexSchur.h
index edda4211b..b1830f642 100644
--- a/Eigen/src/Eigenvalues/ComplexSchur.h
+++ b/Eigen/src/Eigenvalues/ComplexSchur.h
@@ -30,7 +30,9 @@
#include "./EigenvaluesCommon.h"
#include "./HessenbergDecomposition.h"
-template<typename MatrixType, bool IsComplex> struct ei_complex_schur_reduce_to_hessenberg;
+namespace internal {
+template<typename MatrixType, bool IsComplex> struct complex_schur_reduce_to_hessenberg;
+}
/** \eigenvalues_module \ingroup Eigenvalues_Module
*
@@ -146,8 +148,8 @@ template<typename _MatrixType> class ComplexSchur
*/
const ComplexMatrixType& matrixU() const
{
- ei_assert(m_isInitialized && "ComplexSchur is not initialized.");
- ei_assert(m_matUisUptodate && "The matrix U has not been computed during the ComplexSchur decomposition.");
+ eigen_assert(m_isInitialized && "ComplexSchur is not initialized.");
+ eigen_assert(m_matUisUptodate && "The matrix U has not been computed during the ComplexSchur decomposition.");
return m_matU;
}
@@ -170,7 +172,7 @@ template<typename _MatrixType> class ComplexSchur
*/
const ComplexMatrixType& matrixT() const
{
- ei_assert(m_isInitialized && "ComplexSchur is not initialized.");
+ eigen_assert(m_isInitialized && "ComplexSchur is not initialized.");
return m_matT;
}
@@ -201,7 +203,7 @@ template<typename _MatrixType> class ComplexSchur
*/
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "RealSchur is not initialized.");
+ eigen_assert(m_isInitialized && "RealSchur is not initialized.");
return m_info;
}
@@ -222,22 +224,24 @@ template<typename _MatrixType> class ComplexSchur
bool subdiagonalEntryIsNeglegible(Index i);
ComplexScalar computeShift(Index iu, Index iter);
void reduceToTriangularForm(bool computeU);
- friend struct ei_complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>;
+ friend struct internal::complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>;
};
+namespace internal {
+
/** Computes the principal value of the square root of the complex \a z. */
template<typename RealScalar>
-std::complex<RealScalar> ei_sqrt(const std::complex<RealScalar> &z)
+std::complex<RealScalar> sqrt(const std::complex<RealScalar> &z)
{
RealScalar t, tre, tim;
- t = ei_abs(z);
+ t = abs(z);
- if (ei_abs(ei_real(z)) <= ei_abs(ei_imag(z)))
+ if (abs(real(z)) <= abs(imag(z)))
{
// No cancellation in these formulas
- tre = ei_sqrt(RealScalar(0.5)*(t + ei_real(z)));
- tim = ei_sqrt(RealScalar(0.5)*(t - ei_real(z)));
+ tre = sqrt(RealScalar(0.5)*(t + real(z)));
+ tim = sqrt(RealScalar(0.5)*(t - real(z)));
}
else
{
@@ -245,14 +249,14 @@ std::complex<RealScalar> ei_sqrt(const std::complex<RealScalar> &z)
if (z.real() > RealScalar(0))
{
tre = t + z.real();
- tim = ei_abs(ei_imag(z))*ei_sqrt(RealScalar(0.5)/tre);
- tre = ei_sqrt(RealScalar(0.5)*tre);
+ tim = abs(imag(z))*sqrt(RealScalar(0.5)/tre);
+ tre = sqrt(RealScalar(0.5)*tre);
}
else
{
tim = t - z.real();
- tre = ei_abs(ei_imag(z))*ei_sqrt(RealScalar(0.5)/tim);
- tim = ei_sqrt(RealScalar(0.5)*tim);
+ tre = abs(imag(z))*sqrt(RealScalar(0.5)/tim);
+ tim = sqrt(RealScalar(0.5)*tim);
}
}
if(z.imag() < RealScalar(0))
@@ -260,6 +264,7 @@ std::complex<RealScalar> ei_sqrt(const std::complex<RealScalar> &z)
return (std::complex<RealScalar>(tre,tim));
}
+} // end namespace internal
/** If m_matT(i+1,i) is neglegible in floating point arithmetic
@@ -268,9 +273,9 @@ std::complex<RealScalar> ei_sqrt(const std::complex<RealScalar> &z)
template<typename MatrixType>
inline bool ComplexSchur<MatrixType>::subdiagonalEntryIsNeglegible(Index i)
{
- RealScalar d = ei_norm1(m_matT.coeff(i,i)) + ei_norm1(m_matT.coeff(i+1,i+1));
- RealScalar sd = ei_norm1(m_matT.coeff(i+1,i));
- if (ei_isMuchSmallerThan(sd, d, NumTraits<RealScalar>::epsilon()))
+ RealScalar d = internal::norm1(m_matT.coeff(i,i)) + internal::norm1(m_matT.coeff(i+1,i+1));
+ RealScalar sd = internal::norm1(m_matT.coeff(i+1,i));
+ if (internal::isMuchSmallerThan(sd, d, NumTraits<RealScalar>::epsilon()))
{
m_matT.coeffRef(i+1,i) = ComplexScalar(0);
return true;
@@ -286,7 +291,7 @@ typename ComplexSchur<MatrixType>::ComplexScalar ComplexSchur<MatrixType>::compu
if (iter == 10 || iter == 20)
{
// exceptional shift, taken from http://www.netlib.org/eispack/comqr.f
- return ei_abs(ei_real(m_matT.coeff(iu,iu-1))) + ei_abs(ei_real(m_matT.coeff(iu-1,iu-2)));
+ return internal::abs(internal::real(m_matT.coeff(iu,iu-1))) + internal::abs(internal::real(m_matT.coeff(iu-1,iu-2)));
}
// compute the shift as one of the eigenvalues of t, the 2x2
@@ -297,19 +302,19 @@ typename ComplexSchur<MatrixType>::ComplexScalar ComplexSchur<MatrixType>::compu
ComplexScalar b = t.coeff(0,1) * t.coeff(1,0);
ComplexScalar c = t.coeff(0,0) - t.coeff(1,1);
- ComplexScalar disc = ei_sqrt(c*c + RealScalar(4)*b);
+ ComplexScalar disc = internal::sqrt(c*c + RealScalar(4)*b);
ComplexScalar det = t.coeff(0,0) * t.coeff(1,1) - b;
ComplexScalar trace = t.coeff(0,0) + t.coeff(1,1);
ComplexScalar eival1 = (trace + disc) / RealScalar(2);
ComplexScalar eival2 = (trace - disc) / RealScalar(2);
- if(ei_norm1(eival1) > ei_norm1(eival2))
+ if(internal::norm1(eival1) > internal::norm1(eival2))
eival2 = det / eival1;
else
eival1 = det / eival2;
// choose the eigenvalue closest to the bottom entry of the diagonal
- if(ei_norm1(eival1-t.coeff(1,1)) < ei_norm1(eival2-t.coeff(1,1)))
+ if(internal::norm1(eival1-t.coeff(1,1)) < internal::norm1(eival2-t.coeff(1,1)))
return normt * eival1;
else
return normt * eival2;
@@ -320,7 +325,7 @@ template<typename MatrixType>
ComplexSchur<MatrixType>& ComplexSchur<MatrixType>::compute(const MatrixType& matrix, bool computeU)
{
m_matUisUptodate = false;
- ei_assert(matrix.cols() == matrix.rows());
+ eigen_assert(matrix.cols() == matrix.rows());
if(matrix.cols() == 1)
{
@@ -332,14 +337,16 @@ ComplexSchur<MatrixType>& ComplexSchur<MatrixType>::compute(const MatrixType& ma
return *this;
}
- ei_complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>::run(*this, matrix, computeU);
+ internal::complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>::run(*this, matrix, computeU);
reduceToTriangularForm(computeU);
return *this;
}
+namespace internal {
+
/* Reduce given matrix to Hessenberg form */
template<typename MatrixType, bool IsComplex>
-struct ei_complex_schur_reduce_to_hessenberg
+struct complex_schur_reduce_to_hessenberg
{
// this is the implementation for the case IsComplex = true
static void run(ComplexSchur<MatrixType>& _this, const MatrixType& matrix, bool computeU)
@@ -351,7 +358,7 @@ struct ei_complex_schur_reduce_to_hessenberg
};
template<typename MatrixType>
-struct ei_complex_schur_reduce_to_hessenberg<MatrixType, false>
+struct complex_schur_reduce_to_hessenberg<MatrixType, false>
{
static void run(ComplexSchur<MatrixType>& _this, const MatrixType& matrix, bool computeU)
{
@@ -370,6 +377,8 @@ struct ei_complex_schur_reduce_to_hessenberg<MatrixType, false>
}
};
+} // end namespace internal
+
// Reduce the Hessenberg matrix m_matT to triangular form by QR iteration.
template<typename MatrixType>
void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
@@ -411,7 +420,7 @@ void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
bulge is chased down to the bottom of the active submatrix. */
ComplexScalar shift = computeShift(iu, iter);
- PlanarRotation<ComplexScalar> rot;
+ JacobiRotation<ComplexScalar> rot;
rot.makeGivens(m_matT.coeff(il,il) - shift, m_matT.coeff(il+1,il));
m_matT.rightCols(m_matT.cols()-il).applyOnTheLeft(il, il+1, rot.adjoint());
m_matT.topRows(std::min(il+2,iu)+1).applyOnTheRight(il, il+1, rot);
diff --git a/Eigen/src/Eigenvalues/EigenSolver.h b/Eigen/src/Eigenvalues/EigenSolver.h
index 0a5faec52..5a59ccbd4 100644
--- a/Eigen/src/Eigenvalues/EigenSolver.h
+++ b/Eigen/src/Eigenvalues/EigenSolver.h
@@ -211,8 +211,8 @@ template<typename _MatrixType> class EigenSolver
*/
const MatrixType& pseudoEigenvectors() const
{
- ei_assert(m_isInitialized && "EigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
return m_eivec;
}
@@ -254,7 +254,7 @@ template<typename _MatrixType> class EigenSolver
*/
const EigenvalueType& eigenvalues() const
{
- ei_assert(m_isInitialized && "EigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
return m_eivalues;
}
@@ -289,7 +289,7 @@ template<typename _MatrixType> class EigenSolver
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_realSchur.info();
}
@@ -311,17 +311,17 @@ template<typename _MatrixType> class EigenSolver
template<typename MatrixType>
MatrixType EigenSolver<MatrixType>::pseudoEigenvalueMatrix() const
{
- ei_assert(m_isInitialized && "EigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
Index n = m_eivalues.rows();
MatrixType matD = MatrixType::Zero(n,n);
for (Index i=0; i<n; ++i)
{
- if (ei_isMuchSmallerThan(ei_imag(m_eivalues.coeff(i)), ei_real(m_eivalues.coeff(i))))
- matD.coeffRef(i,i) = ei_real(m_eivalues.coeff(i));
+ if (internal::isMuchSmallerThan(internal::imag(m_eivalues.coeff(i)), internal::real(m_eivalues.coeff(i))))
+ matD.coeffRef(i,i) = internal::real(m_eivalues.coeff(i));
else
{
- matD.template block<2,2>(i,i) << ei_real(m_eivalues.coeff(i)), ei_imag(m_eivalues.coeff(i)),
- -ei_imag(m_eivalues.coeff(i)), ei_real(m_eivalues.coeff(i));
+ matD.template block<2,2>(i,i) << internal::real(m_eivalues.coeff(i)), internal::imag(m_eivalues.coeff(i)),
+ -internal::imag(m_eivalues.coeff(i)), internal::real(m_eivalues.coeff(i));
++i;
}
}
@@ -331,13 +331,13 @@ MatrixType EigenSolver<MatrixType>::pseudoEigenvalueMatrix() const
template<typename MatrixType>
typename EigenSolver<MatrixType>::EigenvectorsType EigenSolver<MatrixType>::eigenvectors() const
{
- ei_assert(m_isInitialized && "EigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
Index n = m_eivec.cols();
EigenvectorsType matV(n,n);
for (Index j=0; j<n; ++j)
{
- if (ei_isMuchSmallerThan(ei_imag(m_eivalues.coeff(j)), ei_real(m_eivalues.coeff(j))))
+ if (internal::isMuchSmallerThan(internal::imag(m_eivalues.coeff(j)), internal::real(m_eivalues.coeff(j))))
{
// we have a real eigen value
matV.col(j) = m_eivec.col(j).template cast<ComplexScalar>();
@@ -384,7 +384,7 @@ EigenSolver<MatrixType>& EigenSolver<MatrixType>::compute(const MatrixType& matr
else
{
Scalar p = Scalar(0.5) * (m_matT.coeff(i, i) - m_matT.coeff(i+1, i+1));
- Scalar z = ei_sqrt(ei_abs(p * p + m_matT.coeff(i+1, i) * m_matT.coeff(i, i+1)));
+ Scalar z = internal::sqrt(internal::abs(p * p + m_matT.coeff(i+1, i) * m_matT.coeff(i, i+1)));
m_eivalues.coeffRef(i) = ComplexScalar(m_matT.coeff(i+1, i+1) + p, z);
m_eivalues.coeffRef(i+1) = ComplexScalar(m_matT.coeff(i+1, i+1) + p, -z);
i += 2;
@@ -407,7 +407,7 @@ template<typename Scalar>
std::complex<Scalar> cdiv(Scalar xr, Scalar xi, Scalar yr, Scalar yi)
{
Scalar r,d;
- if (ei_abs(yr) > ei_abs(yi))
+ if (internal::abs(yr) > internal::abs(yi))
{
r = yi/yr;
d = yr + r*yi;
@@ -480,14 +480,14 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
Scalar denom = (m_eivalues.coeff(i).real() - p) * (m_eivalues.coeff(i).real() - p) + m_eivalues.coeff(i).imag() * m_eivalues.coeff(i).imag();
Scalar t = (x * lastr - lastw * r) / denom;
m_matT.coeffRef(i,n) = t;
- if (ei_abs(x) > ei_abs(lastw))
+ if (internal::abs(x) > internal::abs(lastw))
m_matT.coeffRef(i+1,n) = (-r - w * t) / x;
else
m_matT.coeffRef(i+1,n) = (-lastr - y * t) / lastw;
}
// Overflow control
- Scalar t = ei_abs(m_matT.coeff(i,n));
+ Scalar t = internal::abs(m_matT.coeff(i,n));
if ((eps * t) * t > 1)
m_matT.col(n).tail(size-i) /= t;
}
@@ -499,16 +499,16 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
Index l = n-1;
// Last vector component imaginary so matrix is triangular
- if (ei_abs(m_matT.coeff(n,n-1)) > ei_abs(m_matT.coeff(n-1,n)))
+ if (internal::abs(m_matT.coeff(n,n-1)) > internal::abs(m_matT.coeff(n-1,n)))
{
m_matT.coeffRef(n-1,n-1) = q / m_matT.coeff(n,n-1);
m_matT.coeffRef(n-1,n) = -(m_matT.coeff(n,n) - p) / m_matT.coeff(n,n-1);
}
else
{
- std::complex<Scalar> cc = cdiv<Scalar>(0.0,-m_matT.coeff(n-1,n),m_matT.coeff(n-1,n-1)-p,q);
- m_matT.coeffRef(n-1,n-1) = ei_real(cc);
- m_matT.coeffRef(n-1,n) = ei_imag(cc);
+ std::complex<Scalar> cc = cdiv<Scalar>(0.0,-m_matT.coeff(n-1,n),m_matT.coeff(n-1,n-1)-p,q);
+ m_matT.coeffRef(n-1,n-1) = internal::real(cc);
+ m_matT.coeffRef(n-1,n) = internal::imag(cc);
}
m_matT.coeffRef(n,n-1) = 0.0;
m_matT.coeffRef(n,n) = 1.0;
@@ -530,8 +530,8 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
if (m_eivalues.coeff(i).imag() == 0)
{
std::complex<Scalar> cc = cdiv(-ra,-sa,w,q);
- m_matT.coeffRef(i,n-1) = ei_real(cc);
- m_matT.coeffRef(i,n) = ei_imag(cc);
+ m_matT.coeffRef(i,n-1) = internal::real(cc);
+ m_matT.coeffRef(i,n) = internal::imag(cc);
}
else
{
@@ -541,12 +541,12 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
Scalar vr = (m_eivalues.coeff(i).real() - p) * (m_eivalues.coeff(i).real() - p) + m_eivalues.coeff(i).imag() * m_eivalues.coeff(i).imag() - q * q;
Scalar vi = (m_eivalues.coeff(i).real() - p) * Scalar(2) * q;
if ((vr == 0.0) && (vi == 0.0))
- vr = eps * norm * (ei_abs(w) + ei_abs(q) + ei_abs(x) + ei_abs(y) + ei_abs(lastw));
+ vr = eps * norm * (internal::abs(w) + internal::abs(q) + internal::abs(x) + internal::abs(y) + internal::abs(lastw));
std::complex<Scalar> cc = cdiv(x*lastra-lastw*ra+q*sa,x*lastsa-lastw*sa-q*ra,vr,vi);
- m_matT.coeffRef(i,n-1) = ei_real(cc);
- m_matT.coeffRef(i,n) = ei_imag(cc);
- if (ei_abs(x) > (ei_abs(lastw) + ei_abs(q)))
+ m_matT.coeffRef(i,n-1) = internal::real(cc);
+ m_matT.coeffRef(i,n) = internal::imag(cc);
+ if (internal::abs(x) > (internal::abs(lastw) + internal::abs(q)))
{
m_matT.coeffRef(i+1,n-1) = (-ra - w * m_matT.coeff(i,n-1) + q * m_matT.coeff(i,n)) / x;
m_matT.coeffRef(i+1,n) = (-sa - w * m_matT.coeff(i,n) - q * m_matT.coeff(i,n-1)) / x;
@@ -554,13 +554,13 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
else
{
cc = cdiv(-lastra-y*m_matT.coeff(i,n-1),-lastsa-y*m_matT.coeff(i,n),lastw,q);
- m_matT.coeffRef(i+1,n-1) = ei_real(cc);
- m_matT.coeffRef(i+1,n) = ei_imag(cc);
+ m_matT.coeffRef(i+1,n-1) = internal::real(cc);
+ m_matT.coeffRef(i+1,n) = internal::imag(cc);
}
}
// Overflow control
- Scalar t = std::max(ei_abs(m_matT.coeff(i,n-1)),ei_abs(m_matT.coeff(i,n)));
+ Scalar t = std::max(internal::abs(m_matT.coeff(i,n-1)),internal::abs(m_matT.coeff(i,n)));
if ((eps * t) * t > 1)
m_matT.block(i, n-1, size-i, 2) /= t;
diff --git a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
index a47a3dc2e..a19e8cf24 100644
--- a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
+++ b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
@@ -182,8 +182,8 @@ template<typename MatrixType>
GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver<MatrixType>::
compute(const MatrixType& matA, const MatrixType& matB, int options)
{
- ei_assert(matA.cols()==matA.rows() && matB.rows()==matA.rows() && matB.cols()==matB.rows());
- ei_assert((options&~(EigVecMask|GenEigMask))==0
+ eigen_assert(matA.cols()==matA.rows() && matB.rows()==matA.rows() && matB.cols()==matB.rows());
+ eigen_assert((options&~(EigVecMask|GenEigMask))==0
&& (options&EigVecMask)!=EigVecMask
&& ((options&GenEigMask)==0 || (options&GenEigMask)==Ax_lBx
|| (options&GenEigMask)==ABx_lx || (options&GenEigMask)==BAx_lx)
diff --git a/Eigen/src/Eigenvalues/HessenbergDecomposition.h b/Eigen/src/Eigenvalues/HessenbergDecomposition.h
index 79554187a..b7da136a8 100644
--- a/Eigen/src/Eigenvalues/HessenbergDecomposition.h
+++ b/Eigen/src/Eigenvalues/HessenbergDecomposition.h
@@ -28,11 +28,13 @@
template<typename MatrixType> struct HessenbergDecompositionMatrixHReturnType;
+namespace internal {
template<typename MatrixType>
-struct ei_traits<HessenbergDecompositionMatrixHReturnType<MatrixType> >
+struct traits<HessenbergDecompositionMatrixHReturnType<MatrixType> >
{
typedef MatrixType ReturnType;
};
+}
/** \eigenvalues_module \ingroup Eigenvalues_Module
*
@@ -184,7 +186,7 @@ template<typename _MatrixType> class HessenbergDecomposition
*/
const CoeffVectorType& householderCoefficients() const
{
- ei_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
+ eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
return m_hCoeffs;
}
@@ -219,7 +221,7 @@ template<typename _MatrixType> class HessenbergDecomposition
*/
const MatrixType& packedMatrix() const
{
- ei_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
+ eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
return m_matrix;
}
@@ -239,7 +241,7 @@ template<typename _MatrixType> class HessenbergDecomposition
*/
HouseholderSequenceType matrixQ() const
{
- ei_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
+ eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate(), false, m_matrix.rows() - 1, 1);
}
@@ -265,7 +267,7 @@ template<typename _MatrixType> class HessenbergDecomposition
*/
HessenbergDecompositionMatrixHReturnType<MatrixType> matrixH() const
{
- ei_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
+ eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized.");
return HessenbergDecompositionMatrixHReturnType<MatrixType>(*this);
}
@@ -319,7 +321,7 @@ void HessenbergDecomposition<MatrixType>::_compute(MatrixType& matA, CoeffVector
// A = A H'
matA.rightCols(remainingSize)
- .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(), ei_conj(h), &temp.coeffRef(0));
+ .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(), internal::conj(h), &temp.coeffRef(0));
}
}
diff --git a/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h b/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
index e517b6e5a..5591519fb 100644
--- a/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
+++ b/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
@@ -26,10 +26,10 @@
#ifndef EIGEN_MATRIXBASEEIGENVALUES_H
#define EIGEN_MATRIXBASEEIGENVALUES_H
-
+namespace internal {
template<typename Derived, bool IsComplex>
-struct ei_eigenvalues_selector
+struct eigenvalues_selector
{
// this is the implementation for the case IsComplex = true
static inline typename MatrixBase<Derived>::EigenvaluesReturnType const
@@ -42,7 +42,7 @@ struct ei_eigenvalues_selector
};
template<typename Derived>
-struct ei_eigenvalues_selector<Derived, false>
+struct eigenvalues_selector<Derived, false>
{
static inline typename MatrixBase<Derived>::EigenvaluesReturnType const
run(const MatrixBase<Derived>& m)
@@ -53,6 +53,8 @@ struct ei_eigenvalues_selector<Derived, false>
}
};
+} // end namespace internal
+
/** \brief Computes the eigenvalues of a matrix
* \returns Column vector containing the eigenvalues.
*
@@ -77,8 +79,8 @@ template<typename Derived>
inline typename MatrixBase<Derived>::EigenvaluesReturnType
MatrixBase<Derived>::eigenvalues() const
{
- typedef typename ei_traits<Derived>::Scalar Scalar;
- return ei_eigenvalues_selector<Derived, NumTraits<Scalar>::IsComplex>::run(derived());
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ return internal::eigenvalues_selector<Derived, NumTraits<Scalar>::IsComplex>::run(derived());
}
/** \brief Computes the eigenvalues of a matrix
@@ -135,7 +137,7 @@ MatrixBase<Derived>::operatorNorm() const
typename Derived::PlainObject m_eval(derived());
// FIXME if it is really guaranteed that the eigenvalues are already sorted,
// then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough.
- return ei_sqrt((m_eval*m_eval.adjoint())
+ return internal::sqrt((m_eval*m_eval.adjoint())
.eval()
.template selfadjointView<Lower>()
.eigenvalues()
diff --git a/Eigen/src/Eigenvalues/RealSchur.h b/Eigen/src/Eigenvalues/RealSchur.h
index eb713339b..e250d9a86 100644
--- a/Eigen/src/Eigenvalues/RealSchur.h
+++ b/Eigen/src/Eigenvalues/RealSchur.h
@@ -137,8 +137,8 @@ template<typename _MatrixType> class RealSchur
*/
const MatrixType& matrixU() const
{
- ei_assert(m_isInitialized && "RealSchur is not initialized.");
- ei_assert(m_matUisUptodate && "The matrix U has not been computed during the RealSchur decomposition.");
+ eigen_assert(m_isInitialized && "RealSchur is not initialized.");
+ eigen_assert(m_matUisUptodate && "The matrix U has not been computed during the RealSchur decomposition.");
return m_matU;
}
@@ -154,7 +154,7 @@ template<typename _MatrixType> class RealSchur
*/
const MatrixType& matrixT() const
{
- ei_assert(m_isInitialized && "RealSchur is not initialized.");
+ eigen_assert(m_isInitialized && "RealSchur is not initialized.");
return m_matT;
}
@@ -183,7 +183,7 @@ template<typename _MatrixType> class RealSchur
*/
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "RealSchur is not initialized.");
+ eigen_assert(m_isInitialized && "RealSchur is not initialized.");
return m_info;
}
@@ -300,10 +300,10 @@ inline typename MatrixType::Index RealSchur<MatrixType>::findSmallSubdiagEntry(I
Index res = iu;
while (res > 0)
{
- Scalar s = ei_abs(m_matT.coeff(res-1,res-1)) + ei_abs(m_matT.coeff(res,res));
+ Scalar s = internal::abs(m_matT.coeff(res-1,res-1)) + internal::abs(m_matT.coeff(res,res));
if (s == 0.0)
s = norm;
- if (ei_abs(m_matT.coeff(res,res-1)) < NumTraits<Scalar>::epsilon() * s)
+ if (internal::abs(m_matT.coeff(res,res-1)) < NumTraits<Scalar>::epsilon() * s)
break;
res--;
}
@@ -325,8 +325,8 @@ inline void RealSchur<MatrixType>::splitOffTwoRows(Index iu, bool computeU, Scal
if (q >= 0) // Two real eigenvalues
{
- Scalar z = ei_sqrt(ei_abs(q));
- PlanarRotation<Scalar> rot;
+ Scalar z = internal::sqrt(internal::abs(q));
+ JacobiRotation<Scalar> rot;
if (p >= 0)
rot.makeGivens(p + z, m_matT.coeff(iu, iu-1));
else
@@ -357,7 +357,7 @@ inline void RealSchur<MatrixType>::computeShift(Index iu, Index iter, Scalar& ex
exshift += shiftInfo.coeff(0);
for (Index i = 0; i <= iu; ++i)
m_matT.coeffRef(i,i) -= shiftInfo.coeff(0);
- Scalar s = ei_abs(m_matT.coeff(iu,iu-1)) + ei_abs(m_matT.coeff(iu-1,iu-2));
+ Scalar s = internal::abs(m_matT.coeff(iu,iu-1)) + internal::abs(m_matT.coeff(iu-1,iu-2));
shiftInfo.coeffRef(0) = Scalar(0.75) * s;
shiftInfo.coeffRef(1) = Scalar(0.75) * s;
shiftInfo.coeffRef(2) = Scalar(-0.4375) * s * s;
@@ -370,7 +370,7 @@ inline void RealSchur<MatrixType>::computeShift(Index iu, Index iter, Scalar& ex
s = s * s + shiftInfo.coeff(2);
if (s > 0)
{
- s = ei_sqrt(s);
+ s = internal::sqrt(s);
if (shiftInfo.coeff(1) < shiftInfo.coeff(0))
s = -s;
s = s + (shiftInfo.coeff(1) - shiftInfo.coeff(0)) / Scalar(2.0);
@@ -400,9 +400,9 @@ inline void RealSchur<MatrixType>::initFrancisQRStep(Index il, Index iu, const V
if (im == il) {
break;
}
- const Scalar lhs = m_matT.coeff(im,im-1) * (ei_abs(v.coeff(1)) + ei_abs(v.coeff(2)));
- const Scalar rhs = v.coeff(0) * (ei_abs(m_matT.coeff(im-1,im-1)) + ei_abs(Tmm) + ei_abs(m_matT.coeff(im+1,im+1)));
- if (ei_abs(lhs) < NumTraits<Scalar>::epsilon() * rhs)
+ const Scalar lhs = m_matT.coeff(im,im-1) * (internal::abs(v.coeff(1)) + internal::abs(v.coeff(2)));
+ const Scalar rhs = v.coeff(0) * (internal::abs(m_matT.coeff(im-1,im-1)) + internal::abs(Tmm) + internal::abs(m_matT.coeff(im+1,im+1)));
+ if (internal::abs(lhs) < NumTraits<Scalar>::epsilon() * rhs)
{
break;
}
diff --git a/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
index f14baa333..7cef9e529 100644
--- a/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
+++ b/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
@@ -101,7 +101,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
* This is a column vector with entries of type #RealScalar.
* The length of the vector is the size of \p _MatrixType.
*/
- typedef typename ei_plain_col_type<MatrixType, RealScalar>::type RealVectorType;
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type RealVectorType;
typedef Tridiagonalization<MatrixType> TridiagonalizationType;
/** \brief Default constructor for fixed-size matrices.
@@ -219,8 +219,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
*/
const MatrixType& eigenvectors() const
{
- ei_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
return m_eivec;
}
@@ -240,7 +240,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
*/
const RealVectorType& eigenvalues() const
{
- ei_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
return m_eivalues;
}
@@ -264,8 +264,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
*/
MatrixType operatorSqrt() const
{
- ei_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
return m_eivec * m_eivalues.cwiseSqrt().asDiagonal() * m_eivec.adjoint();
}
@@ -289,8 +289,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
*/
MatrixType operatorInverseSqrt() const
{
- ei_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
- ei_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
return m_eivec * m_eivalues.cwiseInverse().cwiseSqrt().asDiagonal() * m_eivec.adjoint();
}
@@ -300,7 +300,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
*/
ComputationInfo info() const
{
- ei_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
return m_info;
}
@@ -335,15 +335,17 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
* Implemented from Golub's "Matrix Computations", algorithm 8.3.2:
* "implicit symmetric QR step with Wilkinson shift"
*/
+namespace internal {
template<typename RealScalar, typename Scalar, typename Index>
-static void ei_tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
+static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
+}
template<typename MatrixType>
SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
::compute(const MatrixType& matrix, int options)
{
- ei_assert(matrix.cols() == matrix.rows());
- ei_assert((options&~(EigVecMask|GenEigMask))==0
+ eigen_assert(matrix.cols() == matrix.rows());
+ eigen_assert((options&~(EigVecMask|GenEigMask))==0
&& (options&EigVecMask)!=EigVecMask
&& "invalid option parameter");
bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
@@ -352,7 +354,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
if(n==1)
{
- m_eivalues.coeffRef(0,0) = ei_real(matrix.coeff(0,0));
+ m_eivalues.coeffRef(0,0) = internal::real(matrix.coeff(0,0));
if(computeEigenvectors)
m_eivec.setOnes();
m_info = Success;
@@ -367,7 +369,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
mat = matrix;
m_subdiag.resize(n-1);
- ei_tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
+ internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
Index end = n-1;
Index start = 0;
@@ -376,7 +378,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
while (end>0)
{
for (Index i = start; i<end; ++i)
- if (ei_isMuchSmallerThan(ei_abs(m_subdiag[i]),(ei_abs(diag[i])+ei_abs(diag[i+1]))))
+ if (internal::isMuchSmallerThan(internal::abs(m_subdiag[i]),(internal::abs(diag[i])+internal::abs(diag[i+1]))))
m_subdiag[i] = 0;
// find the largest unreduced block
@@ -396,7 +398,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
while (start>0 && m_subdiag[start-1]!=0)
start--;
- ei_tridiagonal_qr_step(diag.data(), m_subdiag.data(), start, end, computeEigenvectors ? m_eivec.data() : (Scalar*)0, n);
+ internal::tridiagonal_qr_step(diag.data(), m_subdiag.data(), start, end, computeEigenvectors ? m_eivec.data() : (Scalar*)0, n);
}
if (iter <= m_maxIterations)
@@ -427,18 +429,19 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
return *this;
}
+namespace internal {
template<typename RealScalar, typename Scalar, typename Index>
-static void ei_tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
+static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
{
RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
- RealScalar e2 = ei_abs2(subdiag[end-1]);
- RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * ei_sqrt(td*td + e2));
+ RealScalar e2 = abs2(subdiag[end-1]);
+ RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
RealScalar x = diag[start] - mu;
RealScalar z = subdiag[start];
for (Index k = start; k < end; ++k)
{
- PlanarRotation<RealScalar> rot;
+ JacobiRotation<RealScalar> rot;
rot.makeGivens(x, z);
// do T = G' T G
@@ -468,5 +471,6 @@ static void ei_tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index
}
}
}
+} // end namespace internal
#endif // EIGEN_SELFADJOINTEIGENSOLVER_H
diff --git a/Eigen/src/Eigenvalues/Tridiagonalization.h b/Eigen/src/Eigenvalues/Tridiagonalization.h
index 23ae748d4..d70c4d433 100644
--- a/Eigen/src/Eigenvalues/Tridiagonalization.h
+++ b/Eigen/src/Eigenvalues/Tridiagonalization.h
@@ -26,6 +26,11 @@
#ifndef EIGEN_TRIDIAGONALIZATION_H
#define EIGEN_TRIDIAGONALIZATION_H
+namespace internal {
+template<typename MatrixType, typename CoeffVectorType>
+void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs);
+}
+
/** \eigenvalues_module \ingroup Eigenvalues_Module
*
*
@@ -78,20 +83,20 @@ template<typename _MatrixType> class Tridiagonalization
};
typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> CoeffVectorType;
- typedef typename ei_plain_col_type<MatrixType, RealScalar>::type DiagonalType;
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type DiagonalType;
typedef Matrix<RealScalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> SubDiagonalType;
- typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
typename Diagonal<MatrixType,0>::RealReturnType,
Diagonal<MatrixType,0>
- >::ret DiagonalReturnType;
+ >::type DiagonalReturnType;
- typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
typename Diagonal<
Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >::RealReturnType,
Diagonal<
Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >
- >::ret SubDiagonalReturnType;
+ >::type SubDiagonalReturnType;
/** \brief Return type of matrixQ() */
typedef typename HouseholderSequence<MatrixType,CoeffVectorType>::ConjugateReturnType HouseholderSequenceType;
@@ -129,7 +134,7 @@ template<typename _MatrixType> class Tridiagonalization
m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1),
m_isInitialized(false)
{
- ei_tridiagonalization_inplace(m_matrix, m_hCoeffs);
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
m_isInitialized = true;
}
@@ -154,7 +159,7 @@ template<typename _MatrixType> class Tridiagonalization
{
m_matrix = matrix;
m_hCoeffs.resize(matrix.rows()-1, 1);
- ei_tridiagonalization_inplace(m_matrix, m_hCoeffs);
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
m_isInitialized = true;
return *this;
}
@@ -177,7 +182,7 @@ template<typename _MatrixType> class Tridiagonalization
*/
inline CoeffVectorType householderCoefficients() const
{
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
return m_hCoeffs;
}
@@ -214,7 +219,7 @@ template<typename _MatrixType> class Tridiagonalization
*/
inline const MatrixType& packedMatrix() const
{
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
return m_matrix;
}
@@ -235,7 +240,7 @@ template<typename _MatrixType> class Tridiagonalization
*/
HouseholderSequenceType matrixQ() const
{
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate(), false, m_matrix.rows() - 1, 1);
}
@@ -296,7 +301,7 @@ template<typename MatrixType>
const typename Tridiagonalization<MatrixType>::DiagonalReturnType
Tridiagonalization<MatrixType>::diagonal() const
{
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
return m_matrix.diagonal();
}
@@ -304,7 +309,7 @@ template<typename MatrixType>
const typename Tridiagonalization<MatrixType>::SubDiagonalReturnType
Tridiagonalization<MatrixType>::subDiagonal() const
{
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
Index n = m_matrix.rows();
return Block<MatrixType,SizeMinusOne,SizeMinusOne>(m_matrix, 1, 0, n-1,n-1).diagonal();
}
@@ -315,7 +320,7 @@ Tridiagonalization<MatrixType>::matrixT() const
{
// FIXME should this function (and other similar ones) rather take a matrix as argument
// and fill it ? (to avoid temporaries)
- ei_assert(m_isInitialized && "Tridiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
Index n = m_matrix.rows();
MatrixType matT = m_matrix;
matT.topRightCorner(n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate();
@@ -327,6 +332,8 @@ Tridiagonalization<MatrixType>::matrixT() const
return matT;
}
+namespace internal {
+
/** \internal
* Performs a tridiagonal decomposition of the selfadjoint matrix \a matA in-place.
*
@@ -351,10 +358,10 @@ Tridiagonalization<MatrixType>::matrixT() const
* \sa Tridiagonalization::packedMatrix()
*/
template<typename MatrixType, typename CoeffVectorType>
-void ei_tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
+void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
{
- ei_assert(matA.rows()==matA.cols());
- ei_assert(matA.rows()==hCoeffs.size()+1);
+ eigen_assert(matA.rows()==matA.cols());
+ eigen_assert(matA.rows()==hCoeffs.size()+1);
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
@@ -371,9 +378,9 @@ void ei_tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
matA.col(i).coeffRef(i+1) = 1;
hCoeffs.tail(n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
- * (ei_conj(h) * matA.col(i).tail(remainingSize)));
+ * (conj(h) * matA.col(i).tail(remainingSize)));
- hCoeffs.tail(n-i-1) += (ei_conj(h)*Scalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1);
+ hCoeffs.tail(n-i-1) += (conj(h)*Scalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1);
matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
.rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), -1);
@@ -387,7 +394,7 @@ void ei_tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
template<typename MatrixType,
int Size=MatrixType::ColsAtCompileTime,
bool IsComplex=NumTraits<typename MatrixType::Scalar>::IsComplex>
-struct ei_tridiagonalization_inplace_selector;
+struct tridiagonalization_inplace_selector;
/** \brief Performs a full tridiagonalization in place
*
@@ -430,19 +437,19 @@ struct ei_tridiagonalization_inplace_selector;
* \sa class Tridiagonalization
*/
template<typename MatrixType, typename DiagonalType, typename SubDiagonalType>
-void ei_tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
+void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
{
typedef typename MatrixType::Index Index;
//Index n = mat.rows();
- ei_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1);
- ei_tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, extractQ);
+ eigen_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1);
+ tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, extractQ);
}
/** \internal
* General full tridiagonalization
*/
template<typename MatrixType, int Size, bool IsComplex>
-struct ei_tridiagonalization_inplace_selector
+struct tridiagonalization_inplace_selector
{
typedef typename Tridiagonalization<MatrixType>::CoeffVectorType CoeffVectorType;
typedef typename Tridiagonalization<MatrixType>::HouseholderSequenceType HouseholderSequenceType;
@@ -451,7 +458,7 @@ struct ei_tridiagonalization_inplace_selector
static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
{
CoeffVectorType hCoeffs(mat.cols()-1);
- ei_tridiagonalization_inplace(mat,hCoeffs);
+ tridiagonalization_inplace(mat,hCoeffs);
diag = mat.diagonal().real();
subdiag = mat.template diagonal<-1>().real();
if(extractQ)
@@ -464,7 +471,7 @@ struct ei_tridiagonalization_inplace_selector
* Especially useful for plane fitting.
*/
template<typename MatrixType>
-struct ei_tridiagonalization_inplace_selector<MatrixType,3,false>
+struct tridiagonalization_inplace_selector<MatrixType,3,false>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
@@ -473,7 +480,7 @@ struct ei_tridiagonalization_inplace_selector<MatrixType,3,false>
static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
{
diag[0] = mat(0,0);
- RealScalar v1norm2 = ei_abs2(mat(2,0));
+ RealScalar v1norm2 = abs2(mat(2,0));
if(v1norm2 == RealScalar(0))
{
diag[1] = mat(1,1);
@@ -485,7 +492,7 @@ struct ei_tridiagonalization_inplace_selector<MatrixType,3,false>
}
else
{
- RealScalar beta = ei_sqrt(ei_abs2(mat(1,0)) + v1norm2);
+ RealScalar beta = sqrt(abs2(mat(1,0)) + v1norm2);
RealScalar invBeta = RealScalar(1)/beta;
Scalar m01 = mat(1,0) * invBeta;
Scalar m02 = mat(2,0) * invBeta;
@@ -508,16 +515,19 @@ struct ei_tridiagonalization_inplace_selector<MatrixType,3,false>
* Trivial specialization for 1x1 matrices
*/
template<typename MatrixType, bool IsComplex>
-struct ei_tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
+struct tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
{
typedef typename MatrixType::Scalar Scalar;
template<typename DiagonalType, typename SubDiagonalType>
static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, bool extractQ)
{
- diag(0,0) = ei_real(mat(0,0));
+ diag(0,0) = real(mat(0,0));
if(extractQ)
mat(0,0) = Scalar(1);
}
};
+
+} // end namespace internal
+
#endif // EIGEN_TRIDIAGONALIZATION_H
diff --git a/Eigen/src/Geometry/AlignedBox.h b/Eigen/src/Geometry/AlignedBox.h
index 196a4fc72..0497eb301 100644
--- a/Eigen/src/Geometry/AlignedBox.h
+++ b/Eigen/src/Geometry/AlignedBox.h
@@ -84,7 +84,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived>
inline explicit AlignedBox(const MatrixBase<Derived>& a_p)
{
- const typename ei_nested<Derived,2>::type p(a_p.derived());
+ const typename internal::nested<Derived,2>::type p(a_p.derived());
m_min = p;
m_max = p;
}
@@ -120,8 +120,8 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
inline VectorType& max() { return m_max; }
/** \returns the center of the box */
- inline const CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>,
- CwiseBinaryOp<ei_scalar_sum_op<Scalar>, VectorType, VectorType> >
+ inline const CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>,
+ CwiseBinaryOp<internal::scalar_sum_op<Scalar>, VectorType, VectorType> >
center() const
{ return (m_min+m_max)/2; }
@@ -129,7 +129,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
* Note that this function does not get the same
* result for integral or floating scalar types: see
*/
- inline const CwiseBinaryOp< ei_scalar_difference_op<Scalar>, VectorType, VectorType> sizes() const
+ inline const CwiseBinaryOp< internal::scalar_difference_op<Scalar>, VectorType, VectorType> sizes() const
{ return m_max - m_min; }
/** \returns the volume of the bounding box */
@@ -140,7 +140,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
* if the length of the diagonal is needed: diagonal().norm()
* will provide it.
*/
- inline CwiseBinaryOp< ei_scalar_difference_op<Scalar>, VectorType, VectorType> diagonal() const
+ inline CwiseBinaryOp< internal::scalar_difference_op<Scalar>, VectorType, VectorType> diagonal() const
{ return sizes(); }
/** \returns the vertex of the bounding box at the corner defined by
@@ -178,10 +178,10 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
if(!ScalarTraits::IsInteger)
{
r[d] = m_min[d] + (m_max[d]-m_min[d])
- * ei_random<Scalar>(Scalar(0), Scalar(1));
+ * internal::random<Scalar>(Scalar(0), Scalar(1));
}
else
- r[d] = ei_random(m_min[d], m_max[d]);
+ r[d] = internal::random(m_min[d], m_max[d]);
}
return r;
}
@@ -190,7 +190,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived>
inline bool contains(const MatrixBase<Derived>& a_p) const
{
- const typename ei_nested<Derived,2>::type p(a_p.derived());
+ const typename internal::nested<Derived,2>::type p(a_p.derived());
return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all();
}
@@ -202,7 +202,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived>
inline AlignedBox& extend(const MatrixBase<Derived>& a_p)
{
- const typename ei_nested<Derived,2>::type p(a_p.derived());
+ const typename internal::nested<Derived,2>::type p(a_p.derived());
m_min = m_min.cwiseMin(p);
m_max = m_max.cwiseMax(p);
return *this;
@@ -236,7 +236,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived>
inline AlignedBox& translate(const MatrixBase<Derived>& a_t)
{
- const typename ei_nested<Derived,2>::type t(a_t.derived());
+ const typename internal::nested<Derived,2>::type t(a_t.derived());
m_min += t;
m_max += t;
return *this;
@@ -261,14 +261,14 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
*/
template<typename Derived>
inline NonInteger exteriorDistance(const MatrixBase<Derived>& p) const
- { return ei_sqrt(NonInteger(squaredExteriorDistance(p))); }
+ { return internal::sqrt(NonInteger(squaredExteriorDistance(p))); }
/** \returns the distance between the boxes \a b and \c *this,
* and zero if the boxes intersect.
* \sa squaredExteriorDistance()
*/
inline NonInteger exteriorDistance(const AlignedBox& b) const
- { return ei_sqrt(NonInteger(squaredExteriorDistance(b))); }
+ { return internal::sqrt(NonInteger(squaredExteriorDistance(b))); }
/** \returns \c *this with scalar type casted to \a NewScalarType
*
@@ -276,10 +276,10 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<AlignedBox,
+ inline typename internal::cast_return_type<AlignedBox,
AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
{
- return typename ei_cast_return_type<AlignedBox,
+ return typename internal::cast_return_type<AlignedBox,
AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
}
@@ -309,7 +309,7 @@ template<typename Scalar,int AmbientDim>
template<typename Derived>
inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const MatrixBase<Derived>& a_p) const
{
- const typename ei_nested<Derived,2*AmbientDim>::type p(a_p.derived());
+ const typename internal::nested<Derived,2*AmbientDim>::type p(a_p.derived());
Scalar dist2 = 0.;
Scalar aux;
for (Index k=0; k<dim(); ++k)
diff --git a/Eigen/src/Geometry/AngleAxis.h b/Eigen/src/Geometry/AngleAxis.h
index 8319aa6f1..52f1e323e 100644
--- a/Eigen/src/Geometry/AngleAxis.h
+++ b/Eigen/src/Geometry/AngleAxis.h
@@ -51,10 +51,12 @@
* \sa class Quaternion, class Transform, MatrixBase::UnitX()
*/
-template<typename _Scalar> struct ei_traits<AngleAxis<_Scalar> >
+namespace internal {
+template<typename _Scalar> struct traits<AngleAxis<_Scalar> >
{
typedef _Scalar Scalar;
};
+}
template<typename _Scalar>
class AngleAxis : public RotationBase<AngleAxis<_Scalar>,3>
@@ -131,8 +133,8 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type cast() const
- { return typename ei_cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type(*this); }
+ inline typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type cast() const
+ { return typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type(*this); }
/** Copy constructor with scalar type conversion */
template<typename OtherScalarType>
@@ -149,7 +151,7 @@ public:
*
* \sa MatrixBase::isApprox() */
bool isApprox(const AngleAxis& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const
- { return m_axis.isApprox(other.m_axis, prec) && ei_isApprox(m_angle,other.m_angle, prec); }
+ { return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle,other.m_angle, prec); }
};
/** \ingroup Geometry_Module
@@ -159,8 +161,11 @@ typedef AngleAxis<float> AngleAxisf;
* double precision angle-axis type */
typedef AngleAxis<double> AngleAxisd;
-/** Set \c *this from a quaternion.
+/** Set \c *this from a \b unit quaternion.
* The axis is normalized.
+ *
+ * \warning As any other method dealing with quaternion, if the input quaternion
+ * is not normalized then the result is undefined.
*/
template<typename Scalar>
template<typename QuatDerived>
@@ -174,8 +179,8 @@ AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const QuaternionBase<QuatDerived
}
else
{
- m_angle = 2*std::acos(q.w());
- m_axis = q.vec() / ei_sqrt(n2);
+ m_angle = Scalar(2)*std::acos(std::min(std::max(Scalar(-1),q.w()),Scalar(1)));
+ m_axis = q.vec() / internal::sqrt(n2);
}
return *this;
}
@@ -208,8 +213,8 @@ typename AngleAxis<Scalar>::Matrix3
AngleAxis<Scalar>::toRotationMatrix(void) const
{
Matrix3 res;
- Vector3 sin_axis = ei_sin(m_angle) * m_axis;
- Scalar c = ei_cos(m_angle);
+ Vector3 sin_axis = internal::sin(m_angle) * m_axis;
+ Scalar c = internal::cos(m_angle);
Vector3 cos1_axis = (Scalar(1)-c) * m_axis;
Scalar tmp;
diff --git a/Eigen/src/Geometry/EulerAngles.h b/Eigen/src/Geometry/EulerAngles.h
index f2b3f129e..d246a6ebf 100644
--- a/Eigen/src/Geometry/EulerAngles.h
+++ b/Eigen/src/Geometry/EulerAngles.h
@@ -60,31 +60,31 @@ MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
if (a0==a2)
{
Scalar s = Vector2(coeff(j,i) , coeff(k,i)).norm();
- res[1] = ei_atan2(s, coeff(i,i));
+ res[1] = internal::atan2(s, coeff(i,i));
if (s > epsilon)
{
- res[0] = ei_atan2(coeff(j,i), coeff(k,i));
- res[2] = ei_atan2(coeff(i,j),-coeff(i,k));
+ res[0] = internal::atan2(coeff(j,i), coeff(k,i));
+ res[2] = internal::atan2(coeff(i,j),-coeff(i,k));
}
else
{
res[0] = Scalar(0);
- res[2] = (coeff(i,i)>0?1:-1)*ei_atan2(-coeff(k,j), coeff(j,j));
+ res[2] = (coeff(i,i)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j));
}
}
else
{
Scalar c = Vector2(coeff(i,i) , coeff(i,j)).norm();
- res[1] = ei_atan2(-coeff(i,k), c);
+ res[1] = internal::atan2(-coeff(i,k), c);
if (c > epsilon)
{
- res[0] = ei_atan2(coeff(j,k), coeff(k,k));
- res[2] = ei_atan2(coeff(i,j), coeff(i,i));
+ res[0] = internal::atan2(coeff(j,k), coeff(k,k));
+ res[2] = internal::atan2(coeff(i,j), coeff(i,i));
}
else
{
res[0] = Scalar(0);
- res[2] = (coeff(i,k)>0?1:-1)*ei_atan2(-coeff(k,j), coeff(j,j));
+ res[2] = (coeff(i,k)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j));
}
}
if (!odd)
diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h
index f05899dc8..5a1e0aa4a 100644
--- a/Eigen/src/Geometry/Homogeneous.h
+++ b/Eigen/src/Geometry/Homogeneous.h
@@ -39,13 +39,16 @@
*
* \sa MatrixBase::homogeneous()
*/
+
+namespace internal {
+
template<typename MatrixType,int Direction>
-struct ei_traits<Homogeneous<MatrixType,Direction> >
- : ei_traits<MatrixType>
+struct traits<Homogeneous<MatrixType,Direction> >
+ : traits<MatrixType>
{
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
- typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
- typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
+ typedef typename nested<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
enum {
RowsPlusOne = (MatrixType::RowsAtCompileTime != Dynamic) ?
int(MatrixType::RowsAtCompileTime) + 1 : Dynamic,
@@ -63,8 +66,10 @@ struct ei_traits<Homogeneous<MatrixType,Direction> >
};
};
-template<typename MatrixType,typename Lhs> struct ei_homogeneous_left_product_impl;
-template<typename MatrixType,typename Rhs> struct ei_homogeneous_right_product_impl;
+template<typename MatrixType,typename Lhs> struct homogeneous_left_product_impl;
+template<typename MatrixType,typename Rhs> struct homogeneous_right_product_impl;
+
+} // end namespace internal
template<typename MatrixType,int _Direction> class Homogeneous
: public MatrixBase<Homogeneous<MatrixType,_Direction> >
@@ -92,38 +97,38 @@ template<typename MatrixType,int _Direction> class Homogeneous
}
template<typename Rhs>
- inline const ei_homogeneous_right_product_impl<Homogeneous,Rhs>
+ inline const internal::homogeneous_right_product_impl<Homogeneous,Rhs>
operator* (const MatrixBase<Rhs>& rhs) const
{
- ei_assert(int(Direction)==Horizontal);
- return ei_homogeneous_right_product_impl<Homogeneous,Rhs>(m_matrix,rhs.derived());
+ eigen_assert(int(Direction)==Horizontal);
+ return internal::homogeneous_right_product_impl<Homogeneous,Rhs>(m_matrix,rhs.derived());
}
template<typename Lhs> friend
- inline const ei_homogeneous_left_product_impl<Homogeneous,Lhs>
+ inline const internal::homogeneous_left_product_impl<Homogeneous,Lhs>
operator* (const MatrixBase<Lhs>& lhs, const Homogeneous& rhs)
{
- ei_assert(int(Direction)==Vertical);
- return ei_homogeneous_left_product_impl<Homogeneous,Lhs>(lhs.derived(),rhs.m_matrix);
+ eigen_assert(int(Direction)==Vertical);
+ return internal::homogeneous_left_product_impl<Homogeneous,Lhs>(lhs.derived(),rhs.m_matrix);
}
template<typename Scalar, int Dim, int Mode> friend
- inline const ei_homogeneous_left_product_impl<Homogeneous,
+ inline const internal::homogeneous_left_product_impl<Homogeneous,
typename Transform<Scalar,Dim,Mode>::AffinePartNested>
operator* (const Transform<Scalar,Dim,Mode>& tr, const Homogeneous& rhs)
{
- ei_assert(int(Direction)==Vertical);
- return ei_homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Mode>::AffinePartNested >
+ eigen_assert(int(Direction)==Vertical);
+ return internal::homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Mode>::AffinePartNested >
(tr.affine(),rhs.m_matrix);
}
template<typename Scalar, int Dim> friend
- inline const ei_homogeneous_left_product_impl<Homogeneous,
+ inline const internal::homogeneous_left_product_impl<Homogeneous,
typename Transform<Scalar,Dim,Projective>::MatrixType>
operator* (const Transform<Scalar,Dim,Projective>& tr, const Homogeneous& rhs)
{
- ei_assert(int(Direction)==Vertical);
- return ei_homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Projective>::MatrixType>
+ eigen_assert(int(Direction)==Vertical);
+ return internal::homogeneous_left_product_impl<Homogeneous,typename Transform<Scalar,Dim,Projective>::MatrixType>
(tr.matrix(),rhs.m_matrix);
}
@@ -210,11 +215,13 @@ VectorwiseOp<ExpressionType,Direction>::hnormalized() const
Direction==Horizontal ? _expression().cols()-1 : 1));
}
+namespace internal {
+
template<typename MatrixType,typename Lhs>
-struct ei_traits<ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
+struct traits<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
{
- typedef typename ei_make_proper_matrix_type<
- typename ei_traits<MatrixType>::Scalar,
+ typedef typename make_proper_matrix_type<
+ typename traits<MatrixType>::Scalar,
Lhs::RowsAtCompileTime,
MatrixType::ColsAtCompileTime,
MatrixType::PlainObject::Options,
@@ -223,12 +230,12 @@ struct ei_traits<ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertica
};
template<typename MatrixType,typename Lhs>
-struct ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
- : public ReturnByValue<ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
+struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
+ : public ReturnByValue<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
{
- typedef typename ei_cleantype<typename Lhs::Nested>::type LhsNested;
+ typedef typename remove_all<typename Lhs::Nested>::type LhsNested;
typedef typename MatrixType::Index Index;
- ei_homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs)
+ homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs)
: m_lhs(lhs), m_rhs(rhs)
{}
@@ -251,9 +258,9 @@ struct ei_homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
};
template<typename MatrixType,typename Rhs>
-struct ei_traits<ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
+struct traits<homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
{
- typedef typename ei_make_proper_matrix_type<typename ei_traits<MatrixType>::Scalar,
+ typedef typename make_proper_matrix_type<typename traits<MatrixType>::Scalar,
MatrixType::RowsAtCompileTime,
Rhs::ColsAtCompileTime,
MatrixType::PlainObject::Options,
@@ -262,12 +269,12 @@ struct ei_traits<ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizo
};
template<typename MatrixType,typename Rhs>
-struct ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
- : public ReturnByValue<ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
+struct homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
+ : public ReturnByValue<homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
{
- typedef typename ei_cleantype<typename Rhs::Nested>::type RhsNested;
+ typedef typename remove_all<typename Rhs::Nested>::type RhsNested;
typedef typename MatrixType::Index Index;
- ei_homogeneous_right_product_impl(const MatrixType& lhs, const Rhs& rhs)
+ homogeneous_right_product_impl(const MatrixType& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{}
@@ -289,4 +296,6 @@ struct ei_homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
const typename Rhs::Nested m_rhs;
};
+} // end namespace internal
+
#endif // EIGEN_HOMOGENEOUS_H
diff --git a/Eigen/src/Geometry/Hyperplane.h b/Eigen/src/Geometry/Hyperplane.h
index 7b7d33a92..852aef185 100644
--- a/Eigen/src/Geometry/Hyperplane.h
+++ b/Eigen/src/Geometry/Hyperplane.h
@@ -139,7 +139,7 @@ public:
/** \returns the absolute distance between the plane \c *this and a point \a p.
* \sa signedDistance()
*/
- inline Scalar absDistance(const VectorType& p) const { return ei_abs(signedDistance(p)); }
+ inline Scalar absDistance(const VectorType& p) const { return internal::abs(signedDistance(p)); }
/** \returns the projection of a point \a p onto the plane \c *this.
*/
@@ -186,9 +186,9 @@ public:
Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0);
// since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests
// whether the two lines are approximately parallel.
- if(ei_isMuchSmallerThan(det, Scalar(1)))
+ if(internal::isMuchSmallerThan(det, Scalar(1)))
{ // special case where the two lines are approximately parallel. Pick any point on the first line.
- if(ei_abs(coeffs().coeff(1))>ei_abs(coeffs().coeff(0)))
+ if(internal::abs(coeffs().coeff(1))>internal::abs(coeffs().coeff(0)))
return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0));
else
return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0));
@@ -216,7 +216,7 @@ public:
normal() = mat * normal();
else
{
- ei_assert("invalid traits value in Hyperplane::transform()");
+ eigen_assert("invalid traits value in Hyperplane::transform()");
}
return *this;
}
@@ -242,10 +242,10 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<Hyperplane,
+ inline typename internal::cast_return_type<Hyperplane,
Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
{
- return typename ei_cast_return_type<Hyperplane,
+ return typename internal::cast_return_type<Hyperplane,
Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
}
diff --git a/Eigen/src/Geometry/OrthoMethods.h b/Eigen/src/Geometry/OrthoMethods.h
index d03d85beb..64ca52e16 100644
--- a/Eigen/src/Geometry/OrthoMethods.h
+++ b/Eigen/src/Geometry/OrthoMethods.h
@@ -43,23 +43,25 @@ MatrixBase<Derived>::cross(const MatrixBase<OtherDerived>& other) const
// Note that there is no need for an expression here since the compiler
// optimize such a small temporary very well (even within a complex expression)
- const typename ei_nested<Derived,2>::type lhs(derived());
- const typename ei_nested<OtherDerived,2>::type rhs(other.derived());
- return typename ei_plain_matrix_type<Derived>::type(
+ const typename internal::nested<Derived,2>::type lhs(derived());
+ const typename internal::nested<OtherDerived,2>::type rhs(other.derived());
+ return typename internal::plain_matrix_type<Derived>::type(
lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1),
lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2),
lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0)
);
}
+namespace internal {
+
template< int Arch,typename VectorLhs,typename VectorRhs,
typename Scalar = typename VectorLhs::Scalar,
bool Vectorizable = (VectorLhs::Flags&VectorRhs::Flags)&PacketAccessBit>
-struct ei_cross3_impl {
- inline static typename ei_plain_matrix_type<VectorLhs>::type
+struct cross3_impl {
+ inline static typename internal::plain_matrix_type<VectorLhs>::type
run(const VectorLhs& lhs, const VectorRhs& rhs)
{
- return typename ei_plain_matrix_type<VectorLhs>::type(
+ return typename internal::plain_matrix_type<VectorLhs>::type(
lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1),
lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2),
lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0),
@@ -68,6 +70,8 @@ struct ei_cross3_impl {
}
};
+}
+
/** \geometry_module
*
* \returns the cross product of \c *this and \a other using only the x, y, and z coefficients
@@ -85,14 +89,14 @@ MatrixBase<Derived>::cross3(const MatrixBase<OtherDerived>& other) const
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,4)
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,4)
- typedef typename ei_nested<Derived,2>::type DerivedNested;
- typedef typename ei_nested<OtherDerived,2>::type OtherDerivedNested;
+ typedef typename internal::nested<Derived,2>::type DerivedNested;
+ typedef typename internal::nested<OtherDerived,2>::type OtherDerivedNested;
const DerivedNested lhs(derived());
const OtherDerivedNested rhs(other.derived());
- return ei_cross3_impl<Architecture::Target,
- typename ei_cleantype<DerivedNested>::type,
- typename ei_cleantype<OtherDerivedNested>::type>::run(lhs,rhs);
+ return internal::cross3_impl<Architecture::Target,
+ typename internal::remove_all<DerivedNested>::type,
+ typename internal::remove_all<OtherDerivedNested>::type>::run(lhs,rhs);
}
/** \returns a matrix expression of the cross product of each column or row
@@ -110,20 +114,20 @@ const typename VectorwiseOp<ExpressionType,Direction>::CrossReturnType
VectorwiseOp<ExpressionType,Direction>::cross(const MatrixBase<OtherDerived>& other) const
{
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3)
- EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename OtherDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
CrossReturnType res(_expression().rows(),_expression().cols());
if(Direction==Vertical)
{
- ei_assert(CrossReturnType::RowsAtCompileTime==3 && "the matrix must have exactly 3 rows");
+ eigen_assert(CrossReturnType::RowsAtCompileTime==3 && "the matrix must have exactly 3 rows");
res.row(0) = _expression().row(1) * other.coeff(2) - _expression().row(2) * other.coeff(1);
res.row(1) = _expression().row(2) * other.coeff(0) - _expression().row(0) * other.coeff(2);
res.row(2) = _expression().row(0) * other.coeff(1) - _expression().row(1) * other.coeff(0);
}
else
{
- ei_assert(CrossReturnType::ColsAtCompileTime==3 && "the matrix must have exactly 3 columns");
+ eigen_assert(CrossReturnType::ColsAtCompileTime==3 && "the matrix must have exactly 3 columns");
res.col(0) = _expression().col(1) * other.coeff(2) - _expression().col(2) * other.coeff(1);
res.col(1) = _expression().col(2) * other.coeff(0) - _expression().col(0) * other.coeff(2);
res.col(2) = _expression().col(0) * other.coeff(1) - _expression().col(1) * other.coeff(0);
@@ -131,11 +135,13 @@ VectorwiseOp<ExpressionType,Direction>::cross(const MatrixBase<OtherDerived>& ot
return res;
}
+namespace internal {
+
template<typename Derived, int Size = Derived::SizeAtCompileTime>
-struct ei_unitOrthogonal_selector
+struct unitOrthogonal_selector
{
- typedef typename ei_plain_matrix_type<Derived>::type VectorType;
- typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename plain_matrix_type<Derived>::type VectorType;
+ typedef typename traits<Derived>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef typename Derived::Index Index;
typedef Matrix<Scalar,2,1> Vector2;
@@ -148,18 +154,18 @@ struct ei_unitOrthogonal_selector
if (maxi==0)
sndi = 1;
RealScalar invnm = RealScalar(1)/(Vector2() << src.coeff(sndi),src.coeff(maxi)).finished().norm();
- perp.coeffRef(maxi) = -ei_conj(src.coeff(sndi)) * invnm;
- perp.coeffRef(sndi) = ei_conj(src.coeff(maxi)) * invnm;
+ perp.coeffRef(maxi) = -conj(src.coeff(sndi)) * invnm;
+ perp.coeffRef(sndi) = conj(src.coeff(maxi)) * invnm;
return perp;
}
};
template<typename Derived>
-struct ei_unitOrthogonal_selector<Derived,3>
+struct unitOrthogonal_selector<Derived,3>
{
- typedef typename ei_plain_matrix_type<Derived>::type VectorType;
- typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename plain_matrix_type<Derived>::type VectorType;
+ typedef typename traits<Derived>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
inline static VectorType run(const Derived& src)
{
@@ -171,12 +177,12 @@ struct ei_unitOrthogonal_selector<Derived,3>
/* unless the x and y coords are both close to zero, we can
* simply take ( -y, x, 0 ) and normalize it.
*/
- if((!ei_isMuchSmallerThan(src.x(), src.z()))
- || (!ei_isMuchSmallerThan(src.y(), src.z())))
+ if((!isMuchSmallerThan(src.x(), src.z()))
+ || (!isMuchSmallerThan(src.y(), src.z())))
{
RealScalar invnm = RealScalar(1)/src.template head<2>().norm();
- perp.coeffRef(0) = -ei_conj(src.y())*invnm;
- perp.coeffRef(1) = ei_conj(src.x())*invnm;
+ perp.coeffRef(0) = -conj(src.y())*invnm;
+ perp.coeffRef(1) = conj(src.x())*invnm;
perp.coeffRef(2) = 0;
}
/* if both x and y are close to zero, then the vector is close
@@ -187,8 +193,8 @@ struct ei_unitOrthogonal_selector<Derived,3>
{
RealScalar invnm = RealScalar(1)/src.template tail<2>().norm();
perp.coeffRef(0) = 0;
- perp.coeffRef(1) = -ei_conj(src.z())*invnm;
- perp.coeffRef(2) = ei_conj(src.y())*invnm;
+ perp.coeffRef(1) = -conj(src.z())*invnm;
+ perp.coeffRef(2) = conj(src.y())*invnm;
}
return perp;
@@ -196,13 +202,15 @@ struct ei_unitOrthogonal_selector<Derived,3>
};
template<typename Derived>
-struct ei_unitOrthogonal_selector<Derived,2>
+struct unitOrthogonal_selector<Derived,2>
{
- typedef typename ei_plain_matrix_type<Derived>::type VectorType;
+ typedef typename plain_matrix_type<Derived>::type VectorType;
inline static VectorType run(const Derived& src)
- { return VectorType(-ei_conj(src.y()), ei_conj(src.x())).normalized(); }
+ { return VectorType(-conj(src.y()), conj(src.x())).normalized(); }
};
+} // end namespace internal
+
/** \returns a unit vector which is orthogonal to \c *this
*
* The size of \c *this must be at least 2. If the size is exactly 2,
@@ -215,7 +223,7 @@ typename MatrixBase<Derived>::PlainObject
MatrixBase<Derived>::unitOrthogonal() const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
- return ei_unitOrthogonal_selector<Derived>::run(derived());
+ return internal::unitOrthogonal_selector<Derived>::run(derived());
}
#endif // EIGEN_ORTHOMETHODS_H
diff --git a/Eigen/src/Geometry/ParametrizedLine.h b/Eigen/src/Geometry/ParametrizedLine.h
index 3de23f53b..858cdf6a8 100644
--- a/Eigen/src/Geometry/ParametrizedLine.h
+++ b/Eigen/src/Geometry/ParametrizedLine.h
@@ -91,7 +91,7 @@ public:
/** \returns the distance of a point \a p to its projection onto the line \c *this.
* \sa squaredDistance()
*/
- RealScalar distance(const VectorType& p) const { return ei_sqrt(squaredDistance(p)); }
+ RealScalar distance(const VectorType& p) const { return internal::sqrt(squaredDistance(p)); }
/** \returns the projection of a point \a p onto the line \c *this. */
VectorType projection(const VectorType& p) const
@@ -105,10 +105,10 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<ParametrizedLine,
+ inline typename internal::cast_return_type<ParametrizedLine,
ParametrizedLine<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
{
- return typename ei_cast_return_type<ParametrizedLine,
+ return typename internal::cast_return_type<ParametrizedLine,
ParametrizedLine<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
}
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h
index c0845653d..afbeef26c 100644
--- a/Eigen/src/Geometry/Quaternion.h
+++ b/Eigen/src/Geometry/Quaternion.h
@@ -31,10 +31,12 @@
* The implementation is at the end of the file
***************************************************************************/
+namespace internal {
template<typename Other,
int OtherRows=Other::RowsAtCompileTime,
int OtherCols=Other::ColsAtCompileTime>
-struct ei_quaternionbase_assign_impl;
+struct quaternionbase_assign_impl;
+}
template<class Derived>
class QuaternionBase : public RotationBase<Derived, 3>
@@ -44,9 +46,9 @@ public:
using Base::operator*;
using Base::derived;
- typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
- typedef typename ei_traits<Derived>::Coefficients Coefficients;
+ typedef typename internal::traits<Derived>::Coefficients Coefficients;
// typedef typename Matrix<Scalar,4,1> Coefficients;
/** the type of a 3D vector */
@@ -83,10 +85,10 @@ public:
inline VectorBlock<Coefficients,3> vec() { return coeffs().template head<3>(); }
/** \returns a read-only vector expression of the coefficients (x,y,z,w) */
- inline const typename ei_traits<Derived>::Coefficients& coeffs() const { return derived().coeffs(); }
+ inline const typename internal::traits<Derived>::Coefficients& coeffs() const { return derived().coeffs(); }
/** \returns a vector expression of the coefficients (x,y,z,w) */
- inline typename ei_traits<Derived>::Coefficients& coeffs() { return derived().coeffs(); }
+ inline typename internal::traits<Derived>::Coefficients& coeffs() { return derived().coeffs(); }
EIGEN_STRONG_INLINE QuaternionBase<Derived>& operator=(const QuaternionBase<Derived>& other);
template<class OtherDerived> EIGEN_STRONG_INLINE Derived& operator=(const QuaternionBase<OtherDerived>& other);
@@ -175,9 +177,9 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const
+ inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const
{
- return typename ei_cast_return_type<Derived,Quaternion<NewScalarType> >::type(
+ return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(
coeffs().template cast<NewScalarType>());
}
@@ -212,8 +214,9 @@ public:
* \sa class AngleAxis, class Transform
*/
+namespace internal {
template<typename _Scalar>
-struct ei_traits<Quaternion<_Scalar> >
+struct traits<Quaternion<_Scalar> >
{
typedef Quaternion<_Scalar> PlainObject;
typedef _Scalar Scalar;
@@ -222,6 +225,7 @@ struct ei_traits<Quaternion<_Scalar> >
PacketAccess = Aligned
};
};
+}
template<typename _Scalar>
class Quaternion : public QuaternionBase<Quaternion<_Scalar> >{
@@ -232,7 +236,7 @@ public:
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion<Scalar>)
using Base::operator*=;
- typedef typename ei_traits<Quaternion<Scalar> >::Coefficients Coefficients;
+ typedef typename internal::traits<Quaternion<Scalar> >::Coefficients Coefficients;
typedef typename Base::AngleAxisType AngleAxisType;
/** Default constructor leaving the quaternion uninitialized. */
@@ -281,9 +285,10 @@ typedef Quaternion<double> Quaterniond;
* Specialization of Map<Quaternion<Scalar>>
***************************************************************************/
+namespace internal {
template<typename _Scalar, int _PacketAccess>
-struct ei_traits<Map<Quaternion<_Scalar>, _PacketAccess> >:
-ei_traits<Quaternion<_Scalar> >
+struct traits<Map<Quaternion<_Scalar>, _PacketAccess> >:
+traits<Quaternion<_Scalar> >
{
typedef _Scalar Scalar;
typedef Map<Matrix<_Scalar,4,1>, _PacketAccess> Coefficients;
@@ -291,6 +296,7 @@ ei_traits<Quaternion<_Scalar> >
PacketAccess = _PacketAccess
};
};
+}
/** \brief Expression of a quaternion from a memory buffer
*
@@ -310,7 +316,7 @@ class Map<Quaternion<_Scalar>, PacketAccess >
public:
typedef _Scalar Scalar;
- typedef typename ei_traits<Map>::Coefficients Coefficients;
+ typedef typename internal::traits<Map>::Coefficients Coefficients;
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
using Base::operator*=;
@@ -348,7 +354,8 @@ typedef Map<Quaternion<double>, Aligned> QuaternionMapAlignedd;
// Generic Quaternion * Quaternion product
// This product can be specialized for a given architecture via the Arch template argument.
-template<int Arch, class Derived1, class Derived2, typename Scalar, int PacketAccess> struct ei_quat_product
+namespace internal {
+template<int Arch, class Derived1, class Derived2, typename Scalar, int PacketAccess> struct quat_product
{
EIGEN_STRONG_INLINE static Quaternion<Scalar> run(const QuaternionBase<Derived1>& a, const QuaternionBase<Derived2>& b){
return Quaternion<Scalar>
@@ -360,18 +367,19 @@ template<int Arch, class Derived1, class Derived2, typename Scalar, int PacketAc
);
}
};
+}
/** \returns the concatenation of two rotations as a quaternion-quaternion product */
template <class Derived>
template <class OtherDerived>
-EIGEN_STRONG_INLINE Quaternion<typename ei_traits<Derived>::Scalar>
+EIGEN_STRONG_INLINE Quaternion<typename internal::traits<Derived>::Scalar>
QuaternionBase<Derived>::operator* (const QuaternionBase<OtherDerived>& other) const
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<typename Derived::Scalar, typename OtherDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- return ei_quat_product<Architecture::Target, Derived, OtherDerived,
- typename ei_traits<Derived>::Scalar,
- ei_traits<Derived>::PacketAccess && ei_traits<OtherDerived>::PacketAccess>::run(*this, other);
+ return internal::quat_product<Architecture::Target, Derived, OtherDerived,
+ typename internal::traits<Derived>::Scalar,
+ internal::traits<Derived>::PacketAccess && internal::traits<OtherDerived>::PacketAccess>::run(*this, other);
}
/** \sa operator*(Quaternion) */
@@ -425,8 +433,8 @@ template<class Derived>
EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator=(const AngleAxisType& aa)
{
Scalar ha = Scalar(0.5)*aa.angle(); // Scalar(0.5) to suppress precision loss warnings
- this->w() = ei_cos(ha);
- this->vec() = ei_sin(ha) * aa.axis();
+ this->w() = internal::cos(ha);
+ this->vec() = internal::sin(ha) * aa.axis();
return derived();
}
@@ -440,9 +448,9 @@ template<class Derived>
template<class MatrixDerived>
inline Derived& QuaternionBase<Derived>::operator=(const MatrixBase<MatrixDerived>& xpr)
{
- EIGEN_STATIC_ASSERT((ei_is_same_type<typename Derived::Scalar, typename MatrixDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Derived::Scalar, typename MatrixDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- ei_quaternionbase_assign_impl<MatrixDerived>::run(*this, xpr.derived());
+ internal::quaternionbase_assign_impl<MatrixDerived>::run(*this, xpr.derived());
return derived();
}
@@ -519,12 +527,12 @@ inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Deri
Vector3 axis = svd.matrixV().col(2);
Scalar w2 = (Scalar(1)+c)*Scalar(0.5);
- this->w() = ei_sqrt(w2);
- this->vec() = axis * ei_sqrt(Scalar(1) - w2);
+ this->w() = internal::sqrt(w2);
+ this->vec() = axis * internal::sqrt(Scalar(1) - w2);
return derived();
}
Vector3 axis = v0.cross(v1);
- Scalar s = ei_sqrt((Scalar(1)+c)*Scalar(2));
+ Scalar s = internal::sqrt((Scalar(1)+c)*Scalar(2));
Scalar invs = Scalar(1)/s;
this->vec() = axis * invs;
this->w() = s * Scalar(0.5);
@@ -539,7 +547,7 @@ inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Deri
* \sa QuaternionBase::conjugate()
*/
template <class Derived>
-inline Quaternion<typename ei_traits<Derived>::Scalar> QuaternionBase<Derived>::inverse() const
+inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::inverse() const
{
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
Scalar n2 = this->squaredNorm();
@@ -559,7 +567,7 @@ inline Quaternion<typename ei_traits<Derived>::Scalar> QuaternionBase<Derived>::
* \sa Quaternion2::inverse()
*/
template <class Derived>
-inline Quaternion<typename ei_traits<Derived>::Scalar>
+inline Quaternion<typename internal::traits<Derived>::Scalar>
QuaternionBase<Derived>::conjugate() const
{
return Quaternion<Scalar>(this->w(),-this->x(),-this->y(),-this->z());
@@ -570,10 +578,10 @@ QuaternionBase<Derived>::conjugate() const
*/
template <class Derived>
template <class OtherDerived>
-inline typename ei_traits<Derived>::Scalar
+inline typename internal::traits<Derived>::Scalar
QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& other) const
{
- double d = ei_abs(this->dot(other));
+ double d = internal::abs(this->dot(other));
if (d>=1.0)
return Scalar(0);
return static_cast<Scalar>(2 * std::acos(d));
@@ -584,12 +592,12 @@ QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& oth
*/
template <class Derived>
template <class OtherDerived>
-Quaternion<typename ei_traits<Derived>::Scalar>
+Quaternion<typename internal::traits<Derived>::Scalar>
QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const
{
static const Scalar one = Scalar(1) - NumTraits<Scalar>::epsilon();
Scalar d = this->dot(other);
- Scalar absD = ei_abs(d);
+ Scalar absD = internal::abs(d);
Scalar scale0;
Scalar scale1;
@@ -603,10 +611,10 @@ QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& oth
{
// theta is the angle between the 2 quaternions
Scalar theta = std::acos(absD);
- Scalar sinTheta = ei_sin(theta);
+ Scalar sinTheta = internal::sin(theta);
- scale0 = ei_sin( ( Scalar(1) - t ) * theta) / sinTheta;
- scale1 = ei_sin( ( t * theta) ) / sinTheta;
+ scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;
+ scale1 = internal::sin( ( t * theta) ) / sinTheta;
if (d<0)
scale1 = -scale1;
}
@@ -614,9 +622,11 @@ QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& oth
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
}
+namespace internal {
+
// set from a rotation matrix
template<typename Other>
-struct ei_quaternionbase_assign_impl<Other,3,3>
+struct quaternionbase_assign_impl<Other,3,3>
{
typedef typename Other::Scalar Scalar;
typedef DenseIndex Index;
@@ -627,7 +637,7 @@ struct ei_quaternionbase_assign_impl<Other,3,3>
Scalar t = mat.trace();
if (t > Scalar(0))
{
- t = ei_sqrt(t + Scalar(1.0));
+ t = sqrt(t + Scalar(1.0));
q.w() = Scalar(0.5)*t;
t = Scalar(0.5)/t;
q.x() = (mat.coeff(2,1) - mat.coeff(1,2)) * t;
@@ -644,7 +654,7 @@ struct ei_quaternionbase_assign_impl<Other,3,3>
DenseIndex j = (i+1)%3;
DenseIndex k = (j+1)%3;
- t = ei_sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
+ t = sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
q.coeffs().coeffRef(i) = Scalar(0.5) * t;
t = Scalar(0.5)/t;
q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t;
@@ -656,7 +666,7 @@ struct ei_quaternionbase_assign_impl<Other,3,3>
// set from a vector of coefficients assumed to be a quaternion
template<typename Other>
-struct ei_quaternionbase_assign_impl<Other,4,1>
+struct quaternionbase_assign_impl<Other,4,1>
{
typedef typename Other::Scalar Scalar;
template<class Derived> inline static void run(QuaternionBase<Derived>& q, const Other& vec)
@@ -665,5 +675,6 @@ struct ei_quaternionbase_assign_impl<Other,4,1>
}
};
+} // end namespace internal
#endif // EIGEN_QUATERNION_H
diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h
index c65b4b6e0..e1214bd3e 100644
--- a/Eigen/src/Geometry/Rotation2D.h
+++ b/Eigen/src/Geometry/Rotation2D.h
@@ -41,10 +41,14 @@
*
* \sa class Quaternion, class Transform
*/
-template<typename _Scalar> struct ei_traits<Rotation2D<_Scalar> >
+
+namespace internal {
+
+template<typename _Scalar> struct traits<Rotation2D<_Scalar> >
{
typedef _Scalar Scalar;
};
+} // end namespace internal
template<typename _Scalar>
class Rotation2D : public RotationBase<Rotation2D<_Scalar>,2>
@@ -107,8 +111,8 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type cast() const
- { return typename ei_cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*this); }
+ inline typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type cast() const
+ { return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*this); }
/** Copy constructor with scalar type conversion */
template<typename OtherScalarType>
@@ -124,7 +128,7 @@ public:
*
* \sa MatrixBase::isApprox() */
bool isApprox(const Rotation2D& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const
- { return ei_isApprox(m_angle,other.m_angle, prec); }
+ { return internal::isApprox(m_angle,other.m_angle, prec); }
};
/** \ingroup Geometry_Module
@@ -143,7 +147,7 @@ template<typename Derived>
Rotation2D<Scalar>& Rotation2D<Scalar>::fromRotationMatrix(const MatrixBase<Derived>& mat)
{
EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
- m_angle = ei_atan2(mat.coeff(1,0), mat.coeff(0,0));
+ m_angle = internal::atan2(mat.coeff(1,0), mat.coeff(0,0));
return *this;
}
@@ -153,8 +157,8 @@ template<typename Scalar>
typename Rotation2D<Scalar>::Matrix2
Rotation2D<Scalar>::toRotationMatrix(void) const
{
- Scalar sinA = ei_sin(m_angle);
- Scalar cosA = ei_cos(m_angle);
+ Scalar sinA = internal::sin(m_angle);
+ Scalar cosA = internal::cos(m_angle);
return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
}
diff --git a/Eigen/src/Geometry/RotationBase.h b/Eigen/src/Geometry/RotationBase.h
index 181e65be9..65b9cd834 100644
--- a/Eigen/src/Geometry/RotationBase.h
+++ b/Eigen/src/Geometry/RotationBase.h
@@ -26,8 +26,10 @@
#define EIGEN_ROTATIONBASE_H
// forward declaration
+namespace internal {
template<typename RotationDerived, typename MatrixType, bool IsVector=MatrixType::IsVectorAtCompileTime>
-struct ei_rotation_base_generic_product_selector;
+struct rotation_base_generic_product_selector;
+}
/** \class RotationBase
*
@@ -42,7 +44,7 @@ class RotationBase
public:
enum { Dim = _Dim };
/** the scalar type of the coefficients */
- typedef typename ei_traits<Derived>::Scalar Scalar;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
/** corresponding linear transformation matrix type */
typedef Matrix<Scalar,Dim,Dim> RotationMatrixType;
@@ -78,9 +80,9 @@ class RotationBase
* - a vector of size Dim
*/
template<typename OtherDerived>
- EIGEN_STRONG_INLINE typename ei_rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType
+ EIGEN_STRONG_INLINE typename internal::rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType
operator*(const EigenBase<OtherDerived>& e) const
- { return ei_rotation_base_generic_product_selector<Derived,OtherDerived>::run(derived(), e.derived()); }
+ { return internal::rotation_base_generic_product_selector<Derived,OtherDerived>::run(derived(), e.derived()); }
/** \returns the concatenation of a linear transformation \a l with the rotation \a r */
template<typename OtherDerived> friend
@@ -105,9 +107,11 @@ class RotationBase
{ return toRotationMatrix() * v; }
};
+namespace internal {
+
// implementation of the generic product rotation * matrix
template<typename RotationDerived, typename MatrixType>
-struct ei_rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
+struct rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
{
enum { Dim = RotationDerived::Dim };
typedef Matrix<typename RotationDerived::Scalar,Dim,Dim> ReturnType;
@@ -116,7 +120,7 @@ struct ei_rotation_base_generic_product_selector<RotationDerived,MatrixType,fals
};
template<typename RotationDerived, typename Scalar, int Dim, int MaxDim>
-struct ei_rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
+struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
{
typedef Transform<Scalar,Dim,Affine> ReturnType;
inline static ReturnType run(const RotationDerived& r, const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
@@ -128,7 +132,7 @@ struct ei_rotation_base_generic_product_selector< RotationDerived, DiagonalMatri
};
template<typename RotationDerived,typename OtherVectorType>
-struct ei_rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
+struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
{
enum { Dim = RotationDerived::Dim };
typedef Matrix<typename RotationDerived::Scalar,Dim,1> ReturnType;
@@ -138,6 +142,8 @@ struct ei_rotation_base_generic_product_selector<RotationDerived,OtherVectorType
}
};
+} // end namespace internal
+
/** \geometry_module
*
* \brief Constructs a Dim x Dim rotation matrix from the rotation \a r
@@ -165,6 +171,8 @@ Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
return *this = r.toRotationMatrix();
}
+namespace internal {
+
/** \internal
*
* Helper function to return an arbitrary rotation object to a rotation matrix.
@@ -179,29 +187,31 @@ Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
* - any matrix expression,
* - any type based on RotationBase (e.g., Quaternion, AngleAxis, Rotation2D)
*
- * Currently ei_toRotationMatrix is only used by Transform.
+ * Currently toRotationMatrix is only used by Transform.
*
* \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis
*/
template<typename Scalar, int Dim>
-inline static Matrix<Scalar,2,2> ei_toRotationMatrix(const Scalar& s)
+inline static Matrix<Scalar,2,2> toRotationMatrix(const Scalar& s)
{
EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
return Rotation2D<Scalar>(s).toRotationMatrix();
}
template<typename Scalar, int Dim, typename OtherDerived>
-inline static Matrix<Scalar,Dim,Dim> ei_toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
+inline static Matrix<Scalar,Dim,Dim> toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
{
return r.toRotationMatrix();
}
template<typename Scalar, int Dim, typename OtherDerived>
-inline static const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBase<OtherDerived>& mat)
+inline static const MatrixBase<OtherDerived>& toRotationMatrix(const MatrixBase<OtherDerived>& mat)
{
EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
YOU_MADE_A_PROGRAMMING_MISTAKE)
return mat;
}
+} // end namespace internal
+
#endif // EIGEN_ROTATIONBASE_H
diff --git a/Eigen/src/Geometry/Scaling.h b/Eigen/src/Geometry/Scaling.h
index 8fdbdb102..2d2871d19 100644
--- a/Eigen/src/Geometry/Scaling.h
+++ b/Eigen/src/Geometry/Scaling.h
@@ -78,7 +78,7 @@ public:
/** Concatenates a uniform scaling and a linear transformation matrix */
// TODO returns an expression
template<typename Derived>
- inline typename ei_plain_matrix_type<Derived>::type operator* (const MatrixBase<Derived>& other) const
+ inline typename internal::plain_matrix_type<Derived>::type operator* (const MatrixBase<Derived>& other) const
{ return other * m_factor; }
template<typename Derived,int Dim>
@@ -108,7 +108,7 @@ public:
*
* \sa MatrixBase::isApprox() */
bool isApprox(const UniformScaling& other, typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision()) const
- { return ei_isApprox(m_factor, other.factor(), prec); }
+ { return internal::isApprox(m_factor, other.factor(), prec); }
};
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h
index 58bb2d0c0..dfcb4a3f7 100644
--- a/Eigen/src/Geometry/Transform.h
+++ b/Eigen/src/Geometry/Transform.h
@@ -27,8 +27,10 @@
#ifndef EIGEN_TRANSFORM_H
#define EIGEN_TRANSFORM_H
+namespace internal {
+
template<typename Transform>
-struct ei_transform_traits
+struct transform_traits
{
enum
{
@@ -41,8 +43,8 @@ struct ei_transform_traits
template< typename TransformType,
typename MatrixType,
- bool IsProjective = ei_transform_traits<TransformType>::IsProjective>
-struct ei_transform_right_product_impl;
+ bool IsProjective = transform_traits<TransformType>::IsProjective>
+struct transform_right_product_impl;
template< typename Other,
int Mode,
@@ -50,14 +52,14 @@ template< typename Other,
int HDim,
int OtherRows=Other::RowsAtCompileTime,
int OtherCols=Other::ColsAtCompileTime>
-struct ei_transform_left_product_impl;
+struct transform_left_product_impl;
template< typename Lhs,
typename Rhs,
bool AnyProjective =
- ei_transform_traits<Lhs>::IsProjective ||
- ei_transform_traits<Lhs>::IsProjective>
-struct ei_transform_transform_product_impl;
+ transform_traits<Lhs>::IsProjective ||
+ transform_traits<Lhs>::IsProjective>
+struct transform_transform_product_impl;
template< typename Other,
int Mode,
@@ -65,9 +67,11 @@ template< typename Other,
int HDim,
int OtherRows=Other::RowsAtCompileTime,
int OtherCols=Other::ColsAtCompileTime>
-struct ei_transform_construct_from_matrix;
+struct transform_construct_from_matrix;
+
+template<typename TransformType> struct transform_take_affine_part;
-template<typename TransformType> struct ei_transform_take_affine_part;
+} // end namespace internal
/** \geometry_module \ingroup Geometry_Module
*
@@ -194,13 +198,13 @@ public:
/** type of read/write reference to the linear part of the transformation */
typedef Block<MatrixType,Dim,Dim> LinearPart;
/** type of read/write reference to the affine part of the transformation */
- typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
+ typedef typename internal::conditional<int(Mode)==int(AffineCompact),
MatrixType&,
- Block<MatrixType,Dim,HDim> >::ret AffinePart;
+ Block<MatrixType,Dim,HDim> >::type AffinePart;
/** type of read/write reference to the affine part of the transformation */
- typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
+ typedef typename internal::conditional<int(Mode)==int(AffineCompact),
MatrixType&,
- Block<MatrixType,Dim,HDim> >::ret AffinePartNested;
+ Block<MatrixType,Dim,HDim> >::type AffinePartNested;
/** type of a vector */
typedef Matrix<Scalar,Dim,1> VectorType;
/** type of a read/write reference to the translation part of the rotation */
@@ -235,20 +239,20 @@ public:
inline Transform& operator=(const Transform& other)
{ m_matrix = other.m_matrix; return *this; }
- typedef ei_transform_take_affine_part<Transform> take_affine_part;
+ typedef internal::transform_take_affine_part<Transform> take_affine_part;
/** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
template<typename OtherDerived>
inline explicit Transform(const EigenBase<OtherDerived>& other)
{
- ei_transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
+ internal::transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
}
/** Set \c *this from a Dim^2 or (Dim+1)^2 matrix. */
template<typename OtherDerived>
inline Transform& operator=(const EigenBase<OtherDerived>& other)
{
- ei_transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
+ internal::transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
return *this;
}
@@ -280,7 +284,7 @@ public:
else if(OtherModeIsAffineCompact)
{
typedef typename Transform<Scalar,Dim,OtherMode>::MatrixType OtherMatrixType;
- ei_transform_construct_from_matrix<OtherMatrixType,Mode,Dim,HDim>::run(this, other.matrix());
+ internal::transform_construct_from_matrix<OtherMatrixType,Mode,Dim,HDim>::run(this, other.matrix());
}
else
{
@@ -354,9 +358,9 @@ public:
*/
// note: this function is defined here because some compilers cannot find the respective declaration
template<typename OtherDerived>
- EIGEN_STRONG_INLINE const typename ei_transform_right_product_impl<Transform, OtherDerived>::ResultType
+ EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
operator * (const EigenBase<OtherDerived> &other) const
- { return ei_transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
+ { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
/** \returns the product expression of a transformation matrix \a a times a transform \a b
*
@@ -366,9 +370,9 @@ public:
* \li a general transformation matrix of size Dim+1 x Dim+1.
*/
template<typename OtherDerived> friend
- inline const typename ei_transform_left_product_impl<OtherDerived,Mode,_Dim,_Dim+1>::ResultType
+ inline const typename internal::transform_left_product_impl<OtherDerived,Mode,_Dim,_Dim+1>::ResultType
operator * (const EigenBase<OtherDerived> &a, const Transform &b)
- { return ei_transform_left_product_impl<OtherDerived,Mode,Dim,HDim>::run(a.derived(),b); }
+ { return internal::transform_left_product_impl<OtherDerived,Mode,Dim,HDim>::run(a.derived(),b); }
/** \returns The product expression of a transform \a a times a diagonal matrix \a b
*
@@ -407,16 +411,16 @@ public:
/** Concatenates two transformations */
inline const Transform operator * (const Transform& other) const
{
- return ei_transform_transform_product_impl<Transform,Transform>::run(*this,other);
+ return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
}
/** Concatenates two different transformations */
template<int OtherMode>
- inline const typename ei_transform_transform_product_impl<
+ inline const typename internal::transform_transform_product_impl<
Transform,Transform<Scalar,Dim,OtherMode> >::ResultType
operator * (const Transform<Scalar,Dim,OtherMode>& other) const
{
- return ei_transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode> >::run(*this,other);
+ return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode> >::run(*this,other);
}
/** \sa MatrixBase::setIdentity() */
@@ -495,8 +499,8 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<Transform,Transform<NewScalarType,Dim,Mode> >::type cast() const
- { return typename ei_cast_return_type<Transform,Transform<NewScalarType,Dim,Mode> >::type(*this); }
+ inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode> >::type cast() const
+ { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode> >::type(*this); }
/** Copy constructor with scalar type conversion */
template<typename OtherScalarType>
@@ -590,6 +594,10 @@ typedef Transform<double,2,Projective> Projective2d;
/** \ingroup Geometry_Module */
typedef Transform<double,3,Projective> Projective3d;
+#ifdef EIGEN2_SUPPORT
+#include "src/Eigen2Support/Transform.h"
+#endif
+
/**************************
*** Optional QT support ***
**************************/
@@ -765,7 +773,7 @@ Transform<Scalar,Dim,Mode>::pretranslate(const MatrixBase<OtherDerived> &other)
* to \c *this and returns a reference to \c *this.
*
* The template parameter \a RotationType is the type of the rotation which
- * must be known by ei_toRotationMatrix<>.
+ * must be known by internal::toRotationMatrix<>.
*
* Natively supported types includes:
* - any scalar (2D),
@@ -783,7 +791,7 @@ template<typename RotationType>
Transform<Scalar,Dim,Mode>&
Transform<Scalar,Dim,Mode>::rotate(const RotationType& rotation)
{
- linearExt() *= ei_toRotationMatrix<Scalar,Dim>(rotation);
+ linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
return *this;
}
@@ -799,7 +807,7 @@ template<typename RotationType>
Transform<Scalar,Dim,Mode>&
Transform<Scalar,Dim,Mode>::prerotate(const RotationType& rotation)
{
- m_matrix.template block<Dim,HDim>(0,0) = ei_toRotationMatrix<Scalar,Dim>(rotation)
+ m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
* m_matrix.template block<Dim,HDim>(0,0);
return *this;
}
@@ -877,7 +885,7 @@ template<typename Scalar, int Dim, int Mode>
template<typename Derived>
inline Transform<Scalar,Dim,Mode>& Transform<Scalar,Dim,Mode>::operator=(const RotationBase<Derived,Dim>& r)
{
- linear() = ei_toRotationMatrix<Scalar,Dim>(r);
+ linear() = internal::toRotationMatrix<Scalar,Dim>(r);
translation().setZero();
makeAffine();
return *this;
@@ -928,7 +936,18 @@ template<typename Scalar, int Dim, int Mode>
template<typename RotationMatrixType, typename ScalingMatrixType>
void Transform<Scalar,Dim,Mode>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
{
- linear().svd().computeRotationScaling(rotation, scaling);
+ JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU | ComputeFullV);
+
+ Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
+ VectorType sv(svd.singularValues());
+ sv.coeffRef(0) *= x;
+ if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
+ if(rotation)
+ {
+ LinearMatrixType m(svd.matrixU());
+ m.col(0) /= x;
+ rotation->lazyAssign(m * svd.matrixV().adjoint());
+ }
}
/** decomposes the linear part of the transformation as a product rotation x scaling, the scaling being
@@ -946,7 +965,18 @@ template<typename Scalar, int Dim, int Mode>
template<typename ScalingMatrixType, typename RotationMatrixType>
void Transform<Scalar,Dim,Mode>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
{
- linear().svd().computeScalingRotation(scaling, rotation);
+ JacobiSVD<LinearMatrixType> svd(linear(), ComputeFullU | ComputeFullV);
+
+ Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
+ VectorType sv(svd.singularValues());
+ sv.coeffRef(0) *= x;
+ if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
+ if(rotation)
+ {
+ LinearMatrixType m(svd.matrixU());
+ m.col(0) /= x;
+ rotation->lazyAssign(m * svd.matrixV().adjoint());
+ }
}
/** Convenient method to set \c *this from a position, orientation and scale
@@ -958,23 +988,25 @@ Transform<Scalar,Dim,Mode>&
Transform<Scalar,Dim,Mode>::fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
{
- linear() = ei_toRotationMatrix<Scalar,Dim>(orientation);
+ linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
linear() *= scale.asDiagonal();
translation() = position;
makeAffine();
return *this;
}
+namespace internal {
+
// selector needed to avoid taking the inverse of a 3x4 matrix
template<typename TransformType, int Mode=TransformType::Mode>
-struct ei_projective_transform_inverse
+struct projective_transform_inverse
{
static inline void run(const TransformType&, TransformType&)
{}
};
template<typename TransformType>
-struct ei_projective_transform_inverse<TransformType, Projective>
+struct projective_transform_inverse<TransformType, Projective>
{
static inline void run(const TransformType& m, TransformType& res)
{
@@ -982,6 +1014,8 @@ struct ei_projective_transform_inverse<TransformType, Projective>
}
};
+} // end namespace internal
+
/**
*
@@ -1009,7 +1043,7 @@ Transform<Scalar,Dim,Mode>::inverse(TransformTraits hint) const
Transform res;
if (hint == Projective)
{
- ei_projective_transform_inverse<Transform>::run(*this, res);
+ internal::projective_transform_inverse<Transform>::run(*this, res);
}
else
{
@@ -1023,7 +1057,7 @@ Transform<Scalar,Dim,Mode>::inverse(TransformTraits hint) const
}
else
{
- ei_assert(false && "Invalid transform traits in Transform::Inverse");
+ eigen_assert(false && "Invalid transform traits in Transform::Inverse");
}
// translation and remaining parts
res.matrix().template topRightCorner<Dim,1>()
@@ -1033,11 +1067,13 @@ Transform<Scalar,Dim,Mode>::inverse(TransformTraits hint) const
return res;
}
+namespace internal {
+
/*****************************************************
*** Specializations of take affine part ***
*****************************************************/
-template<typename TransformType> struct ei_transform_take_affine_part {
+template<typename TransformType> struct transform_take_affine_part {
typedef typename TransformType::MatrixType MatrixType;
typedef typename TransformType::AffinePart AffinePart;
static inline AffinePart run(MatrixType& m)
@@ -1047,7 +1083,7 @@ template<typename TransformType> struct ei_transform_take_affine_part {
};
template<typename Scalar, int Dim>
-struct ei_transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
+struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
typedef typename Transform<Scalar,Dim,AffineCompact>::MatrixType MatrixType;
static inline MatrixType& run(MatrixType& m) { return m; }
static inline const MatrixType& run(const MatrixType& m) { return m; }
@@ -1058,7 +1094,7 @@ struct ei_transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
*****************************************************/
template<typename Other, int Mode, int Dim, int HDim>
-struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,Dim>
+struct transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,Dim>
{
static inline void run(Transform<typename Other::Scalar,Dim,Mode> *transform, const Other& other)
{
@@ -1069,7 +1105,7 @@ struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,Dim>
};
template<typename Other, int Mode, int Dim, int HDim>
-struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,HDim>
+struct transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,HDim>
{
static inline void run(Transform<typename Other::Scalar,Dim,Mode> *transform, const Other& other)
{
@@ -1079,14 +1115,14 @@ struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,HDim>
};
template<typename Other, int Mode, int Dim, int HDim>
-struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, HDim,HDim>
+struct transform_construct_from_matrix<Other, Mode,Dim,HDim, HDim,HDim>
{
static inline void run(Transform<typename Other::Scalar,Dim,Mode> *transform, const Other& other)
{ transform->matrix() = other; }
};
template<typename Other, int Dim, int HDim>
-struct ei_transform_construct_from_matrix<Other, AffineCompact,Dim,HDim, HDim,HDim>
+struct transform_construct_from_matrix<Other, AffineCompact,Dim,HDim, HDim,HDim>
{
static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact> *transform, const Other& other)
{ transform->matrix() = other.template block<Dim,HDim>(0,0); }
@@ -1097,7 +1133,7 @@ struct ei_transform_construct_from_matrix<Other, AffineCompact,Dim,HDim, HDim,HD
**********************************************************/
template<int LhsMode,int RhsMode>
-struct ei_transform_product_result
+struct transform_product_result
{
enum
{
@@ -1110,7 +1146,7 @@ struct ei_transform_product_result
};
template< typename TransformType, typename MatrixType >
-struct ei_transform_right_product_impl< TransformType, MatrixType, true >
+struct transform_right_product_impl< TransformType, MatrixType, true >
{
typedef typename MatrixType::PlainObject ResultType;
@@ -1121,7 +1157,7 @@ struct ei_transform_right_product_impl< TransformType, MatrixType, true >
};
template< typename TransformType, typename MatrixType >
-struct ei_transform_right_product_impl< TransformType, MatrixType, false >
+struct transform_right_product_impl< TransformType, MatrixType, false >
{
enum {
Dim = TransformType::Dim,
@@ -1159,7 +1195,7 @@ struct ei_transform_right_product_impl< TransformType, MatrixType, false >
// generic HDim x HDim matrix * T => Projective
template<typename Other,int Mode, int Dim, int HDim>
-struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, HDim,HDim>
+struct transform_left_product_impl<Other,Mode,Dim,HDim, HDim,HDim>
{
typedef Transform<typename Other::Scalar,Dim,Mode> TransformType;
typedef typename TransformType::MatrixType MatrixType;
@@ -1170,7 +1206,7 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, HDim,HDim>
// generic HDim x HDim matrix * AffineCompact => Projective
template<typename Other, int Dim, int HDim>
-struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, HDim,HDim>
+struct transform_left_product_impl<Other,AffineCompact,Dim,HDim, HDim,HDim>
{
typedef Transform<typename Other::Scalar,Dim,AffineCompact> TransformType;
typedef typename TransformType::MatrixType MatrixType;
@@ -1186,7 +1222,7 @@ struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, HDim,HDim>
// affine matrix * T
template<typename Other,int Mode, int Dim, int HDim>
-struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,HDim>
+struct transform_left_product_impl<Other,Mode,Dim,HDim, Dim,HDim>
{
typedef Transform<typename Other::Scalar,Dim,Mode> TransformType;
typedef typename TransformType::MatrixType MatrixType;
@@ -1202,7 +1238,7 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,HDim>
// affine matrix * AffineCompact
template<typename Other, int Dim, int HDim>
-struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, Dim,HDim>
+struct transform_left_product_impl<Other,AffineCompact,Dim,HDim, Dim,HDim>
{
typedef Transform<typename Other::Scalar,Dim,AffineCompact> TransformType;
typedef typename TransformType::MatrixType MatrixType;
@@ -1218,7 +1254,7 @@ struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, Dim,HDim>
// linear matrix * T
template<typename Other,int Mode, int Dim, int HDim>
-struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,Dim>
+struct transform_left_product_impl<Other,Mode,Dim,HDim, Dim,Dim>
{
typedef Transform<typename Other::Scalar,Dim,Mode> TransformType;
typedef typename TransformType::MatrixType MatrixType;
@@ -1239,9 +1275,9 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,Dim>
**********************************************************/
template<typename Scalar, int Dim, int LhsMode, int RhsMode>
-struct ei_transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transform<Scalar,Dim,RhsMode>,false >
+struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transform<Scalar,Dim,RhsMode>,false >
{
- enum { ResultMode = ei_transform_product_result<LhsMode,RhsMode>::Mode };
+ enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
typedef Transform<Scalar,Dim,LhsMode> Lhs;
typedef Transform<Scalar,Dim,RhsMode> Rhs;
typedef Transform<Scalar,Dim,ResultMode> ResultType;
@@ -1256,7 +1292,7 @@ struct ei_transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transfo
};
template<typename Scalar, int Dim, int LhsMode, int RhsMode>
-struct ei_transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transform<Scalar,Dim,RhsMode>,true >
+struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transform<Scalar,Dim,RhsMode>,true >
{
typedef Transform<Scalar,Dim,LhsMode> Lhs;
typedef Transform<Scalar,Dim,RhsMode> Rhs;
@@ -1267,4 +1303,6 @@ struct ei_transform_transform_product_impl<Transform<Scalar,Dim,LhsMode>,Transfo
}
};
+} // end namespace internal
+
#endif // EIGEN_TRANSFORM_H
diff --git a/Eigen/src/Geometry/Translation.h b/Eigen/src/Geometry/Translation.h
index 59d3e4a41..f442d825e 100644
--- a/Eigen/src/Geometry/Translation.h
+++ b/Eigen/src/Geometry/Translation.h
@@ -66,14 +66,14 @@ public:
/** */
inline Translation(const Scalar& sx, const Scalar& sy)
{
- ei_assert(Dim==2);
+ eigen_assert(Dim==2);
m_coeffs.x() = sx;
m_coeffs.y() = sy;
}
/** */
inline Translation(const Scalar& sx, const Scalar& sy, const Scalar& sz)
{
- ei_assert(Dim==3);
+ eigen_assert(Dim==3);
m_coeffs.x() = sx;
m_coeffs.y() = sy;
m_coeffs.z() = sz;
@@ -161,8 +161,8 @@ public:
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
- inline typename ei_cast_return_type<Translation,Translation<NewScalarType,Dim> >::type cast() const
- { return typename ei_cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
+ inline typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type cast() const
+ { return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
/** Copy constructor with scalar type conversion */
template<typename OtherScalarType>
diff --git a/Eigen/src/Geometry/Umeyama.h b/Eigen/src/Geometry/Umeyama.h
index fa6bfcbee..b50f46173 100644
--- a/Eigen/src/Geometry/Umeyama.h
+++ b/Eigen/src/Geometry/Umeyama.h
@@ -36,30 +36,31 @@
// These helpers are required since it allows to use mixed types as parameters
// for the Umeyama. The problem with mixed parameters is that the return type
// cannot trivially be deduced when float and double types are mixed.
-namespace
+namespace internal {
+
+// Compile time return type deduction for different MatrixBase types.
+// Different means here different alignment and parameters but the same underlying
+// real scalar type.
+template<typename MatrixType, typename OtherMatrixType>
+struct umeyama_transform_matrix_type
{
- // Compile time return type deduction for different MatrixBase types.
- // Different means here different alignment and parameters but the same underlying
- // real scalar type.
- template<typename MatrixType, typename OtherMatrixType>
- struct ei_umeyama_transform_matrix_type
- {
- enum {
- MinRowsAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime),
-
- // When possible we want to choose some small fixed size value since the result
- // is likely to fit on the stack. So here, EIGEN_SIZE_MIN_PREFER_DYNAMIC is not what we want.
- HomogeneousDimension = int(MinRowsAtCompileTime) == Dynamic ? Dynamic : int(MinRowsAtCompileTime)+1
- };
-
- typedef Matrix<typename ei_traits<MatrixType>::Scalar,
- HomogeneousDimension,
- HomogeneousDimension,
- AutoAlign | (ei_traits<MatrixType>::Flags & RowMajorBit ? RowMajor : ColMajor),
- HomogeneousDimension,
- HomogeneousDimension
- > type;
+ enum {
+ MinRowsAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime),
+
+ // When possible we want to choose some small fixed size value since the result
+ // is likely to fit on the stack. So here, EIGEN_SIZE_MIN_PREFER_DYNAMIC is not what we want.
+ HomogeneousDimension = int(MinRowsAtCompileTime) == Dynamic ? Dynamic : int(MinRowsAtCompileTime)+1
};
+
+ typedef Matrix<typename traits<MatrixType>::Scalar,
+ HomogeneousDimension,
+ HomogeneousDimension,
+ AutoAlign | (traits<MatrixType>::Flags & RowMajorBit ? RowMajor : ColMajor),
+ HomogeneousDimension,
+ HomogeneousDimension
+ > type;
+};
+
}
#endif
@@ -103,23 +104,23 @@ namespace
* Eigen::Matrix.
*/
template <typename Derived, typename OtherDerived>
-typename ei_umeyama_transform_matrix_type<Derived, OtherDerived>::type
+typename internal::umeyama_transform_matrix_type<Derived, OtherDerived>::type
umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, bool with_scaling = true)
{
- typedef typename ei_umeyama_transform_matrix_type<Derived, OtherDerived>::type TransformationMatrixType;
- typedef typename ei_traits<TransformationMatrixType>::Scalar Scalar;
+ typedef typename internal::umeyama_transform_matrix_type<Derived, OtherDerived>::type TransformationMatrixType;
+ typedef typename internal::traits<TransformationMatrixType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef typename Derived::Index Index;
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL)
- EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename ei_traits<OtherDerived>::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename internal::traits<OtherDerived>::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
enum { Dimension = EIGEN_SIZE_MIN_PREFER_DYNAMIC(Derived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime) };
typedef Matrix<Scalar, Dimension, 1> VectorType;
typedef Matrix<Scalar, Dimension, Dimension> MatrixType;
- typedef typename ei_plain_matrix_type_row_major<Derived>::type RowMajorMatrixType;
+ typedef typename internal::plain_matrix_type_row_major<Derived>::type RowMajorMatrixType;
const Index m = src.rows(); // dimension
const Index n = src.cols(); // number of measurements
@@ -141,7 +142,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
// Eq. (38)
const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose();
- SVD<MatrixType> svd(sigma);
+ JacobiSVD<MatrixType> svd(sigma, ComputeFullU | ComputeFullV);
// Initialize the resulting transformation with an identity matrix...
TransformationMatrixType Rt = TransformationMatrixType::Identity(m+1,m+1);
@@ -152,7 +153,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
// Eq. (40) and (43)
const VectorType& d = svd.singularValues();
- Index rank = 0; for (Index i=0; i<m; ++i) if (!ei_isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
+ Index rank = 0; for (Index i=0; i<m; ++i) if (!internal::isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
if (rank == m-1) {
if ( svd.matrixU().determinant() * svd.matrixV().determinant() > 0 ) {
Rt.block(0,0,m,m).noalias() = svd.matrixU()*svd.matrixV().transpose();
diff --git a/Eigen/src/Geometry/arch/Geometry_SSE.h b/Eigen/src/Geometry/arch/Geometry_SSE.h
index 7d82be694..cbe695c72 100644
--- a/Eigen/src/Geometry/arch/Geometry_SSE.h
+++ b/Eigen/src/Geometry/arch/Geometry_SSE.h
@@ -26,8 +26,10 @@
#ifndef EIGEN_GEOMETRY_SSE_H
#define EIGEN_GEOMETRY_SSE_H
+namespace internal {
+
template<class Derived, class OtherDerived>
-struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, float, Aligned>
+struct quat_product<Architecture::SSE, Derived, OtherDerived, float, Aligned>
{
inline static Quaternion<float> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
{
@@ -35,31 +37,31 @@ struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, float, Aligned>
Quaternion<float> res;
__m128 a = _a.coeffs().template packet<Aligned>(0);
__m128 b = _b.coeffs().template packet<Aligned>(0);
- __m128 flip1 = _mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a,1,2,0,2),
- ei_vec4f_swizzle1(b,2,0,1,2)),mask);
- __m128 flip2 = _mm_xor_ps(_mm_mul_ps(ei_vec4f_swizzle1(a,3,3,3,1),
- ei_vec4f_swizzle1(b,0,1,2,1)),mask);
- ei_pstore(&res.x(),
- _mm_add_ps(_mm_sub_ps(_mm_mul_ps(a,ei_vec4f_swizzle1(b,3,3,3,3)),
- _mm_mul_ps(ei_vec4f_swizzle1(a,2,0,1,0),
- ei_vec4f_swizzle1(b,1,2,0,0))),
+ __m128 flip1 = _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a,1,2,0,2),
+ vec4f_swizzle1(b,2,0,1,2)),mask);
+ __m128 flip2 = _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a,3,3,3,1),
+ vec4f_swizzle1(b,0,1,2,1)),mask);
+ pstore(&res.x(),
+ _mm_add_ps(_mm_sub_ps(_mm_mul_ps(a,vec4f_swizzle1(b,3,3,3,3)),
+ _mm_mul_ps(vec4f_swizzle1(a,2,0,1,0),
+ vec4f_swizzle1(b,1,2,0,0))),
_mm_add_ps(flip1,flip2)));
return res;
}
};
template<typename VectorLhs,typename VectorRhs>
-struct ei_cross3_impl<Architecture::SSE,VectorLhs,VectorRhs,float,true>
+struct cross3_impl<Architecture::SSE,VectorLhs,VectorRhs,float,true>
{
- inline static typename ei_plain_matrix_type<VectorLhs>::type
+ inline static typename plain_matrix_type<VectorLhs>::type
run(const VectorLhs& lhs, const VectorRhs& rhs)
{
__m128 a = lhs.template packet<VectorLhs::Flags&AlignedBit ? Aligned : Unaligned>(0);
__m128 b = rhs.template packet<VectorRhs::Flags&AlignedBit ? Aligned : Unaligned>(0);
- __m128 mul1=_mm_mul_ps(ei_vec4f_swizzle1(a,1,2,0,3),ei_vec4f_swizzle1(b,2,0,1,3));
- __m128 mul2=_mm_mul_ps(ei_vec4f_swizzle1(a,2,0,1,3),ei_vec4f_swizzle1(b,1,2,0,3));
- typename ei_plain_matrix_type<VectorLhs>::type res;
- ei_pstore(&res.x(),_mm_sub_ps(mul1,mul2));
+ __m128 mul1=_mm_mul_ps(vec4f_swizzle1(a,1,2,0,3),vec4f_swizzle1(b,2,0,1,3));
+ __m128 mul2=_mm_mul_ps(vec4f_swizzle1(a,2,0,1,3),vec4f_swizzle1(b,1,2,0,3));
+ typename plain_matrix_type<VectorLhs>::type res;
+ pstore(&res.x(),_mm_sub_ps(mul1,mul2));
return res;
}
};
@@ -68,7 +70,7 @@ struct ei_cross3_impl<Architecture::SSE,VectorLhs,VectorRhs,float,true>
template<class Derived, class OtherDerived>
-struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned>
+struct quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned>
{
inline static Quaternion<double> run(const QuaternionBase<Derived>& _a, const QuaternionBase<OtherDerived>& _b)
{
@@ -79,10 +81,10 @@ struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned
const double* a = _a.coeffs().data();
Packet2d b_xy = _b.coeffs().template packet<Aligned>(0);
Packet2d b_zw = _b.coeffs().template packet<Aligned>(2);
- Packet2d a_xx = ei_pset1<Packet2d>(a[0]);
- Packet2d a_yy = ei_pset1<Packet2d>(a[1]);
- Packet2d a_zz = ei_pset1<Packet2d>(a[2]);
- Packet2d a_ww = ei_pset1<Packet2d>(a[3]);
+ Packet2d a_xx = pset1<Packet2d>(a[0]);
+ Packet2d a_yy = pset1<Packet2d>(a[1]);
+ Packet2d a_zz = pset1<Packet2d>(a[2]);
+ Packet2d a_ww = pset1<Packet2d>(a[3]);
// two temporaries:
Packet2d t1, t2;
@@ -92,13 +94,13 @@ struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned
* t2 = zz*xy - xx*zw
* res.xy = t1 +/- swap(t2)
*/
- t1 = ei_padd(ei_pmul(a_ww, b_xy), ei_pmul(a_yy, b_zw));
- t2 = ei_psub(ei_pmul(a_zz, b_xy), ei_pmul(a_xx, b_zw));
+ t1 = padd(pmul(a_ww, b_xy), pmul(a_yy, b_zw));
+ t2 = psub(pmul(a_zz, b_xy), pmul(a_xx, b_zw));
#ifdef __SSE3__
EIGEN_UNUSED_VARIABLE(mask)
- ei_pstore(&res.x(), _mm_addsub_pd(t1, ei_preverse(t2)));
+ pstore(&res.x(), _mm_addsub_pd(t1, preverse(t2)));
#else
- ei_pstore(&res.x(), ei_padd(t1, ei_pxor(mask,ei_preverse(t2))));
+ pstore(&res.x(), padd(t1, pxor(mask,preverse(t2))));
#endif
/*
@@ -106,18 +108,19 @@ struct ei_quat_product<Architecture::SSE, Derived, OtherDerived, double, Aligned
* t2 = zz*zw + xx*xy
* res.zw = t1 -/+ swap(t2) = swap( swap(t1) +/- t2)
*/
- t1 = ei_psub(ei_pmul(a_ww, b_zw), ei_pmul(a_yy, b_xy));
- t2 = ei_padd(ei_pmul(a_zz, b_zw), ei_pmul(a_xx, b_xy));
+ t1 = psub(pmul(a_ww, b_zw), pmul(a_yy, b_xy));
+ t2 = padd(pmul(a_zz, b_zw), pmul(a_xx, b_xy));
#ifdef __SSE3__
EIGEN_UNUSED_VARIABLE(mask)
- ei_pstore(&res.z(), ei_preverse(_mm_addsub_pd(ei_preverse(t1), t2)));
+ pstore(&res.z(), preverse(_mm_addsub_pd(preverse(t1), t2)));
#else
- ei_pstore(&res.z(), ei_psub(t1, ei_pxor(mask,ei_preverse(t2))));
+ pstore(&res.z(), psub(t1, pxor(mask,preverse(t2))));
#endif
return res;
}
};
+} // end namespace internal
#endif // EIGEN_GEOMETRY_SSE_H
diff --git a/Eigen/src/Householder/BlockHouseholder.h b/Eigen/src/Householder/BlockHouseholder.h
index 2868ef2d6..23ce1bfbd 100644
--- a/Eigen/src/Householder/BlockHouseholder.h
+++ b/Eigen/src/Householder/BlockHouseholder.h
@@ -28,14 +28,16 @@
// This file contains some helper function to deal with block householder reflectors
+namespace internal {
+
/** \internal */
template<typename TriangularFactorType,typename VectorsType,typename CoeffsType>
-void ei_make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs)
+void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs)
{
typedef typename TriangularFactorType::Index Index;
typedef typename VectorsType::Scalar Scalar;
const Index nbVecs = vectors.cols();
- ei_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
+ eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
for(Index i = 0; i < nbVecs; i++)
{
@@ -54,13 +56,13 @@ void ei_make_block_householder_triangular_factor(TriangularFactorType& triFactor
/** \internal */
template<typename MatrixType,typename VectorsType,typename CoeffsType>
-void ei_apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs)
+void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs)
{
typedef typename MatrixType::Index Index;
enum { TFactorSize = MatrixType::ColsAtCompileTime };
Index nbVecs = vectors.cols();
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize> T(nbVecs,nbVecs);
- ei_make_block_householder_triangular_factor(T, vectors, hCoeffs);
+ make_block_householder_triangular_factor(T, vectors, hCoeffs);
const TriangularView<VectorsType, UnitLower>& V(vectors);
@@ -72,5 +74,6 @@ void ei_apply_block_householder_on_the_left(MatrixType& mat, const VectorsType&
mat.noalias() -= V * tmp;
}
+} // end namespace internal
#endif // EIGEN_BLOCK_HOUSEHOLDER_H
diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h
index c45e6469d..7d77cd6e6 100644
--- a/Eigen/src/Householder/Householder.h
+++ b/Eigen/src/Householder/Householder.h
@@ -26,17 +26,19 @@
#ifndef EIGEN_HOUSEHOLDER_H
#define EIGEN_HOUSEHOLDER_H
-template<int n> struct ei_decrement_size
+namespace internal {
+template<int n> struct decrement_size
{
enum {
ret = n==Dynamic ? n : n-1
};
};
+}
template<typename Derived>
void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
{
- VectorBlock<Derived, ei_decrement_size<Base::SizeAtCompileTime>::ret> essentialPart(derived(), 1, size()-1);
+ VectorBlock<Derived, internal::decrement_size<Base::SizeAtCompileTime>::ret> essentialPart(derived(), 1, size()-1);
makeHouseholder(essentialPart, tau, beta);
}
@@ -68,18 +70,18 @@ void MatrixBase<Derived>::makeHouseholder(
RealScalar tailSqNorm = size()==1 ? RealScalar(0) : tail.squaredNorm();
Scalar c0 = coeff(0);
- if(tailSqNorm == RealScalar(0) && ei_imag(c0)==RealScalar(0))
+ if(tailSqNorm == RealScalar(0) && internal::imag(c0)==RealScalar(0))
{
tau = 0;
- beta = ei_real(c0);
+ beta = internal::real(c0);
}
else
{
- beta = ei_sqrt(ei_abs2(c0) + tailSqNorm);
- if (ei_real(c0)>=RealScalar(0))
+ beta = internal::sqrt(internal::abs2(c0) + tailSqNorm);
+ if (internal::real(c0)>=RealScalar(0))
beta = -beta;
essential = tail / (c0 - beta);
- tau = ei_conj((beta - c0) / beta);
+ tau = internal::conj((beta - c0) / beta);
}
}
@@ -96,7 +98,7 @@ void MatrixBase<Derived>::applyHouseholderOnTheLeft(
}
else
{
- Map<typename ei_plain_row_type<PlainObject>::type> tmp(workspace,cols());
+ Map<typename internal::plain_row_type<PlainObject>::type> tmp(workspace,cols());
Block<Derived, EssentialPart::SizeAtCompileTime, Derived::ColsAtCompileTime> bottom(derived(), 1, 0, rows()-1, cols());
tmp.noalias() = essential.adjoint() * bottom;
tmp += this->row(0);
@@ -118,7 +120,7 @@ void MatrixBase<Derived>::applyHouseholderOnTheRight(
}
else
{
- Map<typename ei_plain_col_type<PlainObject>::type> tmp(workspace,rows());
+ Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace,rows());
Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols()-1);
tmp.noalias() = right * essential.conjugate();
tmp += this->col(0);
diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h
index 0e9e85553..2e95b8320 100644
--- a/Eigen/src/Householder/HouseholderSequence.h
+++ b/Eigen/src/Householder/HouseholderSequence.h
@@ -49,25 +49,27 @@
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
+namespace internal {
+
template<typename VectorsType, typename CoeffsType, int Side>
-struct ei_traits<HouseholderSequence<VectorsType,CoeffsType,Side> >
+struct traits<HouseholderSequence<VectorsType,CoeffsType,Side> >
{
typedef typename VectorsType::Scalar Scalar;
typedef typename VectorsType::Index Index;
typedef typename VectorsType::StorageKind StorageKind;
enum {
- RowsAtCompileTime = Side==OnTheLeft ? ei_traits<VectorsType>::RowsAtCompileTime
- : ei_traits<VectorsType>::ColsAtCompileTime,
+ RowsAtCompileTime = Side==OnTheLeft ? traits<VectorsType>::RowsAtCompileTime
+ : traits<VectorsType>::ColsAtCompileTime,
ColsAtCompileTime = RowsAtCompileTime,
- MaxRowsAtCompileTime = Side==OnTheLeft ? ei_traits<VectorsType>::MaxRowsAtCompileTime
- : ei_traits<VectorsType>::MaxColsAtCompileTime,
+ MaxRowsAtCompileTime = Side==OnTheLeft ? traits<VectorsType>::MaxRowsAtCompileTime
+ : traits<VectorsType>::MaxColsAtCompileTime,
MaxColsAtCompileTime = MaxRowsAtCompileTime,
Flags = 0
};
};
template<typename VectorsType, typename CoeffsType, int Side>
-struct ei_hseq_side_dependent_impl
+struct hseq_side_dependent_impl
{
typedef Block<VectorsType, Dynamic, 1> EssentialVectorType;
typedef HouseholderSequence<VectorsType, CoeffsType, OnTheLeft> HouseholderSequenceType;
@@ -80,7 +82,7 @@ struct ei_hseq_side_dependent_impl
};
template<typename VectorsType, typename CoeffsType>
-struct ei_hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight>
+struct hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight>
{
typedef Transpose<Block<VectorsType, 1, Dynamic> > EssentialVectorType;
typedef HouseholderSequence<VectorsType, CoeffsType, OnTheRight> HouseholderSequenceType;
@@ -92,36 +94,38 @@ struct ei_hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight>
}
};
-template<typename OtherScalarType, typename MatrixType> struct ei_matrix_type_times_scalar_type
+template<typename OtherScalarType, typename MatrixType> struct matrix_type_times_scalar_type
{
- typedef typename ei_scalar_product_traits<OtherScalarType, typename MatrixType::Scalar>::ReturnType
+ typedef typename scalar_product_traits<OtherScalarType, typename MatrixType::Scalar>::ReturnType
ResultScalar;
typedef Matrix<ResultScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
0, MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime> Type;
};
+} // end namespace internal
+
template<typename VectorsType, typename CoeffsType, int Side> class HouseholderSequence
: public EigenBase<HouseholderSequence<VectorsType,CoeffsType,Side> >
{
enum {
- RowsAtCompileTime = ei_traits<HouseholderSequence>::RowsAtCompileTime,
- ColsAtCompileTime = ei_traits<HouseholderSequence>::ColsAtCompileTime,
- MaxRowsAtCompileTime = ei_traits<HouseholderSequence>::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = ei_traits<HouseholderSequence>::MaxColsAtCompileTime
+ RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime,
+ ColsAtCompileTime = internal::traits<HouseholderSequence>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = internal::traits<HouseholderSequence>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = internal::traits<HouseholderSequence>::MaxColsAtCompileTime
};
- typedef typename ei_traits<HouseholderSequence>::Scalar Scalar;
+ typedef typename internal::traits<HouseholderSequence>::Scalar Scalar;
typedef typename VectorsType::Index Index;
- typedef typename ei_hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType
+ typedef typename internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType
EssentialVectorType;
public:
typedef HouseholderSequence<
VectorsType,
- typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- typename ei_cleantype<typename CoeffsType::ConjugateReturnType>::type,
- CoeffsType>::ret,
+ typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ typename internal::remove_all<typename CoeffsType::ConjugateReturnType>::type,
+ CoeffsType>::type,
Side
> ConjugateReturnType;
@@ -141,8 +145,8 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
const EssentialVectorType essentialVector(Index k) const
{
- ei_assert(k >= 0 && k < m_actualVectors);
- return ei_hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::essentialVector(*this, k);
+ eigen_assert(k >= 0 && k < m_actualVectors);
+ return internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::essentialVector(*this, k);
}
HouseholderSequence transpose() const
@@ -163,8 +167,8 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
// FIXME find a way to pass this temporary if the user want to
Matrix<Scalar, DestType::RowsAtCompileTime, 1,
AutoAlign|ColMajor, DestType::MaxRowsAtCompileTime, 1> temp(rows());
- if( ei_is_same_type<typename ei_cleantype<VectorsType>::type,DestType>::ret
- && ei_extract_data(dst) == ei_extract_data(m_vectors))
+ if( internal::is_same<typename internal::remove_all<VectorsType>::type,DestType>::value
+ && internal::extract_data(dst) == internal::extract_data(m_vectors))
{
// in-place
dst.diagonal().setOnes();
@@ -227,24 +231,24 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
}
template<typename OtherDerived>
- typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other) const
+ typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other) const
{
- typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
- res(other.template cast<typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
+ typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
+ res(other.template cast<typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
applyThisOnTheLeft(res);
return res;
}
template<typename OtherDerived> friend
- typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence& h)
+ typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence& h)
{
- typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
- res(other.template cast<typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
+ typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
+ res(other.template cast<typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
h.applyThisOnTheRight(res);
return res;
}
- template<typename _VectorsType, typename _CoeffsType, int _Side> friend struct ei_hseq_side_dependent_impl;
+ template<typename _VectorsType, typename _CoeffsType, int _Side> friend struct internal::hseq_side_dependent_impl;
protected:
typename VectorsType::Nested m_vectors;
diff --git a/Eigen/src/Jacobi/Jacobi.h b/Eigen/src/Jacobi/Jacobi.h
index f62d0d8a4..fb5a2c717 100644
--- a/Eigen/src/Jacobi/Jacobi.h
+++ b/Eigen/src/Jacobi/Jacobi.h
@@ -28,8 +28,8 @@
/** \ingroup Jacobi_Module
* \jacobi_module
- * \class PlanarRotation
- * \brief Represents a rotation in the plane from a cosine-sine pair.
+ * \class JacobiRotation
+ * \brief Rotation given by a cosine-sine pair.
*
* This class represents a Jacobi or Givens rotation.
* This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by
@@ -44,16 +44,16 @@
*
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
-template<typename Scalar> class PlanarRotation
+template<typename Scalar> class JacobiRotation
{
public:
typedef typename NumTraits<Scalar>::Real RealScalar;
/** Default constructor without any initialization. */
- PlanarRotation() {}
+ JacobiRotation() {}
/** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */
- PlanarRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {}
+ JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {}
Scalar& c() { return m_c; }
Scalar c() const { return m_c; }
@@ -61,17 +61,17 @@ template<typename Scalar> class PlanarRotation
Scalar s() const { return m_s; }
/** Concatenates two planar rotation */
- PlanarRotation operator*(const PlanarRotation& other)
+ JacobiRotation operator*(const JacobiRotation& other)
{
- return PlanarRotation(m_c * other.m_c - ei_conj(m_s) * other.m_s,
- ei_conj(m_c * ei_conj(other.m_s) + ei_conj(m_s) * ei_conj(other.m_c)));
+ return JacobiRotation(m_c * other.m_c - internal::conj(m_s) * other.m_s,
+ internal::conj(m_c * internal::conj(other.m_s) + internal::conj(m_s) * internal::conj(other.m_c)));
}
/** Returns the transposed transformation */
- PlanarRotation transpose() const { return PlanarRotation(m_c, -ei_conj(m_s)); }
+ JacobiRotation transpose() const { return JacobiRotation(m_c, -internal::conj(m_s)); }
/** Returns the adjoint transformation */
- PlanarRotation adjoint() const { return PlanarRotation(ei_conj(m_c), -m_s); }
+ JacobiRotation adjoint() const { return JacobiRotation(internal::conj(m_c), -m_s); }
template<typename Derived>
bool makeJacobi(const MatrixBase<Derived>&, typename Derived::Index p, typename Derived::Index q);
@@ -80,8 +80,8 @@ template<typename Scalar> class PlanarRotation
void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0);
protected:
- void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, ei_meta_true);
- void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, ei_meta_false);
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type);
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type);
Scalar m_c, m_s;
};
@@ -92,7 +92,7 @@ template<typename Scalar> class PlanarRotation
* \sa MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
template<typename Scalar>
-bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
+bool JacobiRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
{
typedef typename NumTraits<Scalar>::Real RealScalar;
if(y == Scalar(0))
@@ -103,8 +103,8 @@ bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
}
else
{
- RealScalar tau = (x-z)/(RealScalar(2)*ei_abs(y));
- RealScalar w = ei_sqrt(ei_abs2(tau) + 1);
+ RealScalar tau = (x-z)/(RealScalar(2)*internal::abs(y));
+ RealScalar w = internal::sqrt(internal::abs2(tau) + 1);
RealScalar t;
if(tau>0)
{
@@ -115,8 +115,8 @@ bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
t = RealScalar(1) / (tau - w);
}
RealScalar sign_t = t > 0 ? 1 : -1;
- RealScalar n = RealScalar(1) / ei_sqrt(ei_abs2(t)+1);
- m_s = - sign_t * (ei_conj(y) / ei_abs(y)) * ei_abs(t) * n;
+ RealScalar n = RealScalar(1) / internal::sqrt(internal::abs2(t)+1);
+ m_s = - sign_t * (internal::conj(y) / internal::abs(y)) * internal::abs(t) * n;
m_c = n;
return true;
}
@@ -129,13 +129,13 @@ bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
* Example: \include Jacobi_makeJacobi.cpp
* Output: \verbinclude Jacobi_makeJacobi.out
*
- * \sa PlanarRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
+ * \sa JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
template<typename Scalar>
template<typename Derived>
-inline bool PlanarRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q)
+inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q)
{
- return makeJacobi(ei_real(m.coeff(p,p)), m.coeff(p,q), ei_real(m.coeff(q,q)));
+ return makeJacobi(internal::real(m.coeff(p,p)), m.coeff(p,q), internal::real(m.coeff(q,q)));
}
/** Makes \c *this as a Givens rotation \c G such that applying \f$ G^* \f$ to the left of the vector
@@ -155,62 +155,62 @@ inline bool PlanarRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typ
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
template<typename Scalar>
-void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)
+void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)
{
- makeGivens(p, q, z, typename ei_meta_if<NumTraits<Scalar>::IsComplex, ei_meta_true, ei_meta_false>::ret());
+ makeGivens(p, q, z, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type());
}
// specialization for complexes
template<typename Scalar>
-void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_true)
+void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type)
{
if(q==Scalar(0))
{
- m_c = ei_real(p)<0 ? Scalar(-1) : Scalar(1);
+ m_c = internal::real(p)<0 ? Scalar(-1) : Scalar(1);
m_s = 0;
if(r) *r = m_c * p;
}
else if(p==Scalar(0))
{
m_c = 0;
- m_s = -q/ei_abs(q);
- if(r) *r = ei_abs(q);
+ m_s = -q/internal::abs(q);
+ if(r) *r = internal::abs(q);
}
else
{
- RealScalar p1 = ei_norm1(p);
- RealScalar q1 = ei_norm1(q);
+ RealScalar p1 = internal::norm1(p);
+ RealScalar q1 = internal::norm1(q);
if(p1>=q1)
{
Scalar ps = p / p1;
- RealScalar p2 = ei_abs2(ps);
+ RealScalar p2 = internal::abs2(ps);
Scalar qs = q / p1;
- RealScalar q2 = ei_abs2(qs);
+ RealScalar q2 = internal::abs2(qs);
- RealScalar u = ei_sqrt(RealScalar(1) + q2/p2);
- if(ei_real(p)<RealScalar(0))
+ RealScalar u = internal::sqrt(RealScalar(1) + q2/p2);
+ if(internal::real(p)<RealScalar(0))
u = -u;
m_c = Scalar(1)/u;
- m_s = -qs*ei_conj(ps)*(m_c/p2);
+ m_s = -qs*internal::conj(ps)*(m_c/p2);
if(r) *r = p * u;
}
else
{
Scalar ps = p / q1;
- RealScalar p2 = ei_abs2(ps);
+ RealScalar p2 = internal::abs2(ps);
Scalar qs = q / q1;
- RealScalar q2 = ei_abs2(qs);
+ RealScalar q2 = internal::abs2(qs);
- RealScalar u = q1 * ei_sqrt(p2 + q2);
- if(ei_real(p)<RealScalar(0))
+ RealScalar u = q1 * internal::sqrt(p2 + q2);
+ if(internal::real(p)<RealScalar(0))
u = -u;
- p1 = ei_abs(p);
+ p1 = internal::abs(p);
ps = p/p1;
m_c = p1/u;
- m_s = -ei_conj(ps) * (q/u);
+ m_s = -internal::conj(ps) * (q/u);
if(r) *r = ps * u;
}
}
@@ -218,25 +218,25 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
// specialization for reals
template<typename Scalar>
-void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_false)
+void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type)
{
if(q==0)
{
m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1);
m_s = 0;
- if(r) *r = ei_abs(p);
+ if(r) *r = internal::abs(p);
}
else if(p==0)
{
m_c = 0;
m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1);
- if(r) *r = ei_abs(q);
+ if(r) *r = internal::abs(q);
}
- else if(ei_abs(p) > ei_abs(q))
+ else if(internal::abs(p) > internal::abs(q))
{
Scalar t = q/p;
- Scalar u = ei_sqrt(Scalar(1) + ei_abs2(t));
+ Scalar u = internal::sqrt(Scalar(1) + internal::abs2(t));
if(p<Scalar(0))
u = -u;
m_c = Scalar(1)/u;
@@ -246,7 +246,7 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
else
{
Scalar t = p/q;
- Scalar u = ei_sqrt(Scalar(1) + ei_abs2(t));
+ Scalar u = internal::sqrt(Scalar(1) + internal::abs2(t));
if(q<Scalar(0))
u = -u;
m_s = -Scalar(1)/u;
@@ -266,85 +266,92 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
*
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
+namespace internal {
template<typename VectorX, typename VectorY, typename OtherScalar>
-void ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotation<OtherScalar>& j);
+void apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j);
+}
/** \jacobi_module
* Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B,
* with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$.
*
- * \sa class PlanarRotation, MatrixBase::applyOnTheRight(), ei_apply_rotation_in_the_plane()
+ * \sa class JacobiRotation, MatrixBase::applyOnTheRight(), internal::apply_rotation_in_the_plane()
*/
template<typename Derived>
template<typename OtherScalar>
-inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const PlanarRotation<OtherScalar>& j)
+inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j)
{
RowXpr x(this->row(p));
RowXpr y(this->row(q));
- ei_apply_rotation_in_the_plane(x, y, j);
+ internal::apply_rotation_in_the_plane(x, y, j);
}
/** \ingroup Jacobi_Module
* Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J
* with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$.
*
- * \sa class PlanarRotation, MatrixBase::applyOnTheLeft(), ei_apply_rotation_in_the_plane()
+ * \sa class JacobiRotation, MatrixBase::applyOnTheLeft(), internal::apply_rotation_in_the_plane()
*/
template<typename Derived>
template<typename OtherScalar>
-inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const PlanarRotation<OtherScalar>& j)
+inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j)
{
ColXpr x(this->col(p));
ColXpr y(this->col(q));
- ei_apply_rotation_in_the_plane(x, y, j.transpose());
+ internal::apply_rotation_in_the_plane(x, y, j.transpose());
}
-
+namespace internal {
template<typename VectorX, typename VectorY, typename OtherScalar>
-void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotation<OtherScalar>& j)
+void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j)
{
typedef typename VectorX::Index Index;
typedef typename VectorX::Scalar Scalar;
- ei_assert(_x.size() == _y.size());
+ enum { PacketSize = packet_traits<Scalar>::size };
+ typedef typename packet_traits<Scalar>::type Packet;
+ eigen_assert(_x.size() == _y.size());
Index size = _x.size();
- Index incrx = size ==1 ? 1 : &_x.coeffRef(1) - &_x.coeffRef(0);
- Index incry = size ==1 ? 1 : &_y.coeffRef(1) - &_y.coeffRef(0);
+ Index incrx = _x.innerStride();
+ Index incry = _y.innerStride();
Scalar* EIGEN_RESTRICT x = &_x.coeffRef(0);
Scalar* EIGEN_RESTRICT y = &_y.coeffRef(0);
- if((VectorX::Flags & VectorY::Flags & PacketAccessBit) && incrx==1 && incry==1)
+ /*** dynamic-size vectorized paths ***/
+
+ if(VectorX::SizeAtCompileTime == Dynamic &&
+ (VectorX::Flags & VectorY::Flags & PacketAccessBit) &&
+ ((incrx==1 && incry==1) || PacketSize == 1))
{
// both vectors are sequentially stored in memory => vectorization
- typedef typename ei_packet_traits<Scalar>::type Packet;
- enum { PacketSize = ei_packet_traits<Scalar>::size, Peeling = 2 };
+ enum { Peeling = 2 };
- Index alignedStart = ei_first_aligned(y, size);
+ Index alignedStart = first_aligned(y, size);
Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize;
- const Packet pc = ei_pset1<Packet>(j.c());
- const Packet ps = ei_pset1<Packet>(j.s());
- ei_conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj;
+ const Packet pc = pset1<Packet>(j.c());
+ const Packet ps = pset1<Packet>(j.s());
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj;
for(Index i=0; i<alignedStart; ++i)
{
Scalar xi = x[i];
Scalar yi = y[i];
- x[i] = j.c() * xi + ei_conj(j.s()) * yi;
- y[i] = -j.s() * xi + ei_conj(j.c()) * yi;
+ x[i] = j.c() * xi + conj(j.s()) * yi;
+ y[i] = -j.s() * xi + conj(j.c()) * yi;
}
- Scalar* px = x + alignedStart;
- Scalar* py = y + alignedStart;
+ Scalar* EIGEN_RESTRICT px = x + alignedStart;
+ Scalar* EIGEN_RESTRICT py = y + alignedStart;
- if(ei_first_aligned(x, size)==alignedStart)
+ if(first_aligned(x, size)==alignedStart)
{
for(Index i=alignedStart; i<alignedEnd; i+=PacketSize)
{
- Packet xi = ei_pload<Packet>(px);
- Packet yi = ei_pload<Packet>(py);
- ei_pstore(px, ei_padd(ei_pmul(pc,xi),pcj.pmul(ps,yi)));
- ei_pstore(py, ei_psub(ei_pmul(pc,yi),ei_pmul(ps,xi)));
+ Packet xi = pload<Packet>(px);
+ Packet yi = pload<Packet>(py);
+ pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
+ pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
px += PacketSize;
py += PacketSize;
}
@@ -354,23 +361,23 @@ void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY&
Index peelingEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize);
for(Index i=alignedStart; i<peelingEnd; i+=Peeling*PacketSize)
{
- Packet xi = ei_ploadu<Packet>(px);
- Packet xi1 = ei_ploadu<Packet>(px+PacketSize);
- Packet yi = ei_pload <Packet>(py);
- Packet yi1 = ei_pload <Packet>(py+PacketSize);
- ei_pstoreu(px, ei_padd(ei_pmul(pc,xi),pcj.pmul(ps,yi)));
- ei_pstoreu(px+PacketSize, ei_padd(ei_pmul(pc,xi1),pcj.pmul(ps,yi1)));
- ei_pstore (py, ei_psub(ei_pmul(pc,yi),ei_pmul(ps,xi)));
- ei_pstore (py+PacketSize, ei_psub(ei_pmul(pc,yi1),ei_pmul(ps,xi1)));
+ Packet xi = ploadu<Packet>(px);
+ Packet xi1 = ploadu<Packet>(px+PacketSize);
+ Packet yi = pload <Packet>(py);
+ Packet yi1 = pload <Packet>(py+PacketSize);
+ pstoreu(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
+ pstoreu(px+PacketSize, padd(pmul(pc,xi1),pcj.pmul(ps,yi1)));
+ pstore (py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
+ pstore (py+PacketSize, psub(pcj.pmul(pc,yi1),pmul(ps,xi1)));
px += Peeling*PacketSize;
py += Peeling*PacketSize;
}
if(alignedEnd!=peelingEnd)
{
- Packet xi = ei_ploadu<Packet>(x+peelingEnd);
- Packet yi = ei_pload <Packet>(y+peelingEnd);
- ei_pstoreu(x+peelingEnd, ei_padd(ei_pmul(pc,xi),pcj.pmul(ps,yi)));
- ei_pstore (y+peelingEnd, ei_psub(ei_pmul(pc,yi),ei_pmul(ps,xi)));
+ Packet xi = ploadu<Packet>(x+peelingEnd);
+ Packet yi = pload <Packet>(y+peelingEnd);
+ pstoreu(x+peelingEnd, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
+ pstore (y+peelingEnd, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
}
}
@@ -378,22 +385,46 @@ void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY&
{
Scalar xi = x[i];
Scalar yi = y[i];
- x[i] = j.c() * xi + ei_conj(j.s()) * yi;
- y[i] = -j.s() * xi + ei_conj(j.c()) * yi;
+ x[i] = j.c() * xi + conj(j.s()) * yi;
+ y[i] = -j.s() * xi + conj(j.c()) * yi;
+ }
+ }
+
+ /*** fixed-size vectorized path ***/
+ else if(VectorX::SizeAtCompileTime != Dynamic &&
+ (VectorX::Flags & VectorY::Flags & PacketAccessBit) &&
+ (VectorX::Flags & VectorY::Flags & AlignedBit))
+ {
+ const Packet pc = pset1<Packet>(j.c());
+ const Packet ps = pset1<Packet>(j.s());
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj;
+ Scalar* EIGEN_RESTRICT px = x;
+ Scalar* EIGEN_RESTRICT py = y;
+ for(Index i=0; i<size; i+=PacketSize)
+ {
+ Packet xi = pload<Packet>(px);
+ Packet yi = pload<Packet>(py);
+ pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
+ pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
+ px += PacketSize;
+ py += PacketSize;
}
}
+
+ /*** non-vectorized path ***/
else
{
for(Index i=0; i<size; ++i)
{
Scalar xi = *x;
Scalar yi = *y;
- *x = j.c() * xi + ei_conj(j.s()) * yi;
- *y = -j.s() * xi + ei_conj(j.c()) * yi;
+ *x = j.c() * xi + conj(j.s()) * yi;
+ *y = -j.s() * xi + conj(j.c()) * yi;
x += incrx;
y += incry;
}
}
}
+}
#endif // EIGEN_JACOBI_H
diff --git a/Eigen/src/LU/Determinant.h b/Eigen/src/LU/Determinant.h
index ea7db9c0f..b4fe36eb0 100644
--- a/Eigen/src/LU/Determinant.h
+++ b/Eigen/src/LU/Determinant.h
@@ -25,8 +25,10 @@
#ifndef EIGEN_DETERMINANT_H
#define EIGEN_DETERMINANT_H
+namespace internal {
+
template<typename Derived>
-inline const typename Derived::Scalar ei_bruteforce_det3_helper
+inline const typename Derived::Scalar bruteforce_det3_helper
(const MatrixBase<Derived>& matrix, int a, int b, int c)
{
return matrix.coeff(0,a)
@@ -34,7 +36,7 @@ inline const typename Derived::Scalar ei_bruteforce_det3_helper
}
template<typename Derived>
-const typename Derived::Scalar ei_bruteforce_det4_helper
+const typename Derived::Scalar bruteforce_det4_helper
(const MatrixBase<Derived>& matrix, int j, int k, int m, int n)
{
return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1))
@@ -43,66 +45,68 @@ const typename Derived::Scalar ei_bruteforce_det4_helper
template<typename Derived,
int DeterminantType = Derived::RowsAtCompileTime
-> struct ei_determinant_impl
+> struct determinant_impl
{
- static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
+ static inline typename traits<Derived>::Scalar run(const Derived& m)
{
if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0)
- return typename ei_traits<Derived>::Scalar(1);
+ return typename traits<Derived>::Scalar(1);
return m.partialPivLu().determinant();
}
};
-template<typename Derived> struct ei_determinant_impl<Derived, 1>
+template<typename Derived> struct determinant_impl<Derived, 1>
{
- static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
+ static inline typename traits<Derived>::Scalar run(const Derived& m)
{
return m.coeff(0,0);
}
};
-template<typename Derived> struct ei_determinant_impl<Derived, 2>
+template<typename Derived> struct determinant_impl<Derived, 2>
{
- static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
+ static inline typename traits<Derived>::Scalar run(const Derived& m)
{
return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1);
}
};
-template<typename Derived> struct ei_determinant_impl<Derived, 3>
+template<typename Derived> struct determinant_impl<Derived, 3>
{
- static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
+ static inline typename traits<Derived>::Scalar run(const Derived& m)
{
- return ei_bruteforce_det3_helper(m,0,1,2)
- - ei_bruteforce_det3_helper(m,1,0,2)
- + ei_bruteforce_det3_helper(m,2,0,1);
+ return bruteforce_det3_helper(m,0,1,2)
+ - bruteforce_det3_helper(m,1,0,2)
+ + bruteforce_det3_helper(m,2,0,1);
}
};
-template<typename Derived> struct ei_determinant_impl<Derived, 4>
+template<typename Derived> struct determinant_impl<Derived, 4>
{
- static typename ei_traits<Derived>::Scalar run(const Derived& m)
+ static typename traits<Derived>::Scalar run(const Derived& m)
{
// trick by Martin Costabel to compute 4x4 det with only 30 muls
- return ei_bruteforce_det4_helper(m,0,1,2,3)
- - ei_bruteforce_det4_helper(m,0,2,1,3)
- + ei_bruteforce_det4_helper(m,0,3,1,2)
- + ei_bruteforce_det4_helper(m,1,2,0,3)
- - ei_bruteforce_det4_helper(m,1,3,0,2)
- + ei_bruteforce_det4_helper(m,2,3,0,1);
+ return bruteforce_det4_helper(m,0,1,2,3)
+ - bruteforce_det4_helper(m,0,2,1,3)
+ + bruteforce_det4_helper(m,0,3,1,2)
+ + bruteforce_det4_helper(m,1,2,0,3)
+ - bruteforce_det4_helper(m,1,3,0,2)
+ + bruteforce_det4_helper(m,2,3,0,1);
}
};
+} // end namespace internal
+
/** \lu_module
*
* \returns the determinant of this matrix
*/
template<typename Derived>
-inline typename ei_traits<Derived>::Scalar MatrixBase<Derived>::determinant() const
+inline typename internal::traits<Derived>::Scalar MatrixBase<Derived>::determinant() const
{
assert(rows() == cols());
- typedef typename ei_nested<Derived,Base::RowsAtCompileTime>::type Nested;
- return ei_determinant_impl<typename ei_cleantype<Nested>::type>::run(derived());
+ typedef typename internal::nested<Derived,Base::RowsAtCompileTime>::type Nested;
+ return internal::determinant_impl<typename internal::remove_all<Nested>::type>::run(derived());
}
#endif // EIGEN_DETERMINANT_H
diff --git a/Eigen/src/LU/FullPivLU.h b/Eigen/src/LU/FullPivLU.h
index 558b1bd90..339d7845c 100644
--- a/Eigen/src/LU/FullPivLU.h
+++ b/Eigen/src/LU/FullPivLU.h
@@ -68,10 +68,10 @@ template<typename _MatrixType> class FullPivLU
};
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
+ typedef typename internal::traits<MatrixType>::StorageKind StorageKind;
typedef typename MatrixType::Index Index;
- typedef typename ei_plain_row_type<MatrixType, Index>::type IntRowVectorType;
- typedef typename ei_plain_col_type<MatrixType, Index>::type IntColVectorType;
+ typedef typename internal::plain_row_type<MatrixType, Index>::type IntRowVectorType;
+ typedef typename internal::plain_col_type<MatrixType, Index>::type IntColVectorType;
typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationQType;
typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationPType;
@@ -115,7 +115,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline const MatrixType& matrixLU() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return m_lu;
}
@@ -128,7 +128,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline Index nonzeroPivots() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return m_nonzero_pivots;
}
@@ -143,7 +143,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline const PermutationPType& permutationP() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return m_p;
}
@@ -153,7 +153,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline const PermutationQType& permutationQ() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return m_q;
}
@@ -171,10 +171,10 @@ template<typename _MatrixType> class FullPivLU
*
* \sa image()
*/
- inline const ei_kernel_retval<FullPivLU> kernel() const
+ inline const internal::kernel_retval<FullPivLU> kernel() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- return ei_kernel_retval<FullPivLU>(*this);
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ return internal::kernel_retval<FullPivLU>(*this);
}
/** \returns the image of the matrix, also called its column-space. The columns of the returned matrix
@@ -196,11 +196,11 @@ template<typename _MatrixType> class FullPivLU
*
* \sa kernel()
*/
- inline const ei_image_retval<FullPivLU>
+ inline const internal::image_retval<FullPivLU>
image(const MatrixType& originalMatrix) const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- return ei_image_retval<FullPivLU>(*this, originalMatrix);
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ return internal::image_retval<FullPivLU>(*this, originalMatrix);
}
/** \return a solution x to the equation Ax=b, where A is the matrix of which
@@ -223,11 +223,11 @@ template<typename _MatrixType> class FullPivLU
* \sa TriangularView::solve(), kernel(), inverse()
*/
template<typename Rhs>
- inline const ei_solve_retval<FullPivLU, Rhs>
+ inline const internal::solve_retval<FullPivLU, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- return ei_solve_retval<FullPivLU, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ return internal::solve_retval<FullPivLU, Rhs>(*this, b.derived());
}
/** \returns the determinant of the matrix of which
@@ -245,7 +245,7 @@ template<typename _MatrixType> class FullPivLU
*
* \sa MatrixBase::determinant()
*/
- typename ei_traits<MatrixType>::Scalar determinant() const;
+ typename internal::traits<MatrixType>::Scalar determinant() const;
/** Allows to prescribe a threshold to be used by certain methods, such as rank(),
* who need to determine when pivots are to be considered nonzero. This is not used for the
@@ -290,7 +290,7 @@ template<typename _MatrixType> class FullPivLU
*/
RealScalar threshold() const
{
- ei_assert(m_isInitialized || m_usePrescribedThreshold);
+ eigen_assert(m_isInitialized || m_usePrescribedThreshold);
return m_usePrescribedThreshold ? m_prescribedThreshold
// this formula comes from experimenting (see "LU precision tuning" thread on the list)
// and turns out to be identical to Higham's formula used already in LDLt.
@@ -305,11 +305,11 @@ template<typename _MatrixType> class FullPivLU
*/
inline Index rank() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- RealScalar premultiplied_threshold = ei_abs(m_maxpivot) * threshold();
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ RealScalar premultiplied_threshold = internal::abs(m_maxpivot) * threshold();
Index result = 0;
for(Index i = 0; i < m_nonzero_pivots; ++i)
- result += (ei_abs(m_lu.coeff(i,i)) > premultiplied_threshold);
+ result += (internal::abs(m_lu.coeff(i,i)) > premultiplied_threshold);
return result;
}
@@ -321,7 +321,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline Index dimensionOfKernel() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return cols() - rank();
}
@@ -334,7 +334,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline bool isInjective() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return rank() == cols();
}
@@ -347,7 +347,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline bool isSurjective() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return rank() == rows();
}
@@ -359,7 +359,7 @@ template<typename _MatrixType> class FullPivLU
*/
inline bool isInvertible() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return isInjective() && (m_lu.rows() == m_lu.cols());
}
@@ -370,11 +370,11 @@ template<typename _MatrixType> class FullPivLU
*
* \sa MatrixBase::inverse()
*/
- inline const ei_solve_retval<FullPivLU,typename MatrixType::IdentityReturnType> inverse() const
+ inline const internal::solve_retval<FullPivLU,typename MatrixType::IdentityReturnType> inverse() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- ei_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
- return ei_solve_retval<FullPivLU,typename MatrixType::IdentityReturnType>
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
+ return internal::solve_retval<FullPivLU,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()));
}
@@ -519,10 +519,10 @@ FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
}
template<typename MatrixType>
-typename ei_traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() const
+typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
- ei_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!");
return Scalar(m_det_pq) * Scalar(m_lu.diagonal().prod());
}
@@ -532,7 +532,7 @@ typename ei_traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() cons
template<typename MatrixType>
MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
const Index smalldim = std::min(m_lu.rows(), m_lu.cols());
// LU
MatrixType res(m_lu.rows(),m_lu.cols());
@@ -553,9 +553,10 @@ MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
/********* Implementation of kernel() **************************************************/
+namespace internal {
template<typename _MatrixType>
-struct ei_kernel_retval<FullPivLU<_MatrixType> >
- : ei_kernel_retval_base<FullPivLU<_MatrixType> >
+struct kernel_retval<FullPivLU<_MatrixType> >
+ : kernel_retval_base<FullPivLU<_MatrixType> >
{
EIGEN_MAKE_KERNEL_HELPERS(FullPivLU<_MatrixType>)
@@ -596,9 +597,9 @@ struct ei_kernel_retval<FullPivLU<_MatrixType> >
RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
Index p = 0;
for(Index i = 0; i < dec().nonzeroPivots(); ++i)
- if(ei_abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
+ if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
pivots.coeffRef(p++) = i;
- ei_internal_assert(p == rank());
+ eigen_internal_assert(p == rank());
// we construct a temporaty trapezoid matrix m, by taking the U matrix and
// permuting the rows and cols to bring the nonnegligible pivots to the top of
@@ -639,8 +640,8 @@ struct ei_kernel_retval<FullPivLU<_MatrixType> >
/***** Implementation of image() *****************************************************/
template<typename _MatrixType>
-struct ei_image_retval<FullPivLU<_MatrixType> >
- : ei_image_retval_base<FullPivLU<_MatrixType> >
+struct image_retval<FullPivLU<_MatrixType> >
+ : image_retval_base<FullPivLU<_MatrixType> >
{
EIGEN_MAKE_IMAGE_HELPERS(FullPivLU<_MatrixType>)
@@ -664,9 +665,9 @@ struct ei_image_retval<FullPivLU<_MatrixType> >
RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
Index p = 0;
for(Index i = 0; i < dec().nonzeroPivots(); ++i)
- if(ei_abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
+ if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
pivots.coeffRef(p++) = i;
- ei_internal_assert(p == rank());
+ eigen_internal_assert(p == rank());
for(Index i = 0; i < rank(); ++i)
dst.col(i) = originalMatrix().col(dec().permutationQ().indices().coeff(pivots.coeff(i)));
@@ -676,8 +677,8 @@ struct ei_image_retval<FullPivLU<_MatrixType> >
/***** Implementation of solve() *****************************************************/
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<FullPivLU<_MatrixType>, Rhs>
- : ei_solve_retval_base<FullPivLU<_MatrixType>, Rhs>
+struct solve_retval<FullPivLU<_MatrixType>, Rhs>
+ : solve_retval_base<FullPivLU<_MatrixType>, Rhs>
{
EIGEN_MAKE_SOLVE_HELPERS(FullPivLU<_MatrixType>,Rhs)
@@ -693,7 +694,7 @@ struct ei_solve_retval<FullPivLU<_MatrixType>, Rhs>
const Index rows = dec().rows(), cols = dec().cols(),
nonzero_pivots = dec().nonzeroPivots();
- ei_assert(rhs().rows() == rows);
+ eigen_assert(rhs().rows() == rows);
const Index smalldim = std::min(rows, cols);
if(nonzero_pivots == 0)
@@ -733,6 +734,8 @@ struct ei_solve_retval<FullPivLU<_MatrixType>, Rhs>
}
};
+} // end namespace internal
+
/******* MatrixBase methods *****************************************************************/
/** \lu_module
diff --git a/Eigen/src/LU/Inverse.h b/Eigen/src/LU/Inverse.h
index b587e3309..2d3e6d105 100644
--- a/Eigen/src/LU/Inverse.h
+++ b/Eigen/src/LU/Inverse.h
@@ -25,12 +25,14 @@
#ifndef EIGEN_INVERSE_H
#define EIGEN_INVERSE_H
+namespace internal {
+
/**********************************
*** General case implementation ***
**********************************/
template<typename MatrixType, typename ResultType, int Size = MatrixType::RowsAtCompileTime>
-struct ei_compute_inverse
+struct compute_inverse
{
static inline void run(const MatrixType& matrix, ResultType& result)
{
@@ -39,14 +41,14 @@ struct ei_compute_inverse
};
template<typename MatrixType, typename ResultType, int Size = MatrixType::RowsAtCompileTime>
-struct ei_compute_inverse_and_det_with_check { /* nothing! general case not supported. */ };
+struct compute_inverse_and_det_with_check { /* nothing! general case not supported. */ };
/****************************
*** Size 1 implementation ***
****************************/
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse<MatrixType, ResultType, 1>
+struct compute_inverse<MatrixType, ResultType, 1>
{
static inline void run(const MatrixType& matrix, ResultType& result)
{
@@ -56,7 +58,7 @@ struct ei_compute_inverse<MatrixType, ResultType, 1>
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
+struct compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
{
static inline void run(
const MatrixType& matrix,
@@ -67,7 +69,7 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
)
{
determinant = matrix.coeff(0,0);
- invertible = ei_abs(determinant) > absDeterminantThreshold;
+ invertible = abs(determinant) > absDeterminantThreshold;
if(invertible) result.coeffRef(0,0) = typename ResultType::Scalar(1) / determinant;
}
};
@@ -77,7 +79,7 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
****************************/
template<typename MatrixType, typename ResultType>
-inline void ei_compute_inverse_size2_helper(
+inline void compute_inverse_size2_helper(
const MatrixType& matrix, const typename ResultType::Scalar& invdet,
ResultType& result)
{
@@ -88,18 +90,18 @@ inline void ei_compute_inverse_size2_helper(
}
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse<MatrixType, ResultType, 2>
+struct compute_inverse<MatrixType, ResultType, 2>
{
static inline void run(const MatrixType& matrix, ResultType& result)
{
typedef typename ResultType::Scalar Scalar;
const Scalar invdet = typename MatrixType::Scalar(1) / matrix.determinant();
- ei_compute_inverse_size2_helper(matrix, invdet, result);
+ compute_inverse_size2_helper(matrix, invdet, result);
}
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
+struct compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
{
static inline void run(
const MatrixType& matrix,
@@ -111,10 +113,10 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
{
typedef typename ResultType::Scalar Scalar;
determinant = matrix.determinant();
- invertible = ei_abs(determinant) > absDeterminantThreshold;
+ invertible = abs(determinant) > absDeterminantThreshold;
if(!invertible) return;
const Scalar invdet = Scalar(1) / determinant;
- ei_compute_inverse_size2_helper(matrix, invdet, inverse);
+ compute_inverse_size2_helper(matrix, invdet, inverse);
}
};
@@ -123,7 +125,7 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
****************************/
template<typename MatrixType, int i, int j>
-inline typename MatrixType::Scalar ei_3x3_cofactor(const MatrixType& m)
+inline typename MatrixType::Scalar cofactor_3x3(const MatrixType& m)
{
enum {
i1 = (i+1) % 3,
@@ -136,39 +138,39 @@ inline typename MatrixType::Scalar ei_3x3_cofactor(const MatrixType& m)
}
template<typename MatrixType, typename ResultType>
-inline void ei_compute_inverse_size3_helper(
+inline void compute_inverse_size3_helper(
const MatrixType& matrix,
const typename ResultType::Scalar& invdet,
const Matrix<typename ResultType::Scalar,3,1>& cofactors_col0,
ResultType& result)
{
result.row(0) = cofactors_col0 * invdet;
- result.coeffRef(1,0) = ei_3x3_cofactor<MatrixType,0,1>(matrix) * invdet;
- result.coeffRef(1,1) = ei_3x3_cofactor<MatrixType,1,1>(matrix) * invdet;
- result.coeffRef(1,2) = ei_3x3_cofactor<MatrixType,2,1>(matrix) * invdet;
- result.coeffRef(2,0) = ei_3x3_cofactor<MatrixType,0,2>(matrix) * invdet;
- result.coeffRef(2,1) = ei_3x3_cofactor<MatrixType,1,2>(matrix) * invdet;
- result.coeffRef(2,2) = ei_3x3_cofactor<MatrixType,2,2>(matrix) * invdet;
+ result.coeffRef(1,0) = cofactor_3x3<MatrixType,0,1>(matrix) * invdet;
+ result.coeffRef(1,1) = cofactor_3x3<MatrixType,1,1>(matrix) * invdet;
+ result.coeffRef(1,2) = cofactor_3x3<MatrixType,2,1>(matrix) * invdet;
+ result.coeffRef(2,0) = cofactor_3x3<MatrixType,0,2>(matrix) * invdet;
+ result.coeffRef(2,1) = cofactor_3x3<MatrixType,1,2>(matrix) * invdet;
+ result.coeffRef(2,2) = cofactor_3x3<MatrixType,2,2>(matrix) * invdet;
}
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse<MatrixType, ResultType, 3>
+struct compute_inverse<MatrixType, ResultType, 3>
{
static inline void run(const MatrixType& matrix, ResultType& result)
{
typedef typename ResultType::Scalar Scalar;
- Matrix<Scalar,3,1> cofactors_col0;
- cofactors_col0.coeffRef(0) = ei_3x3_cofactor<MatrixType,0,0>(matrix);
- cofactors_col0.coeffRef(1) = ei_3x3_cofactor<MatrixType,1,0>(matrix);
- cofactors_col0.coeffRef(2) = ei_3x3_cofactor<MatrixType,2,0>(matrix);
+ Matrix<typename MatrixType::Scalar,3,1> cofactors_col0;
+ cofactors_col0.coeffRef(0) = cofactor_3x3<MatrixType,0,0>(matrix);
+ cofactors_col0.coeffRef(1) = cofactor_3x3<MatrixType,1,0>(matrix);
+ cofactors_col0.coeffRef(2) = cofactor_3x3<MatrixType,2,0>(matrix);
const Scalar det = (cofactors_col0.cwiseProduct(matrix.col(0))).sum();
const Scalar invdet = Scalar(1) / det;
- ei_compute_inverse_size3_helper(matrix, invdet, cofactors_col0, result);
+ compute_inverse_size3_helper(matrix, invdet, cofactors_col0, result);
}
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
+struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
{
static inline void run(
const MatrixType& matrix,
@@ -180,14 +182,14 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
{
typedef typename ResultType::Scalar Scalar;
Matrix<Scalar,3,1> cofactors_col0;
- cofactors_col0.coeffRef(0) = ei_3x3_cofactor<MatrixType,0,0>(matrix);
- cofactors_col0.coeffRef(1) = ei_3x3_cofactor<MatrixType,1,0>(matrix);
- cofactors_col0.coeffRef(2) = ei_3x3_cofactor<MatrixType,2,0>(matrix);
+ cofactors_col0.coeffRef(0) = cofactor_3x3<MatrixType,0,0>(matrix);
+ cofactors_col0.coeffRef(1) = cofactor_3x3<MatrixType,1,0>(matrix);
+ cofactors_col0.coeffRef(2) = cofactor_3x3<MatrixType,2,0>(matrix);
determinant = (cofactors_col0.cwiseProduct(matrix.col(0))).sum();
- invertible = ei_abs(determinant) > absDeterminantThreshold;
+ invertible = abs(determinant) > absDeterminantThreshold;
if(!invertible) return;
const Scalar invdet = Scalar(1) / determinant;
- ei_compute_inverse_size3_helper(matrix, invdet, cofactors_col0, inverse);
+ compute_inverse_size3_helper(matrix, invdet, cofactors_col0, inverse);
}
};
@@ -196,7 +198,7 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
****************************/
template<typename Derived>
-inline const typename Derived::Scalar ei_general_det3_helper
+inline const typename Derived::Scalar general_det3_helper
(const MatrixBase<Derived>& matrix, int i1, int i2, int i3, int j1, int j2, int j3)
{
return matrix.coeff(i1,j1)
@@ -204,7 +206,7 @@ inline const typename Derived::Scalar ei_general_det3_helper
}
template<typename MatrixType, int i, int j>
-inline typename MatrixType::Scalar ei_4x4_cofactor(const MatrixType& matrix)
+inline typename MatrixType::Scalar cofactor_4x4(const MatrixType& matrix)
{
enum {
i1 = (i+1) % 4,
@@ -214,45 +216,45 @@ inline typename MatrixType::Scalar ei_4x4_cofactor(const MatrixType& matrix)
j2 = (j+2) % 4,
j3 = (j+3) % 4
};
- return ei_general_det3_helper(matrix, i1, i2, i3, j1, j2, j3)
- + ei_general_det3_helper(matrix, i2, i3, i1, j1, j2, j3)
- + ei_general_det3_helper(matrix, i3, i1, i2, j1, j2, j3);
+ return general_det3_helper(matrix, i1, i2, i3, j1, j2, j3)
+ + general_det3_helper(matrix, i2, i3, i1, j1, j2, j3)
+ + general_det3_helper(matrix, i3, i1, i2, j1, j2, j3);
}
template<int Arch, typename Scalar, typename MatrixType, typename ResultType>
-struct ei_compute_inverse_size4
+struct compute_inverse_size4
{
static void run(const MatrixType& matrix, ResultType& result)
{
- result.coeffRef(0,0) = ei_4x4_cofactor<MatrixType,0,0>(matrix);
- result.coeffRef(1,0) = -ei_4x4_cofactor<MatrixType,0,1>(matrix);
- result.coeffRef(2,0) = ei_4x4_cofactor<MatrixType,0,2>(matrix);
- result.coeffRef(3,0) = -ei_4x4_cofactor<MatrixType,0,3>(matrix);
- result.coeffRef(0,2) = ei_4x4_cofactor<MatrixType,2,0>(matrix);
- result.coeffRef(1,2) = -ei_4x4_cofactor<MatrixType,2,1>(matrix);
- result.coeffRef(2,2) = ei_4x4_cofactor<MatrixType,2,2>(matrix);
- result.coeffRef(3,2) = -ei_4x4_cofactor<MatrixType,2,3>(matrix);
- result.coeffRef(0,1) = -ei_4x4_cofactor<MatrixType,1,0>(matrix);
- result.coeffRef(1,1) = ei_4x4_cofactor<MatrixType,1,1>(matrix);
- result.coeffRef(2,1) = -ei_4x4_cofactor<MatrixType,1,2>(matrix);
- result.coeffRef(3,1) = ei_4x4_cofactor<MatrixType,1,3>(matrix);
- result.coeffRef(0,3) = -ei_4x4_cofactor<MatrixType,3,0>(matrix);
- result.coeffRef(1,3) = ei_4x4_cofactor<MatrixType,3,1>(matrix);
- result.coeffRef(2,3) = -ei_4x4_cofactor<MatrixType,3,2>(matrix);
- result.coeffRef(3,3) = ei_4x4_cofactor<MatrixType,3,3>(matrix);
+ result.coeffRef(0,0) = cofactor_4x4<MatrixType,0,0>(matrix);
+ result.coeffRef(1,0) = -cofactor_4x4<MatrixType,0,1>(matrix);
+ result.coeffRef(2,0) = cofactor_4x4<MatrixType,0,2>(matrix);
+ result.coeffRef(3,0) = -cofactor_4x4<MatrixType,0,3>(matrix);
+ result.coeffRef(0,2) = cofactor_4x4<MatrixType,2,0>(matrix);
+ result.coeffRef(1,2) = -cofactor_4x4<MatrixType,2,1>(matrix);
+ result.coeffRef(2,2) = cofactor_4x4<MatrixType,2,2>(matrix);
+ result.coeffRef(3,2) = -cofactor_4x4<MatrixType,2,3>(matrix);
+ result.coeffRef(0,1) = -cofactor_4x4<MatrixType,1,0>(matrix);
+ result.coeffRef(1,1) = cofactor_4x4<MatrixType,1,1>(matrix);
+ result.coeffRef(2,1) = -cofactor_4x4<MatrixType,1,2>(matrix);
+ result.coeffRef(3,1) = cofactor_4x4<MatrixType,1,3>(matrix);
+ result.coeffRef(0,3) = -cofactor_4x4<MatrixType,3,0>(matrix);
+ result.coeffRef(1,3) = cofactor_4x4<MatrixType,3,1>(matrix);
+ result.coeffRef(2,3) = -cofactor_4x4<MatrixType,3,2>(matrix);
+ result.coeffRef(3,3) = cofactor_4x4<MatrixType,3,3>(matrix);
result /= (matrix.col(0).cwiseProduct(result.row(0).transpose())).sum();
}
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse<MatrixType, ResultType, 4>
- : ei_compute_inverse_size4<Architecture::Target, typename MatrixType::Scalar,
+struct compute_inverse<MatrixType, ResultType, 4>
+ : compute_inverse_size4<Architecture::Target, typename MatrixType::Scalar,
MatrixType, ResultType>
{
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
+struct compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
{
static inline void run(
const MatrixType& matrix,
@@ -263,8 +265,8 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
)
{
determinant = matrix.determinant();
- invertible = ei_abs(determinant) > absDeterminantThreshold;
- if(invertible) ei_compute_inverse<MatrixType, ResultType>::run(matrix, inverse);
+ invertible = abs(determinant) > absDeterminantThreshold;
+ if(invertible) compute_inverse<MatrixType, ResultType>::run(matrix, inverse);
}
};
@@ -273,20 +275,20 @@ struct ei_compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
*************************/
template<typename MatrixType>
-struct ei_traits<ei_inverse_impl<MatrixType> >
+struct traits<inverse_impl<MatrixType> >
{
typedef typename MatrixType::PlainObject ReturnType;
};
template<typename MatrixType>
-struct ei_inverse_impl : public ReturnByValue<ei_inverse_impl<MatrixType> >
+struct inverse_impl : public ReturnByValue<inverse_impl<MatrixType> >
{
typedef typename MatrixType::Index Index;
- typedef typename ei_eval<MatrixType>::type MatrixTypeNested;
- typedef typename ei_cleantype<MatrixTypeNested>::type MatrixTypeNestedCleaned;
+ typedef typename internal::eval<MatrixType>::type MatrixTypeNested;
+ typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
const MatrixTypeNested m_matrix;
- ei_inverse_impl(const MatrixType& matrix)
+ inverse_impl(const MatrixType& matrix)
: m_matrix(matrix)
{}
@@ -297,13 +299,15 @@ struct ei_inverse_impl : public ReturnByValue<ei_inverse_impl<MatrixType> >
{
const int Size = EIGEN_PLAIN_ENUM_MIN(MatrixType::ColsAtCompileTime,Dest::ColsAtCompileTime);
EIGEN_ONLY_USED_FOR_DEBUG(Size);
- ei_assert(( (Size<=1) || (Size>4) || (ei_extract_data(m_matrix)!=ei_extract_data(dst)))
+ eigen_assert(( (Size<=1) || (Size>4) || (extract_data(m_matrix)!=extract_data(dst)))
&& "Aliasing problem detected in inverse(), you need to do inverse().eval() here.");
- ei_compute_inverse<MatrixTypeNestedCleaned, Dest>::run(m_matrix, dst);
+ compute_inverse<MatrixTypeNestedCleaned, Dest>::run(m_matrix, dst);
}
};
+} // end namespace internal
+
/** \lu_module
*
* \returns the matrix inverse of this matrix.
@@ -322,11 +326,11 @@ struct ei_inverse_impl : public ReturnByValue<ei_inverse_impl<MatrixType> >
* \sa computeInverseAndDetWithCheck()
*/
template<typename Derived>
-inline const ei_inverse_impl<Derived> MatrixBase<Derived>::inverse() const
+inline const internal::inverse_impl<Derived> MatrixBase<Derived>::inverse() const
{
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsInteger,THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES)
- ei_assert(rows() == cols());
- return ei_inverse_impl<Derived>(derived());
+ eigen_assert(rows() == cols());
+ return internal::inverse_impl<Derived>(derived());
}
/** \lu_module
@@ -357,15 +361,15 @@ inline void MatrixBase<Derived>::computeInverseAndDetWithCheck(
) const
{
// i'd love to put some static assertions there, but SFINAE means that they have no effect...
- ei_assert(rows() == cols());
+ eigen_assert(rows() == cols());
// for 2x2, it's worth giving a chance to avoid evaluating.
// for larger sizes, evaluating has negligible cost and limits code size.
- typedef typename ei_meta_if<
+ typedef typename internal::conditional<
RowsAtCompileTime == 2,
- typename ei_cleantype<typename ei_nested<Derived, 2>::type>::type,
+ typename internal::remove_all<typename internal::nested<Derived, 2>::type>::type,
PlainObject
- >::ret MatrixType;
- ei_compute_inverse_and_det_with_check<MatrixType, ResultType>::run
+ >::type MatrixType;
+ internal::compute_inverse_and_det_with_check<MatrixType, ResultType>::run
(derived(), absDeterminantThreshold, inverse, determinant, invertible);
}
@@ -396,7 +400,7 @@ inline void MatrixBase<Derived>::computeInverseWithCheck(
{
RealScalar determinant;
// i'd love to put some static assertions there, but SFINAE means that they have no effect...
- ei_assert(rows() == cols());
+ eigen_assert(rows() == cols());
computeInverseAndDetWithCheck(inverse,determinant,invertible,absDeterminantThreshold);
}
diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h
index fe91ecd3f..908c00c5c 100644
--- a/Eigen/src/LU/PartialPivLU.h
+++ b/Eigen/src/LU/PartialPivLU.h
@@ -71,7 +71,7 @@ template<typename _MatrixType> class PartialPivLU
};
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
+ typedef typename internal::traits<MatrixType>::StorageKind StorageKind;
typedef typename MatrixType::Index Index;
typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType;
typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType;
@@ -112,7 +112,7 @@ template<typename _MatrixType> class PartialPivLU
*/
inline const MatrixType& matrixLU() const
{
- ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
+ eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
return m_lu;
}
@@ -120,7 +120,7 @@ template<typename _MatrixType> class PartialPivLU
*/
inline const PermutationType& permutationP() const
{
- ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
+ eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
return m_p;
}
@@ -142,11 +142,11 @@ template<typename _MatrixType> class PartialPivLU
* \sa TriangularView::solve(), inverse(), computeInverse()
*/
template<typename Rhs>
- inline const ei_solve_retval<PartialPivLU, Rhs>
+ inline const internal::solve_retval<PartialPivLU, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
- return ei_solve_retval<PartialPivLU, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
+ return internal::solve_retval<PartialPivLU, Rhs>(*this, b.derived());
}
/** \returns the inverse of the matrix of which *this is the LU decomposition.
@@ -156,10 +156,10 @@ template<typename _MatrixType> class PartialPivLU
*
* \sa MatrixBase::inverse(), LU::inverse()
*/
- inline const ei_solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType> inverse() const
+ inline const internal::solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType> inverse() const
{
- ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
- return ei_solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType>
+ eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
+ return internal::solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()));
}
@@ -176,7 +176,7 @@ template<typename _MatrixType> class PartialPivLU
*
* \sa MatrixBase::determinant()
*/
- typename ei_traits<MatrixType>::Scalar determinant() const;
+ typename internal::traits<MatrixType>::Scalar determinant() const;
MatrixType reconstructedMatrix() const;
@@ -222,9 +222,11 @@ PartialPivLU<MatrixType>::PartialPivLU(const MatrixType& matrix)
compute(matrix);
}
-/** \internal This is the blocked version of ei_fullpivlu_unblocked() */
+namespace internal {
+
+/** \internal This is the blocked version of fullpivlu_unblocked() */
template<typename Scalar, int StorageOrder>
-struct ei_partial_lu_impl
+struct partial_lu_impl
{
// FIXME add a stride to Map, so that the following mapping becomes easier,
// another option would be to create an expression being able to automatically
@@ -390,28 +392,30 @@ struct ei_partial_lu_impl
/** \internal performs the LU decomposition with partial pivoting in-place.
*/
template<typename MatrixType, typename TranspositionType>
-void ei_partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename MatrixType::Index& nb_transpositions)
+void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename MatrixType::Index& nb_transpositions)
{
- ei_assert(lu.cols() == row_transpositions.size());
- ei_assert((&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
+ eigen_assert(lu.cols() == row_transpositions.size());
+ eigen_assert((&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
- ei_partial_lu_impl
+ partial_lu_impl
<typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor>
::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
}
+} // end namespace internal
+
template<typename MatrixType>
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
{
m_lu = matrix;
- ei_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
+ eigen_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
const Index size = matrix.rows();
m_rowsTranspositions.resize(size);
Index nb_transpositions;
- ei_partial_lu_inplace(m_lu, m_rowsTranspositions, nb_transpositions);
+ internal::partial_lu_inplace(m_lu, m_rowsTranspositions, nb_transpositions);
m_det_p = (nb_transpositions%2) ? -1 : 1;
m_p = m_rowsTranspositions;
@@ -421,9 +425,9 @@ PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& ma
}
template<typename MatrixType>
-typename ei_traits<MatrixType>::Scalar PartialPivLU<MatrixType>::determinant() const
+typename internal::traits<MatrixType>::Scalar PartialPivLU<MatrixType>::determinant() const
{
- ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
+ eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
return Scalar(m_det_p) * m_lu.diagonal().prod();
}
@@ -433,7 +437,7 @@ typename ei_traits<MatrixType>::Scalar PartialPivLU<MatrixType>::determinant() c
template<typename MatrixType>
MatrixType PartialPivLU<MatrixType>::reconstructedMatrix() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
// LU
MatrixType res = m_lu.template triangularView<UnitLower>().toDenseMatrix()
* m_lu.template triangularView<Upper>();
@@ -446,9 +450,11 @@ MatrixType PartialPivLU<MatrixType>::reconstructedMatrix() const
/***** Implementation of solve() *****************************************************/
+namespace internal {
+
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<PartialPivLU<_MatrixType>, Rhs>
- : ei_solve_retval_base<PartialPivLU<_MatrixType>, Rhs>
+struct solve_retval<PartialPivLU<_MatrixType>, Rhs>
+ : solve_retval_base<PartialPivLU<_MatrixType>, Rhs>
{
EIGEN_MAKE_SOLVE_HELPERS(PartialPivLU<_MatrixType>,Rhs)
@@ -461,7 +467,7 @@ struct ei_solve_retval<PartialPivLU<_MatrixType>, Rhs>
* Step 3: replace c by the solution x to Ux = c.
*/
- ei_assert(rhs().rows() == dec().matrixLU().rows());
+ eigen_assert(rhs().rows() == dec().matrixLU().rows());
// Step 1
dst = dec().permutationP() * rhs();
@@ -474,6 +480,8 @@ struct ei_solve_retval<PartialPivLU<_MatrixType>, Rhs>
}
};
+} // end namespace internal
+
/******** MatrixBase methods *******/
/** \lu_module
diff --git a/Eigen/src/LU/arch/Inverse_SSE.h b/Eigen/src/LU/arch/Inverse_SSE.h
index 6d497d326..0fe9be388 100644
--- a/Eigen/src/LU/arch/Inverse_SSE.h
+++ b/Eigen/src/LU/arch/Inverse_SSE.h
@@ -42,8 +42,10 @@
#ifndef EIGEN_INVERSE_SSE_H
#define EIGEN_INVERSE_SSE_H
+namespace internal {
+
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_size4<Architecture::SSE, float, MatrixType, ResultType>
+struct compute_inverse_size4<Architecture::SSE, float, MatrixType, ResultType>
{
enum {
MatrixAlignment = bool(MatrixType::Flags&AlignedBit),
@@ -171,7 +173,7 @@ struct ei_compute_inverse_size4<Architecture::SSE, float, MatrixType, ResultType
};
template<typename MatrixType, typename ResultType>
-struct ei_compute_inverse_size4<Architecture::SSE, double, MatrixType, ResultType>
+struct compute_inverse_size4<Architecture::SSE, double, MatrixType, ResultType>
{
enum {
MatrixAlignment = bool(MatrixType::Flags&AlignedBit),
@@ -333,4 +335,6 @@ struct ei_compute_inverse_size4<Architecture::SSE, double, MatrixType, ResultTyp
}
};
+}
+
#endif // EIGEN_INVERSE_SSE_H
diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h
index f34658fa9..21ad0febe 100644
--- a/Eigen/src/QR/ColPivHouseholderQR.h
+++ b/Eigen/src/QR/ColPivHouseholderQR.h
@@ -63,11 +63,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
typedef typename MatrixType::RealScalar RealScalar;
typedef typename MatrixType::Index Index;
typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, Options, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
- typedef typename ei_plain_diag_type<MatrixType>::type HCoeffsType;
+ typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType;
typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationType;
- typedef typename ei_plain_row_type<MatrixType, Index>::type IntRowVectorType;
- typedef typename ei_plain_row_type<MatrixType>::type RowVectorType;
- typedef typename ei_plain_row_type<MatrixType, RealScalar>::type RealRowVectorType;
+ typedef typename internal::plain_row_type<MatrixType, Index>::type IntRowVectorType;
+ typedef typename internal::plain_row_type<MatrixType>::type RowVectorType;
+ typedef typename internal::plain_row_type<MatrixType, RealScalar>::type RealRowVectorType;
typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType;
/**
@@ -132,11 +132,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
* Output: \verbinclude ColPivHouseholderQR_solve.out
*/
template<typename Rhs>
- inline const ei_solve_retval<ColPivHouseholderQR, Rhs>
+ inline const internal::solve_retval<ColPivHouseholderQR, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
- return ei_solve_retval<ColPivHouseholderQR, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ return internal::solve_retval<ColPivHouseholderQR, Rhs>(*this, b.derived());
}
HouseholderSequenceType householderQ(void) const;
@@ -145,7 +145,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
const MatrixType& matrixQR() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_qr;
}
@@ -153,7 +153,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
const PermutationType& colsPermutation() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_colsPermutation;
}
@@ -194,11 +194,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline Index rank() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
- RealScalar premultiplied_threshold = ei_abs(m_maxpivot) * threshold();
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ RealScalar premultiplied_threshold = internal::abs(m_maxpivot) * threshold();
Index result = 0;
for(Index i = 0; i < m_nonzero_pivots; ++i)
- result += (ei_abs(m_qr.coeff(i,i)) > premultiplied_threshold);
+ result += (internal::abs(m_qr.coeff(i,i)) > premultiplied_threshold);
return result;
}
@@ -210,7 +210,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline Index dimensionOfKernel() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return cols() - rank();
}
@@ -223,7 +223,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline bool isInjective() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return rank() == cols();
}
@@ -236,7 +236,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline bool isSurjective() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return rank() == rows();
}
@@ -248,7 +248,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline bool isInvertible() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return isInjective() && isSurjective();
}
@@ -258,11 +258,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
* Use isInvertible() to first determine whether this matrix is invertible.
*/
inline const
- ei_solve_retval<ColPivHouseholderQR, typename MatrixType::IdentityReturnType>
+ internal::solve_retval<ColPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
- return ei_solve_retval<ColPivHouseholderQR,typename MatrixType::IdentityReturnType>
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ return internal::solve_retval<ColPivHouseholderQR,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()));
}
@@ -314,7 +314,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
RealScalar threshold() const
{
- ei_assert(m_isInitialized || m_usePrescribedThreshold);
+ eigen_assert(m_isInitialized || m_usePrescribedThreshold);
return m_usePrescribedThreshold ? m_prescribedThreshold
// this formula comes from experimenting (see "LU precision tuning" thread on the list)
// and turns out to be identical to Higham's formula used already in LDLt.
@@ -330,7 +330,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
*/
inline Index nonzeroPivots() const
{
- ei_assert(m_isInitialized && "LU is not initialized.");
+ eigen_assert(m_isInitialized && "LU is not initialized.");
return m_nonzero_pivots;
}
@@ -355,16 +355,16 @@ template<typename _MatrixType> class ColPivHouseholderQR
template<typename MatrixType>
typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::absDeterminant() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
- return ei_abs(m_qr.diagonal().prod());
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ return internal::abs(m_qr.diagonal().prod());
}
template<typename MatrixType>
typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::logAbsDeterminant() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return m_qr.diagonal().cwiseAbs().array().log().sum();
}
@@ -387,7 +387,7 @@ ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const
for(Index k = 0; k < cols; ++k)
m_colSqNorms.coeffRef(k) = m_qr.col(k).squaredNorm();
- RealScalar threshold_helper = m_colSqNorms.maxCoeff() * ei_abs2(NumTraits<Scalar>::epsilon()) / rows;
+ RealScalar threshold_helper = m_colSqNorms.maxCoeff() * internal::abs2(NumTraits<Scalar>::epsilon()) / rows;
m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
m_maxpivot = RealScalar(0);
@@ -439,7 +439,7 @@ ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const
m_qr.coeffRef(k,k) = beta;
// remember the maximum absolute value of diagonal coefficients
- if(ei_abs(beta) > m_maxpivot) m_maxpivot = ei_abs(beta);
+ if(internal::abs(beta) > m_maxpivot) m_maxpivot = internal::abs(beta);
// apply the householder transformation
m_qr.bottomRightCorner(rows-k, cols-k-1)
@@ -459,15 +459,17 @@ ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const
return *this;
}
+namespace internal {
+
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
- : ei_solve_retval_base<ColPivHouseholderQR<_MatrixType>, Rhs>
+struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
+ : solve_retval_base<ColPivHouseholderQR<_MatrixType>, Rhs>
{
EIGEN_MAKE_SOLVE_HELPERS(ColPivHouseholderQR<_MatrixType>,Rhs)
template<typename Dest> void evalTo(Dest& dst) const
{
- ei_assert(rhs().rows() == dec().rows());
+ eigen_assert(rhs().rows() == dec().rows());
const int cols = dec().cols(),
nonzero_pivots = dec().nonzeroPivots();
@@ -507,12 +509,14 @@ struct ei_solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
}
};
+} // end namespace internal
+
/** \returns the matrix Q as a sequence of householder transformations */
template<typename MatrixType>
typename ColPivHouseholderQR<MatrixType>::HouseholderSequenceType ColPivHouseholderQR<MatrixType>
::householderQ() const
{
- ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate(), false, m_nonzero_pivots, 0);
}
diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h
index e228aeb44..4dee21580 100644
--- a/Eigen/src/QR/FullPivHouseholderQR.h
+++ b/Eigen/src/QR/FullPivHouseholderQR.h
@@ -63,12 +63,12 @@ template<typename _MatrixType> class FullPivHouseholderQR
typedef typename MatrixType::RealScalar RealScalar;
typedef typename MatrixType::Index Index;
typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, Options, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
- typedef typename ei_plain_diag_type<MatrixType>::type HCoeffsType;
+ typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType;
typedef Matrix<Index, 1, ColsAtCompileTime, RowMajor, 1, MaxColsAtCompileTime> IntRowVectorType;
typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationType;
- typedef typename ei_plain_col_type<MatrixType, Index>::type IntColVectorType;
- typedef typename ei_plain_row_type<MatrixType>::type RowVectorType;
- typedef typename ei_plain_col_type<MatrixType>::type ColVectorType;
+ typedef typename internal::plain_col_type<MatrixType, Index>::type IntColVectorType;
+ typedef typename internal::plain_row_type<MatrixType>::type RowVectorType;
+ typedef typename internal::plain_col_type<MatrixType>::type ColVectorType;
/** \brief Default Constructor.
*
@@ -129,11 +129,11 @@ template<typename _MatrixType> class FullPivHouseholderQR
* Output: \verbinclude FullPivHouseholderQR_solve.out
*/
template<typename Rhs>
- inline const ei_solve_retval<FullPivHouseholderQR, Rhs>
+ inline const internal::solve_retval<FullPivHouseholderQR, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
- return ei_solve_retval<FullPivHouseholderQR, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ return internal::solve_retval<FullPivHouseholderQR, Rhs>(*this, b.derived());
}
MatrixQType matrixQ(void) const;
@@ -142,7 +142,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
const MatrixType& matrixQR() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_qr;
}
@@ -150,13 +150,13 @@ template<typename _MatrixType> class FullPivHouseholderQR
const PermutationType& colsPermutation() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_cols_permutation;
}
const IntColVectorType& rowsTranspositions() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rows_transpositions;
}
@@ -196,7 +196,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
inline Index rank() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank;
}
@@ -207,7 +207,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
inline Index dimensionOfKernel() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_qr.cols() - m_rank;
}
@@ -219,7 +219,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
inline bool isInjective() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank == m_qr.cols();
}
@@ -231,7 +231,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
inline bool isSurjective() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank == m_qr.rows();
}
@@ -242,7 +242,7 @@ template<typename _MatrixType> class FullPivHouseholderQR
*/
inline bool isInvertible() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return isInjective() && isSurjective();
}
@@ -251,11 +251,11 @@ template<typename _MatrixType> class FullPivHouseholderQR
* \note If this matrix is not invertible, the returned matrix has undefined coefficients.
* Use isInvertible() to first determine whether this matrix is invertible.
*/ inline const
- ei_solve_retval<FullPivHouseholderQR, typename MatrixType::IdentityReturnType>
+ internal::solve_retval<FullPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
- return ei_solve_retval<FullPivHouseholderQR,typename MatrixType::IdentityReturnType>
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ return internal::solve_retval<FullPivHouseholderQR,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()));
}
@@ -279,16 +279,16 @@ template<typename _MatrixType> class FullPivHouseholderQR
template<typename MatrixType>
typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::absDeterminant() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
- return ei_abs(m_qr.diagonal().prod());
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ return internal::abs(m_qr.diagonal().prod());
}
template<typename MatrixType>
typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::logAbsDeterminant() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return m_qr.diagonal().cwiseAbs().array().log().sum();
}
@@ -326,7 +326,7 @@ FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(cons
if(k==0) biggest = biggest_in_corner;
// if the corner is negligible, then we have less than full rank, and we can finish early
- if(ei_isMuchSmallerThan(biggest_in_corner, biggest, m_precision))
+ if(internal::isMuchSmallerThan(biggest_in_corner, biggest, m_precision))
{
m_rank = k;
for(Index i = k; i < size; i++)
@@ -367,16 +367,18 @@ FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(cons
return *this;
}
+namespace internal {
+
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
- : ei_solve_retval_base<FullPivHouseholderQR<_MatrixType>, Rhs>
+struct solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
+ : solve_retval_base<FullPivHouseholderQR<_MatrixType>, Rhs>
{
EIGEN_MAKE_SOLVE_HELPERS(FullPivHouseholderQR<_MatrixType>,Rhs)
template<typename Dest> void evalTo(Dest& dst) const
{
const Index rows = dec().rows(), cols = dec().cols();
- ei_assert(rhs().rows() == rows);
+ eigen_assert(rhs().rows() == rows);
// FIXME introduce nonzeroPivots() and use it here. and more generally,
// make the same improvements in this dec as in FullPivLU.
@@ -405,7 +407,7 @@ struct ei_solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
RealScalar biggest_in_lower_part_of_c = c.bottomRows(rows-dec().rank()).cwiseAbs().maxCoeff();
// FIXME brain dead
const RealScalar m_precision = NumTraits<Scalar>::epsilon() * std::min(rows,cols);
- if(!ei_isMuchSmallerThan(biggest_in_lower_part_of_c, biggest_in_upper_part_of_c, m_precision))
+ if(!isMuchSmallerThan(biggest_in_lower_part_of_c, biggest_in_upper_part_of_c, m_precision))
return;
}
dec().matrixQR()
@@ -418,11 +420,13 @@ struct ei_solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
}
};
+} // end namespace internal
+
/** \returns the matrix Q */
template<typename MatrixType>
typename FullPivHouseholderQR<MatrixType>::MatrixQType FullPivHouseholderQR<MatrixType>::matrixQ() const
{
- ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
// compute the product H'_0 H'_1 ... H'_n-1,
// where H_k is the k-th Householder transformation I - h_k v_k v_k'
// and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...]
@@ -434,7 +438,7 @@ typename FullPivHouseholderQR<MatrixType>::MatrixQType FullPivHouseholderQR<Matr
for (Index k = size-1; k >= 0; k--)
{
res.block(k, k, rows-k, rows-k)
- .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), ei_conj(m_hCoeffs.coeff(k)), &temp.coeffRef(k));
+ .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), internal::conj(m_hCoeffs.coeff(k)), &temp.coeffRef(k));
res.row(k).swap(res.row(m_rows_transpositions.coeff(k)));
}
return res;
diff --git a/Eigen/src/QR/HouseholderQR.h b/Eigen/src/QR/HouseholderQR.h
index f8d759772..0d2b74893 100644
--- a/Eigen/src/QR/HouseholderQR.h
+++ b/Eigen/src/QR/HouseholderQR.h
@@ -68,8 +68,8 @@ template<typename _MatrixType> class HouseholderQR
typedef typename MatrixType::RealScalar RealScalar;
typedef typename MatrixType::Index Index;
typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, (MatrixType::Flags&RowMajorBit) ? RowMajor : ColMajor, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType;
- typedef typename ei_plain_diag_type<MatrixType>::type HCoeffsType;
- typedef typename ei_plain_row_type<MatrixType>::type RowVectorType;
+ typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType;
+ typedef typename internal::plain_row_type<MatrixType>::type RowVectorType;
typedef typename HouseholderSequence<MatrixType,HCoeffsType>::ConjugateReturnType HouseholderSequenceType;
/**
@@ -119,16 +119,16 @@ template<typename _MatrixType> class HouseholderQR
* Output: \verbinclude HouseholderQR_solve.out
*/
template<typename Rhs>
- inline const ei_solve_retval<HouseholderQR, Rhs>
+ inline const internal::solve_retval<HouseholderQR, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
- return ei_solve_retval<HouseholderQR, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
+ return internal::solve_retval<HouseholderQR, Rhs>(*this, b.derived());
}
HouseholderSequenceType householderQ() const
{
- ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate());
}
@@ -137,7 +137,7 @@ template<typename _MatrixType> class HouseholderQR
*/
const MatrixType& matrixQR() const
{
- ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
+ eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
return m_qr;
}
@@ -186,22 +186,24 @@ template<typename _MatrixType> class HouseholderQR
template<typename MatrixType>
typename MatrixType::RealScalar HouseholderQR<MatrixType>::absDeterminant() const
{
- ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
- return ei_abs(m_qr.diagonal().prod());
+ eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ return internal::abs(m_qr.diagonal().prod());
}
template<typename MatrixType>
typename MatrixType::RealScalar HouseholderQR<MatrixType>::logAbsDeterminant() const
{
- ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
- ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
+ eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
+ eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return m_qr.diagonal().cwiseAbs().array().log().sum();
}
+namespace internal {
+
/** \internal */
template<typename MatrixQR, typename HCoeffs>
-void ei_householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typename MatrixQR::Scalar* tempData = 0)
+void householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typename MatrixQR::Scalar* tempData = 0)
{
typedef typename MatrixQR::Index Index;
typedef typename MatrixQR::Scalar Scalar;
@@ -210,7 +212,7 @@ void ei_householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typena
Index cols = mat.cols();
Index size = std::min(rows,cols);
- ei_assert(hCoeffs.size() == size);
+ eigen_assert(hCoeffs.size() == size);
typedef Matrix<Scalar,MatrixQR::ColsAtCompileTime,1> TempType;
TempType tempVector;
@@ -237,7 +239,7 @@ void ei_householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typena
/** \internal */
template<typename MatrixQR, typename HCoeffs>
-void ei_householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs,
+void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs,
typename MatrixQR::Index maxBlockSize=32,
typename MatrixQR::Scalar* tempData = 0)
{
@@ -278,37 +280,19 @@ void ei_householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs,
BlockType A11_21 = mat.block(k,k,brows,bs);
Block<HCoeffs,Dynamic,1> hCoeffsSegment = hCoeffs.segment(k,bs);
- ei_householder_qr_inplace_unblocked(A11_21, hCoeffsSegment, tempData);
+ householder_qr_inplace_unblocked(A11_21, hCoeffsSegment, tempData);
if(tcols)
{
BlockType A21_22 = mat.block(k,k+bs,brows,tcols);
- ei_apply_block_householder_on_the_left(A21_22,A11_21,hCoeffsSegment.adjoint());
+ apply_block_householder_on_the_left(A21_22,A11_21,hCoeffsSegment.adjoint());
}
}
}
-template<typename MatrixType>
-HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
-{
- Index rows = matrix.rows();
- Index cols = matrix.cols();
- Index size = std::min(rows,cols);
-
- m_qr = matrix;
- m_hCoeffs.resize(size);
-
- m_temp.resize(cols);
-
- ei_householder_qr_inplace_blocked(m_qr, m_hCoeffs, 48, m_temp.data());
-
- m_isInitialized = true;
- return *this;
-}
-
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<HouseholderQR<_MatrixType>, Rhs>
- : ei_solve_retval_base<HouseholderQR<_MatrixType>, Rhs>
+struct solve_retval<HouseholderQR<_MatrixType>, Rhs>
+ : solve_retval_base<HouseholderQR<_MatrixType>, Rhs>
{
EIGEN_MAKE_SOLVE_HELPERS(HouseholderQR<_MatrixType>,Rhs)
@@ -316,7 +300,7 @@ struct ei_solve_retval<HouseholderQR<_MatrixType>, Rhs>
{
const Index rows = dec().rows(), cols = dec().cols();
const Index rank = std::min(rows, cols);
- ei_assert(rhs().rows() == rows);
+ eigen_assert(rhs().rows() == rows);
typename Rhs::PlainObject c(rhs());
@@ -336,6 +320,26 @@ struct ei_solve_retval<HouseholderQR<_MatrixType>, Rhs>
}
};
+} // end namespace internal
+
+template<typename MatrixType>
+HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
+{
+ Index rows = matrix.rows();
+ Index cols = matrix.cols();
+ Index size = std::min(rows,cols);
+
+ m_qr = matrix;
+ m_hCoeffs.resize(size);
+
+ m_temp.resize(cols);
+
+ internal::householder_qr_inplace_blocked(m_qr, m_hCoeffs, 48, m_temp.data());
+
+ m_isInitialized = true;
+ return *this;
+}
+
/** \return the Householder QR decomposition of \c *this.
*
* \sa class HouseholderQR
diff --git a/Eigen/src/SVD/JacobiSVD.h b/Eigen/src/SVD/JacobiSVD.h
index bce7719bf..d180db7db 100644
--- a/Eigen/src/SVD/JacobiSVD.h
+++ b/Eigen/src/SVD/JacobiSVD.h
@@ -25,36 +25,31 @@
#ifndef EIGEN_JACOBISVD_H
#define EIGEN_JACOBISVD_H
-// forward declarations (needed by ICC)
-// the empty bodies are required by MSVC
+namespace internal {
+// forward declaration (needed by ICC)
+// the empty body is required by MSVC
template<typename MatrixType, int QRPreconditioner,
bool IsComplex = NumTraits<typename MatrixType::Scalar>::IsComplex>
-struct ei_svd_precondition_2x2_block_to_be_real {};
+struct svd_precondition_2x2_block_to_be_real {};
-template<typename MatrixType, int QRPreconditioner,
- bool PossiblyMoreRowsThanCols = (MatrixType::RowsAtCompileTime == Dynamic)
- || (MatrixType::RowsAtCompileTime > MatrixType::ColsAtCompileTime) >
-struct ei_svd_precondition_if_more_rows_than_cols;
-
-template<typename MatrixType, int QRPreconditioner,
- bool PossiblyMoreColsThanRows = (MatrixType::ColsAtCompileTime == Dynamic)
- || (MatrixType::ColsAtCompileTime > MatrixType::RowsAtCompileTime) >
-struct ei_svd_precondition_if_more_cols_than_rows;
-
-
-/*** QR preconditioners (R-SVD) ***/
+/*** QR preconditioners (R-SVD)
+ ***
+ *** Their role is to reduce the problem of computing the SVD to the case of a square matrix.
+ *** This approach, known as R-SVD, is an optimization for rectangular-enough matrices, and is a requirement for
+ *** JacobiSVD which by itself is only able to work on square matrices.
+ ***/
enum { PreconditionIfMoreColsThanRows, PreconditionIfMoreRowsThanCols };
template<typename MatrixType, int QRPreconditioner, int Case>
-struct ei_qr_preconditioner_should_do_anything
+struct qr_preconditioner_should_do_anything
{
enum { a = MatrixType::RowsAtCompileTime != Dynamic &&
- MatrixType::ColsAtCompileTime != Dynamic &&
- MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime,
+ MatrixType::ColsAtCompileTime != Dynamic &&
+ MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime,
b = MatrixType::RowsAtCompileTime != Dynamic &&
- MatrixType::ColsAtCompileTime != Dynamic &&
- MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime,
+ MatrixType::ColsAtCompileTime != Dynamic &&
+ MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime,
ret = !( (QRPreconditioner == NoQRPreconditioner) ||
(Case == PreconditionIfMoreColsThanRows && bool(a)) ||
(Case == PreconditionIfMoreRowsThanCols && bool(b)) )
@@ -62,11 +57,11 @@ struct ei_qr_preconditioner_should_do_anything
};
template<typename MatrixType, int QRPreconditioner, int Case,
- bool DoAnything = ei_qr_preconditioner_should_do_anything<MatrixType, QRPreconditioner, Case>::ret
-> struct ei_qr_preconditioner_impl {};
+ bool DoAnything = qr_preconditioner_should_do_anything<MatrixType, QRPreconditioner, Case>::ret
+> struct qr_preconditioner_impl {};
template<typename MatrixType, int QRPreconditioner, int Case>
-struct ei_qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
+struct qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
{
static bool run(JacobiSVD<MatrixType, QRPreconditioner>&, const MatrixType&)
{
@@ -74,15 +69,15 @@ struct ei_qr_preconditioner_impl<MatrixType, QRPreconditioner, Case, false>
}
};
+/*** preconditioner using FullPivHouseholderQR ***/
+
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+struct qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
{
static bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
if(matrix.rows() > matrix.cols())
{
- ei_assert(!svd.m_computeThinU && "JacobiSVD: can't compute a thin U with the FullPivHouseholderQR preconditioner. "
- "Use the ColPivHouseholderQR preconditioner instead.");
FullPivHouseholderQR<MatrixType> qr(matrix);
svd.m_workMatrix = qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
if(svd.m_computeFullU) svd.m_matrixU = qr.matrixQ();
@@ -94,14 +89,12 @@ struct ei_qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner,
};
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+struct qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
{
static bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
if(matrix.cols() > matrix.rows())
{
- ei_assert(!svd.m_computeThinV && "JacobiSVD: can't compute a thin V with the FullPivHouseholderQR preconditioner. "
- "Use the ColPivHouseholderQR preconditioner instead.");
typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime,
MatrixType::Options, MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime>
TransposeTypeWithSameStorageOrder;
@@ -115,8 +108,10 @@ struct ei_qr_preconditioner_impl<MatrixType, FullPivHouseholderQRPreconditioner,
}
};
+/*** preconditioner using ColPivHouseholderQR ***/
+
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+struct qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
{
static bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
@@ -137,7 +132,7 @@ struct ei_qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner,
};
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+struct qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
{
static bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
@@ -160,8 +155,10 @@ struct ei_qr_preconditioner_impl<MatrixType, ColPivHouseholderQRPreconditioner,
}
};
+/*** preconditioner using HouseholderQR ***/
+
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
+struct qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreRowsThanCols, true>
{
static bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
@@ -182,7 +179,7 @@ struct ei_qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, Precon
};
template<typename MatrixType>
-struct ei_qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
+struct qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, PreconditionIfMoreColsThanRows, true>
{
static bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
{
@@ -205,37 +202,149 @@ struct ei_qr_preconditioner_impl<MatrixType, HouseholderQRPreconditioner, Precon
}
};
+/*** 2x2 SVD implementation
+ ***
+ *** JacobiSVD consists in performing a series of 2x2 SVD subproblems
+ ***/
+
+template<typename MatrixType, int QRPreconditioner>
+struct svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, false>
+{
+ typedef JacobiSVD<MatrixType, QRPreconditioner> SVD;
+ typedef typename SVD::Index Index;
+ static void run(typename SVD::WorkMatrixType&, SVD&, Index, Index) {}
+};
+
+template<typename MatrixType, int QRPreconditioner>
+struct svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, true>
+{
+ typedef JacobiSVD<MatrixType, QRPreconditioner> SVD;
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::RealScalar RealScalar;
+ typedef typename SVD::Index Index;
+ static void run(typename SVD::WorkMatrixType& work_matrix, SVD& svd, Index p, Index q)
+ {
+ Scalar z;
+ JacobiRotation<Scalar> rot;
+ RealScalar n = sqrt(abs2(work_matrix.coeff(p,p)) + abs2(work_matrix.coeff(q,p)));
+ if(n==0)
+ {
+ z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
+ work_matrix.row(p) *= z;
+ if(svd.computeU()) svd.m_matrixU.col(p) *= conj(z);
+ z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
+ work_matrix.row(q) *= z;
+ if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z);
+ }
+ else
+ {
+ rot.c() = conj(work_matrix.coeff(p,p)) / n;
+ rot.s() = work_matrix.coeff(q,p) / n;
+ work_matrix.applyOnTheLeft(p,q,rot);
+ if(svd.computeU()) svd.m_matrixU.applyOnTheRight(p,q,rot.adjoint());
+ if(work_matrix.coeff(p,q) != Scalar(0))
+ {
+ Scalar z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
+ work_matrix.col(q) *= z;
+ if(svd.computeV()) svd.m_matrixV.col(q) *= z;
+ }
+ if(work_matrix.coeff(q,q) != Scalar(0))
+ {
+ z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
+ work_matrix.row(q) *= z;
+ if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z);
+ }
+ }
+ }
+};
+
+template<typename MatrixType, typename RealScalar, typename Index>
+void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
+ JacobiRotation<RealScalar> *j_left,
+ JacobiRotation<RealScalar> *j_right)
+{
+ Matrix<RealScalar,2,2> m;
+ m << real(matrix.coeff(p,p)), real(matrix.coeff(p,q)),
+ real(matrix.coeff(q,p)), real(matrix.coeff(q,q));
+ JacobiRotation<RealScalar> rot1;
+ RealScalar t = m.coeff(0,0) + m.coeff(1,1);
+ RealScalar d = m.coeff(1,0) - m.coeff(0,1);
+ if(t == RealScalar(0))
+ {
+ rot1.c() = 0;
+ rot1.s() = d > 0 ? 1 : -1;
+ }
+ else
+ {
+ RealScalar u = d / t;
+ rot1.c() = RealScalar(1) / sqrt(1 + abs2(u));
+ rot1.s() = rot1.c() * u;
+ }
+ m.applyOnTheLeft(0,1,rot1);
+ j_right->makeJacobi(m,0,1);
+ *j_left = rot1 * j_right->transpose();
+}
+} // end namespace internal
/** \ingroup SVD_Module
*
*
* \class JacobiSVD
*
- * \brief Jacobi SVD decomposition of a square matrix
+ * \brief Two-sided Jacobi SVD decomposition of a square matrix
*
* \param MatrixType the type of the matrix of which we are computing the SVD decomposition
* \param QRPreconditioner this optional parameter allows to specify the type of QR decomposition that will be used internally
* for the R-SVD step for non-square matrices. See discussion of possible values below.
*
+ * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product
+ * \f[ A = U S V^* \f]
+ * where \a U is a n-by-n unitary, \a V is a p-by-p unitary, and \a S is a n-by-p real positive matrix which is zero outside of its main diagonal;
+ * the diagonal entries of S are known as the \em singular \em values of \a A and the columns of \a U and \a V are known as the left
+ * and right \em singular \em vectors of \a A respectively.
+ *
+ * Singular values are always sorted in decreasing order.
+ *
+ * This JacobiSVD decomposition computes only the singular values by default. If you want \a U or \a V, you need to ask for them explicitly.
+ *
+ * You can ask for only \em thin \a U or \a V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting \a m be the
+ * smaller value among \a n and \a p, there are only \a m singular vectors; the remaining columns of \a U and \a V do not correspond to actual
+ * singular vectors. Asking for \em thin \a U or \a V means asking for only their \a m first columns to be formed. So \a U is then a n-by-m matrix,
+ * and \a V is then a p-by-m matrix. Notice that thin \a U and \a V are all you need for (least squares) solving.
+ *
+ * Here's an example demonstrating basic usage:
+ * \include JacobiSVD_basic.cpp
+ * Output: \verbinclude JacobiSVD_basic.out
+ *
+ * This JacobiSVD class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than
+ * bidiagonalizing SVD algorithms for large square matrices; however its complexity is still \f$ O(n^2p) \f$ where \a n is the smaller dimension and
+ * \a p is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms.
+ * In particular, like any R-SVD, it takes advantage of non-squareness in that its complexity is only linear in the greater dimension.
+ *
+ * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
+ * terminate in finite (and reasonable) time.
+ *
* The possible values for QRPreconditioner are:
- * \li FullPivHouseholderQRPreconditioner (the default), is the safest and slowest. It uses full-pivoting QR.
- * We make it the default so that JacobiSVD is guaranteed to be entirely, uncompromisingly safe by default.
+ * \li ColPivHouseholderQRPreconditioner is the default. In practice it's very safe. It uses column-pivoting QR.
+ * \li FullPivHouseholderQRPreconditioner, is the safest and slowest. It uses full-pivoting QR.
* Contrary to other QRs, it doesn't allow computing thin unitaries.
- * \li ColPivHouseholderQRPreconditioner is faster, and in practice still very safe, although theoretically not as safe as the default
- * full-pivoting preconditioner. It uses column-pivoting QR.
- * \li HouseholderQRPreconditioner is even faster, and less safe and accurate than the pivoting variants. It uses non-pivoting QR.
+ * \li HouseholderQRPreconditioner is the fastest, and less safe and accurate than the pivoting variants. It uses non-pivoting QR.
* This is very similar in safety and accuracy to the bidiagonalization process used by bidiagonalizing SVD algorithms (since bidiagonalization
- * is inherently non-pivoting).
- * \li NoQRPreconditioner allows to not use a QR preconditioner at all. This is useful if you know that you will only be computing
+ * is inherently non-pivoting). However the resulting SVD is still more reliable than bidiagonalizing SVDs because the Jacobi-based iterarive
+ * process is more reliable than the optimized bidiagonal SVD iterations.
+ * \li NoQRPreconditioner allows not to use a QR preconditioner at all. This is useful if you know that you will only be computing
* JacobiSVD decompositions of square matrices. Non-square matrices require a QR preconditioner. Using this option will result in
- * faster compilation and smaller executable code.
+ * faster compilation and smaller executable code. It won't significantly speed up computation, since JacobiSVD is always checking
+ * if QR preconditioning is needed before applying it anyway.
*
* \sa MatrixBase::jacobiSvd()
*/
-template<typename MatrixType, int QRPreconditioner> class JacobiSVD
+template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
{
- private:
+ public:
+
+ typedef _MatrixType MatrixType;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
typedef typename MatrixType::Index Index;
@@ -255,15 +364,13 @@ template<typename MatrixType, int QRPreconditioner> class JacobiSVD
typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime,
MatrixOptions, MaxColsAtCompileTime, MaxColsAtCompileTime>
MatrixVType;
- typedef typename ei_plain_diag_type<MatrixType, RealScalar>::type SingularValuesType;
- typedef typename ei_plain_row_type<MatrixType>::type RowType;
- typedef typename ei_plain_col_type<MatrixType>::type ColType;
+ typedef typename internal::plain_diag_type<MatrixType, RealScalar>::type SingularValuesType;
+ typedef typename internal::plain_row_type<MatrixType>::type RowType;
+ typedef typename internal::plain_col_type<MatrixType>::type ColType;
typedef Matrix<Scalar, DiagSizeAtCompileTime, DiagSizeAtCompileTime,
MatrixOptions, MaxDiagSizeAtCompileTime, MaxDiagSizeAtCompileTime>
WorkMatrixType;
- public:
-
/** \brief Default Constructor.
*
* The default constructor is useful in cases in which the user intends to
@@ -275,14 +382,13 @@ template<typename MatrixType, int QRPreconditioner> class JacobiSVD
/** \brief Default Constructor with memory preallocation
*
* Like the default constructor but with preallocation of the internal data
- * according to the specified problem \a size.
+ * according to the specified problem size.
* \sa JacobiSVD()
*/
- JacobiSVD(Index rows, Index cols) : m_matrixU(rows, rows),
- m_matrixV(cols, cols),
- m_singularValues(std::min(rows, cols)),
- m_workMatrix(rows, cols),
- m_isInitialized(false) {}
+ JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0)
+ {
+ allocate(rows, cols, computationOptions);
+ }
/** \brief Constructor performing the decomposition of given matrix.
*
@@ -290,25 +396,12 @@ template<typename MatrixType, int QRPreconditioner> class JacobiSVD
* \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
* By default, none is computed. This is a bit-field, the possible bits are ComputeFullU, ComputeThinU,
* ComputeFullV, ComputeThinV.
- *
- * Thin unitaries are not available with the default FullPivHouseholderQRPreconditioner, see class documentation for details.
- * If you want thin unitaries, use another preconditioner, for example:
- * \code
- * JacobiSVD<MatrixXf, ColPivHouseholderQRPreconditioner> svd(matrix, ComputeThinU);
- * \endcode
*
- * Thin unitaries also are only available if your matrix type has a Dynamic number of columns (for example MatrixXf).
+ * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
+ * available with the (non-default) FullPivHouseholderQR preconditioner.
*/
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
- : m_matrixU(matrix.rows(), matrix.rows()),
- m_matrixV(matrix.cols(), matrix.cols()),
- m_singularValues(),
- m_workMatrix(),
- m_isInitialized(false)
{
- const Index minSize = std::min(matrix.rows(), matrix.cols());
- m_singularValues.resize(minSize);
- m_workMatrix.resize(minSize, minSize);
compute(matrix, computationOptions);
}
@@ -319,39 +412,90 @@ template<typename MatrixType, int QRPreconditioner> class JacobiSVD
* By default, none is computed. This is a bit-field, the possible bits are ComputeFullU, ComputeThinU,
* ComputeFullV, ComputeThinV.
*
- * Thin unitaries are not available with the default FullPivHouseholderQRPreconditioner, see class documentation for details.
- * If you want thin unitaries, use another preconditioner, for example:
- * \code
- * JacobiSVD<MatrixXf, ColPivHouseholderQRPreconditioner> svd(matrix, ComputeThinU);
- * \endcode
- *
- * Thin unitaries also are only available if your matrix type has a Dynamic number of columns (for example MatrixXf).
+ * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
+ * available with the (non-default) FullPivHouseholderQR preconditioner.
*/
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions = 0);
+ /** \returns the \a U matrix.
+ *
+ * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
+ * the U matrix is n-by-n if you asked for ComputeFullU, and is n-by-m if you asked for ComputeThinU.
+ *
+ * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed.
+ *
+ * This method asserts that you asked for \a U to be computed.
+ */
const MatrixUType& matrixU() const
{
- ei_assert(m_isInitialized && "JacobiSVD is not initialized.");
- ei_assert(computeU() && "This JacobiSVD decomposition didn't compute U. Did you ask for it?");
+ eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
+ eigen_assert(computeU() && "This JacobiSVD decomposition didn't compute U. Did you ask for it?");
return m_matrixU;
}
- const SingularValuesType& singularValues() const
+ /** \returns the \a V matrix.
+ *
+ * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
+ * the V matrix is p-by-p if you asked for ComputeFullV, and is p-by-m if you asked for ComputeThinV.
+ *
+ * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed.
+ *
+ * This method asserts that you asked for \a V to be computed.
+ */
+ const MatrixVType& matrixV() const
{
- ei_assert(m_isInitialized && "JacobiSVD is not initialized.");
- return m_singularValues;
+ eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
+ eigen_assert(computeV() && "This JacobiSVD decomposition didn't compute V. Did you ask for it?");
+ return m_matrixV;
}
- const MatrixVType& matrixV() const
+ /** \returns the vector of singular values.
+ *
+ * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
+ * returned vector has size \a m.
+ */
+ const SingularValuesType& singularValues() const
{
- ei_assert(m_isInitialized && "JacobiSVD is not initialized.");
- ei_assert(computeV() && "This JacobiSVD decomposition didn't compute V. Did you ask for it?");
- return m_matrixV;
+ eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
+ return m_singularValues;
}
+ /** \returns true if \a U (full or thin) is asked for in this SVD decomposition */
inline bool computeU() const { return m_computeFullU || m_computeThinU; }
+ /** \returns true if \a V (full or thin) is asked for in this SVD decomposition */
inline bool computeV() const { return m_computeFullV || m_computeThinV; }
+ /** \returns a (least squares) solution of \f$ A x = b \f$ using the current SVD decomposition of A.
+ *
+ * \param b the right-hand-side of the equation to solve.
+ *
+ * \note Solving requires both U and V to be computed. Thin U and V are enough, there is no need for full U or V.
+ *
+ * \note SVD solving is implicitly least-squares. Thus, this method serves both purposes of exact solving and least-squares solving.
+ * In other words, the returned solution is guaranteed to minimize the Euclidean norm \f$ \Vert A x - b \Vert \f$.
+ */
+ template<typename Rhs>
+ inline const internal::solve_retval<JacobiSVD, Rhs>
+ solve(const MatrixBase<Rhs>& b) const
+ {
+ eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
+ eigen_assert(computeU() && computeV() && "JacobiSVD::solve() requires both unitaries U and V to be computed (thin unitaries suffice).");
+ return internal::solve_retval<JacobiSVD, Rhs>(*this, b.derived());
+ }
+
+ /** \returns the number of singular values that are not exactly 0 */
+ Index nonzeroSingularValues() const
+ {
+ eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
+ return m_nonzeroSingularValues;
+ }
+
+ inline Index rows() const { return m_rows; }
+ inline Index cols() const { return m_cols; }
+
+ private:
+ void allocate(Index rows, Index cols, unsigned int computationOptions = 0);
+
protected:
MatrixUType m_matrixU;
MatrixVType m_matrixV;
@@ -360,136 +504,94 @@ template<typename MatrixType, int QRPreconditioner> class JacobiSVD
bool m_isInitialized;
bool m_computeFullU, m_computeThinU;
bool m_computeFullV, m_computeThinV;
+ Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize;
- template<typename _MatrixType, int _QRPreconditioner, bool _IsComplex>
- friend struct ei_svd_precondition_2x2_block_to_be_real;
- template<typename _MatrixType, int _QRPreconditioner, int _Case, bool _DoAnything>
- friend struct ei_qr_preconditioner_impl;
-};
-
-template<typename MatrixType, int QRPreconditioner>
-struct ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, false>
-{
- typedef JacobiSVD<MatrixType, QRPreconditioner> SVD;
- typedef typename SVD::Index Index;
- static void run(typename SVD::WorkMatrixType&, SVD&, Index, Index) {}
+ template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
+ friend struct internal::svd_precondition_2x2_block_to_be_real;
+ template<typename __MatrixType, int _QRPreconditioner, int _Case, bool _DoAnything>
+ friend struct internal::qr_preconditioner_impl;
};
template<typename MatrixType, int QRPreconditioner>
-struct ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, true>
-{
- typedef JacobiSVD<MatrixType, QRPreconditioner> SVD;
- typedef typename MatrixType::Scalar Scalar;
- typedef typename MatrixType::RealScalar RealScalar;
- typedef typename SVD::Index Index;
- static void run(typename SVD::WorkMatrixType& work_matrix, SVD& svd, Index p, Index q)
- {
- Scalar z;
- PlanarRotation<Scalar> rot;
- RealScalar n = ei_sqrt(ei_abs2(work_matrix.coeff(p,p)) + ei_abs2(work_matrix.coeff(q,p)));
- if(n==0)
- {
- z = ei_abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
- work_matrix.row(p) *= z;
- if(svd.computeU()) svd.m_matrixU.col(p) *= ei_conj(z);
- z = ei_abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
- work_matrix.row(q) *= z;
- if(svd.computeU()) svd.m_matrixU.col(q) *= ei_conj(z);
- }
- else
- {
- rot.c() = ei_conj(work_matrix.coeff(p,p)) / n;
- rot.s() = work_matrix.coeff(q,p) / n;
- work_matrix.applyOnTheLeft(p,q,rot);
- if(svd.computeU()) svd.m_matrixU.applyOnTheRight(p,q,rot.adjoint());
- if(work_matrix.coeff(p,q) != Scalar(0))
- {
- Scalar z = ei_abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
- work_matrix.col(q) *= z;
- if(svd.computeV()) svd.m_matrixV.col(q) *= z;
- }
- if(work_matrix.coeff(q,q) != Scalar(0))
- {
- z = ei_abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
- work_matrix.row(q) *= z;
- if(svd.computeU()) svd.m_matrixU.col(q) *= ei_conj(z);
- }
- }
- }
-};
-
-template<typename MatrixType, typename RealScalar, typename Index>
-void ei_real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
- PlanarRotation<RealScalar> *j_left,
- PlanarRotation<RealScalar> *j_right)
+void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, unsigned int computationOptions)
{
- Matrix<RealScalar,2,2> m;
- m << ei_real(matrix.coeff(p,p)), ei_real(matrix.coeff(p,q)),
- ei_real(matrix.coeff(q,p)), ei_real(matrix.coeff(q,q));
- PlanarRotation<RealScalar> rot1;
- RealScalar t = m.coeff(0,0) + m.coeff(1,1);
- RealScalar d = m.coeff(1,0) - m.coeff(0,1);
- if(t == RealScalar(0))
+ m_rows = rows;
+ m_cols = cols;
+ m_isInitialized = false;
+ m_computeFullU = (computationOptions & ComputeFullU) != 0;
+ m_computeThinU = (computationOptions & ComputeThinU) != 0;
+ m_computeFullV = (computationOptions & ComputeFullV) != 0;
+ m_computeThinV = (computationOptions & ComputeThinV) != 0;
+ eigen_assert(!(m_computeFullU && m_computeThinU) && "JacobiSVD: you can't ask for both full and thin U");
+ eigen_assert(!(m_computeFullV && m_computeThinV) && "JacobiSVD: you can't ask for both full and thin V");
+ eigen_assert(EIGEN_IMPLIES(m_computeThinU || m_computeThinV, MatrixType::ColsAtCompileTime==Dynamic) &&
+ "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns.");
+ if (QRPreconditioner == FullPivHouseholderQRPreconditioner)
{
- rot1.c() = 0;
- rot1.s() = d > 0 ? 1 : -1;
- }
- else
- {
- RealScalar u = d / t;
- rot1.c() = RealScalar(1) / ei_sqrt(1 + ei_abs2(u));
- rot1.s() = rot1.c() * u;
+ eigen_assert(!(m_computeThinU || m_computeThinV) &&
+ "JacobiSVD: can't compute thin U or thin V with the FullPivHouseholderQR preconditioner. "
+ "Use the ColPivHouseholderQR preconditioner instead.");
}
- m.applyOnTheLeft(0,1,rot1);
- j_right->makeJacobi(m,0,1);
- *j_left = rot1 * j_right->transpose();
+ m_diagSize = std::min(m_rows, m_cols);
+ m_singularValues.resize(m_diagSize);
+ m_matrixU.resize(m_rows, m_computeFullU ? m_rows
+ : m_computeThinU ? m_diagSize
+ : 0);
+ m_matrixV.resize(m_cols, m_computeFullV ? m_cols
+ : m_computeThinV ? m_diagSize
+ : 0);
+ m_workMatrix.resize(m_diagSize, m_diagSize);
}
template<typename MatrixType, int QRPreconditioner>
JacobiSVD<MatrixType, QRPreconditioner>&
JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
{
- m_computeFullU = computationOptions & ComputeFullU;
- m_computeThinU = computationOptions & ComputeThinU;
- m_computeFullV = computationOptions & ComputeFullV;
- m_computeThinV = computationOptions & ComputeThinV;
- ei_assert(!(m_computeFullU && m_computeThinU) && "JacobiSVD: you can't ask for both full and thin U");
- ei_assert(!(m_computeFullV && m_computeThinV) && "JacobiSVD: you can't ask for both full and thin V");
- ei_assert(EIGEN_IMPLIES(m_computeThinU || m_computeThinV, MatrixType::ColsAtCompileTime==Dynamic) &&
- "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns.");
- Index rows = matrix.rows();
- Index cols = matrix.cols();
- Index diagSize = std::min(rows, cols);
- m_singularValues.resize(diagSize);
+ allocate(matrix.rows(), matrix.cols(), computationOptions);
+
+ // currently we stop when we reach precision 2*epsilon as the last bit of precision can require an unreasonable number of iterations,
+ // only worsening the precision of U and V as we accumulate more rotations
const RealScalar precision = 2 * NumTraits<Scalar>::epsilon();
- if(!ei_qr_preconditioner_impl<MatrixType, QRPreconditioner, PreconditionIfMoreColsThanRows>::run(*this, matrix)
- && !ei_qr_preconditioner_impl<MatrixType, QRPreconditioner, PreconditionIfMoreRowsThanCols>::run(*this, matrix))
+ /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
+
+ if(!internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows>::run(*this, matrix)
+ && !internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols>::run(*this, matrix))
{
- m_workMatrix = matrix.block(0,0,diagSize,diagSize);
- if(m_computeFullU) m_matrixU.setIdentity(rows,rows);
- if(m_computeThinU) m_matrixU.setIdentity(rows,diagSize);
- if(m_computeFullV) m_matrixV.setIdentity(cols,cols);
- if(m_computeThinV) m_matrixV.setIdentity(diagSize,cols);
+ m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize);
+ if(m_computeFullU) m_matrixU.setIdentity(m_rows,m_rows);
+ if(m_computeThinU) m_matrixU.setIdentity(m_rows,m_diagSize);
+ if(m_computeFullV) m_matrixV.setIdentity(m_cols,m_cols);
+ if(m_computeThinV) m_matrixV.setIdentity(m_cols, m_diagSize);
}
+ /*** step 2. The main Jacobi SVD iteration. ***/
+
bool finished = false;
while(!finished)
{
finished = true;
- for(Index p = 1; p < diagSize; ++p)
+
+ // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix
+
+ for(Index p = 1; p < m_diagSize; ++p)
{
for(Index q = 0; q < p; ++q)
{
- if(std::max(ei_abs(m_workMatrix.coeff(p,q)),ei_abs(m_workMatrix.coeff(q,p)))
- > std::max(ei_abs(m_workMatrix.coeff(p,p)),ei_abs(m_workMatrix.coeff(q,q)))*precision)
+ // if this 2x2 sub-matrix is not diagonal already...
+ // notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't
+ // keep us iterating forever.
+ if(std::max(internal::abs(m_workMatrix.coeff(p,q)),internal::abs(m_workMatrix.coeff(q,p)))
+ > std::max(internal::abs(m_workMatrix.coeff(p,p)),internal::abs(m_workMatrix.coeff(q,q)))*precision)
{
finished = false;
- ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner>::run(m_workMatrix, *this, p, q);
- PlanarRotation<RealScalar> j_left, j_right;
- ei_real_2x2_jacobi_svd(m_workMatrix, p, q, &j_left, &j_right);
+ // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
+ internal::svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner>::run(m_workMatrix, *this, p, q);
+ JacobiRotation<RealScalar> j_left, j_right;
+ internal::real_2x2_jacobi_svd(m_workMatrix, p, q, &j_left, &j_right);
+ // accumulate resulting Jacobi rotations
m_workMatrix.applyOnTheLeft(p,q,j_left);
if(computeU()) m_matrixU.applyOnTheRight(p,q,j_left.transpose());
@@ -500,17 +602,27 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
}
}
- for(Index i = 0; i < diagSize; ++i)
+ /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/
+
+ for(Index i = 0; i < m_diagSize; ++i)
{
- RealScalar a = ei_abs(m_workMatrix.coeff(i,i));
+ RealScalar a = internal::abs(m_workMatrix.coeff(i,i));
m_singularValues.coeffRef(i) = a;
if(computeU() && (a!=RealScalar(0))) m_matrixU.col(i) *= m_workMatrix.coeff(i,i)/a;
}
- for(Index i = 0; i < diagSize; i++)
+ /*** step 4. Sort singular values in descending order and compute the number of nonzero singular values ***/
+
+ m_nonzeroSingularValues = m_diagSize;
+ for(Index i = 0; i < m_diagSize; i++)
{
Index pos;
- m_singularValues.tail(diagSize-i).maxCoeff(&pos);
+ RealScalar maxRemainingSingularValue = m_singularValues.tail(m_diagSize-i).maxCoeff(&pos);
+ if(maxRemainingSingularValue == RealScalar(0))
+ {
+ m_nonzeroSingularValues = i;
+ break;
+ }
if(pos)
{
pos += i;
@@ -523,4 +635,44 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
m_isInitialized = true;
return *this;
}
+
+namespace internal {
+template<typename _MatrixType, int QRPreconditioner, typename Rhs>
+struct solve_retval<JacobiSVD<_MatrixType, QRPreconditioner>, Rhs>
+ : solve_retval_base<JacobiSVD<_MatrixType, QRPreconditioner>, Rhs>
+{
+ typedef JacobiSVD<_MatrixType, QRPreconditioner> JacobiSVDType;
+ EIGEN_MAKE_SOLVE_HELPERS(JacobiSVDType,Rhs)
+
+ template<typename Dest> void evalTo(Dest& dst) const
+ {
+ eigen_assert(rhs().rows() == dec().rows());
+
+ // A = U S V^*
+ // So A^{-1} = V S^{-1} U^*
+
+ Index diagSize = std::min(dec().rows(), dec().cols());
+ typename JacobiSVDType::SingularValuesType invertedSingVals(diagSize);
+
+ Index nonzeroSingVals = dec().nonzeroSingularValues();
+ invertedSingVals.head(nonzeroSingVals) = dec().singularValues().head(nonzeroSingVals).array().inverse();
+ invertedSingVals.tail(diagSize - nonzeroSingVals).setZero();
+
+ dst = dec().matrixV().leftCols(diagSize)
+ * invertedSingVals.asDiagonal()
+ * dec().matrixU().leftCols(diagSize).adjoint()
+ * rhs();
+ }
+};
+} // end namespace internal
+
+template<typename Derived>
+JacobiSVD<typename MatrixBase<Derived>::PlainObject>
+MatrixBase<Derived>::jacobiSvd(unsigned int computationOptions) const
+{
+ return JacobiSVD<PlainObject>(*this, computationOptions);
+}
+
+
+
#endif // EIGEN_JACOBISVD_H
diff --git a/Eigen/src/SVD/SVD.h b/Eigen/src/SVD/SVD.h
deleted file mode 100644
index e8c970d4f..000000000
--- a/Eigen/src/SVD/SVD.h
+++ /dev/null
@@ -1,604 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef EIGEN_SVD_H
-#define EIGEN_SVD_H
-
-template<typename MatrixType, typename Rhs> struct ei_svd_solve_impl;
-
-/** \ingroup SVD_Module
- *
- *
- * \class SVD
- *
- * \brief Standard SVD decomposition of a matrix and associated features
- *
- * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
- *
- * This class performs a standard SVD decomposition of a real matrix A of size \c M x \c N.
- *
- * Requires M >= N, in other words, at least as many rows as columns.
- *
- * \sa MatrixBase::SVD()
- */
-template<typename _MatrixType> class SVD
-{
- public:
- typedef _MatrixType MatrixType;
- typedef typename MatrixType::Scalar Scalar;
- typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- typedef typename MatrixType::Index Index;
-
- enum {
- RowsAtCompileTime = MatrixType::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::ColsAtCompileTime,
- PacketSize = ei_packet_traits<Scalar>::size,
- AlignmentMask = int(PacketSize)-1,
- MinSize = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime),
- MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
- MatrixOptions = MatrixType::Options
- };
-
- typedef typename ei_plain_col_type<MatrixType>::type ColVector;
- typedef typename ei_plain_row_type<MatrixType>::type RowVector;
-
- typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, MatrixOptions, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixUType;
- typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime, MatrixOptions, MaxColsAtCompileTime, MaxColsAtCompileTime> MatrixVType;
- typedef ColVector SingularValuesType;
-
- /**
- * \brief Default Constructor.
- *
- * The default constructor is useful in cases in which the user intends to
- * perform decompositions via SVD::compute(const MatrixType&).
- */
- SVD() : m_matU(), m_matV(), m_sigma(), m_isInitialized(false) {}
-
- /** \brief Default Constructor with memory preallocation
- *
- * Like the default constructor but with preallocation of the internal data
- * according to the specified problem \a size.
- * \sa JacobiSVD()
- */
- SVD(Index rows, Index cols) : m_matU(rows, rows),
- m_matV(cols,cols),
- m_sigma(std::min(rows, cols)),
- m_workMatrix(rows, cols),
- m_rv1(cols),
- m_isInitialized(false)
- {
- ei_assert(rows >= cols && "SVD is only defined if rows>=cols.");
- }
-
- SVD(const MatrixType& matrix) : m_matU(matrix.rows(), matrix.rows()),
- m_matV(matrix.cols(),matrix.cols()),
- m_sigma(std::min(matrix.rows(), matrix.cols())),
- m_workMatrix(matrix.rows(), matrix.cols()),
- m_rv1(matrix.cols()),
- m_isInitialized(false)
- {
- compute(matrix);
- }
-
- /** \returns a solution of \f$ A x = b \f$ using the current SVD decomposition of A.
- *
- * \param b the right-hand-side of the equation to solve.
- *
- * \note_about_checking_solutions
- *
- * \note_about_arbitrary_choice_of_solution
- *
- * \sa MatrixBase::svd(),
- */
- template<typename Rhs>
- inline const ei_solve_retval<SVD, Rhs>
- solve(const MatrixBase<Rhs>& b) const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return ei_solve_retval<SVD, Rhs>(*this, b.derived());
- }
-
- const MatrixUType& matrixU() const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return m_matU;
- }
-
- const SingularValuesType& singularValues() const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return m_sigma;
- }
-
- const MatrixVType& matrixV() const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return m_matV;
- }
-
- SVD& compute(const MatrixType& matrix);
-
- template<typename UnitaryType, typename PositiveType>
- void computeUnitaryPositive(UnitaryType *unitary, PositiveType *positive) const;
- template<typename PositiveType, typename UnitaryType>
- void computePositiveUnitary(PositiveType *positive, UnitaryType *unitary) const;
- template<typename RotationType, typename ScalingType>
- void computeRotationScaling(RotationType *unitary, ScalingType *positive) const;
- template<typename ScalingType, typename RotationType>
- void computeScalingRotation(ScalingType *positive, RotationType *unitary) const;
-
- inline Index rows() const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return m_rows;
- }
-
- inline Index cols() const
- {
- ei_assert(m_isInitialized && "SVD is not initialized.");
- return m_cols;
- }
-
- protected:
- // Computes (a^2 + b^2)^(1/2) without destructive underflow or overflow.
- inline static Scalar pythag(Scalar a, Scalar b)
- {
- Scalar abs_a = ei_abs(a);
- Scalar abs_b = ei_abs(b);
- if (abs_a > abs_b)
- return abs_a*ei_sqrt(Scalar(1.0)+ei_abs2(abs_b/abs_a));
- else
- return (abs_b == Scalar(0.0) ? Scalar(0.0) : abs_b*ei_sqrt(Scalar(1.0)+ei_abs2(abs_a/abs_b)));
- }
-
- inline static Scalar sign(Scalar a, Scalar b)
- {
- return (b >= Scalar(0.0) ? ei_abs(a) : -ei_abs(a));
- }
-
- protected:
- /** \internal */
- MatrixUType m_matU;
- /** \internal */
- MatrixVType m_matV;
- /** \internal */
- SingularValuesType m_sigma;
- MatrixType m_workMatrix;
- RowVector m_rv1;
- bool m_isInitialized;
- Index m_rows, m_cols;
-};
-
-/** Computes / recomputes the SVD decomposition A = U S V^* of \a matrix
- *
- * \note this code has been adapted from Numerical Recipes, third edition.
- *
- * \returns a reference to *this
- */
-template<typename MatrixType>
-SVD<MatrixType>& SVD<MatrixType>::compute(const MatrixType& matrix)
-{
- const Index m = m_rows = matrix.rows();
- const Index n = m_cols = matrix.cols();
-
- m_matU.resize(m, m);
- m_matU.setZero();
- m_sigma.resize(n);
- m_matV.resize(n,n);
- m_workMatrix = matrix;
-
- Index max_iters = 30;
-
- MatrixVType& V = m_matV;
- MatrixType& A = m_workMatrix;
- SingularValuesType& W = m_sigma;
-
- bool flag;
- Index i=0,its=0,j=0,k=0,l=0,nm=0;
- Scalar anorm, c, f, g, h, s, scale, x, y, z;
- bool convergence = true;
- Scalar eps = NumTraits<Scalar>::dummy_precision();
-
- m_rv1.resize(n);
-
- g = scale = anorm = 0;
- // Householder reduction to bidiagonal form.
- for (i=0; i<n; i++)
- {
- l = i+2;
- m_rv1[i] = scale*g;
- g = s = scale = 0.0;
- if (i < m)
- {
- scale = A.col(i).tail(m-i).cwiseAbs().sum();
- if (scale != Scalar(0))
- {
- for (k=i; k<m; k++)
- {
- A(k, i) /= scale;
- s += A(k, i)*A(k, i);
- }
- f = A(i, i);
- g = -sign( ei_sqrt(s), f );
- h = f*g - s;
- A(i, i)=f-g;
- for (j=l-1; j<n; j++)
- {
- s = A.col(j).tail(m-i).dot(A.col(i).tail(m-i));
- f = s/h;
- A.col(j).tail(m-i) += f*A.col(i).tail(m-i);
- }
- A.col(i).tail(m-i) *= scale;
- }
- }
- W[i] = scale * g;
- g = s = scale = 0.0;
- if (i+1 <= m && i+1 != n)
- {
- scale = A.row(i).tail(n-l+1).cwiseAbs().sum();
- if (scale != Scalar(0))
- {
- for (k=l-1; k<n; k++)
- {
- A(i, k) /= scale;
- s += A(i, k)*A(i, k);
- }
- f = A(i,l-1);
- g = -sign(ei_sqrt(s),f);
- h = f*g - s;
- A(i,l-1) = f-g;
- m_rv1.tail(n-l+1) = A.row(i).tail(n-l+1)/h;
- for (j=l-1; j<m; j++)
- {
- s = A.row(i).tail(n-l+1).dot(A.row(j).tail(n-l+1));
- A.row(j).tail(n-l+1) += s*m_rv1.tail(n-l+1).transpose();
- }
- A.row(i).tail(n-l+1) *= scale;
- }
- }
- anorm = std::max( anorm, (ei_abs(W[i])+ei_abs(m_rv1[i])) );
- }
- // Accumulation of right-hand transformations.
- for (i=n-1; i>=0; i--)
- {
- //Accumulation of right-hand transformations.
- if (i < n-1)
- {
- if (g != Scalar(0.0))
- {
- for (j=l; j<n; j++) //Double division to avoid possible underflow.
- V(j, i) = (A(i, j)/A(i, l))/g;
- for (j=l; j<n; j++)
- {
- s = V.col(j).tail(n-l).dot(A.row(i).tail(n-l));
- V.col(j).tail(n-l) += s * V.col(i).tail(n-l);
- }
- }
- V.row(i).tail(n-l).setZero();
- V.col(i).tail(n-l).setZero();
- }
- V(i, i) = 1.0;
- g = m_rv1[i];
- l = i;
- }
- // Accumulation of left-hand transformations.
- for (i=std::min(m,n)-1; i>=0; i--)
- {
- l = i+1;
- g = W[i];
- if (n-l>0)
- A.row(i).tail(n-l).setZero();
- if (g != Scalar(0.0))
- {
- g = Scalar(1.0)/g;
- if (m-l)
- {
- for (j=l; j<n; j++)
- {
- s = A.col(j).tail(m-l).dot(A.col(i).tail(m-l));
- f = (s/A(i,i))*g;
- A.col(j).tail(m-i) += f * A.col(i).tail(m-i);
- }
- }
- A.col(i).tail(m-i) *= g;
- }
- else
- A.col(i).tail(m-i).setZero();
- ++A(i,i);
- }
- // Diagonalization of the bidiagonal form: Loop over
- // singular values, and over allowed iterations.
- for (k=n-1; k>=0; k--)
- {
- for (its=0; its<max_iters; its++)
- {
- flag = true;
- for (l=k; l>=0; l--)
- {
- // Test for splitting.
- nm = l-1;
- // Note that rv1[1] is always zero.
- //if ((double)(ei_abs(rv1[l])+anorm) == anorm)
- if (l==0 || ei_abs(m_rv1[l]) <= eps*anorm)
- {
- flag = false;
- break;
- }
- //if ((double)(ei_abs(W[nm])+anorm) == anorm)
- if (ei_abs(W[nm]) <= eps*anorm)
- break;
- }
- if (flag)
- {
- c = 0.0; //Cancellation of rv1[l], if l > 0.
- s = 1.0;
- for (i=l ;i<k+1; i++)
- {
- f = s*m_rv1[i];
- m_rv1[i] = c*m_rv1[i];
- //if ((double)(ei_abs(f)+anorm) == anorm)
- if (ei_abs(f) <= eps*anorm)
- break;
- g = W[i];
- h = pythag(f,g);
- W[i] = h;
- h = Scalar(1.0)/h;
- c = g*h;
- s = -f*h;
- V.applyOnTheRight(i,nm,PlanarRotation<Scalar>(c,s));
- }
- }
- z = W[k];
- if (l == k) //Convergence.
- {
- if (z < 0.0) { // Singular value is made nonnegative.
- W[k] = -z;
- V.col(k) = -V.col(k);
- }
- break;
- }
- if (its+1 == max_iters)
- {
- convergence = false;
- }
- x = W[l]; // Shift from bottom 2-by-2 minor.
- nm = k-1;
- y = W[nm];
- g = m_rv1[nm];
- h = m_rv1[k];
- f = ((y-z)*(y+z) + (g-h)*(g+h))/(Scalar(2.0)*h*y);
- g = pythag(f,1.0);
- f = ((x-z)*(x+z) + h*((y/(f+sign(g,f)))-h))/x;
- c = s = 1.0;
- //Next QR transformation:
- for (j=l; j<=nm; j++)
- {
- i = j+1;
- g = m_rv1[i];
- y = W[i];
- h = s*g;
- g = c*g;
-
- z = pythag(f,h);
- m_rv1[j] = z;
- c = f/z;
- s = h/z;
- f = x*c + g*s;
- g = g*c - x*s;
- h = y*s;
- y *= c;
- V.applyOnTheRight(i,j,PlanarRotation<Scalar>(c,s));
-
- z = pythag(f,h);
- W[j] = z;
- // Rotation can be arbitrary if z = 0.
- if (z!=Scalar(0))
- {
- z = Scalar(1.0)/z;
- c = f*z;
- s = h*z;
- }
- f = c*g + s*y;
- x = c*y - s*g;
- A.applyOnTheRight(i,j,PlanarRotation<Scalar>(c,s));
- }
- m_rv1[l] = 0.0;
- m_rv1[k] = f;
- W[k] = x;
- }
- }
-
- // sort the singular values:
- {
- for (Index i=0; i<n; i++)
- {
- Index k;
- W.tail(n-i).maxCoeff(&k);
- if (k != 0)
- {
- k += i;
- std::swap(W[k],W[i]);
- A.col(i).swap(A.col(k));
- V.col(i).swap(V.col(k));
- }
- }
- }
- m_matU.leftCols(n) = A;
- m_matU.rightCols(m-n).setZero();
-
- // Gram Schmidt orthogonalization to fill up U
- for (int col = A.cols(); col < A.rows(); ++col)
- {
- typename MatrixUType::ColXpr colVec = m_matU.col(col);
- colVec(col) = 1;
- for (int prevCol = 0; prevCol < col; ++prevCol)
- {
- typename MatrixUType::ColXpr prevColVec = m_matU.col(prevCol);
- colVec -= colVec.dot(prevColVec)*prevColVec;
- }
- // Here we can run into troubles when colVec.norm() = 0.
- m_matU.col(col) = colVec.normalized();
- }
-
- m_isInitialized = true;
- return *this;
-}
-
-template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<SVD<_MatrixType>, Rhs>
- : ei_solve_retval_base<SVD<_MatrixType>, Rhs>
-{
- EIGEN_MAKE_SOLVE_HELPERS(SVD<_MatrixType>,Rhs)
-
- template<typename Dest> void evalTo(Dest& dst) const
- {
- ei_assert(rhs().rows() == dec().rows());
-
- for (Index j=0; j<cols(); ++j)
- {
- Matrix<Scalar,MatrixType::RowsAtCompileTime,1> aux = dec().matrixU().adjoint() * rhs().col(j);
-
- for (Index i = 0; i < dec().singularValues().size(); ++i)
- {
- Scalar si = dec().singularValues().coeff(i);
- if(si == RealScalar(0))
- aux.coeffRef(i) = Scalar(0);
- else
- aux.coeffRef(i) /= si;
- }
- aux.tail(aux.size() - dec().singularValues().size()).setZero();
-
- const Index minsize = std::min(dec().rows(),dec().cols());
- dst.col(j).head(minsize) = aux.head(minsize);
- if(dec().cols()>dec().rows()) dst.col(j).tail(cols()-minsize).setZero();
- dst.col(j) = dec().matrixV() * dst.col(j);
- }
- }
-};
-
-/** Computes the polar decomposition of the matrix, as a product unitary x positive.
- *
- * If either pointer is zero, the corresponding computation is skipped.
- *
- * Only for square matrices.
- *
- * \sa computePositiveUnitary(), computeRotationScaling()
- */
-template<typename MatrixType>
-template<typename UnitaryType, typename PositiveType>
-void SVD<MatrixType>::computeUnitaryPositive(UnitaryType *unitary,
- PositiveType *positive) const
-{
- ei_assert(m_isInitialized && "SVD is not initialized.");
- ei_assert(m_matU.cols() == m_matV.cols() && "Polar decomposition is only for square matrices");
- if(unitary) *unitary = m_matU * m_matV.adjoint();
- if(positive) *positive = m_matV * m_sigma.asDiagonal() * m_matV.adjoint();
-}
-
-/** Computes the polar decomposition of the matrix, as a product positive x unitary.
- *
- * If either pointer is zero, the corresponding computation is skipped.
- *
- * Only for square matrices.
- *
- * \sa computeUnitaryPositive(), computeRotationScaling()
- */
-template<typename MatrixType>
-template<typename UnitaryType, typename PositiveType>
-void SVD<MatrixType>::computePositiveUnitary(UnitaryType *positive,
- PositiveType *unitary) const
-{
- ei_assert(m_isInitialized && "SVD is not initialized.");
- ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
- if(unitary) *unitary = m_matU * m_matV.adjoint();
- if(positive) *positive = m_matU * m_sigma.asDiagonal() * m_matU.adjoint();
-}
-
-/** decomposes the matrix as a product rotation x scaling, the scaling being
- * not necessarily positive.
- *
- * If either pointer is zero, the corresponding computation is skipped.
- *
- * This method requires the Geometry module.
- *
- * \sa computeScalingRotation(), computeUnitaryPositive()
- */
-template<typename MatrixType>
-template<typename RotationType, typename ScalingType>
-void SVD<MatrixType>::computeRotationScaling(RotationType *rotation, ScalingType *scaling) const
-{
- ei_assert(m_isInitialized && "SVD is not initialized.");
- ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
- Scalar x = (m_matU * m_matV.adjoint()).determinant(); // so x has absolute value 1
- Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> sv(m_sigma);
- sv.coeffRef(0) *= x;
- if(scaling) scaling->lazyAssign(m_matV * sv.asDiagonal() * m_matV.adjoint());
- if(rotation)
- {
- MatrixType m(m_matU);
- m.col(0) /= x;
- rotation->lazyAssign(m * m_matV.adjoint());
- }
-}
-
-/** decomposes the matrix as a product scaling x rotation, the scaling being
- * not necessarily positive.
- *
- * If either pointer is zero, the corresponding computation is skipped.
- *
- * This method requires the Geometry module.
- *
- * \sa computeRotationScaling(), computeUnitaryPositive()
- */
-template<typename MatrixType>
-template<typename ScalingType, typename RotationType>
-void SVD<MatrixType>::computeScalingRotation(ScalingType *scaling, RotationType *rotation) const
-{
- ei_assert(m_isInitialized && "SVD is not initialized.");
- ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
- Scalar x = (m_matU * m_matV.adjoint()).determinant(); // so x has absolute value 1
- Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> sv(m_sigma);
- sv.coeffRef(0) *= x;
- if(scaling) scaling->lazyAssign(m_matU * sv.asDiagonal() * m_matU.adjoint());
- if(rotation)
- {
- MatrixType m(m_matU);
- m.col(0) /= x;
- rotation->lazyAssign(m * m_matV.adjoint());
- }
-}
-
-
-/** \svd_module
- * \returns the SVD decomposition of \c *this
- */
-template<typename Derived>
-inline SVD<typename MatrixBase<Derived>::PlainObject>
-MatrixBase<Derived>::svd() const
-{
- return SVD<PlainObject>(derived());
-}
-
-#endif // EIGEN_SVD_H
diff --git a/Eigen/src/SVD/UpperBidiagonalization.h b/Eigen/src/SVD/UpperBidiagonalization.h
index 1e1355b52..c9ba325ed 100644
--- a/Eigen/src/SVD/UpperBidiagonalization.h
+++ b/Eigen/src/SVD/UpperBidiagonalization.h
@@ -33,7 +33,7 @@ template<typename _MatrixType> class UpperBidiagonalization
enum {
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
- ColsAtCompileTimeMinusOne = ei_decrement_size<ColsAtCompileTime>::ret
+ ColsAtCompileTimeMinusOne = internal::decrement_size<ColsAtCompileTime>::ret
};
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
@@ -45,7 +45,7 @@ template<typename _MatrixType> class UpperBidiagonalization
typedef Matrix<Scalar, ColsAtCompileTimeMinusOne, 1> SuperDiagVectorType;
typedef HouseholderSequence<
MatrixType,
- CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Diagonal<MatrixType,0> >
+ CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Diagonal<MatrixType,0> >
> HouseholderUSequenceType;
typedef HouseholderSequence<
MatrixType,
@@ -76,13 +76,13 @@ template<typename _MatrixType> class UpperBidiagonalization
HouseholderUSequenceType householderU() const
{
- ei_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
return HouseholderUSequenceType(m_householder, m_householder.diagonal().conjugate());
}
HouseholderVSequenceType householderV() // const here gives nasty errors and i'm lazy
{
- ei_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
+ eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
return HouseholderVSequenceType(m_householder, m_householder.template diagonal<1>(),
false, m_householder.cols()-1, 1);
}
@@ -99,7 +99,7 @@ UpperBidiagonalization<_MatrixType>& UpperBidiagonalization<_MatrixType>::comput
Index rows = matrix.rows();
Index cols = matrix.cols();
- ei_assert(rows >= cols && "UpperBidiagonalization is only for matrices satisfying rows>=cols.");
+ eigen_assert(rows >= cols && "UpperBidiagonalization is only for matrices satisfying rows>=cols.");
m_householder = matrix;
diff --git a/Eigen/src/Sparse/AmbiVector.h b/Eigen/src/Sparse/AmbiVector.h
index f2e92f93c..01c93fbd7 100644
--- a/Eigen/src/Sparse/AmbiVector.h
+++ b/Eigen/src/Sparse/AmbiVector.h
@@ -183,7 +183,7 @@ void AmbiVector<_Scalar,_Index>::setZero()
}
else
{
- ei_assert(m_mode==IsSparse);
+ eigen_assert(m_mode==IsSparse);
m_llSize = 0;
m_llStart = -1;
}
@@ -198,7 +198,7 @@ _Scalar& AmbiVector<_Scalar,_Index>::coeffRef(_Index i)
{
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
// TODO factorize the following code to reduce code generation
- ei_assert(m_mode==IsSparse);
+ eigen_assert(m_mode==IsSparse);
if (m_llSize==0)
{
// this is the first element
@@ -225,7 +225,7 @@ _Scalar& AmbiVector<_Scalar,_Index>::coeffRef(_Index i)
else
{
Index nextel = llElements[m_llCurrent].next;
- ei_assert(i>=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index");
+ eigen_assert(i>=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index");
while (nextel >= 0 && llElements[nextel].index<=i)
{
m_llCurrent = nextel;
@@ -244,7 +244,7 @@ _Scalar& AmbiVector<_Scalar,_Index>::coeffRef(_Index i)
reallocateSparse();
llElements = reinterpret_cast<ListEl*>(m_buffer);
}
- ei_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
+ eigen_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
// let's insert a new coefficient
ListEl& el = llElements[m_llSize];
el.value = Scalar(0);
@@ -266,7 +266,7 @@ _Scalar& AmbiVector<_Scalar,_Index>::coeff(_Index i)
else
{
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
- ei_assert(m_mode==IsSparse);
+ eigen_assert(m_mode==IsSparse);
if ((m_llSize==0) || (i<llElements[m_llStart].index))
{
return m_zero;
@@ -315,7 +315,7 @@ class AmbiVector<_Scalar,_Index>::Iterator
{
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
m_currentEl = m_vector.m_llStart;
- while (m_currentEl>=0 && ei_abs(llElements[m_currentEl].value)<m_epsilon)
+ while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<m_epsilon)
m_currentEl = llElements[m_currentEl].next;
if (m_currentEl<0)
{
@@ -341,7 +341,7 @@ class AmbiVector<_Scalar,_Index>::Iterator
{
do {
++m_cachedIndex;
- } while (m_cachedIndex<m_vector.m_end && ei_abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
+ } while (m_cachedIndex<m_vector.m_end && internal::abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
if (m_cachedIndex<m_vector.m_end)
m_cachedValue = m_vector.m_buffer[m_cachedIndex];
else
@@ -352,7 +352,7 @@ class AmbiVector<_Scalar,_Index>::Iterator
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
do {
m_currentEl = llElements[m_currentEl].next;
- } while (m_currentEl>=0 && ei_abs(llElements[m_currentEl].value)<m_epsilon);
+ } while (m_currentEl>=0 && internal::abs(llElements[m_currentEl].value)<m_epsilon);
if (m_currentEl<0)
{
m_cachedIndex = -1;
diff --git a/Eigen/src/Sparse/CompressedStorage.h b/Eigen/src/Sparse/CompressedStorage.h
index 8164b610f..1c36a2632 100644
--- a/Eigen/src/Sparse/CompressedStorage.h
+++ b/Eigen/src/Sparse/CompressedStorage.h
@@ -200,7 +200,7 @@ class CompressedStorage
size_t n = size();
for (size_t i=0; i<n; ++i)
{
- if (!ei_isMuchSmallerThan(value(i), reference, epsilon))
+ if (!internal::isMuchSmallerThan(value(i), reference, epsilon))
{
value(k) = value(i);
index(k) = index(i);
diff --git a/Eigen/src/Sparse/CoreIterators.h b/Eigen/src/Sparse/CoreIterators.h
index 07fd3f3ad..b4beaeee6 100644
--- a/Eigen/src/Sparse/CoreIterators.h
+++ b/Eigen/src/Sparse/CoreIterators.h
@@ -37,6 +37,7 @@
// generic version for dense matrix and expressions
template<typename Derived> class DenseBase<Derived>::InnerIterator
{
+ protected:
typedef typename Derived::Scalar Scalar;
typedef typename Derived::Index Index;
diff --git a/Eigen/src/Sparse/DynamicSparseMatrix.h b/Eigen/src/Sparse/DynamicSparseMatrix.h
index 620f09289..88ad85f84 100644
--- a/Eigen/src/Sparse/DynamicSparseMatrix.h
+++ b/Eigen/src/Sparse/DynamicSparseMatrix.h
@@ -42,8 +42,10 @@
*
* \see SparseMatrix
*/
-template<typename _Scalar, int _Flags, typename _Index>
-struct ei_traits<DynamicSparseMatrix<_Scalar, _Flags, _Index> >
+
+namespace internal {
+template<typename _Scalar, int _Options, typename _Index>
+struct traits<DynamicSparseMatrix<_Scalar, _Options, _Index> >
{
typedef _Scalar Scalar;
typedef _Index Index;
@@ -54,15 +56,16 @@ struct ei_traits<DynamicSparseMatrix<_Scalar, _Flags, _Index> >
ColsAtCompileTime = Dynamic,
MaxRowsAtCompileTime = Dynamic,
MaxColsAtCompileTime = Dynamic,
- Flags = _Flags | NestByRefBit | LvalueBit,
+ Flags = _Options | NestByRefBit | LvalueBit,
CoeffReadCost = NumTraits<Scalar>::ReadCost,
SupportedAccessPatterns = OuterRandomAccessPattern
};
};
+}
-template<typename _Scalar, int _Flags, typename _Index>
+template<typename _Scalar, int _Options, typename _Index>
class DynamicSparseMatrix
- : public SparseMatrixBase<DynamicSparseMatrix<_Scalar, _Flags, _Index> >
+ : public SparseMatrixBase<DynamicSparseMatrix<_Scalar, _Options, _Index> >
{
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(DynamicSparseMatrix)
@@ -71,6 +74,9 @@ class DynamicSparseMatrix
// EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(DynamicSparseMatrix, -=)
typedef MappedSparseMatrix<Scalar,Flags> Map;
using Base::IsRowMajor;
+ enum {
+ Options = _Options
+ };
protected:
@@ -158,8 +164,8 @@ class DynamicSparseMatrix
/** \sa insertBack */
inline Scalar& insertBackByOuterInner(Index outer, Index inner)
{
- ei_assert(outer<Index(m_data.size()) && inner<m_innerSize && "out of range");
- ei_assert(((m_data[outer].size()==0) || (m_data[outer].index(m_data[outer].size()-1)<inner))
+ eigen_assert(outer<Index(m_data.size()) && inner<m_innerSize && "out of range");
+ eigen_assert(((m_data[outer].size()==0) || (m_data[outer].index(m_data[outer].size()-1)<inner))
&& "wrong sorted insertion");
m_data[outer].append(0, inner);
return m_data[outer].value(m_data[outer].size()-1);
@@ -228,7 +234,7 @@ class DynamicSparseMatrix
inline DynamicSparseMatrix()
: m_innerSize(0), m_data(0)
{
- ei_assert(innerSize()==0 && outerSize()==0);
+ eigen_assert(innerSize()==0 && outerSize()==0);
}
inline DynamicSparseMatrix(Index rows, Index cols)
@@ -322,10 +328,10 @@ class DynamicSparseMatrix
EIGEN_DEPRECATED void endFill() {}
};
-template<typename Scalar, int _Flags, typename _Index>
-class DynamicSparseMatrix<Scalar,_Flags,_Index>::InnerIterator : public SparseVector<Scalar,_Flags>::InnerIterator
+template<typename Scalar, int _Options, typename _Index>
+class DynamicSparseMatrix<Scalar,_Options,_Index>::InnerIterator : public SparseVector<Scalar,_Options>::InnerIterator
{
- typedef typename SparseVector<Scalar,_Flags>::InnerIterator Base;
+ typedef typename SparseVector<Scalar,_Options>::InnerIterator Base;
public:
InnerIterator(const DynamicSparseMatrix& mat, Index outer)
: Base(mat.m_data[outer]), m_outer(outer)
diff --git a/Eigen/src/Sparse/MappedSparseMatrix.h b/Eigen/src/Sparse/MappedSparseMatrix.h
index 941290a35..31a431fb2 100644
--- a/Eigen/src/Sparse/MappedSparseMatrix.h
+++ b/Eigen/src/Sparse/MappedSparseMatrix.h
@@ -34,9 +34,11 @@
* See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
*
*/
+namespace internal {
template<typename _Scalar, int _Flags, typename _Index>
-struct ei_traits<MappedSparseMatrix<_Scalar, _Flags, _Index> > : ei_traits<SparseMatrix<_Scalar, _Flags, _Index> >
+struct traits<MappedSparseMatrix<_Scalar, _Flags, _Index> > : traits<SparseMatrix<_Scalar, _Flags, _Index> >
{};
+}
template<typename _Scalar, int _Flags, typename _Index>
class MappedSparseMatrix
@@ -101,11 +103,11 @@ class MappedSparseMatrix
Index start = m_outerIndex[outer];
Index end = m_outerIndex[outer+1];
- ei_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
- ei_assert(end>start && "coeffRef cannot be called on a zero coefficient");
+ eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
+ eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end],inner);
const Index id = r-&m_innerIndices[0];
- ei_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
+ eigen_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
return m_values[id];
}
diff --git a/Eigen/src/Sparse/SparseBlock.h b/Eigen/src/Sparse/SparseBlock.h
index dde442caa..b2ff4b8f0 100644
--- a/Eigen/src/Sparse/SparseBlock.h
+++ b/Eigen/src/Sparse/SparseBlock.h
@@ -25,12 +25,13 @@
#ifndef EIGEN_SPARSE_BLOCK_H
#define EIGEN_SPARSE_BLOCK_H
+namespace internal {
template<typename MatrixType, int Size>
-struct ei_traits<SparseInnerVectorSet<MatrixType, Size> >
+struct traits<SparseInnerVectorSet<MatrixType, Size> >
{
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
- typedef typename ei_traits<MatrixType>::Index Index;
- typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
+ typedef typename traits<MatrixType>::Scalar Scalar;
+ typedef typename traits<MatrixType>::Index Index;
+ typedef typename traits<MatrixType>::StorageKind StorageKind;
typedef MatrixXpr XprKind;
enum {
IsRowMajor = (int(MatrixType::Flags)&RowMajorBit)==RowMajorBit,
@@ -42,14 +43,15 @@ struct ei_traits<SparseInnerVectorSet<MatrixType, Size> >
CoeffReadCost = MatrixType::CoeffReadCost
};
};
+} // end namespace internal
template<typename MatrixType, int Size>
-class SparseInnerVectorSet : ei_no_assignment_operator,
+class SparseInnerVectorSet : internal::no_assignment_operator,
public SparseMatrixBase<SparseInnerVectorSet<MatrixType, Size> >
{
public:
- enum { IsRowMajor = ei_traits<SparseInnerVectorSet>::IsRowMajor };
+ enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
class InnerIterator: public MatrixType::InnerIterator
@@ -67,14 +69,14 @@ class SparseInnerVectorSet : ei_no_assignment_operator,
inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
: m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
{
- ei_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
+ eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
}
inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
: m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
{
- ei_assert(Size!=Dynamic);
- ei_assert( (outer>=0) && (outer<matrix.outerSize()) );
+ eigen_assert(Size!=Dynamic);
+ eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
}
// template<typename OtherDerived>
@@ -96,7 +98,7 @@ class SparseInnerVectorSet : ei_no_assignment_operator,
const typename MatrixType::Nested m_matrix;
Index m_outerStart;
- const ei_variable_if_dynamic<Index, Size> m_outerSize;
+ const internal::variable_if_dynamic<Index, Size> m_outerSize;
};
/***************************************************************************
@@ -110,7 +112,7 @@ class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
typedef DynamicSparseMatrix<_Scalar, _Options> MatrixType;
public:
- enum { IsRowMajor = ei_traits<SparseInnerVectorSet>::IsRowMajor };
+ enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
class InnerIterator: public MatrixType::InnerIterator
@@ -128,14 +130,14 @@ class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
: m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
{
- ei_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
+ eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
}
inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
: m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
{
- ei_assert(Size!=Dynamic);
- ei_assert( (outer>=0) && (outer<matrix.outerSize()) );
+ eigen_assert(Size!=Dynamic);
+ eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
}
template<typename OtherDerived>
@@ -175,7 +177,7 @@ class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
const Scalar& lastCoeff() const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(SparseInnerVectorSet);
- ei_assert(m_matrix.data()[m_outerStart].size()>0);
+ eigen_assert(m_matrix.data()[m_outerStart].size()>0);
return m_matrix.data()[m_outerStart].vale(m_matrix.data()[m_outerStart].size()-1);
}
@@ -192,7 +194,7 @@ class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
const typename MatrixType::Nested m_matrix;
Index m_outerStart;
- const ei_variable_if_dynamic<Index, Size> m_outerSize;
+ const internal::variable_if_dynamic<Index, Size> m_outerSize;
};
@@ -208,7 +210,7 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
typedef SparseMatrix<_Scalar, _Options> MatrixType;
public:
- enum { IsRowMajor = ei_traits<SparseInnerVectorSet>::IsRowMajor };
+ enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseInnerVectorSet)
class InnerIterator: public MatrixType::InnerIterator
@@ -226,20 +228,20 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
inline SparseInnerVectorSet(const MatrixType& matrix, Index outerStart, Index outerSize)
: m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
{
- ei_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
+ eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
}
inline SparseInnerVectorSet(const MatrixType& matrix, Index outer)
: m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
{
- ei_assert(Size==1);
- ei_assert( (outer>=0) && (outer<matrix.outerSize()) );
+ eigen_assert(Size==1);
+ eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
}
template<typename OtherDerived>
inline SparseInnerVectorSet& operator=(const SparseMatrixBase<OtherDerived>& other)
{
- typedef typename ei_cleantype<typename MatrixType::Nested>::type _NestedMatrixType;
+ typedef typename internal::remove_all<typename MatrixType::Nested>::type _NestedMatrixType;
_NestedMatrixType& matrix = const_cast<_NestedMatrixType&>(m_matrix);;
// This assignement is slow if this vector set not empty
// and/or it is not at the end of the nonzeros of the underlying matrix.
@@ -339,7 +341,7 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
const Scalar& lastCoeff() const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(SparseInnerVectorSet);
- ei_assert(nonZeros()>0);
+ eigen_assert(nonZeros()>0);
return m_matrix._valuePtr()[m_matrix._outerIndexPtr()[m_outerStart+1]-1];
}
@@ -356,7 +358,7 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
const typename MatrixType::Nested m_matrix;
Index m_outerStart;
- const ei_variable_if_dynamic<Index, Size> m_outerSize;
+ const internal::variable_if_dynamic<Index, Size> m_outerSize;
};
diff --git a/Eigen/src/Sparse/SparseCwiseBinaryOp.h b/Eigen/src/Sparse/SparseCwiseBinaryOp.h
index a4fb7ea86..cde5bbc03 100644
--- a/Eigen/src/Sparse/SparseCwiseBinaryOp.h
+++ b/Eigen/src/Sparse/SparseCwiseBinaryOp.h
@@ -42,12 +42,21 @@
// 4 - dense op dense product dense
// generic dense
-template<> struct ei_promote_storage_type<Dense,Sparse>
+namespace internal {
+
+template<> struct promote_storage_type<Dense,Sparse>
{ typedef Sparse ret; };
-template<> struct ei_promote_storage_type<Sparse,Dense>
+template<> struct promote_storage_type<Sparse,Dense>
{ typedef Sparse ret; };
+template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
+ typename _LhsStorageMode = typename traits<Lhs>::StorageKind,
+ typename _RhsStorageMode = typename traits<Rhs>::StorageKind>
+class sparse_cwise_binary_op_inner_iterator_selector;
+
+} // end namespace internal
+
template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
: public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
@@ -58,18 +67,13 @@ class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
};
-template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
- typename _LhsStorageMode = typename ei_traits<Lhs>::StorageKind,
- typename _RhsStorageMode = typename ei_traits<Rhs>::StorageKind>
-class ei_sparse_cwise_binary_op_inner_iterator_selector;
-
template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
- : public ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator>
+ : public internal::sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator>
{
public:
typedef typename Lhs::Index Index;
- typedef ei_sparse_cwise_binary_op_inner_iterator_selector<
+ typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
BinaryOp,Lhs,Rhs, InnerIterator> Base;
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, Index outer)
@@ -81,26 +85,28 @@ class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
* Implementation of inner-iterators
***************************************************************************/
-// template<typename T> struct ei_func_is_conjunction { enum { ret = false }; };
-// template<typename T> struct ei_func_is_conjunction<ei_scalar_product_op<T> > { enum { ret = true }; };
+// template<typename T> struct internal::func_is_conjunction { enum { ret = false }; };
+// template<typename T> struct internal::func_is_conjunction<internal::scalar_product_op<T> > { enum { ret = true }; };
+
+// TODO generalize the internal::scalar_product_op specialization to all conjunctions if any !
-// TODO generalize the ei_scalar_product_op specialization to all conjunctions if any !
+namespace internal {
// sparse - sparse (generic)
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived>
-class ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, Sparse, Sparse>
+class sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, Sparse, Sparse>
{
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr;
- typedef typename ei_traits<CwiseBinaryXpr>::Scalar Scalar;
- typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
- typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+ typedef typename traits<CwiseBinaryXpr>::Scalar Scalar;
+ typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+ typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
typedef typename _LhsNested::InnerIterator LhsIterator;
typedef typename _RhsNested::InnerIterator RhsIterator;
typedef typename Lhs::Index Index;
public:
- EIGEN_STRONG_INLINE ei_sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+ EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
: m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
{
this->operator++();
@@ -153,19 +159,19 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Deri
// sparse - sparse (product)
template<typename T, typename Lhs, typename Rhs, typename Derived>
-class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Sparse>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Sparse>
{
- typedef ei_scalar_product_op<T> BinaryFunc;
+ typedef scalar_product_op<T> BinaryFunc;
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
typedef typename CwiseBinaryXpr::Scalar Scalar;
- typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+ typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
typedef typename _LhsNested::InnerIterator LhsIterator;
- typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+ typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
typedef typename _RhsNested::InnerIterator RhsIterator;
typedef typename Lhs::Index Index;
public:
- EIGEN_STRONG_INLINE ei_sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+ EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
: m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor())
{
while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
@@ -207,19 +213,19 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
// sparse - dense (product)
template<typename T, typename Lhs, typename Rhs, typename Derived>
-class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Dense>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Dense>
{
- typedef ei_scalar_product_op<T> BinaryFunc;
+ typedef scalar_product_op<T> BinaryFunc;
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
typedef typename CwiseBinaryXpr::Scalar Scalar;
- typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
- typedef typename ei_traits<CwiseBinaryXpr>::RhsNested RhsNested;
+ typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
+ typedef typename traits<CwiseBinaryXpr>::RhsNested RhsNested;
typedef typename _LhsNested::InnerIterator LhsIterator;
typedef typename Lhs::Index Index;
enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit };
public:
- EIGEN_STRONG_INLINE ei_sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+ EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
: m_rhs(xpr.rhs()), m_lhsIter(xpr.lhs(),outer), m_functor(xpr.functor()), m_outer(outer)
{}
@@ -248,19 +254,19 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
// sparse - dense (product)
template<typename T, typename Lhs, typename Rhs, typename Derived>
-class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, Dense, Sparse>
+class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Dense, Sparse>
{
- typedef ei_scalar_product_op<T> BinaryFunc;
+ typedef scalar_product_op<T> BinaryFunc;
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
typedef typename CwiseBinaryXpr::Scalar Scalar;
- typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
+ typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
typedef typename _RhsNested::InnerIterator RhsIterator;
typedef typename Lhs::Index Index;
enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit };
public:
- EIGEN_STRONG_INLINE ei_sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
+ EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer)
: m_xpr(xpr), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()), m_outer(outer)
{}
@@ -286,6 +292,7 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
const Index m_outer;
};
+} // end namespace internal
/***************************************************************************
* Implementation of SparseMatrixBase and SparseCwise functions/operators
@@ -293,11 +300,11 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
// template<typename Derived>
// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>,
+// EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_difference_op<typename internal::traits<Derived>::Scalar>,
// Derived, OtherDerived>
// SparseMatrixBase<Derived>::operator-(const SparseMatrixBase<OtherDerived> &other) const
// {
-// return CwiseBinaryOp<ei_scalar_difference_op<Scalar>,
+// return CwiseBinaryOp<internal::scalar_difference_op<Scalar>,
// Derived, OtherDerived>(derived(), other.derived());
// }
@@ -311,10 +318,10 @@ SparseMatrixBase<Derived>::operator-=(const SparseMatrixBase<OtherDerived> &othe
// template<typename Derived>
// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
+// EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
// SparseMatrixBase<Derived>::operator+(const SparseMatrixBase<OtherDerived> &other) const
// {
-// return CwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
+// return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
// }
template<typename Derived>
@@ -343,18 +350,18 @@ SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) c
// template<typename ExpressionType>
// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
+// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
// SparseCwise<ExpressionType>::operator/(const SparseMatrixBase<OtherDerived> &other) const
// {
-// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)(_expression(), other.derived());
+// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
// }
//
// template<typename ExpressionType>
// template<typename OtherDerived>
-// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
+// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
// SparseCwise<ExpressionType>::operator/(const MatrixBase<OtherDerived> &other) const
// {
-// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)(_expression(), other.derived());
+// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
// }
// template<typename ExpressionType>
diff --git a/Eigen/src/Sparse/SparseCwiseUnaryOp.h b/Eigen/src/Sparse/SparseCwiseUnaryOp.h
index 514f1c00b..aa068835f 100644
--- a/Eigen/src/Sparse/SparseCwiseUnaryOp.h
+++ b/Eigen/src/Sparse/SparseCwiseUnaryOp.h
@@ -26,15 +26,15 @@
#define EIGEN_SPARSE_CWISE_UNARY_OP_H
// template<typename UnaryOp, typename MatrixType>
-// struct ei_traits<SparseCwiseUnaryOp<UnaryOp, MatrixType> > : ei_traits<MatrixType>
+// struct internal::traits<SparseCwiseUnaryOp<UnaryOp, MatrixType> > : internal::traits<MatrixType>
// {
-// typedef typename ei_result_of<
+// typedef typename internal::result_of<
// UnaryOp(typename MatrixType::Scalar)
// >::type Scalar;
// typedef typename MatrixType::Nested MatrixTypeNested;
-// typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
+// typedef typename internal::remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
// enum {
-// CoeffReadCost = _MatrixTypeNested::CoeffReadCost + ei_functor_traits<UnaryOp>::Cost
+// CoeffReadCost = _MatrixTypeNested::CoeffReadCost + internal::functor_traits<UnaryOp>::Cost
// };
// };
@@ -45,7 +45,7 @@ class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>
public:
class InnerIterator;
-// typedef typename ei_unref<LhsNested>::type _LhsNested;
+// typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived;
EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
@@ -55,7 +55,7 @@ template<typename UnaryOp, typename MatrixType>
class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
{
typedef typename CwiseUnaryOpImpl::Scalar Scalar;
- typedef typename ei_traits<Derived>::_XprTypeNested _MatrixTypeNested;
+ typedef typename internal::traits<Derived>::_XprTypeNested _MatrixTypeNested;
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
typedef typename MatrixType::Index Index;
public:
@@ -87,7 +87,7 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>
public:
class InnerIterator;
-// typedef typename ei_unref<LhsNested>::type _LhsNested;
+// typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
@@ -97,7 +97,7 @@ template<typename ViewOp, typename MatrixType>
class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
{
typedef typename CwiseUnaryViewImpl::Scalar Scalar;
- typedef typename ei_traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
+ typedef typename internal::traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
typedef typename MatrixType::Index Index;
public:
diff --git a/Eigen/src/Sparse/SparseDenseProduct.h b/Eigen/src/Sparse/SparseDenseProduct.h
index 0489c68db..8cc39c8fb 100644
--- a/Eigen/src/Sparse/SparseDenseProduct.h
+++ b/Eigen/src/Sparse/SparseDenseProduct.h
@@ -45,26 +45,28 @@ template<typename Lhs, typename Rhs> struct DenseSparseProductReturnType<Lhs,Rhs
typedef SparseDenseOuterProduct<Rhs,Lhs,true> Type;
};
+namespace internal {
+
template<typename Lhs, typename Rhs, bool Tr>
-struct ei_traits<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
+struct traits<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
{
typedef Sparse StorageKind;
- typedef typename ei_scalar_product_traits<typename ei_traits<Lhs>::Scalar,
- typename ei_traits<Rhs>::Scalar>::ReturnType Scalar;
+ typedef typename scalar_product_traits<typename traits<Lhs>::Scalar,
+ typename traits<Rhs>::Scalar>::ReturnType Scalar;
typedef typename Lhs::Index Index;
typedef typename Lhs::Nested LhsNested;
typedef typename Rhs::Nested RhsNested;
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
+ typedef typename remove_all<LhsNested>::type _LhsNested;
+ typedef typename remove_all<RhsNested>::type _RhsNested;
enum {
- LhsCoeffReadCost = ei_traits<_LhsNested>::CoeffReadCost,
- RhsCoeffReadCost = ei_traits<_RhsNested>::CoeffReadCost,
+ LhsCoeffReadCost = traits<_LhsNested>::CoeffReadCost,
+ RhsCoeffReadCost = traits<_RhsNested>::CoeffReadCost,
- RowsAtCompileTime = Tr ? int(ei_traits<Rhs>::RowsAtCompileTime) : int(ei_traits<Lhs>::RowsAtCompileTime),
- ColsAtCompileTime = Tr ? int(ei_traits<Lhs>::ColsAtCompileTime) : int(ei_traits<Rhs>::ColsAtCompileTime),
- MaxRowsAtCompileTime = Tr ? int(ei_traits<Rhs>::MaxRowsAtCompileTime) : int(ei_traits<Lhs>::MaxRowsAtCompileTime),
- MaxColsAtCompileTime = Tr ? int(ei_traits<Lhs>::MaxColsAtCompileTime) : int(ei_traits<Rhs>::MaxColsAtCompileTime),
+ RowsAtCompileTime = Tr ? int(traits<Rhs>::RowsAtCompileTime) : int(traits<Lhs>::RowsAtCompileTime),
+ ColsAtCompileTime = Tr ? int(traits<Lhs>::ColsAtCompileTime) : int(traits<Rhs>::ColsAtCompileTime),
+ MaxRowsAtCompileTime = Tr ? int(traits<Rhs>::MaxRowsAtCompileTime) : int(traits<Lhs>::MaxRowsAtCompileTime),
+ MaxColsAtCompileTime = Tr ? int(traits<Lhs>::MaxColsAtCompileTime) : int(traits<Rhs>::MaxColsAtCompileTime),
Flags = Tr ? RowMajorBit : 0,
@@ -72,6 +74,8 @@ struct ei_traits<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
};
};
+} // end namespace internal
+
template<typename Lhs, typename Rhs, bool Tr>
class SparseDenseOuterProduct
: public SparseMatrixBase<SparseDenseOuterProduct<Lhs,Rhs,Tr> >
@@ -80,7 +84,7 @@ class SparseDenseOuterProduct
typedef SparseMatrixBase<SparseDenseOuterProduct> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(SparseDenseOuterProduct)
- typedef ei_traits<SparseDenseOuterProduct> Traits;
+ typedef internal::traits<SparseDenseOuterProduct> Traits;
private:
@@ -137,13 +141,15 @@ class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNes
Scalar m_factor;
};
+namespace internal {
template<typename Lhs, typename Rhs>
-struct ei_traits<SparseTimeDenseProduct<Lhs,Rhs> >
- : ei_traits<ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs> >
+struct traits<SparseTimeDenseProduct<Lhs,Rhs> >
+ : traits<ProductBase<SparseTimeDenseProduct<Lhs,Rhs>, Lhs, Rhs> >
{
typedef Dense StorageKind;
typedef MatrixXpr XprKind;
};
+} // end namespace internal
template<typename Lhs, typename Rhs>
class SparseTimeDenseProduct
@@ -157,8 +163,8 @@ class SparseTimeDenseProduct
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
{
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
+ typedef typename internal::remove_all<Lhs>::type _Lhs;
+ typedef typename internal::remove_all<Rhs>::type _Rhs;
typedef typename _Lhs::InnerIterator LhsInnerIterator;
enum { LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit };
for(Index j=0; j<m_lhs.outerSize(); ++j)
@@ -180,12 +186,14 @@ class SparseTimeDenseProduct
// dense = dense * sparse
+namespace internal {
template<typename Lhs, typename Rhs>
-struct ei_traits<DenseTimeSparseProduct<Lhs,Rhs> >
- : ei_traits<ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs> >
+struct traits<DenseTimeSparseProduct<Lhs,Rhs> >
+ : traits<ProductBase<DenseTimeSparseProduct<Lhs,Rhs>, Lhs, Rhs> >
{
typedef Dense StorageKind;
};
+} // end namespace internal
template<typename Lhs, typename Rhs>
class DenseTimeSparseProduct
@@ -199,7 +207,7 @@ class DenseTimeSparseProduct
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
{
- typedef typename ei_cleantype<Rhs>::type _Rhs;
+ typedef typename internal::remove_all<Rhs>::type _Rhs;
typedef typename _Rhs::InnerIterator RhsInnerIterator;
enum { RhsIsRowMajor = (_Rhs::Flags&RowMajorBit)==RowMajorBit };
for(Index j=0; j<m_rhs.outerSize(); ++j)
diff --git a/Eigen/src/Sparse/SparseDiagonalProduct.h b/Eigen/src/Sparse/SparseDiagonalProduct.h
index 1e29143af..6c0a03363 100644
--- a/Eigen/src/Sparse/SparseDiagonalProduct.h
+++ b/Eigen/src/Sparse/SparseDiagonalProduct.h
@@ -37,14 +37,16 @@
// for that particular case
// The two other cases are symmetric.
+namespace internal {
+
template<typename Lhs, typename Rhs>
-struct ei_traits<SparseDiagonalProduct<Lhs, Rhs> >
+struct traits<SparseDiagonalProduct<Lhs, Rhs> >
{
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
+ typedef typename remove_all<Lhs>::type _Lhs;
+ typedef typename remove_all<Rhs>::type _Rhs;
typedef typename _Lhs::Scalar Scalar;
- typedef typename ei_promote_index_type<typename ei_traits<Lhs>::Index,
- typename ei_traits<Rhs>::Index>::type Index;
+ typedef typename promote_index_type<typename traits<Lhs>::Index,
+ typename traits<Rhs>::Index>::type Index;
typedef Sparse StorageKind;
typedef MatrixXpr XprKind;
enum {
@@ -54,7 +56,7 @@ struct ei_traits<SparseDiagonalProduct<Lhs, Rhs> >
MaxRowsAtCompileTime = _Lhs::MaxRowsAtCompileTime,
MaxColsAtCompileTime = _Rhs::MaxColsAtCompileTime,
- SparseFlags = ei_is_diagonal<_Lhs>::ret ? int(_Rhs::Flags) : int(_Lhs::Flags),
+ SparseFlags = is_diagonal<_Lhs>::ret ? int(_Rhs::Flags) : int(_Lhs::Flags),
Flags = (SparseFlags&RowMajorBit),
CoeffReadCost = Dynamic
};
@@ -62,37 +64,39 @@ struct ei_traits<SparseDiagonalProduct<Lhs, Rhs> >
enum {SDP_IsDiagonal, SDP_IsSparseRowMajor, SDP_IsSparseColMajor};
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType, int RhsMode, int LhsMode>
-class ei_sparse_diagonal_product_inner_iterator_selector;
+class sparse_diagonal_product_inner_iterator_selector;
+
+} // end namespace internal
template<typename Lhs, typename Rhs>
class SparseDiagonalProduct
: public SparseMatrixBase<SparseDiagonalProduct<Lhs,Rhs> >,
- ei_no_assignment_operator
+ internal::no_assignment_operator
{
typedef typename Lhs::Nested LhsNested;
typedef typename Rhs::Nested RhsNested;
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
+ typedef typename internal::remove_all<LhsNested>::type _LhsNested;
+ typedef typename internal::remove_all<RhsNested>::type _RhsNested;
enum {
- LhsMode = ei_is_diagonal<_LhsNested>::ret ? SDP_IsDiagonal
- : (_LhsNested::Flags&RowMajorBit) ? SDP_IsSparseRowMajor : SDP_IsSparseColMajor,
- RhsMode = ei_is_diagonal<_RhsNested>::ret ? SDP_IsDiagonal
- : (_RhsNested::Flags&RowMajorBit) ? SDP_IsSparseRowMajor : SDP_IsSparseColMajor
+ LhsMode = internal::is_diagonal<_LhsNested>::ret ? internal::SDP_IsDiagonal
+ : (_LhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor,
+ RhsMode = internal::is_diagonal<_RhsNested>::ret ? internal::SDP_IsDiagonal
+ : (_RhsNested::Flags&RowMajorBit) ? internal::SDP_IsSparseRowMajor : internal::SDP_IsSparseColMajor
};
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseDiagonalProduct)
- typedef ei_sparse_diagonal_product_inner_iterator_selector
+ typedef internal::sparse_diagonal_product_inner_iterator_selector
<_LhsNested,_RhsNested,SparseDiagonalProduct,LhsMode,RhsMode> InnerIterator;
EIGEN_STRONG_INLINE SparseDiagonalProduct(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{
- ei_assert(lhs.cols() == rhs.rows() && "invalid sparse matrix * diagonal matrix product");
+ eigen_assert(lhs.cols() == rhs.rows() && "invalid sparse matrix * diagonal matrix product");
}
EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); }
@@ -106,75 +110,78 @@ class SparseDiagonalProduct
RhsNested m_rhs;
};
+namespace internal {
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class ei_sparse_diagonal_product_inner_iterator_selector
+class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
- : public CwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator
+ : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator
{
- typedef typename CwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator Base;
+ typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
- inline ei_sparse_diagonal_product_inner_iterator_selector(
+ inline sparse_diagonal_product_inner_iterator_selector(
const SparseDiagonalProductType& expr, Index outer)
: Base(expr.rhs()*(expr.lhs().diagonal().coeff(outer)), outer)
{}
};
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class ei_sparse_diagonal_product_inner_iterator_selector
+class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseColMajor>
: public CwiseBinaryOp<
- ei_scalar_product_op<typename Lhs::Scalar>,
+ scalar_product_op<typename Lhs::Scalar>,
SparseInnerVectorSet<Rhs,1>,
typename Lhs::DiagonalVectorType>::InnerIterator
{
typedef typename CwiseBinaryOp<
- ei_scalar_product_op<typename Lhs::Scalar>,
+ scalar_product_op<typename Lhs::Scalar>,
SparseInnerVectorSet<Rhs,1>,
typename Lhs::DiagonalVectorType>::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
- inline ei_sparse_diagonal_product_inner_iterator_selector(
+ inline sparse_diagonal_product_inner_iterator_selector(
const SparseDiagonalProductType& expr, Index outer)
: Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0)
{}
};
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class ei_sparse_diagonal_product_inner_iterator_selector
+class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
- : public CwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator
+ : public CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator
{
- typedef typename CwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator Base;
+ typedef typename CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
- inline ei_sparse_diagonal_product_inner_iterator_selector(
+ inline sparse_diagonal_product_inner_iterator_selector(
const SparseDiagonalProductType& expr, Index outer)
: Base(expr.lhs()*expr.rhs().diagonal().coeff(outer), outer)
{}
};
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
-class ei_sparse_diagonal_product_inner_iterator_selector
+class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseRowMajor,SDP_IsDiagonal>
: public CwiseBinaryOp<
- ei_scalar_product_op<typename Rhs::Scalar>,
+ scalar_product_op<typename Rhs::Scalar>,
SparseInnerVectorSet<Lhs,1>,
Transpose<typename Rhs::DiagonalVectorType> >::InnerIterator
{
typedef typename CwiseBinaryOp<
- ei_scalar_product_op<typename Rhs::Scalar>,
+ scalar_product_op<typename Rhs::Scalar>,
SparseInnerVectorSet<Lhs,1>,
Transpose<typename Rhs::DiagonalVectorType> >::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
- inline ei_sparse_diagonal_product_inner_iterator_selector(
+ inline sparse_diagonal_product_inner_iterator_selector(
const SparseDiagonalProductType& expr, Index outer)
: Base(expr.lhs().innerVector(outer) .cwiseProduct(expr.rhs().diagonal().transpose()), 0)
{}
};
+} // end namespace internal
+
// SparseMatrixBase functions
template<typename Derived>
diff --git a/Eigen/src/Sparse/SparseDot.h b/Eigen/src/Sparse/SparseDot.h
index 42ad07aeb..1f10f71a4 100644
--- a/Eigen/src/Sparse/SparseDot.h
+++ b/Eigen/src/Sparse/SparseDot.h
@@ -27,23 +27,23 @@
template<typename Derived>
template<typename OtherDerived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
- EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename OtherDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- ei_assert(size() == other.size());
- ei_assert(other.size()>0 && "you are using a non initialized vector");
+ eigen_assert(size() == other.size());
+ eigen_assert(other.size()>0 && "you are using a non initialized vector");
typename Derived::InnerIterator i(derived(),0);
Scalar res = 0;
while (i)
{
- res += ei_conj(i.value()) * other.coeff(i.index());
+ res += internal::conj(i.value()) * other.coeff(i.index());
++i;
}
return res;
@@ -51,16 +51,16 @@ SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
template<typename Derived>
template<typename OtherDerived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
- EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename OtherDerived::Scalar>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
- ei_assert(size() == other.size());
+ eigen_assert(size() == other.size());
typename Derived::InnerIterator i(derived(),0);
typename OtherDerived::InnerIterator j(other.derived(),0);
@@ -69,7 +69,7 @@ SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) cons
{
if (i.index()==j.index())
{
- res += ei_conj(i.value()) * j.value();
+ res += internal::conj(i.value()) * j.value();
++i; ++j;
}
else if (i.index()<j.index())
@@ -81,17 +81,17 @@ SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) cons
}
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
SparseMatrixBase<Derived>::squaredNorm() const
{
- return ei_real((*this).cwiseAbs2().sum());
+ return internal::real((*this).cwiseAbs2().sum());
}
template<typename Derived>
-inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real
+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
SparseMatrixBase<Derived>::norm() const
{
- return ei_sqrt(squaredNorm());
+ return internal::sqrt(squaredNorm());
}
#endif // EIGEN_SPARSE_DOT_H
diff --git a/Eigen/src/Sparse/SparseFuzzy.h b/Eigen/src/Sparse/SparseFuzzy.h
index bf6d2e250..ddcef88ee 100644
--- a/Eigen/src/Sparse/SparseFuzzy.h
+++ b/Eigen/src/Sparse/SparseFuzzy.h
@@ -32,8 +32,8 @@
// typename NumTraits<Scalar>::Real prec
// ) const
// {
-// const typename ei_nested<Derived,2>::type nested(derived());
-// const typename ei_nested<OtherDerived,2>::type otherNested(other.derived());
+// const typename internal::nested<Derived,2>::type nested(derived());
+// const typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
// return (nested - otherNested).cwise().abs2().sum()
// <= prec * prec * std::min(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum());
// }
diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h
index 820cf2884..38e810725 100644
--- a/Eigen/src/Sparse/SparseMatrix.h
+++ b/Eigen/src/Sparse/SparseMatrix.h
@@ -42,8 +42,10 @@
* See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
*
*/
+
+namespace internal {
template<typename _Scalar, int _Options, typename _Index>
-struct ei_traits<SparseMatrix<_Scalar, _Options, _Index> >
+struct traits<SparseMatrix<_Scalar, _Options, _Index> >
{
typedef _Scalar Scalar;
typedef _Index Index;
@@ -59,6 +61,7 @@ struct ei_traits<SparseMatrix<_Scalar, _Options, _Index> >
SupportedAccessPatterns = InnerRandomAccessPattern
};
};
+} // end namespace internal
template<typename _Scalar, int _Options, typename _Index>
class SparseMatrix
@@ -75,6 +78,9 @@ class SparseMatrix
typedef MappedSparseMatrix<Scalar,Flags> Map;
using Base::IsRowMajor;
typedef CompressedStorage<Scalar,Index> Storage;
+ enum {
+ Options = _Options
+ };
protected:
@@ -120,10 +126,10 @@ class SparseMatrix
Index start = m_outerIndex[outer];
Index end = m_outerIndex[outer+1];
- ei_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
- ei_assert(end>start && "coeffRef cannot be called on a zero coefficient");
+ eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
+ eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
const Index id = m_data.searchLowerIndex(start,end-1,inner);
- ei_assert((id<end) && (m_data.index(id)==inner) && "coeffRef cannot be called on a zero coefficient");
+ eigen_assert((id<end) && (m_data.index(id)==inner) && "coeffRef cannot be called on a zero coefficient");
return m_data.value(id);
}
@@ -166,8 +172,8 @@ class SparseMatrix
/** \sa insertBack, startVec */
inline Scalar& insertBackByOuterInner(Index outer, Index inner)
{
- ei_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
- ei_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
+ eigen_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
+ eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
Index id = m_outerIndex[outer+1];
++m_outerIndex[outer+1];
m_data.append(0, inner);
@@ -186,8 +192,8 @@ class SparseMatrix
/** \sa insertBack, insertBackByOuterInner */
inline void startVec(Index outer)
{
- ei_assert(m_outerIndex[outer]==int(m_data.size()) && "You must call startVec for each inner vector sequentially");
- ei_assert(m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially");
+ eigen_assert(m_outerIndex[outer]==int(m_data.size()) && "You must call startVec for each inner vector sequentially");
+ eigen_assert(m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially");
m_outerIndex[outer+1] = m_outerIndex[outer];
}
@@ -328,15 +334,28 @@ class SparseMatrix
/** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */
void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
{
+ prune(default_prunning_func(reference,epsilon));
+ }
+
+ /** Suppress all nonzeros which do not satisfy the predicate \a keep.
+ * The functor type \a KeepFunc must implement the following function:
+ * \code
+ * bool operator() (const Index& row, const Index& col, const Scalar& value) const;
+ * \endcode
+ * \sa prune(Scalar,RealScalar)
+ */
+ template<typename KeepFunc>
+ void prune(const KeepFunc& keep = KeepFunc())
+ {
Index k = 0;
- for (Index j=0; j<m_outerSize; ++j)
+ for(Index j=0; j<m_outerSize; ++j)
{
Index previousStart = m_outerIndex[j];
m_outerIndex[j] = k;
Index end = m_outerIndex[j+1];
- for (Index i=previousStart; i<end; ++i)
+ for(Index i=previousStart; i<end; ++i)
{
- if (!ei_isMuchSmallerThan(m_data.value(i), reference, epsilon))
+ if(keep(IsRowMajor?j:m_data.index(i), IsRowMajor?m_data.index(i):j, m_data.value(i)))
{
m_data.value(k) = m_data.value(i);
m_data.index(k) = m_data.index(i);
@@ -433,6 +452,12 @@ class SparseMatrix
{
return Base::operator=(product);
}
+
+ template<typename OtherDerived>
+ EIGEN_STRONG_INLINE SparseMatrix& operator=(const ReturnByValue<OtherDerived>& func)
+ {
+ return Base::operator=(func);
+ }
#endif
template<typename OtherDerived>
@@ -445,8 +470,8 @@ class SparseMatrix
// 1 - compute the number of coeffs per dest inner vector
// 2 - do the actual copy/eval
// Since each coeff of the rhs has to be evaluated twice, let's evaluate it if needed
- typedef typename ei_nested<OtherDerived,2>::type OtherCopy;
- typedef typename ei_cleantype<OtherCopy>::type _OtherCopy;
+ typedef typename internal::nested<OtherDerived,2>::type OtherCopy;
+ typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
OtherCopy otherCopy(other.derived());
resize(other.rows(), other.cols());
@@ -561,7 +586,7 @@ class SparseMatrix
}
else
{
- ei_assert(m_data.index(m_data.size()-1)<inner && "wrong sorted insertion");
+ eigen_assert(m_data.index(m_data.size()-1)<inner && "wrong sorted insertion");
}
// std::cerr << size_t(m_outerIndex[outer+1]) << " == " << m_data.size() << "\n";
assert(size_t(m_outerIndex[outer+1]) == m_data.size());
@@ -574,6 +599,17 @@ class SparseMatrix
/** \deprecated use finalize */
EIGEN_DEPRECATED void endFill() { finalize(); }
+
+private:
+ struct default_prunning_func {
+ default_prunning_func(Scalar ref, RealScalar eps) : reference(ref), epsilon(eps) {}
+ inline bool operator() (const Index&, const Index&, const Scalar& value) const
+ {
+ return !internal::isMuchSmallerThan(value, reference, epsilon);
+ }
+ Scalar reference;
+ RealScalar epsilon;
+ };
};
template<typename Scalar, int _Options, typename _Index>
diff --git a/Eigen/src/Sparse/SparseMatrixBase.h b/Eigen/src/Sparse/SparseMatrixBase.h
index 5ca3b604b..ba6f64ab7 100644
--- a/Eigen/src/Sparse/SparseMatrixBase.h
+++ b/Eigen/src/Sparse/SparseMatrixBase.h
@@ -40,30 +40,30 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
{
public:
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type PacketScalar;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::traits<Derived>::Index Index;
typedef SparseMatrixBase StorageBaseType;
enum {
- RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
+ RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
/**< The number of rows at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
- ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
+ ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
/**< The number of columns at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
- SizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime>::ret),
+ SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime>::ret),
/**< This is equal to the number of coefficients, i.e. the number of
* rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
@@ -71,7 +71,7 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
MaxRowsAtCompileTime = RowsAtCompileTime,
MaxColsAtCompileTime = ColsAtCompileTime,
- MaxSizeAtCompileTime = (ei_size_at_compile_time<MaxRowsAtCompileTime,
+ MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
MaxColsAtCompileTime>::ret),
IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
@@ -80,12 +80,12 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
* we are dealing with a column-vector (if there is only one column) or with
* a row-vector (if there is only one row). */
- Flags = ei_traits<Derived>::Flags,
+ Flags = internal::traits<Derived>::Flags,
/**< This stores expression \ref flags flags which may or may not be inherited by new expressions
* constructed from this one. See the \ref flags "list of flags".
*/
- CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
+ CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
/**< This is a rough measure of how expensive it is to read one coefficient from
* this expression.
*/
@@ -98,19 +98,19 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
};
/* \internal the return type of MatrixBase::conjugate() */
-// typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
-// const SparseCwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>,
+// typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+// const SparseCwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Derived>,
// const Derived&
-// >::ret ConjugateReturnType;
+// >::type ConjugateReturnType;
/* \internal the return type of MatrixBase::real() */
-// typedef SparseCwiseUnaryOp<ei_scalar_real_op<Scalar>, Derived> RealReturnType;
+// typedef SparseCwiseUnaryOp<internal::scalar_real_op<Scalar>, Derived> RealReturnType;
/* \internal the return type of MatrixBase::imag() */
-// typedef SparseCwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
+// typedef SparseCwiseUnaryOp<internal::scalar_imag_op<Scalar>, Derived> ImagReturnType;
/** \internal the return type of MatrixBase::adjoint() */
- typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<Derived> >,
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Eigen::Transpose<Derived> >,
Transpose<Derived>
- >::ret AdjointReturnType;
+ >::type AdjointReturnType;
typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor> PlainObject;
@@ -132,10 +132,10 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
/** \internal the return type of coeff()
*/
- typedef typename ei_meta_if<_HasDirectAccess, const Scalar&, Scalar>::ret CoeffReturnType;
+ typedef typename internal::conditional<_HasDirectAccess, const Scalar&, Scalar>::type CoeffReturnType;
/** \internal Represents a matrix with all coefficients equal to one another*/
- typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
+ typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
/** type of the equivalent square matrix */
typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime),
@@ -183,6 +183,13 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
this->operator=<Derived>(other);
return derived();
}
+
+ template<typename OtherDerived>
+ Derived& operator=(const ReturnByValue<OtherDerived>& other)
+ {
+ other.evalTo(derived());
+ return derived();
+ }
template<typename OtherDerived>
@@ -190,14 +197,14 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
{
// std::cout << "Derived& operator=(const MatrixBase<OtherDerived>& other)\n";
//const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
- ei_assert(( ((ei_traits<Derived>::SupportedAccessPatterns&OuterRandomAccessPattern)==OuterRandomAccessPattern) ||
+ eigen_assert(( ((internal::traits<Derived>::SupportedAccessPatterns&OuterRandomAccessPattern)==OuterRandomAccessPattern) ||
(!((Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit)))) &&
"the transpose operation is supposed to be handled in SparseMatrix::operator=");
enum { Flip = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit) };
const Index outerSize = other.outerSize();
- //typedef typename ei_meta_if<transpose, LinkedVectorMatrix<Scalar,Flags&RowMajorBit>, Derived>::ret TempType;
+ //typedef typename internal::conditional<transpose, LinkedVectorMatrix<Scalar,Flags&RowMajorBit>, Derived>::type TempType;
// thanks to shallow copies, we always eval to a tempary
Derived temp(other.rows(), other.cols());
@@ -299,14 +306,14 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
return s;
}
-// const SparseCwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> operator-() const;
+// const SparseCwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>,Derived> operator-() const;
// template<typename OtherDerived>
-// const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
+// const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
// operator+(const SparseMatrixBase<OtherDerived> &other) const;
// template<typename OtherDerived>
-// const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
+// const CwiseBinaryOp<internal::scalar_difference_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
// operator-(const SparseMatrixBase<OtherDerived> &other) const;
template<typename OtherDerived>
@@ -322,10 +329,10 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
#define EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE \
CwiseBinaryOp< \
- ei_scalar_product_op< \
- typename ei_scalar_product_traits< \
- typename ei_traits<Derived>::Scalar, \
- typename ei_traits<OtherDerived>::Scalar \
+ internal::scalar_product_op< \
+ typename internal::scalar_product_traits< \
+ typename internal::traits<Derived>::Scalar, \
+ typename internal::traits<OtherDerived>::Scalar \
>::ReturnType \
>, \
Derived, \
@@ -336,12 +343,12 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
cwiseProduct(const MatrixBase<OtherDerived> &other) const;
-// const SparseCwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
+// const SparseCwiseUnaryOp<internal::scalar_multiple_op<typename internal::traits<Derived>::Scalar>, Derived>
// operator*(const Scalar& scalar) const;
-// const SparseCwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
+// const SparseCwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, Derived>
// operator/(const Scalar& scalar) const;
-// inline friend const SparseCwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
+// inline friend const SparseCwiseUnaryOp<internal::scalar_multiple_op<typename internal::traits<Derived>::Scalar>, Derived>
// operator*(const Scalar& scalar, const SparseMatrixBase& matrix)
// { return matrix*scalar; }
@@ -379,7 +386,7 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
#ifdef EIGEN2_SUPPORT
// deprecated
template<typename OtherDerived>
- typename ei_plain_matrix_type_column_major<OtherDerived>::type
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type
solveTriangular(const MatrixBase<OtherDerived>& other) const;
// deprecated
@@ -545,15 +552,15 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
// template<typename NewType>
-// const SparseCwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
+// const SparseCwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, Derived> cast() const;
/** \returns the matrix or vector obtained by evaluating this expression.
*
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy.
*/
- inline const typename ei_eval<Derived>::type eval() const
- { return typename ei_eval<Derived>::type(derived()); }
+ inline const typename internal::eval<Derived>::type eval() const
+ { return typename internal::eval<Derived>::type(derived()); }
// template<typename OtherDerived>
// void swap(MatrixBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other);
@@ -585,14 +592,14 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
Scalar sum() const;
// Scalar trace() const;
-// typename ei_traits<Derived>::Scalar minCoeff() const;
-// typename ei_traits<Derived>::Scalar maxCoeff() const;
+// typename internal::traits<Derived>::Scalar minCoeff() const;
+// typename internal::traits<Derived>::Scalar maxCoeff() const;
-// typename ei_traits<Derived>::Scalar minCoeff(int* row, int* col = 0) const;
-// typename ei_traits<Derived>::Scalar maxCoeff(int* row, int* col = 0) const;
+// typename internal::traits<Derived>::Scalar minCoeff(int* row, int* col = 0) const;
+// typename internal::traits<Derived>::Scalar maxCoeff(int* row, int* col = 0) const;
// template<typename BinaryOp>
-// typename ei_result_of<BinaryOp(typename ei_traits<Derived>::Scalar)>::type
+// typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
// redux(const BinaryOp& func) const;
// template<typename Visitor>
@@ -612,9 +619,9 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
const VectorwiseOp<Derived,Horizontal> rowwise() const;
const VectorwiseOp<Derived,Vertical> colwise() const;
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int rows, int cols);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random(int size);
- static const CwiseNullaryOp<ei_scalar_random_op<Scalar>,Derived> Random();
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(int rows, int cols);
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random(int size);
+ static const CwiseNullaryOp<internal::scalar_random_op<Scalar>,Derived> Random();
template<typename ThenDerived,typename ElseDerived>
const Select<Derived,ThenDerived,ElseDerived>
@@ -638,10 +645,10 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
// {
// EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
// EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
-// EIGEN_STATIC_ASSERT((ei_is_same_type<Scalar, typename OtherDerived::Scalar>::ret),
+// EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
//
-// ei_assert(derived().size() == other.size());
+// eigen_assert(derived().size() == other.size());
// // short version, but the assembly looks more complicated because
// // of the CwiseBinaryOp iterator complexity
// // return res = (derived().cwise() * other.derived().conjugate()).sum();
@@ -655,7 +662,7 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
// if (i.index()==j.index())
// {
// // std::cerr << i.value() << " * " << j.value() << "\n";
-// res += i.value() * ei_conj(j.value());
+// res += i.value() * internal::conj(j.value());
// ++i; ++j;
// }
// else if (i.index()<j.index())
diff --git a/Eigen/src/Sparse/SparseProduct.h b/Eigen/src/Sparse/SparseProduct.h
index ef6ef3c02..1c1f54706 100644
--- a/Eigen/src/Sparse/SparseProduct.h
+++ b/Eigen/src/Sparse/SparseProduct.h
@@ -28,35 +28,36 @@
template<typename Lhs, typename Rhs>
struct SparseSparseProductReturnType
{
- typedef typename ei_traits<Lhs>::Scalar Scalar;
+ typedef typename internal::traits<Lhs>::Scalar Scalar;
enum {
- LhsRowMajor = ei_traits<Lhs>::Flags & RowMajorBit,
- RhsRowMajor = ei_traits<Rhs>::Flags & RowMajorBit,
+ LhsRowMajor = internal::traits<Lhs>::Flags & RowMajorBit,
+ RhsRowMajor = internal::traits<Rhs>::Flags & RowMajorBit,
TransposeRhs = (!LhsRowMajor) && RhsRowMajor,
TransposeLhs = LhsRowMajor && (!RhsRowMajor)
};
- typedef typename ei_meta_if<TransposeLhs,
+ typedef typename internal::conditional<TransposeLhs,
SparseMatrix<Scalar,0>,
- const typename ei_nested<Lhs,Rhs::RowsAtCompileTime>::type>::ret LhsNested;
+ const typename internal::nested<Lhs,Rhs::RowsAtCompileTime>::type>::type LhsNested;
- typedef typename ei_meta_if<TransposeRhs,
+ typedef typename internal::conditional<TransposeRhs,
SparseMatrix<Scalar,0>,
- const typename ei_nested<Rhs,Lhs::RowsAtCompileTime>::type>::ret RhsNested;
+ const typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type>::type RhsNested;
typedef SparseSparseProduct<LhsNested, RhsNested> Type;
};
+namespace internal {
template<typename LhsNested, typename RhsNested>
-struct ei_traits<SparseSparseProduct<LhsNested, RhsNested> >
+struct traits<SparseSparseProduct<LhsNested, RhsNested> >
{
typedef MatrixXpr XprKind;
// clean the nested types:
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
+ typedef typename remove_all<LhsNested>::type _LhsNested;
+ typedef typename remove_all<RhsNested>::type _RhsNested;
typedef typename _LhsNested::Scalar Scalar;
- typedef typename ei_promote_index_type<typename ei_traits<_LhsNested>::Index,
- typename ei_traits<_RhsNested>::Index>::type Index;
+ typedef typename promote_index_type<typename traits<_LhsNested>::Index,
+ typename traits<_RhsNested>::Index>::type Index;
enum {
LhsCoeffReadCost = _LhsNested::CoeffReadCost,
@@ -85,8 +86,10 @@ struct ei_traits<SparseSparseProduct<LhsNested, RhsNested> >
typedef Sparse StorageKind;
};
+} // end namespace internal
+
template<typename LhsNested, typename RhsNested>
-class SparseSparseProduct : ei_no_assignment_operator,
+class SparseSparseProduct : internal::no_assignment_operator,
public SparseMatrixBase<SparseSparseProduct<LhsNested, RhsNested> >
{
public:
@@ -96,8 +99,8 @@ class SparseSparseProduct : ei_no_assignment_operator,
private:
- typedef typename ei_traits<SparseSparseProduct>::_LhsNested _LhsNested;
- typedef typename ei_traits<SparseSparseProduct>::_RhsNested _RhsNested;
+ typedef typename internal::traits<SparseSparseProduct>::_LhsNested _LhsNested;
+ typedef typename internal::traits<SparseSparseProduct>::_RhsNested _RhsNested;
public:
@@ -105,7 +108,7 @@ class SparseSparseProduct : ei_no_assignment_operator,
EIGEN_STRONG_INLINE SparseSparseProduct(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs)
{
- ei_assert(lhs.cols() == rhs.rows());
+ eigen_assert(lhs.cols() == rhs.rows());
enum {
ProductIsValid = _LhsNested::ColsAtCompileTime==Dynamic
diff --git a/Eigen/src/Sparse/SparseRedux.h b/Eigen/src/Sparse/SparseRedux.h
index bc10d5a4e..afc49de7a 100644
--- a/Eigen/src/Sparse/SparseRedux.h
+++ b/Eigen/src/Sparse/SparseRedux.h
@@ -26,10 +26,10 @@
#define EIGEN_SPARSEREDUX_H
template<typename Derived>
-typename ei_traits<Derived>::Scalar
+typename internal::traits<Derived>::Scalar
SparseMatrixBase<Derived>::sum() const
{
- ei_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+ eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
Scalar res = 0;
for (Index j=0; j<outerSize(); ++j)
for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
@@ -38,18 +38,18 @@ SparseMatrixBase<Derived>::sum() const
}
template<typename _Scalar, int _Options, typename _Index>
-typename ei_traits<SparseMatrix<_Scalar,_Options,_Index> >::Scalar
+typename internal::traits<SparseMatrix<_Scalar,_Options,_Index> >::Scalar
SparseMatrix<_Scalar,_Options,_Index>::sum() const
{
- ei_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+ eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
}
template<typename _Scalar, int _Options, typename _Index>
-typename ei_traits<SparseVector<_Scalar,_Options, _Index> >::Scalar
+typename internal::traits<SparseVector<_Scalar,_Options, _Index> >::Scalar
SparseVector<_Scalar,_Options,_Index>::sum() const
{
- ei_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
+ eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
}
diff --git a/Eigen/src/Sparse/SparseSelfAdjointView.h b/Eigen/src/Sparse/SparseSelfAdjointView.h
index dd4d925e1..2a7101082 100644
--- a/Eigen/src/Sparse/SparseSelfAdjointView.h
+++ b/Eigen/src/Sparse/SparseSelfAdjointView.h
@@ -54,8 +54,8 @@ template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView
inline SparseSelfAdjointView(const MatrixType& matrix) : m_matrix(matrix)
{
- ei_assert(ei_are_flags_consistent<UpLo>::ret);
- ei_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
+ eigen_assert(internal::are_flags_consistent<UpLo>::ret);
+ eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
}
inline Index rows() const { return m_matrix.rows(); }
@@ -92,7 +92,7 @@ template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView
* call this function with u.adjoint().
*/
template<typename DerivedU>
- SparseSelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
+ SparseSelfAdjointView& rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha = Scalar(1));
// const SparseLLT<PlainObject, UpLo> llt() const;
// const SparseLDLT<PlainObject, UpLo> ldlt() const;
@@ -127,27 +127,29 @@ SparseSelfAdjointView<Derived, UpLo> SparseMatrixBase<Derived>::selfadjointView(
template<typename MatrixType, unsigned int UpLo>
template<typename DerivedU>
SparseSelfAdjointView<MatrixType,UpLo>&
-SparseSelfAdjointView<MatrixType,UpLo>::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
+SparseSelfAdjointView<MatrixType,UpLo>::rankUpdate(const SparseMatrixBase<DerivedU>& u, Scalar alpha)
{
SparseMatrix<Scalar,MatrixType::Flags&RowMajorBit?RowMajor:ColMajor> tmp = u * u.adjoint();
if(alpha==Scalar(0))
- m_matrix = tmp.template triangularView<UpLo>();
+ m_matrix.const_cast_derived() = tmp.template triangularView<UpLo>();
else
- m_matrix += alpha * tmp.template triangularView<UpLo>();
+ m_matrix.const_cast_derived() /*+*/= alpha * tmp.template triangularView<UpLo>();
- return this;
+ return *this;
}
/***************************************************************************
* Implementation of sparse self-adjoint time dense matrix
***************************************************************************/
+namespace internal {
template<typename Lhs, typename Rhs, int UpLo>
-struct ei_traits<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo> >
- : ei_traits<ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
+struct traits<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo> >
+ : traits<ProductBase<SparseSelfAdjointTimeDenseProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
{
typedef Dense StorageKind;
};
+}
template<typename Lhs, typename Rhs, int UpLo>
class SparseSelfAdjointTimeDenseProduct
@@ -162,9 +164,9 @@ class SparseSelfAdjointTimeDenseProduct
template<typename Dest> void scaleAndAddTo(Dest& dest, Scalar alpha) const
{
// TODO use alpha
- ei_assert(alpha==Scalar(1) && "alpha != 1 is not implemented yet, sorry");
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
+ eigen_assert(alpha==Scalar(1) && "alpha != 1 is not implemented yet, sorry");
+ typedef typename internal::remove_all<Lhs>::type _Lhs;
+ typedef typename internal::remove_all<Rhs>::type _Rhs;
typedef typename _Lhs::InnerIterator LhsInnerIterator;
enum {
LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit,
@@ -189,7 +191,7 @@ class SparseSelfAdjointTimeDenseProduct
Index b = LhsIsRowMajor ? i.index() : j;
typename Lhs::Scalar v = i.value();
dest.row(a) += (v) * m_rhs.row(b);
- dest.row(b) += ei_conj(v) * m_rhs.row(a);
+ dest.row(b) += internal::conj(v) * m_rhs.row(a);
}
if (ProcessFirstHalf && i && (i.index()==j))
dest.row(j) += i.value() * m_rhs.row(j);
@@ -200,10 +202,12 @@ class SparseSelfAdjointTimeDenseProduct
SparseSelfAdjointTimeDenseProduct& operator=(const SparseSelfAdjointTimeDenseProduct&);
};
+namespace internal {
template<typename Lhs, typename Rhs, int UpLo>
-struct ei_traits<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo> >
- : ei_traits<ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
+struct traits<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo> >
+ : traits<ProductBase<DenseTimeSparseSelfAdjointProduct<Lhs,Rhs,UpLo>, Lhs, Rhs> >
{};
+}
template<typename Lhs, typename Rhs, int UpLo>
class DenseTimeSparseSelfAdjointProduct
diff --git a/Eigen/src/Sparse/SparseSparseProduct.h b/Eigen/src/Sparse/SparseSparseProduct.h
index c8724c118..b7ed151b4 100644
--- a/Eigen/src/Sparse/SparseSparseProduct.h
+++ b/Eigen/src/Sparse/SparseSparseProduct.h
@@ -25,16 +25,18 @@
#ifndef EIGEN_SPARSESPARSEPRODUCT_H
#define EIGEN_SPARSESPARSEPRODUCT_H
+namespace internal {
+
template<typename Lhs, typename Rhs, typename ResultType>
-static void ei_sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+static void sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
- typedef typename ei_cleantype<Lhs>::type::Scalar Scalar;
- typedef typename ei_cleantype<Lhs>::type::Index Index;
+ typedef typename remove_all<Lhs>::type::Scalar Scalar;
+ typedef typename remove_all<Lhs>::type::Index Index;
// make sure to call innerSize/outerSize since we fake the storage order.
Index rows = lhs.innerSize();
Index cols = rhs.outerSize();
- ei_assert(lhs.outerSize() == rhs.innerSize());
+ eigen_assert(lhs.outerSize() == rhs.innerSize());
std::vector<bool> mask(rows,false);
Matrix<Scalar,Dynamic,1> values(rows);
@@ -110,18 +112,18 @@ static void ei_sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType&
// perform a pseudo in-place sparse * sparse product assuming all matrices are col major
template<typename Lhs, typename Rhs, typename ResultType>
-static void ei_sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
+static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
-// return ei_sparse_product_impl2(lhs,rhs,res);
+// return sparse_product_impl2(lhs,rhs,res);
- typedef typename ei_cleantype<Lhs>::type::Scalar Scalar;
- typedef typename ei_cleantype<Lhs>::type::Index Index;
+ typedef typename remove_all<Lhs>::type::Scalar Scalar;
+ typedef typename remove_all<Lhs>::type::Index Index;
// make sure to call innerSize/outerSize since we fake the storage order.
Index rows = lhs.innerSize();
Index cols = rhs.outerSize();
//int size = lhs.outerSize();
- ei_assert(lhs.outerSize() == rhs.innerSize());
+ eigen_assert(lhs.outerSize() == rhs.innerSize());
// allocate a temporary buffer
AmbiVector<Scalar,Index> tempVector(rows);
@@ -159,27 +161,27 @@ static void ei_sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& r
}
template<typename Lhs, typename Rhs, typename ResultType,
- int LhsStorageOrder = ei_traits<Lhs>::Flags&RowMajorBit,
- int RhsStorageOrder = ei_traits<Rhs>::Flags&RowMajorBit,
- int ResStorageOrder = ei_traits<ResultType>::Flags&RowMajorBit>
-struct ei_sparse_product_selector;
+ int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
+ int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
+ int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
+struct sparse_product_selector;
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
+struct sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
{
- typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
+ typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
// std::cerr << __LINE__ << "\n";
- typename ei_cleantype<ResultType>::type _res(res.rows(), res.cols());
- ei_sparse_product_impl<Lhs,Rhs,ResultType>(lhs, rhs, _res);
+ typename remove_all<ResultType>::type _res(res.rows(), res.cols());
+ sparse_product_impl<Lhs,Rhs,ResultType>(lhs, rhs, _res);
res.swap(_res);
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
+struct sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
@@ -187,26 +189,26 @@ struct ei_sparse_product_selector<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
// we need a col-major matrix to hold the result
typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
SparseTemporaryType _res(res.rows(), res.cols());
- ei_sparse_product_impl<Lhs,Rhs,SparseTemporaryType>(lhs, rhs, _res);
+ sparse_product_impl<Lhs,Rhs,SparseTemporaryType>(lhs, rhs, _res);
res = _res;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
+struct sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
// std::cerr << __LINE__ << "\n";
// let's transpose the product to get a column x column product
- typename ei_cleantype<ResultType>::type _res(res.rows(), res.cols());
- ei_sparse_product_impl<Rhs,Lhs,ResultType>(rhs, lhs, _res);
+ typename remove_all<ResultType>::type _res(res.rows(), res.cols());
+ sparse_product_impl<Rhs,Lhs,ResultType>(rhs, lhs, _res);
res.swap(_res);
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
+struct sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
@@ -215,21 +217,22 @@ struct ei_sparse_product_selector<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
ColMajorMatrix colLhs(lhs);
ColMajorMatrix colRhs(rhs);
// std::cerr << "more...\n";
- ei_sparse_product_impl<ColMajorMatrix,ColMajorMatrix,ResultType>(colLhs, colRhs, res);
+ sparse_product_impl<ColMajorMatrix,ColMajorMatrix,ResultType>(colLhs, colRhs, res);
// std::cerr << "OK.\n";
// let's transpose the product to get a column x column product
// typedef SparseMatrix<typename ResultType::Scalar> SparseTemporaryType;
// SparseTemporaryType _res(res.cols(), res.rows());
-// ei_sparse_product_impl<Rhs,Lhs,SparseTemporaryType>(rhs, lhs, _res);
+// sparse_product_impl<Rhs,Lhs,SparseTemporaryType>(rhs, lhs, _res);
// res = _res.transpose();
}
};
-// NOTE the 2 others cases (col row *) must never occurs since they are caught
-// by ProductReturnType which transform it to (col col *) by evaluating rhs.
+// NOTE the 2 others cases (col row *) must never occur since they are caught
+// by ProductReturnType which transforms it to (col col *) by evaluating rhs.
+} // end namespace internal
// sparse = sparse * sparse
template<typename Derived>
@@ -237,33 +240,34 @@ template<typename Lhs, typename Rhs>
inline Derived& SparseMatrixBase<Derived>::operator=(const SparseSparseProduct<Lhs,Rhs>& product)
{
// std::cerr << "there..." << typeid(Lhs).name() << " " << typeid(Lhs).name() << " " << (Derived::Flags&&RowMajorBit) << "\n";
- ei_sparse_product_selector<
- typename ei_cleantype<Lhs>::type,
- typename ei_cleantype<Rhs>::type,
+ internal::sparse_product_selector<
+ typename internal::remove_all<Lhs>::type,
+ typename internal::remove_all<Rhs>::type,
Derived>::run(product.lhs(),product.rhs(),derived());
return derived();
}
+namespace internal {
template<typename Lhs, typename Rhs, typename ResultType,
- int LhsStorageOrder = ei_traits<Lhs>::Flags&RowMajorBit,
- int RhsStorageOrder = ei_traits<Rhs>::Flags&RowMajorBit,
- int ResStorageOrder = ei_traits<ResultType>::Flags&RowMajorBit>
-struct ei_sparse_product_selector2;
+ int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit,
+ int RhsStorageOrder = traits<Rhs>::Flags&RowMajorBit,
+ int ResStorageOrder = traits<ResultType>::Flags&RowMajorBit>
+struct sparse_product_selector2;
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,ColMajor>
{
- typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
+ typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
- ei_sparse_product_impl2<Lhs,Rhs,ResultType>(lhs, rhs, res);
+ sparse_product_impl2<Lhs,Rhs,ResultType>(lhs, rhs, res);
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,ColMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,ColMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
@@ -275,79 +279,79 @@ struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,ColMajor
// typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
// RowMajorMatrix rhsRow = rhs;
// RowMajorMatrix resRow(res.rows(), res.cols());
-// ei_sparse_product_impl2<RowMajorMatrix,Lhs,RowMajorMatrix>(rhsRow, lhs, resRow);
+// sparse_product_impl2<RowMajorMatrix,Lhs,RowMajorMatrix>(rhsRow, lhs, resRow);
// res = resRow;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,ColMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,ColMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
RowMajorMatrix lhsRow = lhs;
RowMajorMatrix resRow(res.rows(), res.cols());
- ei_sparse_product_impl2<Rhs,RowMajorMatrix,RowMajorMatrix>(rhs, lhsRow, resRow);
+ sparse_product_impl2<Rhs,RowMajorMatrix,RowMajorMatrix>(rhs, lhsRow, resRow);
res = resRow;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,ColMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
typedef SparseMatrix<typename ResultType::Scalar,RowMajor> RowMajorMatrix;
RowMajorMatrix resRow(res.rows(), res.cols());
- ei_sparse_product_impl2<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
+ sparse_product_impl2<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
res = resRow;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,ColMajor,RowMajor>
{
- typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
+ typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
ColMajorMatrix resCol(res.rows(), res.cols());
- ei_sparse_product_impl2<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
+ sparse_product_impl2<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
res = resCol;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,RowMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,ColMajor,RowMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
ColMajorMatrix lhsCol = lhs;
ColMajorMatrix resCol(res.rows(), res.cols());
- ei_sparse_product_impl2<ColMajorMatrix,Rhs,ColMajorMatrix>(lhsCol, rhs, resCol);
+ sparse_product_impl2<ColMajorMatrix,Rhs,ColMajorMatrix>(lhsCol, rhs, resCol);
res = resCol;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,RowMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,ColMajor,RowMajor,RowMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
ColMajorMatrix rhsCol = rhs;
ColMajorMatrix resCol(res.rows(), res.cols());
- ei_sparse_product_impl2<Lhs,ColMajorMatrix,ColMajorMatrix>(lhs, rhsCol, resCol);
+ sparse_product_impl2<Lhs,ColMajorMatrix,ColMajorMatrix>(lhs, rhsCol, resCol);
res = resCol;
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
+struct sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor>
{
static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res)
{
@@ -355,26 +359,28 @@ struct ei_sparse_product_selector2<Lhs,Rhs,ResultType,RowMajor,RowMajor,RowMajor
// ColMajorMatrix lhsTr(lhs);
// ColMajorMatrix rhsTr(rhs);
// ColMajorMatrix aux(res.rows(), res.cols());
-// ei_sparse_product_impl2<Rhs,Lhs,ColMajorMatrix>(rhs, lhs, aux);
+// sparse_product_impl2<Rhs,Lhs,ColMajorMatrix>(rhs, lhs, aux);
// // ColMajorMatrix aux2 = aux.transpose();
// res = aux;
typedef SparseMatrix<typename ResultType::Scalar,ColMajor> ColMajorMatrix;
ColMajorMatrix lhsCol(lhs);
ColMajorMatrix rhsCol(rhs);
ColMajorMatrix resCol(res.rows(), res.cols());
- ei_sparse_product_impl2<ColMajorMatrix,ColMajorMatrix,ColMajorMatrix>(lhsCol, rhsCol, resCol);
+ sparse_product_impl2<ColMajorMatrix,ColMajorMatrix,ColMajorMatrix>(lhsCol, rhsCol, resCol);
res = resCol;
}
};
+} // end namespace internal
+
template<typename Derived>
template<typename Lhs, typename Rhs>
inline void SparseMatrixBase<Derived>::_experimentalNewProduct(const Lhs& lhs, const Rhs& rhs)
{
//derived().resize(lhs.rows(), rhs.cols());
- ei_sparse_product_selector2<
- typename ei_cleantype<Lhs>::type,
- typename ei_cleantype<Rhs>::type,
+ internal::sparse_product_selector2<
+ typename internal::remove_all<Lhs>::type,
+ typename internal::remove_all<Rhs>::type,
Derived>::run(lhs,rhs,derived());
}
diff --git a/Eigen/src/Sparse/SparseTranspose.h b/Eigen/src/Sparse/SparseTranspose.h
index 79e0a04db..2aea2fa32 100644
--- a/Eigen/src/Sparse/SparseTranspose.h
+++ b/Eigen/src/Sparse/SparseTranspose.h
@@ -28,7 +28,7 @@
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
: public SparseMatrixBase<Transpose<MatrixType> >
{
- typedef typename ei_cleantype<typename MatrixType::Nested>::type _MatrixTypeNested;
+ typedef typename internal::remove_all<typename MatrixType::Nested>::type _MatrixTypeNested;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose<MatrixType>)
diff --git a/Eigen/src/Sparse/SparseTriangularView.h b/Eigen/src/Sparse/SparseTriangularView.h
index 929f58416..319eaf066 100644
--- a/Eigen/src/Sparse/SparseTriangularView.h
+++ b/Eigen/src/Sparse/SparseTriangularView.h
@@ -25,27 +25,31 @@
#ifndef EIGEN_SPARSE_TRIANGULARVIEW_H
#define EIGEN_SPARSE_TRIANGULARVIEW_H
+namespace internal {
+
template<typename MatrixType, int Mode>
-struct ei_traits<SparseTriangularView<MatrixType,Mode> >
-: public ei_traits<MatrixType>
+struct traits<SparseTriangularView<MatrixType,Mode> >
+: public traits<MatrixType>
{};
+} // namespace internal
+
template<typename MatrixType, int Mode> class SparseTriangularView
: public SparseMatrixBase<SparseTriangularView<MatrixType,Mode> >
{
enum { SkipFirst = (Mode==Lower && !(MatrixType::Flags&RowMajorBit))
|| (Mode==Upper && (MatrixType::Flags&RowMajorBit)) };
public:
+
+ EIGEN_SPARSE_PUBLIC_INTERFACE(SparseTriangularView)
class InnerIterator;
- typedef typename MatrixType::Scalar Scalar;
- typedef typename MatrixType::Index Index;
- inline Index rows() { return m_matrix.rows(); }
- inline Index cols() { return m_matrix.cols(); }
+ inline Index rows() const { return m_matrix.rows(); }
+ inline Index cols() const { return m_matrix.cols(); }
- typedef typename ei_meta_if<ei_must_nest_by_value<MatrixType>::ret,
- MatrixType, const MatrixType&>::ret MatrixTypeNested;
+ typedef typename internal::conditional<internal::must_nest_by_value<MatrixType>::ret,
+ MatrixType, const MatrixType&>::type MatrixTypeNested;
inline SparseTriangularView(const MatrixType& matrix) : m_matrix(matrix) {}
@@ -53,7 +57,7 @@ template<typename MatrixType, int Mode> class SparseTriangularView
inline const MatrixType& nestedExpression() const { return m_matrix; }
template<typename OtherDerived>
- typename ei_plain_matrix_type_column_major<OtherDerived>::type
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type
solve(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived> void solveInPlace(MatrixBase<OtherDerived>& other) const;
@@ -81,7 +85,7 @@ class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixType::
EIGEN_STRONG_INLINE operator bool() const
{
- return SkipFirst ? Base::operator bool() : (Base::operator bool() && this->index() < this->outer());
+ return SkipFirst ? Base::operator bool() : (Base::operator bool() && this->index() <= this->outer());
}
};
diff --git a/Eigen/src/Sparse/SparseUtil.h b/Eigen/src/Sparse/SparseUtil.h
index ddfa115dc..db9ae98e7 100644
--- a/Eigen/src/Sparse/SparseUtil.h
+++ b/Eigen/src/Sparse/SparseUtil.h
@@ -58,15 +58,15 @@ EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
#define _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, BaseClass) \
typedef BaseClass Base; \
- typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
+ typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
- typedef typename Eigen::ei_nested<Derived>::type Nested; \
- typedef typename Eigen::ei_traits<Derived>::StorageKind StorageKind; \
- typedef typename Eigen::ei_traits<Derived>::Index Index; \
- enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
- ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
- Flags = Eigen::ei_traits<Derived>::Flags, \
- CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
+ typedef typename Eigen::internal::nested<Derived>::type Nested; \
+ typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
+ typedef typename Eigen::internal::traits<Derived>::Index Index; \
+ enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
+ ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
+ Flags = Eigen::internal::traits<Derived>::Flags, \
+ CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
using Base::derived; \
@@ -98,29 +98,33 @@ template<typename Lhs, typename Rhs> class DenseTimeSparseProduct;
template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
-template<typename Lhs, typename Rhs, int InnerSize = ei_traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
-template<typename Lhs, typename Rhs, int InnerSize = ei_traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
+template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
+template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
-template<typename T> struct ei_eval<T,Sparse>
+namespace internal {
+
+template<typename T> struct eval<T,Sparse>
{
- typedef typename ei_traits<T>::Scalar _Scalar;
+ typedef typename traits<T>::Scalar _Scalar;
enum {
- _Flags = ei_traits<T>::Flags
+ _Flags = traits<T>::Flags
};
public:
typedef SparseMatrix<_Scalar, _Flags> type;
};
-template<typename T> struct ei_plain_matrix_type<T,Sparse>
+template<typename T> struct plain_matrix_type<T,Sparse>
{
- typedef typename ei_traits<T>::Scalar _Scalar;
+ typedef typename traits<T>::Scalar _Scalar;
enum {
- _Flags = ei_traits<T>::Flags
+ _Flags = traits<T>::Flags
};
public:
typedef SparseMatrix<_Scalar, _Flags> type;
};
+} // end namespace internal
+
#endif // EIGEN_SPARSEUTIL_H
diff --git a/Eigen/src/Sparse/SparseVector.h b/Eigen/src/Sparse/SparseVector.h
index c5d0a6981..c640eadff 100644
--- a/Eigen/src/Sparse/SparseVector.h
+++ b/Eigen/src/Sparse/SparseVector.h
@@ -34,8 +34,10 @@
* See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
*
*/
+
+namespace internal {
template<typename _Scalar, int _Options, typename _Index>
-struct ei_traits<SparseVector<_Scalar, _Options, _Index> >
+struct traits<SparseVector<_Scalar, _Options, _Index> >
{
typedef _Scalar Scalar;
typedef _Index Index;
@@ -53,6 +55,7 @@ struct ei_traits<SparseVector<_Scalar, _Options, _Index> >
SupportedAccessPatterns = InnerRandomAccessPattern
};
};
+}
template<typename _Scalar, int _Options, typename _Index>
class SparseVector
@@ -68,7 +71,11 @@ class SparseVector
public:
typedef SparseMatrixBase<SparseVector> SparseBase;
- enum { IsColVector = ei_traits<SparseVector>::IsColVector };
+ enum { IsColVector = internal::traits<SparseVector>::IsColVector };
+
+ enum {
+ Options = _Options
+ };
CompressedStorage<Scalar,Index> m_data;
Index m_size;
@@ -82,7 +89,7 @@ class SparseVector
EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; }
EIGEN_STRONG_INLINE Index innerSize() const { return m_size; }
EIGEN_STRONG_INLINE Index outerSize() const { return 1; }
- EIGEN_STRONG_INLINE Index innerNonZeros(Index j) const { ei_assert(j==0); return m_size; }
+ EIGEN_STRONG_INLINE Index innerNonZeros(Index j) const { eigen_assert(j==0); return m_size; }
EIGEN_STRONG_INLINE const Scalar* _valuePtr() const { return &m_data.value(0); }
EIGEN_STRONG_INLINE Scalar* _valuePtr() { return &m_data.value(0); }
@@ -92,14 +99,14 @@ class SparseVector
inline Scalar coeff(Index row, Index col) const
{
- ei_assert((IsColVector ? col : row)==0);
+ eigen_assert((IsColVector ? col : row)==0);
return coeff(IsColVector ? row : col);
}
inline Scalar coeff(Index i) const { return m_data.at(i); }
inline Scalar& coeffRef(Index row, Index col)
{
- ei_assert((IsColVector ? col : row)==0);
+ eigen_assert((IsColVector ? col : row)==0);
return coeff(IsColVector ? row : col);
}
@@ -125,12 +132,12 @@ class SparseVector
inline void startVec(Index outer)
{
- ei_assert(outer==0);
+ eigen_assert(outer==0);
}
inline Scalar& insertBackByOuterInner(Index outer, Index inner)
{
- ei_assert(outer==0);
+ eigen_assert(outer==0);
return insertBack(inner);
}
inline Scalar& insertBack(Index i)
@@ -143,7 +150,7 @@ class SparseVector
{
Index inner = IsColVector ? row : col;
Index outer = IsColVector ? col : row;
- ei_assert(outer==0);
+ eigen_assert(outer==0);
return insert(inner);
}
Scalar& insert(Index i)
@@ -178,7 +185,7 @@ class SparseVector
void resize(Index rows, Index cols)
{
- ei_assert(rows==1 || cols==1);
+ eigen_assert(rows==1 || cols==1);
resize(IsColVector ? rows : cols);
}
@@ -260,9 +267,9 @@ class SparseVector
// // 1 - compute the number of coeffs per dest inner vector
// // 2 - do the actual copy/eval
// // Since each coeff of the rhs has to be evaluated twice, let's evauluate it if needed
-// typedef typename ei_nested<OtherDerived,2>::type OtherCopy;
+// typedef typename internal::nested<OtherDerived,2>::type OtherCopy;
// OtherCopy otherCopy(other.derived());
-// typedef typename ei_cleantype<OtherCopy>::type _OtherCopy;
+// typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
//
// resize(other.rows(), other.cols());
// Eigen::Map<VectorXi>(m_outerIndex,outerSize()).setZero();
@@ -321,7 +328,7 @@ class SparseVector
// {
// if (m_data.index(i)==other.m_data.index(j))
// {
-// res += m_data.value(i) * ei_conj(other.m_data.value(j));
+// res += m_data.value(i) * internal::conj(other.m_data.value(j));
// ++i; ++j;
// }
// else if (m_data.index(i)<other.m_data.index(j))
@@ -351,7 +358,7 @@ class SparseVector
/** \deprecated use insertBack(Index,Index) */
EIGEN_DEPRECATED Scalar& fill(Index r, Index c)
{
- ei_assert(r==0 || c==0);
+ eigen_assert(r==0 || c==0);
return fill(IsColVector ? r : c);
}
@@ -365,7 +372,7 @@ class SparseVector
/** \deprecated use insert(Index,Index) */
EIGEN_DEPRECATED Scalar& fillrand(Index r, Index c)
{
- ei_assert(r==0 || c==0);
+ eigen_assert(r==0 || c==0);
return fillrand(IsColVector ? r : c);
}
@@ -386,7 +393,7 @@ class SparseVector<Scalar,_Options,_Index>::InnerIterator
InnerIterator(const SparseVector& vec, Index outer=0)
: m_data(vec.m_data), m_id(0), m_end(static_cast<Index>(m_data.size()))
{
- ei_assert(outer==0);
+ eigen_assert(outer==0);
}
InnerIterator(const CompressedStorage<Scalar,Index>& data)
diff --git a/Eigen/src/Sparse/SparseView.h b/Eigen/src/Sparse/SparseView.h
index 5a152b255..243065610 100644
--- a/Eigen/src/Sparse/SparseView.h
+++ b/Eigen/src/Sparse/SparseView.h
@@ -26,21 +26,25 @@
#ifndef EIGEN_SPARSEVIEW_H
#define EIGEN_SPARSEVIEW_H
+namespace internal {
+
template<typename MatrixType>
-struct ei_traits<SparseView<MatrixType> > : ei_traits<MatrixType>
+struct traits<SparseView<MatrixType> > : traits<MatrixType>
{
typedef int Index;
typedef Sparse StorageKind;
enum {
- Flags = int(ei_traits<MatrixType>::Flags) & (RowMajorBit)
+ Flags = int(traits<MatrixType>::Flags) & (RowMajorBit)
};
};
+} // end namespace internal
+
template<typename MatrixType>
class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
{
typedef typename MatrixType::Nested MatrixTypeNested;
- typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
@@ -88,7 +92,7 @@ protected:
private:
void incrementToNonZero()
{
- while(ei_isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon) && (bool(*this)))
+ while(internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon) && (bool(*this)))
{
IterBase::operator++();
}
diff --git a/Eigen/src/Sparse/TriangularSolver.h b/Eigen/src/Sparse/TriangularSolver.h
index 3233ab0fd..73468e044 100644
--- a/Eigen/src/Sparse/TriangularSolver.h
+++ b/Eigen/src/Sparse/TriangularSolver.h
@@ -25,18 +25,20 @@
#ifndef EIGEN_SPARSETRIANGULARSOLVER_H
#define EIGEN_SPARSETRIANGULARSOLVER_H
+namespace internal {
+
template<typename Lhs, typename Rhs, int Mode,
int UpLo = (Mode & Lower)
? Lower
: (Mode & Upper)
? Upper
: -1,
- int StorageOrder = int(ei_traits<Lhs>::Flags) & RowMajorBit>
-struct ei_sparse_solve_triangular_selector;
+ int StorageOrder = int(traits<Lhs>::Flags) & RowMajorBit>
+struct sparse_solve_triangular_selector;
// forward substitution, row-major
template<typename Lhs, typename Rhs, int Mode>
-struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
{
typedef typename Rhs::Scalar Scalar;
static void run(const Lhs& lhs, Rhs& other)
@@ -60,7 +62,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
other.coeffRef(i,col) = tmp;
else
{
- ei_assert(lastIndex==i);
+ eigen_assert(lastIndex==i);
other.coeffRef(i,col) = tmp/lastVal;
}
}
@@ -70,7 +72,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
// backward substitution, row-major
template<typename Lhs, typename Rhs, int Mode>
-struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
{
typedef typename Rhs::Scalar Scalar;
static void run(const Lhs& lhs, Rhs& other)
@@ -93,7 +95,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
else
{
typename Lhs::InnerIterator it(lhs, i);
- ei_assert(it && it.index() == i);
+ eigen_assert(it && it.index() == i);
other.coeffRef(i,col) = tmp/it.value();
}
}
@@ -103,7 +105,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
// forward substitution, col-major
template<typename Lhs, typename Rhs, int Mode>
-struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
{
typedef typename Rhs::Scalar Scalar;
static void run(const Lhs& lhs, Rhs& other)
@@ -118,7 +120,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
typename Lhs::InnerIterator it(lhs, i);
if(!(Mode & UnitDiag))
{
- ei_assert(it.index()==i);
+ eigen_assert(it.index()==i);
tmp /= it.value();
}
if (it && it.index()==i)
@@ -133,7 +135,7 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,ColMajor>
// backward substitution, col-major
template<typename Lhs, typename Rhs, int Mode>
-struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor>
+struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor>
{
typedef typename Rhs::Scalar Scalar;
static void run(const Lhs& lhs, Rhs& other)
@@ -160,22 +162,24 @@ struct ei_sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor>
}
};
+} // end namespace internal
+
template<typename ExpressionType,int Mode>
template<typename OtherDerived>
void SparseTriangularView<ExpressionType,Mode>::solveInPlace(MatrixBase<OtherDerived>& other) const
{
- ei_assert(m_matrix.cols() == m_matrix.rows());
- ei_assert(m_matrix.cols() == other.rows());
- ei_assert(!(Mode & ZeroDiag));
- ei_assert(Mode & (Upper|Lower));
+ eigen_assert(m_matrix.cols() == m_matrix.rows());
+ eigen_assert(m_matrix.cols() == other.rows());
+ eigen_assert(!(Mode & ZeroDiag));
+ eigen_assert(Mode & (Upper|Lower));
- enum { copy = ei_traits<OtherDerived>::Flags & RowMajorBit };
+ enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
- typedef typename ei_meta_if<copy,
- typename ei_plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::ret OtherCopy;
+ typedef typename internal::conditional<copy,
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
OtherCopy otherCopy(other.derived());
- ei_sparse_solve_triangular_selector<ExpressionType, typename ei_unref<OtherCopy>::type, Mode>::run(m_matrix, otherCopy);
+ internal::sparse_solve_triangular_selector<ExpressionType, typename internal::remove_reference<OtherCopy>::type, Mode>::run(m_matrix, otherCopy);
if (copy)
other = otherCopy;
@@ -183,16 +187,18 @@ void SparseTriangularView<ExpressionType,Mode>::solveInPlace(MatrixBase<OtherDer
template<typename ExpressionType,int Mode>
template<typename OtherDerived>
-typename ei_plain_matrix_type_column_major<OtherDerived>::type
+typename internal::plain_matrix_type_column_major<OtherDerived>::type
SparseTriangularView<ExpressionType,Mode>::solve(const MatrixBase<OtherDerived>& other) const
{
- typename ei_plain_matrix_type_column_major<OtherDerived>::type res(other);
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
solveInPlace(res);
return res;
}
// pure sparse path
+namespace internal {
+
template<typename Lhs, typename Rhs, int Mode,
int UpLo = (Mode & Lower)
? Lower
@@ -200,15 +206,15 @@ template<typename Lhs, typename Rhs, int Mode,
? Upper
: -1,
int StorageOrder = int(Lhs::Flags) & (RowMajorBit)>
-struct ei_sparse_solve_triangular_sparse_selector;
+struct sparse_solve_triangular_sparse_selector;
// forward substitution, col-major
template<typename Lhs, typename Rhs, int Mode, int UpLo>
-struct ei_sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
+struct sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
{
typedef typename Rhs::Scalar Scalar;
- typedef typename ei_promote_index_type<typename ei_traits<Lhs>::Index,
- typename ei_traits<Rhs>::Index>::type Index;
+ typedef typename promote_index_type<typename traits<Lhs>::Index,
+ typename traits<Rhs>::Index>::type Index;
static void run(const Lhs& lhs, Rhs& other)
{
const bool IsLower = (UpLo==Lower);
@@ -243,7 +249,7 @@ struct ei_sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
{
if (IsLower)
{
- ei_assert(it.index()==i);
+ eigen_assert(it.index()==i);
ci /= it.value();
}
else
@@ -283,22 +289,24 @@ struct ei_sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
}
};
+} // end namespace internal
+
template<typename ExpressionType,int Mode>
template<typename OtherDerived>
void SparseTriangularView<ExpressionType,Mode>::solveInPlace(SparseMatrixBase<OtherDerived>& other) const
{
- ei_assert(m_matrix.cols() == m_matrix.rows());
- ei_assert(m_matrix.cols() == other.rows());
- ei_assert(!(Mode & ZeroDiag));
- ei_assert(Mode & (Upper|Lower));
+ eigen_assert(m_matrix.cols() == m_matrix.rows());
+ eigen_assert(m_matrix.cols() == other.rows());
+ eigen_assert(!(Mode & ZeroDiag));
+ eigen_assert(Mode & (Upper|Lower));
-// enum { copy = ei_traits<OtherDerived>::Flags & RowMajorBit };
+// enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
-// typedef typename ei_meta_if<copy,
-// typename ei_plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::ret OtherCopy;
+// typedef typename internal::conditional<copy,
+// typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
// OtherCopy otherCopy(other.derived());
- ei_sparse_solve_triangular_sparse_selector<ExpressionType, OtherDerived, Mode>::run(m_matrix, other.derived());
+ internal::sparse_solve_triangular_sparse_selector<ExpressionType, OtherDerived, Mode>::run(m_matrix, other.derived());
// if (copy)
// other = otherCopy;
@@ -319,10 +327,10 @@ void SparseMatrixBase<Derived>::solveTriangularInPlace(MatrixBase<OtherDerived>&
/** \deprecated */
template<typename Derived>
template<typename OtherDerived>
-typename ei_plain_matrix_type_column_major<OtherDerived>::type
+typename internal::plain_matrix_type_column_major<OtherDerived>::type
SparseMatrixBase<Derived>::solveTriangular(const MatrixBase<OtherDerived>& other) const
{
- typename ei_plain_matrix_type_column_major<OtherDerived>::type res(other);
+ typename internal::plain_matrix_type_column_major<OtherDerived>::type res(other);
derived().solveTriangularInPlace(res);
return res;
}
diff --git a/Eigen/src/StlSupport/StdVector.h b/Eigen/src/StlSupport/StdVector.h
index 9786bac34..81a2d7762 100644
--- a/Eigen/src/StlSupport/StdVector.h
+++ b/Eigen/src/StlSupport/StdVector.h
@@ -67,9 +67,6 @@ namespace std \
}; \
}
-// check whether we really need the std::vector specialization
-#if !(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&). */
-
namespace std {
#define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \
@@ -119,6 +116,13 @@ namespace std {
{ return vector_base::insert(position,x); }
void insert(const_iterator position, size_type new_size, const value_type& x)
{ vector_base::insert(position, new_size, x); }
+#elif defined(_GLIBCXX_VECTOR) && (!(EIGEN_GNUC_AT_LEAST(4,1)))
+ /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&).
+ * However, this specialization is still needed to make the above EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION trick to work. */
+ void resize(size_type new_size, const value_type& x)
+ {
+ vector_base::resize(new_size,x);
+ }
#elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,2)
// workaround GCC std::vector implementation
void resize(size_type new_size, const value_type& x)
@@ -142,6 +146,4 @@ namespace std {
};
}
-#endif // check whether specialization is actually required
-
#endif // EIGEN_STDVECTOR_H
diff --git a/Eigen/src/StlSupport/details.h b/Eigen/src/StlSupport/details.h
index 5ee4dba94..d3dbe0be8 100644
--- a/Eigen/src/StlSupport/details.h
+++ b/Eigen/src/StlSupport/details.h
@@ -27,58 +27,60 @@
#define EIGEN_STL_DETAILS_H
#ifndef EIGEN_ALIGNED_ALLOCATOR
- #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator
+ #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator
#endif
namespace Eigen {
- // This one is needed to prevent reimplementing the whole std::vector.
- template <class T>
- class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
- {
- public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T value_type;
+ // This one is needed to prevent reimplementing the whole std::vector.
+ template <class T>
+ class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T value_type;
- template<class U>
- struct rebind
- {
- typedef aligned_allocator_indirection<U> other;
- };
+ template<class U>
+ struct rebind
+ {
+ typedef aligned_allocator_indirection<U> other;
+ };
- aligned_allocator_indirection() {}
- aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
- aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
- template<class U>
- aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
- template<class U>
- aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
- ~aligned_allocator_indirection() {}
- };
+ aligned_allocator_indirection() {}
+ aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
+ aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
+ template<class U>
+ aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
+ template<class U>
+ aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
+ ~aligned_allocator_indirection() {}
+ };
#ifdef _MSC_VER
- // sometimes, MSVC detects, at compile time, that the argument x
- // in std::vector::resize(size_t s,T x) won't be aligned and generate an error
- // even if this function is never called. Whence this little wrapper.
-#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) Eigen::ei_workaround_msvc_stl_support<T>
- template<typename T> struct ei_workaround_msvc_stl_support : public T
- {
- inline ei_workaround_msvc_stl_support() : T() {}
- inline ei_workaround_msvc_stl_support(const T& other) : T(other) {}
- inline operator T& () { return *static_cast<T*>(this); }
- inline operator const T& () const { return *static_cast<const T*>(this); }
- template<typename OtherT>
- inline T& operator=(const OtherT& other)
- { T::operator=(other); return *this; }
- inline ei_workaround_msvc_stl_support& operator=(const ei_workaround_msvc_stl_support& other)
- { T::operator=(other); return *this; }
- };
+ // sometimes, MSVC detects, at compile time, that the argument x
+ // in std::vector::resize(size_t s,T x) won't be aligned and generate an error
+ // even if this function is never called. Whence this little wrapper.
+#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) Eigen::internal::workaround_msvc_stl_support<T>
+ namespace internal {
+ template<typename T> struct workaround_msvc_stl_support : public T
+ {
+ inline workaround_msvc_stl_support() : T() {}
+ inline workaround_msvc_stl_support(const T& other) : T(other) {}
+ inline operator T& () { return *static_cast<T*>(this); }
+ inline operator const T& () const { return *static_cast<const T*>(this); }
+ template<typename OtherT>
+ inline T& operator=(const OtherT& other)
+ { T::operator=(other); return *this; }
+ inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
+ { T::operator=(other); return *this; }
+ };
+ }
#else
diff --git a/Eigen/src/misc/Image.h b/Eigen/src/misc/Image.h
index 32392fd29..19b3e08cb 100644
--- a/Eigen/src/misc/Image.h
+++ b/Eigen/src/misc/Image.h
@@ -25,11 +25,13 @@
#ifndef EIGEN_MISC_IMAGE_H
#define EIGEN_MISC_IMAGE_H
-/** \class ei_image_retval_base
+namespace internal {
+
+/** \class image_retval_base
*
*/
template<typename DecompositionType>
-struct ei_traits<ei_image_retval_base<DecompositionType> >
+struct traits<image_retval_base<DecompositionType> >
{
typedef typename DecompositionType::MatrixType MatrixType;
typedef Matrix<
@@ -43,15 +45,15 @@ struct ei_traits<ei_image_retval_base<DecompositionType> >
> ReturnType;
};
-template<typename _DecompositionType> struct ei_image_retval_base
- : public ReturnByValue<ei_image_retval_base<_DecompositionType> >
+template<typename _DecompositionType> struct image_retval_base
+ : public ReturnByValue<image_retval_base<_DecompositionType> >
{
typedef _DecompositionType DecompositionType;
typedef typename DecompositionType::MatrixType MatrixType;
- typedef ReturnByValue<ei_image_retval_base> Base;
+ typedef ReturnByValue<image_retval_base> Base;
typedef typename Base::Index Index;
- ei_image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix)
+ image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix)
: m_dec(dec), m_rank(dec.rank()),
m_cols(m_rank == 0 ? 1 : m_rank),
m_originalMatrix(originalMatrix)
@@ -65,7 +67,7 @@ template<typename _DecompositionType> struct ei_image_retval_base
template<typename Dest> inline void evalTo(Dest& dst) const
{
- static_cast<const ei_image_retval<DecompositionType>*>(this)->evalTo(dst);
+ static_cast<const image_retval<DecompositionType>*>(this)->evalTo(dst);
}
protected:
@@ -74,18 +76,20 @@ template<typename _DecompositionType> struct ei_image_retval_base
const MatrixType& m_originalMatrix;
};
+} // end namespace internal
+
#define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \
typedef typename DecompositionType::MatrixType MatrixType; \
typedef typename MatrixType::Scalar Scalar; \
typedef typename MatrixType::RealScalar RealScalar; \
typedef typename MatrixType::Index Index; \
- typedef ei_image_retval_base<DecompositionType> Base; \
+ typedef Eigen::internal::image_retval_base<DecompositionType> Base; \
using Base::dec; \
using Base::originalMatrix; \
using Base::rank; \
using Base::rows; \
using Base::cols; \
- ei_image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
+ image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
: Base(dec, originalMatrix) {}
#endif // EIGEN_MISC_IMAGE_H
diff --git a/Eigen/src/misc/Kernel.h b/Eigen/src/misc/Kernel.h
index 38a2d4097..0115970e8 100644
--- a/Eigen/src/misc/Kernel.h
+++ b/Eigen/src/misc/Kernel.h
@@ -25,11 +25,13 @@
#ifndef EIGEN_MISC_KERNEL_H
#define EIGEN_MISC_KERNEL_H
-/** \class ei_kernel_retval_base
+namespace internal {
+
+/** \class kernel_retval_base
*
*/
template<typename DecompositionType>
-struct ei_traits<ei_kernel_retval_base<DecompositionType> >
+struct traits<kernel_retval_base<DecompositionType> >
{
typedef typename DecompositionType::MatrixType MatrixType;
typedef Matrix<
@@ -45,14 +47,14 @@ struct ei_traits<ei_kernel_retval_base<DecompositionType> >
> ReturnType;
};
-template<typename _DecompositionType> struct ei_kernel_retval_base
- : public ReturnByValue<ei_kernel_retval_base<_DecompositionType> >
+template<typename _DecompositionType> struct kernel_retval_base
+ : public ReturnByValue<kernel_retval_base<_DecompositionType> >
{
typedef _DecompositionType DecompositionType;
- typedef ReturnByValue<ei_kernel_retval_base> Base;
+ typedef ReturnByValue<kernel_retval_base> Base;
typedef typename Base::Index Index;
- ei_kernel_retval_base(const DecompositionType& dec)
+ kernel_retval_base(const DecompositionType& dec)
: m_dec(dec),
m_rank(dec.rank()),
m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
@@ -65,7 +67,7 @@ template<typename _DecompositionType> struct ei_kernel_retval_base
template<typename Dest> inline void evalTo(Dest& dst) const
{
- static_cast<const ei_kernel_retval<DecompositionType>*>(this)->evalTo(dst);
+ static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
}
protected:
@@ -73,16 +75,18 @@ template<typename _DecompositionType> struct ei_kernel_retval_base
Index m_rank, m_cols;
};
+} // end namespace internal
+
#define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
typedef typename DecompositionType::MatrixType MatrixType; \
typedef typename MatrixType::Scalar Scalar; \
typedef typename MatrixType::RealScalar RealScalar; \
typedef typename MatrixType::Index Index; \
- typedef ei_kernel_retval_base<DecompositionType> Base; \
+ typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
using Base::dec; \
using Base::rank; \
using Base::rows; \
using Base::cols; \
- ei_kernel_retval(const DecompositionType& dec) : Base(dec) {}
+ kernel_retval(const DecompositionType& dec) : Base(dec) {}
#endif // EIGEN_MISC_KERNEL_H
diff --git a/Eigen/src/misc/Solve.h b/Eigen/src/misc/Solve.h
index d6fc67406..b7cbcadb3 100644
--- a/Eigen/src/misc/Solve.h
+++ b/Eigen/src/misc/Solve.h
@@ -25,11 +25,13 @@
#ifndef EIGEN_MISC_SOLVE_H
#define EIGEN_MISC_SOLVE_H
-/** \class ei_solve_retval_base
+namespace internal {
+
+/** \class solve_retval_base
*
*/
template<typename DecompositionType, typename Rhs>
-struct ei_traits<ei_solve_retval_base<DecompositionType, Rhs> >
+struct traits<solve_retval_base<DecompositionType, Rhs> >
{
typedef typename DecompositionType::MatrixType MatrixType;
typedef Matrix<typename Rhs::Scalar,
@@ -40,15 +42,15 @@ struct ei_traits<ei_solve_retval_base<DecompositionType, Rhs> >
Rhs::MaxColsAtCompileTime> ReturnType;
};
-template<typename _DecompositionType, typename Rhs> struct ei_solve_retval_base
- : public ReturnByValue<ei_solve_retval_base<_DecompositionType, Rhs> >
+template<typename _DecompositionType, typename Rhs> struct solve_retval_base
+ : public ReturnByValue<solve_retval_base<_DecompositionType, Rhs> >
{
- typedef typename ei_cleantype<typename Rhs::Nested>::type RhsNestedCleaned;
+ typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
typedef _DecompositionType DecompositionType;
- typedef ReturnByValue<ei_solve_retval_base> Base;
+ typedef ReturnByValue<solve_retval_base> Base;
typedef typename Base::Index Index;
- ei_solve_retval_base(const DecompositionType& dec, const Rhs& rhs)
+ solve_retval_base(const DecompositionType& dec, const Rhs& rhs)
: m_dec(dec), m_rhs(rhs)
{}
@@ -59,7 +61,7 @@ template<typename _DecompositionType, typename Rhs> struct ei_solve_retval_base
template<typename Dest> inline void evalTo(Dest& dst) const
{
- static_cast<const ei_solve_retval<DecompositionType,Rhs>*>(this)->evalTo(dst);
+ static_cast<const solve_retval<DecompositionType,Rhs>*>(this)->evalTo(dst);
}
protected:
@@ -67,17 +69,19 @@ template<typename _DecompositionType, typename Rhs> struct ei_solve_retval_base
const typename Rhs::Nested m_rhs;
};
+} // end namespace internal
+
#define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \
typedef typename DecompositionType::MatrixType MatrixType; \
typedef typename MatrixType::Scalar Scalar; \
typedef typename MatrixType::RealScalar RealScalar; \
typedef typename MatrixType::Index Index; \
- typedef ei_solve_retval_base<DecompositionType,Rhs> Base; \
+ typedef Eigen::internal::solve_retval_base<DecompositionType,Rhs> Base; \
using Base::dec; \
using Base::rhs; \
using Base::rows; \
using Base::cols; \
- ei_solve_retval(const DecompositionType& dec, const Rhs& rhs) \
+ solve_retval(const DecompositionType& dec, const Rhs& rhs) \
: Base(dec, rhs) {}
#endif // EIGEN_MISC_SOLVE_H
diff --git a/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/Eigen/src/plugins/ArrayCwiseBinaryOps.h
index b48a58234..d19299c35 100644
--- a/Eigen/src/plugins/ArrayCwiseBinaryOps.h
+++ b/Eigen/src/plugins/ArrayCwiseBinaryOps.h
@@ -14,10 +14,10 @@ operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa MatrixBase::cwiseQuotient
*/
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>
operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
- return CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
+ return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
}
/** \returns an expression of the coefficient-wise min of \c *this and \a other
@@ -27,7 +27,7 @@ operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
*
* \sa max()
*/
-EIGEN_MAKE_CWISE_BINARY_OP(min,ei_scalar_min_op)
+EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
/** \returns an expression of the coefficient-wise max of \c *this and \a other
*
@@ -36,7 +36,7 @@ EIGEN_MAKE_CWISE_BINARY_OP(min,ei_scalar_min_op)
*
* \sa min()
*/
-EIGEN_MAKE_CWISE_BINARY_OP(max,ei_scalar_max_op)
+EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
/** \returns an expression of the coefficient-wise \< operator of *this and \a other
*
@@ -111,13 +111,13 @@ EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
*
* \sa operator+=(), operator-()
*/
-inline const CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
operator+(const Scalar& scalar) const
{
- return CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>(derived(), ei_scalar_add_op<Scalar>(scalar));
+ return CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
}
-friend inline const CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>
+friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
{
return other + scalar;
@@ -130,13 +130,13 @@ operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>&
*
* \sa operator+(), operator-=()
*/
-inline const CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
operator-(const Scalar& scalar) const
{
return *this + (-scalar);
}
-friend inline const CwiseUnaryOp<ei_scalar_add_op<Scalar>, CwiseUnaryOp<ei_scalar_opposite_op<Scalar>,Derived> >
+friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, CwiseUnaryOp<internal::scalar_opposite_op<Scalar>,Derived> >
operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
{
return (-other) + scalar;
diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h
index 9695bf921..78479b985 100644
--- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h
+++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h
@@ -7,7 +7,7 @@
*
* \sa abs2()
*/
-EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_abs_op<Scalar>, Derived>
+EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, Derived>
abs() const
{
return derived();
@@ -20,7 +20,7 @@ abs() const
*
* \sa abs(), square()
*/
-EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_abs2_op<Scalar>, Derived>
+EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, Derived>
abs2() const
{
return derived();
@@ -33,7 +33,7 @@ abs2() const
*
* \sa pow(), log(), sin(), cos()
*/
-inline const CwiseUnaryOp<ei_scalar_exp_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_exp_op<Scalar>, Derived>
exp() const
{
return derived();
@@ -46,7 +46,7 @@ exp() const
*
* \sa exp()
*/
-inline const CwiseUnaryOp<ei_scalar_log_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_log_op<Scalar>, Derived>
log() const
{
return derived();
@@ -59,7 +59,7 @@ log() const
*
* \sa pow(), square()
*/
-inline const CwiseUnaryOp<ei_scalar_sqrt_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, Derived>
sqrt() const
{
return derived();
@@ -72,7 +72,7 @@ sqrt() const
*
* \sa sin(), exp()
*/
-inline const CwiseUnaryOp<ei_scalar_cos_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_cos_op<Scalar>, Derived>
cos() const
{
return derived();
@@ -86,7 +86,7 @@ cos() const
*
* \sa cos(), exp()
*/
-inline const CwiseUnaryOp<ei_scalar_sin_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_sin_op<Scalar>, Derived>
sin() const
{
return derived();
@@ -100,11 +100,11 @@ sin() const
*
* \sa exp(), log()
*/
-inline const CwiseUnaryOp<ei_scalar_pow_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_pow_op<Scalar>, Derived>
pow(const Scalar& exponent) const
{
- return CwiseUnaryOp<ei_scalar_pow_op<Scalar>,Derived>
- (derived(), ei_scalar_pow_op<Scalar>(exponent));
+ return CwiseUnaryOp<internal::scalar_pow_op<Scalar>,Derived>
+ (derived(), internal::scalar_pow_op<Scalar>(exponent));
}
@@ -115,7 +115,7 @@ pow(const Scalar& exponent) const
*
* \sa operator/(), operator*()
*/
-inline const CwiseUnaryOp<ei_scalar_inverse_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, Derived>
inverse() const
{
return derived();
@@ -128,7 +128,7 @@ inverse() const
*
* \sa operator/(), operator*(), abs2()
*/
-inline const CwiseUnaryOp<ei_scalar_square_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_square_op<Scalar>, Derived>
square() const
{
return derived();
@@ -141,7 +141,7 @@ square() const
*
* \sa square(), pow()
*/
-inline const CwiseUnaryOp<ei_scalar_cube_op<Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_cube_op<Scalar>, Derived>
cube() const
{
return derived();
diff --git a/Eigen/src/plugins/BlockMethods.h b/Eigen/src/plugins/BlockMethods.h
index 3aae95a64..2a0e508e8 100644
--- a/Eigen/src/plugins/BlockMethods.h
+++ b/Eigen/src/plugins/BlockMethods.h
@@ -29,17 +29,17 @@
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** \internal expression type of a column */
-typedef Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
+typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
/** \internal expression type of a row */
-typedef Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
+typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
/** \internal expression type of a block of whole columns */
-typedef Block<Derived, ei_traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
+typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
/** \internal expression type of a block of whole rows */
-typedef Block<Derived, Dynamic, ei_traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
+typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
/** \internal expression type of a block of whole columns */
-template<int N> struct NColsBlockXpr { typedef Block<Derived, ei_traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
+template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
/** \internal expression type of a block of whole rows */
-template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, ei_traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
+template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
#endif // not EIGEN_PARSED_BY_DOXYGEN
diff --git a/Eigen/src/plugins/CommonCwiseBinaryOps.h b/Eigen/src/plugins/CommonCwiseBinaryOps.h
index bb0b17c09..944c86148 100644
--- a/Eigen/src/plugins/CommonCwiseBinaryOps.h
+++ b/Eigen/src/plugins/CommonCwiseBinaryOps.h
@@ -31,7 +31,7 @@
*
* \sa class CwiseBinaryOp, operator-=()
*/
-EIGEN_MAKE_CWISE_BINARY_OP(operator-,ei_scalar_difference_op)
+EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op)
/** \returns an expression of the sum of \c *this and \a other
*
@@ -39,7 +39,7 @@ EIGEN_MAKE_CWISE_BINARY_OP(operator-,ei_scalar_difference_op)
*
* \sa class CwiseBinaryOp, operator+=()
*/
-EIGEN_MAKE_CWISE_BINARY_OP(operator+,ei_scalar_sum_op)
+EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op)
/** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other
*
diff --git a/Eigen/src/plugins/CommonCwiseUnaryOps.h b/Eigen/src/plugins/CommonCwiseUnaryOps.h
index c16b177d8..f2da51efa 100644
--- a/Eigen/src/plugins/CommonCwiseUnaryOps.h
+++ b/Eigen/src/plugins/CommonCwiseUnaryOps.h
@@ -28,34 +28,34 @@
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** \internal Represents a scalar multiple of an expression */
-typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> ScalarMultipleReturnType;
+typedef CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, Derived> ScalarMultipleReturnType;
/** \internal Represents a quotient of an expression by a scalar*/
-typedef CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived> ScalarQuotient1ReturnType;
+typedef CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, Derived> ScalarQuotient1ReturnType;
/** \internal the return type of conjugate() */
-typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>,
+typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Derived>,
const Derived&
- >::ret ConjugateReturnType;
+ >::type ConjugateReturnType;
/** \internal the return type of real() const */
-typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- const CwiseUnaryOp<ei_scalar_real_op<Scalar>, Derived>,
+typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ const CwiseUnaryOp<internal::scalar_real_op<Scalar>, Derived>,
const Derived&
- >::ret RealReturnType;
+ >::type RealReturnType;
/** \internal the return type of real() */
-typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
- CwiseUnaryView<ei_scalar_real_ref_op<Scalar>, Derived>,
+typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
+ CwiseUnaryView<internal::scalar_real_ref_op<Scalar>, Derived>,
Derived&
- >::ret NonConstRealReturnType;
+ >::type NonConstRealReturnType;
/** \internal the return type of imag() const */
-typedef CwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
+typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, Derived> ImagReturnType;
/** \internal the return type of imag() */
-typedef CwiseUnaryView<ei_scalar_imag_ref_op<Scalar>, Derived> NonConstImagReturnType;
+typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstImagReturnType;
#endif // not EIGEN_PARSED_BY_DOXYGEN
/** \returns an expression of the opposite of \c *this
*/
-inline const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived>
+inline const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>,Derived>
operator-() const { return derived(); }
@@ -63,8 +63,8 @@ operator-() const { return derived(); }
inline const ScalarMultipleReturnType
operator*(const Scalar& scalar) const
{
- return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
- (derived(), ei_scalar_multiple_op<Scalar>(scalar));
+ return CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, Derived>
+ (derived(), internal::scalar_multiple_op<Scalar>(scalar));
}
#ifdef EIGEN_PARSED_BY_DOXYGEN
@@ -72,26 +72,26 @@ const ScalarMultipleReturnType operator*(const RealScalar& scalar) const;
#endif
/** \returns an expression of \c *this divided by the scalar value \a scalar */
-inline const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
+inline const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, Derived>
operator/(const Scalar& scalar) const
{
- return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived>
- (derived(), ei_scalar_quotient1_op<Scalar>(scalar));
+ return CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, Derived>
+ (derived(), internal::scalar_quotient1_op<Scalar>(scalar));
}
/** Overloaded for efficient real matrix times complex scalar value */
-inline const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
+inline const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
operator*(const std::complex<Scalar>& scalar) const
{
- return CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
- (*static_cast<const Derived*>(this), ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
+ return CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
+ (*static_cast<const Derived*>(this), internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
}
inline friend const ScalarMultipleReturnType
operator*(const Scalar& scalar, const StorageBaseType& matrix)
{ return matrix*scalar; }
-inline friend const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
+inline friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix)
{ return matrix*scalar; }
@@ -103,7 +103,7 @@ operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix)
* \sa class CwiseUnaryOp
*/
template<typename NewType>
-typename ei_cast_return_type<Derived,const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> >::type
+typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, Derived> >::type
cast() const
{
return derived();
diff --git a/Eigen/src/plugins/MatrixCwiseBinaryOps.h b/Eigen/src/plugins/MatrixCwiseBinaryOps.h
index a1f673df5..75397c512 100644
--- a/Eigen/src/plugins/MatrixCwiseBinaryOps.h
+++ b/Eigen/src/plugins/MatrixCwiseBinaryOps.h
@@ -85,10 +85,10 @@ cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa class CwiseBinaryOp, max()
*/
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_min_op<Scalar>, Derived, OtherDerived>
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, Derived, OtherDerived>
cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
- return CwiseBinaryOp<ei_scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
+ return CwiseBinaryOp<internal::scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
}
/** \returns an expression of the coefficient-wise max of *this and \a other
@@ -99,10 +99,10 @@ cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa class CwiseBinaryOp, min()
*/
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_max_op<Scalar>, Derived, OtherDerived>
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, Derived, OtherDerived>
cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
- return CwiseBinaryOp<ei_scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
+ return CwiseBinaryOp<internal::scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
}
/** \returns an expression of the coefficient-wise quotient of *this and \a other
@@ -113,8 +113,8 @@ cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse()
*/
template<typename OtherDerived>
-EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>
+EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>
cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
- return CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
+ return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
}
diff --git a/Eigen/src/plugins/MatrixCwiseUnaryOps.h b/Eigen/src/plugins/MatrixCwiseUnaryOps.h
index a33de85a5..85df29cbe 100644
--- a/Eigen/src/plugins/MatrixCwiseUnaryOps.h
+++ b/Eigen/src/plugins/MatrixCwiseUnaryOps.h
@@ -32,7 +32,7 @@
*
* \sa cwiseAbs2()
*/
-EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_abs_op<Scalar>,Derived>
+EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>,Derived>
cwiseAbs() const { return derived(); }
/** \returns an expression of the coefficient-wise squared absolute value of \c *this
@@ -42,7 +42,7 @@ cwiseAbs() const { return derived(); }
*
* \sa cwiseAbs()
*/
-EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_abs2_op<Scalar>,Derived>
+EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>,Derived>
cwiseAbs2() const { return derived(); }
/** \returns an expression of the coefficient-wise square root of *this.
@@ -52,7 +52,7 @@ cwiseAbs2() const { return derived(); }
*
* \sa cwisePow(), cwiseSquare()
*/
-inline const CwiseUnaryOp<ei_scalar_sqrt_op<Scalar>,Derived>
+inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>,Derived>
cwiseSqrt() const { return derived(); }
/** \returns an expression of the coefficient-wise inverse of *this.
@@ -62,7 +62,7 @@ cwiseSqrt() const { return derived(); }
*
* \sa cwiseProduct()
*/
-inline const CwiseUnaryOp<ei_scalar_inverse_op<Scalar>,Derived>
+inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>,Derived>
cwiseInverse() const { return derived(); }
/** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s
diff --git a/bench/BenchSparseUtil.h b/bench/BenchSparseUtil.h
index 305c70aeb..ff836bffe 100644
--- a/bench/BenchSparseUtil.h
+++ b/bench/BenchSparseUtil.h
@@ -31,7 +31,7 @@ void fillMatrix(float density, int rows, int cols, EigenSparseMatrix& dst)
{
for(int i = 0; i < rows; i++)
{
- Scalar v = (ei_random<float>(0,1) < density) ? ei_random<Scalar>() : 0;
+ Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;
if (v!=0)
dst.insert(i,j) = v;
}
@@ -48,12 +48,12 @@ void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix& dst)
std::set<int> aux;
for(int i = 0; i < nnzPerCol; i++)
{
- int k = ei_random<int>(0,rows-1);
+ int k = internal::random<int>(0,rows-1);
while (aux.find(k)!=aux.end())
- k = ei_random<int>(0,rows-1);
+ k = internal::random<int>(0,rows-1);
aux.insert(k);
- dst.insert(k,j) = ei_random<Scalar>();
+ dst.insert(k,j) = internal::random<Scalar>();
}
}
dst.finalize();
diff --git a/bench/benchBlasGemm.cpp b/bench/benchBlasGemm.cpp
index 81ff3f724..cb086a555 100644
--- a/bench/benchBlasGemm.cpp
+++ b/bench/benchBlasGemm.cpp
@@ -208,9 +208,9 @@ void check_product(void)
int M, N, K;
for (uint i=0; i<1000; ++i)
{
- M = ei_random<int>(1,64);
- N = ei_random<int>(1,768);
- K = ei_random<int>(1,768);
+ M = internal::random<int>(1,64);
+ N = internal::random<int>(1,768);
+ K = internal::random<int>(1,768);
M = (0 + M) * 1;
std::cout << M << " x " << N << " x " << K << "\n";
check_product(M, N, K);
diff --git a/bench/benchCholesky.cpp b/bench/benchCholesky.cpp
index ca9bb20bc..42b3e1285 100644
--- a/bench/benchCholesky.cpp
+++ b/bench/benchCholesky.cpp
@@ -49,8 +49,8 @@ __attribute__ ((noinline)) void benchLLT(const MatrixType& m)
BenchTimer timerNoSqrt, timerSqrt;
Scalar acc = 0;
- int r = ei_random<int>(0,covMat.rows()-1);
- int c = ei_random<int>(0,covMat.cols()-1);
+ int r = internal::random<int>(0,covMat.rows()-1);
+ int c = internal::random<int>(0,covMat.cols()-1);
for (int t=0; t<TRIES; ++t)
{
timerNoSqrt.start();
diff --git a/bench/benchEigenSolver.cpp b/bench/benchEigenSolver.cpp
index de2fa600e..dd78c7e01 100644
--- a/bench/benchEigenSolver.cpp
+++ b/bench/benchEigenSolver.cpp
@@ -48,8 +48,8 @@ __attribute__ ((noinline)) void benchEigenSolver(const MatrixType& m)
BenchTimer timerSa, timerStd;
Scalar acc = 0;
- int r = ei_random<int>(0,covMat.rows()-1);
- int c = ei_random<int>(0,covMat.cols()-1);
+ int r = internal::random<int>(0,covMat.rows()-1);
+ int c = internal::random<int>(0,covMat.cols()-1);
{
SelfAdjointEigenSolver<SquareMatrixType> ei(covMat);
for (int t=0; t<TRIES; ++t)
diff --git a/bench/benchVecAdd.cpp b/bench/benchVecAdd.cpp
index 755c75ed5..ce8e1e911 100644
--- a/bench/benchVecAdd.cpp
+++ b/bench/benchVecAdd.cpp
@@ -22,9 +22,9 @@ int main(int argc, char* argv[])
{
int size = SIZE * 8;
int size2 = size * size;
- Scalar* a = ei_aligned_new<Scalar>(size2);
- Scalar* b = ei_aligned_new<Scalar>(size2+4)+1;
- Scalar* c = ei_aligned_new<Scalar>(size2);
+ Scalar* a = internal::aligned_new<Scalar>(size2);
+ Scalar* b = internal::aligned_new<Scalar>(size2+4)+1;
+ Scalar* c = internal::aligned_new<Scalar>(size2);
for (int i=0; i<size; ++i)
{
@@ -90,46 +90,46 @@ void benchVec(VectorXf& a, VectorXf& b, VectorXf& c)
void benchVec(Scalar* a, Scalar* b, Scalar* c, int size)
{
- typedef ei_packet_traits<Scalar>::type PacketScalar;
- const int PacketSize = ei_packet_traits<Scalar>::size;
+ typedef internal::packet_traits<Scalar>::type PacketScalar;
+ const int PacketSize = internal::packet_traits<Scalar>::size;
PacketScalar a0, a1, a2, a3, b0, b1, b2, b3;
for (int k=0; k<REPEAT; ++k)
for (int i=0; i<size; i+=PacketSize*8)
{
-// a0 = ei_pload(&a[i]);
-// b0 = ei_pload(&b[i]);
-// a1 = ei_pload(&a[i+1*PacketSize]);
-// b1 = ei_pload(&b[i+1*PacketSize]);
-// a2 = ei_pload(&a[i+2*PacketSize]);
-// b2 = ei_pload(&b[i+2*PacketSize]);
-// a3 = ei_pload(&a[i+3*PacketSize]);
-// b3 = ei_pload(&b[i+3*PacketSize]);
-// ei_pstore(&a[i], ei_padd(a0, b0));
-// a0 = ei_pload(&a[i+4*PacketSize]);
-// b0 = ei_pload(&b[i+4*PacketSize]);
+// a0 = internal::pload(&a[i]);
+// b0 = internal::pload(&b[i]);
+// a1 = internal::pload(&a[i+1*PacketSize]);
+// b1 = internal::pload(&b[i+1*PacketSize]);
+// a2 = internal::pload(&a[i+2*PacketSize]);
+// b2 = internal::pload(&b[i+2*PacketSize]);
+// a3 = internal::pload(&a[i+3*PacketSize]);
+// b3 = internal::pload(&b[i+3*PacketSize]);
+// internal::pstore(&a[i], internal::padd(a0, b0));
+// a0 = internal::pload(&a[i+4*PacketSize]);
+// b0 = internal::pload(&b[i+4*PacketSize]);
//
-// ei_pstore(&a[i+1*PacketSize], ei_padd(a1, b1));
-// a1 = ei_pload(&a[i+5*PacketSize]);
-// b1 = ei_pload(&b[i+5*PacketSize]);
+// internal::pstore(&a[i+1*PacketSize], internal::padd(a1, b1));
+// a1 = internal::pload(&a[i+5*PacketSize]);
+// b1 = internal::pload(&b[i+5*PacketSize]);
//
-// ei_pstore(&a[i+2*PacketSize], ei_padd(a2, b2));
-// a2 = ei_pload(&a[i+6*PacketSize]);
-// b2 = ei_pload(&b[i+6*PacketSize]);
+// internal::pstore(&a[i+2*PacketSize], internal::padd(a2, b2));
+// a2 = internal::pload(&a[i+6*PacketSize]);
+// b2 = internal::pload(&b[i+6*PacketSize]);
//
-// ei_pstore(&a[i+3*PacketSize], ei_padd(a3, b3));
-// a3 = ei_pload(&a[i+7*PacketSize]);
-// b3 = ei_pload(&b[i+7*PacketSize]);
+// internal::pstore(&a[i+3*PacketSize], internal::padd(a3, b3));
+// a3 = internal::pload(&a[i+7*PacketSize]);
+// b3 = internal::pload(&b[i+7*PacketSize]);
//
-// ei_pstore(&a[i+4*PacketSize], ei_padd(a0, b0));
-// ei_pstore(&a[i+5*PacketSize], ei_padd(a1, b1));
-// ei_pstore(&a[i+6*PacketSize], ei_padd(a2, b2));
-// ei_pstore(&a[i+7*PacketSize], ei_padd(a3, b3));
+// internal::pstore(&a[i+4*PacketSize], internal::padd(a0, b0));
+// internal::pstore(&a[i+5*PacketSize], internal::padd(a1, b1));
+// internal::pstore(&a[i+6*PacketSize], internal::padd(a2, b2));
+// internal::pstore(&a[i+7*PacketSize], internal::padd(a3, b3));
- ei_pstore(&a[i+2*PacketSize], ei_padd(ei_ploadu(&a[i+2*PacketSize]), ei_ploadu(&b[i+2*PacketSize])));
- ei_pstore(&a[i+3*PacketSize], ei_padd(ei_ploadu(&a[i+3*PacketSize]), ei_ploadu(&b[i+3*PacketSize])));
- ei_pstore(&a[i+4*PacketSize], ei_padd(ei_ploadu(&a[i+4*PacketSize]), ei_ploadu(&b[i+4*PacketSize])));
- ei_pstore(&a[i+5*PacketSize], ei_padd(ei_ploadu(&a[i+5*PacketSize]), ei_ploadu(&b[i+5*PacketSize])));
- ei_pstore(&a[i+6*PacketSize], ei_padd(ei_ploadu(&a[i+6*PacketSize]), ei_ploadu(&b[i+6*PacketSize])));
- ei_pstore(&a[i+7*PacketSize], ei_padd(ei_ploadu(&a[i+7*PacketSize]), ei_ploadu(&b[i+7*PacketSize])));
+ internal::pstore(&a[i+2*PacketSize], internal::padd(internal::ploadu(&a[i+2*PacketSize]), internal::ploadu(&b[i+2*PacketSize])));
+ internal::pstore(&a[i+3*PacketSize], internal::padd(internal::ploadu(&a[i+3*PacketSize]), internal::ploadu(&b[i+3*PacketSize])));
+ internal::pstore(&a[i+4*PacketSize], internal::padd(internal::ploadu(&a[i+4*PacketSize]), internal::ploadu(&b[i+4*PacketSize])));
+ internal::pstore(&a[i+5*PacketSize], internal::padd(internal::ploadu(&a[i+5*PacketSize]), internal::ploadu(&b[i+5*PacketSize])));
+ internal::pstore(&a[i+6*PacketSize], internal::padd(internal::ploadu(&a[i+6*PacketSize]), internal::ploadu(&b[i+6*PacketSize])));
+ internal::pstore(&a[i+7*PacketSize], internal::padd(internal::ploadu(&a[i+7*PacketSize]), internal::ploadu(&b[i+7*PacketSize])));
}
}
diff --git a/bench/bench_gemm.cpp b/bench/bench_gemm.cpp
index bc3089b9f..65fe4da1e 100644
--- a/bench/bench_gemm.cpp
+++ b/bench/bench_gemm.cpp
@@ -116,11 +116,11 @@ EIGEN_DONT_INLINE void gemm(const A& a, const B& b, C& c)
int main(int argc, char ** argv)
{
- std::ptrdiff_t l1 = ei_queryL1CacheSize();
- std::ptrdiff_t l2 = ei_queryTopLevelCacheSize();
+ std::ptrdiff_t l1 = internal::queryL1CacheSize();
+ std::ptrdiff_t l2 = internal::queryTopLevelCacheSize();
std::cout << "L1 cache size = " << (l1>0 ? l1/1024 : -1) << " KB\n";
std::cout << "L2/L3 cache size = " << (l2>0 ? l2/1024 : -1) << " KB\n";
- typedef ei_gebp_traits<Scalar,Scalar> Traits;
+ typedef internal::gebp_traits<Scalar,Scalar> Traits;
std::cout << "Register blocking = " << Traits::mr << " x " << Traits::nr << "\n";
int rep = 1; // number of repetitions per try
diff --git a/bench/bench_norm.cpp b/bench/bench_norm.cpp
index 1436ddbf5..806db292c 100644
--- a/bench/bench_norm.cpp
+++ b/bench/bench_norm.cpp
@@ -32,18 +32,18 @@ EIGEN_DONT_INLINE typename T::Scalar lapackNorm(T& v)
Scalar ssq = 1;
for (int i=0;i<n;++i)
{
- Scalar ax = ei_abs(v.coeff(i));
+ Scalar ax = internal::abs(v.coeff(i));
if (scale >= ax)
{
- ssq += ei_abs2(ax/scale);
+ ssq += internal::abs2(ax/scale);
}
else
{
- ssq = Scalar(1) + ssq * ei_abs2(scale/ax);
+ ssq = Scalar(1) + ssq * internal::abs2(scale/ax);
scale = ax;
}
}
- return scale * ei_sqrt(ssq);
+ return scale * internal::sqrt(ssq);
}
template<typename T>
@@ -73,15 +73,15 @@ EIGEN_DONT_INLINE typename T::Scalar divacNorm(T& v)
v(i) = v(2*i) + v(2*i+1);
n = n/2;
}
- return ei_sqrt(v(0));
+ return internal::sqrt(v(0));
}
#ifdef EIGEN_VECTORIZE
-Packet4f ei_plt(const Packet4f& a, Packet4f& b) { return _mm_cmplt_ps(a,b); }
-Packet2d ei_plt(const Packet2d& a, Packet2d& b) { return _mm_cmplt_pd(a,b); }
+Packet4f internal::plt(const Packet4f& a, Packet4f& b) { return _mm_cmplt_ps(a,b); }
+Packet2d internal::plt(const Packet2d& a, Packet2d& b) { return _mm_cmplt_pd(a,b); }
-Packet4f ei_pandnot(const Packet4f& a, Packet4f& b) { return _mm_andnot_ps(a,b); }
-Packet2d ei_pandnot(const Packet2d& a, Packet2d& b) { return _mm_andnot_pd(a,b); }
+Packet4f internal::pandnot(const Packet4f& a, Packet4f& b) { return _mm_andnot_ps(a,b); }
+Packet2d internal::pandnot(const Packet2d& a, Packet2d& b) { return _mm_andnot_pd(a,b); }
#endif
template<typename T>
@@ -112,7 +112,7 @@ EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v)
if(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5)
|| (it<=4 && ibeta <= 3 ) || it<2)
{
- ei_assert(false && "the algorithm cannot be guaranteed on this computer");
+ eigen_assert(false && "the algorithm cannot be guaranteed on this computer");
}
iexp = -((1-iemin)/2);
b1 = std::pow(ibeta, iexp); // lower boundary of midrange
@@ -126,60 +126,60 @@ EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v)
overfl = rbig*s2m; // overfow boundary for abig
eps = std::pow(ibeta, 1-it);
- relerr = ei_sqrt(eps); // tolerance for neglecting asml
+ relerr = internal::sqrt(eps); // tolerance for neglecting asml
abig = 1.0/eps - 1.0;
if (Scalar(nbig)>abig) nmax = abig; // largest safe n
else nmax = nbig;
}
- typedef typename ei_packet_traits<Scalar>::type Packet;
- const int ps = ei_packet_traits<Scalar>::size;
- Packet pasml = ei_pset1(Scalar(0));
- Packet pamed = ei_pset1(Scalar(0));
- Packet pabig = ei_pset1(Scalar(0));
- Packet ps2m = ei_pset1(s2m);
- Packet ps1m = ei_pset1(s1m);
- Packet pb2 = ei_pset1(b2);
- Packet pb1 = ei_pset1(b1);
+ typedef typename internal::packet_traits<Scalar>::type Packet;
+ const int ps = internal::packet_traits<Scalar>::size;
+ Packet pasml = internal::pset1(Scalar(0));
+ Packet pamed = internal::pset1(Scalar(0));
+ Packet pabig = internal::pset1(Scalar(0));
+ Packet ps2m = internal::pset1(s2m);
+ Packet ps1m = internal::pset1(s1m);
+ Packet pb2 = internal::pset1(b2);
+ Packet pb1 = internal::pset1(b1);
for(int j=0; j<v.size(); j+=ps)
{
- Packet ax = ei_pabs(v.template packet<Aligned>(j));
- Packet ax_s2m = ei_pmul(ax,ps2m);
- Packet ax_s1m = ei_pmul(ax,ps1m);
- Packet maskBig = ei_plt(pb2,ax);
- Packet maskSml = ei_plt(ax,pb1);
-
-// Packet maskMed = ei_pand(maskSml,maskBig);
-// Packet scale = ei_pset1(Scalar(0));
-// scale = ei_por(scale, ei_pand(maskBig,ps2m));
-// scale = ei_por(scale, ei_pand(maskSml,ps1m));
-// scale = ei_por(scale, ei_pandnot(ei_pset1(Scalar(1)),maskMed));
-// ax = ei_pmul(ax,scale);
-// ax = ei_pmul(ax,ax);
-// pabig = ei_padd(pabig, ei_pand(maskBig, ax));
-// pasml = ei_padd(pasml, ei_pand(maskSml, ax));
-// pamed = ei_padd(pamed, ei_pandnot(ax,maskMed));
-
-
- pabig = ei_padd(pabig, ei_pand(maskBig, ei_pmul(ax_s2m,ax_s2m)));
- pasml = ei_padd(pasml, ei_pand(maskSml, ei_pmul(ax_s1m,ax_s1m)));
- pamed = ei_padd(pamed, ei_pandnot(ei_pmul(ax,ax),ei_pand(maskSml,maskBig)));
+ Packet ax = internal::pabs(v.template packet<Aligned>(j));
+ Packet ax_s2m = internal::pmul(ax,ps2m);
+ Packet ax_s1m = internal::pmul(ax,ps1m);
+ Packet maskBig = internal::plt(pb2,ax);
+ Packet maskSml = internal::plt(ax,pb1);
+
+// Packet maskMed = internal::pand(maskSml,maskBig);
+// Packet scale = internal::pset1(Scalar(0));
+// scale = internal::por(scale, internal::pand(maskBig,ps2m));
+// scale = internal::por(scale, internal::pand(maskSml,ps1m));
+// scale = internal::por(scale, internal::pandnot(internal::pset1(Scalar(1)),maskMed));
+// ax = internal::pmul(ax,scale);
+// ax = internal::pmul(ax,ax);
+// pabig = internal::padd(pabig, internal::pand(maskBig, ax));
+// pasml = internal::padd(pasml, internal::pand(maskSml, ax));
+// pamed = internal::padd(pamed, internal::pandnot(ax,maskMed));
+
+
+ pabig = internal::padd(pabig, internal::pand(maskBig, internal::pmul(ax_s2m,ax_s2m)));
+ pasml = internal::padd(pasml, internal::pand(maskSml, internal::pmul(ax_s1m,ax_s1m)));
+ pamed = internal::padd(pamed, internal::pandnot(internal::pmul(ax,ax),internal::pand(maskSml,maskBig)));
}
- Scalar abig = ei_predux(pabig);
- Scalar asml = ei_predux(pasml);
- Scalar amed = ei_predux(pamed);
+ Scalar abig = internal::predux(pabig);
+ Scalar asml = internal::predux(pasml);
+ Scalar amed = internal::predux(pamed);
if(abig > Scalar(0))
{
- abig = ei_sqrt(abig);
+ abig = internal::sqrt(abig);
if(abig > overfl)
{
- ei_assert(false && "overflow");
+ eigen_assert(false && "overflow");
return rbig;
}
if(amed > Scalar(0))
{
abig = abig/s2m;
- amed = ei_sqrt(amed);
+ amed = internal::sqrt(amed);
}
else
{
@@ -191,24 +191,24 @@ EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v)
{
if (amed > Scalar(0))
{
- abig = ei_sqrt(amed);
- amed = ei_sqrt(asml) / s1m;
+ abig = internal::sqrt(amed);
+ amed = internal::sqrt(asml) / s1m;
}
else
{
- return ei_sqrt(asml)/s1m;
+ return internal::sqrt(asml)/s1m;
}
}
else
{
- return ei_sqrt(amed);
+ return internal::sqrt(amed);
}
asml = std::min(abig, amed);
abig = std::max(abig, amed);
if(asml <= abig*relerr)
return abig;
else
- return abig * ei_sqrt(Scalar(1) + ei_abs2(asml/abig));
+ return abig * internal::sqrt(Scalar(1) + internal::abs2(asml/abig));
#endif
}
@@ -234,12 +234,12 @@ EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v)
void check_accuracy(double basef, double based, int s)
{
- double yf = basef * ei_abs(ei_random<double>());
- double yd = based * ei_abs(ei_random<double>());
+ double yf = basef * internal::abs(internal::random<double>());
+ double yd = based * internal::abs(internal::random<double>());
VectorXf vf = VectorXf::Ones(s) * yf;
VectorXd vd = VectorXd::Ones(s) * yd;
- std::cout << "reference\t" << ei_sqrt(double(s))*yf << "\t" << ei_sqrt(double(s))*yd << "\n";
+ std::cout << "reference\t" << internal::sqrt(double(s))*yf << "\t" << internal::sqrt(double(s))*yd << "\n";
std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\n";
std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\n";
std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\n";
@@ -255,11 +255,11 @@ void check_accuracy_var(int ef0, int ef1, int ed0, int ed1, int s)
VectorXd vd(s);
for (int i=0; i<s; ++i)
{
- vf[i] = ei_abs(ei_random<double>()) * std::pow(double(10), ei_random<int>(ef0,ef1));
- vd[i] = ei_abs(ei_random<double>()) * std::pow(double(10), ei_random<int>(ed0,ed1));
+ vf[i] = internal::abs(internal::random<double>()) * std::pow(double(10), internal::random<int>(ef0,ef1));
+ vd[i] = internal::abs(internal::random<double>()) * std::pow(double(10), internal::random<int>(ed0,ed1));
}
- //std::cout << "reference\t" << ei_sqrt(double(s))*yf << "\t" << ei_sqrt(double(s))*yd << "\n";
+ //std::cout << "reference\t" << internal::sqrt(double(s))*yf << "\t" << internal::sqrt(double(s))*yd << "\n";
std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\t" << sqsumNorm(vf.cast<long double>()) << "\t" << sqsumNorm(vd.cast<long double>()) << "\n";
std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\t" << hypotNorm(vf.cast<long double>()) << "\t" << hypotNorm(vd.cast<long double>()) << "\n";
std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\t" << blueNorm(vf.cast<long double>()) << "\t" << blueNorm(vd.cast<long double>()) << "\n";
@@ -273,7 +273,7 @@ int main(int argc, char** argv)
{
int tries = 10;
int iters = 100000;
- double y = 1.1345743233455785456788e12 * ei_random<double>();
+ double y = 1.1345743233455785456788e12 * internal::random<double>();
VectorXf v = VectorXf::Ones(1024) * y;
// return 0;
diff --git a/bench/bench_reverse.cpp b/bench/bench_reverse.cpp
index 0e695b2f2..1e69ca1b2 100644
--- a/bench/bench_reverse.cpp
+++ b/bench/bench_reverse.cpp
@@ -28,8 +28,8 @@ __attribute__ ((noinline)) void bench_reverse(const MatrixType& m)
BenchTimer timerB, timerH, timerV;
Scalar acc = 0;
- int r = ei_random<int>(0,rows-1);
- int c = ei_random<int>(0,cols-1);
+ int r = internal::random<int>(0,rows-1);
+ int c = internal::random<int>(0,cols-1);
for (int t=0; t<TRIES; ++t)
{
timerB.start();
diff --git a/bench/benchmarkSlice.cpp b/bench/benchmarkSlice.cpp
index 3d04b6fd5..c5b89c545 100644
--- a/bench/benchmarkSlice.cpp
+++ b/bench/benchmarkSlice.cpp
@@ -24,10 +24,10 @@ int main(int argc, char *argv[])
for(int a = 0; a < REPEAT; a++)
{
int r, c, nr, nc;
- r = Eigen::ei_random<int>(0,10);
- c = Eigen::ei_random<int>(0,10);
- nr = Eigen::ei_random<int>(50,80);
- nc = Eigen::ei_random<int>(50,80);
+ r = Eigen::internal::random<int>(0,10);
+ c = Eigen::internal::random<int>(0,10);
+ nr = Eigen::internal::random<int>(50,80);
+ nc = Eigen::internal::random<int>(50,80);
m.block(r,c,nr,nc) += Mat::Ones(nr,nc);
m.block(r,c,nr,nc) *= SCALAR(10);
m.block(r,c,nr,nc) -= Mat::constant(nr,nc,10);
diff --git a/bench/btl/libs/eigen2/eigen2_interface.hh b/bench/btl/libs/eigen2/eigen2_interface.hh
index 9bd9e8a62..ae280008b 100644
--- a/bench/btl/libs/eigen2/eigen2_interface.hh
+++ b/bench/btl/libs/eigen2/eigen2_interface.hh
@@ -106,13 +106,13 @@ public :
static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){
X.noalias() = (A.template selfadjointView<Lower>() * B);
-// ei_product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1);
+// internal::product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1);
}
template<typename Dest, typename Src> static void triassign(Dest& dst, const Src& src)
{
typedef typename Dest::Scalar Scalar;
- typedef typename ei_packet_traits<Scalar>::type Packet;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
const int PacketSize = sizeof(Packet)/sizeof(Scalar);
int size = dst.cols();
for(int j=0; j<size; j+=1)
@@ -121,7 +121,7 @@ public :
Scalar* A0 = dst.data() + j*dst.stride();
int starti = j;
int alignedEnd = starti;
- int alignedStart = (starti) + ei_first_aligned(&A0[starti], size-starti);
+ int alignedStart = (starti) + internal::first_aligned(&A0[starti], size-starti);
alignedEnd = alignedStart + ((size-alignedStart)/(2*PacketSize))*(PacketSize*2);
// do the non-vectorizable part of the assignment
@@ -155,7 +155,7 @@ public :
}
static EIGEN_DONT_INLINE void syr2(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
- // ei_product_selfadjoint_rank2_update<real,0,LowerTriangularBit>(N,A.data(),N, X.data(), 1, Y.data(), 1, -1);
+ // internal::product_selfadjoint_rank2_update<real,0,LowerTriangularBit>(N,A.data(),N, X.data(), 1, Y.data(), 1, -1);
for(int j=0; j<N; ++j)
A.col(j).tail(N-j) += X[j] * Y.tail(N-j) + Y[j] * X.tail(N-j);
}
@@ -166,7 +166,7 @@ public :
}
static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int N){
- ei_apply_rotation_in_the_plane(A, B, PlanarRotation<real>(c,s));
+ internal::apply_rotation_in_the_plane(A, B, JacobiRotation<real>(c,s));
}
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
@@ -203,7 +203,7 @@ public :
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
C = X;
- ei_llt_inplace<Lower>::blocked(C);
+ internal::llt_inplace<Lower>::blocked(C);
//C = X.llt().matrixL();
// C = X;
// Cholesky<gene_matrix>::computeInPlace(C);
@@ -218,14 +218,14 @@ public :
Matrix<DenseIndex,1,Dynamic> piv(N);
DenseIndex nb;
C = X;
- ei_partial_lu_inplace(C,piv,nb);
+ internal::partial_lu_inplace(C,piv,nb);
// C = X.partialPivLu().matrixLU();
}
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
typename Tridiagonalization<gene_matrix>::CoeffVectorType aux(N-1);
C = X;
- ei_tridiagonalization_inplace(C, aux);
+ internal::tridiagonalization_inplace(C, aux);
}
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
diff --git a/bench/btl/libs/hand_vec/hand_vec_interface.hh b/bench/btl/libs/hand_vec/hand_vec_interface.hh
index be5d5e6b6..0bb4b64ca 100755
--- a/bench/btl/libs/hand_vec/hand_vec_interface.hh
+++ b/bench/btl/libs/hand_vec/hand_vec_interface.hh
@@ -29,8 +29,8 @@ class hand_vec_interface : public f77_interface_base<real> {
public :
- typedef typename ei_packet_traits<real>::type Packet;
- static const int PacketSize = ei_packet_traits<real>::size;
+ typedef typename internal::packet_traits<real>::type Packet;
+ static const int PacketSize = internal::packet_traits<real>::size;
typedef typename f77_interface_base<real>::stl_matrix stl_matrix;
typedef typename f77_interface_base<real>::stl_vector stl_vector;
@@ -38,16 +38,16 @@ public :
typedef typename f77_interface_base<real>::gene_vector gene_vector;
static void free_matrix(gene_matrix & A, int N){
- ei_aligned_free(A);
+ internal::aligned_free(A);
}
static void free_vector(gene_vector & B){
- ei_aligned_free(B);
+ internal::aligned_free(B);
}
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
int N = A_stl.size();
- A = (real*)ei_aligned_malloc(N*N*sizeof(real));
+ A = (real*)internal::aligned_malloc(N*N*sizeof(real));
for (int j=0;j<N;j++)
for (int i=0;i<N;i++)
A[i+N*j] = A_stl[j][i];
@@ -55,7 +55,7 @@ public :
static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
int N = B_stl.size();
- B = (real*)ei_aligned_malloc(N*sizeof(real));
+ B = (real*)internal::aligned_malloc(N*sizeof(real));
for (int i=0;i<N;i++)
B[i] = B_stl[i];
}
@@ -84,10 +84,10 @@ public :
register real* __restrict__ A2 = A + (i+2)*N;
register real* __restrict__ A3 = A + (i+3)*N;
- Packet ptmp0 = ei_pset1(B[i]);
- Packet ptmp1 = ei_pset1(B[i+1]);
- Packet ptmp2 = ei_pset1(B[i+2]);
- Packet ptmp3 = ei_pset1(B[i+3]);
+ Packet ptmp0 = internal::pset1(B[i]);
+ Packet ptmp1 = internal::pset1(B[i+1]);
+ Packet ptmp2 = internal::pset1(B[i+2]);
+ Packet ptmp3 = internal::pset1(B[i+3]);
// register Packet ptmp0, ptmp1, ptmp2, ptmp3;
// asm(
//
@@ -162,73 +162,73 @@ public :
register Packet A13;
for (int j = 0;j<ANP;j+=2*PacketSize)
{
-// A00 = ei_pload(&A0[j]);
-// A01 = ei_ploadu(&A1[j]);
-// A02 = ei_ploadu(&A2[j]);
-// A03 = ei_ploadu(&A3[j]);
-// A10 = ei_pload(&A0[j+PacketSize]);
-// A11 = ei_ploadu(&A1[j+PacketSize]);
-// A12 = ei_ploadu(&A2[j+PacketSize]);
-// A13 = ei_ploadu(&A3[j+PacketSize]);
+// A00 = internal::pload(&A0[j]);
+// A01 = internal::ploadu(&A1[j]);
+// A02 = internal::ploadu(&A2[j]);
+// A03 = internal::ploadu(&A3[j]);
+// A10 = internal::pload(&A0[j+PacketSize]);
+// A11 = internal::ploadu(&A1[j+PacketSize]);
+// A12 = internal::ploadu(&A2[j+PacketSize]);
+// A13 = internal::ploadu(&A3[j+PacketSize]);
//
-// A00 = ei_pmul(ptmp0, A00);
-// A01 = ei_pmul(ptmp1, A01);
-// A02 = ei_pmul(ptmp2, A02);
-// A03 = ei_pmul(ptmp3, A03);
-// A10 = ei_pmul(ptmp0, A10);
-// A11 = ei_pmul(ptmp1, A11);
-// A12 = ei_pmul(ptmp2, A12);
-// A13 = ei_pmul(ptmp3, A13);
+// A00 = internal::pmul(ptmp0, A00);
+// A01 = internal::pmul(ptmp1, A01);
+// A02 = internal::pmul(ptmp2, A02);
+// A03 = internal::pmul(ptmp3, A03);
+// A10 = internal::pmul(ptmp0, A10);
+// A11 = internal::pmul(ptmp1, A11);
+// A12 = internal::pmul(ptmp2, A12);
+// A13 = internal::pmul(ptmp3, A13);
//
-// A00 = ei_padd(A00,A01);
-// A02 = ei_padd(A02,A03);
-// A00 = ei_padd(A00,ei_pload(&X[j]));
-// A00 = ei_padd(A00,A02);
-// ei_pstore(&X[j],A00);
+// A00 = internal::padd(A00,A01);
+// A02 = internal::padd(A02,A03);
+// A00 = internal::padd(A00,internal::pload(&X[j]));
+// A00 = internal::padd(A00,A02);
+// internal::pstore(&X[j],A00);
//
-// A10 = ei_padd(A10,A11);
-// A12 = ei_padd(A12,A13);
-// A10 = ei_padd(A10,ei_pload(&X[j+PacketSize]));
-// A10 = ei_padd(A10,A12);
-// ei_pstore(&X[j+PacketSize],A10);
-
- ei_pstore(&X[j],
- ei_padd(ei_pload(&X[j]),
- ei_padd(
- ei_padd(ei_pmul(ptmp0,ei_pload(&A0[j])),ei_pmul(ptmp1,ei_ploadu(&A1[j]))),
- ei_padd(ei_pmul(ptmp2,ei_ploadu(&A2[j])),ei_pmul(ptmp3,ei_ploadu(&A3[j]))) )));
-
- ei_pstore(&X[j+PacketSize],
- ei_padd(ei_pload(&X[j+PacketSize]),
- ei_padd(
- ei_padd(ei_pmul(ptmp0,ei_pload(&A0[j+PacketSize])),ei_pmul(ptmp1,ei_ploadu(&A1[j+PacketSize]))),
- ei_padd(ei_pmul(ptmp2,ei_ploadu(&A2[j+PacketSize])),ei_pmul(ptmp3,ei_ploadu(&A3[j+PacketSize]))) )));
+// A10 = internal::padd(A10,A11);
+// A12 = internal::padd(A12,A13);
+// A10 = internal::padd(A10,internal::pload(&X[j+PacketSize]));
+// A10 = internal::padd(A10,A12);
+// internal::pstore(&X[j+PacketSize],A10);
+
+ internal::pstore(&X[j],
+ internal::padd(internal::pload(&X[j]),
+ internal::padd(
+ internal::padd(internal::pmul(ptmp0,internal::pload(&A0[j])),internal::pmul(ptmp1,internal::ploadu(&A1[j]))),
+ internal::padd(internal::pmul(ptmp2,internal::ploadu(&A2[j])),internal::pmul(ptmp3,internal::ploadu(&A3[j]))) )));
+
+ internal::pstore(&X[j+PacketSize],
+ internal::padd(internal::pload(&X[j+PacketSize]),
+ internal::padd(
+ internal::padd(internal::pmul(ptmp0,internal::pload(&A0[j+PacketSize])),internal::pmul(ptmp1,internal::ploadu(&A1[j+PacketSize]))),
+ internal::padd(internal::pmul(ptmp2,internal::ploadu(&A2[j+PacketSize])),internal::pmul(ptmp3,internal::ploadu(&A3[j+PacketSize]))) )));
}
for (int j = ANP;j<AN;j+=PacketSize)
- ei_pstore(&X[j],
- ei_padd(ei_pload(&X[j]),
- ei_padd(
- ei_padd(ei_pmul(ptmp0,ei_pload(&A0[j])),ei_pmul(ptmp1,ei_ploadu(&A1[j]))),
- ei_padd(ei_pmul(ptmp2,ei_ploadu(&A2[j])),ei_pmul(ptmp3,ei_ploadu(&A3[j]))) )));
+ internal::pstore(&X[j],
+ internal::padd(internal::pload(&X[j]),
+ internal::padd(
+ internal::padd(internal::pmul(ptmp0,internal::pload(&A0[j])),internal::pmul(ptmp1,internal::ploadu(&A1[j]))),
+ internal::padd(internal::pmul(ptmp2,internal::ploadu(&A2[j])),internal::pmul(ptmp3,internal::ploadu(&A3[j]))) )));
}
// process remaining scalars
for (int j=AN;j<N;j++)
- X[j] += ei_pfirst(ptmp0) * A0[j] + ei_pfirst(ptmp1) * A1[j] + ei_pfirst(ptmp2) * A2[j] + ei_pfirst(ptmp3) * A3[j];
+ X[j] += internal::pfirst(ptmp0) * A0[j] + internal::pfirst(ptmp1) * A1[j] + internal::pfirst(ptmp2) * A2[j] + internal::pfirst(ptmp3) * A3[j];
}
for (int i=bound;i<N;i++)
{
real tmp0 = B[i];
- Packet ptmp0 = ei_pset1(tmp0);
+ Packet ptmp0 = internal::pset1(tmp0);
int iN0 = i*N;
if (AN>0)
{
bool aligned0 = (iN0 % PacketSize) == 0;
if (aligned0)
for (int j = 0;j<AN;j+=PacketSize)
- ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pload(&X[j])));
+ internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pload(&X[j])));
else
for (int j = 0;j<AN;j+=PacketSize)
- ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),ei_pload(&X[j])));
+ internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),internal::pload(&X[j])));
}
// process remaining scalars
for (int j=AN;j<N;j++)
@@ -254,18 +254,18 @@ public :
register real* __restrict__ A1 = A + (j+1)*N;
real t0 = B[j];
- Packet ptmp0 = ei_pset1(t0);
+ Packet ptmp0 = internal::pset1(t0);
real t1 = B[j+1];
- Packet ptmp1 = ei_pset1(t1);
+ Packet ptmp1 = internal::pset1(t1);
real t2 = 0;
- Packet ptmp2 = ei_pset1(t2);
+ Packet ptmp2 = internal::pset1(t2);
real t3 = 0;
- Packet ptmp3 = ei_pset1(t3);
+ Packet ptmp3 = internal::pset1(t3);
int starti = j+2;
int alignedEnd = starti;
- int alignedStart = (starti) + ei_first_aligned(&X[starti], N-starti);
+ int alignedStart = (starti) + internal::first_aligned(&X[starti], N-starti);
alignedEnd = alignedStart + ((N-alignedStart)/(PacketSize))*(PacketSize);
X[j] += t0 * A0[j];
@@ -282,21 +282,21 @@ public :
}
asm("#begin symv");
for (size_t i=alignedStart; i<alignedEnd; i+=PacketSize) {
- Packet A0i = ei_ploadu(&A0[i]);
- Packet A1i = ei_ploadu(&A1[i]);
-// Packet A0i1 = ei_ploadu(&A0[i+PacketSize]);
- Packet Xi = ei_pload(&X[i]);
- Packet Bi = ei_pload/*u*/(&B[i]);
-// Packet Xi1 = ei_pload(&X[i+PacketSize]);
-// Packet Bi1 = ei_pload/*u*/(&B[i+PacketSize]);
- Xi = ei_padd(ei_padd(Xi, ei_pmul(ptmp0, A0i)), ei_pmul(ptmp1, A1i));
- ptmp2 = ei_padd(ptmp2, ei_pmul(A0i, Bi));
- ptmp3 = ei_padd(ptmp3, ei_pmul(A1i, Bi));
-// Xi1 = ei_padd(Xi1, ei_pmul(ptmp1, A0i1));
-// ptmp2 = ei_padd(ptmp2, ei_pmul(A0i1, Bi1));
+ Packet A0i = internal::ploadu(&A0[i]);
+ Packet A1i = internal::ploadu(&A1[i]);
+// Packet A0i1 = internal::ploadu(&A0[i+PacketSize]);
+ Packet Xi = internal::pload(&X[i]);
+ Packet Bi = internal::pload/*u*/(&B[i]);
+// Packet Xi1 = internal::pload(&X[i+PacketSize]);
+// Packet Bi1 = internal::pload/*u*/(&B[i+PacketSize]);
+ Xi = internal::padd(internal::padd(Xi, internal::pmul(ptmp0, A0i)), internal::pmul(ptmp1, A1i));
+ ptmp2 = internal::padd(ptmp2, internal::pmul(A0i, Bi));
+ ptmp3 = internal::padd(ptmp3, internal::pmul(A1i, Bi));
+// Xi1 = internal::padd(Xi1, internal::pmul(ptmp1, A0i1));
+// ptmp2 = internal::padd(ptmp2, internal::pmul(A0i1, Bi1));
//
- ei_pstore(&X[i],Xi);
-// ei_pstore(&X[i+PacketSize],Xi1);
+ internal::pstore(&X[i],Xi);
+// internal::pstore(&X[i+PacketSize],Xi1);
// asm(
// "prefetchnta 64(%[A0],%[i],4) \n\t"
// //"movups (%[A0],%[i],4), %%xmm8 \n\t"
@@ -341,8 +341,8 @@ public :
}
- X[j] += t2 + ei_predux(ptmp2);
- X[j+1] += t3 + ei_predux(ptmp3);
+ X[j] += t2 + internal::predux(ptmp2);
+ X[j+1] += t3 + internal::predux(ptmp3);
}
for (int j=bound;j<N;j++)
{
@@ -372,13 +372,13 @@ public :
// for (int i=0;i<bound;i+=4)
// {
// real tmp0 = B[i];
-// Packet ptmp0 = ei_pset1(tmp0);
+// Packet ptmp0 = internal::pset1(tmp0);
// real tmp1 = B[i+1];
-// Packet ptmp1 = ei_pset1(tmp1);
+// Packet ptmp1 = internal::pset1(tmp1);
// real tmp2 = B[i+2];
-// Packet ptmp2 = ei_pset1(tmp2);
+// Packet ptmp2 = internal::pset1(tmp2);
// real tmp3 = B[i+3];
-// Packet ptmp3 = ei_pset1(tmp3);
+// Packet ptmp3 = internal::pset1(tmp3);
// int iN0 = i*N;
// int iN1 = (i+1)*N;
// int iN2 = (i+2)*N;
@@ -392,59 +392,59 @@ public :
// {
// for (int j = 0;j<AN;j+=PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pload(&X[j]),
-// ei_padd(
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pmul(ptmp1,ei_pload(&A[j+iN1]))),
-// ei_padd(ei_pmul(ptmp2,ei_pload(&A[j+iN2])),ei_pmul(ptmp3,ei_pload(&A[j+iN3]))) )));
+// internal::pstore(&X[j],
+// internal::padd(internal::pload(&X[j]),
+// internal::padd(
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pmul(ptmp1,internal::pload(&A[j+iN1]))),
+// internal::padd(internal::pmul(ptmp2,internal::pload(&A[j+iN2])),internal::pmul(ptmp3,internal::pload(&A[j+iN3]))) )));
// }
// }
// else if (aligned1==2)
// {
// for (int j = 0;j<AN;j+=PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pload(&X[j]),
-// ei_padd(
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+iN1]))),
-// ei_padd(ei_pmul(ptmp2,ei_pload(&A[j+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+iN3]))) )));
+// internal::pstore(&X[j],
+// internal::padd(internal::pload(&X[j]),
+// internal::padd(
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+iN1]))),
+// internal::padd(internal::pmul(ptmp2,internal::pload(&A[j+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+iN3]))) )));
// }
// }
// else
// {
// for (int j = 0;j<ANP;j+=2*PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pload(&X[j]),
-// ei_padd(
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+iN1]))),
-// ei_padd(ei_pmul(ptmp2,ei_ploadu(&A[j+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+iN3]))) )));
+// internal::pstore(&X[j],
+// internal::padd(internal::pload(&X[j]),
+// internal::padd(
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+iN1]))),
+// internal::padd(internal::pmul(ptmp2,internal::ploadu(&A[j+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+iN3]))) )));
//
-// ei_pstore(&X[j+PacketSize],
-// ei_padd(ei_pload(&X[j+PacketSize]),
-// ei_padd(
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+PacketSize+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+PacketSize+iN1]))),
-// ei_padd(ei_pmul(ptmp2,ei_ploadu(&A[j+PacketSize+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+PacketSize+iN3]))) )));
+// internal::pstore(&X[j+PacketSize],
+// internal::padd(internal::pload(&X[j+PacketSize]),
+// internal::padd(
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+PacketSize+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+PacketSize+iN1]))),
+// internal::padd(internal::pmul(ptmp2,internal::ploadu(&A[j+PacketSize+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+PacketSize+iN3]))) )));
//
-// // ei_pstore(&X[j+2*PacketSize],
-// // ei_padd(ei_pload(&X[j+2*PacketSize]),
-// // ei_padd(
-// // ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+2*PacketSize+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+2*PacketSize+iN1]))),
-// // ei_padd(ei_pmul(ptmp2,ei_ploadu(&A[j+2*PacketSize+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+2*PacketSize+iN3]))) )));
+// // internal::pstore(&X[j+2*PacketSize],
+// // internal::padd(internal::pload(&X[j+2*PacketSize]),
+// // internal::padd(
+// // internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+2*PacketSize+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+2*PacketSize+iN1]))),
+// // internal::padd(internal::pmul(ptmp2,internal::ploadu(&A[j+2*PacketSize+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+2*PacketSize+iN3]))) )));
// //
-// // ei_pstore(&X[j+3*PacketSize],
-// // ei_padd(ei_pload(&X[j+3*PacketSize]),
-// // ei_padd(
-// // ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+3*PacketSize+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+3*PacketSize+iN1]))),
-// // ei_padd(ei_pmul(ptmp2,ei_ploadu(&A[j+3*PacketSize+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+3*PacketSize+iN3]))) )));
+// // internal::pstore(&X[j+3*PacketSize],
+// // internal::padd(internal::pload(&X[j+3*PacketSize]),
+// // internal::padd(
+// // internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+3*PacketSize+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+3*PacketSize+iN1]))),
+// // internal::padd(internal::pmul(ptmp2,internal::ploadu(&A[j+3*PacketSize+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+3*PacketSize+iN3]))) )));
//
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ei_pstore(&X[j],
-// ei_padd(ei_pload(&X[j]),
-// ei_padd(
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),ei_pmul(ptmp1,ei_ploadu(&A[j+iN1]))),
-// ei_padd(ei_pmul(ptmp2,ei_ploadu(&A[j+iN2])),ei_pmul(ptmp3,ei_ploadu(&A[j+iN3]))) )));
+// internal::pstore(&X[j],
+// internal::padd(internal::pload(&X[j]),
+// internal::padd(
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),internal::pmul(ptmp1,internal::ploadu(&A[j+iN1]))),
+// internal::padd(internal::pmul(ptmp2,internal::ploadu(&A[j+iN2])),internal::pmul(ptmp3,internal::ploadu(&A[j+iN3]))) )));
// }
// }
// // process remaining scalars
@@ -454,17 +454,17 @@ public :
// for (int i=bound;i<N;i++)
// {
// real tmp0 = B[i];
-// Packet ptmp0 = ei_pset1(tmp0);
+// Packet ptmp0 = internal::pset1(tmp0);
// int iN0 = i*N;
// if (AN>0)
// {
// bool aligned0 = (iN0 % PacketSize) == 0;
// if (aligned0)
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pload(&X[j])));
+// internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pload(&X[j])));
// else
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),ei_pload(&X[j])));
+// internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),internal::pload(&X[j])));
// }
// // process remaining scalars
// for (int j=AN;j<N;j++)
@@ -483,9 +483,9 @@ public :
// for (int i=0;i<N;i+=2)
// {
// real tmp0 = B[i];
-// Packet ptmp0 = ei_pset1(tmp0);
+// Packet ptmp0 = internal::pset1(tmp0);
// real tmp1 = B[i+1];
-// Packet ptmp1 = ei_pset1(tmp1);
+// Packet ptmp1 = internal::pset1(tmp1);
// int iN0 = i*N;
// int iN1 = (i+1)*N;
// if (AN>0)
@@ -497,27 +497,27 @@ public :
// {
// for (int j = 0;j<AN;j+=PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_pload(&A[j+iN1])),ei_pload(&X[j]))));
+// internal::pstore(&X[j],
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::pload(&A[j+iN1])),internal::pload(&X[j]))));
// }
// }
// else if (aligned0)
// {
// for (int j = 0;j<AN;j+=PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+iN1])),ei_pload(&X[j]))));
+// internal::pstore(&X[j],
+// internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+iN1])),internal::pload(&X[j]))));
// }
// }
// else if (aligned1)
// {
// for (int j = 0;j<AN;j+=PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_pload(&A[j+iN1])),ei_pload(&X[j]))));
+// internal::pstore(&X[j],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::pload(&A[j+iN1])),internal::pload(&X[j]))));
// }
// }
// else
@@ -525,26 +525,26 @@ public :
// int ANP = (AN/(4*PacketSize))*4*PacketSize;
// for (int j = 0;j<ANP;j+=4*PacketSize)
// {
-// ei_pstore(&X[j],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+iN1])),ei_pload(&X[j]))));
+// internal::pstore(&X[j],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+iN1])),internal::pload(&X[j]))));
//
-// ei_pstore(&X[j+PacketSize],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+PacketSize+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+PacketSize+iN1])),ei_pload(&X[j+PacketSize]))));
+// internal::pstore(&X[j+PacketSize],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+PacketSize+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+PacketSize+iN1])),internal::pload(&X[j+PacketSize]))));
//
-// ei_pstore(&X[j+2*PacketSize],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+2*PacketSize+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+2*PacketSize+iN1])),ei_pload(&X[j+2*PacketSize]))));
+// internal::pstore(&X[j+2*PacketSize],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+2*PacketSize+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+2*PacketSize+iN1])),internal::pload(&X[j+2*PacketSize]))));
//
-// ei_pstore(&X[j+3*PacketSize],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+3*PacketSize+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+3*PacketSize+iN1])),ei_pload(&X[j+3*PacketSize]))));
+// internal::pstore(&X[j+3*PacketSize],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+3*PacketSize+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+3*PacketSize+iN1])),internal::pload(&X[j+3*PacketSize]))));
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ei_pstore(&X[j],
-// ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),
-// ei_padd(ei_pmul(ptmp1,ei_ploadu(&A[j+iN1])),ei_pload(&X[j]))));
+// internal::pstore(&X[j],
+// internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),
+// internal::padd(internal::pmul(ptmp1,internal::ploadu(&A[j+iN1])),internal::pload(&X[j]))));
// }
// }
// // process remaining scalars
@@ -555,17 +555,17 @@ public :
// for (int i=remaining;i<N;i++)
// {
// real tmp0 = B[i];
-// Packet ptmp0 = ei_pset1(tmp0);
+// Packet ptmp0 = internal::pset1(tmp0);
// int iN0 = i*N;
// if (AN>0)
// {
// bool aligned0 = (iN0 % PacketSize) == 0;
// if (aligned0)
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_pload(&A[j+iN0])),ei_pload(&X[j])));
+// internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::pload(&A[j+iN0])),internal::pload(&X[j])));
// else
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pmul(ptmp0,ei_ploadu(&A[j+iN0])),ei_pload(&X[j])));
+// internal::pstore(&X[j], internal::padd(internal::pmul(ptmp0,internal::ploadu(&A[j+iN0])),internal::pload(&X[j])));
// }
// // process remaining scalars
// for (int j=AN;j<N;j++)
@@ -583,7 +583,7 @@ public :
// for (int i=0;i<N;i++)
// {
// real tmp = B[i];
-// Packet ptmp = ei_pset1(tmp);
+// Packet ptmp = internal::pset1(tmp);
// int iN = i*N;
// if (AN>0)
// {
@@ -595,45 +595,45 @@ public :
// int ANP = (AN/(8*PacketSize))*8*PacketSize;
// for (int j = 0;j<ANP;j+=PacketSize*8)
// {
-// A0 = ei_pload(&A[j+iN]);
-// X0 = ei_pload(&X[j]);
-// A1 = ei_pload(&A[j+PacketSize+iN]);
-// X1 = ei_pload(&X[j+PacketSize]);
-// A2 = ei_pload(&A[j+2*PacketSize+iN]);
-// X2 = ei_pload(&X[j+2*PacketSize]);
-// ei_pstore(&X[j], ei_padd(X0, ei_pmul(ptmp,A0)));
-// A0 = ei_pload(&A[j+3*PacketSize+iN]);
-// X0 = ei_pload(&X[j+3*PacketSize]);
-// ei_pstore(&X[j+PacketSize], ei_padd(ei_pload(&X1), ei_pmul(ptmp,A1)));
-// A1 = ei_pload(&A[j+4*PacketSize+iN]);
-// X1 = ei_pload(&X[j+4*PacketSize]);
-// ei_pstore(&X[j+2*PacketSize], ei_padd(ei_pload(&X2), ei_pmul(ptmp,A2)));
-// A2 = ei_pload(&A[j+5*PacketSize+iN]);
-// X2 = ei_pload(&X[j+5*PacketSize]);
-// ei_pstore(&X[j+3*PacketSize], ei_padd(ei_pload(&X0), ei_pmul(ptmp,A0)));
-// A0 = ei_pload(&A[j+6*PacketSize+iN]);
-// X0 = ei_pload(&X[j+6*PacketSize]);
-// ei_pstore(&X[j+4*PacketSize], ei_padd(ei_pload(&X1), ei_pmul(ptmp,A1)));
-// A1 = ei_pload(&A[j+7*PacketSize+iN]);
-// X1 = ei_pload(&X[j+7*PacketSize]);
-// ei_pstore(&X[j+5*PacketSize], ei_padd(ei_pload(&X2), ei_pmul(ptmp,A2)));
-// ei_pstore(&X[j+6*PacketSize], ei_padd(ei_pload(&X0), ei_pmul(ptmp,A0)));
-// ei_pstore(&X[j+7*PacketSize], ei_padd(ei_pload(&X1), ei_pmul(ptmp,A1)));
+// A0 = internal::pload(&A[j+iN]);
+// X0 = internal::pload(&X[j]);
+// A1 = internal::pload(&A[j+PacketSize+iN]);
+// X1 = internal::pload(&X[j+PacketSize]);
+// A2 = internal::pload(&A[j+2*PacketSize+iN]);
+// X2 = internal::pload(&X[j+2*PacketSize]);
+// internal::pstore(&X[j], internal::padd(X0, internal::pmul(ptmp,A0)));
+// A0 = internal::pload(&A[j+3*PacketSize+iN]);
+// X0 = internal::pload(&X[j+3*PacketSize]);
+// internal::pstore(&X[j+PacketSize], internal::padd(internal::pload(&X1), internal::pmul(ptmp,A1)));
+// A1 = internal::pload(&A[j+4*PacketSize+iN]);
+// X1 = internal::pload(&X[j+4*PacketSize]);
+// internal::pstore(&X[j+2*PacketSize], internal::padd(internal::pload(&X2), internal::pmul(ptmp,A2)));
+// A2 = internal::pload(&A[j+5*PacketSize+iN]);
+// X2 = internal::pload(&X[j+5*PacketSize]);
+// internal::pstore(&X[j+3*PacketSize], internal::padd(internal::pload(&X0), internal::pmul(ptmp,A0)));
+// A0 = internal::pload(&A[j+6*PacketSize+iN]);
+// X0 = internal::pload(&X[j+6*PacketSize]);
+// internal::pstore(&X[j+4*PacketSize], internal::padd(internal::pload(&X1), internal::pmul(ptmp,A1)));
+// A1 = internal::pload(&A[j+7*PacketSize+iN]);
+// X1 = internal::pload(&X[j+7*PacketSize]);
+// internal::pstore(&X[j+5*PacketSize], internal::padd(internal::pload(&X2), internal::pmul(ptmp,A2)));
+// internal::pstore(&X[j+6*PacketSize], internal::padd(internal::pload(&X0), internal::pmul(ptmp,A0)));
+// internal::pstore(&X[j+7*PacketSize], internal::padd(internal::pload(&X1), internal::pmul(ptmp,A1)));
// //
-// // ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_pload(&A[j+iN]))));
-// // ei_pstore(&X[j+PacketSize], ei_padd(ei_pload(&X[j+PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+PacketSize+iN]))));
-// // ei_pstore(&X[j+2*PacketSize], ei_padd(ei_pload(&X[j+2*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+2*PacketSize+iN]))));
-// // ei_pstore(&X[j+3*PacketSize], ei_padd(ei_pload(&X[j+3*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+3*PacketSize+iN]))));
-// // ei_pstore(&X[j+4*PacketSize], ei_padd(ei_pload(&X[j+4*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+4*PacketSize+iN]))));
-// // ei_pstore(&X[j+5*PacketSize], ei_padd(ei_pload(&X[j+5*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+5*PacketSize+iN]))));
-// // ei_pstore(&X[j+6*PacketSize], ei_padd(ei_pload(&X[j+6*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+6*PacketSize+iN]))));
-// // ei_pstore(&X[j+7*PacketSize], ei_padd(ei_pload(&X[j+7*PacketSize]), ei_pmul(ptmp,ei_pload(&A[j+7*PacketSize+iN]))));
+// // internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::pload(&A[j+iN]))));
+// // internal::pstore(&X[j+PacketSize], internal::padd(internal::pload(&X[j+PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+PacketSize+iN]))));
+// // internal::pstore(&X[j+2*PacketSize], internal::padd(internal::pload(&X[j+2*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+2*PacketSize+iN]))));
+// // internal::pstore(&X[j+3*PacketSize], internal::padd(internal::pload(&X[j+3*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+3*PacketSize+iN]))));
+// // internal::pstore(&X[j+4*PacketSize], internal::padd(internal::pload(&X[j+4*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+4*PacketSize+iN]))));
+// // internal::pstore(&X[j+5*PacketSize], internal::padd(internal::pload(&X[j+5*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+5*PacketSize+iN]))));
+// // internal::pstore(&X[j+6*PacketSize], internal::padd(internal::pload(&X[j+6*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+6*PacketSize+iN]))));
+// // internal::pstore(&X[j+7*PacketSize], internal::padd(internal::pload(&X[j+7*PacketSize]), internal::pmul(ptmp,internal::pload(&A[j+7*PacketSize+iN]))));
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_pload(&A[j+iN]))));
+// internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::pload(&A[j+iN]))));
// #else
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_pload(&A[j+iN]))));
+// internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::pload(&A[j+iN]))));
// #endif
// }
// else
@@ -642,20 +642,20 @@ public :
// int ANP = (AN/(8*PacketSize))*8*PacketSize;
// for (int j = 0;j<ANP;j+=PacketSize*8)
// {
-// ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_ploadu(&A[j+iN]))));
-// ei_pstore(&X[j+PacketSize], ei_padd(ei_pload(&X[j+PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+PacketSize+iN]))));
-// ei_pstore(&X[j+2*PacketSize], ei_padd(ei_pload(&X[j+2*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+2*PacketSize+iN]))));
-// ei_pstore(&X[j+3*PacketSize], ei_padd(ei_pload(&X[j+3*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+3*PacketSize+iN]))));
-// ei_pstore(&X[j+4*PacketSize], ei_padd(ei_pload(&X[j+4*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+4*PacketSize+iN]))));
-// ei_pstore(&X[j+5*PacketSize], ei_padd(ei_pload(&X[j+5*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+5*PacketSize+iN]))));
-// ei_pstore(&X[j+6*PacketSize], ei_padd(ei_pload(&X[j+6*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+6*PacketSize+iN]))));
-// ei_pstore(&X[j+7*PacketSize], ei_padd(ei_pload(&X[j+7*PacketSize]), ei_pmul(ptmp,ei_ploadu(&A[j+7*PacketSize+iN]))));
+// internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::ploadu(&A[j+iN]))));
+// internal::pstore(&X[j+PacketSize], internal::padd(internal::pload(&X[j+PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+PacketSize+iN]))));
+// internal::pstore(&X[j+2*PacketSize], internal::padd(internal::pload(&X[j+2*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+2*PacketSize+iN]))));
+// internal::pstore(&X[j+3*PacketSize], internal::padd(internal::pload(&X[j+3*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+3*PacketSize+iN]))));
+// internal::pstore(&X[j+4*PacketSize], internal::padd(internal::pload(&X[j+4*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+4*PacketSize+iN]))));
+// internal::pstore(&X[j+5*PacketSize], internal::padd(internal::pload(&X[j+5*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+5*PacketSize+iN]))));
+// internal::pstore(&X[j+6*PacketSize], internal::padd(internal::pload(&X[j+6*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+6*PacketSize+iN]))));
+// internal::pstore(&X[j+7*PacketSize], internal::padd(internal::pload(&X[j+7*PacketSize]), internal::pmul(ptmp,internal::ploadu(&A[j+7*PacketSize+iN]))));
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_ploadu(&A[j+iN]))));
+// internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::ploadu(&A[j+iN]))));
// #else
// for (int j = 0;j<AN;j+=PacketSize)
-// ei_pstore(&X[j], ei_padd(ei_pload(&X[j]), ei_pmul(ptmp,ei_ploadu(&A[j+iN]))));
+// internal::pstore(&X[j], internal::padd(internal::pload(&X[j]), internal::pmul(ptmp,internal::ploadu(&A[j+iN]))));
// #endif
// }
// }
@@ -673,13 +673,13 @@ public :
for (int i=0;i<bound;i+=4)
{
real tmp0 = 0;
- Packet ptmp0 = ei_pset1(real(0));
+ Packet ptmp0 = internal::pset1(real(0));
real tmp1 = 0;
- Packet ptmp1 = ei_pset1(real(0));
+ Packet ptmp1 = internal::pset1(real(0));
real tmp2 = 0;
- Packet ptmp2 = ei_pset1(real(0));
+ Packet ptmp2 = internal::pset1(real(0));
real tmp3 = 0;
- Packet ptmp3 = ei_pset1(real(0));
+ Packet ptmp3 = internal::pset1(real(0));
int iN0 = i*N;
int iN1 = (i+1)*N;
int iN2 = (i+2)*N;
@@ -691,39 +691,39 @@ public :
{
for (int j = 0;j<AN;j+=PacketSize)
{
- Packet b = ei_pload(&B[j]);
- ptmp0 = ei_padd(ptmp0, ei_pmul(b, ei_pload(&A[j+iN0])));
- ptmp1 = ei_padd(ptmp1, ei_pmul(b, ei_pload(&A[j+iN1])));
- ptmp2 = ei_padd(ptmp2, ei_pmul(b, ei_pload(&A[j+iN2])));
- ptmp3 = ei_padd(ptmp3, ei_pmul(b, ei_pload(&A[j+iN3])));
+ Packet b = internal::pload(&B[j]);
+ ptmp0 = internal::padd(ptmp0, internal::pmul(b, internal::pload(&A[j+iN0])));
+ ptmp1 = internal::padd(ptmp1, internal::pmul(b, internal::pload(&A[j+iN1])));
+ ptmp2 = internal::padd(ptmp2, internal::pmul(b, internal::pload(&A[j+iN2])));
+ ptmp3 = internal::padd(ptmp3, internal::pmul(b, internal::pload(&A[j+iN3])));
}
}
else if (align1==2)
{
for (int j = 0;j<AN;j+=PacketSize)
{
- Packet b = ei_pload(&B[j]);
- ptmp0 = ei_padd(ptmp0, ei_pmul(b, ei_pload(&A[j+iN0])));
- ptmp1 = ei_padd(ptmp1, ei_pmul(b, ei_ploadu(&A[j+iN1])));
- ptmp2 = ei_padd(ptmp2, ei_pmul(b, ei_pload(&A[j+iN2])));
- ptmp3 = ei_padd(ptmp3, ei_pmul(b, ei_ploadu(&A[j+iN3])));
+ Packet b = internal::pload(&B[j]);
+ ptmp0 = internal::padd(ptmp0, internal::pmul(b, internal::pload(&A[j+iN0])));
+ ptmp1 = internal::padd(ptmp1, internal::pmul(b, internal::ploadu(&A[j+iN1])));
+ ptmp2 = internal::padd(ptmp2, internal::pmul(b, internal::pload(&A[j+iN2])));
+ ptmp3 = internal::padd(ptmp3, internal::pmul(b, internal::ploadu(&A[j+iN3])));
}
}
else
{
for (int j = 0;j<AN;j+=PacketSize)
{
- Packet b = ei_pload(&B[j]);
- ptmp0 = ei_padd(ptmp0, ei_pmul(b, ei_pload(&A[j+iN0])));
- ptmp1 = ei_padd(ptmp1, ei_pmul(b, ei_ploadu(&A[j+iN1])));
- ptmp2 = ei_padd(ptmp2, ei_pmul(b, ei_ploadu(&A[j+iN2])));
- ptmp3 = ei_padd(ptmp3, ei_pmul(b, ei_ploadu(&A[j+iN3])));
+ Packet b = internal::pload(&B[j]);
+ ptmp0 = internal::padd(ptmp0, internal::pmul(b, internal::pload(&A[j+iN0])));
+ ptmp1 = internal::padd(ptmp1, internal::pmul(b, internal::ploadu(&A[j+iN1])));
+ ptmp2 = internal::padd(ptmp2, internal::pmul(b, internal::ploadu(&A[j+iN2])));
+ ptmp3 = internal::padd(ptmp3, internal::pmul(b, internal::ploadu(&A[j+iN3])));
}
}
- tmp0 = ei_predux(ptmp0);
- tmp1 = ei_predux(ptmp1);
- tmp2 = ei_predux(ptmp2);
- tmp3 = ei_predux(ptmp3);
+ tmp0 = internal::predux(ptmp0);
+ tmp1 = internal::predux(ptmp1);
+ tmp2 = internal::predux(ptmp2);
+ tmp3 = internal::predux(ptmp3);
}
// process remaining scalars
for (int j=AN;j<N;j++)
@@ -742,17 +742,17 @@ public :
for (int i=bound;i<N;i++)
{
real tmp0 = 0;
- Packet ptmp0 = ei_pset1(real(0));
+ Packet ptmp0 = internal::pset1(real(0));
int iN0 = i*N;
if (AN>0)
{
if (iN0 % PacketSize==0)
for (int j = 0;j<AN;j+=PacketSize)
- ptmp0 = ei_padd(ptmp0, ei_pmul(ei_pload(&B[j]), ei_pload(&A[j+iN0])));
+ ptmp0 = internal::padd(ptmp0, internal::pmul(internal::pload(&B[j]), internal::pload(&A[j+iN0])));
else
for (int j = 0;j<AN;j+=PacketSize)
- ptmp0 = ei_padd(ptmp0, ei_pmul(ei_pload(&B[j]), ei_ploadu(&A[j+iN0])));
- tmp0 = ei_predux(ptmp0);
+ ptmp0 = internal::padd(ptmp0, internal::pmul(internal::pload(&B[j]), internal::ploadu(&A[j+iN0])));
+ tmp0 = internal::predux(ptmp0);
}
// process remaining scalars
for (int j=AN;j<N;j++)
@@ -769,7 +769,7 @@ public :
// for (int i=0;i<N;i++)
// {
// real tmp = 0;
-// Packet ptmp = ei_pset1(real(0));
+// Packet ptmp = internal::pset1(real(0));
// int iN = i*N;
// if (AN>0)
// {
@@ -781,21 +781,21 @@ public :
// for (int j = 0;j<ANP;j+=PacketSize*8)
// {
// ptmp =
-// ei_padd(ei_pmul(ei_pload(&B[j]), ei_pload(&A[j+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+PacketSize]), ei_pload(&A[j+PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+2*PacketSize]), ei_pload(&A[j+2*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+3*PacketSize]), ei_pload(&A[j+3*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+4*PacketSize]), ei_pload(&A[j+4*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+5*PacketSize]), ei_pload(&A[j+5*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+6*PacketSize]), ei_pload(&A[j+6*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+7*PacketSize]), ei_pload(&A[j+7*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j]), internal::pload(&A[j+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+PacketSize]), internal::pload(&A[j+PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+2*PacketSize]), internal::pload(&A[j+2*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+3*PacketSize]), internal::pload(&A[j+3*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+4*PacketSize]), internal::pload(&A[j+4*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+5*PacketSize]), internal::pload(&A[j+5*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+6*PacketSize]), internal::pload(&A[j+6*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+7*PacketSize]), internal::pload(&A[j+7*PacketSize+iN])),
// ptmp))))))));
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ptmp = ei_padd(ptmp, ei_pmul(ei_pload(&B[j]), ei_pload(&A[j+iN])));
+// ptmp = internal::padd(ptmp, internal::pmul(internal::pload(&B[j]), internal::pload(&A[j+iN])));
// #else
// for (int j = 0;j<AN;j+=PacketSize)
-// ptmp = ei_padd(ptmp, ei_pmul(ei_pload(&B[j]), ei_pload(&A[j+iN])));
+// ptmp = internal::padd(ptmp, internal::pmul(internal::pload(&B[j]), internal::pload(&A[j+iN])));
// #endif
// }
// else
@@ -805,24 +805,24 @@ public :
// for (int j = 0;j<ANP;j+=PacketSize*8)
// {
// ptmp =
-// ei_padd(ei_pmul(ei_pload(&B[j]), ei_ploadu(&A[j+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+PacketSize]), ei_ploadu(&A[j+PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+2*PacketSize]), ei_ploadu(&A[j+2*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+3*PacketSize]), ei_ploadu(&A[j+3*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+4*PacketSize]), ei_ploadu(&A[j+4*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+5*PacketSize]), ei_ploadu(&A[j+5*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+6*PacketSize]), ei_ploadu(&A[j+6*PacketSize+iN])),
-// ei_padd(ei_pmul(ei_pload(&B[j+7*PacketSize]), ei_ploadu(&A[j+7*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j]), internal::ploadu(&A[j+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+PacketSize]), internal::ploadu(&A[j+PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+2*PacketSize]), internal::ploadu(&A[j+2*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+3*PacketSize]), internal::ploadu(&A[j+3*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+4*PacketSize]), internal::ploadu(&A[j+4*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+5*PacketSize]), internal::ploadu(&A[j+5*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+6*PacketSize]), internal::ploadu(&A[j+6*PacketSize+iN])),
+// internal::padd(internal::pmul(internal::pload(&B[j+7*PacketSize]), internal::ploadu(&A[j+7*PacketSize+iN])),
// ptmp))))))));
// }
// for (int j = ANP;j<AN;j+=PacketSize)
-// ptmp = ei_padd(ptmp, ei_pmul(ei_pload(&B[j]), ei_ploadu(&A[j+iN])));
+// ptmp = internal::padd(ptmp, internal::pmul(internal::pload(&B[j]), internal::ploadu(&A[j+iN])));
// #else
// for (int j = 0;j<AN;j+=PacketSize)
-// ptmp = ei_padd(ptmp, ei_pmul(ei_pload(&B[j]), ei_ploadu(&A[j+iN])));
+// ptmp = internal::padd(ptmp, internal::pmul(internal::pload(&B[j]), internal::ploadu(&A[j+iN])));
// #endif
// }
-// tmp = ei_predux(ptmp);
+// tmp = internal::predux(ptmp);
// }
// // process remaining scalars
// for (int j=AN;j<N;j++)
@@ -835,7 +835,7 @@ public :
int AN = (N/PacketSize)*PacketSize;
if (AN>0)
{
- Packet pcoef = ei_pset1(coef);
+ Packet pcoef = internal::pset1(coef);
#ifdef PEELING
const int peelSize = 3;
int ANP = (AN/(peelSize*PacketSize))*peelSize*PacketSize;
@@ -846,33 +846,33 @@ public :
Packet x0,x1,x2,y0,y1,y2;
for (int j = 0;j<ANP;j+=PacketSize*peelSize)
{
- x0 = ei_pload(X+j);
- x1 = ei_pload(X1+j);
- x2 = ei_pload(X2+j);
-
- y0 = ei_pload(Y+j);
- y1 = ei_pload(Y1+j);
- y2 = ei_pload(Y2+j);
-
- y0 = ei_pmadd(pcoef, x0, y0);
- y1 = ei_pmadd(pcoef, x1, y1);
- y2 = ei_pmadd(pcoef, x2, y2);
-
- ei_pstore(Y+j, y0);
- ei_pstore(Y1+j, y1);
- ei_pstore(Y2+j, y2);
-// ei_pstore(&Y[j+2*PacketSize], ei_padd(ei_pload(&Y[j+2*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+2*PacketSize]))));
-// ei_pstore(&Y[j+3*PacketSize], ei_padd(ei_pload(&Y[j+3*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+3*PacketSize]))));
-// ei_pstore(&Y[j+4*PacketSize], ei_padd(ei_pload(&Y[j+4*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+4*PacketSize]))));
-// ei_pstore(&Y[j+5*PacketSize], ei_padd(ei_pload(&Y[j+5*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+5*PacketSize]))));
-// ei_pstore(&Y[j+6*PacketSize], ei_padd(ei_pload(&Y[j+6*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+6*PacketSize]))));
-// ei_pstore(&Y[j+7*PacketSize], ei_padd(ei_pload(&Y[j+7*PacketSize]), ei_pmul(pcoef,ei_pload(&X[j+7*PacketSize]))));
+ x0 = internal::pload(X+j);
+ x1 = internal::pload(X1+j);
+ x2 = internal::pload(X2+j);
+
+ y0 = internal::pload(Y+j);
+ y1 = internal::pload(Y1+j);
+ y2 = internal::pload(Y2+j);
+
+ y0 = internal::pmadd(pcoef, x0, y0);
+ y1 = internal::pmadd(pcoef, x1, y1);
+ y2 = internal::pmadd(pcoef, x2, y2);
+
+ internal::pstore(Y+j, y0);
+ internal::pstore(Y1+j, y1);
+ internal::pstore(Y2+j, y2);
+// internal::pstore(&Y[j+2*PacketSize], internal::padd(internal::pload(&Y[j+2*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+2*PacketSize]))));
+// internal::pstore(&Y[j+3*PacketSize], internal::padd(internal::pload(&Y[j+3*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+3*PacketSize]))));
+// internal::pstore(&Y[j+4*PacketSize], internal::padd(internal::pload(&Y[j+4*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+4*PacketSize]))));
+// internal::pstore(&Y[j+5*PacketSize], internal::padd(internal::pload(&Y[j+5*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+5*PacketSize]))));
+// internal::pstore(&Y[j+6*PacketSize], internal::padd(internal::pload(&Y[j+6*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+6*PacketSize]))));
+// internal::pstore(&Y[j+7*PacketSize], internal::padd(internal::pload(&Y[j+7*PacketSize]), internal::pmul(pcoef,internal::pload(&X[j+7*PacketSize]))));
}
for (int j = ANP;j<AN;j+=PacketSize)
- ei_pstore(&Y[j], ei_padd(ei_pload(&Y[j]), ei_pmul(pcoef,ei_pload(&X[j]))));
+ internal::pstore(&Y[j], internal::padd(internal::pload(&Y[j]), internal::pmul(pcoef,internal::pload(&X[j]))));
#else
for (int j = 0;j<AN;j+=PacketSize)
- ei_pstore(&Y[j], ei_padd(ei_pload(&Y[j]), ei_pmul(pcoef,ei_pload(&X[j]))));
+ internal::pstore(&Y[j], internal::padd(internal::pload(&Y[j]), internal::pmul(pcoef,internal::pload(&X[j]))));
#endif
}
// process remaining scalars
diff --git a/bench/check_cache_queries.cpp b/bench/check_cache_queries.cpp
index d2e75048a..029d44cf6 100644
--- a/bench/check_cache_queries.cpp
+++ b/bench/check_cache_queries.cpp
@@ -17,10 +17,10 @@ using namespace std;
int main()
{
- cout << "Eigen's L1 = " << ei_queryL1CacheSize() << endl;
- cout << "Eigen's L2/L3 = " << ei_queryTopLevelCacheSize() << endl;
+ cout << "Eigen's L1 = " << internal::queryL1CacheSize() << endl;
+ cout << "Eigen's L2/L3 = " << internal::queryTopLevelCacheSize() << endl;
int l1, l2, l3;
- ei_queryCacheSizes(l1, l2, l3);
+ internal::queryCacheSizes(l1, l2, l3);
cout << "Eigen's L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl;
#ifdef EIGEN_CPUID
@@ -40,14 +40,14 @@ int main()
cout << endl;
int max_funcs = abcd[0];
- ei_queryCacheSizes_intel_codes(l1, l2, l3);
+ internal::queryCacheSizes_intel_codes(l1, l2, l3);
cout << "Eigen's intel codes L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl;
if(max_funcs>=4)
{
- ei_queryCacheSizes_intel_direct(l1, l2, l3);
+ internal::queryCacheSizes_intel_direct(l1, l2, l3);
cout << "Eigen's intel direct L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl;
}
- ei_queryCacheSizes_amd(l1, l2, l3);
+ internal::queryCacheSizes_amd(l1, l2, l3);
cout << "Eigen's amd L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl;
cout << endl;
diff --git a/bench/eig33.cpp b/bench/eig33.cpp
index df07ad79d..da8518012 100644
--- a/bench/eig33.cpp
+++ b/bench/eig33.cpp
@@ -65,7 +65,7 @@ inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
const Scalar s_inv3 = 1.0/3.0;
- const Scalar s_sqrt3 = ei_sqrt(Scalar(3.0));
+ const Scalar s_sqrt3 = internal::sqrt(Scalar(3.0));
// The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The
// eigenvalues are the roots to this equation, all guaranteed to be
@@ -88,10 +88,10 @@ inline void computeRoots(const Matrix& m, Roots& roots)
q = Scalar(0);
// Compute the eigenvalues by solving for the roots of the polynomial.
- Scalar rho = ei_sqrt(-a_over_3);
- Scalar theta = std::atan2(ei_sqrt(-q),half_b)*s_inv3;
- Scalar cos_theta = ei_cos(theta);
- Scalar sin_theta = ei_sin(theta);
+ Scalar rho = internal::sqrt(-a_over_3);
+ Scalar theta = std::atan2(internal::sqrt(-q),half_b)*s_inv3;
+ Scalar cos_theta = internal::cos(theta);
+ Scalar sin_theta = internal::sin(theta);
roots(0) = c2_over_3 + Scalar(2)*rho*cos_theta;
roots(1) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta);
roots(2) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta);
diff --git a/bench/quat_slerp.cpp b/bench/quat_slerp.cpp
index 27a2067ab..bffb3bf11 100644
--- a/bench/quat_slerp.cpp
+++ b/bench/quat_slerp.cpp
@@ -25,16 +25,16 @@ EIGEN_DONT_INLINE Q slerp_legacy(const Q& a, const Q& b, typename Q::Scalar t)
typedef typename Q::Scalar Scalar;
static const Scalar one = Scalar(1) - dummy_precision<Scalar>();
Scalar d = a.dot(b);
- Scalar absD = ei_abs(d);
+ Scalar absD = internal::abs(d);
if (absD>=one)
return a;
// theta is the angle between the 2 quaternions
Scalar theta = std::acos(absD);
- Scalar sinTheta = ei_sin(theta);
+ Scalar sinTheta = internal::sin(theta);
- Scalar scale0 = ei_sin( ( Scalar(1) - t ) * theta) / sinTheta;
- Scalar scale1 = ei_sin( ( t * theta) ) / sinTheta;
+ Scalar scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;
+ Scalar scale1 = internal::sin( ( t * theta) ) / sinTheta;
if (d<0)
scale1 = -scale1;
@@ -47,7 +47,7 @@ EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q& a, const Q& b, typename Q::Scala
typedef typename Q::Scalar Scalar;
static const Scalar one = Scalar(1) - epsilon<Scalar>();
Scalar d = a.dot(b);
- Scalar absD = ei_abs(d);
+ Scalar absD = internal::abs(d);
Scalar scale0;
Scalar scale1;
@@ -61,10 +61,10 @@ EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q& a, const Q& b, typename Q::Scala
{
// theta is the angle between the 2 quaternions
Scalar theta = std::acos(absD);
- Scalar sinTheta = ei_sin(theta);
+ Scalar sinTheta = internal::sin(theta);
- scale0 = ei_sin( ( Scalar(1) - t ) * theta) / sinTheta;
- scale1 = ei_sin( ( t * theta) ) / sinTheta;
+ scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;
+ scale1 = internal::sin( ( t * theta) ) / sinTheta;
if (d<0)
scale1 = -scale1;
}
@@ -132,8 +132,8 @@ EIGEN_DONT_INLINE Q slerp_gael(const Q& a, const Q& b, typename Q::Scalar t)
else
{
Scalar sinTheta = std::sin(theta);
- scale0 = ei_sin( ( Scalar(1) - t ) * theta) / sinTheta;
- scale1 = ei_sin( ( t * theta) ) / sinTheta;
+ scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;
+ scale1 = internal::sin( ( t * theta) ) / sinTheta;
if (d<0)
scale1 = -scale1;
}
diff --git a/bench/quatmul.cpp b/bench/quatmul.cpp
index d91a4b01b..8d9d7922c 100644
--- a/bench/quatmul.cpp
+++ b/bench/quatmul.cpp
@@ -14,7 +14,7 @@ EIGEN_DONT_INLINE void quatmul_default(const Quat& a, const Quat& b, Quat& c)
template<typename Quat>
EIGEN_DONT_INLINE void quatmul_novec(const Quat& a, const Quat& b, Quat& c)
{
- c = ei_quat_product<0, Quat, Quat, typename Quat::Scalar, Aligned>::run(a,b);
+ c = internal::quat_product<0, Quat, Quat, typename Quat::Scalar, Aligned>::run(a,b);
}
template<typename Quat> void bench(const std::string& label)
diff --git a/bench/sparse_cholesky.cpp b/bench/sparse_cholesky.cpp
index 4b8ff34f8..ecb226786 100644
--- a/bench/sparse_cholesky.cpp
+++ b/bench/sparse_cholesky.cpp
@@ -46,10 +46,10 @@ void fillSpdMatrix(float density, int rows, int cols, EigenSparseSelfAdjointMat
dst.startFill(rows*cols*density);
for(int j = 0; j < cols; j++)
{
- dst.fill(j,j) = ei_random<Scalar>(10,20);
+ dst.fill(j,j) = internal::random<Scalar>(10,20);
for(int i = j+1; i < rows; i++)
{
- Scalar v = (ei_random<float>(0,1) < density) ? ei_random<Scalar>() : 0;
+ Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;
if (v!=0)
dst.fill(i,j) = v;
}
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
int count = 0;
for (int j=0; j<cols; ++j)
for (int i=j; i<rows; ++i)
- if (!ei_isMuchSmallerThan(ei_abs(chol.matrixL()(i,j)), 0.1))
+ if (!internal::isMuchSmallerThan(internal::abs(chol.matrixL()(i,j)), 0.1))
count++;
std::cout << "dense: " << "nnz = " << count << "\n";
// std::cout << "dense:\n" << m1 << "\n\n" << chol.matrixL() << endl;
diff --git a/bench/sparse_randomsetter.cpp b/bench/sparse_randomsetter.cpp
index 61753d8c2..19a76e38d 100644
--- a/bench/sparse_randomsetter.cpp
+++ b/bench/sparse_randomsetter.cpp
@@ -51,7 +51,7 @@ void dostuff(const char* name, EigenSparseMatrix& sm1)
SetterType* set1 = new SetterType(sm1);
t.reset(); t.start();
for (int k=0; k<nentries; ++k)
- (*set1)(ei_random<int>(0,rows-1),ei_random<int>(0,cols-1)) += 1;
+ (*set1)(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
t.stop();
std::cout << "std::map => \t" << t.value()-rtime
<< " nnz=" << set1->nonZeros() << std::flush;
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
t.reset(); t.start();
for (int k=0; k<nentries; ++k)
- dummy = ei_random<int>(0,rows-1) + ei_random<int>(0,cols-1);
+ dummy = internal::random<int>(0,rows-1) + internal::random<int>(0,cols-1);
t.stop();
rtime = t.value();
std::cout << "rtime = " << rtime << " (" << dummy << ")\n\n";
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
// RandomSetter<EigenSparseMatrix,GnuHashMapTraits,Bits> set1(sm1);
// t.reset(); t.start();
// for (int k=0; k<n; ++k)
-// set1(ei_random<int>(0,rows-1),ei_random<int>(0,cols-1)) += 1;
+// set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
// t.stop();
// std::cout << "gnu::hash_map => \t" << t.value()-rtime
// << " nnz=" << set1.nonZeros() << "\n";getchar();
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
// RandomSetter<EigenSparseMatrix,GoogleDenseHashMapTraits,Bits> set1(sm1);
// t.reset(); t.start();
// for (int k=0; k<n; ++k)
-// set1(ei_random<int>(0,rows-1),ei_random<int>(0,cols-1)) += 1;
+// set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
// t.stop();
// std::cout << "google::dense => \t" << t.value()-rtime
// << " nnz=" << set1.nonZeros() << "\n";getchar();
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
// RandomSetter<EigenSparseMatrix,GoogleSparseHashMapTraits,Bits> set1(sm1);
// t.reset(); t.start();
// for (int k=0; k<n; ++k)
-// set1(ei_random<int>(0,rows-1),ei_random<int>(0,cols-1)) += 1;
+// set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
// t.stop();
// std::cout << "google::sparse => \t" << t.value()-rtime
// << " nnz=" << set1.nonZeros() << "\n";getchar();
diff --git a/bench/sparse_setter.cpp b/bench/sparse_setter.cpp
index 9c22636d7..a9f0b11cc 100644
--- a/bench/sparse_setter.cpp
+++ b/bench/sparse_setter.cpp
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
for (int i=0; i<cols*NBPERROW; )
{
// DynamicSparseMatrix<int> stencil(SIZE,SIZE);
- Vector2i ij(ei_random<int>(0,rows-1),ei_random<int>(0,cols-1));
+ Vector2i ij(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1));
// if(stencil.coeffRef(ij.x(), ij.y())==0)
{
// stencil.coeffRef(ij.x(), ij.y()) = 1;
@@ -90,9 +90,9 @@ int main(int argc, char *argv[])
values.reserve(n);
for (int i=0; i<n; ++i)
{
- int i = ei_random<int>(0,pool.size());
+ int i = internal::random<int>(0,pool.size());
coords.push_back(pool[i]);
- values.push_back(ei_random<Scalar>());
+ values.push_back(internal::random<Scalar>());
}
}
else
@@ -100,8 +100,8 @@ int main(int argc, char *argv[])
for (int j=0; j<cols; ++j)
for (int i=0; i<NBPERROW; ++i)
{
- coords.push_back(Vector2i(ei_random<int>(0,rows-1),j));
- values.push_back(ei_random<Scalar>());
+ coords.push_back(Vector2i(internal::random<int>(0,rows-1),j));
+ values.push_back(internal::random<Scalar>());
}
}
std::cout << "nnz = " << coords.size() << "\n";
diff --git a/bench/sparse_trisolver.cpp b/bench/sparse_trisolver.cpp
index 6d433ad9e..13f4f0a24 100644
--- a/bench/sparse_trisolver.cpp
+++ b/bench/sparse_trisolver.cpp
@@ -44,11 +44,11 @@ void fillMatrix(float density, int rows, int cols, EigenSparseTriMatrix& dst)
{
for(int i = 0; i < j; i++)
{
- Scalar v = (ei_random<float>(0,1) < density) ? ei_random<Scalar>() : 0;
+ Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;
if (v!=0)
dst.fill(i,j) = v;
}
- dst.fill(j,j) = ei_random<Scalar>();
+ dst.fill(j,j) = internal::random<Scalar>();
}
dst.endFill();
}
diff --git a/blas/level1_impl.h b/blas/level1_impl.h
index f07b41c64..a24adc681 100644
--- a/blas/level1_impl.h
+++ b/blas/level1_impl.h
@@ -55,13 +55,13 @@ RealScalar EIGEN_BLAS_FUNC(asum)(int *n, RealScalar *px, int *incx)
}
#else
-struct ei_scalar_norm1_op {
+struct internal::scalar_norm1_op {
typedef RealScalar result_type;
- EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_norm1_op)
- inline RealScalar operator() (const Scalar& a) const { return ei_norm1(a); }
+ EIGEN_EMPTY_STRUCT_CTOR(internal::scalar_norm1_op)
+ inline RealScalar operator() (const Scalar& a) const { return internal::norm1(a); }
};
namespace Eigen {
-template<> struct ei_functor_traits<ei_scalar_norm1_op >
+template<> struct internal::functor_traits<internal::scalar_norm1_op >
{
enum { Cost = 3 * NumTraits<Scalar>::AddCost, PacketAccess = 0 };
};
@@ -75,8 +75,8 @@ RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),asum_)(int *n,
if(*n<=0) return 0;
- if(*incx==1) return vector(x,*n).unaryExpr<ei_scalar_norm1_op>().sum();
- else return vector(x,*n,std::abs(*incx)).unaryExpr<ei_scalar_norm1_op>().sum();
+ if(*incx==1) return vector(x,*n).unaryExpr<internal::scalar_norm1_op>().sum();
+ else return vector(x,*n,std::abs(*incx)).unaryExpr<internal::scalar_norm1_op>().sum();
}
#endif
@@ -233,9 +233,9 @@ int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int
Reverse<StridedVectorType> rvx(vx);
Reverse<StridedVectorType> rvy(vy);
- if(*incx<0 && *incy>0) ei_apply_rotation_in_the_plane(rvx, vy, PlanarRotation<Scalar>(c,s));
- else if(*incx>0 && *incy<0) ei_apply_rotation_in_the_plane(vx, rvy, PlanarRotation<Scalar>(c,s));
- else ei_apply_rotation_in_the_plane(vx, vy, PlanarRotation<Scalar>(c,s));
+ if(*incx<0 && *incy>0) internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));
+ else if(*incx>0 && *incy<0) internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));
+ else internal::apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c,s));
return 0;
@@ -250,8 +250,8 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
#if !ISCOMPLEX
Scalar r,z;
- Scalar aa = ei_abs(a);
- Scalar ab = ei_abs(b);
+ Scalar aa = internal::abs(a);
+ Scalar ab = internal::abs(b);
if((aa+ab)==Scalar(0))
{
*c = 1;
@@ -261,7 +261,7 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
}
else
{
- r = ei_sqrt(a*a + b*b);
+ r = internal::sqrt(a*a + b*b);
Scalar amax = aa>ab ? a : b;
r = amax>0 ? r : -r;
*c = a/r;
@@ -276,7 +276,7 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
#else
Scalar alpha;
RealScalar norm,scale;
- if(ei_abs(a)==RealScalar(0))
+ if(internal::abs(a)==RealScalar(0))
{
*c = RealScalar(0);
*s = Scalar(1);
@@ -284,16 +284,16 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
}
else
{
- scale = ei_abs(a) + ei_abs(b);
- norm = scale*ei_sqrt((ei_abs2(a/scale))+ (ei_abs2(b/scale)));
- alpha = a/ei_abs(a);
- *c = ei_abs(a)/norm;
- *s = alpha*ei_conj(b)/norm;
+ scale = internal::abs(a) + internal::abs(b);
+ norm = scale*internal::sqrt((internal::abs2(a/scale))+ (internal::abs2(b/scale)));
+ alpha = a/internal::abs(a);
+ *c = internal::abs(a)/norm;
+ *s = alpha*internal::conj(b)/norm;
a = alpha*norm;
}
#endif
-// PlanarRotation<Scalar> r;
+// JacobiRotation<Scalar> r;
// r.makeGivens(a,b);
// *c = r.c();
// *s = r.s();
diff --git a/blas/level2_impl.h b/blas/level2_impl.h
index 3489a426d..2749cf5b3 100644
--- a/blas/level2_impl.h
+++ b/blas/level2_impl.h
@@ -84,21 +84,21 @@ int EIGEN_BLAS_FUNC(trsv)(char *uplo, char *opa, char *diag, int *n, RealScalar
for(int k=0; k<16; ++k)
func[k] = 0;
-// func[NOTR | (UP << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|0, false,ColMajor,ColMajor>::run);
-// func[TR | (UP << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|0, false,RowMajor,ColMajor>::run);
-// func[ADJ | (UP << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|0, Conj, RowMajor,ColMajor>::run);
+// func[NOTR | (UP << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|0, false,ColMajor,ColMajor>::run);
+// func[TR | (UP << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|0, false,RowMajor,ColMajor>::run);
+// func[ADJ | (UP << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|0, Conj, RowMajor,ColMajor>::run);
//
-// func[NOTR | (LO << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|0, false,ColMajor,ColMajor>::run);
-// func[TR | (LO << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|0, false,RowMajor,ColMajor>::run);
-// func[ADJ | (LO << 2) | (NUNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|0, Conj, RowMajor,ColMajor>::run);
+// func[NOTR | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|0, false,ColMajor,ColMajor>::run);
+// func[TR | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|0, false,RowMajor,ColMajor>::run);
+// func[ADJ | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|0, Conj, RowMajor,ColMajor>::run);
//
-// func[NOTR | (UP << 3) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,false,ColMajor,ColMajor>::run);
-// func[TR | (UP << 2) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,false,RowMajor,ColMajor>::run);
-// func[ADJ | (UP << 2) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,Conj, RowMajor,ColMajor>::run);
+// func[NOTR | (UP << 3) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,false,ColMajor,ColMajor>::run);
+// func[TR | (UP << 2) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,false,RowMajor,ColMajor>::run);
+// func[ADJ | (UP << 2) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, UpperTriangular|UnitDiagBit,Conj, RowMajor,ColMajor>::run);
//
-// func[NOTR | (LO << 2) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,false,ColMajor,ColMajor>::run);
-// func[TR | (LO << 2) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,false,RowMajor,ColMajor>::run);
-// func[ADJ | (LO << 2) | (UNIT << 3)] = (ei_triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,Conj, RowMajor,ColMajor>::run);
+// func[NOTR | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,false,ColMajor,ColMajor>::run);
+// func[TR | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,false,RowMajor,ColMajor>::run);
+// func[ADJ | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector<Scalar, LowerTriangular|UnitDiagBit,Conj, RowMajor,ColMajor>::run);
init = true;
}
@@ -130,21 +130,21 @@ int EIGEN_BLAS_FUNC(trmv)(char *uplo, char *opa, char *diag, int *n, RealScalar
for(int k=0; k<16; ++k)
func[k] = 0;
-// func[NOTR | (UP << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
-// func[TR | (UP << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
-// func[ADJ | (UP << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+// func[NOTR | (UP << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
+// func[TR | (UP << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
+// func[ADJ | (UP << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
//
-// func[NOTR | (LO << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
-// func[TR | (LO << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
-// func[ADJ | (LO << 2) | (NUNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+// func[NOTR | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
+// func[TR | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
+// func[ADJ | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
//
-// func[NOTR | (UP << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, ColMajor,false,ColMajor,false,ColMajor>::run);
-// func[TR | (UP << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, RowMajor,false,ColMajor,false,ColMajor>::run);
-// func[ADJ | (UP << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+// func[NOTR | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, ColMajor,false,ColMajor,false,ColMajor>::run);
+// func[TR | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, RowMajor,false,ColMajor,false,ColMajor>::run);
+// func[ADJ | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,UpperTriangular|UnitDiagBit,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
//
-// func[NOTR | (LO << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, ColMajor,false,ColMajor,false,ColMajor>::run);
-// func[TR | (LO << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, RowMajor,false,ColMajor,false,ColMajor>::run);
-// func[ADJ | (LO << 2) | (UNIT << 3)] = (ei_product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+// func[NOTR | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, ColMajor,false,ColMajor,false,ColMajor>::run);
+// func[TR | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, RowMajor,false,ColMajor,false,ColMajor>::run);
+// func[ADJ | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector<Scalar,LowerTriangular|UnitDiagBit,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
init = true;
}
@@ -182,8 +182,8 @@ int EIGEN_BLAS_FUNC(syr)(char *uplo, int *n, RealScalar *palpha, RealScalar *pa,
for(int k=0; k<2; ++k)
func[k] = 0;
-// func[UP] = (ei_selfadjoint_product<Scalar,ColMajor,ColMajor,false,UpperTriangular>::run);
-// func[LO] = (ei_selfadjoint_product<Scalar,ColMajor,ColMajor,false,LowerTriangular>::run);
+// func[UP] = (internal::selfadjoint_product<Scalar,ColMajor,ColMajor,false,UpperTriangular>::run);
+// func[LO] = (internal::selfadjoint_product<Scalar,ColMajor,ColMajor,false,LowerTriangular>::run);
init = true;
}
@@ -216,8 +216,8 @@ int EIGEN_BLAS_FUNC(syr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *pa
for(int k=0; k<2; ++k)
func[k] = 0;
-// func[UP] = (ei_selfadjoint_product<Scalar,ColMajor,ColMajor,false,UpperTriangular>::run);
-// func[LO] = (ei_selfadjoint_product<Scalar,ColMajor,ColMajor,false,LowerTriangular>::run);
+// func[UP] = (internal::selfadjoint_product<Scalar,ColMajor,ColMajor,false,UpperTriangular>::run);
+// func[LO] = (internal::selfadjoint_product<Scalar,ColMajor,ColMajor,false,LowerTriangular>::run);
init = true;
}
diff --git a/blas/level3_impl.h b/blas/level3_impl.h
index b07c20ee6..ef343dc50 100644
--- a/blas/level3_impl.h
+++ b/blas/level3_impl.h
@@ -27,7 +27,7 @@
int EIGEN_BLAS_FUNC(gemm)(char *opa, char *opb, int *m, int *n, int *k, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, RealScalar *pbeta, RealScalar *pc, int *ldc)
{
// std::cerr << "in gemm " << *opa << " " << *opb << " " << *m << " " << *n << " " << *k << " " << *lda << " " << *ldb << " " << *ldc << " " << *palpha << " " << *pbeta << "\n";
- typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar, ei_level3_blocking<Scalar,Scalar>&, Eigen::GemmParallelInfo<DenseIndex>*);
+ typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar, internal::level3_blocking<Scalar,Scalar>&, Eigen::GemmParallelInfo<DenseIndex>*);
static functype func[12];
static bool init = false;
@@ -35,15 +35,15 @@ int EIGEN_BLAS_FUNC(gemm)(char *opa, char *opb, int *m, int *n, int *k, RealScal
{
for(int k=0; k<12; ++k)
func[k] = 0;
- func[NOTR | (NOTR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,ColMajor,false,ColMajor>::run);
- func[TR | (NOTR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,false,ColMajor>::run);
- func[ADJ | (NOTR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor>::run);
- func[NOTR | (TR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,false,ColMajor>::run);
- func[TR | (TR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,false,ColMajor>::run);
- func[ADJ | (TR << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,false,ColMajor>::run);
- func[NOTR | (ADJ << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj, ColMajor>::run);
- func[TR | (ADJ << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,Conj, ColMajor>::run);
- func[ADJ | (ADJ << 2)] = (ei_general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,Conj, ColMajor>::run);
+ func[NOTR | (NOTR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,ColMajor,false,ColMajor>::run);
+ func[TR | (NOTR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,false,ColMajor>::run);
+ func[ADJ | (NOTR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor>::run);
+ func[NOTR | (TR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,false,ColMajor>::run);
+ func[TR | (TR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,false,ColMajor>::run);
+ func[ADJ | (TR << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,false,ColMajor>::run);
+ func[NOTR | (ADJ << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj, ColMajor>::run);
+ func[TR | (ADJ << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,Conj, ColMajor>::run);
+ func[ADJ | (ADJ << 2)] = (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,Conj, ColMajor>::run);
init = true;
}
@@ -71,7 +71,7 @@ int EIGEN_BLAS_FUNC(gemm)(char *opa, char *opb, int *m, int *n, int *k, RealScal
else matrix(c, *m, *n, *ldc) *= beta;
}
- ei_gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*m,*n,*k);
+ internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*m,*n,*k);
int code = OP(*opa) | (OP(*opb) << 2);
func[code](*m, *n, *k, a, *lda, b, *ldb, c, *ldc, alpha, blocking, 0);
@@ -90,38 +90,38 @@ int EIGEN_BLAS_FUNC(trsm)(char *side, char *uplo, char *opa, char *diag, int *m,
for(int k=0; k<32; ++k)
func[k] = 0;
- func[NOTR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, false,ColMajor,ColMajor>::run);
- func[TR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, false,RowMajor,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, false,ColMajor,ColMajor>::run);
+ func[TR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, false,RowMajor,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, Conj, RowMajor,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, false,ColMajor,ColMajor>::run);
- func[TR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, false,RowMajor,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, false,ColMajor,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, false,RowMajor,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, Conj, RowMajor,ColMajor>::run);
- func[NOTR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, false,ColMajor,ColMajor>::run);
- func[TR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, false,RowMajor,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0, false,ColMajor,ColMajor>::run);
+ func[TR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, false,RowMajor,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0, Conj, RowMajor,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, false,ColMajor,ColMajor>::run);
- func[TR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, false,RowMajor,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0, false,ColMajor,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, false,RowMajor,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0, Conj, RowMajor,ColMajor>::run);
- func[NOTR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,ColMajor,ColMajor>::run);
- func[TR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,RowMajor,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,ColMajor,ColMajor>::run);
+ func[TR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,RowMajor,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,Conj, RowMajor,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,ColMajor,ColMajor>::run);
- func[TR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,RowMajor,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,ColMajor,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,RowMajor,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,Conj, RowMajor,ColMajor>::run);
- func[NOTR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,ColMajor,ColMajor>::run);
- func[TR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,RowMajor,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,ColMajor,ColMajor>::run);
+ func[TR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,RowMajor,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,Conj, RowMajor,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,ColMajor,ColMajor>::run);
- func[TR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,RowMajor,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,Conj, RowMajor,ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,ColMajor,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,RowMajor,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,Conj, RowMajor,ColMajor>::run);
init = true;
}
@@ -169,37 +169,37 @@ int EIGEN_BLAS_FUNC(trmm)(char *side, char *uplo, char *opa, char *diag, int *m,
for(int k=0; k<32; ++k)
func[k] = 0;
- func[NOTR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,RowMajor,false,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,RowMajor,false,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
- func[NOTR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, true, ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, RowMajor,false,ColMajor,false,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,RowMajor,false,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0, false,ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,RowMajor,false,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0, false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
- func[NOTR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (UP << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
- func[NOTR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run);
- func[ADJ | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
+ func[NOTR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run);
+ func[ADJ | (LEFT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run);
- func[NOTR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run);
- func[TR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run);
- func[ADJ | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (ei_product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
+ func[NOTR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run);
+ func[TR | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run);
+ func[ADJ | (RIGHT << 2) | (LO << 3) | (UNIT << 4)] = (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run);
init = true;
}
@@ -289,12 +289,12 @@ int EIGEN_BLAS_FUNC(symm)(char *side, char *uplo, int *m, int *n, RealScalar *pa
matrix(c, *m, *n, *ldc) += alpha * matrix(b, *m, *n, *ldb) * matA;
#else
if(SIDE(*side)==LEFT)
- if(UPLO(*uplo)==UP) ei_product_selfadjoint_matrix<Scalar, DenseIndex, RowMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
- else if(UPLO(*uplo)==LO) ei_product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
+ if(UPLO(*uplo)==UP) internal::product_selfadjoint_matrix<Scalar, DenseIndex, RowMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
+ else if(UPLO(*uplo)==LO) internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
else return 0;
else if(SIDE(*side)==RIGHT)
- if(UPLO(*uplo)==UP) ei_product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, RowMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);
- else if(UPLO(*uplo)==LO) ei_product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, ColMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);
+ if(UPLO(*uplo)==UP) internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, RowMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);
+ else if(UPLO(*uplo)==LO) internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, ColMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);
else return 0;
else
return 0;
@@ -317,13 +317,13 @@ int EIGEN_BLAS_FUNC(syrk)(char *uplo, char *op, int *n, int *k, RealScalar *palp
for(int k=0; k<8; ++k)
func[k] = 0;
- func[NOTR | (UP << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Upper>::run);
- func[TR | (UP << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
- func[ADJ | (UP << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
+ func[NOTR | (UP << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Upper>::run);
+ func[TR | (UP << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
+ func[ADJ | (UP << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
- func[NOTR | (LO << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Lower>::run);
- func[TR | (LO << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
- func[ADJ | (LO << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
+ func[NOTR | (LO << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Lower>::run);
+ func[TR | (LO << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
+ func[ADJ | (LO << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
init = true;
}
@@ -470,17 +470,17 @@ int EIGEN_BLAS_FUNC(hemm)(char *side, char *uplo, int *m, int *n, RealScalar *pa
if(SIDE(*side)==LEFT)
{
- if(UPLO(*uplo)==UP) ei_product_selfadjoint_matrix<Scalar,DenseIndex,RowMajor,true,Conj, ColMajor,false,false, ColMajor>
+ if(UPLO(*uplo)==UP) internal::product_selfadjoint_matrix<Scalar,DenseIndex,RowMajor,true,Conj, ColMajor,false,false, ColMajor>
::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
- else if(UPLO(*uplo)==LO) ei_product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,true,false, ColMajor,false,false, ColMajor>
+ else if(UPLO(*uplo)==LO) internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,true,false, ColMajor,false,false, ColMajor>
::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha);
else return 0;
}
else if(SIDE(*side)==RIGHT)
{
- if(UPLO(*uplo)==UP) matrix(c,*m,*n,*ldc) += alpha * matrix(b,*m,*n,*ldb) * matrix(a,*n,*n,*lda).selfadjointView<Upper>();/*ei_product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, RowMajor,true,Conj, ColMajor>
+ if(UPLO(*uplo)==UP) matrix(c,*m,*n,*ldc) += alpha * matrix(b,*m,*n,*ldb) * matrix(a,*n,*n,*lda).selfadjointView<Upper>();/*internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, RowMajor,true,Conj, ColMajor>
::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);*/
- else if(UPLO(*uplo)==LO) ei_product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, ColMajor,true,false, ColMajor>
+ else if(UPLO(*uplo)==LO) internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, ColMajor,true,false, ColMajor>
::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha);
else return 0;
}
@@ -505,11 +505,11 @@ int EIGEN_BLAS_FUNC(herk)(char *uplo, char *op, int *n, int *k, RealScalar *palp
for(int k=0; k<8; ++k)
func[k] = 0;
- func[NOTR | (UP << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Upper>::run);
- func[ADJ | (UP << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
+ func[NOTR | (UP << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Upper>::run);
+ func[ADJ | (UP << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Upper>::run);
- func[NOTR | (LO << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Lower>::run);
- func[ADJ | (LO << 2)] = (ei_selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
+ func[NOTR | (LO << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,ColMajor,ColMajor,true, Lower>::run);
+ func[ADJ | (LO << 2)] = (internal::selfadjoint_product<Scalar,DenseIndex,RowMajor,ColMajor,false,Lower>::run);
init = true;
}
@@ -591,23 +591,23 @@ int EIGEN_BLAS_FUNC(her2k)(char *uplo, char *op, int *n, int *k, RealScalar *pal
{
matrix(c, *n, *n, *ldc).triangularView<Upper>()
+= alpha *matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).adjoint()
- + ei_conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();
+ + internal::conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();
}
else if(UPLO(*uplo)==LO)
matrix(c, *n, *n, *ldc).triangularView<Lower>()
+= alpha*matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).adjoint()
- + ei_conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();
+ + internal::conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();
}
else if(OP(*op)==ADJ)
{
if(UPLO(*uplo)==UP)
matrix(c, *n, *n, *ldc).triangularView<Upper>()
+= alpha*matrix(a, *k, *n, *lda).adjoint()*matrix(b, *k, *n, *ldb)
- + ei_conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);
+ + internal::conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);
else if(UPLO(*uplo)==LO)
matrix(c, *n, *n, *ldc).triangularView<Lower>()
+= alpha*matrix(a, *k, *n, *lda).adjoint()*matrix(b, *k, *n, *ldb)
- + ei_conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);
+ + internal::conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);
}
return 1;
diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake
index 60d99adc9..821bdae56 100644
--- a/cmake/EigenTesting.cmake
+++ b/cmake/EigenTesting.cmake
@@ -35,13 +35,19 @@ macro(ei_add_test_internal testname testname_with_suffix)
if(EXTERNAL_LIBS)
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
endif()
+
if(${ARGC} GREATER 3)
- string(STRIP "${ARGV3}" ARGV3_stripped)
- string(LENGTH "${ARGV3_stripped}" ARGV3_stripped_length)
- if(${ARGV3_stripped_length} GREATER 0)
- target_link_libraries(${targetname} ${ARGV3})
- endif(${ARGV3_stripped_length} GREATER 0)
- endif(${ARGC} GREATER 3)
+ set(libs_to_link ${ARGV3})
+ # it could be that some cmake module provides a bad library string " " (just spaces),
+ # and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).
+ # so we check for strings containing only spaces.
+ string(STRIP "${libs_to_link}" libs_to_link_stripped)
+ string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length)
+ if(${libs_to_link_stripped_length} GREATER 0)
+ # notice: no double quotes around ${libs_to_link} here. It may be a list.
+ target_link_libraries(${targetname} ${libs_to_link})
+ endif()
+ endif()
if(WIN32)
if(CYGWIN)
diff --git a/cmake/FindGLEW.cmake b/cmake/FindGLEW.cmake
new file mode 100644
index 000000000..54da20f12
--- /dev/null
+++ b/cmake/FindGLEW.cmake
@@ -0,0 +1,105 @@
+# Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+# - try to find glew library and include files
+# GLEW_INCLUDE_DIR, where to find GL/glew.h, etc.
+# GLEW_LIBRARIES, the libraries to link against
+# GLEW_FOUND, If false, do not try to use GLEW.
+# Also defined, but not for general use are:
+# GLEW_GLEW_LIBRARY = the full path to the glew library.
+
+IF (WIN32)
+
+ IF(CYGWIN)
+
+ FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h)
+
+ FIND_LIBRARY( GLEW_GLEW_LIBRARY glew32
+ ${OPENGL_LIBRARY_DIR}
+ /usr/lib/w32api
+ /usr/X11R6/lib
+ )
+
+
+ ELSE(CYGWIN)
+
+ FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
+ $ENV{GLEW_ROOT_PATH}/include
+ )
+
+ FIND_LIBRARY( GLEW_GLEW_LIBRARY
+ NAMES glew glew32
+ PATHS
+ $ENV{GLEW_ROOT_PATH}/lib
+ ${OPENGL_LIBRARY_DIR}
+ )
+
+ ENDIF(CYGWIN)
+
+ELSE (WIN32)
+
+ IF (APPLE)
+# These values for Apple could probably do with improvement.
+ FIND_PATH( GLEW_INCLUDE_DIR glew.h
+ /System/Library/Frameworks/GLEW.framework/Versions/A/Headers
+ ${OPENGL_LIBRARY_DIR}
+ )
+ SET(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX")
+ SET(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
+ ELSE (APPLE)
+
+ FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
+ /usr/include/GL
+ /usr/openwin/share/include
+ /usr/openwin/include
+ /usr/X11R6/include
+ /usr/include/X11
+ /opt/graphics/OpenGL/include
+ /opt/graphics/OpenGL/contrib/libglew
+ )
+
+ FIND_LIBRARY( GLEW_GLEW_LIBRARY GLEW
+ /usr/openwin/lib
+ /usr/X11R6/lib
+ )
+
+ ENDIF (APPLE)
+
+ENDIF (WIN32)
+
+SET( GLEW_FOUND "NO" )
+IF(GLEW_INCLUDE_DIR)
+ IF(GLEW_GLEW_LIBRARY)
+ # Is -lXi and -lXmu required on all platforms that have it?
+ # If not, we need some way to figure out what platform we are on.
+ SET( GLEW_LIBRARIES
+ ${GLEW_GLEW_LIBRARY}
+ ${GLEW_cocoa_LIBRARY}
+ )
+ SET( GLEW_FOUND "YES" )
+
+#The following deprecated settings are for backwards compatibility with CMake1.4
+ SET (GLEW_LIBRARY ${GLEW_LIBRARIES})
+ SET (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR})
+
+ ENDIF(GLEW_GLEW_LIBRARY)
+ENDIF(GLEW_INCLUDE_DIR)
+
+IF(GLEW_FOUND)
+ IF(NOT GLEW_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Glew: ${GLEW_LIBRARIES}")
+ ENDIF(NOT GLEW_FIND_QUIETLY)
+ELSE(GLEW_FOUND)
+ IF(GLEW_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Glew")
+ ENDIF(GLEW_FIND_REQUIRED)
+ENDIF(GLEW_FOUND)
+
+MARK_AS_ADVANCED(
+ GLEW_INCLUDE_DIR
+ GLEW_GLEW_LIBRARY
+ GLEW_Xmu_LIBRARY
+ GLEW_Xi_LIBRARY
+)
diff --git a/cmake/FindGSL.cmake b/cmake/FindGSL.cmake
index bf411a7f9..32d182d64 100644
--- a/cmake/FindGSL.cmake
+++ b/cmake/FindGSL.cmake
@@ -160,6 +160,7 @@ ELSE(WIN32)
ENDIF(UNIX)
ENDIF(WIN32)
+set(GSL_LIBRARIES "")
IF(GSL_LIBRARIES)
IF(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)
diff --git a/debug/msvc/eigen_autoexp_part.dat b/debug/msvc/eigen_autoexp_part.dat
index cda25229f..ba7eefc8e 100644
--- a/debug/msvc/eigen_autoexp_part.dat
+++ b/debug/msvc/eigen_autoexp_part.dat
@@ -38,16 +38,13 @@ Eigen::Matrix<*,4,1,*,*,*>|Eigen::Matrix<*,1,4,*,*,*>{
)
preview
- (
- #(
- "(",
-
- #array
- (
- expr : [($c.m_storage.m_data.array)[$i],g],
- size : 4
- ),
- ")"
+ (
+ #(
+ "[",
+ 4,
+ "](",
+ #array(expr: $e.m_storage.m_data.array[$i], size: 4),
+ ")"
)
)
}
@@ -65,22 +62,19 @@ Eigen::Matrix<*,3,1,*,*,*>|Eigen::Matrix<*,1,3,*,*,*>{
)
preview
- (
- #(
- "(",
-
- #array
- (
- expr : [($c.m_storage.m_data.array)[$i],g],
- size : 3
- ),
- ")"
+ (
+ #(
+ "[",
+ 3,
+ "](",
+ #array(expr: $e.m_storage.m_data.array[$i], size: 3),
+ ")"
)
)
}
-; Fixed size floating point 2-vectors
-Eigen::Matrix<float,2,1,*,*,*>|Eigen::Matrix<float,1,2,*,*,*>|Eigen::Matrix<double,2,1,*,*,*>|Eigen::Matrix<double,1,2,*,*,*>{
+; Fixed size 2-vectors
+Eigen::Matrix<*,2,1,*,*,*>|Eigen::Matrix<*,1,2,*,*,*>{
children
(
#(
@@ -91,42 +85,35 @@ Eigen::Matrix<float,2,1,*,*,*>|Eigen::Matrix<float,1,2,*,*,*>|Eigen::Matrix<doub
)
preview
- (
- #(
- "(",
-
- #array
- (
- expr : [($c.m_storage.m_data.array)[$i],g],
- size : 2
- ),
- ")"
+ (
+ #(
+ "[",
+ 2,
+ "](",
+ #array(expr: $e.m_storage.m_data.array[$i], size: 2),
+ ")"
)
)
}
-; Fixed size integral 2-vectors
-Eigen::Matrix<*,2,1,*,*,*>|Eigen::Matrix<*,1,2,*,*,*>{
+; Fixed size 1-vectors
+Eigen::Matrix<*,1,1,*,*,*>|Eigen::Matrix<*,1,1,*,*,*>{
children
(
#(
[internals]: [$c,!],
- x : ($c.m_storage.m_data.array)[0],
- y : ($c.m_storage.m_data.array)[1]
+ x : ($c.m_storage.m_data.array)[0]
)
)
preview
- (
- #(
- "(",
-
- #array
- (
- expr : ($c.m_storage.m_data.array)[$i],
- size : 2
- ),
- ")"
+ (
+ #(
+ "[",
+ 1,
+ "](",
+ #array(expr: $e.m_storage.m_data.array[$i], size: 1),
+ ")"
)
)
}
diff --git a/demos/mandelbrot/mandelbrot.cpp b/demos/mandelbrot/mandelbrot.cpp
index f89526cf6..91c0b404f 100644
--- a/demos/mandelbrot/mandelbrot.cpp
+++ b/demos/mandelbrot/mandelbrot.cpp
@@ -45,7 +45,7 @@ template<> struct iters_before_test<double> { enum { ret = 16 }; };
template<typename Real> void MandelbrotThread::render(int img_width, int img_height)
{
- enum { packetSize = Eigen::ei_packet_traits<Real>::size }; // number of reals in a Packet
+ enum { packetSize = Eigen::internal::packet_traits<Real>::size }; // number of reals in a Packet
typedef Eigen::Array<Real, packetSize, 1> Packet; // wrap a Packet as a vector
enum { iters_before_test = iters_before_test<Real>::ret };
@@ -163,8 +163,8 @@ void MandelbrotWidget::paintEvent(QPaintEvent *)
<< elapsed << " ms, "
<< speed << " iters/s (max " << max_speed << ")" << std::endl;
int packetSize = threads[0]->single_precision
- ? int(Eigen::ei_packet_traits<float>::size)
- : int(Eigen::ei_packet_traits<double>::size);
+ ? int(Eigen::internal::packet_traits<float>::size)
+ : int(Eigen::internal::packet_traits<double>::size);
setWindowTitle(QString("resolution ")+QString::number(xradius*2/width(), 'e', 2)
+QString(", %1 iterations per pixel, ").arg(threads[0]->max_iter)
+(threads[0]->single_precision ? QString("single ") : QString("double "))
diff --git a/demos/opengl/gpuhelper.h b/demos/opengl/gpuhelper.h
index c7b924b0e..d0fe71bc7 100644
--- a/demos/opengl/gpuhelper.h
+++ b/demos/opengl/gpuhelper.h
@@ -67,7 +67,7 @@ class GpuHelper
template<typename Scalar, typename Derived>
void loadMatrix(
- const Eigen::CwiseNullaryOp<Eigen::ei_scalar_identity_op<Scalar>,Derived>&,
+ const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,
GLenum matrixTarget);
/** Make the matrix \a matrixTarget the current OpenGL matrix target.
@@ -86,7 +86,7 @@ class GpuHelper
template<typename Scalar, typename Derived>
void pushMatrix(
- const Eigen::CwiseNullaryOp<Eigen::ei_scalar_identity_op<Scalar>,Derived>&,
+ const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,
GLenum matrixTarget);
/** Push and clone the OpenGL matrix \a matrixTarget
@@ -161,7 +161,7 @@ void GpuHelper::multMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum ma
template<typename Scalar, typename Derived>
void GpuHelper::loadMatrix(
- const Eigen::CwiseNullaryOp<Eigen::ei_scalar_identity_op<Scalar>,Derived>&,
+ const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,
GLenum matrixTarget)
{
setMatrixTarget(matrixTarget);
@@ -190,7 +190,7 @@ inline void GpuHelper::pushMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GL
template<typename Scalar, typename Derived>
void GpuHelper::pushMatrix(
- const Eigen::CwiseNullaryOp<Eigen::ei_scalar_identity_op<Scalar>,Derived>&,
+ const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,
GLenum matrixTarget)
{
pushMatrix(matrixTarget);
diff --git a/demos/opengl/quaternion_demo.cpp b/demos/opengl/quaternion_demo.cpp
index 9d496f922..899075669 100644
--- a/demos/opengl/quaternion_demo.cpp
+++ b/demos/opengl/quaternion_demo.cpp
@@ -249,7 +249,7 @@ void RenderingWidget::drawScene()
gpu.drawVector(Vector3f::Zero(), length*Vector3f::UnitZ(), Color(0,0,1,1));
// draw the fractal object
- float sqrt3 = ei_sqrt(3.);
+ float sqrt3 = internal::sqrt(3.);
glLightfv(GL_LIGHT0, GL_AMBIENT, Vector4f(0.5,0.5,0.5,1).data());
glLightfv(GL_LIGHT0, GL_DIFFUSE, Vector4f(0.5,1,0.5,1).data());
glLightfv(GL_LIGHT0, GL_SPECULAR, Vector4f(1,1,1,1).data());
diff --git a/demos/opengl/trackball.cpp b/demos/opengl/trackball.cpp
index 05e45c1d0..f8da7779a 100644
--- a/demos/opengl/trackball.cpp
+++ b/demos/opengl/trackball.cpp
@@ -38,7 +38,7 @@ void Trackball::track(const Vector2i& point2D)
{
Vector3f axis = mLastPoint3D.cross(newPoint3D).normalized();
float cos_angle = mLastPoint3D.dot(newPoint3D);
- if ( ei_abs(cos_angle) < 1.0 )
+ if ( internal::abs(cos_angle) < 1.0 )
{
float angle = 2. * acos(cos_angle);
if (mMode==Around)
diff --git a/doc/A05_PortingFrom2To3.dox b/doc/A05_PortingFrom2To3.dox
index 783b99576..3cfae061e 100644
--- a/doc/A05_PortingFrom2To3.dox
+++ b/doc/A05_PortingFrom2To3.dox
@@ -2,27 +2,39 @@ namespace Eigen {
/** \page Eigen2ToEigen3 Porting from Eigen2 to Eigen3
-The goals of this page is to enumerate the API changes between Eigen2 and Eigen3,
-and to help porting an application from Eigen2 to Eigen3.
+This page lists the most important API changes between Eigen2 and Eigen3,
+and gives tips to help porting your application from Eigen2 to Eigen3.
\b Table \b of \b contents
- \ref CompatibilitySupport
+ - \ref Using
- \ref VectorBlocks
+ - \ref Corners
- \ref CoefficientWiseOperations
- \ref PartAndExtract
- \ref TriangularSolveInPlace
- - \ref Using
- - \ref Corners
+ - \ref Decompositions
+ - \ref LinearSolvers
+ - \ref Transform
- \ref LazyVsNoalias
+ - \ref AlignMacros
+ - \ref AlignedMap
\section CompatibilitySupport Eigen2 compatibility support
In order to ease the switch from Eigen2 to Eigen3, Eigen3 features a compatibility mode which can be enabled by defining the EIGEN2_SUPPORT preprocessor token \b before including any Eigen header (typically it should be set in your project options).
+\section Using The USING_PART_OF_NAMESPACE_EIGEN macro
+
+The USING_PART_OF_NAMESPACE_EIGEN macro has been removed. In Eigen 3, just do:
+\code
+using namespace Eigen;
+\endcode
+
\section VectorBlocks Vector blocks
-<table>
-<tr><td>Eigen 2</td><td>Eigen 3</td></tr>
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th></th>
<tr><td>\code
vector.start(length)
vector.start<length>()
@@ -39,8 +51,8 @@ vector.tail<length>()
\section Corners Matrix Corners
-<table>
-<tr><td>Eigen 2</td><td>Eigen 3</td></tr>
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th></th>
<tr><td>\code
matrix.corner(TopLeft,r,c)
matrix.corner(TopRight,r,c)
@@ -95,8 +107,8 @@ c = (a.cwise().abs().cwise().pow(3)).cwise() * (b.cwise().abs().cwise().sin());
In Eigen 2 you had to play with the part, extract, and marked functions to deal with triangular and selfadjoint matrices. In Eigen 3, all these functions have been removed in favor of the concept of \em views:
-<table>
-<tr><td>Eigen 2</td><td>Eigen 3</td></tr>
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th></tr>
<tr><td>\code
A.part<UpperTriangular>();
A.part<StrictlyLowerTriangular>(); \endcode</td>
@@ -145,49 +157,90 @@ StrictlyLower
\section TriangularSolveInPlace Triangular in-place solving
-<table>
-<tr><td>Eigen 2</td><td>Eigen 3</td></tr>
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th></tr>
<tr><td>\code A.triangularSolveInPlace<XxxTriangular>(Y);\endcode</td><td>\code A.triangularView<Xxx>().solveInPlace(Y);\endcode</td></tr>
</table>
+
+\section Decompositions Matrix decompositions
+
+Some of Eigen 2's matrix decompositions have been renamed in Eigen 3, while some others have been removed and are replaced by other decompositions in Eigen 3.
+
+<table class="manual">
+ <tr>
+ <th>Eigen 2</th>
+ <th>Eigen 3</th>
+ <th>Notes</th>
+ </tr>
+ <tr>
+ <td>LU</td>
+ <td>FullPivLU</td>
+ <td class="alt">See also the new PartialPivLU, it's much faster</td>
+ </tr>
+ <tr>
+ <td>QR</td>
+ <td>HouseholderQR</td>
+ <td class="alt">See also the new ColPivHouseholderQR, it's more reliable</td>
+ </tr>
+ <tr>
+ <td>SVD</td>
+ <td>JacobiSVD</td>
+ <td class="alt">We currently don't have a bidiagonalizing SVD; of course this is planned.</td>
+ </tr>
+ <tr>
+ <td>EigenSolver and friends</td>
+ <td>\code #include<Eigen/Eigenvalues> \endcode </td>
+ <td class="alt">Moved to separate module</td>
+ </tr>
+</table>
+
\section LinearSolvers Linear solvers
-<table>
-<tr><td>Eigen 2</td><td>Eigen 3</td><td>Notes</td></tr>
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th><th>Notes</th></tr>
<tr><td>\code A.lu();\endcode</td>
<td>\code A.fullPivLu();\endcode</td>
-<td>Now A.lu() returns a PartialPivLU</td></tr>
+<td class="alt">Now A.lu() returns a PartialPivLU</td></tr>
<tr><td>\code A.lu().solve(B,&X);\endcode</td>
<td>\code X = A.lu().solve(B);
X = A.fullPivLu().solve(B);\endcode</td>
-<td>The returned by value is fully optimized</td></tr>
+<td class="alt">The returned by value is fully optimized</td></tr>
<tr><td>\code A.llt().solve(B,&X);\endcode</td>
<td>\code X = A.llt().solve(B);
X = A.selfadjointView<Lower>.llt().solve(B);
X = A.selfadjointView<Upper>.llt().solve(B);\endcode</td>
-<td>The returned by value is fully optimized and \n
+<td class="alt">The returned by value is fully optimized and \n
the selfadjointView API allows you to select the \n
triangular part to work on (default is lower part)</td></tr>
<tr><td>\code A.llt().solveInPlace(B);\endcode</td>
<td>\code B = A.llt().solve(B);
B = A.selfadjointView<Lower>.llt().solve(B);
B = A.selfadjointView<Upper>.llt().solve(B);\endcode</td>
-<td>In place solving</td></tr>
+<td class="alt">In place solving</td></tr>
<tr><td>\code A.ldlt().solve(B,&X);\endcode</td>
<td>\code X = A.ldlt().solve(B);
X = A.selfadjointView<Lower>.ldlt().solve(B);
X = A.selfadjointView<Upper>.ldlt().solve(B);\endcode</td>
-<td>The returned by value is fully optimized and \n
+<td class="alt">The returned by value is fully optimized and \n
the selfadjointView API allows you to select the \n
triangular part to work on</td></tr>
</table>
-\section Using The USING_PART_OF_NAMESPACE_EIGEN macro
+\section Transform The Transform class
-The USING_PART_OF_NAMESPACE_EIGEN macro has been removed. In Eigen 3, just do:
-\code
-using namespace Eigen;
-\endcode
+In Eigen 2, the Transform class didn't really know whether it was a projective or affine transformation. In Eigen 3, it takes a new \a Mode template parameter, which indicates whether it's \a Projective or \a Affine transform. The default is \a Projective.
+
+The Transform3f (etc) typedefs are no more. In Eigen 3, the Transform typedefs explicitly refer to the \a Projective and \a Affine modes:
+
+<table class="manual">
+<tr><th>Eigen 2</th><th>Eigen 3</th><th>Notes</th></tr>
+<tr>
+ <td> Transform3f </td>
+ <td> Affine3f or Projective3f </td>
+ <td> Of course 3f is just an example here </td>
+</tr>
+</table>
\section LazyVsNoalias Lazy evaluation and noalias
@@ -206,6 +259,25 @@ it might be useful to explicit request for a lay product, i.e., for a product wh
just like any other expressions. To this end you can use the MatrixBase::lazyProduct() function, however we strongly discourage you to
use it unless you are sure of what you are doing, i.e., you have rigourosly measured a speed improvement.
+\section AlignMacros Alignment-related macros
+
+The EIGEN_ALIGN_128 macro has been renamed to EIGEN_ALIGN16. Don't be surprised, it's just that we switched to counting in bytes ;-)
+
+The EIGEN_DONT_ALIGN option still exists in Eigen 3, but it has a new cousin: EIGEN_DONT_ALIGN_STATICALLY. It allows to get rid of all static alignment issues while keeping alignment of dynamic-size heap-allocated arrays, thus keeping vectorization for dynamic-size objects.
+
+\section AlignedMap Aligned Map objects
+
+A common issue with Eigen 2 was that when mapping an array with Map, there was no way to tell Eigen that your array was aligned. There was a ForceAligned option but it didn't mean that; it was just confusing and has been removed.
+
+New in Eigen3 is the Aligned option. See the documentation of class Map. Use it like this:
+\code
+Map<Vector4f, Aligned> myMappedVector(some_aligned_array);
+\endcode
+There also are related convenience static methods:
+\code
+result = Vector4f::MapAligned(some_aligned_array);
+\endcode
+
*/
}
diff --git a/doc/C00_QuickStartGuide.dox b/doc/C00_QuickStartGuide.dox
index 3b7c405ca..62b7f6061 100644
--- a/doc/C00_QuickStartGuide.dox
+++ b/doc/C00_QuickStartGuide.dox
@@ -45,12 +45,12 @@ The following three statements sets the other three entries. The final line outp
Here is another example, which combines matrices with vectors. Concentrate on the left-hand program for now; we will talk about the right-hand program later.
-<table class="tutorial_code"><tr><td>
-Size set at run time:
+<table class="manual">
+<tr><th>Size set at run time:</th><th>Size set at compile time:</th></tr>
+<tr><td>
\include QuickStart_example2_dynamic.cpp
</td>
<td>
-Size set at compile time:
\include QuickStart_example2_fixed.cpp
</td></tr></table>
@@ -83,8 +83,9 @@ The use of fixed-size matrices and vectors has two advantages. The compiler emit
\section GettingStartedConclusion Where to go from here?
-You could directly use our \ref QuickRefPage and class documentation, or if you do not yet feel ready for that, you could
-read the longer \ref TutorialMatrixClass "Tutorial" in which the Eigen library is explained in more detail.
+It's worth taking the time to read the \ref TutorialMatrixClass "long tutorial".
+
+However if you think you don't need it, you can directly use the classes documentation and our \ref QuickRefPage.
\li \b Next: \ref TutorialMatrixClass
diff --git a/doc/C01_TutorialMatrixClass.dox b/doc/C01_TutorialMatrixClass.dox
index b5d7ec0c7..4860616e5 100644
--- a/doc/C01_TutorialMatrixClass.dox
+++ b/doc/C01_TutorialMatrixClass.dox
@@ -92,7 +92,7 @@ Matrix<float, 3, Dynamic>
\section TutorialMatrixConstructors Constructors
-A default constructor is always available, and always has zero runtime cost. You can do:
+A default constructor is always available, never performs any dynamic memory allocation, and never initializes the matrix coefficients. You can do:
\code
Matrix3f a;
MatrixXf b;
@@ -133,11 +133,13 @@ The primary coefficient accessors and mutators in Eigen are the overloaded paren
For matrices, the row index is always passed first. For vectors, just pass one index.
The numbering starts at 0. This example is self-explanatory:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_matrix_coefficient_accessors.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_matrix_coefficient_accessors.cpp
</td>
<td>
-Output: \verbinclude tut_matrix_coefficient_accessors.out
+\verbinclude tut_matrix_coefficient_accessors.out
</td></tr></table>
Note that the syntax <tt> m(index) </tt>
@@ -154,52 +156,52 @@ would make matrix[i,j] compile to the same thing as matrix[j] !
%Matrix and vector coefficients can be conveniently set using the so-called \em comma-initializer syntax.
For now, it is enough to know this example:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_commainit_01.cpp
-</td>
-<td>
-Output: \verbinclude Tutorial_commainit_01.out
-</td></tr></table>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr>
+<td>\include Tutorial_commainit_01.cpp </td>
+<td>\verbinclude Tutorial_commainit_01.out </td>
+</tr></table>
The right-hand side can also contain matrix expressions as discussed in \ref TutorialAdvancedInitialization "this page".
\section TutorialMatrixSizesResizing Resizing
-The current size of a matrix can be retrieved by \link EigenBase::rows() rows()\endlink, \link EigenBase::cols() cols() \endlink and \link EigenBase::size() size()\endlink. These methods return the number of rows, the number of columns and the number of coefficients, respectively. Resizing a dynamic-size matrix is done by the \link DenseStorageBase::resize(Index,Index) resize() \endlink method.
+The current size of a matrix can be retrieved by \link EigenBase::rows() rows()\endlink, \link EigenBase::cols() cols() \endlink and \link EigenBase::size() size()\endlink. These methods return the number of rows, the number of columns and the number of coefficients, respectively. Resizing a dynamic-size matrix is done by the \link PlainObjectBase::resize(Index,Index) resize() \endlink method.
-<table class="tutorial_code"><tr><td>
-Example: \include tut_matrix_resize.cpp
-</td>
-<td>
-Output: \verbinclude tut_matrix_resize.out
-</td></tr></table>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr>
+<td>\include tut_matrix_resize.cpp </td>
+<td>\verbinclude tut_matrix_resize.out </td>
+</tr></table>
The resize() method is a no-operation if the actual matrix size doesn't change; otherwise it is destructive: the values of the coefficients may change.
-If you want a conservative variant of resize() which does not change the coefficients, use \link DenseStorageBase::conservativeResize() conservativeResize()\endlink, see \ref TopicResizing "this page" for more details.
+If you want a conservative variant of resize() which does not change the coefficients, use \link PlainObjectBase::conservativeResize() conservativeResize()\endlink, see \ref TopicResizing "this page" for more details.
All these methods are still available on fixed-size matrices, for the sake of API uniformity. Of course, you can't actually
resize a fixed-size matrix. Trying to change a fixed size to an actually different value will trigger an assertion failure;
but the following code is legal:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_matrix_resize_fixed_size.cpp
-</td>
-<td>
-Output: \verbinclude tut_matrix_resize_fixed_size.out
-</td></tr></table>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr>
+<td>\include tut_matrix_resize_fixed_size.cpp </td>
+<td>\verbinclude tut_matrix_resize_fixed_size.out </td>
+</tr></table>
\section TutorialMatrixAssignment Assignment and resizing
Assignment is the action of copying a matrix into another, using \c operator=. Eigen resizes the matrix on the left-hand side automatically so that it matches the size of the matrix on the right-hand size. For example:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_matrix_assignment_resizing.cpp
-</td>
-<td>
-Output: \verbinclude tut_matrix_assignment_resizing.out
-</td></tr></table>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr>
+<td>\include tut_matrix_assignment_resizing.cpp </td>
+<td>\verbinclude tut_matrix_assignment_resizing.out </td>
+</tr></table>
Of course, if the left-hand side is of fixed size, resizing it is not allowed.
diff --git a/doc/C02_TutorialMatrixArithmetic.dox b/doc/C02_TutorialMatrixArithmetic.dox
index d076c8048..ae2964a46 100644
--- a/doc/C02_TutorialMatrixArithmetic.dox
+++ b/doc/C02_TutorialMatrixArithmetic.dox
@@ -39,11 +39,13 @@ also have the same \c Scalar type, as Eigen doesn't do automatic type promotion.
\li compound operator += as in \c a+=b
\li compound operator -= as in \c a-=b
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_add_sub.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_add_sub.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_add_sub.out
+\verbinclude tut_arithmetic_add_sub.out
</td></tr></table>
\section TutorialArithmeticScalarMulDiv Scalar multiplication and division
@@ -55,11 +57,13 @@ Multiplication and division by a scalar is very simple too. The operators at han
\li compound operator *= as in \c matrix*=scalar
\li compound operator /= as in \c matrix/=scalar
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_scalar_mul_div.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_scalar_mul_div.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_scalar_mul_div.out
+\verbinclude tut_arithmetic_scalar_mul_div.out
</td></tr></table>
@@ -89,30 +93,36 @@ more opportunities for optimization.
The transpose \f$ a^T \f$, conjugate \f$ \bar{a} \f$, and adjoint (i.e., conjugate transpose) \f$ a^* \f$ of a matrix or vector \f$ a \f$ are obtained by the member functions \link DenseBase::transpose() transpose()\endlink, \link MatrixBase::conjugate() conjugate()\endlink, and \link MatrixBase::adjoint() adjoint()\endlink, respectively.
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_transpose_conjugate.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_transpose_conjugate.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_transpose_conjugate.out
+\verbinclude tut_arithmetic_transpose_conjugate.out
</td></tr></table>
For real matrices, \c conjugate() is a no-operation, and so \c adjoint() is 100% equivalent to \c transpose().
As for basic arithmetic operators, \c transpose() and \c adjoint() simply return a proxy object without doing the actual transposition. If you do <tt>b = a.transpose()</tt>, then the transpose is evaluated at the same time as the result is written into \c b. However, there is a complication here. If you do <tt>a = a.transpose()</tt>, then Eigen starts writing the result into \c a before the evaluation of the transpose is finished. Therefore, the instruction <tt>a = a.transpose()</tt> does not replace \c a with its transpose, as one would expect:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_transpose_aliasing.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_transpose_aliasing.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_transpose_aliasing.out
+\verbinclude tut_arithmetic_transpose_aliasing.out
</td></tr></table>
This is the so-called \ref TopicAliasing "aliasing issue". In "debug mode", i.e., when \ref TopicAssertions "assertions" have not been disabled, such common pitfalls are automatically detected.
For \em in-place transposition, as for instance in <tt>a = a.transpose()</tt>, simply use the \link DenseBase::transposeInPlace() transposeInPlace()\endlink function:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_transpose_inplace.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_transpose_inplace.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_transpose_inplace.out
+\verbinclude tut_arithmetic_transpose_inplace.out
</td></tr></table>
There is also the \link MatrixBase::adjointInPlace() adjointInPlace()\endlink function for complex matrices.
@@ -125,11 +135,13 @@ two operators:
\li binary operator * as in \c a*b
\li compound operator *= as in \c a*=b (this multiplies on the right: \c a*=b is equivalent to <tt>a = a*b</tt>)
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_matrix_mul.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_matrix_mul.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_matrix_mul.out
+\verbinclude tut_arithmetic_matrix_mul.out
</td></tr></table>
Note: if you read the above paragraph on expression templates and are worried that doing \c m=m*m might cause
@@ -150,11 +162,13 @@ For more details on this topic, see \ref TopicEigenExpressionTemplates "this pag
\section TutorialArithmeticDotAndCross Dot product and cross product
The above-discussed \c operator* cannot be used to compute dot and cross products directly. For that, you need the \link MatrixBase::dot() dot()\endlink and \link MatrixBase::cross() cross()\endlink methods.
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_dot_cross.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_dot_cross.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_dot_cross.out
+\verbinclude tut_arithmetic_dot_cross.out
</td></tr></table>
Remember that cross product is only for vectors of size 3. Dot product is for vectors of any sizes.
@@ -164,22 +178,26 @@ second variable.
\section TutorialArithmeticRedux Basic arithmetic reduction operations
Eigen also provides some reduction operations to reduce a given matrix or vector to a single value such as the sum (computed by \link DenseBase::sum() sum()\endlink), product (\link DenseBase::prod() prod()\endlink), or the maximum (\link DenseBase::maxCoeff() maxCoeff()\endlink) and minimum (\link DenseBase::minCoeff() minCoeff()\endlink) of all its coefficients.
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_redux_basic.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_redux_basic.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_redux_basic.out
+\verbinclude tut_arithmetic_redux_basic.out
</td></tr></table>
The \em trace of a matrix, as returned by the function \link MatrixBase::trace() trace()\endlink, is the sum of the diagonal coefficients and can also be computed as efficiently using <tt>a.diagonal().sum()</tt>, as we will see later on.
There also exist variants of the \c minCoeff and \c maxCoeff functions returning the coordinates of the respective coefficient via the arguments:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_redux_minmax.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_redux_minmax.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_redux_minmax.out
+\verbinclude tut_arithmetic_redux_minmax.out
</td></tr></table>
diff --git a/doc/C03_TutorialArrayClass.dox b/doc/C03_TutorialArrayClass.dox
index 92bcebe9d..8bd13a79a 100644
--- a/doc/C03_TutorialArrayClass.dox
+++ b/doc/C03_TutorialArrayClass.dox
@@ -41,33 +41,27 @@ We adopt that convention that typedefs of the form ArrayNt stand for 1-dimension
the size and the scalar type, as in the Matrix typedefs explained on \ref TutorialMatrixClass "this page". For 2-dimensional arrays, we
use typedefs of the form ArrayNNt. Some examples are shown in the following table:
-<table class="tutorial_code" align="center">
-
+<table class="manual">
<tr>
- <td align="center">\b Type </td>
- <td align="center">\b Typedef </td>
+ <th>Type </th>
+ <th>Typedef </th>
</tr>
-
<tr>
<td> \code Array<float,Dynamic,1> \endcode </td>
<td> \code ArrayXf \endcode </td>
</tr>
-
<tr>
<td> \code Array<float,3,1> \endcode </td>
<td> \code Array3f \endcode </td>
</tr>
-
<tr>
<td> \code Array<double,Dynamic,Dynamic> \endcode </td>
<td> \code ArrayXXd \endcode </td>
</tr>
-
<tr>
<td> \code Array<double,3,3> \endcode </td>
<td> \code Array33d \endcode </td>
</tr>
-
</table>
@@ -76,11 +70,13 @@ use typedefs of the form ArrayNNt. Some examples are shown in the following tabl
The parenthesis operator is overloaded to provide write and read access to the coefficients of an array, just as with matrices.
Furthermore, the \c << operator can be used to initialize arrays (via the comma initializer) or to print them.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ArrayClass_accessors.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ArrayClass_accessors.cpp
</td>
<td>
-Output: \verbinclude Tutorial_ArrayClass_accessors.out
+\verbinclude Tutorial_ArrayClass_accessors.out
</td></tr></table>
For more information about the comma initializer, see \ref TutorialAdvancedInitialization.
@@ -94,11 +90,13 @@ The operation is valid if both arrays have the same size, and the addition or su
Arrays also support expressions of the form <tt>array + scalar</tt> which add a scalar to each coefficient in the array.
This provides a functionality that is not directly available for Matrix objects.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ArrayClass_addition.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ArrayClass_addition.cpp
</td>
<td>
-Output: \verbinclude Tutorial_ArrayClass_addition.out
+\verbinclude Tutorial_ArrayClass_addition.out
</td></tr></table>
@@ -109,11 +107,13 @@ are fundamentally different from matrices, is when you multiply two together. Ma
multiplication as the matrix product and arrays interpret multiplication as the coefficient-wise product. Thus, two
arrays can be multiplied if they have the same size.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ArrayClass_mult.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ArrayClass_mult.cpp
</td>
<td>
-Output: \verbinclude Tutorial_ArrayClass_mult.out
+\verbinclude Tutorial_ArrayClass_mult.out
</td></tr></table>
@@ -126,11 +126,13 @@ coefficients. If you have two arrays of the same size, you can call \link ArrayB
construct the array whose coefficients are the minimum of the corresponding coefficients of the two given
arrays. These operations are illustrated in the following example.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ArrayClass_cwise_other.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ArrayClass_cwise_other.cpp
</td>
<td>
-Output: \verbinclude Tutorial_ArrayClass_cwise_other.out
+\verbinclude Tutorial_ArrayClass_cwise_other.out
</td></tr></table>
More coefficient-wise operations can be found in the \ref QuickRefPage.
@@ -170,11 +172,12 @@ As a matter of fact, this usage case is so common that Eigen provides a \link Ma
.cwiseProduct() \endlink method for matrices to compute the coefficient-wise product. This is also shown in
the example program.
-<table class="tutorial_code"><tr><td>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_ArrayClass_interop_matrix.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ArrayClass_interop_matrix.out
</td></tr></table>
@@ -186,11 +189,12 @@ coefficient in the matrix \c m and then computes the matrix product of the resul
expression <tt>(m.array() * n.array()).matrix() * m</tt> computes the coefficient-wise product of the matrices
\c m and \c n and then the matrix product of the result with \c m.
-<table class="tutorial_code"><tr><td>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_ArrayClass_interop.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ArrayClass_interop.out
</td></tr></table>
diff --git a/doc/C04_TutorialBlockOperations.dox b/doc/C04_TutorialBlockOperations.dox
index b45cbfbc8..eac0eaa59 100644
--- a/doc/C04_TutorialBlockOperations.dox
+++ b/doc/C04_TutorialBlockOperations.dox
@@ -21,13 +21,12 @@ provided that you let your compiler optimize.
\section TutorialBlockOperationsUsing Using block operations
The most general block operation in Eigen is called \link DenseBase::block() .block() \endlink.
-This function returns a block of size <tt>(p,q)</tt> whose origin is at <tt>(i,j)</tt>.
There are two versions, whose syntax is as follows:
-<table class="tutorial_code" align="center">
-<tr><td align="center">\b %Block \b operation</td>
-<td align="center">Default version</td>
-<td align="center">Optimized version when the<br>size is known at compile time</td></tr>
+<table class="manual">
+<tr><th>\b %Block \b operation</td>
+<th>Version constructing a \n dynamic-size block expression</th>
+<th>Version constructing a \n fixed-size block expression</th></tr>
<tr><td>%Block of size <tt>(p,q)</tt>, starting at <tt>(i,j)</tt></td>
<td>\code
matrix.block(i,j,p,q);\endcode </td>
@@ -36,99 +35,92 @@ matrix.block<p,q>(i,j);\endcode </td>
</tr>
</table>
-The default version is a method which takes four arguments. It can always be used. The optimized version
-takes two template arguments (the size of the block) and two normal arguments (the position of the block).
-It can only be used if the size of the block is known at compile time, but it may be faster than the
-non-optimized version, especially if the size of the block is small. Both versions can be used on fixed-size
-and dynamic-size matrices and arrays.
+As always in Eigen, indices start at 0.
-The following program uses the default and optimized versions to print the values of several blocks inside a
+Both versions can be used on fixed-size and dynamic-size matrices and arrays.
+These two expressions are semantically equivalent.
+The only difference is that the fixed-size version will typically give you faster code if the block size is small,
+but requires this size to be known at compile time.
+
+The following program uses the dynamic-size and fixed-size versions to print the values of several blocks inside a
matrix.
-<table class="tutorial_code"><tr><td>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_BlockOperations_print_block.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_BlockOperations_print_block.out
</td></tr></table>
-In the above example the \link DenseBase::block() .block() \endlink function was employed
-to read the values inside matrix \p m . However, blocks can also be used as lvalues, meaning that you can
-assign to a block.
+In the above example the \link DenseBase::block() .block() \endlink function was employed as a \em rvalue, i.e.
+it was only read from. However, blocks can also be used as \em lvalues, meaning that you can assign to a block.
-This is illustrated in the following example, which uses arrays instead of matrices. The coefficients of the
-5-by-5 array \c n are first all set to 0.6, but then the 3-by-3 block in the middle is set to the values in
-\c m . The penultimate line shows that blocks can be combined with matrices and arrays to create more complex
-expressions. Blocks of an array are an array expression, and thus the multiplication here is coefficient-wise
-multiplication.
+This is illustrated in the following example. This example also demonstrates blocks in arrays, which works exactly like the above-demonstrated blocks in matrices.
-<table class="tutorial_code"><tr><td>
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_BlockOperations_block_assignment.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_BlockOperations_block_assignment.out
</td></tr></table>
-The \link DenseBase::block() .block() \endlink method is used for general block operations, but there are
-other methods for special cases. These are described in the rest of this page.
+While the \link DenseBase::block() .block() \endlink method can be used for any block operation, there are
+other methods for special cases, providing more specialized API and/or better performance. On the topic of performance, all what
+matters is that you give Eigen as much information as possible at compile time. For example, if your block is a single whole column in a matrix,
+using the specialized \link DenseBase::col() .col() \endlink function described below lets Eigen know that, which can give it optimization opportunities.
+The rest of this page describes these specialized methods.
\section TutorialBlockOperationsSyntaxColumnRows Columns and rows
-Individual columns and rows are special cases of blocks. Eigen provides methods to easily access them:
-\link DenseBase::col() .col() \endlink and \link DenseBase::row() .row()\endlink. There is no syntax variant
-for an optimized version.
+Individual columns and rows are special cases of blocks. Eigen provides methods to easily address them:
+\link DenseBase::col() .col() \endlink and \link DenseBase::row() .row()\endlink.
-<table class="tutorial_code" align="center">
-<tr><td align="center">\b %Block \b operation</td>
-<td align="center">Default version</td>
-<td align="center">Optimized version when the<br>size is known at compile time</td></tr>
+<table class="manual">
+<tr><th>%Block operation</th>
+<th>Method</th>
<tr><td>i<sup>th</sup> row
\link DenseBase::row() * \endlink</td>
<td>\code
matrix.row(i);\endcode </td>
- <td>\code
-matrix.row(i);\endcode </td>
</tr>
<tr><td>j<sup>th</sup> column
\link DenseBase::col() * \endlink</td>
<td>\code
matrix.col(j);\endcode </td>
- <td>\code
-matrix.col(j);\endcode </td>
</tr>
</table>
-The argument for \p col() and \p row() is the index of the column or row to be accessed, starting at
-0. Therefore, \p col(0) will access the first column and \p col(1) the second one.
+The argument for \p col() and \p row() is the index of the column or row to be accessed. As always in Eigen, indices start at 0.
-<table class="tutorial_code"><tr><td>
-C++ code:
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_BlockOperations_colrow.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_BlockOperations_colrow.out
</td></tr></table>
+That example also demonstrates that block expressions (here columns) can be used in arithmetic like any other expression.
+
\section TutorialBlockOperationsSyntaxCorners Corner-related operations
Eigen also provides special methods for blocks that are flushed against one of the corners or sides of a
matrix or array. For instance, \link DenseBase::topLeftCorner() .topLeftCorner() \endlink can be used to refer
-to a block in the top-left corner of a matrix. Use <tt>matrix.topLeftCorner(p,q)</tt> to access the block
-consisting of the coefficients <tt>matrix(i,j)</tt> with \c i &lt; \c p and \c j &lt; \c q. As an other
-example, blocks consisting of whole rows flushed against the top side of the matrix can be accessed by
-\link DenseBase::topRows() .topRows() \endlink.
+to a block in the top-left corner of a matrix.
The different possibilities are summarized in the following table:
-<table class="tutorial_code" align="center">
-<tr><td align="center">\b %Block \b operation</td>
-<td align="center">Default version</td>
-<td align="center">Optimized version when the<br>size is known at compile time</td></tr>
+<table class="manual">
+<tr><th>%Block \b operation</td>
+<th>Version constructing a \n dynamic-size block expression</th>
+<th>Version constructing a \n fixed-size block expression</th></tr>
<tr><td>Top-left p by q block \link DenseBase::topLeftCorner() * \endlink</td>
<td>\code
matrix.topLeftCorner(p,q);\endcode </td>
@@ -188,24 +180,24 @@ matrix.rightCols<q>();\endcode </td>
Here is a simple example illustrating the use of the operations presented above:
-<table class="tutorial_code"><tr><td>
-C++ code:
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_BlockOperations_corner.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_BlockOperations_corner.out
</td></tr></table>
\section TutorialBlockOperationsSyntaxVectors Block operations for vectors
-Eigen also provides a set of block operations designed specifically for vectors and one-dimensional arrays:
+Eigen also provides a set of block operations designed specifically for the special case of vectors and one-dimensional arrays:
-<table class="tutorial_code" align="center">
-<tr><td align="center">\b %Block \b operation</td>
-<td align="center">Default version</td>
-<td align="center">Optimized version when the<br>size is known at compile time</td></tr>
+<table class="manual">
+<tr><th> %Block operation</th>
+<th>Version constructing a \n dynamic-size block expression</th>
+<th>Version constructing a \n fixed-size block expression</th></tr>
<tr><td>%Block containing the first \p n elements
\link DenseBase::head() * \endlink</td>
<td>\code
@@ -231,12 +223,12 @@ vector.segment<n>(i);\endcode </td>
An example is presented below:
-<table class="tutorial_code"><tr><td>
-C++ code:
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
\include Tutorial_BlockOperations_vector.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_BlockOperations_vector.out
</td></tr></table>
diff --git a/doc/C05_TutorialAdvancedInitialization.dox b/doc/C05_TutorialAdvancedInitialization.dox
index db84f94a7..cb8fb6633 100644
--- a/doc/C05_TutorialAdvancedInitialization.dox
+++ b/doc/C05_TutorialAdvancedInitialization.dox
@@ -23,31 +23,37 @@ vector or array. Simply list the coefficients, starting at the top-left corner a
and from the top to the bottom. The size of the object needs to be specified beforehand. If you list too few
or too many coefficients, Eigen will complain.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_commainit_01.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_commainit_01.cpp
</td>
<td>
-Output: \verbinclude Tutorial_commainit_01.out
+\verbinclude Tutorial_commainit_01.out
</td></tr></table>
The comma initializer can also be used to fill block expressions such as <tt>m.row(i)</tt>. Here is a more
complicated way to get the same result as above:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_commainit_01b.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_commainit_01b.cpp
</td>
<td>
-Output: \verbinclude Tutorial_commainit_01b.out
+\verbinclude Tutorial_commainit_01b.out
</td></tr></table>
Moreover, the elements of the initialization list may themselves be matrices. Thus, we can use them to
initialize matrices with a block structure.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_AdvancedInitialization_Block.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_AdvancedInitialization_Block.cpp
</td>
<td>
-Output: \verbinclude Tutorial_AdvancedInitialization_Block.out
+\verbinclude Tutorial_AdvancedInitialization_Block.out
</td></tr></table>
@@ -60,15 +66,17 @@ to specify the size. Thus, the second variant requires one argument and can be u
dynamic-size objects, while the third variant requires two arguments and can be used for two-dimensional
objects. All three variants are illustrated in the following example:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_AdvancedInitialization_Zero.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_AdvancedInitialization_Zero.cpp
</td>
<td>
-Output: \verbinclude Tutorial_AdvancedInitialization_Zero.out
+\verbinclude Tutorial_AdvancedInitialization_Zero.out
</td></tr></table>
-Similarly, the static method \link DenseBase::Constant() Constant\endlink(value) sets all coefficients to \c
-value. If the size of the object needs to be specified, the additional arguments go before the \c value
+Similarly, the static method \link DenseBase::Constant() Constant\endlink(value) sets all coefficients to \c value.
+If the size of the object needs to be specified, the additional arguments go before the \c value
argument, as in <tt>MatrixXd::Constant(rows, cols, value)</tt>. The method \link DenseBase::Random() Random()
\endlink fills the matrix or array with random coefficients. The identity matrix can be obtained by calling
\link MatrixBase::Identity() Identity()\endlink; this method is only available for Matrix, not for Array,
@@ -78,11 +86,13 @@ one-dimensional arrays; it yields a vector of the specified size whose coefficie
\c low and \c high. The method \c LinSpaced() is illustrated in the following example, which prints a table
with angles in degrees, the corresponding angle in radians, and their sine and cosine.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_AdvancedInitialization_LinSpaced.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_AdvancedInitialization_LinSpaced.cpp
</td>
<td>
-Output: \verbinclude Tutorial_AdvancedInitialization_LinSpaced.out
+\verbinclude Tutorial_AdvancedInitialization_LinSpaced.out
</td></tr></table>
This example shows that objects like the ones returned by LinSpaced() can be assigned to variables (and
@@ -92,42 +102,51 @@ conveniently. The following example contrasts three ways to construct the matrix
\f$ J = \bigl[ \begin{smallmatrix} O & I \\ I & O \end{smallmatrix} \bigr] \f$: using static methods and
assignment, using static methods and the comma-initializer, or using the setXxx() methods.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_AdvancedInitialization_ThreeWays.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_AdvancedInitialization_ThreeWays.cpp
</td>
<td>
-Output: \verbinclude Tutorial_AdvancedInitialization_ThreeWays.out
+\verbinclude Tutorial_AdvancedInitialization_ThreeWays.out
</td></tr></table>
A summary of all pre-defined matrix, vector and array objects can be found in the \ref QuickRefPage.
-\section TutorialAdvancedInitializationTemporaryObjects Temporary matrices and arrays
+\section TutorialAdvancedInitializationTemporaryObjects Usage as temporary objects
-As shown above, static methods as Zero() and Constant() can be used to initialize to variables at the time of
+As shown above, static methods as Zero() and Constant() can be used to initialize variables at the time of
declaration or at the right-hand side of an assignment operator. You can think of these methods as returning a
-matrix or array (in fact, they return a so-called \ref TopicEigenExpressionTemplates "expression object" which
-evaluates to a matrix when needed). This matrix can also be used as a temporary object. The second example in
-the \ref GettingStarted guide, which we reproduced here, already illustrates this.
+matrix or array; in fact, they return so-called \ref TopicEigenExpressionTemplates "expression objects" which
+evaluate to a matrix or array when needed, so that this syntax does not incur any overhead.
-<table class="tutorial_code"><tr><td>
-Example: \include QuickStart_example2_dynamic.cpp
+These expressions can also be used as a temporary object. The second example in
+the \ref GettingStarted guide, which we reproduce here, already illustrates this.
+
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include QuickStart_example2_dynamic.cpp
</td>
<td>
-Output: \verbinclude QuickStart_example2_dynamic.out
+\verbinclude QuickStart_example2_dynamic.out
</td></tr></table>
-The expression <tt>m + MatrixXf::Constant(3,3,1.2)</tt> constructs the 3-by-3 matrix with all its coefficients
-equal to 1.2 and adds it to \c m ; in other words, it adds 1.2 to all the coefficients of \c m . The
-comma-initializer can also be used to construct temporary objects. The following example constructs a random
+The expression <tt>m + MatrixXf::Constant(3,3,1.2)</tt> constructs the 3-by-3 matrix expression with all its coefficients
+equal to 1.2 plus the corresponding coefficient of \a m.
+
+The comma-initializer, too, can also be used to construct temporary objects. The following example constructs a random
matrix of size 2-by-3, and then multiplies this matrix on the left with
\f$ \bigl[ \begin{smallmatrix} 0 & 1 \\ 1 & 0 \end{smallmatrix} \bigr] \f$.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_AdvancedInitialization_CommaTemporary.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_AdvancedInitialization_CommaTemporary.cpp
</td>
<td>
-Output: \verbinclude Tutorial_AdvancedInitialization_CommaTemporary.out
+\verbinclude Tutorial_AdvancedInitialization_CommaTemporary.out
</td></tr></table>
The \link CommaInitializer::finished() finished() \endlink method is necessary here to get the actual matrix
diff --git a/doc/C06_TutorialLinearAlgebra.dox b/doc/C06_TutorialLinearAlgebra.dox
index 3e436d393..77f13f4a0 100644
--- a/doc/C06_TutorialLinearAlgebra.dox
+++ b/doc/C06_TutorialLinearAlgebra.dox
@@ -29,10 +29,11 @@ Where \a A and \a b are matrices (\a b could be a vector, as a special case). Yo
\b The \b solution: You can choose between various decompositions, depending on what your matrix \a A looks like,
and depending on whether you favor speed or accuracy. However, let's start with an example that works in all cases,
and is a good compromise:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgExSolveColPivHouseholderQR.cpp </td>
- <td>output: \verbinclude TutorialLinAlgExSolveColPivHouseholderQR.out </td>
+ <td>\verbinclude TutorialLinAlgExSolveColPivHouseholderQR.out </td>
</tr>
</table>
@@ -47,16 +48,14 @@ Here, ColPivHouseholderQR is a QR decomposition with column pivoting. It's a goo
works for all matrices while being quite fast. Here is a table of some other decompositions that you can choose from,
depending on your matrix and the trade-off you want to make:
-<table border="1">
-
+<table class="manual">
<tr>
- <td>Decomposition</td>
- <td>Method</td>
- <td>Requirements on the matrix</td>
- <td>Speed</td>
- <td>Accuracy</td>
+ <th>Decomposition</th>
+ <th>Method</th>
+ <th>Requirements on the matrix</th>
+ <th>Speed</th>
+ <th>Accuracy</th>
</tr>
-
<tr>
<td>PartialPivLU</td>
<td>partialPivLu()</td>
@@ -64,15 +63,13 @@ depending on your matrix and the trade-off you want to make:
<td>++</td>
<td>+</td>
</tr>
-
- <tr>
+ <tr class="alt">
<td>FullPivLU</td>
<td>fullPivLu()</td>
<td>None</td>
<td>-</td>
<td>+++</td>
</tr>
-
<tr>
<td>HouseholderQR</td>
<td>householderQr()</td>
@@ -80,15 +77,13 @@ depending on your matrix and the trade-off you want to make:
<td>++</td>
<td>+</td>
</tr>
-
- <tr>
+ <tr class="alt">
<td>ColPivHouseholderQR</td>
<td>colPivHouseholderQr()</td>
<td>None</td>
<td>+</td>
<td>++</td>
</tr>
-
<tr>
<td>FullPivHouseholderQR</td>
<td>fullPivHouseholderQr()</td>
@@ -96,15 +91,13 @@ depending on your matrix and the trade-off you want to make:
<td>-</td>
<td>+++</td>
</tr>
-
- <tr>
+ <tr class="alt">
<td>LLT</td>
<td>llt()</td>
<td>Positive definite</td>
<td>+++</td>
<td>+</td>
</tr>
-
<tr>
<td>LDLT</td>
<td>ldlt()</td>
@@ -112,7 +105,6 @@ depending on your matrix and the trade-off you want to make:
<td>+++</td>
<td>++</td>
</tr>
-
</table>
All of these decompositions offer a solve() method that works as in the above example.
@@ -121,10 +113,11 @@ For example, if your matrix is positive definite, the above table says that a ve
choice is then the LDLT decomposition. Here's an example, also demonstrating that using a general
matrix (not a vector) as right hand side is possible.
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgExSolveLDLT.cpp </td>
- <td>output: \verbinclude TutorialLinAlgExSolveLDLT.out </td>
+ <td>\verbinclude TutorialLinAlgExSolveLDLT.out </td>
</tr>
</table>
@@ -137,10 +130,11 @@ supports many other decompositions), see our special page on
Only you know what error margin you want to allow for a solution to be considered valid.
So Eigen lets you do this computation for yourself, if you want to, as in this example:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgExComputeSolveError.cpp </td>
- <td>output: \verbinclude TutorialLinAlgExComputeSolveError.out </td>
+ <td>\verbinclude TutorialLinAlgExComputeSolveError.out </td>
</tr>
</table>
@@ -150,10 +144,11 @@ You need an eigendecomposition here, see available such decompositions on \ref T
Make sure to check if your matrix is self-adjoint, as is often the case in these problems. Here's an example using
SelfAdjointEigenSolver, it could easily be adapted to general matrices using EigenSolver or ComplexEigenSolver.
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgSelfAdjointEigenSolver.cpp </td>
- <td>output: \verbinclude TutorialLinAlgSelfAdjointEigenSolver.out </td>
+ <td>\verbinclude TutorialLinAlgSelfAdjointEigenSolver.out </td>
</tr>
</table>
@@ -171,18 +166,29 @@ call inverse() and determinant() directly on a matrix. If your matrix is of a ve
allows Eigen to avoid performing a LU decomposition, and instead use formulas that are more efficient on such small matrices.
Here is an example:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgInverseDeterminant.cpp </td>
- <td>output: \verbinclude TutorialLinAlgInverseDeterminant.out </td>
+ <td>\verbinclude TutorialLinAlgInverseDeterminant.out </td>
</tr>
</table>
\section TutorialLinAlgLeastsquares Least squares solving
-Eigen doesn't currently provide built-in linear least squares solving functions, but you can easily compute that yourself
-from Eigen's decompositions. The most reliable way is to use a SVD (or better yet, JacobiSVD), and in the future
-these classes will offer methods for least squares solving. Another, potentially faster way, is to use a LLT decomposition
+The best way to do least squares solving is with a SVD decomposition. Eigen provides one as the JacobiSVD class, and its solve()
+is doing least-squares solving.
+
+Here is an example:
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr>
+ <td>\include TutorialLinAlgSVDSolve.cpp </td>
+ <td>\verbinclude TutorialLinAlgSVDSolve.out </td>
+</tr>
+</table>
+
+Another way, potentially faster but less reliable, is to use a LDLT decomposition
of the normal matrix. In any case, just read any reference text on least squares, and it will be very easy for you
to implement any linear least squares computation on top of Eigen.
@@ -200,10 +206,11 @@ What makes this possible is that:
For example:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgComputeTwice.cpp </td>
- <td>output: \verbinclude TutorialLinAlgComputeTwice.out </td>
+ <td>\verbinclude TutorialLinAlgComputeTwice.out </td>
</tr>
</table>
@@ -228,10 +235,11 @@ Rank-revealing decompositions offer at least a rank() method. They can also offe
and some are also providing methods to compute the kernel (null-space) and image (column-space) of the matrix, as is the
case with FullPivLU:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgRankRevealing.cpp </td>
- <td>output: \verbinclude TutorialLinAlgRankRevealing.out </td>
+ <td>\verbinclude TutorialLinAlgRankRevealing.out </td>
</tr>
</table>
@@ -243,10 +251,11 @@ on your decomposition object before calling rank() or any other method that need
The decomposition itself, i.e. the compute() method, is independent of the threshold. You don't need to recompute the
decomposition after you've changed the threshold.
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
<tr>
<td>\include TutorialLinAlgSetThreshold.cpp </td>
- <td>output: \verbinclude TutorialLinAlgSetThreshold.out </td>
+ <td>\verbinclude TutorialLinAlgSetThreshold.out </td>
</tr>
</table>
diff --git a/doc/C07_TutorialReductionsVisitorsBroadcasting.dox b/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
index 80b95a63b..44e963424 100644
--- a/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
+++ b/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
@@ -13,7 +13,7 @@ This tutorial explains Eigen's reductions, visitors and broadcasting and how the
- \ref TutorialReductionsVisitorsBroadcastingReductions
- \ref TutorialReductionsVisitorsBroadcastingReductionsNorm
- \ref TutorialReductionsVisitorsBroadcastingReductionsBool
- - FIXME: .redux()
+ - \ref TutorialReductionsVisitorsBroadcastingReductionsUserdefined
- \ref TutorialReductionsVisitorsBroadcastingVisitors
- \ref TutorialReductionsVisitorsBroadcastingPartialReductions
- \ref TutorialReductionsVisitorsBroadcastingPartialReductionsCombined
@@ -22,49 +22,66 @@ This tutorial explains Eigen's reductions, visitors and broadcasting and how the
\section TutorialReductionsVisitorsBroadcastingReductions Reductions
-In Eigen, a reduction is a function that is applied to a certain matrix or array, returning a single
-value of type scalar. One of the most used reductions is \link DenseBase::sum() .sum() \endlink,
-which returns the addition of all the coefficients inside a given matrix or array.
-
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_redux_basic.cpp
+In Eigen, a reduction is a function taking a matrix or array, and returning a single
+scalar value. One of the most used reductions is \link DenseBase::sum() .sum() \endlink,
+returning the sum of all the coefficients inside a given matrix or array.
+
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_redux_basic.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_redux_basic.out
+\verbinclude tut_arithmetic_redux_basic.out
</td></tr></table>
-The \em trace of a matrix, as returned by the function \c trace(), is the sum of the diagonal coefficients and can also be computed as efficiently using <tt>a.diagonal().sum()</tt>, as we will see later on.
+The \em trace of a matrix, as returned by the function \c trace(), is the sum of the diagonal coefficients and can equivalently be computed <tt>a.diagonal().sum()</tt>.
+
+
+\subsection TutorialReductionsVisitorsBroadcastingReductionsNorm Norm computations
+
+The (Euclidean a.k.a. \f$\ell^2\f$) squared norm of a vector can be obtained \link MatrixBase::squaredNorm() squaredNorm() \endlink. It is equal to the dot product of the vector by itself, and equivalently to the sum of squared absolute values of its coefficients.
+Eigen also provides the \link MatrixBase::norm() norm() \endlink method, which returns the square root of \link MatrixBase::squaredNorm() squaredNorm() \endlink.
-\subsection TutorialReductionsVisitorsBroadcastingReductionsNorm Norm reductions
-Eigen also provides reductions to obtain the Euclidean norm or squared norm of a vector with \link MatrixBase::norm() norm() \endlink and \link MatrixBase::squaredNorm() squaredNorm() \endlink respectively.
-These operations can also operate on matrices; in that case, they use the Frobenius norm. The following example shows these methods.
+These operations can also operate on matrices; in that case, a n-by-p matrix is seen as a vector of size (n*p), so for example the \link MatrixBase::norm() norm() \endlink method returns the "Frobenius" or "Hilbert-Schmidt" norm. We refrain from speaking of the \f$\ell^2\f$ norm of a matrix because that can mean different things.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
+If you want other \f$\ell^p\f$ norms, use the \link MatrixBase::lpNorm() lpNnorm<p>() \endlink method. The template parameter \a p can take the special value \a Infinity if you want the \f$\ell^\infty\f$ norm, which is the maximum of the absolute values of the coefficients.
+
+The following example demonstrates these methods.
+
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.out
</td></tr></table>
-\subsection TutorialReductionsVisitorsBroadcastingReductionsBool Boolean-like reductions
+\subsection TutorialReductionsVisitorsBroadcastingReductionsBool Boolean reductions
-Another interesting type of reductions are the ones that deal with \b true and \b false values:
- - \link DenseBase::all() all() \endlink returns \b true if all of the coefficients in a given Matrix or Array are \b true .
- - \link DenseBase::any() any() \endlink returns \b true if at least one of the coefficients in a given Matrix or Array is \b true .
- - \link DenseBase::count() count() \endlink returns the number of \b true coefficients in a given Matrix or Array.
+The following reductions operate on boolean values:
+ - \link DenseBase::all() all() \endlink returns \b true if all of the coefficients in a given Matrix or Array evaluate to \b true .
+ - \link DenseBase::any() any() \endlink returns \b true if at least one of the coefficients in a given Matrix or Array evaluates to \b true .
+ - \link DenseBase::count() count() \endlink returns the number of coefficients in a given Matrix or Array that evaluate to \b true.
These are typically used in conjunction with the coefficient-wise comparison and equality operators provided by Array. For instance, <tt>array > 0</tt> is an %Array of the same size as \c array , with \b true at those positions where the corresponding coefficient of \c array is positive. Thus, <tt>(array > 0).all()</tt> tests whether all coefficients of \c array are positive. This can be seen in the following example:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.out
</td></tr></table>
+\subsection TutorialReductionsVisitorsBroadcastingReductionsUserdefined User defined reductions
+
+TODO
+
+In the meantime you can have a look at the DenseBase::redux() function.
\section TutorialReductionsVisitorsBroadcastingVisitors Visitors
Visitors are useful when one wants to obtain the location of a coefficient inside
@@ -78,11 +95,12 @@ The arguments passed to a visitor are pointers to the variables where the
row and column position are to be stored. These variables should be of type
\link DenseBase::Index Index \endlink (FIXME: link ok?), as shown below:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_visitors.out
</td></tr></table>
@@ -98,21 +116,23 @@ with \link DenseBase::colwise() colwise() \endlink or \link DenseBase::rowwise()
A simple example is obtaining the maximum of the elements
in each column in a given matrix, storing the result in a row-vector:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_colwise.out
</td></tr></table>
The same operation can be performed row-wise:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_rowwise.out
</td></tr></table>
@@ -124,11 +144,12 @@ It is also possible to use the result of a partial reduction to do further proce
Here is another example that aims to find the column whose sum of elements is the maximum
within a matrix. With column-wise partial reductions this can be coded as:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_maxnorm.out
</td></tr></table>
@@ -161,11 +182,12 @@ one direction.
A simple example is to add a certain column-vector to each column in a matrix.
This can be accomplished with:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.out
</td></tr></table>
@@ -176,11 +198,12 @@ The same applies for the Array class, where the equivalent for VectorXf is Array
Therefore, to perform the same operation row-wise we can do:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.out
</td></tr></table>
@@ -192,11 +215,12 @@ Now that broadcasting, reductions and partial reductions have been introduced, w
the nearest neighbour of a vector <tt>v</tt> within the columns of matrix <tt>m</tt>. The Euclidean distance will be used in this example,
computing the squared Euclidean distance with the partial reduction named \link MatrixBase::squaredNorm() squaredNorm() \endlink:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.out
</td></tr></table>
diff --git a/doc/C08_TutorialGeometry.dox b/doc/C08_TutorialGeometry.dox
index 9df19e793..b2890dbc6 100644
--- a/doc/C08_TutorialGeometry.dox
+++ b/doc/C08_TutorialGeometry.dox
@@ -38,18 +38,18 @@ But note that unfortunately, because of how C++ works, you can \b not do this:
\section TutorialGeoElementaryTransformations Transformation types
-<table class="tutorial_code">
-<tr><td>Transformation type</td><td>Typical initialization code</td></tr>
+<table class="manual">
+<tr><th>Transformation type</th><th>Typical initialization code</th></tr>
<tr><td>
\ref Rotation2D "2D rotation" from an angle</td><td>\code
Rotation2D<float> rot2(angle_in_radian);\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
3D rotation as an \ref AngleAxis "angle + axis"</td><td>\code
AngleAxis<float> aa(angle_in_radian, Vector3f(ax,ay,az));\endcode</td></tr>
<tr><td>
3D rotation as a \ref Quaternion "quaternion"</td><td>\code
Quaternion<float> q = AngleAxis<float>(angle_in_radian, axis);\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
N-D Scaling</td><td>\code
Scaling<float,2>(sx, sy)
Scaling<float,3>(sx, sy, sz)
@@ -61,7 +61,7 @@ Translation<float,2>(tx, ty)
Translation<float,3>(tx, ty, tz)
Translation<float,N>(s)
Translation<float,N>(vecN)\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
N-D \ref TutorialGeoTransform "Affine transformation"</td><td>\code
Transform<float,N,Affine> t = concatenation_of_any_transformations;
Transform<float,3,Affine> t = Translation3f(p) * AngleAxisf(a,axis) * Scaling3f(s);\endcode</td></tr>
@@ -86,7 +86,7 @@ kind of transformations.
Any of the above transformation types can be converted to any other types of the same nature,
or to a more generic type. Here are some additional examples:
-<table class="tutorial_code">
+<table class="manual">
<tr><td>\code
Rotation2Df r = Matrix2f(..); // assumes a pure rotation matrix
AngleAxisf aa = Quaternionf(..);
@@ -103,15 +103,15 @@ Affine3f m = Translation3f(..); Affine3f m = Matrix3f(..);
To some extent, Eigen's \ref Geometry_Module "geometry module" allows you to write
generic algorithms working on any kind of transformation representations:
-<table class="tutorial_code">
+<table class="manual">
<tr><td>
Concatenation of two transformations</td><td>\code
gen1 * gen2;\endcode</td></tr>
-<tr><td>Apply the transformation to a vector</td><td>\code
+<tr class="alt"><td>Apply the transformation to a vector</td><td>\code
vec2 = gen1 * vec1;\endcode</td></tr>
<tr><td>Get the inverse of the transformation</td><td>\code
gen2 = gen1.inverse();\endcode</td></tr>
-<tr><td>Spherical interpolation \n (Rotation2D and Quaternion only)</td><td>\code
+<tr class="alt"><td>Spherical interpolation \n (Rotation2D and Quaternion only)</td><td>\code
rot3 = rot1.slerp(alpha,rot2);\endcode</td></tr>
</table>
@@ -123,12 +123,12 @@ is a (Dim+1)^2 matrix. In Eigen we have chosen to not distinghish between points
vectors such that all points are actually represented by displacement vectors from the
origin ( \f$ \mathbf{p} \equiv \mathbf{p}-0 \f$ ). With that in mind, real points and
vector distinguish when the transformation is applied.
-<table class="tutorial_code">
+<table class="manual">
<tr><td>
Apply the transformation to a \b point </td><td>\code
VectorNf p1, p2;
p2 = t * p1;\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
Apply the transformation to a \b vector </td><td>\code
VectorNf vec1, vec2;
vec2 = t.linear() * vec1;\endcode</td></tr>
@@ -138,14 +138,14 @@ Apply a \em general transformation \n to a \b normal \b vector
VectorNf n1, n2;
MatrixNf normalMatrix = t.linear().inverse().transpose();
n2 = (normalMatrix * n1).normalized();\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
Apply a transformation with \em pure \em rotation \n to a \b normal \b vector
(no scaling, no shear)</td><td>\code
n2 = t.linear() * n1;\endcode</td></tr>
<tr><td>
OpenGL compatibility \b 3D </td><td>\code
glLoadMatrixf(t.data());\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
OpenGL compatibility \b 2D </td><td>\code
Affine3f aux(Affine3f::Identity);
aux.linear().topLeftCorner<2,2>() = t.linear();
@@ -153,14 +153,14 @@ aux.translation().start<2>() = t.translation();
glLoadMatrixf(aux.data());\endcode</td></tr>
</table>
-\b Component \b accessors</td></tr>
-<table class="tutorial_code">
+\b Component \b accessors
+<table class="manual">
<tr><td>
full read-write access to the internal matrix</td><td>\code
t.matrix() = matN1xN1; // N1 means N+1
matN1xN1 = t.matrix();
\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
coefficient accessors</td><td>\code
t(i,j) = scalar; <=> t.matrix()(i,j) = scalar;
scalar = t(i,j); <=> scalar = t.matrix()(i,j);
@@ -170,7 +170,7 @@ translation part</td><td>\code
t.translation() = vecN;
vecN = t.translation();
\endcode</td></tr>
-<tr><td>
+<tr class="alt"><td>
linear part</td><td>\code
t.linear() = matNxN;
matNxN = t.linear();
@@ -185,8 +185,8 @@ matNxN = t.extractRotation();
\b Transformation \b creation \n
While transformation objects can be created and updated concatenating elementary transformations,
the Transform class also features a procedural API:
-<table class="tutorial_code">
-<tr><td></td><td>\b procedurale \b API </td><td>\b equivalent \b natural \b API </td></tr>
+<table class="manual">
+<tr><th></th><th>procedurale API</th><th>equivalent natural API </th></tr>
<tr><td>Translation</td><td>\code
t.translate(Vector_(tx,ty,..));
t.pretranslate(Vector_(tx,ty,..));
@@ -194,7 +194,7 @@ t.pretranslate(Vector_(tx,ty,..));
t *= Translation_(tx,ty,..);
t = Translation_(tx,ty,..) * t;
\endcode</td></tr>
-<tr><td>\b Rotation \n <em class="note">In 2D and for the procedural API, any_rotation can also \n be an angle in radian</em></td><td>\code
+<tr class="alt"><td>\b Rotation \n <em class="note">In 2D and for the procedural API, any_rotation can also \n be an angle in radian</em></td><td>\code
t.rotate(any_rotation);
t.prerotate(any_rotation);
\endcode</td><td>\code
@@ -212,14 +212,14 @@ t *= Scaling_(s);
t = Scaling_(sx,sy,..) * t;
t = Scaling_(s) * t;
\endcode</td></tr>
-<tr><td>Shear transformation \n ( \b 2D \b only ! )</td><td>\code
+<tr class="alt"><td>Shear transformation \n ( \b 2D \b only ! )</td><td>\code
t.shear(sx,sy);
t.preshear(sx,sy);
\endcode</td><td></td></tr>
</table>
Note that in both API, any many transformations can be concatenated in a single expression as shown in the two following equivalent examples:
-<table class="tutorial_code">
+<table class="manual">
<tr><td>\code
t.pretranslate(..).rotate(..).translate(..).scale(..);
\endcode</td></tr>
@@ -231,7 +231,7 @@ t = Translation_(..) * t * RotationType(..) * Translation_(..) * Scaling_(..);
<a href="#" class="top">top</a>\section TutorialGeoEulerAngles Euler angles
-<table class="tutorial_code">
+<table class="manual">
<tr><td style="max-width:30em;">
Euler angles might be convenient to create rotation objects.
On the other hand, since there exist 24 differents convension,they are pretty confusing to use. This example shows how
diff --git a/doc/C09_TutorialSparse.dox b/doc/C09_TutorialSparse.dox
index 19fc11375..da32e3c0e 100644
--- a/doc/C09_TutorialSparse.dox
+++ b/doc/C09_TutorialSparse.dox
@@ -40,7 +40,7 @@ Note that here the size of a vector denotes its dimension and not the number of
In order to get the best of the Eigen's sparse objects, it is important to have a rough idea of the way they are internally stored. The SparseMatrix class implements the common and generic Compressed Column/Row Storage scheme. It consists of three compact arrays storing the values with their respective inner coordinates, and pointer indices to the begining of each outer vector. For instance, let \c m be a column-major sparse matrix. Then its nonzero coefficients are sequentially stored in memory in a column-major order (\em values). A second array of integer stores the respective row index of each coefficient (\em inner \em indices). Finally, a third array of integer, having the same length than the number of columns, stores the index in the previous arrays of the first element of each column (\em outer \em indices).
Here is an example, with the matrix:
-<table>
+<table class="manual">
<tr><td>0</td><td>3</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>22</td><td>0</td><td>0</td><td>0</td><td>17</td></tr>
<tr><td>7</td><td>5</td><td>0</td><td>1</td><td>0</td></tr>
@@ -49,11 +49,11 @@ Here is an example, with the matrix:
</table>
and its internal representation using the Compressed Column Storage format:
-<table>
+<table class="manual">
<tr><td>Values:</td> <td>22</td><td>7</td><td>3</td><td>5</td><td>14</td><td>1</td><td>17</td><td>8</td></tr>
<tr><td>Inner indices:</td> <td> 1</td><td>2</td><td>0</td><td>2</td><td> 4</td><td>2</td><td> 1</td><td>4</td></tr>
</table>
-Outer indices:<table><tr><td>0</td><td>2</td><td>4</td><td>5</td><td>6</td><td>\em 7 </td></tr></table>
+Outer indices:<table class="manual"><tr><td>0</td><td>2</td><td>4</td><td>5</td><td>6</td><td>\em 7 </td></tr></table>
As you can guess, here the storage order is even more important than with dense matrix. We will therefore often make a clear difference between the \em inner and \em outer dimensions. For instance, it is easy to loop over the coefficients of an \em inner \em vector (e.g., a column of a column-major matrix), but completely inefficient to do the same for an \em outer \em vector (e.g., a row of a col-major matrix).
@@ -63,7 +63,7 @@ Since all nonzero coefficients of such a matrix are sequentially stored in memor
To summarize, it is recommanded to use a SparseMatrix whenever this is possible, and reserve the use of DynamicSparseMatrix for matrix assembly purpose when a SparseMatrix is not flexible enough. The respective pro/cons of both representations are summarized in the following table:
-<table>
+<table class="manual">
<tr><td></td> <td>SparseMatrix</td><td>DynamicSparseMatrix</td></tr>
<tr><td>memory usage</td><td>***</td><td>**</td></tr>
<tr><td>sorted insertion</td><td>***</td><td>***</td></tr>
@@ -84,7 +84,7 @@ To summarize, it is recommanded to use a SparseMatrix whenever this is possible,
Here mat and vec represents any sparse-matrix and sparse-vector types respectively.
-<table>
+<table class="manual">
<tr><td>Standard \n dimensions</td><td>\code
mat.rows()
mat.cols()\endcode</td>
@@ -106,7 +106,7 @@ vec.nonZeros() \endcode</td></tr>
\b Iterating \b over \b the \b nonzero \b coefficients \n
Iterating over the coefficients of a sparse matrix can be done only in the same order than the storage order. Here is an example:
-<table>
+<table class="manual">
<tr><td>
\code
SparseMatrixType mat(rows,cols);
diff --git a/doc/D11_UnalignedArrayAssert.dox b/doc/D11_UnalignedArrayAssert.dox
index 1a0e5140c..d173ee5f4 100644
--- a/doc/D11_UnalignedArrayAssert.dox
+++ b/doc/D11_UnalignedArrayAssert.dox
@@ -4,8 +4,8 @@ namespace Eigen {
Hello! You are seeing this webpage because your program terminated on an assertion failure like this one:
<pre>
-my_program: path/to/eigen/Eigen/src/Core/MatrixStorage.h:44:
-Eigen::ei_matrix_array<T, Size, MatrixOptions, Align>::ei_matrix_array()
+my_program: path/to/eigen/Eigen/src/Core/DenseStorage.h:44:
+Eigen::internal::matrix_array<T, Size, MatrixOptions, Align>::internal::matrix_array()
[with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]:
Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion
is explained here: http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html
diff --git a/doc/I00_CustomizingEigen.dox b/doc/I00_CustomizingEigen.dox
index d87fb8d6a..1c7a45355 100644
--- a/doc/I00_CustomizingEigen.dox
+++ b/doc/I00_CustomizingEigen.dox
@@ -43,7 +43,7 @@ inline Scalar squaredDistanceTo(const MatrixBase<OtherDerived>& other) const
template<typename OtherDerived>
inline RealScalar distanceTo(const MatrixBase<OtherDerived>& other) const
-{ return ei_sqrt(derived().squaredDistanceTo(other)); }
+{ return internal::sqrt(derived().squaredDistanceTo(other)); }
inline void scaleTo(RealScalar l) { RealScalar vl = norm(); if (vl>1e-9) derived() *= (l/vl); }
@@ -58,13 +58,13 @@ void makeFloor(const MatrixBase<OtherDerived>& other) { derived() = derived().cw
template<typename OtherDerived>
void makeCeil(const MatrixBase<OtherDerived>& other) { derived() = derived().cwiseMax(other.derived()); }
-const CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>
+const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
operator+(const Scalar& scalar) const
-{ return CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>(derived(), ei_scalar_add_op<Scalar>(scalar)); }
+{ return CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>(derived(), internal::scalar_add_op<Scalar>(scalar)); }
-friend const CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>
+friend const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
operator+(const Scalar& scalar, const MatrixBase<Derived>& mat)
-{ return CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived>(mat.derived(), ei_scalar_add_op<Scalar>(scalar)); }
+{ return CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>(mat.derived(), internal::scalar_add_op<Scalar>(scalar)); }
\endcode
Then one can the following declaration in the config.h or whatever prerequisites header file of his project:
@@ -124,7 +124,7 @@ By default, Eigen currently supports the following scalar types: \c int, \c floa
In order to add support for a custom type \c T you need:
1 - make sure the common operator (+,-,*,/,etc.) are supported by the type \c T
2 - add a specialization of struct Eigen::NumTraits<T> (see \ref NumTraits)
- 3 - define a couple of math functions for your type such as: ei_sqrt, ei_abs, etc...
+ 3 - define a couple of math functions for your type such as: internal::sqrt, internal::abs, etc...
(see the file Eigen/src/Core/MathFunctions.h)
Here is a concrete example adding support for the Adolc's \c adouble type. <a href="https://projects.coin-or.org/ADOL-C">Adolc</a> is an automatic differentiation library. The type \c adouble is basically a real value tracking the values of any number of partial derivatives.
@@ -158,21 +158,21 @@ template<> struct NumTraits<adtl::adouble>
}
// the Adolc's type adouble is defined in the adtl namespace
-// therefore, the following ei_* functions *must* be defined
+// therefore, the following internal::* functions *must* be defined
// in the same namespace
namespace adtl {
- inline const adouble& ei_conj(const adouble& x) { return x; }
- inline const adouble& ei_real(const adouble& x) { return x; }
- inline adouble ei_imag(const adouble&) { return 0.; }
- inline adouble ei_abs(const adouble& x) { return fabs(x); }
- inline adouble ei_abs2(const adouble& x) { return x*x; }
- inline adouble ei_sqrt(const adouble& x) { return sqrt(x); }
- inline adouble ei_exp(const adouble& x) { return exp(x); }
- inline adouble ei_log(const adouble& x) { return log(x); }
- inline adouble ei_sin(const adouble& x) { return sin(x); }
- inline adouble ei_cos(const adouble& x) { return cos(x); }
- inline adouble ei_pow(const adouble& x, adouble y) { return pow(x, y); }
+ inline const adouble& internal::conj(const adouble& x) { return x; }
+ inline const adouble& internal::real(const adouble& x) { return x; }
+ inline adouble internal::imag(const adouble&) { return 0.; }
+ inline adouble internal::abs(const adouble& x) { return fabs(x); }
+ inline adouble internal::abs2(const adouble& x) { return x*x; }
+ inline adouble internal::sqrt(const adouble& x) { return sqrt(x); }
+ inline adouble internal::exp(const adouble& x) { return exp(x); }
+ inline adouble internal::log(const adouble& x) { return log(x); }
+ inline adouble internal::sin(const adouble& x) { return sin(x); }
+ inline adouble internal::cos(const adouble& x) { return cos(x); }
+ inline adouble internal::pow(const adouble& x, adouble y) { return pow(x, y); }
}
diff --git a/doc/I02_HiPerformance.dox b/doc/I02_HiPerformance.dox
index 7f0ce1569..ac1c2ca2b 100644
--- a/doc/I02_HiPerformance.dox
+++ b/doc/I02_HiPerformance.dox
@@ -42,12 +42,12 @@ which exactly matches our GEMM routine.
\subsection GEMM_Limitations Limitations
Unfortunately, this simplification mechanism is not perfect yet and not all expressions which could be
handled by a single GEMM-like call are correctly detected.
-<table class="tutorial_code" style="width:100%">
+<table class="manual" style="width:100%">
<tr>
-<td>Not optimal expression</td>
-<td>Evaluated as</td>
-<td>Optimal version (single evaluation)</td>
-<td>Comments</td>
+<th>Not optimal expression</th>
+<th>Evaluated as</th>
+<th>Optimal version (single evaluation)</th>
+<th>Comments</th>
</tr>
<tr>
<td>\code
@@ -60,7 +60,7 @@ m1.noalias() += m2 * m3; \endcode</td>
<td>Use .noalias() to tell Eigen the result and right-hand-sides do not alias.
Otherwise the product m2 * m3 is evaluated into a temporary.</td>
</tr>
-<tr>
+<tr class="alt">
<td></td>
<td></td>
<td>\code
@@ -83,7 +83,7 @@ m1.noalias() += m3.adjoint()
<td>This is because the product expression has the EvalBeforeNesting bit which
enforces the evaluation of the product by the Tranpose expression.</td>
</tr>
-<tr>
+<tr class="alt">
<td>\code
m1 = m1 + m2 * m3; \endcode</td>
<td>\code
@@ -107,7 +107,7 @@ m1.noalias() += m2 * m3; \endcode</td>
so that no temporary is required. (tip: for very small fixed size matrix
it is slighlty better to rewrite it like this: m1.noalias() = m2 * m3; m1 += m4;</td>
</tr>
-<tr>
+<tr class="alt">
<td>\code
m1.noalias() += (s1*m2).block(..) * m3; \endcode</td>
<td>\code
diff --git a/doc/I03_InsideEigenExample.dox b/doc/I03_InsideEigenExample.dox
index e0f8d52a9..0c60984a2 100644
--- a/doc/I03_InsideEigenExample.dox
+++ b/doc/I03_InsideEigenExample.dox
@@ -87,30 +87,30 @@ When we do
\code
Eigen::VectorXf u(size);
\endcode
-the constructor that is called is Matrix::Matrix(int), in src/Core/Matrix.h. Besides some assertions, all it does is to construct the \a m_storage member, which is of type ei_matrix_storage\<float, Dynamic, Dynamic, 1\>.
+the constructor that is called is Matrix::Matrix(int), in src/Core/Matrix.h. Besides some assertions, all it does is to construct the \a m_storage member, which is of type DenseStorage\<float, Dynamic, Dynamic, 1\>.
-You may wonder, isn't it overengineering to have the storage in a separate class? The reason is that the Matrix class template covers all kinds of matrices and vector: both fixed-size and dynamic-size. The storage method is not the same in these two cases. For fixed-size, the matrix coefficients are stored as a plain member array. For dynamic-size, the coefficients will be stored as a pointer to a dynamically-allocated array. Because of this, we need to abstract storage away from the Matrix class. That's ei_matrix_storage.
+You may wonder, isn't it overengineering to have the storage in a separate class? The reason is that the Matrix class template covers all kinds of matrices and vector: both fixed-size and dynamic-size. The storage method is not the same in these two cases. For fixed-size, the matrix coefficients are stored as a plain member array. For dynamic-size, the coefficients will be stored as a pointer to a dynamically-allocated array. Because of this, we need to abstract storage away from the Matrix class. That's DenseStorage.
-Let's look at this constructor, in src/Core/MatrixStorage.h. You can see that there are many partial template specializations of ei_matrix_storages here, treating separately the cases where dimensions are Dynamic or fixed at compile-time. The partial specialization that we are looking at is:
+Let's look at this constructor, in src/Core/DenseStorage.h. You can see that there are many partial template specializations of DenseStorages here, treating separately the cases where dimensions are Dynamic or fixed at compile-time. The partial specialization that we are looking at is:
\code
-template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Cols>
+template<typename T, int _Cols> class DenseStorage<T, Dynamic, Dynamic, _Cols>
\endcode
-Here, the constructor called is ei_matrix_storage::ei_matrix_storage(int size, int rows, int columns)
+Here, the constructor called is DenseStorage::DenseStorage(int size, int rows, int columns)
with size=50, rows=50, columns=1.
Here is this constructor:
\code
-inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_new<T>(size)), m_rows(rows) {}
+inline DenseStorage(int size, int rows, int) : m_data(internal::aligned_new<T>(size)), m_rows(rows) {}
\endcode
-Here, the \a m_data member is the actual array of coefficients of the matrix. As you see, it is dynamically allocated. Rather than calling new[] or malloc(), as you can see, we have our own ei_aligned_new defined in src/Core/util/Memory.h. What it does is that if vectorization is enabled, then it uses a platform-specific call to allocate a 128-bit-aligned array, as that is very useful for vectorization with both SSE2 and AltiVec. If vectorization is disabled, it amounts to the standard new[].
+Here, the \a m_data member is the actual array of coefficients of the matrix. As you see, it is dynamically allocated. Rather than calling new[] or malloc(), as you can see, we have our own internal::aligned_new defined in src/Core/util/Memory.h. What it does is that if vectorization is enabled, then it uses a platform-specific call to allocate a 128-bit-aligned array, as that is very useful for vectorization with both SSE2 and AltiVec. If vectorization is disabled, it amounts to the standard new[].
-As you can see, the constructor also sets the \a m_rows member to \a size. Notice that there is no \a m_columns member: indeed, in this partial specialization of ei_matrix_storage, we know the number of columns at compile-time, since the _Cols template parameter is different from Dynamic. Namely, in our case, _Cols is 1, which is to say that our vector is just a matrix with 1 column. Hence, there is no need to store the number of columns as a runtime variable.
+As you can see, the constructor also sets the \a m_rows member to \a size. Notice that there is no \a m_columns member: indeed, in this partial specialization of DenseStorage, we know the number of columns at compile-time, since the _Cols template parameter is different from Dynamic. Namely, in our case, _Cols is 1, which is to say that our vector is just a matrix with 1 column. Hence, there is no need to store the number of columns as a runtime variable.
-When you call VectorXf::data() to get the pointer to the array of coefficients, it returns ei_matrix_storage::data() which returns the \a m_data member.
+When you call VectorXf::data() to get the pointer to the array of coefficients, it returns DenseStorage::data() which returns the \a m_data member.
-When you call VectorXf::size() to get the size of the vector, this is actually a method in the base class MatrixBase. It determines that the vector is a column-vector, since ColsAtCompileTime==1 (this comes from the template parameters in the typedef VectorXf). It deduces that the size is the number of rows, so it returns VectorXf::rows(), which returns ei_matrix_storage::rows(), which returns the \a m_rows member, which was set to \a size by the constructor.
+When you call VectorXf::size() to get the size of the vector, this is actually a method in the base class MatrixBase. It determines that the vector is a column-vector, since ColsAtCompileTime==1 (this comes from the template parameters in the typedef VectorXf). It deduces that the size is the number of rows, so it returns VectorXf::rows(), which returns DenseStorage::rows(), which returns the \a m_rows member, which was set to \a size by the constructor.
\section ConstructionOfSumXpr Construction of the sum expression
@@ -136,7 +136,7 @@ MatrixBase::operator+(const MatrixBase&)
The return type of this operator is
\code
-CwiseBinaryOp<ei_scalar_sum_op<float>, VectorXf, VectorXf>
+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>
\endcode
The CwiseBinaryOp class is our first encounter with an expression template. As we said, the operator+ doesn't by itself perform any computation, it just returns an abstract "sum of vectors" expression. Since there are also "difference of vectors" and "coefficient-wise product of vectors" expressions, we unify them all as "coefficient-wise binary operations", which we abbreviate as "CwiseBinaryOp". "Coefficient-wise" means that the operations is performed coefficient by coefficient. "binary" means that there are two operands -- we are adding two vectors with one another.
@@ -177,7 +177,7 @@ class MatrixBase
// ...
template<typename OtherDerived>
- const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
+ const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>
operator+(const MatrixBase<OtherDerived> &other) const;
// ...
@@ -186,17 +186,17 @@ class MatrixBase
Here of course, \a Derived and \a OtherDerived are VectorXf.
-As we said, CwiseBinaryOp is also used for other operations such as substration, so it takes another template parameter determining the operation that will be applied to coefficients. This template parameter is a functor, that is, a class in which we have an operator() so it behaves like a function. Here, the functor used is ei_scalar_sum_op. It is defined in src/Core/Functors.h.
+As we said, CwiseBinaryOp is also used for other operations such as substration, so it takes another template parameter determining the operation that will be applied to coefficients. This template parameter is a functor, that is, a class in which we have an operator() so it behaves like a function. Here, the functor used is internal::scalar_sum_op. It is defined in src/Core/Functors.h.
-Let us now explain the ei_traits here. The ei_scalar_sum_op class takes one template parameter: the type of the numbers to handle. Here of course we want to pass the scalar type (a.k.a. numeric type) of VectorXf, which is \c float. How do we determine which is the scalar type of \a Derived ? Throughout Eigen, all matrix and expression types define a typedef \a Scalar which gives its scalar type. For example, VectorXf::Scalar is a typedef for \c float. So here, if life was easy, we could find the numeric type of \a Derived as just
+Let us now explain the internal::traits here. The internal::scalar_sum_op class takes one template parameter: the type of the numbers to handle. Here of course we want to pass the scalar type (a.k.a. numeric type) of VectorXf, which is \c float. How do we determine which is the scalar type of \a Derived ? Throughout Eigen, all matrix and expression types define a typedef \a Scalar which gives its scalar type. For example, VectorXf::Scalar is a typedef for \c float. So here, if life was easy, we could find the numeric type of \a Derived as just
\code
typename Derived::Scalar
\endcode
Unfortunately, we can't do that here, as the compiler would complain that the type Derived hasn't yet been defined. So we use a workaround: in src/Core/util/ForwardDeclarations.h, we declared (not defined!) all our subclasses, like Matrix, and we also declared the following class template:
\code
-template<typename T> struct ei_traits;
+template<typename T> struct internal::traits;
\endcode
-In src/Core/Matrix.h, right \em before the definition of class Matrix, we define a partial specialization of ei_traits for T=Matrix\<any template parameters\>. In this specialization of ei_traits, we define the Scalar typedef. So when we actually define Matrix, it is legal to refer to "typename ei_traits\<Matrix\>::Scalar".
+In src/Core/Matrix.h, right \em before the definition of class Matrix, we define a partial specialization of internal::traits for T=Matrix\<any template parameters\>. In this specialization of internal::traits, we define the Scalar typedef. So when we actually define Matrix, it is legal to refer to "typename internal::traits\<Matrix\>::Scalar".
Anyway, we have declared our operator+. In our case, where \a Derived and \a OtherDerived are VectorXf, the above declaration amounts to:
\code
@@ -204,7 +204,7 @@ class MatrixBase<VectorXf>
{
// ...
- const CwiseBinaryOp<ei_scalar_sum_op<float>, VectorXf, VectorXf>
+ const CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>
operator+(const MatrixBase<VectorXf> &other) const;
// ...
@@ -228,7 +228,7 @@ What operator= is being called here? The vector u is an object of class VectorXf
template<typename OtherDerived>
inline Matrix& operator=(const MatrixBase<OtherDerived>& other)
{
- ei_assert(m_storage.data()!=0 && "you cannot use operator= with a non initialized matrix (instead use set()");
+ eigen_assert(m_storage.data()!=0 && "you cannot use operator= with a non initialized matrix (instead use set()");
return Base::operator=(other.derived());
}
\endcode
@@ -239,11 +239,11 @@ Here, Base is a typedef for MatrixBase\<Matrix\>. So, what is being called is th
\endcode
Here, \a Derived is VectorXf (since u is a VectorXf) and \a OtherDerived is CwiseBinaryOp. More specifically, as explained in the previous section, \a OtherDerived is:
\code
-CwiseBinaryOp<ei_scalar_sum_op<float>, VectorXf, VectorXf>
+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>
\endcode
So the full prototype of the operator= being called is:
\code
-VectorXf& MatrixBase<VectorXf>::operator=(const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<float>, VectorXf, VectorXf> > & other);
+VectorXf& MatrixBase<VectorXf>::operator=(const MatrixBase<CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> > & other);
\endcode
This operator= literally reads "copying a sum of two VectorXf's into another VectorXf".
@@ -256,11 +256,11 @@ template<typename OtherDerived>
inline Derived& MatrixBase<Derived>
::operator=(const MatrixBase<OtherDerived>& other)
{
- return ei_assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
+ return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
}
\endcode
-OK so our next task is to understand ei_assign_selector :)
+OK so our next task is to understand internal::assign_selector :)
Here is its declaration (all that is still in the same file src/Core/Assign.h)
\code
@@ -271,24 +271,24 @@ template<typename Derived, typename OtherDerived,
&& int(Derived::RowsAtCompileTime) == int(OtherDerived::ColsAtCompileTime)
&& int(Derived::ColsAtCompileTime) == int(OtherDerived::RowsAtCompileTime)
&& int(Derived::SizeAtCompileTime) != 1>
-struct ei_assign_selector;
+struct internal::assign_selector;
\endcode
-So ei_assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.
+So internal::assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.
-EvalBeforeAssigning is here to enforce the EvalBeforeAssigningBit. As explained <a href="TopicLazyEvaluation.html">here</a>, certain expressions have this flag which makes them automatically evaluate into temporaries before assigning them to another expression. This is the case of the Product expression, in order to avoid strange aliasing effects when doing "m = m * m;" However, of course here our CwiseBinaryOp expression doesn't have the EvalBeforeAssigningBit: we said since the beginning that we didn't want a temporary to be introduced here. So if you go to src/Core/CwiseBinaryOp.h, you'll see that the Flags in ei_traits\<CwiseBinaryOp\> don't include the EvalBeforeAssigningBit. The Flags member of CwiseBinaryOp is then imported from the ei_traits by the EIGEN_GENERIC_PUBLIC_INTERFACE macro. Anyway, here the template parameter EvalBeforeAssigning has the value \c false.
+EvalBeforeAssigning is here to enforce the EvalBeforeAssigningBit. As explained <a href="TopicLazyEvaluation.html">here</a>, certain expressions have this flag which makes them automatically evaluate into temporaries before assigning them to another expression. This is the case of the Product expression, in order to avoid strange aliasing effects when doing "m = m * m;" However, of course here our CwiseBinaryOp expression doesn't have the EvalBeforeAssigningBit: we said since the beginning that we didn't want a temporary to be introduced here. So if you go to src/Core/CwiseBinaryOp.h, you'll see that the Flags in internal::traits\<CwiseBinaryOp\> don't include the EvalBeforeAssigningBit. The Flags member of CwiseBinaryOp is then imported from the internal::traits by the EIGEN_GENERIC_PUBLIC_INTERFACE macro. Anyway, here the template parameter EvalBeforeAssigning has the value \c false.
NeedToTranspose is here for the case where the user wants to copy a row-vector into a column-vector. We allow this as a special exception to the general rule that in assignments we require the dimesions to match. Anyway, here both the left-hand and right-hand sides are column vectors, in the sense that ColsAtCompileTime is equal to 1. So NeedToTranspose is \c false too.
So, here we are in the partial specialization:
\code
-ei_assign_selector<Derived, OtherDerived, false, false>
+internal::assign_selector<Derived, OtherDerived, false, false>
\endcode
Here's how it is defined:
\code
template<typename Derived, typename OtherDerived>
-struct ei_assign_selector<Derived,OtherDerived,false,false> {
+struct internal::assign_selector<Derived,OtherDerived,false,false> {
static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
};
\endcode
@@ -302,48 +302,48 @@ inline Derived& MatrixBase<Derived>
::lazyAssign(const MatrixBase<OtherDerived>& other)
{
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
- ei_assert(rows() == other.rows() && cols() == other.cols());
- ei_assign_impl<Derived, OtherDerived>::run(derived(),other.derived());
+ eigen_assert(rows() == other.rows() && cols() == other.cols());
+ internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived());
return derived();
}
\endcode
What do we see here? Some assertions, and then the only interesting line is:
\code
- ei_assign_impl<Derived, OtherDerived>::run(derived(),other.derived());
+ internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived());
\endcode
-OK so now we want to know what is inside ei_assign_impl.
+OK so now we want to know what is inside internal::assign_impl.
Here is its declaration:
\code
template<typename Derived1, typename Derived2,
- int Vectorization = ei_assign_traits<Derived1, Derived2>::Vectorization,
- int Unrolling = ei_assign_traits<Derived1, Derived2>::Unrolling>
-struct ei_assign_impl;
+ int Vectorization = internal::assign_traits<Derived1, Derived2>::Vectorization,
+ int Unrolling = internal::assign_traits<Derived1, Derived2>::Unrolling>
+struct internal::assign_impl;
\endcode
-Again, ei_assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.
+Again, internal::assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.
-These two parameters \a Vectorization and \a Unrolling are determined by a helper class ei_assign_traits. Its job is to determine which vectorization strategy to use (that is \a Vectorization) and which unrolling strategy to use (that is \a Unrolling).
+These two parameters \a Vectorization and \a Unrolling are determined by a helper class internal::assign_traits. Its job is to determine which vectorization strategy to use (that is \a Vectorization) and which unrolling strategy to use (that is \a Unrolling).
-We'll not enter into the details of how these strategies are chosen (this is in the implementation of ei_assign_traits at the top of the same file). Let's just say that here \a Vectorization has the value \a LinearVectorization, and \a Unrolling has the value \a NoUnrolling (the latter is obvious since our vectors have dynamic size so there's no way to unroll the loop at compile-time).
+We'll not enter into the details of how these strategies are chosen (this is in the implementation of internal::assign_traits at the top of the same file). Let's just say that here \a Vectorization has the value \a LinearVectorization, and \a Unrolling has the value \a NoUnrolling (the latter is obvious since our vectors have dynamic size so there's no way to unroll the loop at compile-time).
-So the partial specialization of ei_assign_impl that we're looking at is:
+So the partial specialization of internal::assign_impl that we're looking at is:
\code
-ei_assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>
+internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>
\endcode
Here is how it's defined:
\code
template<typename Derived1, typename Derived2>
-struct ei_assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>
+struct internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>
{
static void run(Derived1 &dst, const Derived2 &src)
{
const int size = dst.size();
- const int packetSize = ei_packet_traits<typename Derived1::Scalar>::size;
- const int alignedStart = ei_assign_traits<Derived1,Derived2>::DstIsAligned ? 0
- : ei_first_aligned(&dst.coeffRef(0), size);
+ const int packetSize = internal::packet_traits<typename Derived1::Scalar>::size;
+ const int alignedStart = internal::assign_traits<Derived1,Derived2>::DstIsAligned ? 0
+ : internal::first_aligned(&dst.coeffRef(0), size);
const int alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
for(int index = 0; index < alignedStart; index++)
@@ -351,7 +351,7 @@ struct ei_assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>
for(int index = alignedStart; index < alignedEnd; index += packetSize)
{
- dst.template copyPacket<Derived2, Aligned, ei_assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
+ dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
}
for(int index = alignedEnd; index < size; index++)
@@ -374,7 +374,7 @@ First, the vectorized part: the 48 first coefficients out of 50 will be copied b
\code
for(int index = alignedStart; index < alignedEnd; index += packetSize)
{
- dst.template copyPacket<Derived2, Aligned, ei_assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
+ dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
}
\endcode
@@ -384,7 +384,7 @@ template<typename Derived>
template<typename OtherDerived, int StoreMode, int LoadMode>
inline void MatrixBase<Derived>::copyPacket(int index, const MatrixBase<OtherDerived>& other)
{
- ei_internal_assert(index >= 0 && index < size());
+ eigen_internal_assert(index >= 0 && index < size());
derived().template writePacket<StoreMode>(index,
other.derived().template packet<LoadMode>(index));
}
@@ -397,30 +397,30 @@ First, writePacket() here is a method on the left-hand side VectorXf. So we go t
template<int StoreMode>
inline void writePacket(int index, const PacketScalar& x)
{
- ei_pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x);
+ internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x);
}
\endcode
-Here, \a StoreMode is \a Aligned, indicating that we are doing a 128-bit-aligned write access, \a PacketScalar is a type representing a "SSE packet of 4 floats" and ei_pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in src/Core/arch/SSE/PacketMath.h:
+Here, \a StoreMode is \a Aligned, indicating that we are doing a 128-bit-aligned write access, \a PacketScalar is a type representing a "SSE packet of 4 floats" and internal::pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in src/Core/arch/SSE/PacketMath.h:
The line in src/Core/arch/SSE/PacketMath.h that determines the PacketScalar type (via a typedef in Matrix.h) is:
\code
-template<> struct ei_packet_traits<float> { typedef __m128 type; enum {size=4}; };
+template<> struct internal::packet_traits<float> { typedef __m128 type; enum {size=4}; };
\endcode
Here, __m128 is a SSE-specific type. Notice that the enum \a size here is what was used to define \a packetSize above.
-And here is the implementation of ei_pstoret:
+And here is the implementation of internal::pstoret:
\code
-template<> inline void ei_pstore(float* to, const __m128& from) { _mm_store_ps(to, from); }
+template<> inline void internal::pstore(float* to, const __m128& from) { _mm_store_ps(to, from); }
\endcode
-Here, __mm_store_ps is a SSE-specific intrinsic function, representing a single SSE instruction. The difference between ei_pstore and ei_pstoret is that ei_pstoret is a dispatcher handling both the aligned and unaligned cases, you find its definition in src/Core/GenericPacketMath.h:
+Here, __mm_store_ps is a SSE-specific intrinsic function, representing a single SSE instruction. The difference between internal::pstore and internal::pstoret is that internal::pstoret is a dispatcher handling both the aligned and unaligned cases, you find its definition in src/Core/GenericPacketMath.h:
\code
template<typename Scalar, typename Packet, int LoadMode>
-inline void ei_pstoret(Scalar* to, const Packet& from)
+inline void internal::pstoret(Scalar* to, const Packet& from)
{
if(LoadMode == Aligned)
- ei_pstore(to, from);
+ internal::pstore(to, from);
else
- ei_pstoreu(to, from);
+ internal::pstoreu(to, from);
}
\endcode
@@ -450,30 +450,30 @@ class Matrix
template<int LoadMode>
inline PacketScalar packet(int index) const
{
- return ei_ploadt<Scalar, LoadMode>(m_storage.data() + index);
+ return internal::ploadt<Scalar, LoadMode>(m_storage.data() + index);
}
};
\endcode
-We let you look up the definition of ei_ploadt in GenericPacketMath.h and the ei_pload in src/Core/arch/SSE/PacketMath.h. It is very similar to the above for ei_pstore.
+We let you look up the definition of internal::ploadt in GenericPacketMath.h and the internal::pload in src/Core/arch/SSE/PacketMath.h. It is very similar to the above for internal::pstore.
Let's go back to CwiseBinaryOp::packet(). Once the packets from the vectors \a v and \a w have been returned, what does this function do? It calls m_functor.packetOp() on them. What is m_functor? Here we must remember what particular template specialization of CwiseBinaryOp we're dealing with:
\code
-CwiseBinaryOp<ei_scalar_sum_op<float>, VectorXf, VectorXf>
+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>
\endcode
-So m_functor is an object of the empty class ei_scalar_sum_op<float>. As we mentioned above, don't worry about why we constructed an object of this empty class at all -- it's an implementation detail, the point is that some other functors need to store member data.
+So m_functor is an object of the empty class internal::scalar_sum_op<float>. As we mentioned above, don't worry about why we constructed an object of this empty class at all -- it's an implementation detail, the point is that some other functors need to store member data.
-Anyway, ei_scalar_sum_op is defined in src/Core/Functors.h:
+Anyway, internal::scalar_sum_op is defined in src/Core/Functors.h:
\code
-template<typename Scalar> struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT {
+template<typename Scalar> struct internal::scalar_sum_op EIGEN_EMPTY_STRUCT {
inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; }
template<typename PacketScalar>
inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
- { return ei_padd(a,b); }
+ { return internal::padd(a,b); }
};
\endcode
-As you can see, all what packetOp() does is to call ei_padd on the two packets. Here is the definition of ei_padd from src/Core/arch/SSE/PacketMath.h:
+As you can see, all what packetOp() does is to call internal::padd on the two packets. Here is the definition of internal::padd from src/Core/arch/SSE/PacketMath.h:
\code
-template<> inline __m128 ei_padd(const __m128& a, const __m128& b) { return _mm_add_ps(a,b); }
+template<> inline __m128 internal::padd(const __m128& a, const __m128& b) { return _mm_add_ps(a,b); }
\endcode
Here, _mm_add_ps is a SSE-specific intrinsic function, representing a single SSE instruction.
@@ -481,7 +481,7 @@ To summarize, the loop
\code
for(int index = alignedStart; index < alignedEnd; index += packetSize)
{
- dst.template copyPacket<Derived2, Aligned, ei_assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
+ dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);
}
\endcode
has been compiled to the following code: for \a index going from 0 to the 11 ( = 48/4 - 1), read the i-th packet (of 4 floats) from the vector v and the i-th packet from the vector w using two __mm_load_ps SSE instructions, then add them together using a __mm_add_ps instruction, then store the result using a __mm_store_ps instruction.
diff --git a/doc/I11_Aliasing.dox b/doc/I11_Aliasing.dox
index 9c6c2ebba..04a24bded 100644
--- a/doc/I11_Aliasing.dox
+++ b/doc/I11_Aliasing.dox
@@ -20,11 +20,13 @@ to do about it.
Here is a simple example exhibiting aliasing:
-<table class="tutorial_code"><tr><td>
-Example: \include TopicAliasing_block.cpp
+<table class="example">
+<tr><th>Example</th><th>Output</th></tr>
+<tr><td>
+\include TopicAliasing_block.cpp
</td>
<td>
-Output: \verbinclude TopicAliasing_block.out
+\verbinclude TopicAliasing_block.out
</td></tr></table>
The output is not what one would expect. The problem is the assignment
@@ -51,11 +53,13 @@ problem. This means that in general aliasing cannot be detected at compile time.
some instances of aliasing, albeit at run time. The following example exhibiting aliasing was mentioned in
\ref TutorialMatrixArithmetic :
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_transpose_aliasing.cpp
+<table class="example">
+<tr><th>Example</th><th>Output</th></tr>
+<tr><td>
+\include tut_arithmetic_transpose_aliasing.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_transpose_aliasing.out
+\verbinclude tut_arithmetic_transpose_aliasing.out
</td></tr></table>
Again, the output shows the aliasing issue. However, by default Eigen uses a run-time assertion to detect this
@@ -64,7 +68,7 @@ and exits with a message like
\verbatim
void Eigen::DenseBase<Derived>::checkTransposeAliasing(const OtherDerived&) const
[with OtherDerived = Eigen::Transpose<Eigen::Matrix<int, 2, 2, 0, 2, 2> >, Derived = Eigen::Matrix<int, 2, 2, 0, 2, 2>]:
-Assertion `(!ei_check_transpose_aliasing_selector<Scalar,ei_blas_traits<Derived>::IsTransposed,OtherDerived>::run(ei_extract_data(derived()), other))
+Assertion `(!internal::check_transpose_aliasing_selector<Scalar,internal::blas_traits<Derived>::IsTransposed,OtherDerived>::run(internal::extract_data(derived()), other))
&& "aliasing detected during tranposition, use transposeInPlace() or evaluate the rhs into a temporary using .eval()"' failed.
\endverbatim
@@ -81,11 +85,13 @@ side. The function \link DenseBase::eval() eval() \endlink does precisely that.
For example, here is the corrected version of the first example above:
-<table class="tutorial_code"><tr><td>
-Example: \include TopicAliasing_block_correct.cpp
+<table class="example">
+<tr><th>Example</th><th>Output</th></tr>
+<tr><td>
+\include TopicAliasing_block_correct.cpp
</td>
<td>
-Output: \verbinclude TopicAliasing_block_correct.out
+\verbinclude TopicAliasing_block_correct.out
</td></tr></table>
Now, \c mat(2,2) equals 5 after the assignment, as it should be.
@@ -96,25 +102,27 @@ better solution. Eigen provides the special-purpose function
\link DenseBase::transposeInPlace() transposeInPlace() \endlink which replaces a matrix by its transpose.
This is shown below:
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_transpose_inplace.cpp
+<table class="example">
+<tr><th>Example</th><th>Output</th></tr>
+<tr><td>
+\include tut_arithmetic_transpose_inplace.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_transpose_inplace.out
+\verbinclude tut_arithmetic_transpose_inplace.out
</td></tr></table>
-If an xxxInPlace() function is available, then it is best to use it, because it indicate more clearly what you
+If an xxxInPlace() function is available, then it is best to use it, because it indicates more clearly what you
are doing. This may also allow Eigen to optimize more aggressively. These are some of the xxxInPlace()
functions provided:
-<table class="tutorial_code" align="center">
-<tr> <td> <b>Original function</b> </td> <td> <b>In-place function</b> </td> </tr>
+<table class="manual">
+<tr><th>Original function</th><th>In-place function</th></tr>
<tr> <td> MatrixBase::adjoint() </td> <td> MatrixBase::adjointInPlace() </td> </tr>
-<tr> <td> DenseBase::reverse() </td> <td> DenseBase::reverseInPlace() </td> </tr>
+<tr class="alt"> <td> DenseBase::reverse() </td> <td> DenseBase::reverseInPlace() </td> </tr>
<tr> <td> LDLT::solve() </td> <td> LDLT::solveInPlace() </td> </tr>
-<tr> <td> LLT::solve() </td> <td> LLT::solveInPlace() </td> </tr>
+<tr class="alt"> <td> LLT::solve() </td> <td> LLT::solveInPlace() </td> </tr>
<tr> <td> TriangularView::solve() </td> <td> TriangularView::solveInPlace() </td> </tr>
-<tr> <td> DenseBase::transpose() </td> <td> DenseBase::transposeInPlace() </td> </tr>
+<tr class="alt"> <td> DenseBase::transpose() </td> <td> DenseBase::transposeInPlace() </td> </tr>
</table>
diff --git a/doc/I12_ClassHierarchy.dox b/doc/I12_ClassHierarchy.dox
index 2351957f1..700d01802 100644
--- a/doc/I12_ClassHierarchy.dox
+++ b/doc/I12_ClassHierarchy.dox
@@ -52,13 +52,13 @@ objects.
These classes serve as base classes for the five core classes mentioned above. They are more internal and so
less interesting for users of the Eigen library.
- - DenseStorageBase means dense (matrix or array) plain object, i.e. something that stores its own dense
- array of coefficients. This is where, for instance, the \link DenseStorageBase::resize() resize() \endlink
- methods go. \c %DenseStorageBase is inherited by \c %Matrix and by \c %Array. But above, we said that
+ - PlainObjectBase means dense (matrix or array) plain object, i.e. something that stores its own dense
+ array of coefficients. This is where, for instance, the \link PlainObjectBase::resize() resize() \endlink
+ methods go. \c %PlainObjectBase is inherited by \c %Matrix and by \c %Array. But above, we said that
\c %Matrix inherits \c %MatrixBase and \c %Array inherits \c %ArrayBase. So does that mean multiple
- inheritance? No, because \c %DenseStorageBase \e itself inherits \c %MatrixBase or \c %ArrayBase depending
+ inheritance? No, because \c %PlainObjectBase \e itself inherits \c %MatrixBase or \c %ArrayBase depending
on whether we are in the matrix or array case. When we said above that \c %Matrix inherited
- \c %MatrixBase, we omitted to say it does so indirectly via \c %DenseStorageBase. Same for \c %Array.
+ \c %MatrixBase, we omitted to say it does so indirectly via \c %PlainObjectBase. Same for \c %Array.
- DenseCoeffsBase means something that has dense coefficient accessors. It is a base class for
\c %DenseBase. The reason for \c %DenseCoeffsBase to exist is that the set of available coefficient
accessors is very different depending on whether a dense expression has direct memory access or not (the
@@ -82,7 +82,7 @@ EigenBase&lt;%Matrix&gt;
<-- DenseCoeffsBase&lt;%Matrix&gt; (direct access case)
<-- DenseBase&lt;%Matrix&gt;
<-- MatrixBase&lt;%Matrix&gt;
- <-- DenseStorageBase&lt;%Matrix&gt; (matrix case)
+ <-- PlainObjectBase&lt;%Matrix&gt; (matrix case)
<-- Matrix
</pre>
@@ -93,7 +93,7 @@ EigenBase&lt;%Array&gt;
<-- DenseCoeffsBase&lt;%Array&gt; (direct access case)
<-- DenseBase&lt;%Array&gt;
<-- ArrayBase&lt;%Array&gt;
- <-- DenseStorageBase&lt;%Array&gt; (array case)
+ <-- PlainObjectBase&lt;%Array&gt; (array case)
<-- Array
</pre>
diff --git a/doc/I13_FunctionsTakingEigenTypes.dox b/doc/I13_FunctionsTakingEigenTypes.dox
index a6caf539e..8f2542632 100644
--- a/doc/I13_FunctionsTakingEigenTypes.dox
+++ b/doc/I13_FunctionsTakingEigenTypes.dox
@@ -26,11 +26,13 @@ This section will provide simple examples for different types of objects Eigen i
<b> %EigenBase Example </b><br/><br/>
Prints the dimensions of the most generic object present in Eigen. It coulde be any matrix expressions, any dense or sparse matrix and any array.
-<table class="tutorial_code"><tr><td>
-Example: \include function_taking_eigenbase.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include function_taking_eigenbase.cpp
</td>
<td>
-Output: \verbinclude function_taking_eigenbase.out
+\verbinclude function_taking_eigenbase.out
</td></tr></table>
<b> %DenseBase Example </b><br/><br/>
Prints a sub-block of the dense expression. Accepts any dense matrix or array expression, but no sparse objects and no special matrix classes such as DiagonalMatrix.
@@ -102,16 +104,15 @@ When trying to execute the following code
MatrixXf C = MatrixXf::Zero(3,6);
cov(x,y, C.block(0,0,3,3));
\endcode
-the compiler will fail, because it is not possible to convert the expression returned by \c MatrixXf::block() in a non-const \c MatrixXf&. This is the case because the compiler wants to protect you from writing your result to a temporary object. In this special case this protection is not intended -- we want to write to a temporary object. So how can we overcome this problem? There are two possible solutions depending on the type of compiler you are using.
+the compiler will fail, because it is not possible to convert the expression returned by \c MatrixXf::block() into a non-const \c MatrixXf&. This is the case because the compiler wants to protect you from writing your result to a temporary object. In this special case this protection is not intended -- we want to write to a temporary object. So how can we overcome this problem?
-<b>Solution A)</b>
-Assuming you are using a compiler following the C98 standard, the only thing you can do is to use a little \em hack. You need to pass a const reference and internally the constness needs to be cast away. The correct implementation for C98 compliant compilers would be
+The solution which is preferred at the moment is based on a little \em hack. One needs to pass a const reference to the matrix and internally the constness needs to be cast away. The correct implementation for C98 compliant compilers would be
\code
template <typename Derived, typename OtherDerived>
void cov(const MatrixBase<Derived>& x, const MatrixBase<Derived>& y, MatrixBase<OtherDerived> EIGEN_REF_TO_TEMPORARY C)
{
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_plain_row_type<Derived>::type RowVectorType;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::plain_row_type<Derived>::type RowVectorType;
const Scalar num_observations = static_cast<Scalar>(x.rows());
@@ -126,24 +127,6 @@ The implementation above does now not only work with temporary expressions but i
\b Note: The const cast hack will only work with templated functions. It will not work with the MatrixXf implementation because it is not possible to cast a Block expression to a Matrix reference!
-<b>Solution B)</b>
-In the next solution we are going to utilize a new feature introduced with C++0x compliant compilers -- so called rvalue references. Rvalue references allow to explicitly tell the compiler that the object we are going to pass to a function is a temporary object that is writeable. The C++0x compliant implementation of the covariance function will be
-\code
-template <typename Derived, typename OtherDerived>
-void cov(const MatrixBase<Derived>& x, const MatrixBase<Derived>& y, MatrixBase<OtherDerived>&& C)
-{
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_plain_row_type<Derived>::type RowVectorType;
-
- const Scalar num_observations = static_cast<Scalar>(x.rows());
-
- const RowVectorType x_mean = x.colwise().sum() / num_observations;
- const RowVectorType y_mean = y.colwise().sum() / num_observations;
-
- C = (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;
-}
-\endcode
-
\section TopicResizingInGenericImplementations How to resize matrices in generic implementations?
One might think we are done now, right? This is not completely true because in order for our covariance function to be generically applicable, we want the follwing code to work
@@ -158,8 +141,8 @@ This is not the case anymore, when we are using an implementation taking MatrixB
template <typename Derived, typename OtherDerived>
void cov(const MatrixBase<Derived>& x, const MatrixBase<Derived>& y, MatrixBase<OtherDerived> EIGEN_REF_TO_TEMPORARY C_)
{
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_plain_row_type<Derived>::type RowVectorType;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::plain_row_type<Derived>::type RowVectorType;
const Scalar num_observations = static_cast<Scalar>(x.rows());
diff --git a/doc/QuickReference.dox b/doc/QuickReference.dox
index d426b85de..e657f1a7c 100644
--- a/doc/QuickReference.dox
+++ b/doc/QuickReference.dox
@@ -20,19 +20,19 @@ namespace Eigen {
The Eigen library is divided in a Core module and several additional modules. Each module has a corresponding header file which has to be included in order to use the module. The \c %Dense and \c Eigen header files are provided to conveniently gain access to several modules at once.
-<table class="tutorial_code">
-<tr><td>Module</td><td>Header file</td><td>Contents</td></tr>
+<table class="manual">
+<tr><th>Module</th><th>Header file</th><th>Contents</th></tr>
<tr><td>\link Core_Module Core \endlink</td><td>\code#include <Eigen/Core>\endcode</td><td>Matrix and Array classes, basic linear algebra (including triangular and selfadjoint products), array manipulation</td></tr>
-<tr><td>\link Geometry_Module Geometry \endlink</td><td>\code#include <Eigen/Geometry>\endcode</td><td>Transform, Translation, Scaling, Rotation2D and 3D rotations (Quaternion, AngleAxis)</td></tr>
+<tr class="alt"><td>\link Geometry_Module Geometry \endlink</td><td>\code#include <Eigen/Geometry>\endcode</td><td>Transform, Translation, Scaling, Rotation2D and 3D rotations (Quaternion, AngleAxis)</td></tr>
<tr><td>\link LU_Module LU \endlink</td><td>\code#include <Eigen/LU>\endcode</td><td>Inverse, determinant, LU decompositions with solver (FullPivLU, PartialPivLU)</td></tr>
<tr><td>\link Cholesky_Module Cholesky \endlink</td><td>\code#include <Eigen/Cholesky>\endcode</td><td>LLT and LDLT Cholesky factorization with solver</td></tr>
-<tr><td>\link Householder_Module Householder \endlink</td><td>\code#include <Eigen/Householder>\endcode</td><td>Householder transformations; this module is used by several linear algebra modules</td></tr>
-<tr><td>\link SVD_Module SVD \endlink</td><td>\code#include <Eigen/SVD>\endcode</td><td>%SVD decomposition with solver (SVD, JacobiSVD)</td></tr>
-<tr><td>\link QR_Module QR \endlink</td><td>\code#include <Eigen/QR>\endcode</td><td>QR decomposition with solver (HouseholderQR, ColPivHouseholderQR, FullPivHouseholderQR)</td></tr>
+<tr class="alt"><td>\link Householder_Module Householder \endlink</td><td>\code#include <Eigen/Householder>\endcode</td><td>Householder transformations; this module is used by several linear algebra modules</td></tr>
+<tr><td>\link SVD_Module SVD \endlink</td><td>\code#include <Eigen/SVD>\endcode</td><td>SVD decomposition with least-squares solver (JacobiSVD)</td></tr>
+<tr class="alt"><td>\link QR_Module QR \endlink</td><td>\code#include <Eigen/QR>\endcode</td><td>QR decomposition with solver (HouseholderQR, ColPivHouseholderQR, FullPivHouseholderQR)</td></tr>
<tr><td>\link Eigenvalues_Module Eigenvalues \endlink</td><td>\code#include <Eigen/Eigenvalues>\endcode</td><td>Eigenvalue, eigenvector decompositions (EigenSolver, SelfAdjointEigenSolver, ComplexEigenSolver)</td></tr>
-<tr><td>\link Sparse_Module Sparse \endlink</td><td>\code#include <Eigen/Sparse>\endcode</td><td>%Sparse matrix storage and related basic linear algebra (SparseMatrix, DynamicSparseMatrix, SparseVector)</td></tr>
-<tr><td></td><td>\code#include <Eigen/Dense>\endcode</td><td>Includes Core, Geometry, LU, Cholesky, %SVD, QR, and Eigenvalues header files</td></tr>
-<tr><td></td><td>\code#include <Eigen/Eigen>\endcode</td><td>Includes %Dense and %Sparse header files (the whole Eigen library)</td></tr>
+<tr class="alt"><td>\link Sparse_Module Sparse \endlink</td><td>\code#include <Eigen/Sparse>\endcode</td><td>%Sparse matrix storage and related basic linear algebra (SparseMatrix, DynamicSparseMatrix, SparseVector)</td></tr>
+<tr><td></td><td>\code#include <Eigen/Dense>\endcode</td><td>Includes Core, Geometry, LU, Cholesky, SVD, QR, and Eigenvalues header files</td></tr>
+<tr class="alt"><td></td><td>\code#include <Eigen/Eigen>\endcode</td><td>Includes %Dense and %Sparse header files (the whole Eigen library)</td></tr>
</table>
<a href="#" class="top">top</a>
@@ -40,29 +40,26 @@ The Eigen library is divided in a Core module and several additional modules. Ea
\b Recall: Eigen provides two kinds of dense objects: mathematical matrices and vectors which are both represented by the template class Matrix, and general 1D and 2D arrays represented by the template class Array:
-<div class="desired_tutorial_width">
\code
typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyMatrixType;
typedef Array<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyArrayType;
\endcode
-</div>
\li \c Scalar is the scalar type of the coefficients (e.g., \c float, \c double, \c bool, \c int, etc.).
\li \c RowsAtCompileTime and \c ColsAtCompileTime are the number of rows and columns of the matrix as known at compile-time or \c Dynamic.
\li \c Options can be \c ColMajor or \c RowMajor, default is \c ColMajor. (see class Matrix for more options)
All combinations are allowed: you can have a matrix with a fixed number of rows and a dynamic number of columns, etc. The following are all valid:
-<div class="desired_tutorial_width">
\code
Matrix<double, 6, Dynamic> // Dynamic number of columns (heap allocation)
Matrix<double, Dynamic, 2> // Dynamic number of rows (heap allocation)
Matrix<double, Dynamic, Dynamic, RowMajor> // Fully dynamic, row major (heap allocation)
Matrix<double, 13, 3> // Fully fixed (static allocation)
\endcode
-</div>
In most cases, you can simply use one of the convenience typedefs for \ref matrixtypedefs "matrices" and \ref arraytypedefs "arrays". Some examples:
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Matrices</th><th>Arrays</th></tr>
<tr><td>\code
Matrix<float,Dynamic,Dynamic> <=> MatrixXf
Matrix<double,Dynamic,1> <=> VectorXd
@@ -79,7 +76,6 @@ Array<float,4,1> <=> Array4f
</table>
Conversion between the matrix and array worlds:
-<div class="desired_tutorial_width">
\code
Array44f a1, a1;
Matrix4f m1, m2;
@@ -90,7 +86,6 @@ m2 = a1.matrix() + m1; // and explicit conversion is required.
ArrayWrapper<Matrix4f> m1a(m1); // m1a is an alias for m1.array(), they share the same coefficients
MatrixWrapper<Array44f> a1m(a1);
\endcode
-</div>
In the rest of this document we will use the following symbols to emphasize the features which are specifics to a given kind of object:
\li <a name="matrixonly"><a/>\matrixworld linear algebra matrix and vector only
@@ -98,8 +93,8 @@ In the rest of this document we will use the following symbols to emphasize the
\subsection QuickRef_Basics Basic matrix manipulation
-<table class="tutorial_code">
-<tr><td></td><td>1D objects</td><td>2D objects</td><td>Notes</td></tr>
+<table class="manual">
+<tr><th></th><th>1D objects</th><th>2D objects</th><th>Notes</th></tr>
<tr><td>Constructors</td>
<td>\code
Vector4d v4;
@@ -119,7 +114,7 @@ MatrixXf m5; // empty object
MatrixXf m6(nb_rows, nb_columns);
\endcode</td><td class="note">
By default, the coefficients \n are left uninitialized</td></tr>
-<tr><td>Comma initializer</td>
+<tr class="alt"><td>Comma initializer</td>
<td>\code
Vector3f v1; v1 << x, y, z;
ArrayXf v2(4); v2 << 1, 2, 3, 4;
@@ -140,7 +135,7 @@ output:
</td>
</tr>
-<tr><td>Runtime info</td>
+<tr class="alt"><td>Runtime info</td>
<td>\code
vector.size();
@@ -158,7 +153,7 @@ ObjectType::Scalar ObjectType::RowsAtCompileTime
ObjectType::RealScalar ObjectType::ColsAtCompileTime
ObjectType::Index ObjectType::SizeAtCompileTime
\endcode</td><td></td></tr>
-<tr><td>Resizing</td>
+<tr class="alt"><td>Resizing</td>
<td>\code
vector.resize(size);
@@ -183,7 +178,7 @@ vector[i] vector.y()
matrix(i,j)
\endcode</td><td class="note">Range checking is disabled if \n NDEBUG or #EIGEN_NO_DEBUG is defined</td></tr>
-<tr><td>Coeff access without \n range checking</td>
+<tr class="alt"><td>Coeff access without \n range checking</td>
<td>\code
vector.coeff(i)
vector.coeffRef(i)
@@ -202,11 +197,11 @@ object_of_float = expression_of_double.cast<float>();
\subsection QuickRef_PredefMat Predefined Matrices
-<table class="tutorial_code">
+<table class="manual">
<tr>
- <td>Fixed-size matrix or vector</td>
- <td>Dynamic-size matrix</td>
- <td>Dynamic-size vector</td>
+ <th>Fixed-size matrix or vector</th>
+ <th>Dynamic-size matrix</th>
+ <th>Dynamic-size vector</th>
</tr>
<tr style="border-bottom-style: none;">
<td>
@@ -303,7 +298,7 @@ VectorXf::Unit(4,1) == Vector4f(0,1,0,0)
\subsection QuickRef_Map Mapping external arrays
-<table class="tutorial_code">
+<table class="manual">
<tr>
<td>Contiguous \n memory</td>
<td>\code
@@ -330,13 +325,13 @@ Map<MatrixXf,0,OuterStride<> > m1(data,2,3,OuterStride<>(3)); // are equal t
<a href="#" class="top">top</a>
\section QuickRef_ArithmeticOperators Arithmetic Operators
-<table class="tutorial_code">
+<table class="manual">
<tr><td>
add \n subtract</td><td>\code
mat3 = mat1 + mat2; mat3 += mat1;
mat3 = mat1 - mat2; mat3 -= mat1;\endcode
</td></tr>
-<tr><td>
+<tr class="alt"><td>
scalar product</td><td>\code
mat3 = mat1 * s1; mat3 *= s1; mat3 = s1 * mat1;
mat3 = mat1 / s1; mat3 /= s1;\endcode
@@ -347,7 +342,7 @@ col2 = mat1 * col1;
row2 = row1 * mat1; row1 *= mat1;
mat3 = mat1 * mat2; mat3 *= mat1; \endcode
</td></tr>
-<tr><td>
+<tr class="alt"><td>
transposition \n adjoint \matrixworld</td><td>\code
mat1 = mat2.transpose(); mat1.transposeInPlace();
mat1 = mat2.adjoint(); mat1.adjointInPlace();
@@ -359,7 +354,7 @@ scalar = vec1.dot(vec2);
scalar = col1.adjoint() * col2;
scalar = (col1.adjoint() * col2).value();\endcode
</td></tr>
-<tr><td>
+<tr class="alt"><td>
outer product \matrixworld</td><td>\code
mat = col1 * col2.transpose();\endcode
</td></tr>
@@ -370,7 +365,7 @@ scalar = vec1.norm(); scalar = vec1.squaredNorm()
vec2 = vec1.normalized(); vec1.normalize(); // inplace \endcode
</td></tr>
-<tr><td>
+<tr class="alt"><td>
\link MatrixBase::cross() cross product \endlink \matrixworld</td><td>\code
#include <Eigen/Geometry>
vec3 = vec1.cross(vec2);\endcode</td></tr>
@@ -379,8 +374,8 @@ vec3 = vec1.cross(vec2);\endcode</td></tr>
<a href="#" class="top">top</a>
\section QuickRef_Coeffwise Coefficient-wise \& Array operators
Coefficient-wise operators for matrices and vectors:
-<table class="tutorial_code">
-<tr><td>Matrix API \matrixworld</td><td>Via Array conversions</td></tr>
+<table class="manual">
+<tr><th>Matrix API \matrixworld</th><th>Via Array conversions</th></tr>
<tr><td>\code
mat1.cwiseMin(mat2)
mat1.cwiseMax(mat2)
@@ -402,7 +397,7 @@ mat1.array() / mat2.array()
Array operators:\arrayworld
-<table class="tutorial_code">
+<table class="manual">
<tr><td>Arithmetic operators</td><td>\code
array1 * array2 array1 / array2 array1 *= array2 array1 /= array2
array1 + scalar array1 - scalar array1 += scalar array1 -= scalar
@@ -443,14 +438,14 @@ Eigen provides several reduction methods such as:
All reduction operations can be done matrix-wise,
\link DenseBase::colwise() column-wise \endlink \redstar or
\link DenseBase::rowwise() row-wise \endlink \redstar. Usage example:
-<table class="tutorial_code">
-<tr><td rowspan="3" style="border-right-style:dashed">\code
+<table class="manual">
+<tr><td rowspan="3" style="border-right-style:dashed;vertical-align:middle">\code
5 3 1
mat = 2 7 8
9 4 6 \endcode
</td> <td>\code mat.minCoeff(); \endcode</td><td>\code 1 \endcode</td></tr>
-<tr><td>\code mat.colwise().minCoeff(); \endcode</td><td>\code 2 3 1 \endcode</td></tr>
-<tr><td>\code mat.rowwise().minCoeff(); \endcode</td><td>\code
+<tr class="alt"><td>\code mat.colwise().minCoeff(); \endcode</td><td>\code 2 3 1 \endcode</td></tr>
+<tr style="vertical-align:middle"><td>\code mat.rowwise().minCoeff(); \endcode</td><td>\code
1
2
4
@@ -458,47 +453,41 @@ mat = 2 7 8
</table>
Special versions of \link DenseBase::minCoeff(Index*,Index*) minCoeff \endlink and \link DenseBase::maxCoeff(Index*,Index*) maxCoeff \endlink:
-<div class="desired_tutorial_width">
\code
int i, j;
s = vector.minCoeff(&i); // s == vector[i]
s = matrix.maxCoeff(&i, &j); // s == matrix(i,j)
\endcode
-</div>
Typical use cases of all() and any():
-<div class="desired_tutorial_width">
\code
if((array1 > 0).all()) ... // if all coefficients of array1 are greater than 0 ...
if((array1 < array2).any()) ... // if there exist a pair i,j such that array1(i,j) < array2(i,j) ...
\endcode
-</div>
<a href="#" class="top">top</a>\section QuickRef_Blocks Sub-matrices
Read-write access to a \link DenseBase::col(Index) column \endlink
or a \link DenseBase::row(Index) row \endlink of a matrix (or array):
-<div class="desired_tutorial_width">
\code
mat1.row(i) = mat2.col(j);
mat1.col(j1).swap(mat1.col(j2));
\endcode
-</div>
Read-write access to sub-vectors:
-<table class="tutorial_code">
+<table class="manual">
<tr>
-<td>Default versions</td>
-<td>Optimized versions when the size \n is known at compile time</td></tr>
-<td></td>
+<th>Default versions</th>
+<th>Optimized versions when the size \n is known at compile time</th></tr>
+<th></th>
<tr><td>\code vec1.head(n)\endcode</td><td>\code vec1.head<n>()\endcode</td><td>the first \c n coeffs </td></tr>
<tr><td>\code vec1.tail(n)\endcode</td><td>\code vec1.tail<n>()\endcode</td><td>the last \c n coeffs </td></tr>
<tr><td>\code vec1.segment(pos,n)\endcode</td><td>\code vec1.segment<n>(pos)\endcode</td>
<td>the \c n coeffs in \n the range [\c pos : \c pos + \c n [</td></tr>
-<tr style="border-style: dashed none dashed none;"><td>
+<tr class="alt"><td colspan="3">
-Read-write access to sub-matrices:</td><td></td><td></td></tr>
+Read-write access to sub-matrices:</td></tr>
<tr>
<td>\code mat1.block(i,j,rows,cols)\endcode
\link DenseBase::block(Index,Index,Index,Index) (more) \endlink</td>
@@ -537,7 +526,8 @@ Read-write access to sub-matrices:</td><td></td><td></td></tr>
\subsection QuickRef_Diagonal Diagonal matrices
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Operation</th><th>Code</th></tr>
<tr><td>
view a vector \link MatrixBase::asDiagonal() as a diagonal matrix \endlink \n </td><td>\code
mat1 = vec1.asDiagonal();\endcode
@@ -572,7 +562,8 @@ mat3 = mat1 * diag1.inverse()
TriangularView gives a view on a triangular part of a dense matrix and allows to perform optimized operations on it. The opposite triangular part is never referenced and can be used to store other information.
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Operation</th><th>Code</th></tr>
<tr><td>
Reference to a triangular with optional \n
unit or null diagonal (read/write):
@@ -615,7 +606,8 @@ Just as for triangular matrix, you can reference any triangular part of a square
matrix and perform special and optimized operations. Again the opposite triangular part is never referenced and can be
used to store other information.
-<table class="tutorial_code">
+<table class="example">
+<tr><th>Operation</th><th>Code</th></tr>
<tr><td>
Conversion to a dense matrix:
</td><td>\code
diff --git a/doc/TopicLinearAlgebraDecompositions.dox b/doc/TopicLinearAlgebraDecompositions.dox
index ad8d0abea..574962033 100644
--- a/doc/TopicLinearAlgebraDecompositions.dox
+++ b/doc/TopicLinearAlgebraDecompositions.dox
@@ -5,24 +5,24 @@ namespace Eigen {
\section TopicLinAlgBigTable Catalogue of decompositions offered by Eigen
-<table border="1">
+<table class="manual-vl">
<tr>
- <td></td>
- <td colspan="5" align="center">Generic information, not Eigen-specific</td>
- <td colspan="3" align="center">Eigen-specific</td>
+ <th class="meta"></th>
+ <th class="meta" colspan="5">Generic information, not Eigen-specific</th>
+ <th class="meta" colspan="3">Eigen-specific</th>
</tr>
<tr>
- <td>Decomposition</td>
- <td>Requirements on the matrix</td>
- <td>Speed</td>
- <td>Algorithm reliability and accuracy</td>
- <td>Rank-revealing</td>
- <td>Allows to compute (besides linear solving)</td>
- <td>Linear solver provided by Eigen</td>
- <td>Maturity of Eigen's implementation</td>
- <td>Optimizations</td>
+ <th>Decomposition</th>
+ <th>Requirements on the matrix</th>
+ <th>Speed</th>
+ <th>Algorithm reliability and accuracy</th>
+ <th>Rank-revealing</th>
+ <th>Allows to compute (besides linear solving)</th>
+ <th>Linear solver provided by Eigen</th>
+ <th>Maturity of Eigen's implementation</th>
+ <th>Optimizations</th>
</tr>
<tr>
@@ -37,7 +37,7 @@ namespace Eigen {
<td>Blocking</td>
</tr>
- <tr>
+ <tr class="alt">
<td>FullPivLU</td>
<td>-</td>
<td>Slow</td>
@@ -61,7 +61,7 @@ namespace Eigen {
<td>Blocking</td>
</tr>
- <tr>
+ <tr class="alt">
<td>ColPivHouseholderQR</td>
<td>-</td>
<td>Fast</td>
@@ -85,7 +85,7 @@ namespace Eigen {
<td>-</td>
</tr>
- <tr>
+ <tr class="alt">
<td>LLT</td>
<td>Positive definite</td>
<td>Very fast</td>
@@ -109,33 +109,21 @@ namespace Eigen {
<td><em>Soon: blocking</em></td>
</tr>
- <tr><td colspan="9">\n Singular values and eigenvalues decompositions</td></tr>
+ <tr><th class="inter" colspan="9">\n Singular values and eigenvalues decompositions</th></tr>
<tr>
- <td>SVD</td>
- <td>-</td>
- <td>Average</td>
- <td>Good</td>
- <td>Yes</td>
- <td>Singular values/vectors, least squares</td>
- <td>Yes</td>
- <td>Average</td>
- <td>-</td>
- </tr>
-
- <tr>
- <td>JacobiSVD</td>
+ <td>JacobiSVD (two-sided)</td>
<td>-</td>
<td>Slow (but fast for small matrices)</td>
- <td>Proven</td>
+ <td>Excellent-Proven<sup><a href="#note3">3</a></sup></td>
<td>Yes</td>
<td>Singular values/vectors, least squares</td>
- <td>-</td>
+ <td>Yes (and does least squares)</td>
<td>Excellent</td>
- <td>-</td>
+ <td>R-SVD</td>
</tr>
- <tr>
+ <tr class="alt">
<td>SelfAdjointEigenSolver</td>
<td>Self-adjoint</td>
<td>Fast-average<sup><a href="#note2">2</a></sup></td>
@@ -159,7 +147,7 @@ namespace Eigen {
<td>-</td>
</tr>
- <tr>
+ <tr class="alt">
<td>EigenSolver</td>
<td>Square and real</td>
<td>Average-slow<sup><a href="#note2">2</a></sup></td>
@@ -183,7 +171,7 @@ namespace Eigen {
<td>-</td>
</tr>
- <tr><td colspan="9">\n Helper decompositions</td></tr>
+ <tr><th class="inter" colspan="9">\n Helper decompositions</th></tr>
<tr>
<td>RealSchur</td>
@@ -197,7 +185,7 @@ namespace Eigen {
<td>-</td>
</tr>
- <tr>
+ <tr class="alt">
<td>ComplexSchur</td>
<td>Square</td>
<td>Slow-very slow<sup><a href="#note2">2</a></sup></td>
@@ -221,7 +209,7 @@ namespace Eigen {
<td>-</td>
</tr>
- <tr>
+ <tr class="alt">
<td>Tridiagonalization</td>
<td>Self-adjoint</td>
<td>Fast</td>
@@ -251,6 +239,7 @@ namespace Eigen {
<ul>
<li><a name="note1">\b 1: </a>There exist two variants of the LDLT algorithm. Eigen's one produces a pure diagonal D matrix, and therefore it cannot handle indefinite matrices, unlike Lapack's one which produces a block diagonal D matrix.</li>
<li><a name="note2">\b 2: </a>Eigenvalues, SVD and Schur decompositions rely on iterative algorithms. Their convergence speed depends on how well the eigenvalues are separated.</li>
+<li><a name="note3">\b 3: </a>Our JacobiSVD is two-sided, making for proven and optimal precision for square matrices. For non-square matrices, we have to use a QR preconditioner first. The default choice, ColPivHouseholderQR, is already very reliable, but if you want it to be proven, use FullPivHouseholderQR instead.
</ul>
\section TopicLinAlgTerminology Terminology
diff --git a/doc/eigendoxy.css b/doc/eigendoxy.css
index 555bd4855..e62958831 100644
--- a/doc/eigendoxy.css
+++ b/doc/eigendoxy.css
@@ -1,10 +1,13 @@
-body,h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 10pt;
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
}
+/* @group Heading Levels */
+
h1 {
- text-align: center;
font-size: 150%;
}
@@ -16,137 +19,132 @@ h3 {
font-size: 100%;
}
-td h2
-{
- /* we need the margin in order to ensure that in tables
- * the headings are centered. */
- margin-top: 12px;
- margin-bottom: 12px;
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
}
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
caption {
- font-weight: bold
+ font-weight: bold;
}
-div.center {
- text-align: center;
- margin-top: 0px;
- margin-bottom: 0px;
- padding: 0px;
+span.legend {
+ font-size: 70%;
+ text-align: center;
}
-div.center img {
- border: 0px;
+h3.version {
+ font-size: 90%;
+ text-align: center;
}
-div.qindex {
- width: 100%;
- background-color: #e8eef2;
- border: 1px solid #84b0c7;
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
text-align: center;
margin: 2px;
padding: 2px;
- line-height: 140%;
}
-div.navpath {
+div.qindex, div.navpath {
width: 100%;
- background-color: #e8eef2;
- border: 1px solid #84b0c7;
- text-align: center;
- margin: 2px;
- padding: 2px;
line-height: 140%;
}
div.navtab {
- background-color: #e8eef2;
- border: 1px solid #84b0c7;
- text-align: center;
- margin: 2px;
margin-right: 15px;
- padding: 2px;
}
-td.navtab {
- font-size: 100%;
-}
+/* @group Link Styling */
-a.qindex {
- text-decoration: none;
- font-weight: bold;
- color: #1a419d;
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
}
-a.qindex:visited {
- text-decoration: none;
- font-weight: bold;
- color: #1a419d
+.contents a:visited {
+ color: #4665A2;
}
-a.qindex:hover {
- text-decoration: none;
- background-color: #ddddff;
+a:hover {
+ text-decoration: underline;
}
-a.qindexhl {
- text-decoration: none;
+a.qindex {
font-weight: bold;
- background-color: #6666cc;
- color: #ffffff;
- border: 1px double #9295c2;
}
-a.qindexhl:hover {
- text-decoration: none;
- background-color: #6666cc;
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
color: #ffffff;
+ border: 1px double #869DCA;
}
-a.qindexhl:visited {
- text-decoration: none;
- background-color: #6666cc;
- color: #ffffff
+.contents a.qindexHL:visited {
+ color: #ffffff;
}
a.el {
- text-decoration: none;
- font-weight: bold
+ font-weight: bold;
}
-a.elref {
- font-weight: bold
+a.elRef {
}
-a.code:link {
- text-decoration: none;
- font-weight: normal;
- color: #0000ff
+a.code {
+ color: #4665A2;
}
-a.code:visited {
- text-decoration: none;
- font-weight: normal;
- color: #0000ff
+a.codeRef {
+ color: #4665A2;
}
-a.coderef:link {
- font-weight: normal;
- color: #0000ff
-}
+/* @end */
-a.coderef:visited {
- font-weight: normal;
- color: #0000ff
+dl.el {
+ margin-left: -1cm;
}
-a:hover {
- text-decoration: none;
- background-color: #f2f2ff
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 105%;
}
-dl.el {
- margin-left: -1cm
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ /*word-wrap: break-word;*/
+ font-size: 9pt;
+ line-height: 125%;
}
div.ah {
@@ -154,113 +152,143 @@ div.ah {
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
- margin-top: 3px
-}
-
-div.groupheader {
- margin-left: 16px;
- margin-top: 12px;
- margin-bottom: 6px;
- font-weight: bold;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
}
-div.grouptext {
+div.groupText {
margin-left: 16px;
font-style: italic;
- font-size: 95%
}
body {
background: white;
color: black;
- margin-right: 20px;
- margin-left: 20px;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 10px;
+ margin-right: 10px;
}
td.indexkey {
- background-color: #e8eef2;
+ background-color: #EBEFF6;
font-weight: bold;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px;
- border: 1px solid #cccccc;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
}
td.indexvalue {
- background-color: #e8eef2;
- font-style: italic;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px;
- border: 1px solid #cccccc;
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
}
tr.memlist {
- background-color: #f0f0f0;
+ background-color: #EEF1F7;
}
-p.formuladsp {
+p.formulaDsp {
text-align: center;
}
-img.formuladsp {
+img.formulaDsp {
+
}
-img.formulainl {
+img.formulaInl {
vertical-align: middle;
}
-span.keyword { color: #008000 }
-span.keywordtype { color: #604020 }
-span.keywordflow { color: #e08000 }
-span.comment { color: #800000 }
-span.preprocessor { color: #806020 }
-span.stringliteral { color: #002080 }
-span.charliteral { color: #008080 }
-span.vhdldigit { color: #ff00ff }
-span.vhdlchar { color: #000000 }
-span.vhdlkeyword { color: #700070 }
-span.vhdllogic { color: #ff0000 }
-
-/* @group member descriptions */
-
-.mdescleft, .mdescright,
-.memitemleft, .memitemright,
-.memtemplitemleft, .memtemplitemright, .memtemplparams {
- background-color: #fafafa;
- border: none;
- margin: 4px;
- padding: 1px 0 0 8px;
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
}
-.mdescleft, .mdescright {
- padding: 0px 8px 4px 8px;
- color: #555;
+div.center img {
+ border: 0px;
}
-.memitemleft, .memitemright, .memtemplparams {
- border-top: 1px solid #ccc;
+address.footer {
+ text-align: right;
+ padding-right: 12px;
}
-.memitemleft, .memtemplitemleft {
- white-space: nowrap;
+img.footer {
+ border: 0px;
+ vertical-align: middle;
}
-.memtemplparams {
- color: #606060;
- white-space: nowrap;
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
}
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
.search {
color: #003399;
font-weight: bold;
@@ -272,53 +300,88 @@ form.search {
}
input.search {
- font-size: 90%;
+ font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
+*/
td.tiny {
- font-size: 85%;
-}
-
-a {
- color: #1a41a8;
-}
-
-a:visited {
- color: #2a3798;
+ font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
- border: 1px solid #84b0c7;
+ border: 1px solid #A3B4D7;
}
th.dirtab {
- background: #e8eef2;
+ background: #EBEFF6;
font-weight: bold;
}
hr {
- height: 0;
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
border: none;
- border-top: 1px solid #666;
+ margin: 4px;
+ padding: 1px 0 0 8px;
}
-/* styles for detailed member documentation */
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #C4CFE5;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
- color: #606060;
+ color: #4665A2;
font-weight: normal;
- margin-left: 3px;
+ margin-left: 9px;
}
.memnav {
- background-color: #e8eef2;
- border: 1px solid #84b0c7;
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
text-align: center;
margin: 2px;
margin-right: 15px;
@@ -331,36 +394,58 @@ hr {
}
.memname {
- white-space: nowrap;
- font-weight: bold;
-}
-
-.memproto, .memdoc {
- border: 1px solid #84b0c7;
+ white-space: nowrap;
+ font-weight: bold;
+ margin-left: 6px;
}
.memproto {
- padding: 2;
- background-color: #d5e1e8;
- font-weight: bold;
- -webkit-border-top-left-radius: 8px;
- -webkit-border-top-right-radius: 8px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- -moz-border-radius-topleft: 8px;
- -moz-border-radius-topright: 8px;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 8px;
+ border-top-left-radius: 8px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+
}
.memdoc {
- padding: 2px 5px;
- background-color: #eef3f5;
- border-top-width: 0;
- -webkit-border-bottom-left-radius: 8px;
- -webkit-border-bottom-right-radius: 8px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- -moz-border-radius-bottomleft: 8px;
- -moz-border-radius-bottomright: 8px;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 2px 5px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ /* opera specific markup */
+ border-bottom-left-radius: 8px;
+ border-bottom-right-radius: 8px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 8px;
+ -moz-border-radius-bottomright: 8px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
}
.paramkey {
@@ -379,17 +464,45 @@ hr {
font-style: normal;
}
-/* end styling for detailed member documentation */
+.params, .retval, .exception, .tparams {
+ border-spacing: 6px 2px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+
+
+
+/* @end */
+
+/* @group Directory (tree) */
/* for the tree view */
+
.ftvtree {
font-family: sans-serif;
- margin:0.5em;
+ margin: 0px;
}
+/* these are for tree view when used as main index */
+
.directory {
font-size: 9pt;
font-weight: bold;
+ margin: 5px;
}
.directory h3 {
@@ -398,6 +511,24 @@ hr {
font-size: 11pt;
}
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
.directory > h3 {
margin-top: 0;
}
@@ -416,49 +547,286 @@ hr {
vertical-align: -30%;
}
-h2 a {
- font-size: 13pt;margin:10px 0 1em 1em;display:block;
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
}
-a.top {
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right: 15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath a
+{
+ height:32px;
display:block;
- color: #666666;
- position:absolute;
- right:20pt;
- margin:12pt 0 0 0;
- text-decoration : none;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath a:hover
+{
+ color:#6884BD;
+}
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
}
-a.top:hover, a.logo:hover {
- background-color: transparent;
- font-weight : bolder;
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
}
-div.navigation {
- min-height : 64px;
- padding-left : 80px;
- padding-top : 5px;
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+
+
+/******** Eigen specific CSS code ************/
+
+
+body {
+ max-width:60em;
+ margin-left:5%;
+ margin-top:2%;
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
}
img {
border: 0;
}
-table {
+a.logo {
+ float:right;
+ margin:10px;
+}
+
+div.fragment {
+ display:table; /* this allows the element to be larger than its parent */
+ padding: 0pt;
+}
+pre.fragment {
+ border: 1px solid #cccccc;
+
+ margin: 2px 0px 2px 0px ;
+ padding: 3px 5px 3px 5px;
+}
+
+/* Common style for all Eigen's tables */
+
+table.example, table.manual, table.manual-vl {
+ max-width:100%;
border-collapse: collapse;
- border-style: none;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #cccccc;
font-size: 1em;
+
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+table.example th, table.manual th, table.manual-vl th {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ text-align: left;
+ padding-right: 1em;
+ color: #555555;
+ background-color: #F4F4E5;
+
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.3,#FFFFFF), color-stop(0.30,#FFFFFF), color-stop(0.98,#F4F4E5), to(#ECECDE));
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 30%, #F4F4E5 98%, #ECECDE);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#F4F4E5');
+}
+
+table.example td, table.manual td, table.manual-vl td {
+ vertical-align:top;
+ border-width: 1px;
+ border-color: #cccccc;
+}
+
+/* header of headers */
+table th.meta {
+ text-align:center;
+ font-size: 1.2em;
+ background-color:#FFFFFF;
}
+/* intermediate header */
+table th.inter {
+ text-align:left;
+ background-color:#FFFFFF;
+ background-image:none;
+ border-style:solid solid solid solid;
+ border-width: 1px;
+ border-color: #cccccc;
+}
+
+/** class for exemple / output tables **/
+
+table.example {
+}
+
+table.example th {
+}
+
+table.example td {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ vertical-align:top;
+}
+
+/* standard class for the manual */
+
+table.manual, table.manual-vl {
+ padding: 0.2em 0em 0.5em 0em;
+}
+
+table.manual th, table.manual-vl th {
+ margin: 0em 0em 0.3em 0em;
+}
+
+table.manual td, table.manual-vl td {
+ padding: 0.3em 0.5em 0.3em 0.5em;
+ vertical-align:top;
+ border-width: 1px;
+}
+
+table.manual td.alt, table.manual tr.alt, table.manual-vl td.alt, table.manual-vl tr.alt {
+ background-color: #F4F4E5;
+}
+
+table.manual-vl th, table.manual-vl td, table.manual-vl td.alt {
+ border-color: #cccccc;
+ border-width: 1px;
+ border-style: none solid none solid;
+}
+
+table.manual-vl th.inter {
+ border-style: solid solid solid solid;
+}
+
+h2 {
+ margin-top:2em;
+ border-style: none none solid none;
+ border-width: 1px;
+ border-color: #cccccc;
+}
+
+
+/**** old Eigen's styles ****/
+
th {
- text-align: left;
- padding-right: 1em;
+ /*text-align: left;
+ padding-right: 1em;*/
/* border: #cccccc dashed; */
/* border-style: dashed; */
/* border-width: 0 0 3px 0; */
}
-
+/*
table.noborder {
border-collapse: separate;
border-bottom-style : none;
@@ -468,6 +836,9 @@ table.noborder {
border-spacing : 0px 0px;
margin: 4pt 0 0 0;
padding: 0 0 0 0;
+
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
}
table.noborder td {
@@ -482,11 +853,14 @@ table.noborder td {
table.tutorial_code {
width: 90%;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
}
table.tutorial_code tr {
border: 1px dashed #888888;
}
+*/
table.tutorial_code td {
border-color: transparent; /* required for Firefox */
@@ -494,6 +868,7 @@ table.tutorial_code td {
vertical-align: top;
}
+
/* Whenever doxygen meets a '\n' or a '<BR/>', it will put
* the text containing the characted into a <p class="starttd">.
* This little hack togehter with table.tutorial_code td.note
@@ -503,12 +878,11 @@ table.tutorial_code td.note p.starttd {
border: none;
padding: 0px;
}
-
+/*
div.fragment {
font-family: monospace, fixed;
font-size: 95%;
- margin: 0pt;
border: none;
padding: 0pt;
}
@@ -520,10 +894,7 @@ pre.fragment {
background-color: #f5f5f5;
}
-
-div.desired_tutorial_width {
- width: 90%;
-}
+*/
div.eimainmenu {
text-align: center;
diff --git a/doc/eigendoxy_footer.html.in b/doc/eigendoxy_footer.html.in
index 7654e0f43..e70829fb0 100644
--- a/doc/eigendoxy_footer.html.in
+++ b/doc/eigendoxy_footer.html.in
@@ -1,5 +1,5 @@
-<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 24 23:40:21 2008 for Eigen by&nbsp;
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
+
+<hr class="footer"/><address class="footer"><small>
+<a href="http://www.doxygen.org/index.html"><img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a></small></address>
</body>
</html> \ No newline at end of file
diff --git a/doc/eigendoxy_header.html.in b/doc/eigendoxy_header.html.in
index 572c47158..a4fe47f27 100644
--- a/doc/eigendoxy_header.html.in
+++ b/doc/eigendoxy_header.html.in
@@ -1,10 +1,14 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>$title</title>
-<link href="eigendoxy.css" rel="stylesheet" type="text/css">
-<link href="eigendoxy_tabs.css" rel="stylesheet" type="text/css">
-</head><body>
+<link href="$relpath$eigendoxy_tabs.css" rel="stylesheet" type="text/css">
+<link href="$relpath$search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javaScript" src="$relpath$search/search.js"></script>
+<link href="$relpath$eigendoxy.css" rel="stylesheet" type="text/css">
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
<a name="top"></a>
<a class="logo" href="http://eigen.tuxfamily.org/">
-<img src="Eigen_Silly_Professor_64x64.png" width=64 height=64 alt="Eigen's silly professor"
- style="position:absolute; border:none" /></a> \ No newline at end of file
+<img class="logo" src="Eigen_Silly_Professor_64x64.png" width=64 height=64 alt="Eigen's silly professor"/></a>
diff --git a/doc/eigendoxy_tabs.css b/doc/eigendoxy_tabs.css
index 00a02138c..21920562a 100644
--- a/doc/eigendoxy_tabs.css
+++ b/doc/eigendoxy_tabs.css
@@ -1,101 +1,59 @@
-/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
-
-DIV.tabs
-{
- float: left;
- width:100%;
- background : url("tab_b.gif") repeat-x bottom;
-}
-
-DIV.tabs UL
-{
- margin : 0px;
- padding-left : 10px;
- list-style : none;
-}
-
-DIV.tabs LI, DIV.tabs FORM
-{
- display : inline;
- margin : 0px;
- padding : 0px;
-}
-
-DIV.tabs FORM
-{
- float : right;
+.tabs, .tabs2, .tabs3 {
+ background-image: url('tab_b.png');
+ width: 100%;
+ z-index: 101;
+ font-size: 13px;
}
-DIV.tabs A
-{
- float : left;
- background : url("tab_r.gif") no-repeat right top;
- border-bottom : 1px solid #84B0C7;
- font-size : x-small;
- font-weight : bold;
- text-decoration : none;
+.tabs2 {
+ font-size: 10px;
}
-
-DIV.tabs A:hover
-{
- background-position: 100% -150px;
+.tabs3 {
+ font-size: 9px;
}
-DIV.tabs A:link, DIV.tabs A:visited,
-DIV.tabs A:active, DIV.tabs A:hover
-{
- color: #1A419D;
+.tablist {
+ margin: 0;
+ padding: 0;
+ display: table;
}
-DIV.tabs SPAN
-{
- float : left;
- display : block;
- background : url("tab_l.gif") no-repeat left top;
- padding : 5px 9px;
- white-space : nowrap;
+.tablist li {
+ float: left;
+ display: table-cell;
+ background-image: url('tab_b.png');
+ line-height: 36px;
+ list-style: none;
}
-DIV.tabs INPUT
-{
- float : right;
- display : inline;
- font-size : 1em;
-}
-
-DIV.tabs TD
-{
- font-size : x-small;
- font-weight : bold;
- text-decoration : none;
-}
-
-
-
-/* Commented Backslash Hack hides rule from IE5-Mac \*/
-DIV.tabs SPAN {float : none;}
-/* End IE5-Mac hack */
-
-DIV.tabs A:hover SPAN
-{
- background-position: 0% -150px;
+.tablist a {
+ display: block;
+ padding: 0 20px;
+ font-weight: bold;
+ background-image:url('tab_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color: #283A5D;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ text-decoration: none;
+ outline: none;
}
-DIV.tabs LI.current A
-{
- background-position: 100% -150px;
- border-width : 0px;
+.tabs3 .tablist a {
+ padding: 0 10px;
}
-DIV.tabs LI.current SPAN
-{
- background-position: 0% -150px;
- padding-bottom : 6px;
+.tablist a:hover {
+ background-image: url('tab_h.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+ text-decoration: none;
}
-DIV.navpath
-{
- background : none;
- border : none;
- border-bottom : 1px solid #84B0C7;
+.tablist li.current a {
+ background-image: url('tab_a.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
}
diff --git a/doc/examples/TutorialLinAlgSVDSolve.cpp b/doc/examples/TutorialLinAlgSVDSolve.cpp
new file mode 100644
index 000000000..9fbc031de
--- /dev/null
+++ b/doc/examples/TutorialLinAlgSVDSolve.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+#include <Eigen/Dense>
+
+using namespace std;
+using namespace Eigen;
+
+int main()
+{
+ MatrixXf A = MatrixXf::Random(3, 2);
+ cout << "Here is the matrix A:\n" << A << endl;
+ VectorXf b = VectorXf::Random(3);
+ cout << "Here is the right hand side b:\n" << b << endl;
+ cout << "The least-squares solution is:\n"
+ << A.jacobiSvd(ComputeThinU | ComputeThinV).solve(b) << endl;
+}
diff --git a/doc/examples/Tutorial_BlockOperations_block_assignment.cpp b/doc/examples/Tutorial_BlockOperations_block_assignment.cpp
index 56ca69a6e..76f49f2fb 100644
--- a/doc/examples/Tutorial_BlockOperations_block_assignment.cpp
+++ b/doc/examples/Tutorial_BlockOperations_block_assignment.cpp
@@ -6,13 +6,13 @@ using namespace Eigen;
int main()
{
- Array33f m;
- m << 1,2,3,
- 4,5,6,
- 7,8,9;
- Array<float,5,5> n = Array<float,5,5>::Constant(0.6);
- n.block(1,1,3,3) = m;
- cout << "n = " << endl << n << endl << endl;
- Array33f res = n.block(0,0,3,3) * m;
- cout << "res =" << endl << res << endl;
+ Array22f m;
+ m << 1,2,
+ 3,4;
+ Array44f a = Array44f::Constant(0.6);
+ cout << "Here is the array a:" << endl << a << endl << endl;
+ a.block<2,2>(1,1) = m;
+ cout << "Here is now a with m copied into its central 2x2 block:" << endl << a << endl << endl;
+ a.block(0,0,2,3) = a.block(2,1,2,3);
+ cout << "Here is now a with bottom-right 2x3 block copied into top-left 2x2 block:" << endl << a << endl << endl;
}
diff --git a/doc/examples/Tutorial_BlockOperations_colrow.cpp b/doc/examples/Tutorial_BlockOperations_colrow.cpp
index e98263057..2e7eb009b 100644
--- a/doc/examples/Tutorial_BlockOperations_colrow.cpp
+++ b/doc/examples/Tutorial_BlockOperations_colrow.cpp
@@ -1,14 +1,17 @@
#include <Eigen/Dense>
#include <iostream>
+using namespace std;
+
int main()
{
Eigen::MatrixXf m(3,3);
m << 1,2,3,
4,5,6,
7,8,9;
- std::cout << "2nd Row: " << m.row(1) << std::endl;
- m.col(0) += m.col(2);
- std::cout << "m after adding third column to first:\n";
- std::cout << m << std::endl;
+ cout << "Here is the matrix m:" << endl << m << endl;
+ cout << "2nd Row: " << m.row(1) << endl;
+ m.col(2) += 3 * m.col(0);
+ cout << "After adding 3 times the first column into the third column, the matrix m is:\n";
+ cout << m << endl;
}
diff --git a/doc/examples/Tutorial_BlockOperations_print_block.cpp b/doc/examples/Tutorial_BlockOperations_print_block.cpp
index 0fdefecdf..edea4aefe 100644
--- a/doc/examples/Tutorial_BlockOperations_print_block.cpp
+++ b/doc/examples/Tutorial_BlockOperations_print_block.cpp
@@ -1,6 +1,8 @@
#include <Eigen/Dense>
#include <iostream>
+using namespace std;
+
int main()
{
Eigen::MatrixXf m(4,4);
@@ -8,11 +10,11 @@ int main()
5, 6, 7, 8,
9,10,11,12,
13,14,15,16;
- std::cout << "Block in the middle" << std::endl;
- std::cout << m.block<2,2>(1,1) << std::endl << std::endl;
- for (int i = 1; i < 4; ++i)
+ cout << "Block in the middle" << endl;
+ cout << m.block<2,2>(1,1) << endl << endl;
+ for (int i = 1; i <= 3; ++i)
{
- std::cout << "Block of size " << i << std::endl;
- std::cout << m.block(0,0,i,i) << std::endl << std::endl;
+ cout << "Block of size " << i << "x" << i << endl;
+ cout << m.block(0,0,i,i) << endl << endl;
}
}
diff --git a/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
index f3364d7fc..740439fb3 100644
--- a/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
+++ b/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
@@ -9,20 +9,20 @@ int main()
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
- v << 5,
- 10;
+ v << -1,
+ 2;
- m << 2,2,
- 3,4;
+ m << 1,-2,
+ -3,4;
- n << 1, 2,
- 32,12;
-
+ cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
- cout << "m.norm() = " << m.norm() << endl;
- cout << "n.norm() = " << n.norm() << endl;
+ cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << endl;
+ cout << "v.lpNorm<Infinity>() = " << v.lpNorm<Infinity>() << endl;
+
cout << endl;
- cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "m.squaredNorm() = " << m.squaredNorm() << endl;
- cout << "n.squaredNorm() = " << n.squaredNorm() << endl;
+ cout << "m.norm() = " << m.norm() << endl;
+ cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << endl;
+ cout << "m.lpNorm<Infinity>() = " << m.lpNorm<Infinity>() << endl;
}
diff --git a/doc/snippets/JacobiSVD_basic.cpp b/doc/snippets/JacobiSVD_basic.cpp
new file mode 100644
index 000000000..ab24b9bca
--- /dev/null
+++ b/doc/snippets/JacobiSVD_basic.cpp
@@ -0,0 +1,9 @@
+MatrixXf m = MatrixXf::Random(3,2);
+cout << "Here is the matrix m:" << endl << m << endl;
+JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
+cout << "Its singular values are:" << endl << svd.singularValues() << endl;
+cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
+cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
+Vector3f rhs(1, 0, 0);
+cout << "Now consider this rhs vector:" << endl << rhs << endl;
+cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
diff --git a/doc/snippets/Jacobi_makeGivens.cpp b/doc/snippets/Jacobi_makeGivens.cpp
index 3a4defe24..4b733c306 100644
--- a/doc/snippets/Jacobi_makeGivens.cpp
+++ b/doc/snippets/Jacobi_makeGivens.cpp
@@ -1,5 +1,5 @@
Vector2f v = Vector2f::Random();
-PlanarRotation<float> G;
+JacobiRotation<float> G;
G.makeGivens(v.x(), v.y());
cout << "Here is the vector v:" << endl << v << endl;
v.applyOnTheLeft(0, 1, G.adjoint());
diff --git a/doc/snippets/Jacobi_makeJacobi.cpp b/doc/snippets/Jacobi_makeJacobi.cpp
index 5c0ab7374..0cc331d9f 100644
--- a/doc/snippets/Jacobi_makeJacobi.cpp
+++ b/doc/snippets/Jacobi_makeJacobi.cpp
@@ -1,6 +1,6 @@
Matrix2f m = Matrix2f::Random();
m = (m + m.adjoint()).eval();
-PlanarRotation<float> J;
+JacobiRotation<float> J;
J.makeJacobi(m, 0, 1);
cout << "Here is the matrix m:" << endl << m << endl;
m.applyOnTheLeft(0, 1, J.adjoint());
diff --git a/doc/snippets/Tridiagonalization_decomposeInPlace.cpp b/doc/snippets/Tridiagonalization_decomposeInPlace.cpp
index 1d0961aee..93dcfca1d 100644
--- a/doc/snippets/Tridiagonalization_decomposeInPlace.cpp
+++ b/doc/snippets/Tridiagonalization_decomposeInPlace.cpp
@@ -4,7 +4,7 @@ cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;
VectorXd diag(5);
VectorXd subdiag(4);
-ei_tridiagonalization_inplace(A, diag, subdiag, true);
+internal::tridiagonalization_inplace(A, diag, subdiag, true);
cout << "The orthogonal matrix Q is:" << endl << A << endl;
cout << "The diagonal of the tridiagonal matrix T is:" << endl << diag << endl;
cout << "The subdiagonal of the tridiagonal matrix T is:" << endl << subdiag << endl;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 95115e9d5..507eef31d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -13,7 +13,7 @@ if(GSL_FOUND)
ei_add_property(EIGEN_TESTED_BACKENDS "GSL, ")
else(GSL_FOUND)
ei_add_property(EIGEN_MISSING_BACKENDS "GSL, ")
- set(GSL_LIBRARIES " ")
+ set(GSL_LIBRARIES "")
endif(GSL_FOUND)
@@ -76,7 +76,7 @@ ei_add_test(product_trsolve)
ei_add_test(product_notemporary)
ei_add_test(stable_norm)
ei_add_test(bandmatrix)
-ei_add_test(cholesky " " "${GSL_LIBRARIES}")
+ei_add_test(cholesky "" "${GSL_LIBRARIES}")
ei_add_test(lu)
ei_add_test(determinant)
ei_add_test(inverse)
@@ -87,10 +87,10 @@ ei_add_test(upperbidiagonalization)
ei_add_test(hessenberg)
ei_add_test(schur_real)
ei_add_test(schur_complex)
-ei_add_test(eigensolver_selfadjoint " " "${GSL_LIBRARIES}")
-ei_add_test(eigensolver_generic " " "${GSL_LIBRARIES}")
+ei_add_test(eigensolver_selfadjoint "" "${GSL_LIBRARIES}")
+ei_add_test(eigensolver_generic "" "${GSL_LIBRARIES}")
ei_add_test(eigensolver_complex)
-ei_add_test(svd)
+ei_add_test(jacobi)
ei_add_test(jacobisvd)
ei_add_test(geo_orthomethods)
ei_add_test(geo_homogeneous)
@@ -103,14 +103,15 @@ ei_add_test(geo_alignedbox)
ei_add_test(stdvector)
ei_add_test(stdvector_overload)
ei_add_test(stdlist)
+ei_add_test(stddeque)
ei_add_test(resize)
if(QT4_FOUND)
- ei_add_test(qtvector " " "${QT_QTCORE_LIBRARY}")
+ ei_add_test(qtvector "" "${QT_QTCORE_LIBRARY}")
endif(QT4_FOUND)
ei_add_test(sparse_vector)
ei_add_test(sparse_basic)
ei_add_test(sparse_product)
-ei_add_test(sparse_solvers " " "${SPARSE_LIBS}")
+ei_add_test(sparse_solvers "" "${SPARSE_LIBS}")
ei_add_test(umeyama)
ei_add_test(householder)
ei_add_test(swap)
diff --git a/test/adjoint.cpp b/test/adjoint.cpp
index 2cf9ef380..72cbf3406 100644
--- a/test/adjoint.cpp
+++ b/test/adjoint.cpp
@@ -41,7 +41,7 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
Index cols = m.cols();
RealScalar largerEps = test_precision<RealScalar>();
- if (ei_is_same_type<RealScalar,float>::ret)
+ if (internal::is_same<RealScalar,float>::value)
largerEps = RealScalar(1e-3f);
MatrixType m1 = MatrixType::Random(rows, cols),
@@ -55,8 +55,8 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
v3 = VectorType::Random(rows),
vzero = VectorType::Zero(rows);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
// check basic compatibility of adjoint, transpose, conjugate
VERIFY_IS_APPROX(m1.transpose().conjugate().adjoint(), m1);
@@ -64,26 +64,26 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
// check multiplicative behavior
VERIFY_IS_APPROX((m1.adjoint() * m2).adjoint(), m2.adjoint() * m1);
- VERIFY_IS_APPROX((s1 * m1).adjoint(), ei_conj(s1) * m1.adjoint());
+ VERIFY_IS_APPROX((s1 * m1).adjoint(), internal::conj(s1) * m1.adjoint());
// check basic properties of dot, norm, norm2
typedef typename NumTraits<Scalar>::Real RealScalar;
- VERIFY(ei_isApprox((s1 * v1 + s2 * v2).dot(v3), ei_conj(s1) * v1.dot(v3) + ei_conj(s2) * v2.dot(v3), largerEps));
- VERIFY(ei_isApprox(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), largerEps));
- VERIFY_IS_APPROX(ei_conj(v1.dot(v2)), v2.dot(v1));
- VERIFY_IS_APPROX(ei_abs(v1.dot(v1)), v1.squaredNorm());
+ VERIFY(internal::isApprox((s1 * v1 + s2 * v2).dot(v3), internal::conj(s1) * v1.dot(v3) + internal::conj(s2) * v2.dot(v3), largerEps));
+ VERIFY(internal::isApprox(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), largerEps));
+ VERIFY_IS_APPROX(internal::conj(v1.dot(v2)), v2.dot(v1));
+ VERIFY_IS_APPROX(internal::abs(v1.dot(v1)), v1.squaredNorm());
if(!NumTraits<Scalar>::IsInteger)
VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(vzero.dot(v1)), static_cast<RealScalar>(1));
+ VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(vzero.dot(v1)), static_cast<RealScalar>(1));
// check compatibility of dot and adjoint
- VERIFY(ei_isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps));
+ VERIFY(internal::isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps));
// like in testBasicStuff, test operator() to check const-qualification
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
- VERIFY_IS_APPROX(m1.conjugate()(r,c), ei_conj(m1(r,c)));
- VERIFY_IS_APPROX(m1.adjoint()(c,r), ei_conj(m1(r,c)));
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
+ VERIFY_IS_APPROX(m1.conjugate()(r,c), internal::conj(m1(r,c)));
+ VERIFY_IS_APPROX(m1.adjoint()(c,r), internal::conj(m1(r,c)));
if(!NumTraits<Scalar>::IsInteger)
{
diff --git a/test/array.cpp b/test/array.cpp
index 332861168..72d3584e6 100644
--- a/test/array.cpp
+++ b/test/array.cpp
@@ -42,8 +42,8 @@ template<typename ArrayType> void array(const ArrayType& m)
ColVectorType cv1 = ColVectorType::Random(rows);
RowVectorType rv1 = RowVectorType::Random(cols);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
// scalar addition
VERIFY_IS_APPROX(m1 + s1, s1 + m1);
@@ -62,9 +62,9 @@ template<typename ArrayType> void array(const ArrayType& m)
// reductions
VERIFY_IS_APPROX(m1.colwise().sum().sum(), m1.sum());
VERIFY_IS_APPROX(m1.rowwise().sum().sum(), m1.sum());
- if (!ei_isApprox(m1.sum(), (m1+m2).sum()))
+ if (!internal::isApprox(m1.sum(), (m1+m2).sum()))
VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum());
- VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(ei_scalar_sum_op<Scalar>()));
+ VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op<Scalar>()));
// vector-wise ops
m3 = m1;
@@ -87,8 +87,8 @@ template<typename ArrayType> void comparisons(const ArrayType& m)
Index rows = m.rows();
Index cols = m.cols();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
ArrayType m1 = ArrayType::Random(rows, cols),
m2 = ArrayType::Random(rows, cols),
@@ -116,7 +116,7 @@ template<typename ArrayType> void comparisons(const ArrayType& m)
Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2);
for (int j=0; j<cols; ++j)
for (int i=0; i<rows; ++i)
- m3(i,j) = ei_abs(m1(i,j))<mid ? 0 : m1(i,j);
+ m3(i,j) = internal::abs(m1(i,j))<mid ? 0 : m1(i,j);
VERIFY_IS_APPROX( (m1.abs()<ArrayType::Constant(rows,cols,mid))
.select(ArrayType::Zero(rows,cols),m1), m3);
// shorter versions:
@@ -151,28 +151,28 @@ template<typename ArrayType> void array_real(const ArrayType& m)
m3(rows, cols);
VERIFY_IS_APPROX(m1.sin(), std::sin(m1));
- VERIFY_IS_APPROX(m1.sin(), ei_sin(m1));
+ VERIFY_IS_APPROX(m1.sin(), internal::sin(m1));
VERIFY_IS_APPROX(m1.cos(), std::cos(m1));
- VERIFY_IS_APPROX(m1.cos(), ei_cos(m1));
+ VERIFY_IS_APPROX(m1.cos(), internal::cos(m1));
- VERIFY_IS_APPROX(ei_cos(m1+RealScalar(3)*m2), ei_cos((m1+RealScalar(3)*m2).eval()));
+ VERIFY_IS_APPROX(internal::cos(m1+RealScalar(3)*m2), internal::cos((m1+RealScalar(3)*m2).eval()));
VERIFY_IS_APPROX(std::cos(m1+RealScalar(3)*m2), std::cos((m1+RealScalar(3)*m2).eval()));
VERIFY_IS_APPROX(m1.abs().sqrt(), std::sqrt(std::abs(m1)));
- VERIFY_IS_APPROX(m1.abs().sqrt(), ei_sqrt(ei_abs(m1)));
- VERIFY_IS_APPROX(m1.abs(), ei_sqrt(ei_abs2(m1)));
+ VERIFY_IS_APPROX(m1.abs().sqrt(), internal::sqrt(internal::abs(m1)));
+ VERIFY_IS_APPROX(m1.abs(), internal::sqrt(internal::abs2(m1)));
- VERIFY_IS_APPROX(ei_abs2(ei_real(m1)) + ei_abs2(ei_imag(m1)), ei_abs2(m1));
- VERIFY_IS_APPROX(ei_abs2(std::real(m1)) + ei_abs2(std::imag(m1)), ei_abs2(m1));
+ VERIFY_IS_APPROX(internal::abs2(internal::real(m1)) + internal::abs2(internal::imag(m1)), internal::abs2(m1));
+ VERIFY_IS_APPROX(internal::abs2(std::real(m1)) + internal::abs2(std::imag(m1)), internal::abs2(m1));
if(!NumTraits<Scalar>::IsComplex)
- VERIFY_IS_APPROX(ei_real(m1), m1);
+ VERIFY_IS_APPROX(internal::real(m1), m1);
VERIFY_IS_APPROX(m1.abs().log(), std::log(std::abs(m1)));
- VERIFY_IS_APPROX(m1.abs().log(), ei_log(ei_abs(m1)));
+ VERIFY_IS_APPROX(m1.abs().log(), internal::log(internal::abs(m1)));
VERIFY_IS_APPROX(m1.exp(), std::exp(m1));
VERIFY_IS_APPROX(m1.exp() * m2.exp(), std::exp(m1+m2));
- VERIFY_IS_APPROX(m1.exp(), ei_exp(m1));
+ VERIFY_IS_APPROX(m1.exp(), internal::exp(m1));
VERIFY_IS_APPROX(m1.exp() / m2.exp(), std::exp(m1-m2));
VERIFY_IS_APPROX(m1.pow(2), m1.square());
@@ -206,11 +206,11 @@ void test_array()
CALL_SUBTEST_5( array_real(ArrayXXf(8, 12)) );
}
- VERIFY((ei_is_same_type< ei_global_math_functions_filtering_base<int>::type, int >::ret));
- VERIFY((ei_is_same_type< ei_global_math_functions_filtering_base<float>::type, float >::ret));
- VERIFY((ei_is_same_type< ei_global_math_functions_filtering_base<Array2i>::type, ArrayBase<Array2i> >::ret));
- typedef CwiseUnaryOp<ei_scalar_sum_op<double>, ArrayXd > Xpr;
- VERIFY((ei_is_same_type< ei_global_math_functions_filtering_base<Xpr>::type,
+ VERIFY((internal::is_same< internal::global_math_functions_filtering_base<int>::type, int >::value));
+ VERIFY((internal::is_same< internal::global_math_functions_filtering_base<float>::type, float >::value));
+ VERIFY((internal::is_same< internal::global_math_functions_filtering_base<Array2i>::type, ArrayBase<Array2i> >::value));
+ typedef CwiseUnaryOp<internal::scalar_sum_op<double>, ArrayXd > Xpr;
+ VERIFY((internal::is_same< internal::global_math_functions_filtering_base<Xpr>::type,
ArrayBase<Xpr>
- >::ret));
+ >::value));
}
diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp
index 3699b861a..b7671ccda 100644
--- a/test/array_for_matrix.cpp
+++ b/test/array_for_matrix.cpp
@@ -42,8 +42,8 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
ColVectorType cv1 = ColVectorType::Random(rows);
RowVectorType rv1 = RowVectorType::Random(cols);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
// scalar addition
VERIFY_IS_APPROX(m1.array() + s1, s1 + m1.array());
@@ -59,9 +59,9 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
// reductions
VERIFY_IS_APPROX(m1.colwise().sum().sum(), m1.sum());
VERIFY_IS_APPROX(m1.rowwise().sum().sum(), m1.sum());
- if (!ei_isApprox(m1.sum(), (m1+m2).sum()))
+ if (!internal::isApprox(m1.sum(), (m1+m2).sum()))
VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum());
- VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(ei_scalar_sum_op<Scalar>()));
+ VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op<Scalar>()));
// vector-wise ops
m3 = m1;
@@ -88,8 +88,8 @@ template<typename MatrixType> void comparisons(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
MatrixType m1 = MatrixType::Random(rows, cols),
m2 = MatrixType::Random(rows, cols),
@@ -117,7 +117,7 @@ template<typename MatrixType> void comparisons(const MatrixType& m)
Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2);
for (int j=0; j<cols; ++j)
for (int i=0; i<rows; ++i)
- m3(i,j) = ei_abs(m1(i,j))<mid ? 0 : m1(i,j);
+ m3(i,j) = internal::abs(m1(i,j))<mid ? 0 : m1(i,j);
VERIFY_IS_APPROX( (m1.array().abs()<MatrixType::Constant(rows,cols,mid).array())
.select(MatrixType::Zero(rows,cols),m1), m3);
// shorter versions:
@@ -144,8 +144,8 @@ template<typename VectorType> void lpNorm(const VectorType& v)
VERIFY_IS_APPROX(u.template lpNorm<Infinity>(), u.cwiseAbs().maxCoeff());
VERIFY_IS_APPROX(u.template lpNorm<1>(), u.cwiseAbs().sum());
- VERIFY_IS_APPROX(u.template lpNorm<2>(), ei_sqrt(u.array().abs().square().sum()));
- VERIFY_IS_APPROX(ei_pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.array().abs().pow(5).sum());
+ VERIFY_IS_APPROX(u.template lpNorm<2>(), internal::sqrt(u.array().abs().square().sum()));
+ VERIFY_IS_APPROX(internal::pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.array().abs().pow(5).sum());
}
void test_array_for_matrix()
diff --git a/test/array_replicate.cpp b/test/array_replicate.cpp
index cafdafef5..b3520b58c 100644
--- a/test/array_replicate.cpp
+++ b/test/array_replicate.cpp
@@ -47,8 +47,8 @@ template<typename MatrixType> void replicate(const MatrixType& m)
MatrixX x1, x2;
VectorX vx1;
- int f1 = ei_random<int>(1,10),
- f2 = ei_random<int>(1,10);
+ int f1 = internal::random<int>(1,10),
+ f2 = internal::random<int>(1,10);
x1.resize(rows*f1,cols*f2);
for(int j=0; j<f2; j++)
diff --git a/test/array_reverse.cpp b/test/array_reverse.cpp
index 1461900c3..fdede3760 100644
--- a/test/array_reverse.cpp
+++ b/test/array_reverse.cpp
@@ -104,10 +104,10 @@ template<typename MatrixType> void reverse(const MatrixType& m)
}
}
- Scalar x = ei_random<Scalar>();
+ Scalar x = internal::random<Scalar>();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
m1.reverse()(r, c) = x;
VERIFY_IS_APPROX(x, m1(rows - 1 - r, cols - 1 - c));
diff --git a/test/bandmatrix.cpp b/test/bandmatrix.cpp
index 2f228cdd2..6dfaa1879 100644
--- a/test/bandmatrix.cpp
+++ b/test/bandmatrix.cpp
@@ -78,10 +78,10 @@ void test_bandmatrix()
typedef BandMatrix<float>::Index Index;
for(int i = 0; i < 10*g_repeat ; i++) {
- Index rows = ei_random<Index>(1,10);
- Index cols = ei_random<Index>(1,10);
- Index sups = ei_random<Index>(0,cols-1);
- Index subs = ei_random<Index>(0,rows-1);
+ Index rows = internal::random<Index>(1,10);
+ Index cols = internal::random<Index>(1,10);
+ Index sups = internal::random<Index>(0,cols-1);
+ Index subs = internal::random<Index>(0,rows-1);
CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
}
}
diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp
index 4ff4a24fa..175f54009 100644
--- a/test/basicstuff.cpp
+++ b/test/basicstuff.cpp
@@ -50,10 +50,10 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
vzero = VectorType::Zero(rows);
SquareMatrixType sm1 = SquareMatrixType::Random(rows,rows), sm2(rows,rows);
- Scalar x = ei_random<Scalar>();
+ Scalar x = internal::random<Scalar>();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
m1.coeffRef(r,c) = x;
VERIFY_IS_APPROX(x, m1.coeff(r,c));
@@ -156,14 +156,14 @@ template<typename MatrixType> void basicStuffComplex(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
- VERIFY(ei_real(s1)==ei_real_ref(s1));
- VERIFY(ei_imag(s1)==ei_imag_ref(s1));
- ei_real_ref(s1) = ei_real(s2);
- ei_imag_ref(s1) = ei_imag(s2);
- VERIFY(ei_isApprox(s1, s2, NumTraits<RealScalar>::epsilon()));
+ VERIFY(internal::real(s1)==internal::real_ref(s1));
+ VERIFY(internal::imag(s1)==internal::imag_ref(s1));
+ internal::real_ref(s1) = internal::real(s2);
+ internal::imag_ref(s1) = internal::imag(s2);
+ VERIFY(internal::isApprox(s1, s2, NumTraits<RealScalar>::epsilon()));
// extended precision in Intel FPUs means that s1 == s2 in the line above is not guaranteed.
RealMatrixType rm1 = RealMatrixType::Random(rows,cols),
@@ -200,14 +200,14 @@ void test_basicstuff()
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( basicStuff(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( basicStuff(Matrix4d()) );
- CALL_SUBTEST_3( basicStuff(MatrixXcf(ei_random<int>(1,100), ei_random<int>(1,100))) );
- CALL_SUBTEST_4( basicStuff(MatrixXi(ei_random<int>(1,100), ei_random<int>(1,100))) );
- CALL_SUBTEST_5( basicStuff(MatrixXcd(ei_random<int>(1,100), ei_random<int>(1,100))) );
+ CALL_SUBTEST_3( basicStuff(MatrixXcf(internal::random<int>(1,100), internal::random<int>(1,100))) );
+ CALL_SUBTEST_4( basicStuff(MatrixXi(internal::random<int>(1,100), internal::random<int>(1,100))) );
+ CALL_SUBTEST_5( basicStuff(MatrixXcd(internal::random<int>(1,100), internal::random<int>(1,100))) );
CALL_SUBTEST_6( basicStuff(Matrix<float, 100, 100>()) );
- CALL_SUBTEST_7( basicStuff(Matrix<long double,Dynamic,Dynamic>(ei_random<int>(1,100),ei_random<int>(1,100))) );
+ CALL_SUBTEST_7( basicStuff(Matrix<long double,Dynamic,Dynamic>(internal::random<int>(1,100),internal::random<int>(1,100))) );
- CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(ei_random<int>(1,100), ei_random<int>(1,100))) );
- CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(ei_random<int>(1,100), ei_random<int>(1,100))) );
+ CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(internal::random<int>(1,100), internal::random<int>(1,100))) );
+ CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(internal::random<int>(1,100), internal::random<int>(1,100))) );
}
CALL_SUBTEST_2(casting());
diff --git a/test/block.cpp b/test/block.cpp
index 1c2e080ad..6c5681683 100644
--- a/test/block.cpp
+++ b/test/block.cpp
@@ -48,12 +48,12 @@ template<typename MatrixType> void block(const MatrixType& m)
v3 = VectorType::Random(rows),
vzero = VectorType::Zero(rows);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
- Index r1 = ei_random<Index>(0,rows-1);
- Index r2 = ei_random<Index>(r1,rows-1);
- Index c1 = ei_random<Index>(0,cols-1);
- Index c2 = ei_random<Index>(c1,cols-1);
+ Index r1 = internal::random<Index>(0,rows-1);
+ Index r2 = internal::random<Index>(r1,rows-1);
+ Index c1 = internal::random<Index>(0,cols-1);
+ Index c2 = internal::random<Index>(c1,cols-1);
//check row() and col()
VERIFY_IS_EQUAL(m1.col(c1).transpose(), m1.transpose().row(c1));
@@ -100,16 +100,16 @@ template<typename MatrixType> void block(const MatrixType& m)
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.tail(2));
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.segment(i,2));
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.template segment<2>(i));
- i = ei_random<Index>(0,rows-2);
+ i = internal::random<Index>(0,rows-2);
VERIFY_IS_EQUAL(v1.segment(i,2), v1.template segment<2>(i));
}
// stress some basic stuffs with block matrices
- VERIFY(ei_real(ones.col(c1).sum()) == RealScalar(rows));
- VERIFY(ei_real(ones.row(r1).sum()) == RealScalar(cols));
+ VERIFY(internal::real(ones.col(c1).sum()) == RealScalar(rows));
+ VERIFY(internal::real(ones.row(r1).sum()) == RealScalar(cols));
- VERIFY(ei_real(ones.col(c1).dot(ones.col(c2))) == RealScalar(rows));
- VERIFY(ei_real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols));
+ VERIFY(internal::real(ones.col(c1).dot(ones.col(c2))) == RealScalar(rows));
+ VERIFY(internal::real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols));
// now test some block-inside-of-block.
@@ -197,10 +197,10 @@ void data_and_stride(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Index r1 = ei_random<Index>(0,rows-1);
- Index r2 = ei_random<Index>(r1,rows-1);
- Index c1 = ei_random<Index>(0,cols-1);
- Index c2 = ei_random<Index>(c1,cols-1);
+ Index r1 = internal::random<Index>(0,rows-1);
+ Index r2 = internal::random<Index>(r1,rows-1);
+ Index c1 = internal::random<Index>(0,cols-1);
+ Index c2 = internal::random<Index>(c1,cols-1);
MatrixType m1 = MatrixType::Random(rows, cols);
compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1));
@@ -224,8 +224,8 @@ void test_block()
CALL_SUBTEST_8( block(Matrix<float,Dynamic,4>(3, 4)) );
#ifndef EIGEN_DEFAULT_TO_ROW_MAJOR
- CALL_SUBTEST_6( data_and_stride(MatrixXf(ei_random(5,50), ei_random(5,50))) );
- CALL_SUBTEST_7( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(ei_random(5,50), ei_random(5,50))) );
+ CALL_SUBTEST_6( data_and_stride(MatrixXf(internal::random(5,50), internal::random(5,50))) );
+ CALL_SUBTEST_7( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(internal::random(5,50), internal::random(5,50))) );
#endif
}
}
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 46140bb11..1a6d4bed6 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -78,7 +78,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
//symm.template part<StrictlyLower>().setZero();
#ifdef HAS_GSL
-// if (ei_is_same_type<RealScalar,double>::ret)
+// if (internal::is_same<RealScalar,double>::value)
// {
// typedef GslTraits<Scalar> Gsl;
// typename Gsl::Matrix gMatA=0, gSymm=0;
@@ -128,7 +128,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
// LDLT
{
- int sign = ei_random<int>()%2 ? 1 : -1;
+ int sign = internal::random<int>()%2 ? 1 : -1;
if(sign == -1)
{
@@ -226,7 +226,7 @@ template<typename MatrixType> void cholesky_cplx(const MatrixType& m)
// LDLT
{
- int sign = ei_random<int>()%2 ? 1 : -1;
+ int sign = internal::random<int>()%2 ? 1 : -1;
if(sign == -1)
{
@@ -273,9 +273,9 @@ void test_cholesky()
CALL_SUBTEST_3( cholesky(Matrix2d()) );
CALL_SUBTEST_4( cholesky(Matrix3f()) );
CALL_SUBTEST_5( cholesky(Matrix4d()) );
- s = ei_random<int>(1,200);
+ s = internal::random<int>(1,200);
CALL_SUBTEST_2( cholesky(MatrixXd(s,s)) );
- s = ei_random<int>(1,100);
+ s = internal::random<int>(1,100);
CALL_SUBTEST_6( cholesky_cplx(MatrixXcd(s,s)) );
}
diff --git a/test/conservative_resize.cpp b/test/conservative_resize.cpp
index f428021dd..781cf5aad 100644
--- a/test/conservative_resize.cpp
+++ b/test/conservative_resize.cpp
@@ -52,8 +52,8 @@ void run_matrix_tests()
// random shrinking ...
for (int i=0; i<25; ++i)
{
- const Index rows = ei_random<Index>(1,50);
- const Index cols = ei_random<Index>(1,50);
+ const Index rows = internal::random<Index>(1,50);
+ const Index cols = internal::random<Index>(1,50);
m = n = MatrixType::Random(50,50);
m.conservativeResize(rows,cols);
VERIFY_IS_APPROX(m, n.block(0,0,rows,cols));
@@ -62,8 +62,8 @@ void run_matrix_tests()
// random growing with zeroing ...
for (int i=0; i<25; ++i)
{
- const Index rows = ei_random<Index>(50,75);
- const Index cols = ei_random<Index>(50,75);
+ const Index rows = internal::random<Index>(50,75);
+ const Index cols = internal::random<Index>(50,75);
m = n = MatrixType::Random(50,50);
m.conservativeResizeLike(MatrixType::Zero(rows,cols));
VERIFY_IS_APPROX(m.block(0,0,n.rows(),n.cols()), n);
@@ -91,7 +91,7 @@ void run_vector_tests()
// random shrinking ...
for (int i=0; i<50; ++i)
{
- const int size = ei_random<int>(1,50);
+ const int size = internal::random<int>(1,50);
m = n = MatrixType::Random(50);
m.conservativeResize(size);
VERIFY_IS_APPROX(m, n.segment(0,size));
@@ -100,7 +100,7 @@ void run_vector_tests()
// random growing with zeroing ...
for (int i=0; i<50; ++i)
{
- const int size = ei_random<int>(50,100);
+ const int size = internal::random<int>(50,100);
m = n = MatrixType::Random(50);
m.conservativeResizeLike(MatrixType::Zero(size));
VERIFY_IS_APPROX(m.segment(0,50), n);
diff --git a/test/corners.cpp b/test/corners.cpp
index fe2b205d7..8d12c6146 100644
--- a/test/corners.cpp
+++ b/test/corners.cpp
@@ -34,8 +34,8 @@ template<typename MatrixType> void corners(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Index r = ei_random<Index>(1,rows);
- Index c = ei_random<Index>(1,cols);
+ Index r = internal::random<Index>(1,rows);
+ Index c = internal::random<Index>(1,cols);
MatrixType matrix = MatrixType::Random(rows,cols);
const MatrixType const_matrix = MatrixType::Random(rows,cols);
@@ -45,10 +45,10 @@ template<typename MatrixType> void corners(const MatrixType& m)
COMPARE_CORNER(bottomLeftCorner(r,c), block(rows-r,0,r,c));
COMPARE_CORNER(bottomRightCorner(r,c), block(rows-r,cols-c,r,c));
- Index sr = ei_random<Index>(1,rows) - 1;
- Index nr = ei_random<Index>(1,rows-sr);
- Index sc = ei_random<Index>(1,cols) - 1;
- Index nc = ei_random<Index>(1,cols-sc);
+ Index sr = internal::random<Index>(1,rows) - 1;
+ Index nr = internal::random<Index>(1,rows-sr);
+ Index sc = internal::random<Index>(1,cols) - 1;
+ Index nc = internal::random<Index>(1,cols-sc);
COMPARE_CORNER(topRows(r), block(0,0,r,cols));
COMPARE_CORNER(middleRows(sr,nr), block(sr,0,nr,cols));
diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp
index 7533b7566..c63ace1cc 100644
--- a/test/cwiseop.cpp
+++ b/test/cwiseop.cpp
@@ -60,10 +60,10 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
vones = VectorType::Ones(rows),
v3(rows);
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
// test Zero, Ones, Constant, and the set* variants
m3 = MatrixType::Constant(rows, cols, s1);
diff --git a/test/determinant.cpp b/test/determinant.cpp
index 8112131b7..dcf64387d 100644
--- a/test/determinant.cpp
+++ b/test/determinant.cpp
@@ -38,14 +38,14 @@ template<typename MatrixType> void determinant(const MatrixType& m)
m1.setRandom();
m2.setRandom();
typedef typename MatrixType::Scalar Scalar;
- Scalar x = ei_random<Scalar>();
+ Scalar x = internal::random<Scalar>();
VERIFY_IS_APPROX(MatrixType::Identity(size, size).determinant(), Scalar(1));
VERIFY_IS_APPROX((m1*m2).eval().determinant(), m1.determinant() * m2.determinant());
if(size==1) return;
- Index i = ei_random<Index>(0, size-1);
+ Index i = internal::random<Index>(0, size-1);
Index j;
do {
- j = ei_random<Index>(0, size-1);
+ j = internal::random<Index>(0, size-1);
} while(j==i);
m2 = m1;
m2.row(i).swap(m2.row(j));
@@ -54,7 +54,7 @@ template<typename MatrixType> void determinant(const MatrixType& m)
m2.col(i).swap(m2.col(j));
VERIFY_IS_APPROX(m2.determinant(), -m1.determinant());
VERIFY_IS_APPROX(m2.determinant(), m2.transpose().determinant());
- VERIFY_IS_APPROX(ei_conj(m2.determinant()), m2.adjoint().determinant());
+ VERIFY_IS_APPROX(internal::conj(m2.determinant()), m2.adjoint().determinant());
m2 = m1;
m2.row(i) += x*m2.row(j);
VERIFY_IS_APPROX(m2.determinant(), m1.determinant());
diff --git a/test/diagonalmatrices.cpp b/test/diagonalmatrices.cpp
index 8408dda44..9d6f069c6 100644
--- a/test/diagonalmatrices.cpp
+++ b/test/diagonalmatrices.cpp
@@ -66,8 +66,8 @@ template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
sq_m1.transpose() = ldm1;
VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix());
- Index i = ei_random<Index>(0, rows-1);
- Index j = ei_random<Index>(0, cols-1);
+ Index i = internal::random<Index>(0, rows-1);
+ Index j = internal::random<Index>(0, cols-1);
VERIFY_IS_APPROX( ((ldm1 * m1)(i,j)) , ldm1.diagonal()(i) * m1(i,j) );
VERIFY_IS_APPROX( ((ldm1 * (m1+m2))(i,j)) , ldm1.diagonal()(i) * (m1+m2)(i,j) );
diff --git a/test/dynalloc.cpp b/test/dynalloc.cpp
index 26813ba0b..cd0062aac 100644
--- a/test/dynalloc.cpp
+++ b/test/dynalloc.cpp
@@ -34,11 +34,11 @@ void check_handmade_aligned_malloc()
{
for(int i = 1; i < 1000; i++)
{
- char *p = (char*)ei_handmade_aligned_malloc(i);
+ char *p = (char*)internal::handmade_aligned_malloc(i);
VERIFY(size_t(p)%ALIGNMENT==0);
// if the buffer is wrongly allocated this will give a bad write --> check with valgrind
for(int j = 0; j < i; j++) p[j]=0;
- ei_handmade_aligned_free(p);
+ internal::handmade_aligned_free(p);
}
}
@@ -46,11 +46,11 @@ void check_aligned_malloc()
{
for(int i = 1; i < 1000; i++)
{
- char *p = (char*)ei_aligned_malloc(i);
+ char *p = (char*)internal::aligned_malloc(i);
VERIFY(size_t(p)%ALIGNMENT==0);
// if the buffer is wrongly allocated this will give a bad write --> check with valgrind
for(int j = 0; j < i; j++) p[j]=0;
- ei_aligned_free(p);
+ internal::aligned_free(p);
}
}
@@ -58,11 +58,11 @@ void check_aligned_new()
{
for(int i = 1; i < 1000; i++)
{
- float *p = ei_aligned_new<float>(i);
+ float *p = internal::aligned_new<float>(i);
VERIFY(size_t(p)%ALIGNMENT==0);
// if the buffer is wrongly allocated this will give a bad write --> check with valgrind
for(int j = 0; j < i; j++) p[j]=0;
- ei_aligned_delete(p,i);
+ internal::aligned_delete(p,i);
}
}
diff --git a/test/eigen2support.cpp b/test/eigen2support.cpp
index 6684d1b9a..1c3686013 100644
--- a/test/eigen2support.cpp
+++ b/test/eigen2support.cpp
@@ -38,8 +38,8 @@ template<typename MatrixType> void eigen2support(const MatrixType& m)
m2 = MatrixType::Random(rows, cols),
m3(rows, cols);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
// scalar addition
VERIFY_IS_APPROX(m1.cwise() + s1, s1 + m1.cwise());
diff --git a/test/eigensolver_selfadjoint.cpp b/test/eigensolver_selfadjoint.cpp
index 3215d2184..dadf4bfca 100644
--- a/test/eigensolver_selfadjoint.cpp
+++ b/test/eigensolver_selfadjoint.cpp
@@ -63,7 +63,7 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
GeneralizedSelfAdjointEigenSolver<MatrixType> eiSymmGen(symmA, symmB);
#ifdef HAS_GSL
- if (ei_is_same_type<RealScalar,double>::ret)
+ if (internal::is_same<RealScalar,double>::value)
{
// restore symmA and symmB.
symmA = MatrixType(symmA.template selfadjointView<Lower>());
diff --git a/test/first_aligned.cpp b/test/first_aligned.cpp
index 687f4a5dc..b4ccb22cd 100644
--- a/test/first_aligned.cpp
+++ b/test/first_aligned.cpp
@@ -27,8 +27,8 @@
template<typename Scalar>
void test_first_aligned_helper(Scalar *array, int size)
{
- const int packet_size = sizeof(Scalar) * ei_packet_traits<Scalar>::size;
- VERIFY(((size_t(array) + sizeof(Scalar) * ei_first_aligned(array, size)) % packet_size) == 0);
+ const int packet_size = sizeof(Scalar) * internal::packet_traits<Scalar>::size;
+ VERIFY(((size_t(array) + sizeof(Scalar) * internal::first_aligned(array, size)) % packet_size) == 0);
}
template<typename Scalar>
@@ -36,7 +36,7 @@ void test_none_aligned_helper(Scalar *array, int size)
{
EIGEN_UNUSED_VARIABLE(array);
EIGEN_UNUSED_VARIABLE(size);
- VERIFY(ei_packet_traits<Scalar>::size == 1 || ei_first_aligned(array, size) == size);
+ VERIFY(internal::packet_traits<Scalar>::size == 1 || internal::first_aligned(array, size) == size);
}
struct some_non_vectorizable_type { float x; };
diff --git a/test/geo_alignedbox.cpp b/test/geo_alignedbox.cpp
index 65c232b96..738ca3150 100644
--- a/test/geo_alignedbox.cpp
+++ b/test/geo_alignedbox.cpp
@@ -46,7 +46,7 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
VectorType p1 = VectorType::Random(dim);
while( p1 == p0 ){
p1 = VectorType::Random(dim); }
- RealScalar s1 = ei_random<RealScalar>(0,1);
+ RealScalar s1 = internal::random<RealScalar>(0,1);
BoxType b0(dim);
BoxType b1(VectorType::Random(dim),VectorType::Random(dim));
@@ -124,7 +124,7 @@ void specificTest1()
VERIFY_IS_APPROX( 14.0f, box.volume() );
VERIFY_IS_APPROX( 53.0f, box.diagonal().squaredNorm() );
- VERIFY_IS_APPROX( ei_sqrt( 53.0f ), box.diagonal().norm() );
+ VERIFY_IS_APPROX( internal::sqrt( 53.0f ), box.diagonal().norm() );
VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeft ) );
VERIFY_IS_APPROX( M, box.corner( BoxType::TopRight ) );
diff --git a/test/geo_eulerangles.cpp b/test/geo_eulerangles.cpp
index bbc9ebb81..f82cb8fbe 100644
--- a/test/geo_eulerangles.cpp
+++ b/test/geo_eulerangles.cpp
@@ -34,7 +34,7 @@ template<typename Scalar> void eulerangles(void)
typedef Quaternion<Scalar> Quaternionx;
typedef AngleAxis<Scalar> AngleAxisx;
- Scalar a = ei_random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
+ Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
Quaternionx q1;
q1 = AngleAxisx(a, Vector3::Random().normalized());
Matrix3 m;
diff --git a/test/geo_homogeneous.cpp b/test/geo_homogeneous.cpp
index a0fee2f0c..124071f47 100644
--- a/test/geo_homogeneous.cpp
+++ b/test/geo_homogeneous.cpp
@@ -42,7 +42,7 @@ template<typename Scalar,int Size> void homogeneous(void)
typedef Matrix<Scalar,Size+1,Size> T3MatrixType;
Scalar largeEps = test_precision<Scalar>();
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
largeEps = 1e-3f;
VectorType v0 = VectorType::Random(),
diff --git a/test/geo_hyperplane.cpp b/test/geo_hyperplane.cpp
index bed6f5b40..23027f38e 100644
--- a/test/geo_hyperplane.cpp
+++ b/test/geo_hyperplane.cpp
@@ -51,8 +51,8 @@ template<typename HyperplaneType> void hyperplane(const HyperplaneType& _plane)
HyperplaneType pl1(n1, p1);
HyperplaneType pl2 = pl1;
- Scalar s0 = ei_random<Scalar>();
- Scalar s1 = ei_random<Scalar>();
+ Scalar s0 = internal::random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
VERIFY_IS_APPROX( n1.dot(n1), Scalar(1) );
@@ -103,8 +103,8 @@ template<typename Scalar> void lines()
Vector center = Vector::Random();
Vector u = Vector::Random();
Vector v = Vector::Random();
- Scalar a = ei_random<Scalar>();
- while (ei_abs(a-1) < 1e-4) a = ei_random<Scalar>();
+ Scalar a = internal::random<Scalar>();
+ while (internal::abs(a-1) < 1e-4) a = internal::random<Scalar>();
while (u.norm() < 1e-4) u = Vector::Random();
while (v.norm() < 1e-4) v = Vector::Random();
diff --git a/test/geo_orthomethods.cpp b/test/geo_orthomethods.cpp
index 8ed7195ec..9152d99c8 100644
--- a/test/geo_orthomethods.cpp
+++ b/test/geo_orthomethods.cpp
@@ -55,7 +55,7 @@ template<typename Scalar> void orthomethods_3()
mat3.setRandom();
Vector3 vec3 = Vector3::Random();
Matrix3 mcross;
- int i = ei_random<int>(0,2);
+ int i = internal::random<int>(0,2);
mcross = mat3.colwise().cross(vec3);
VERIFY_IS_APPROX(mcross.col(i), mat3.col(i).cross(vec3));
mcross = mat3.rowwise().cross(vec3);
@@ -97,7 +97,7 @@ template<typename Scalar, int Size> void orthomethods(int size=Size)
// colwise/rowwise cross product
Vector3 vec3 = Vector3::Random();
- int i = ei_random<int>(0,size-1);
+ int i = internal::random<int>(0,size-1);
Matrix3N mat3N(3,size), mcross3N(3,size);
mat3N.setRandom();
diff --git a/test/geo_parametrizedline.cpp b/test/geo_parametrizedline.cpp
index 3ffc378a6..36b38b979 100644
--- a/test/geo_parametrizedline.cpp
+++ b/test/geo_parametrizedline.cpp
@@ -48,8 +48,8 @@ template<typename LineType> void parametrizedline(const LineType& _line)
LineType l0(p0, d0);
- Scalar s0 = ei_random<Scalar>();
- Scalar s1 = ei_abs(ei_random<Scalar>());
+ Scalar s0 = internal::random<Scalar>();
+ Scalar s1 = internal::abs(internal::random<Scalar>());
VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0), RealScalar(1) );
VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0+s0*d0), RealScalar(1) );
diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp
index bfe15320a..aab7ed3f7 100644
--- a/test/geo_quaternion.cpp
+++ b/test/geo_quaternion.cpp
@@ -40,17 +40,17 @@ template<typename Scalar> void quaternion(void)
typedef AngleAxis<Scalar> AngleAxisx;
Scalar largeEps = test_precision<Scalar>();
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
largeEps = 1e-3f;
- Scalar eps = ei_random<Scalar>() * Scalar(1e-2);
+ Scalar eps = internal::random<Scalar>() * Scalar(1e-2);
Vector3 v0 = Vector3::Random(),
v1 = Vector3::Random(),
v2 = Vector3::Random(),
v3 = Vector3::Random();
- Scalar a = ei_random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
+ Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
// Quaternion: Identity(), setIdentity();
Quaternionx q1, q2;
@@ -66,13 +66,13 @@ template<typename Scalar> void quaternion(void)
q2 = AngleAxisx(a, v1.normalized());
// angular distance
- Scalar refangle = ei_abs(AngleAxisx(q1.inverse()*q2).angle());
+ Scalar refangle = internal::abs(AngleAxisx(q1.inverse()*q2).angle());
if (refangle>Scalar(M_PI))
refangle = Scalar(2)*Scalar(M_PI) - refangle;
if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps)
{
- VERIFY(ei_isApprox(q1.angularDistance(q2), refangle, largeEps));
+ VERIFY(internal::isApprox(q1.angularDistance(q2), refangle, largeEps));
}
// rotation matrix conversion
@@ -96,7 +96,7 @@ template<typename Scalar> void quaternion(void)
VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized());
VERIFY_IS_APPROX( v1.normalized(),(q2.setFromTwoVectors(v1, v1)*v1).normalized());
VERIFY_IS_APPROX(-v1.normalized(),(q2.setFromTwoVectors(v1,-v1)*v1).normalized());
- if (ei_is_same_type<Scalar,double>::ret)
+ if (internal::is_same<Scalar,double>::value)
{
v3 = (v1.array()+eps).matrix();
VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized());
diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp
index b9ea6bb91..ac0c7ecbf 100644
--- a/test/geo_transformations.cpp
+++ b/test/geo_transformations.cpp
@@ -51,7 +51,7 @@ template<typename Scalar, int Mode> void non_projective_only(void)
typedef Translation<Scalar,3> Translation3;
Scalar largeEps = test_precision<Scalar>();
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
largeEps = 1e-2f;
Vector3 v0 = Vector3::Random(),
@@ -59,7 +59,7 @@ template<typename Scalar, int Mode> void non_projective_only(void)
Transform3 t0, t1, t2;
- Scalar a = ei_random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
+ Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
Quaternionx q1, q2;
@@ -126,7 +126,7 @@ template<typename Scalar, int Mode> void transformations(void)
typedef Translation<Scalar,3> Translation3;
Scalar largeEps = test_precision<Scalar>();
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
largeEps = 1e-2f;
Vector3 v0 = Vector3::Random(),
@@ -135,12 +135,12 @@ template<typename Scalar, int Mode> void transformations(void)
Vector2 u0 = Vector2::Random();
Matrix3 matrot1, m;
- Scalar a = ei_random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
- Scalar s0 = ei_random<Scalar>();
+ Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
+ Scalar s0 = internal::random<Scalar>();
VERIFY_IS_APPROX(v0, AngleAxisx(a, v0.normalized()) * v0);
VERIFY_IS_APPROX(-v0, AngleAxisx(Scalar(M_PI), v0.unitOrthogonal()) * v0);
- VERIFY_IS_APPROX(ei_cos(a)*v0.squaredNorm(), v0.dot(AngleAxisx(a, v0.unitOrthogonal()) * v0));
+ VERIFY_IS_APPROX(internal::cos(a)*v0.squaredNorm(), v0.dot(AngleAxisx(a, v0.unitOrthogonal()) * v0));
m = AngleAxisx(a, v0.normalized()).toRotationMatrix().adjoint();
VERIFY_IS_APPROX(Matrix3::Identity(), m * AngleAxisx(a, v0.normalized()));
VERIFY_IS_APPROX(Matrix3::Identity(), AngleAxisx(a, v0.normalized()) * m);
@@ -180,8 +180,8 @@ template<typename Scalar, int Mode> void transformations(void)
// Transform
// TODO complete the tests !
a = 0;
- while (ei_abs(a)<Scalar(0.1))
- a = ei_random<Scalar>(-Scalar(0.4)*Scalar(M_PI), Scalar(0.4)*Scalar(M_PI));
+ while (internal::abs(a)<Scalar(0.1))
+ a = internal::random<Scalar>(-Scalar(0.4)*Scalar(M_PI), Scalar(0.4)*Scalar(M_PI));
q1 = AngleAxisx(a, v0.normalized());
Transform3 t0, t1, t2;
@@ -227,7 +227,7 @@ template<typename Scalar, int Mode> void transformations(void)
tmat4.matrix()(3,3) = Scalar(1);
VERIFY_IS_APPROX(tmat3.matrix(), tmat4.matrix());
- Scalar a3 = ei_random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
+ Scalar a3 = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
Vector3 v3 = Vector3::Random().normalized();
AngleAxisx aa3(a3, v3);
Transform3 t3(aa3);
@@ -274,7 +274,7 @@ template<typename Scalar, int Mode> void transformations(void)
Vector2 v20 = Vector2::Random();
Vector2 v21 = Vector2::Random();
for (int k=0; k<2; ++k)
- if (ei_abs(v21[k])<Scalar(1e-3)) v21[k] = Scalar(1e-3);
+ if (internal::abs(v21[k])<Scalar(1e-3)) v21[k] = Scalar(1e-3);
t21.setIdentity();
t21.linear() = Rotation2D<Scalar>(a).toRotationMatrix();
VERIFY_IS_APPROX(t20.fromPositionOrientationScale(v20,a,v21).matrix(),
@@ -411,7 +411,7 @@ template<typename Scalar, int Mode> void transformations(void)
AngleAxis<double> aa1d = aa1.template cast<double>();
VERIFY_IS_APPROX(aa1d.template cast<Scalar>(),aa1);
- Rotation2D<Scalar> r2d1(ei_random<Scalar>());
+ Rotation2D<Scalar> r2d1(internal::random<Scalar>());
Rotation2D<float> r2d1f = r2d1.template cast<float>();
VERIFY_IS_APPROX(r2d1f.template cast<Scalar>(),r2d1);
Rotation2D<double> r2d1d = r2d1.template cast<double>();
diff --git a/test/hessenberg.cpp b/test/hessenberg.cpp
index 35df3d58d..51e758bb3 100644
--- a/test/hessenberg.cpp
+++ b/test/hessenberg.cpp
@@ -69,8 +69,8 @@ void test_hessenberg()
CALL_SUBTEST_1(( hessenberg<std::complex<double>,1>() ));
CALL_SUBTEST_2(( hessenberg<std::complex<double>,2>() ));
CALL_SUBTEST_3(( hessenberg<std::complex<float>,4>() ));
- CALL_SUBTEST_4(( hessenberg<float,Dynamic>(ei_random<int>(1,320)) ));
- CALL_SUBTEST_5(( hessenberg<std::complex<double>,Dynamic>(ei_random<int>(1,320)) ));
+ CALL_SUBTEST_4(( hessenberg<float,Dynamic>(internal::random<int>(1,320)) ));
+ CALL_SUBTEST_5(( hessenberg<std::complex<double>,Dynamic>(internal::random<int>(1,320)) ));
// Test problem size constructors
CALL_SUBTEST_6(HessenbergDecomposition<MatrixXf>(10));
diff --git a/test/householder.cpp b/test/householder.cpp
index 1f22c6c53..244ae8e5f 100644
--- a/test/householder.cpp
+++ b/test/householder.cpp
@@ -39,7 +39,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
- typedef Matrix<Scalar, ei_decrement_size<MatrixType::RowsAtCompileTime>::ret, 1> EssentialVectorType;
+ typedef Matrix<Scalar, internal::decrement_size<MatrixType::RowsAtCompileTime>::ret, 1> EssentialVectorType;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
typedef Matrix<Scalar, Dynamic, MatrixType::ColsAtCompileTime> HBlockMatrixType;
typedef Matrix<Scalar, Dynamic, 1> HCoeffsVectorType;
@@ -77,8 +77,8 @@ template<typename MatrixType> void householder(const MatrixType& m)
m1.applyHouseholderOnTheLeft(essential,beta,tmp);
VERIFY_IS_APPROX(m1.norm(), m2.norm());
if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m1.block(1,0,rows-1,cols).norm(), m1.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(ei_imag(m1(0,0)), ei_real(m1(0,0)));
- VERIFY_IS_APPROX(ei_real(m1(0,0)), alpha);
+ VERIFY_IS_MUCH_SMALLER_THAN(internal::imag(m1(0,0)), internal::real(m1(0,0)));
+ VERIFY_IS_APPROX(internal::real(m1(0,0)), alpha);
v1 = VectorType::Random(rows);
if(even) v1.tail(rows-1).setZero();
@@ -89,12 +89,12 @@ template<typename MatrixType> void householder(const MatrixType& m)
m3.applyHouseholderOnTheRight(essential,beta,tmp);
VERIFY_IS_APPROX(m3.norm(), m4.norm());
if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m3.block(0,1,rows,rows-1).norm(), m3.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(ei_imag(m3(0,0)), ei_real(m3(0,0)));
- VERIFY_IS_APPROX(ei_real(m3(0,0)), alpha);
+ VERIFY_IS_MUCH_SMALLER_THAN(internal::imag(m3(0,0)), internal::real(m3(0,0)));
+ VERIFY_IS_APPROX(internal::real(m3(0,0)), alpha);
// test householder sequence on the left with a shift
- Index shift = ei_random<Index>(0, std::max<Index>(rows-2,0));
+ Index shift = internal::random<Index>(0, std::max<Index>(rows-2,0));
Index brows = rows - shift;
m1.setRandom(rows, cols);
HBlockMatrixType hbm = m1.block(shift,0,brows,cols);
diff --git a/test/integer_types.cpp b/test/integer_types.cpp
index 14f8eaa6e..b27bb0a2a 100644
--- a/test/integer_types.cpp
+++ b/test/integer_types.cpp
@@ -54,7 +54,7 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m
Scalar s1;
do {
- s1 = ei_random<Scalar>();
+ s1 = internal::random<Scalar>();
} while(s1 == 0);
VERIFY_IS_EQUAL(-(-m1), m1);
@@ -126,7 +126,7 @@ template<typename MatrixType> void integer_type_tests(const MatrixType& m)
Scalar s1;
do {
- s1 = ei_random<Scalar>();
+ s1 = internal::random<Scalar>();
} while(s1 == 0);
VERIFY_IS_EQUAL(m1+m1, 2*m1);
diff --git a/test/inverse.cpp b/test/inverse.cpp
index df11c0a4a..f0c69e78c 100644
--- a/test/inverse.cpp
+++ b/test/inverse.cpp
@@ -79,7 +79,7 @@ template<typename MatrixType> void inverse(const MatrixType& m)
MatrixType m3 = v3*v3.transpose(), m4(rows,cols);
m3.computeInverseAndDetWithCheck(m4, det, invertible);
VERIFY( rows==1 ? invertible : !invertible );
- VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(det-m3.determinant()), RealScalar(1));
+ VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(det-m3.determinant()), RealScalar(1));
m3.computeInverseWithCheck(m4, invertible);
VERIFY( rows==1 ? invertible : !invertible );
#endif
@@ -107,9 +107,9 @@ void test_inverse()
CALL_SUBTEST_3( inverse(Matrix3f()) );
CALL_SUBTEST_4( inverse(Matrix4f()) );
CALL_SUBTEST_4( inverse(Matrix<float,4,4,DontAlign>()) );
- s = ei_random<int>(50,320);
+ s = internal::random<int>(50,320);
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
- s = ei_random<int>(25,100);
+ s = internal::random<int>(25,100);
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );
CALL_SUBTEST_7( inverse(Matrix4d()) );
CALL_SUBTEST_7( inverse(Matrix<double,4,4,DontAlign>()) );
diff --git a/test/jacobi.cpp b/test/jacobi.cpp
new file mode 100644
index 000000000..6464c63c5
--- /dev/null
+++ b/test/jacobi.cpp
@@ -0,0 +1,96 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+//
+// Eigen is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#include "main.h"
+#include <Eigen/SVD>
+
+template<typename MatrixType, typename JacobiScalar>
+void jacobi(const MatrixType& m = MatrixType())
+{
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::Index Index;
+ Index rows = m.rows();
+ Index cols = m.cols();
+
+ enum {
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime
+ };
+
+ typedef Matrix<JacobiScalar, 2, 1> JacobiVector;
+
+ const MatrixType a(MatrixType::Random(rows, cols));
+
+ JacobiVector v = JacobiVector::Random().normalized();
+ JacobiScalar c = v.x(), s = v.y();
+ JacobiRotation<JacobiScalar> rot(c, s);
+
+ {
+ Index p = internal::random<Index>(0, rows-1);
+ Index q;
+ do {
+ q = internal::random<Index>(0, rows-1);
+ } while (q == p);
+
+ MatrixType b = a;
+ b.applyOnTheLeft(p, q, rot);
+ VERIFY_IS_APPROX(b.row(p), c * a.row(p) + internal::conj(s) * a.row(q));
+ VERIFY_IS_APPROX(b.row(q), -s * a.row(p) + internal::conj(c) * a.row(q));
+ }
+
+ {
+ Index p = internal::random<Index>(0, cols-1);
+ Index q;
+ do {
+ q = internal::random<Index>(0, cols-1);
+ } while (q == p);
+
+ MatrixType b = a;
+ b.applyOnTheRight(p, q, rot);
+ VERIFY_IS_APPROX(b.col(p), c * a.col(p) - s * a.col(q));
+ VERIFY_IS_APPROX(b.col(q), internal::conj(s) * a.col(p) + internal::conj(c) * a.col(q));
+ }
+}
+
+void test_jacobi()
+{
+ for(int i = 0; i < g_repeat; i++) {
+ CALL_SUBTEST_1(( jacobi<Matrix3f, float>() ));
+ CALL_SUBTEST_2(( jacobi<Matrix4d, double>() ));
+ CALL_SUBTEST_3(( jacobi<Matrix4cf, float>() ));
+ CALL_SUBTEST_3(( jacobi<Matrix4cf, std::complex<float> >() ));
+
+ int r = internal::random<int>(2, 20),
+ c = internal::random<int>(2, 20);
+ CALL_SUBTEST_4(( jacobi<MatrixXf, float>(MatrixXf(r,c)) ));
+ CALL_SUBTEST_5(( jacobi<MatrixXcd, double>(MatrixXcd(r,c)) ));
+ CALL_SUBTEST_5(( jacobi<MatrixXcd, std::complex<double> >(MatrixXcd(r,c)) ));
+ // complex<float> is really important to test as it is the only way to cover conjugation issues in certain unaligned paths
+ CALL_SUBTEST_6(( jacobi<MatrixXcf, float>(MatrixXcf(r,c)) ));
+ CALL_SUBTEST_6(( jacobi<MatrixXcf, std::complex<float> >(MatrixXcf(r,c)) ));
+ (void) r;
+ (void) c;
+ }
+}
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp
index 32b25f9d2..681852ffa 100644
--- a/test/jacobisvd.cpp
+++ b/test/jacobisvd.cpp
@@ -25,7 +25,6 @@
#include "main.h"
#include <Eigen/SVD>
-#include <Eigen/LU>
template<typename MatrixType, int QRPreconditioner>
void jacobisvd_check_full(const MatrixType& m, const JacobiSVD<MatrixType, QRPreconditioner>& svd)
@@ -68,15 +67,38 @@ void jacobisvd_compare_to_full(const MatrixType& m,
JacobiSVD<MatrixType, QRPreconditioner> svd(m, computationOptions);
- VERIFY_IS_EQUAL(svd.singularValues(), referenceSvd.singularValues());
+ VERIFY_IS_APPROX(svd.singularValues(), referenceSvd.singularValues());
if(computationOptions & ComputeFullU)
- VERIFY_IS_EQUAL(svd.matrixU(), referenceSvd.matrixU());
+ VERIFY_IS_APPROX(svd.matrixU(), referenceSvd.matrixU());
if(computationOptions & ComputeThinU)
- VERIFY_IS_EQUAL(svd.matrixU(), referenceSvd.matrixU().leftCols(diagSize));
+ VERIFY_IS_APPROX(svd.matrixU(), referenceSvd.matrixU().leftCols(diagSize));
if(computationOptions & ComputeFullV)
- VERIFY_IS_EQUAL(svd.matrixV(), referenceSvd.matrixV());
+ VERIFY_IS_APPROX(svd.matrixV(), referenceSvd.matrixV());
if(computationOptions & ComputeThinV)
- VERIFY_IS_EQUAL(svd.matrixV(), referenceSvd.matrixV().leftCols(diagSize));
+ VERIFY_IS_APPROX(svd.matrixV(), referenceSvd.matrixV().leftCols(diagSize));
+}
+
+template<typename MatrixType, int QRPreconditioner>
+void jacobisvd_solve(const MatrixType& m, unsigned int computationOptions)
+{
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::Index Index;
+ Index rows = m.rows();
+ Index cols = m.cols();
+
+ enum {
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime
+ };
+
+ typedef Matrix<Scalar, RowsAtCompileTime, Dynamic> RhsType;
+ typedef Matrix<Scalar, ColsAtCompileTime, Dynamic> SolutionType;
+
+ RhsType rhs = RhsType::Random(rows, internal::random<Index>(1, cols));
+ JacobiSVD<MatrixType, QRPreconditioner> svd(m, computationOptions);
+ SolutionType x = svd.solve(rhs);
+ // evaluate normal equation which works also for least-squares solutions
+ VERIFY_IS_APPROX(m.adjoint()*m*x,m.adjoint()*rhs);
}
template<typename MatrixType, int QRPreconditioner>
@@ -87,6 +109,7 @@ void jacobisvd_test_all_computation_options(const MatrixType& m)
JacobiSVD<MatrixType, QRPreconditioner> fullSvd(m, ComputeFullU|ComputeFullV);
jacobisvd_check_full(m, fullSvd);
+ jacobisvd_solve<MatrixType, QRPreconditioner>(m, ComputeFullU | ComputeFullV);
if(QRPreconditioner == FullPivHouseholderQRPreconditioner)
return;
@@ -102,6 +125,9 @@ void jacobisvd_test_all_computation_options(const MatrixType& m)
jacobisvd_compare_to_full(m, ComputeThinU|ComputeFullV, fullSvd);
jacobisvd_compare_to_full(m, ComputeThinU , fullSvd);
jacobisvd_compare_to_full(m, ComputeThinU|ComputeThinV, fullSvd);
+ jacobisvd_solve<MatrixType, QRPreconditioner>(m, ComputeFullU | ComputeThinV);
+ jacobisvd_solve<MatrixType, QRPreconditioner>(m, ComputeThinU | ComputeFullV);
+ jacobisvd_solve<MatrixType, QRPreconditioner>(m, ComputeThinU | ComputeThinV);
}
}
@@ -109,29 +135,116 @@ template<typename MatrixType>
void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true)
{
MatrixType m = pickrandom ? MatrixType::Random(a.rows(), a.cols()) : a;
+
jacobisvd_test_all_computation_options<MatrixType, FullPivHouseholderQRPreconditioner>(m);
jacobisvd_test_all_computation_options<MatrixType, ColPivHouseholderQRPreconditioner>(m);
jacobisvd_test_all_computation_options<MatrixType, HouseholderQRPreconditioner>(m);
jacobisvd_test_all_computation_options<MatrixType, NoQRPreconditioner>(m);
}
-template<typename MatrixType> void jacobisvd_verify_assert()
+template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m)
{
- MatrixType tmp;
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::Index Index;
+ Index rows = m.rows();
+ Index cols = m.cols();
+
+ enum {
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime
+ };
+
+ typedef Matrix<Scalar, RowsAtCompileTime, 1> RhsType;
+
+ RhsType rhs(rows);
JacobiSVD<MatrixType> svd;
- //VERIFY_RAISES_ASSERT(svd.solve(tmp, &tmp))
VERIFY_RAISES_ASSERT(svd.matrixU())
VERIFY_RAISES_ASSERT(svd.singularValues())
VERIFY_RAISES_ASSERT(svd.matrixV())
- /*VERIFY_RAISES_ASSERT(svd.computeUnitaryPositive(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computePositiveUnitary(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computeRotationScaling(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computeScalingRotation(&tmp,&tmp))*/
+ VERIFY_RAISES_ASSERT(svd.solve(rhs))
+
+ MatrixType a = MatrixType::Zero(rows, cols);
+ a.setZero();
+ svd.compute(a, 0);
+ VERIFY_RAISES_ASSERT(svd.matrixU())
+ VERIFY_RAISES_ASSERT(svd.matrixV())
+ svd.singularValues();
+ VERIFY_RAISES_ASSERT(svd.solve(rhs))
+
+ if (ColsAtCompileTime == Dynamic)
+ {
+ svd.compute(a, ComputeThinU);
+ svd.matrixU();
+ VERIFY_RAISES_ASSERT(svd.matrixV())
+ VERIFY_RAISES_ASSERT(svd.solve(rhs))
+
+ svd.compute(a, ComputeThinV);
+ svd.matrixV();
+ VERIFY_RAISES_ASSERT(svd.matrixU())
+ VERIFY_RAISES_ASSERT(svd.solve(rhs))
+
+ JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner> svd_fullqr;
+ VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeFullU|ComputeThinV))
+ VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeThinU|ComputeThinV))
+ VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeThinU|ComputeFullV))
+ }
+ else
+ {
+ VERIFY_RAISES_ASSERT(svd.compute(a, ComputeThinU))
+ VERIFY_RAISES_ASSERT(svd.compute(a, ComputeThinV))
+ }
+}
+
+template<typename MatrixType>
+void jacobisvd_method()
+{
+ enum { Size = MatrixType::RowsAtCompileTime };
+ typedef typename MatrixType::RealScalar RealScalar;
+ typedef Matrix<RealScalar, Size, 1> RealVecType;
+ MatrixType m = MatrixType::Identity();
+ VERIFY_IS_APPROX(m.jacobiSvd().singularValues(), RealVecType::Ones());
+ VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixU());
+ VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixV());
+ VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m);
+}
+
+// work around stupid msvc error when constructing at compile time an expression that involves
+// a division by zero, even if the numeric type has floating point
+template<typename Scalar>
+EIGEN_DONT_INLINE Scalar zero() { return Scalar(0); }
+
+template<typename MatrixType>
+void jacobisvd_inf_nan()
+{
+ // all this function does is verify we don't iterate infinitely on nan/inf values
+
+ JacobiSVD<MatrixType> svd;
+ typedef typename MatrixType::Scalar Scalar;
+ Scalar some_inf = Scalar(1) / zero<Scalar>();
+ VERIFY((some_inf - some_inf) != (some_inf - some_inf));
+ svd.compute(MatrixType::Constant(10,10,some_inf), ComputeFullU | ComputeFullV);
+
+ Scalar some_nan = zero<Scalar>() / zero<Scalar>();
+ VERIFY(some_nan != some_nan);
+ svd.compute(MatrixType::Constant(10,10,some_nan), ComputeFullU | ComputeFullV);
+
+ MatrixType m = MatrixType::Zero(10,10);
+ m(internal::random<int>(0,9), internal::random<int>(0,9)) = some_inf;
+ svd.compute(m, ComputeFullU | ComputeFullV);
+
+ m = MatrixType::Zero(10,10);
+ m(internal::random<int>(0,9), internal::random<int>(0,9)) = some_nan;
+ svd.compute(m, ComputeFullU | ComputeFullV);
}
void test_jacobisvd()
{
+ CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));
+ CALL_SUBTEST_4(( jacobisvd_verify_assert(Matrix4d()) ));
+ CALL_SUBTEST_7(( jacobisvd_verify_assert(MatrixXf(10,12)) ));
+ CALL_SUBTEST_8(( jacobisvd_verify_assert(MatrixXcd(7,5)) ));
+
for(int i = 0; i < g_repeat; i++) {
Matrix2cd m;
m << 0, 1,
@@ -140,26 +253,38 @@ void test_jacobisvd()
m << 1, 0,
1, 0;
CALL_SUBTEST_1(( jacobisvd(m, false) ));
+
Matrix2d n;
- n << 1, 1,
- 1, -1;
+ n << 0, 0,
+ 0, 0;
CALL_SUBTEST_2(( jacobisvd(n, false) ));
+ n << 0, 0,
+ 0, 1;
+ CALL_SUBTEST_2(( jacobisvd(n, false) ));
+
CALL_SUBTEST_3(( jacobisvd<Matrix3f>() ));
CALL_SUBTEST_4(( jacobisvd<Matrix4d>() ));
CALL_SUBTEST_5(( jacobisvd<Matrix<float,3,5> >() ));
CALL_SUBTEST_6(( jacobisvd<Matrix<double,Dynamic,2> >(Matrix<double,Dynamic,2>(10,2)) ));
- CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(50,50)) ));
- CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(14,7)) ));
+ int r = internal::random<int>(1, 30),
+ c = internal::random<int>(1, 30);
+ CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(r,c)) ));
+ CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(r,c)) ));
+ (void) r;
+ (void) c;
+
+ // Test on inf/nan matrix
+ CALL_SUBTEST_7( jacobisvd_inf_nan<MatrixXf>() );
}
- CALL_SUBTEST_9(( jacobisvd<MatrixXf>(MatrixXf(300,200)) ));
- CALL_SUBTEST_10(( jacobisvd<MatrixXcd>(MatrixXcd(100,150)) ));
- CALL_SUBTEST_3(( jacobisvd_verify_assert<Matrix3f>() ));
- CALL_SUBTEST_3(( jacobisvd_verify_assert<Matrix3d>() ));
- CALL_SUBTEST_9(( jacobisvd_verify_assert<MatrixXf>() ));
- CALL_SUBTEST_11(( jacobisvd_verify_assert<MatrixXd>() ));
+ CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(internal::random<int>(100, 150), internal::random<int>(100, 150))) ));
+ CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(internal::random<int>(80, 100), internal::random<int>(80, 100))) ));
+
+ // test matrixbase method
+ CALL_SUBTEST_1(( jacobisvd_method<Matrix2cd>() ));
+ CALL_SUBTEST_3(( jacobisvd_method<Matrix3f>() ));
// Test problem size constructors
- CALL_SUBTEST_12( JacobiSVD<MatrixXf>(10, 20) );
+ CALL_SUBTEST_7( JacobiSVD<MatrixXf>(10,10) );
}
diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp
index b5c58bdaa..312102701 100644
--- a/test/linearstructure.cpp
+++ b/test/linearstructure.cpp
@@ -42,11 +42,11 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
m3(rows, cols),
mzero = MatrixType::Zero(rows, cols);
- Scalar s1 = ei_random<Scalar>();
- while (ei_abs(s1)<1e-3) s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
+ while (internal::abs(s1)<1e-3) s1 = internal::random<Scalar>();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
VERIFY_IS_APPROX(-(-m1), m1);
VERIFY_IS_APPROX(m1+m1, 2*m1);
diff --git a/test/lu.cpp b/test/lu.cpp
index 8cb3cbbee..eac7c1ee6 100644
--- a/test/lu.cpp
+++ b/test/lu.cpp
@@ -37,7 +37,7 @@ template<typename MatrixType> void lu_non_invertible()
Index rows, cols, cols2;
if(MatrixType::RowsAtCompileTime==Dynamic)
{
- rows = ei_random<Index>(2,200);
+ rows = internal::random<Index>(2,200);
}
else
{
@@ -45,8 +45,8 @@ template<typename MatrixType> void lu_non_invertible()
}
if(MatrixType::ColsAtCompileTime==Dynamic)
{
- cols = ei_random<Index>(2,200);
- cols2 = ei_random<int>(2,200);
+ cols = internal::random<Index>(2,200);
+ cols2 = internal::random<int>(2,200);
}
else
{
@@ -57,14 +57,14 @@ template<typename MatrixType> void lu_non_invertible()
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime
};
- typedef typename ei_kernel_retval_base<FullPivLU<MatrixType> >::ReturnType KernelMatrixType;
- typedef typename ei_image_retval_base<FullPivLU<MatrixType> >::ReturnType ImageMatrixType;
+ typedef typename internal::kernel_retval_base<FullPivLU<MatrixType> >::ReturnType KernelMatrixType;
+ typedef typename internal::image_retval_base<FullPivLU<MatrixType> >::ReturnType ImageMatrixType;
typedef Matrix<typename MatrixType::Scalar, ColsAtCompileTime, ColsAtCompileTime>
CMatrixType;
typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime>
RMatrixType;
- Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
+ Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
// The image of the zero matrix should consist of a single (zero) column vector
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
@@ -117,7 +117,7 @@ template<typename MatrixType> void lu_invertible()
*/
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- int size = ei_random<int>(1,200);
+ int size = internal::random<int>(1,200);
MatrixType m1(size, size), m2(size, size), m3(size, size);
FullPivLU<MatrixType> lu;
@@ -149,7 +149,7 @@ template<typename MatrixType> void lu_partial_piv()
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- Index rows = ei_random<Index>(1,4);
+ Index rows = internal::random<Index>(1,4);
Index cols = rows;
MatrixType m1(cols, rows);
diff --git a/test/main.h b/test/main.h
index 8fa4ca8b5..fdd382492 100644
--- a/test/main.h
+++ b/test/main.h
@@ -71,10 +71,10 @@ namespace Eigen
static bool no_more_assert = false;
static bool report_on_cerr_on_assert_failure = true;
- struct ei_assert_exception
+ struct eigen_assert_exception
{
- ei_assert_exception(void) {}
- ~ei_assert_exception() { Eigen::no_more_assert = false; }
+ eigen_assert_exception(void) {}
+ ~eigen_assert_exception() { Eigen::no_more_assert = false; }
};
}
@@ -89,52 +89,52 @@ namespace Eigen
namespace Eigen
{
- static bool ei_push_assert = false;
- static std::vector<std::string> ei_assert_list;
+ static bool internal::push_assert = false;
+ static std::vector<std::string> eigen_assert_list;
}
- #define ei_assert(a) \
+ #define eigen_assert(a) \
if( (!(a)) && (!no_more_assert) ) \
{ \
if(report_on_cerr_on_assert_failure) \
std::cerr << #a << " " __FILE__ << "(" << __LINE__ << ")\n"; \
Eigen::no_more_assert = true; \
- throw Eigen::ei_assert_exception(); \
+ throw Eigen::eigen_assert_exception(); \
} \
- else if (Eigen::ei_push_assert) \
+ else if (Eigen::internal::push_assert) \
{ \
- ei_assert_list.push_back(std::string(EI_PP_MAKE_STRING(__FILE__)" ("EI_PP_MAKE_STRING(__LINE__)") : "#a) ); \
+ eigen_assert_list.push_back(std::string(EI_PP_MAKE_STRING(__FILE__)" ("EI_PP_MAKE_STRING(__LINE__)") : "#a) ); \
}
#define VERIFY_RAISES_ASSERT(a) \
{ \
Eigen::no_more_assert = false; \
- Eigen::ei_assert_list.clear(); \
- Eigen::ei_push_assert = true; \
+ Eigen::eigen_assert_list.clear(); \
+ Eigen::internal::push_assert = true; \
Eigen::report_on_cerr_on_assert_failure = false; \
try { \
a; \
std::cerr << "One of the following asserts should have been triggered:\n"; \
- for (uint ai=0 ; ai<ei_assert_list.size() ; ++ai) \
- std::cerr << " " << ei_assert_list[ai] << "\n"; \
+ for (uint ai=0 ; ai<eigen_assert_list.size() ; ++ai) \
+ std::cerr << " " << eigen_assert_list[ai] << "\n"; \
VERIFY(Eigen::should_raise_an_assert && # a); \
- } catch (Eigen::ei_assert_exception) { \
- Eigen::ei_push_assert = false; VERIFY(true); \
+ } catch (Eigen::eigen_assert_exception) { \
+ Eigen::internal::push_assert = false; VERIFY(true); \
} \
Eigen::report_on_cerr_on_assert_failure = true; \
- Eigen::ei_push_assert = false; \
+ Eigen::internal::push_assert = false; \
}
#else // EIGEN_DEBUG_ASSERTS
- #define ei_assert(a) \
+ #define eigen_assert(a) \
if( (!(a)) && (!no_more_assert) ) \
{ \
Eigen::no_more_assert = true; \
if(report_on_cerr_on_assert_failure) \
assert(a); \
else \
- throw Eigen::ei_assert_exception(); \
+ throw Eigen::eigen_assert_exception(); \
}
#define VERIFY_RAISES_ASSERT(a) { \
@@ -144,7 +144,7 @@ namespace Eigen
a; \
VERIFY(Eigen::should_raise_an_assert && # a); \
} \
- catch (Eigen::ei_assert_exception&) { VERIFY(true); } \
+ catch (Eigen::eigen_assert_exception&) { VERIFY(true); } \
Eigen::report_on_cerr_on_assert_failure = true; \
}
@@ -163,19 +163,25 @@ namespace Eigen
#include <Eigen/QR> // required for createRandomPIMatrixOfRank
-#define VERIFY(a) do { if (!(a)) { \
- std::cerr << "Test " << g_test_stack.back() << " failed in "EI_PP_MAKE_STRING(__FILE__) << " (" << EI_PP_MAKE_STRING(__LINE__) << ")" \
- << std::endl << " " << EI_PP_MAKE_STRING(a) << std::endl << std::endl; \
- exit(2); \
- } } while (0)
+static void verify_impl(bool condition, const char *testname, const char *file, int line, const char *condition_as_string)
+{
+ if (!condition)
+ {
+ std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" \
+ << std::endl << " " << condition_as_string << std::endl << std::endl; \
+ abort();
+ }
+}
+
+#define VERIFY(a) verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a))
#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b))
-#define VERIFY_IS_APPROX(a, b) VERIFY(test_ei_isApprox(a, b))
-#define VERIFY_IS_NOT_APPROX(a, b) VERIFY(!test_ei_isApprox(a, b))
-#define VERIFY_IS_MUCH_SMALLER_THAN(a, b) VERIFY(test_ei_isMuchSmallerThan(a, b))
-#define VERIFY_IS_NOT_MUCH_SMALLER_THAN(a, b) VERIFY(!test_ei_isMuchSmallerThan(a, b))
-#define VERIFY_IS_APPROX_OR_LESS_THAN(a, b) VERIFY(test_ei_isApproxOrLessThan(a, b))
-#define VERIFY_IS_NOT_APPROX_OR_LESS_THAN(a, b) VERIFY(!test_ei_isApproxOrLessThan(a, b))
+#define VERIFY_IS_APPROX(a, b) VERIFY(test_isApprox(a, b))
+#define VERIFY_IS_NOT_APPROX(a, b) VERIFY(!test_isApprox(a, b))
+#define VERIFY_IS_MUCH_SMALLER_THAN(a, b) VERIFY(test_isMuchSmallerThan(a, b))
+#define VERIFY_IS_NOT_MUCH_SMALLER_THAN(a, b) VERIFY(!test_isMuchSmallerThan(a, b))
+#define VERIFY_IS_APPROX_OR_LESS_THAN(a, b) VERIFY(test_isApproxOrLessThan(a, b))
+#define VERIFY_IS_NOT_APPROX_OR_LESS_THAN(a, b) VERIFY(!test_isApproxOrLessThan(a, b))
#define VERIFY_IS_UNITARY(a) VERIFY(test_isUnitary(a))
@@ -290,82 +296,82 @@ template<> inline float test_precision<std::complex<float> >() { return test_pre
template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }
template<> inline long double test_precision<long double>() { return 1e-6; }
-inline bool test_ei_isApprox(const int& a, const int& b)
-{ return ei_isApprox(a, b, test_precision<int>()); }
-inline bool test_ei_isMuchSmallerThan(const int& a, const int& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<int>()); }
-inline bool test_ei_isApproxOrLessThan(const int& a, const int& b)
-{ return ei_isApproxOrLessThan(a, b, test_precision<int>()); }
-
-inline bool test_ei_isApprox(const float& a, const float& b)
-{ return ei_isApprox(a, b, test_precision<float>()); }
-inline bool test_ei_isMuchSmallerThan(const float& a, const float& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<float>()); }
-inline bool test_ei_isApproxOrLessThan(const float& a, const float& b)
-{ return ei_isApproxOrLessThan(a, b, test_precision<float>()); }
-
-inline bool test_ei_isApprox(const double& a, const double& b)
+inline bool test_isApprox(const int& a, const int& b)
+{ return internal::isApprox(a, b, test_precision<int>()); }
+inline bool test_isMuchSmallerThan(const int& a, const int& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<int>()); }
+inline bool test_isApproxOrLessThan(const int& a, const int& b)
+{ return internal::isApproxOrLessThan(a, b, test_precision<int>()); }
+
+inline bool test_isApprox(const float& a, const float& b)
+{ return internal::isApprox(a, b, test_precision<float>()); }
+inline bool test_isMuchSmallerThan(const float& a, const float& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<float>()); }
+inline bool test_isApproxOrLessThan(const float& a, const float& b)
+{ return internal::isApproxOrLessThan(a, b, test_precision<float>()); }
+
+inline bool test_isApprox(const double& a, const double& b)
{
- bool ret = ei_isApprox(a, b, test_precision<double>());
+ bool ret = internal::isApprox(a, b, test_precision<double>());
if (!ret) std::cerr
<< std::endl << " actual = " << a
<< std::endl << " expected = " << b << std::endl << std::endl;
return ret;
}
-inline bool test_ei_isMuchSmallerThan(const double& a, const double& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<double>()); }
-inline bool test_ei_isApproxOrLessThan(const double& a, const double& b)
-{ return ei_isApproxOrLessThan(a, b, test_precision<double>()); }
+inline bool test_isMuchSmallerThan(const double& a, const double& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<double>()); }
+inline bool test_isApproxOrLessThan(const double& a, const double& b)
+{ return internal::isApproxOrLessThan(a, b, test_precision<double>()); }
-inline bool test_ei_isApprox(const std::complex<float>& a, const std::complex<float>& b)
-{ return ei_isApprox(a, b, test_precision<std::complex<float> >()); }
-inline bool test_ei_isMuchSmallerThan(const std::complex<float>& a, const std::complex<float>& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<std::complex<float> >()); }
+inline bool test_isApprox(const std::complex<float>& a, const std::complex<float>& b)
+{ return internal::isApprox(a, b, test_precision<std::complex<float> >()); }
+inline bool test_isMuchSmallerThan(const std::complex<float>& a, const std::complex<float>& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<std::complex<float> >()); }
-inline bool test_ei_isApprox(const std::complex<double>& a, const std::complex<double>& b)
-{ return ei_isApprox(a, b, test_precision<std::complex<double> >()); }
-inline bool test_ei_isMuchSmallerThan(const std::complex<double>& a, const std::complex<double>& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<std::complex<double> >()); }
+inline bool test_isApprox(const std::complex<double>& a, const std::complex<double>& b)
+{ return internal::isApprox(a, b, test_precision<std::complex<double> >()); }
+inline bool test_isMuchSmallerThan(const std::complex<double>& a, const std::complex<double>& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<std::complex<double> >()); }
-inline bool test_ei_isApprox(const long double& a, const long double& b)
+inline bool test_isApprox(const long double& a, const long double& b)
{
- bool ret = ei_isApprox(a, b, test_precision<long double>());
+ bool ret = internal::isApprox(a, b, test_precision<long double>());
if (!ret) std::cerr
<< std::endl << " actual = " << a
<< std::endl << " expected = " << b << std::endl << std::endl;
return ret;
}
-inline bool test_ei_isMuchSmallerThan(const long double& a, const long double& b)
-{ return ei_isMuchSmallerThan(a, b, test_precision<long double>()); }
-inline bool test_ei_isApproxOrLessThan(const long double& a, const long double& b)
-{ return ei_isApproxOrLessThan(a, b, test_precision<long double>()); }
+inline bool test_isMuchSmallerThan(const long double& a, const long double& b)
+{ return internal::isMuchSmallerThan(a, b, test_precision<long double>()); }
+inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
+{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }
template<typename Type1, typename Type2>
-inline bool test_ei_isApprox(const Type1& a, const Type2& b)
+inline bool test_isApprox(const Type1& a, const Type2& b)
{
return a.isApprox(b, test_precision<typename Type1::Scalar>());
}
template<typename Derived1, typename Derived2>
-inline bool test_ei_isMuchSmallerThan(const MatrixBase<Derived1>& m1,
+inline bool test_isMuchSmallerThan(const MatrixBase<Derived1>& m1,
const MatrixBase<Derived2>& m2)
{
- return m1.isMuchSmallerThan(m2, test_precision<typename ei_traits<Derived1>::Scalar>());
+ return m1.isMuchSmallerThan(m2, test_precision<typename internal::traits<Derived1>::Scalar>());
}
template<typename Derived>
-inline bool test_ei_isMuchSmallerThan(const MatrixBase<Derived>& m,
- const typename NumTraits<typename ei_traits<Derived>::Scalar>::Real& s)
+inline bool test_isMuchSmallerThan(const MatrixBase<Derived>& m,
+ const typename NumTraits<typename internal::traits<Derived>::Scalar>::Real& s)
{
- return m.isMuchSmallerThan(s, test_precision<typename ei_traits<Derived>::Scalar>());
+ return m.isMuchSmallerThan(s, test_precision<typename internal::traits<Derived>::Scalar>());
}
template<typename Derived>
inline bool test_isUnitary(const MatrixBase<Derived>& m)
{
- return m.isUnitary(test_precision<typename ei_traits<Derived>::Scalar>());
+ return m.isUnitary(test_precision<typename internal::traits<Derived>::Scalar>());
}
template<typename T, typename U>
@@ -388,8 +394,8 @@ bool test_is_equal(const T& actual, const U& expected)
template<typename MatrixType>
void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typename MatrixType::Index rows, typename MatrixType::Index cols, MatrixType& m)
{
- typedef typename ei_traits<MatrixType>::Index Index;
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
+ typedef typename internal::traits<MatrixType>::Index Index;
+ typedef typename internal::traits<MatrixType>::Scalar Scalar;
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
typedef Matrix<Scalar, Dynamic, 1> VectorType;
diff --git a/test/map.cpp b/test/map.cpp
index 9b0301ec0..aa954167a 100644
--- a/test/map.cpp
+++ b/test/map.cpp
@@ -32,8 +32,8 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
Index size = m.size();
// test Map.h
- Scalar* array1 = ei_aligned_new<Scalar>(size);
- Scalar* array2 = ei_aligned_new<Scalar>(size);
+ Scalar* array1 = internal::aligned_new<Scalar>(size);
+ Scalar* array2 = internal::aligned_new<Scalar>(size);
Scalar* array3 = new Scalar[size+1];
Scalar* array3unaligned = size_t(array3)%16 == 0 ? array3+1 : array3;
@@ -49,8 +49,8 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
VERIFY_RAISES_ASSERT((Map<VectorType,Aligned>(array3unaligned, size)))
#endif
- ei_aligned_delete(array1, size);
- ei_aligned_delete(array2, size);
+ internal::aligned_delete(array1, size);
+ internal::aligned_delete(array2, size);
delete[] array3;
}
@@ -62,9 +62,9 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m)
Index rows = m.rows(), cols = m.cols(), size = rows*cols;
// test Map.h
- Scalar* array1 = ei_aligned_new<Scalar>(size);
+ Scalar* array1 = internal::aligned_new<Scalar>(size);
for(int i = 0; i < size; i++) array1[i] = Scalar(1);
- Scalar* array2 = ei_aligned_new<Scalar>(size);
+ Scalar* array2 = internal::aligned_new<Scalar>(size);
for(int i = 0; i < size; i++) array2[i] = Scalar(1);
Scalar* array3 = new Scalar[size+1];
for(int i = 0; i < size+1; i++) array3[i] = Scalar(1);
@@ -78,8 +78,8 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m)
MatrixType ma3 = Map<MatrixType>(array3unaligned, rows, cols);
VERIFY_IS_EQUAL(ma1, ma3);
- ei_aligned_delete(array1, size);
- ei_aligned_delete(array2, size);
+ internal::aligned_delete(array1, size);
+ internal::aligned_delete(array2, size);
delete[] array3;
}
@@ -91,8 +91,8 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
Index size = m.size();
// test Map.h
- Scalar* array1 = ei_aligned_new<Scalar>(size);
- Scalar* array2 = ei_aligned_new<Scalar>(size);
+ Scalar* array1 = internal::aligned_new<Scalar>(size);
+ Scalar* array2 = internal::aligned_new<Scalar>(size);
Scalar* array3 = new Scalar[size+1];
Scalar* array3unaligned = size_t(array3)%16 == 0 ? array3+1 : array3;
@@ -105,8 +105,8 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
VERIFY_IS_EQUAL(ma1, ma2);
VERIFY_IS_EQUAL(ma1, ma3);
- ei_aligned_delete(array1, size);
- ei_aligned_delete(array2, size);
+ internal::aligned_delete(array1, size);
+ internal::aligned_delete(array2, size);
delete[] array3;
}
@@ -123,8 +123,8 @@ void test_map()
CALL_SUBTEST_1( map_class_matrix(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( map_class_matrix(Matrix4d()) );
CALL_SUBTEST_11( map_class_matrix(Matrix<float,3,5>()) );
- CALL_SUBTEST_4( map_class_matrix(MatrixXcf(ei_random<int>(1,10),ei_random<int>(1,10))) );
- CALL_SUBTEST_5( map_class_matrix(MatrixXi(ei_random<int>(1,10),ei_random<int>(1,10))) );
+ CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) );
+ CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random<int>(1,10),internal::random<int>(1,10))) );
CALL_SUBTEST_6( map_static_methods(Matrix<double, 1, 1>()) );
CALL_SUBTEST_7( map_static_methods(Vector3f()) );
diff --git a/test/mapstride.cpp b/test/mapstride.cpp
index 072b2134c..8ccd758f8 100644
--- a/test/mapstride.cpp
+++ b/test/mapstride.cpp
@@ -35,7 +35,7 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
Index arraysize = 3*size;
- Scalar* array = ei_aligned_new<Scalar>(arraysize);
+ Scalar* array = internal::aligned_new<Scalar>(arraysize);
{
Map<VectorType, Aligned, InnerStride<3> > map(array, size);
@@ -57,7 +57,7 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
}
}
- ei_aligned_delete(array, arraysize);
+ internal::aligned_delete(array, arraysize);
}
template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
@@ -71,7 +71,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
Index arraysize = 2*(rows+4)*(cols+4);
- Scalar* array = ei_aligned_new<Scalar>(arraysize);
+ Scalar* array = internal::aligned_new<Scalar>(arraysize);
// test no inner stride and some dynamic outer stride
{
@@ -119,7 +119,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
}
}
- ei_aligned_delete(array, arraysize);
+ internal::aligned_delete(array, arraysize);
}
void test_mapstride()
@@ -135,7 +135,7 @@ void test_mapstride()
CALL_SUBTEST_2( map_class_matrix(Matrix4d()) );
CALL_SUBTEST_3( map_class_matrix(Matrix<float,3,5>()) );
CALL_SUBTEST_3( map_class_matrix(Matrix<float,4,8>()) );
- CALL_SUBTEST_4( map_class_matrix(MatrixXcf(ei_random<int>(1,10),ei_random<int>(1,10))) );
- CALL_SUBTEST_5( map_class_matrix(MatrixXi(5,5)));//ei_random<int>(1,10),ei_random<int>(1,10))) );
+ CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) );
+ CALL_SUBTEST_5( map_class_matrix(MatrixXi(5,5)));//internal::random<int>(1,10),internal::random<int>(1,10))) );
}
}
diff --git a/test/meta.cpp b/test/meta.cpp
index 88d549a8a..9adb95034 100644
--- a/test/meta.cpp
+++ b/test/meta.cpp
@@ -29,33 +29,33 @@ void test_meta()
typedef float & FloatRef;
typedef const float & ConstFloatRef;
- VERIFY((ei_meta_if<(3<4),ei_meta_true, ei_meta_false>::ret::ret));
- VERIFY(( ei_is_same_type<float,float>::ret));
- VERIFY((!ei_is_same_type<float,double>::ret));
- VERIFY((!ei_is_same_type<float,float&>::ret));
- VERIFY((!ei_is_same_type<float,const float&>::ret));
+ VERIFY((internal::conditional<(3<4),internal::true_type, internal::false_type>::type::value));
+ VERIFY(( internal::is_same<float,float>::value));
+ VERIFY((!internal::is_same<float,double>::value));
+ VERIFY((!internal::is_same<float,float&>::value));
+ VERIFY((!internal::is_same<float,const float&>::value));
- VERIFY(( ei_is_same_type<float,ei_cleantype<const float&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<const float*>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<const float*&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<float**>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<float**&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<float* const *&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_cleantype<float* const>::type >::ret));
+ VERIFY(( internal::is_same<float,internal::remove_all<const float&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<const float*>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<const float*&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<float**>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<float**&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<float* const *&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_all<float* const>::type >::value));
- VERIFY(( ei_is_same_type<float*,ei_unconst<const float*>::type >::ret));
- VERIFY(( ei_is_same_type<float&,ei_unconst<const float&>::type >::ret));
- VERIFY(( ei_is_same_type<float&,ei_unconst<ConstFloatRef>::type >::ret));
+ VERIFY(( internal::is_same<float*,internal::remove_const<const float*>::type >::value));
+ VERIFY(( internal::is_same<float&,internal::remove_const<const float&>::type >::value));
+ VERIFY(( internal::is_same<float&,internal::remove_const<ConstFloatRef>::type >::value));
- VERIFY(( ei_is_same_type<float&,ei_unconst<float&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_unref<float&>::type >::ret));
- VERIFY(( ei_is_same_type<const float,ei_unref<const float&>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_unpointer<float*>::type >::ret));
- VERIFY(( ei_is_same_type<const float,ei_unpointer<const float*>::type >::ret));
- VERIFY(( ei_is_same_type<float,ei_unpointer<float* const >::type >::ret));
+ VERIFY(( internal::is_same<float&,internal::remove_const<float&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_reference<float&>::type >::value));
+ VERIFY(( internal::is_same<const float,internal::remove_reference<const float&>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_pointer<float*>::type >::value));
+ VERIFY(( internal::is_same<const float,internal::remove_pointer<const float*>::type >::value));
+ VERIFY(( internal::is_same<float,internal::remove_pointer<float* const >::type >::value));
- VERIFY(ei_meta_sqrt<1>::ret == 1);
- #define VERIFY_META_SQRT(X) VERIFY(ei_meta_sqrt<X>::ret == int(ei_sqrt(double(X))))
+ VERIFY(internal::meta_sqrt<1>::ret == 1);
+ #define VERIFY_META_SQRT(X) VERIFY(internal::meta_sqrt<X>::ret == int(internal::sqrt(double(X))))
VERIFY_META_SQRT(2);
VERIFY_META_SQRT(3);
VERIFY_META_SQRT(4);
diff --git a/test/miscmatrices.cpp b/test/miscmatrices.cpp
index b14bca61c..327ceaedb 100644
--- a/test/miscmatrices.cpp
+++ b/test/miscmatrices.cpp
@@ -36,7 +36,7 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Index r = ei_random<Index>(0, rows-1), r2 = ei_random<Index>(0, rows-1), c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1), r2 = internal::random<Index>(0, rows-1), c = internal::random<Index>(0, cols-1);
VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast<Scalar>(1));
MatrixType m1 = MatrixType::Ones(rows,cols);
VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1));
diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp
index 7673348b4..0ebd00d1d 100644
--- a/test/mixingtypes.cpp
+++ b/test/mixingtypes.cpp
@@ -59,10 +59,10 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
Vec_d vd = vf.template cast<double>();
Vec_cf vcf = Vec_cf::Random(size,1);
Vec_cd vcd = vcf.template cast<complex<double> >();
- float sf = ei_random<float>();
- double sd = ei_random<double>();
- complex<float> scf = ei_random<complex<float> >();
- complex<double> scd = ei_random<complex<double> >();
+ float sf = internal::random<float>();
+ double sd = internal::random<double>();
+ complex<float> scf = internal::random<complex<float> >();
+ complex<double> scd = internal::random<complex<double> >();
mf+mf;
@@ -144,5 +144,5 @@ void test_mixingtypes()
{
CALL_SUBTEST_1(mixingtypes<3>());
CALL_SUBTEST_2(mixingtypes<4>());
- CALL_SUBTEST_3(mixingtypes<Dynamic>(ei_random<int>(1,310)));
+ CALL_SUBTEST_3(mixingtypes<Dynamic>(internal::random<int>(1,310)));
}
diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp
index c1965a8ac..0e3caa4ae 100644
--- a/test/nomalloc.cpp
+++ b/test/nomalloc.cpp
@@ -62,10 +62,10 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
v2 = VectorType::Random(rows),
vzero = VectorType::Zero(rows);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1);
VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2);
VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c)));
@@ -125,8 +125,7 @@ void ctms_decompositions()
Eigen::FullPivHouseholderQR<Matrix> fpQR; fpQR.compute(A);
// SVD module
- Eigen::JacobiSVD<Matrix> jSVD; jSVD.compute(A);
- Eigen::SVD<Matrix> svd; svd.compute(A);
+ Eigen::JacobiSVD<Matrix> jSVD; jSVD.compute(A, ComputeFullU | ComputeFullV);
}
void test_nomalloc()
diff --git a/test/nullary.cpp b/test/nullary.cpp
index 78d2e9117..cc842203e 100644
--- a/test/nullary.cpp
+++ b/test/nullary.cpp
@@ -49,10 +49,10 @@ bool equalsIdentity(const MatrixType& A)
template<typename VectorType>
void testVectorType(const VectorType& base)
{
- typedef typename ei_traits<VectorType>::Index Index;
- typedef typename ei_traits<VectorType>::Scalar Scalar;
- Scalar low = ei_random<Scalar>(-500,500);
- Scalar high = ei_random<Scalar>(-500,500);
+ typedef typename internal::traits<VectorType>::Index Index;
+ typedef typename internal::traits<VectorType>::Scalar Scalar;
+ Scalar low = internal::random<Scalar>(-500,500);
+ Scalar high = internal::random<Scalar>(-500,500);
if (low>high) std::swap(low,high);
const Index size = base.size();
const Scalar step = (high-low)/(size-1);
@@ -71,6 +71,9 @@ void testVectorType(const VectorType& base)
m = VectorType::LinSpaced(size,low,high);
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
+ // Assignment of a RowVectorXd to a MatrixXd (regression test for bug #79).
+ VERIFY( (MatrixXd(RowVectorXd::LinSpaced(3, 0, 1)) - RowVector3d(0, 0.5, 1)).norm() < std::numeric_limits<Scalar>::epsilon() );
+
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
//VERIFY( m(m.size()-1) == high );
//VERIFY( m(0) == low );
diff --git a/test/packetmath.cpp b/test/packetmath.cpp
index 0eb3d7f51..001dbc4d2 100644
--- a/test/packetmath.cpp
+++ b/test/packetmath.cpp
@@ -27,11 +27,15 @@
// using namespace Eigen;
-template<typename T> T ei_negate(const T& x) { return -x; }
+namespace Eigen {
+namespace internal {
+template<typename T> T negate(const T& x) { return -x; }
+}
+}
template<typename Scalar> bool isApproxAbs(const Scalar& a, const Scalar& b, const typename NumTraits<Scalar>::Real& refvalue)
{
- return ei_isMuchSmallerThan(a-b, refvalue);
+ return internal::isMuchSmallerThan(a-b, refvalue);
}
template<typename Scalar> bool areApproxAbs(const Scalar* a, const Scalar* b, int size, const typename NumTraits<Scalar>::Real& refvalue)
@@ -51,7 +55,7 @@ template<typename Scalar> bool areApprox(const Scalar* a, const Scalar* b, int s
{
for (int i=0; i<size; ++i)
{
- if (!ei_isApprox(a[i],b[i]))
+ if (!internal::isApprox(a[i],b[i]))
{
std::cout << "a[" << i << "]: " << a[i] << " != b[" << i << "]: " << b[i] << std::endl;
return false;
@@ -64,14 +68,14 @@ template<typename Scalar> bool areApprox(const Scalar* a, const Scalar* b, int s
#define CHECK_CWISE2(REFOP, POP) { \
for (int i=0; i<PacketSize; ++i) \
ref[i] = REFOP(data1[i], data1[i+PacketSize]); \
- ei_pstore(data2, POP(ei_pload<Packet>(data1), ei_pload<Packet>(data1+PacketSize))); \
+ internal::pstore(data2, POP(internal::pload<Packet>(data1), internal::pload<Packet>(data1+PacketSize))); \
VERIFY(areApprox(ref, data2, PacketSize) && #POP); \
}
#define CHECK_CWISE1(REFOP, POP) { \
for (int i=0; i<PacketSize; ++i) \
ref[i] = REFOP(data1[i]); \
- ei_pstore(data2, POP(ei_pload<Packet>(data1))); \
+ internal::pstore(data2, POP(internal::pload<Packet>(data1))); \
VERIFY(areApprox(ref, data2, PacketSize) && #POP); \
}
@@ -79,10 +83,10 @@ template<bool Cond,typename Packet>
struct packet_helper
{
template<typename T>
- inline Packet load(const T* from) const { return ei_pload<Packet>(from); }
+ inline Packet load(const T* from) const { return internal::pload<Packet>(from); }
template<typename T>
- inline void store(T* to, const Packet& x) const { ei_pstore(to,x); }
+ inline void store(T* to, const Packet& x) const { internal::pstore(to,x); }
};
template<typename Packet>
@@ -110,150 +114,150 @@ struct packet_helper<false,Packet>
template<typename Scalar> void packetmath()
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- const int PacketSize = ei_packet_traits<Scalar>::size;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
+ const int PacketSize = internal::packet_traits<Scalar>::size;
typedef typename NumTraits<Scalar>::Real RealScalar;
const int size = PacketSize*4;
- EIGEN_ALIGN16 Scalar data1[ei_packet_traits<Scalar>::size*4];
- EIGEN_ALIGN16 Scalar data2[ei_packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar data1[internal::packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar data2[internal::packet_traits<Scalar>::size*4];
EIGEN_ALIGN16 Packet packets[PacketSize*2];
- EIGEN_ALIGN16 Scalar ref[ei_packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar ref[internal::packet_traits<Scalar>::size*4];
RealScalar refvalue = 0;
for (int i=0; i<size; ++i)
{
- data1[i] = ei_random<Scalar>();
- data2[i] = ei_random<Scalar>();
- refvalue = std::max(refvalue,ei_abs(data1[i]));
+ data1[i] = internal::random<Scalar>();
+ data2[i] = internal::random<Scalar>();
+ refvalue = std::max(refvalue,internal::abs(data1[i]));
}
- ei_pstore(data2, ei_pload<Packet>(data1));
+ internal::pstore(data2, internal::pload<Packet>(data1));
VERIFY(areApprox(data1, data2, PacketSize) && "aligned load/store");
for (int offset=0; offset<PacketSize; ++offset)
{
- ei_pstore(data2, ei_ploadu<Packet>(data1+offset));
- VERIFY(areApprox(data1+offset, data2, PacketSize) && "ei_ploadu");
+ internal::pstore(data2, internal::ploadu<Packet>(data1+offset));
+ VERIFY(areApprox(data1+offset, data2, PacketSize) && "internal::ploadu");
}
for (int offset=0; offset<PacketSize; ++offset)
{
- ei_pstoreu(data2+offset, ei_pload<Packet>(data1));
- VERIFY(areApprox(data1, data2+offset, PacketSize) && "ei_pstoreu");
+ internal::pstoreu(data2+offset, internal::pload<Packet>(data1));
+ VERIFY(areApprox(data1, data2+offset, PacketSize) && "internal::pstoreu");
}
for (int offset=0; offset<PacketSize; ++offset)
{
- packets[0] = ei_pload<Packet>(data1);
- packets[1] = ei_pload<Packet>(data1+PacketSize);
- if (offset==0) ei_palign<0>(packets[0], packets[1]);
- else if (offset==1) ei_palign<1>(packets[0], packets[1]);
- else if (offset==2) ei_palign<2>(packets[0], packets[1]);
- else if (offset==3) ei_palign<3>(packets[0], packets[1]);
- ei_pstore(data2, packets[0]);
+ packets[0] = internal::pload<Packet>(data1);
+ packets[1] = internal::pload<Packet>(data1+PacketSize);
+ if (offset==0) internal::palign<0>(packets[0], packets[1]);
+ else if (offset==1) internal::palign<1>(packets[0], packets[1]);
+ else if (offset==2) internal::palign<2>(packets[0], packets[1]);
+ else if (offset==3) internal::palign<3>(packets[0], packets[1]);
+ internal::pstore(data2, packets[0]);
for (int i=0; i<PacketSize; ++i)
ref[i] = data1[i+offset];
typedef Matrix<Scalar, PacketSize, 1> Vector;
- VERIFY(areApprox(ref, data2, PacketSize) && "ei_palign");
+ VERIFY(areApprox(ref, data2, PacketSize) && "internal::palign");
}
- CHECK_CWISE2(REF_ADD, ei_padd);
- CHECK_CWISE2(REF_SUB, ei_psub);
- CHECK_CWISE2(REF_MUL, ei_pmul);
+ CHECK_CWISE2(REF_ADD, internal::padd);
+ CHECK_CWISE2(REF_SUB, internal::psub);
+ CHECK_CWISE2(REF_MUL, internal::pmul);
#ifndef EIGEN_VECTORIZE_ALTIVEC
- if (!ei_is_same_type<Scalar,int>::ret)
- CHECK_CWISE2(REF_DIV, ei_pdiv);
+ if (!internal::is_same<Scalar,int>::value)
+ CHECK_CWISE2(REF_DIV, internal::pdiv);
#endif
- CHECK_CWISE1(ei_negate, ei_pnegate);
- CHECK_CWISE1(ei_conj, ei_pconj);
+ CHECK_CWISE1(internal::negate, internal::pnegate);
+ CHECK_CWISE1(internal::conj, internal::pconj);
for (int i=0; i<PacketSize; ++i)
ref[i] = data1[0];
- ei_pstore(data2, ei_pset1<Packet>(data1[0]));
- VERIFY(areApprox(ref, data2, PacketSize) && "ei_pset1");
+ internal::pstore(data2, internal::pset1<Packet>(data1[0]));
+ VERIFY(areApprox(ref, data2, PacketSize) && "internal::pset1");
- VERIFY(ei_isApprox(data1[0], ei_pfirst(ei_pload<Packet>(data1))) && "ei_pfirst");
+ VERIFY(internal::isApprox(data1[0], internal::pfirst(internal::pload<Packet>(data1))) && "internal::pfirst");
ref[0] = 0;
for (int i=0; i<PacketSize; ++i)
ref[0] += data1[i];
- VERIFY(isApproxAbs(ref[0], ei_predux(ei_pload<Packet>(data1)), refvalue) && "ei_predux");
+ VERIFY(isApproxAbs(ref[0], internal::predux(internal::pload<Packet>(data1)), refvalue) && "internal::predux");
ref[0] = 1;
for (int i=0; i<PacketSize; ++i)
ref[0] *= data1[i];
- VERIFY(ei_isApprox(ref[0], ei_predux_mul(ei_pload<Packet>(data1))) && "ei_predux_mul");
+ VERIFY(internal::isApprox(ref[0], internal::predux_mul(internal::pload<Packet>(data1))) && "internal::predux_mul");
for (int j=0; j<PacketSize; ++j)
{
ref[j] = 0;
for (int i=0; i<PacketSize; ++i)
ref[j] += data1[i+j*PacketSize];
- packets[j] = ei_pload<Packet>(data1+j*PacketSize);
+ packets[j] = internal::pload<Packet>(data1+j*PacketSize);
}
- ei_pstore(data2, ei_preduxp(packets));
- VERIFY(areApproxAbs(ref, data2, PacketSize, refvalue) && "ei_preduxp");
+ internal::pstore(data2, internal::preduxp(packets));
+ VERIFY(areApproxAbs(ref, data2, PacketSize, refvalue) && "internal::preduxp");
for (int i=0; i<PacketSize; ++i)
ref[i] = data1[PacketSize-i-1];
- ei_pstore(data2, ei_preverse(ei_pload<Packet>(data1)));
- VERIFY(areApprox(ref, data2, PacketSize) && "ei_preverse");
+ internal::pstore(data2, internal::preverse(internal::pload<Packet>(data1)));
+ VERIFY(areApprox(ref, data2, PacketSize) && "internal::preverse");
}
template<typename Scalar> void packetmath_real()
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- const int PacketSize = ei_packet_traits<Scalar>::size;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
+ const int PacketSize = internal::packet_traits<Scalar>::size;
const int size = PacketSize*4;
- EIGEN_ALIGN16 Scalar data1[ei_packet_traits<Scalar>::size*4];
- EIGEN_ALIGN16 Scalar data2[ei_packet_traits<Scalar>::size*4];
- EIGEN_ALIGN16 Scalar ref[ei_packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar data1[internal::packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar data2[internal::packet_traits<Scalar>::size*4];
+ EIGEN_ALIGN16 Scalar ref[internal::packet_traits<Scalar>::size*4];
for (int i=0; i<size; ++i)
{
- data1[i] = ei_random<Scalar>(-1e3,1e3);
- data2[i] = ei_random<Scalar>(-1e3,1e3);
+ data1[i] = internal::random<Scalar>(-1e3,1e3);
+ data2[i] = internal::random<Scalar>(-1e3,1e3);
}
- CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasSin, ei_sin, ei_psin);
- CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasCos, ei_cos, ei_pcos);
+ CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasSin, internal::sin, internal::psin);
+ CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasCos, internal::cos, internal::pcos);
for (int i=0; i<size; ++i)
{
- data1[i] = ei_random<Scalar>(-87,88);
- data2[i] = ei_random<Scalar>(-87,88);
+ data1[i] = internal::random<Scalar>(-87,88);
+ data2[i] = internal::random<Scalar>(-87,88);
}
- CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasExp, ei_exp, ei_pexp);
+ CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasExp, internal::exp, internal::pexp);
for (int i=0; i<size; ++i)
{
- data1[i] = ei_random<Scalar>(0,1e6);
- data2[i] = ei_random<Scalar>(0,1e6);
+ data1[i] = internal::random<Scalar>(0,1e6);
+ data2[i] = internal::random<Scalar>(0,1e6);
}
- CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasLog, ei_log, ei_plog);
- CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasSqrt, ei_sqrt, ei_psqrt);
+ CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLog, internal::log, internal::plog);
+ CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasSqrt, internal::sqrt, internal::psqrt);
ref[0] = data1[0];
for (int i=0; i<PacketSize; ++i)
ref[0] = std::min(ref[0],data1[i]);
- VERIFY(ei_isApprox(ref[0], ei_predux_min(ei_pload<Packet>(data1))) && "ei_predux_min");
+ VERIFY(internal::isApprox(ref[0], internal::predux_min(internal::pload<Packet>(data1))) && "internal::predux_min");
- CHECK_CWISE2(std::min, ei_pmin);
- CHECK_CWISE2(std::max, ei_pmax);
- CHECK_CWISE1(ei_abs, ei_pabs);
+ CHECK_CWISE2(std::min, internal::pmin);
+ CHECK_CWISE2(std::max, internal::pmax);
+ CHECK_CWISE1(internal::abs, internal::pabs);
ref[0] = data1[0];
for (int i=0; i<PacketSize; ++i)
ref[0] = std::max(ref[0],data1[i]);
- VERIFY(ei_isApprox(ref[0], ei_predux_max(ei_pload<Packet>(data1))) && "ei_predux_max");
+ VERIFY(internal::isApprox(ref[0], internal::predux_max(internal::pload<Packet>(data1))) && "internal::predux_max");
}
template<typename Scalar> void packetmath_complex()
{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- const int PacketSize = ei_packet_traits<Scalar>::size;
+ typedef typename internal::packet_traits<Scalar>::type Packet;
+ const int PacketSize = internal::packet_traits<Scalar>::size;
const int size = PacketSize*4;
EIGEN_ALIGN16 Scalar data1[PacketSize*4];
@@ -263,52 +267,52 @@ template<typename Scalar> void packetmath_complex()
for (int i=0; i<size; ++i)
{
- data1[i] = ei_random<Scalar>() * Scalar(1e2);
- data2[i] = ei_random<Scalar>() * Scalar(1e2);
+ data1[i] = internal::random<Scalar>() * Scalar(1e2);
+ data2[i] = internal::random<Scalar>() * Scalar(1e2);
}
{
- ei_conj_helper<Scalar,Scalar,false,false> cj;
- ei_conj_helper<Packet,Packet,false,false> pcj;
+ internal::conj_helper<Scalar,Scalar,false,false> cj;
+ internal::conj_helper<Packet,Packet,false,false> pcj;
for(int i=0;i<PacketSize;++i)
{
ref[i] = data1[i] * data2[i];
- VERIFY(ei_isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
+ VERIFY(internal::isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
}
- ei_pstore(pval,pcj.pmul(ei_pload<Packet>(data1),ei_pload<Packet>(data2)));
+ internal::pstore(pval,pcj.pmul(internal::pload<Packet>(data1),internal::pload<Packet>(data2)));
VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper");
}
{
- ei_conj_helper<Scalar,Scalar,true,false> cj;
- ei_conj_helper<Packet,Packet,true,false> pcj;
+ internal::conj_helper<Scalar,Scalar,true,false> cj;
+ internal::conj_helper<Packet,Packet,true,false> pcj;
for(int i=0;i<PacketSize;++i)
{
- ref[i] = ei_conj(data1[i]) * data2[i];
- VERIFY(ei_isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
+ ref[i] = internal::conj(data1[i]) * data2[i];
+ VERIFY(internal::isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
}
- ei_pstore(pval,pcj.pmul(ei_pload<Packet>(data1),ei_pload<Packet>(data2)));
+ internal::pstore(pval,pcj.pmul(internal::pload<Packet>(data1),internal::pload<Packet>(data2)));
VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper");
}
{
- ei_conj_helper<Scalar,Scalar,false,true> cj;
- ei_conj_helper<Packet,Packet,false,true> pcj;
+ internal::conj_helper<Scalar,Scalar,false,true> cj;
+ internal::conj_helper<Packet,Packet,false,true> pcj;
for(int i=0;i<PacketSize;++i)
{
- ref[i] = data1[i] * ei_conj(data2[i]);
- VERIFY(ei_isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
+ ref[i] = data1[i] * internal::conj(data2[i]);
+ VERIFY(internal::isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
}
- ei_pstore(pval,pcj.pmul(ei_pload<Packet>(data1),ei_pload<Packet>(data2)));
+ internal::pstore(pval,pcj.pmul(internal::pload<Packet>(data1),internal::pload<Packet>(data2)));
VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper");
}
{
- ei_conj_helper<Scalar,Scalar,true,true> cj;
- ei_conj_helper<Packet,Packet,true,true> pcj;
+ internal::conj_helper<Scalar,Scalar,true,true> cj;
+ internal::conj_helper<Packet,Packet,true,true> pcj;
for(int i=0;i<PacketSize;++i)
{
- ref[i] = ei_conj(data1[i]) * ei_conj(data2[i]);
- VERIFY(ei_isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
+ ref[i] = internal::conj(data1[i]) * internal::conj(data2[i]);
+ VERIFY(internal::isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper");
}
- ei_pstore(pval,pcj.pmul(ei_pload<Packet>(data1),ei_pload<Packet>(data2)));
+ internal::pstore(pval,pcj.pmul(internal::pload<Packet>(data1),internal::pload<Packet>(data2)));
VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper");
}
diff --git a/test/permutationmatrices.cpp b/test/permutationmatrices.cpp
index 880cd87a9..b9b3bbbca 100644
--- a/test/permutationmatrices.cpp
+++ b/test/permutationmatrices.cpp
@@ -34,9 +34,9 @@ void randomPermutationVector(PermutationVectorType& v, typename PermutationVecto
if(size == 1) return;
for(Index n = 0; n < 3 * size; ++n)
{
- Index i = ei_random<Index>(0, size-1);
+ Index i = internal::random<Index>(0, size-1);
Index j;
- do j = ei_random<Index>(0, size-1); while(j==i);
+ do j = internal::random<Index>(0, size-1); while(j==i);
std::swap(v(i), v(j));
}
}
@@ -108,17 +108,17 @@ template<typename MatrixType> void permutationmatrices(const MatrixType& m)
if(rows>1 && cols>1)
{
lp2 = lp;
- Index i = ei_random<Index>(0, rows-1);
+ Index i = internal::random<Index>(0, rows-1);
Index j;
- do j = ei_random<Index>(0, rows-1); while(j==i);
+ do j = internal::random<Index>(0, rows-1); while(j==i);
lp2.applyTranspositionOnTheLeft(i, j);
lm = lp;
lm.row(i).swap(lm.row(j));
VERIFY_IS_APPROX(lm, lp2.toDenseMatrix().template cast<Scalar>());
RightPermutationType rp2 = rp;
- i = ei_random<Index>(0, cols-1);
- do j = ei_random<Index>(0, cols-1); while(j==i);
+ i = internal::random<Index>(0, cols-1);
+ do j = internal::random<Index>(0, cols-1); while(j==i);
rp2.applyTranspositionOnTheRight(i, j);
rm = rp;
rm.col(i).swap(rm.col(j));
diff --git a/test/prec_inverse_4x4.cpp b/test/prec_inverse_4x4.cpp
index 8b1aa8869..c40cf7399 100644
--- a/test/prec_inverse_4x4.cpp
+++ b/test/prec_inverse_4x4.cpp
@@ -53,7 +53,7 @@ template<typename MatrixType> void inverse_general_4x4(int repeat)
RealScalar absdet;
do {
m = MatrixType::Random();
- absdet = ei_abs(m.determinant());
+ absdet = internal::abs(m.determinant());
} while(absdet < NumTraits<Scalar>::epsilon());
MatrixType inv = m.inverse();
double error = double( (m*inv-MatrixType::Identity()).norm() * absdet / NumTraits<Scalar>::epsilon() );
diff --git a/test/product.h b/test/product.h
index 804ce131d..101766b18 100644
--- a/test/product.h
+++ b/test/product.h
@@ -69,11 +69,11 @@ template<typename MatrixType> void product(const MatrixType& m)
ColVectorType vc2 = ColVectorType::Random(cols), vcres(cols);
OtherMajorMatrixType tm1 = m1;
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
- Index r = ei_random<Index>(0, rows-1),
- c = ei_random<Index>(0, cols-1),
- c2 = ei_random<Index>(0, cols-1);
+ Index r = internal::random<Index>(0, rows-1),
+ c = internal::random<Index>(0, cols-1),
+ c2 = internal::random<Index>(0, cols-1);
// begin testing Product.h: only associativity for now
// (we use Transpose.h but this doesn't count as a test for it)
diff --git a/test/product_extra.cpp b/test/product_extra.cpp
index de105946e..fcedacb2c 100644
--- a/test/product_extra.cpp
+++ b/test/product_extra.cpp
@@ -50,15 +50,15 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
ColVectorType vc2 = ColVectorType::Random(cols), vcres(cols);
OtherMajorMatrixType tm1 = m1;
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>(),
- s3 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>(),
+ s3 = internal::random<Scalar>();
VERIFY_IS_APPROX(m3.noalias() = m1 * m2.adjoint(), m1 * m2.adjoint().eval());
VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * square.adjoint(), m1.adjoint().eval() * square.adjoint().eval());
VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * m2, m1.adjoint().eval() * m2);
VERIFY_IS_APPROX(m3.noalias() = (s1 * m1.adjoint()) * m2, (s1 * m1.adjoint()).eval() * m2);
- VERIFY_IS_APPROX(m3.noalias() = ((s1 * m1).adjoint()) * m2, (ei_conj(s1) * m1.adjoint()).eval() * m2);
+ VERIFY_IS_APPROX(m3.noalias() = ((s1 * m1).adjoint()) * m2, (internal::conj(s1) * m1.adjoint()).eval() * m2);
VERIFY_IS_APPROX(m3.noalias() = (- m1.adjoint() * s1) * (s3 * m2), (- m1.adjoint() * s1).eval() * (s3 * m2).eval());
VERIFY_IS_APPROX(m3.noalias() = (s2 * m1.adjoint() * s1) * m2, (s2 * m1.adjoint() * s1).eval() * m2);
VERIFY_IS_APPROX(m3.noalias() = (-m1*s2) * s1*m2.adjoint(), (-m1*s2).eval() * (s1*m2.adjoint()).eval());
@@ -101,12 +101,12 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
(-m1.adjoint()*s2).eval() * (s1 * v1.adjoint()).eval());
// test the vector-matrix product with non aligned starts
- Index i = ei_random<Index>(0,m1.rows()-2);
- Index j = ei_random<Index>(0,m1.cols()-2);
- Index r = ei_random<Index>(1,m1.rows()-i);
- Index c = ei_random<Index>(1,m1.cols()-j);
- Index i2 = ei_random<Index>(0,m1.rows()-1);
- Index j2 = ei_random<Index>(0,m1.cols()-1);
+ Index i = internal::random<Index>(0,m1.rows()-2);
+ Index j = internal::random<Index>(0,m1.cols()-2);
+ Index r = internal::random<Index>(1,m1.rows()-i);
+ Index c = internal::random<Index>(1,m1.cols()-j);
+ Index i2 = internal::random<Index>(0,m1.rows()-1);
+ Index j2 = internal::random<Index>(0,m1.cols()-1);
VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval());
VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval());
@@ -119,9 +119,9 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
void test_product_extra()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST_1( product_extra(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST_2( product_extra(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST_3( product_extra(MatrixXcf(ei_random<int>(1,150), ei_random<int>(1,150))) );
- CALL_SUBTEST_4( product_extra(MatrixXcd(ei_random<int>(1,150), ei_random<int>(1,150))) );
+ CALL_SUBTEST_1( product_extra(MatrixXf(internal::random<int>(1,320), internal::random<int>(1,320))) );
+ CALL_SUBTEST_2( product_extra(MatrixXd(internal::random<int>(1,320), internal::random<int>(1,320))) );
+ CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random<int>(1,150), internal::random<int>(1,150))) );
+ CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,150), internal::random<int>(1,150))) );
}
}
diff --git a/test/product_large.cpp b/test/product_large.cpp
index 2c5523913..8ed937068 100644
--- a/test/product_large.cpp
+++ b/test/product_large.cpp
@@ -27,11 +27,11 @@
void test_product_large()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,150), ei_random<int>(1,150))) );
- CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
+ CALL_SUBTEST_1( product(MatrixXf(internal::random<int>(1,320), internal::random<int>(1,320))) );
+ CALL_SUBTEST_2( product(MatrixXd(internal::random<int>(1,320), internal::random<int>(1,320))) );
+ CALL_SUBTEST_3( product(MatrixXi(internal::random<int>(1,320), internal::random<int>(1,320))) );
+ CALL_SUBTEST_4( product(MatrixXcf(internal::random<int>(1,150), internal::random<int>(1,150))) );
+ CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,320), internal::random<int>(1,320))) );
}
#if defined EIGEN_TEST_PART_6
@@ -53,16 +53,16 @@ void test_product_large()
{
// check the functions to setup blocking sizes compile and do not segfault
// FIXME check they do what they are supposed to do !!
- std::ptrdiff_t l1 = ei_random<int>(10000,20000);
- std::ptrdiff_t l2 = ei_random<int>(1000000,2000000);
+ std::ptrdiff_t l1 = internal::random<int>(10000,20000);
+ std::ptrdiff_t l2 = internal::random<int>(1000000,2000000);
setCpuCacheSizes(l1,l2);
VERIFY(l1==l1CacheSize());
VERIFY(l2==l2CacheSize());
- std::ptrdiff_t k1 = ei_random<int>(10,100)*16;
- std::ptrdiff_t m1 = ei_random<int>(10,100)*16;
- std::ptrdiff_t n1 = ei_random<int>(10,100)*16;
+ std::ptrdiff_t k1 = internal::random<int>(10,100)*16;
+ std::ptrdiff_t m1 = internal::random<int>(10,100)*16;
+ std::ptrdiff_t n1 = internal::random<int>(10,100)*16;
// only makes sure it compiles fine
- computeProductBlockingSizes<float,float>(k1,m1,n1);
+ internal::computeProductBlockingSizes<float,float>(k1,m1,n1);
}
{
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp
index 9175694ba..e5dd964c0 100644
--- a/test/product_notemporary.cpp
+++ b/test/product_notemporary.cpp
@@ -57,14 +57,14 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
ColVectorType vc2 = ColVectorType::Random(cols), cvres(cols);
RowMajorMatrixType rm3(rows, cols);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>(),
- s3 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>(),
+ s3 = internal::random<Scalar>();
- Index c0 = ei_random<Index>(4,cols-8),
- c1 = ei_random<Index>(8,cols-c0),
- r0 = ei_random<Index>(4,cols-8),
- r1 = ei_random<Index>(8,rows-r0);
+ Index c0 = internal::random<Index>(4,cols-8),
+ c1 = internal::random<Index>(8,cols-c0),
+ r0 = internal::random<Index>(4,cols-8),
+ r1 = internal::random<Index>(8,rows-r0);
VERIFY_EVALUATION_COUNT( m3 = (m1 * m2.adjoint()), 1);
VERIFY_EVALUATION_COUNT( m3.noalias() = m1 * m2.adjoint(), 0);
@@ -128,13 +128,13 @@ void test_product_notemporary()
{
int s;
for(int i = 0; i < g_repeat; i++) {
- s = ei_random<int>(16,320);
+ s = internal::random<int>(16,320);
CALL_SUBTEST_1( product_notemporary(MatrixXf(s, s)) );
- s = ei_random<int>(16,320);
+ s = internal::random<int>(16,320);
CALL_SUBTEST_2( product_notemporary(MatrixXd(s, s)) );
- s = ei_random<int>(16,120);
+ s = internal::random<int>(16,120);
CALL_SUBTEST_3( product_notemporary(MatrixXcf(s,s)) );
- s = ei_random<int>(16,120);
+ s = internal::random<int>(16,120);
CALL_SUBTEST_4( product_notemporary(MatrixXcd(s,s)) );
}
}
diff --git a/test/product_selfadjoint.cpp b/test/product_selfadjoint.cpp
index c84582484..2e1fc7ec0 100644
--- a/test/product_selfadjoint.cpp
+++ b/test/product_selfadjoint.cpp
@@ -47,9 +47,9 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
r2 = RowVectorType::Random(rows);
RhsMatrixType m4 = RhsMatrixType::Random(rows,10);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>(),
- s3 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>(),
+ s3 = internal::random<Scalar>();
m1 = (m1.adjoint() + m1).eval();
@@ -83,13 +83,13 @@ void test_product_selfadjoint()
CALL_SUBTEST_1( product_selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( product_selfadjoint(Matrix<float, 2, 2>()) );
CALL_SUBTEST_3( product_selfadjoint(Matrix3d()) );
- s = ei_random<int>(1,150);
+ s = internal::random<int>(1,150);
CALL_SUBTEST_4( product_selfadjoint(MatrixXcf(s, s)) );
- s = ei_random<int>(1,150);
+ s = internal::random<int>(1,150);
CALL_SUBTEST_5( product_selfadjoint(MatrixXcd(s,s)) );
- s = ei_random<int>(1,320);
+ s = internal::random<int>(1,320);
CALL_SUBTEST_6( product_selfadjoint(MatrixXd(s,s)) );
- s = ei_random<int>(1,320);
+ s = internal::random<int>(1,320);
CALL_SUBTEST_7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s,s)) );
}
}
diff --git a/test/product_symm.cpp b/test/product_symm.cpp
index 5ddae30c0..21c2f605b 100644
--- a/test/product_symm.cpp
+++ b/test/product_symm.cpp
@@ -47,8 +47,8 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in
Rhs2 rhs2 = Rhs2::Random(othersize, rows), rhs22(othersize, rows), rhs23(othersize, rows);
Rhs3 rhs3 = Rhs3::Random(cols, othersize), rhs32(cols, othersize), rhs33(cols, othersize);
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
m2 = m1.template triangularView<Lower>();
m3 = m2.template selfadjointView<Lower>();
@@ -98,14 +98,14 @@ void test_product_symm()
{
for(int i = 0; i < g_repeat ; i++)
{
- CALL_SUBTEST_1(( symm<float,Dynamic,Dynamic>(ei_random<int>(1,320),ei_random<int>(1,320)) ));
- CALL_SUBTEST_2(( symm<double,Dynamic,Dynamic>(ei_random<int>(1,320),ei_random<int>(1,320)) ));
- CALL_SUBTEST_3(( symm<std::complex<float>,Dynamic,Dynamic>(ei_random<int>(1,200),ei_random<int>(1,200)) ));
- CALL_SUBTEST_4(( symm<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(1,200),ei_random<int>(1,200)) ));
-
- CALL_SUBTEST_5(( symm<float,Dynamic,1>(ei_random<int>(1,320)) ));
- CALL_SUBTEST_6(( symm<double,Dynamic,1>(ei_random<int>(1,320)) ));
- CALL_SUBTEST_7(( symm<std::complex<float>,Dynamic,1>(ei_random<int>(1,320)) ));
- CALL_SUBTEST_8(( symm<std::complex<double>,Dynamic,1>(ei_random<int>(1,320)) ));
+ CALL_SUBTEST_1(( symm<float,Dynamic,Dynamic>(internal::random<int>(1,320),internal::random<int>(1,320)) ));
+ CALL_SUBTEST_2(( symm<double,Dynamic,Dynamic>(internal::random<int>(1,320),internal::random<int>(1,320)) ));
+ CALL_SUBTEST_3(( symm<std::complex<float>,Dynamic,Dynamic>(internal::random<int>(1,200),internal::random<int>(1,200)) ));
+ CALL_SUBTEST_4(( symm<std::complex<double>,Dynamic,Dynamic>(internal::random<int>(1,200),internal::random<int>(1,200)) ));
+
+ CALL_SUBTEST_5(( symm<float,Dynamic,1>(internal::random<int>(1,320)) ));
+ CALL_SUBTEST_6(( symm<double,Dynamic,1>(internal::random<int>(1,320)) ));
+ CALL_SUBTEST_7(( symm<std::complex<float>,Dynamic,1>(internal::random<int>(1,320)) ));
+ CALL_SUBTEST_8(( symm<std::complex<double>,Dynamic,1>(internal::random<int>(1,320)) ));
}
}
diff --git a/test/product_syrk.cpp b/test/product_syrk.cpp
index 575b21cac..951a254ed 100644
--- a/test/product_syrk.cpp
+++ b/test/product_syrk.cpp
@@ -39,11 +39,11 @@ template<typename MatrixType> void syrk(const MatrixType& m)
MatrixType m1 = MatrixType::Random(rows, cols),
m2 = MatrixType::Random(rows, cols);
- Rhs1 rhs1 = Rhs1::Random(ei_random<int>(1,320), cols);
- Rhs2 rhs2 = Rhs2::Random(rows, ei_random<int>(1,320));
- Rhs3 rhs3 = Rhs3::Random(ei_random<int>(1,320), rows);
+ Rhs1 rhs1 = Rhs1::Random(internal::random<int>(1,320), cols);
+ Rhs2 rhs2 = Rhs2::Random(rows, internal::random<int>(1,320));
+ Rhs3 rhs3 = Rhs3::Random(internal::random<int>(1,320), rows);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
m2.setZero();
VERIFY_IS_APPROX((m2.template selfadjointView<Lower>().rankUpdate(rhs2,s1)._expression()),
@@ -75,13 +75,13 @@ void test_product_syrk()
for(int i = 0; i < g_repeat ; i++)
{
int s;
- s = ei_random<int>(1,320);
+ s = internal::random<int>(1,320);
CALL_SUBTEST_1( syrk(MatrixXf(s, s)) );
- s = ei_random<int>(1,320);
+ s = internal::random<int>(1,320);
CALL_SUBTEST_2( syrk(MatrixXd(s, s)) );
- s = ei_random<int>(1,200);
+ s = internal::random<int>(1,200);
CALL_SUBTEST_3( syrk(MatrixXcf(s, s)) );
- s = ei_random<int>(1,200);
+ s = internal::random<int>(1,200);
CALL_SUBTEST_4( syrk(MatrixXcd(s, s)) );
}
}
diff --git a/test/product_trmm.cpp b/test/product_trmm.cpp
index e4790fb66..e117f6931 100644
--- a/test/product_trmm.cpp
+++ b/test/product_trmm.cpp
@@ -32,15 +32,15 @@ template<typename Scalar> void trmm(int size,int /*othersize*/)
typedef Matrix<Scalar,Dynamic,Dynamic,RowMajor> MatrixRowMaj;
DenseIndex rows = size;
- DenseIndex cols = ei_random<DenseIndex>(1,size);
+ DenseIndex cols = internal::random<DenseIndex>(1,size);
MatrixColMaj triV(rows,cols), triH(cols,rows), upTri(cols,rows), loTri(rows,cols),
unitUpTri(cols,rows), unitLoTri(rows,cols), strictlyUpTri(cols,rows), strictlyLoTri(rows,cols);
MatrixColMaj ge1(rows,cols), ge2(cols,rows), ge3;
MatrixRowMaj rge3;
- Scalar s1 = ei_random<Scalar>(),
- s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>(),
+ s2 = internal::random<Scalar>();
triV.setRandom();
triH.setRandom();
@@ -65,7 +65,7 @@ template<typename Scalar> void trmm(int size,int /*othersize*/)
VERIFY_IS_APPROX( ge3 = ge1.adjoint() * triV.template triangularView<Lower>(), ge1.adjoint() * loTri);
VERIFY_IS_APPROX( ge3 = triH.template triangularView<Upper>() * ge2.adjoint(), upTri * ge2.adjoint());
VERIFY_IS_APPROX(rge3.noalias() = triH.template triangularView<Upper>() * ge2.adjoint(), upTri * ge2.adjoint());
- VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<Upper>() * ge2.adjoint(), ei_conj(s1) * loTri.adjoint() * ge2.adjoint());
+ VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<Upper>() * ge2.adjoint(), internal::conj(s1) * loTri.adjoint() * ge2.adjoint());
VERIFY_IS_APPROX(rge3.noalias() = triV.adjoint().template triangularView<Upper>() * ge2.adjoint(), loTri.adjoint() * ge2.adjoint());
VERIFY_IS_APPROX( ge3 = triH.adjoint().template triangularView<Lower>() * ge1.adjoint(), upTri.adjoint() * ge1.adjoint());
VERIFY_IS_APPROX(rge3.noalias() = triH.adjoint().template triangularView<Lower>() * ge1.adjoint(), upTri.adjoint() * ge1.adjoint());
@@ -73,21 +73,21 @@ template<typename Scalar> void trmm(int size,int /*othersize*/)
VERIFY_IS_APPROX( ge3 = triV.template triangularView<UnitLower>() * ge2, unitLoTri * ge2);
VERIFY_IS_APPROX( rge3.noalias() = ge2 * triV.template triangularView<UnitLower>(), ge2 * unitLoTri);
VERIFY_IS_APPROX( ge3 = ge2 * triV.template triangularView<UnitLower>(), ge2 * unitLoTri);
- VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<UnitUpper>() * ge2.adjoint(), ei_conj(s1) * unitLoTri.adjoint() * ge2.adjoint());
+ VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<UnitUpper>() * ge2.adjoint(), internal::conj(s1) * unitLoTri.adjoint() * ge2.adjoint());
VERIFY_IS_APPROX( ge3 = triV.template triangularView<StrictlyLower>() * ge2, strictlyLoTri * ge2);
VERIFY_IS_APPROX( rge3.noalias() = ge2 * triV.template triangularView<StrictlyLower>(), ge2 * strictlyLoTri);
VERIFY_IS_APPROX( ge3 = ge2 * triV.template triangularView<StrictlyLower>(), ge2 * strictlyLoTri);
- VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<StrictlyUpper>() * ge2.adjoint(), ei_conj(s1) * strictlyLoTri.adjoint() * ge2.adjoint());
+ VERIFY_IS_APPROX( ge3 = (s1*triV).adjoint().template triangularView<StrictlyUpper>() * ge2.adjoint(), internal::conj(s1) * strictlyLoTri.adjoint() * ge2.adjoint());
}
void test_product_trmm()
{
for(int i = 0; i < g_repeat ; i++)
{
- CALL_SUBTEST_1((trmm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
- CALL_SUBTEST_2((trmm<double>(ei_random<int>(1,320),ei_random<int>(1,320))));
- CALL_SUBTEST_3((trmm<std::complex<float> >(ei_random<int>(1,200),ei_random<int>(1,200))));
- CALL_SUBTEST_4((trmm<std::complex<double> >(ei_random<int>(1,200),ei_random<int>(1,200))));
+ CALL_SUBTEST_1((trmm<float>(internal::random<int>(1,320),internal::random<int>(1,320))));
+ CALL_SUBTEST_2((trmm<double>(internal::random<int>(1,320),internal::random<int>(1,320))));
+ CALL_SUBTEST_3((trmm<std::complex<float> >(internal::random<int>(1,200),internal::random<int>(1,200))));
+ CALL_SUBTEST_4((trmm<std::complex<double> >(internal::random<int>(1,200),internal::random<int>(1,200))));
}
}
diff --git a/test/product_trmv.cpp b/test/product_trmv.cpp
index d32e96c55..cfb7355ff 100644
--- a/test/product_trmv.cpp
+++ b/test/product_trmv.cpp
@@ -40,7 +40,7 @@ template<typename MatrixType> void trmv(const MatrixType& m)
m3(rows, cols);
VectorType v1 = VectorType::Random(rows);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
m1 = MatrixType::Random(rows, cols);
@@ -93,11 +93,11 @@ void test_product_trmv()
CALL_SUBTEST_1( trmv(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( trmv(Matrix<float, 2, 2>()) );
CALL_SUBTEST_3( trmv(Matrix3d()) );
- s = ei_random<int>(1,200);
+ s = internal::random<int>(1,200);
CALL_SUBTEST_4( trmv(MatrixXcf(s,s)) );
- s = ei_random<int>(1,200);
+ s = internal::random<int>(1,200);
CALL_SUBTEST_5( trmv(MatrixXcd(s,s)) );
- s = ei_random<int>(1,320);
+ s = internal::random<int>(1,320);
CALL_SUBTEST_6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );
}
}
diff --git a/test/product_trsolve.cpp b/test/product_trsolve.cpp
index 352f54751..e7ada23a5 100644
--- a/test/product_trsolve.cpp
+++ b/test/product_trsolve.cpp
@@ -80,13 +80,13 @@ void test_product_trsolve()
for(int i = 0; i < g_repeat ; i++)
{
// matrices
- CALL_SUBTEST_1((trsolve<float,Dynamic,Dynamic>(ei_random<int>(1,320),ei_random<int>(1,320))));
- CALL_SUBTEST_2((trsolve<double,Dynamic,Dynamic>(ei_random<int>(1,320),ei_random<int>(1,320))));
- CALL_SUBTEST_3((trsolve<std::complex<float>,Dynamic,Dynamic>(ei_random<int>(1,200),ei_random<int>(1,200))));
- CALL_SUBTEST_4((trsolve<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(1,200),ei_random<int>(1,200))));
+ CALL_SUBTEST_1((trsolve<float,Dynamic,Dynamic>(internal::random<int>(1,320),internal::random<int>(1,320))));
+ CALL_SUBTEST_2((trsolve<double,Dynamic,Dynamic>(internal::random<int>(1,320),internal::random<int>(1,320))));
+ CALL_SUBTEST_3((trsolve<std::complex<float>,Dynamic,Dynamic>(internal::random<int>(1,200),internal::random<int>(1,200))));
+ CALL_SUBTEST_4((trsolve<std::complex<double>,Dynamic,Dynamic>(internal::random<int>(1,200),internal::random<int>(1,200))));
// vectors
- CALL_SUBTEST_5((trsolve<std::complex<double>,Dynamic,1>(ei_random<int>(1,320))));
+ CALL_SUBTEST_5((trsolve<std::complex<double>,Dynamic,1>(internal::random<int>(1,320))));
CALL_SUBTEST_6((trsolve<float,1,1>()));
CALL_SUBTEST_7((trsolve<float,1,2>()));
CALL_SUBTEST_8((trsolve<std::complex<float>,4,1>()));
diff --git a/test/qr.cpp b/test/qr.cpp
index 09fb81dde..7e9ac9df9 100644
--- a/test/qr.cpp
+++ b/test/qr.cpp
@@ -71,12 +71,12 @@ template<typename MatrixType> void qr_invertible()
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
typedef typename MatrixType::Scalar Scalar;
- int size = ei_random<int>(10,50);
+ int size = internal::random<int>(10,50);
MatrixType m1(size, size), m2(size, size), m3(size, size);
m1 = MatrixType::Random(size,size);
- if (ei_is_same_type<RealScalar,float>::ret)
+ if (internal::is_same<RealScalar,float>::value)
{
// let's build a matrix more stable to inverse
MatrixType a = MatrixType::Random(size,size*2);
@@ -90,13 +90,13 @@ template<typename MatrixType> void qr_invertible()
// now construct a matrix with prescribed determinant
m1.setZero();
- for(int i = 0; i < size; i++) m1(i,i) = ei_random<Scalar>();
- RealScalar absdet = ei_abs(m1.diagonal().prod());
+ for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();
+ RealScalar absdet = internal::abs(m1.diagonal().prod());
m3 = qr.householderQ(); // get a unitary
m1 = m3 * m1 * m3;
qr.compute(m1);
VERIFY_IS_APPROX(absdet, qr.absDeterminant());
- VERIFY_IS_APPROX(ei_log(absdet), qr.logAbsDeterminant());
+ VERIFY_IS_APPROX(internal::log(absdet), qr.logAbsDeterminant());
}
template<typename MatrixType> void qr_verify_assert()
@@ -114,8 +114,8 @@ template<typename MatrixType> void qr_verify_assert()
void test_qr()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST_1( qr(MatrixXf(ei_random<int>(1,200),ei_random<int>(1,200))) );
- CALL_SUBTEST_2( qr(MatrixXcd(ei_random<int>(1,200),ei_random<int>(1,200))) );
+ CALL_SUBTEST_1( qr(MatrixXf(internal::random<int>(1,200),internal::random<int>(1,200))) );
+ CALL_SUBTEST_2( qr(MatrixXcd(internal::random<int>(1,200),internal::random<int>(1,200))) );
CALL_SUBTEST_3(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));
CALL_SUBTEST_4(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp
index a499412cd..ddfb1bad5 100644
--- a/test/qr_colpivoting.cpp
+++ b/test/qr_colpivoting.cpp
@@ -30,8 +30,8 @@ template<typename MatrixType> void qr()
{
typedef typename MatrixType::Index Index;
- Index rows = ei_random<Index>(2,200), cols = ei_random<Index>(2,200), cols2 = ei_random<Index>(2,200);
- Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
+ Index rows = internal::random<Index>(2,200), cols = internal::random<Index>(2,200), cols2 = internal::random<Index>(2,200);
+ Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
@@ -64,7 +64,7 @@ template<typename MatrixType, int Cols2> void qr_fixedsize()
{
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
typedef typename MatrixType::Scalar Scalar;
- int rank = ei_random<int>(1, std::min(int(Rows), int(Cols))-1);
+ int rank = internal::random<int>(1, std::min(int(Rows), int(Cols))-1);
Matrix<Scalar,Rows,Cols> m1;
createRandomPIMatrixOfRank(rank,Rows,Cols,m1);
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
@@ -90,12 +90,12 @@ template<typename MatrixType> void qr_invertible()
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
typedef typename MatrixType::Scalar Scalar;
- int size = ei_random<int>(10,50);
+ int size = internal::random<int>(10,50);
MatrixType m1(size, size), m2(size, size), m3(size, size);
m1 = MatrixType::Random(size,size);
- if (ei_is_same_type<RealScalar,float>::ret)
+ if (internal::is_same<RealScalar,float>::value)
{
// let's build a matrix more stable to inverse
MatrixType a = MatrixType::Random(size,size*2);
@@ -109,13 +109,13 @@ template<typename MatrixType> void qr_invertible()
// now construct a matrix with prescribed determinant
m1.setZero();
- for(int i = 0; i < size; i++) m1(i,i) = ei_random<Scalar>();
- RealScalar absdet = ei_abs(m1.diagonal().prod());
+ for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();
+ RealScalar absdet = internal::abs(m1.diagonal().prod());
m3 = qr.householderQ(); // get a unitary
m1 = m3 * m1 * m3;
qr.compute(m1);
VERIFY_IS_APPROX(absdet, qr.absDeterminant());
- VERIFY_IS_APPROX(ei_log(absdet), qr.logAbsDeterminant());
+ VERIFY_IS_APPROX(internal::log(absdet), qr.logAbsDeterminant());
}
template<typename MatrixType> void qr_verify_assert()
diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp
index 340b73037..175c293b3 100644
--- a/test/qr_fullpivoting.cpp
+++ b/test/qr_fullpivoting.cpp
@@ -30,8 +30,8 @@ template<typename MatrixType> void qr()
{
typedef typename MatrixType::Index Index;
- Index rows = ei_random<Index>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200);
- Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
+ Index rows = internal::random<Index>(20,200), cols = internal::random<int>(20,200), cols2 = internal::random<int>(20,200);
+ Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
@@ -69,12 +69,12 @@ template<typename MatrixType> void qr_invertible()
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
typedef typename MatrixType::Scalar Scalar;
- int size = ei_random<int>(10,50);
+ int size = internal::random<int>(10,50);
MatrixType m1(size, size), m2(size, size), m3(size, size);
m1 = MatrixType::Random(size,size);
- if (ei_is_same_type<RealScalar,float>::ret)
+ if (internal::is_same<RealScalar,float>::value)
{
// let's build a matrix more stable to inverse
MatrixType a = MatrixType::Random(size,size*2);
@@ -92,13 +92,13 @@ template<typename MatrixType> void qr_invertible()
// now construct a matrix with prescribed determinant
m1.setZero();
- for(int i = 0; i < size; i++) m1(i,i) = ei_random<Scalar>();
- RealScalar absdet = ei_abs(m1.diagonal().prod());
+ for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();
+ RealScalar absdet = internal::abs(m1.diagonal().prod());
m3 = qr.matrixQ(); // get a unitary
m1 = m3 * m1 * m3;
qr.compute(m1);
VERIFY_IS_APPROX(absdet, qr.absDeterminant());
- VERIFY_IS_APPROX(ei_log(absdet), qr.logAbsDeterminant());
+ VERIFY_IS_APPROX(internal::log(absdet), qr.logAbsDeterminant());
}
template<typename MatrixType> void qr_verify_assert()
diff --git a/test/redux.cpp b/test/redux.cpp
index 9a1df71a8..b9004fbd2 100644
--- a/test/redux.cpp
+++ b/test/redux.cpp
@@ -37,28 +37,28 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows, cols).sum(), Scalar(1));
VERIFY_IS_APPROX(MatrixType::Ones(rows, cols).sum(), Scalar(float(rows*cols))); // the float() here to shut up excessive MSVC warning about int->complex conversion being lossy
- Scalar s(0), p(1), minc(ei_real(m1.coeff(0))), maxc(ei_real(m1.coeff(0)));
+ Scalar s(0), p(1), minc(internal::real(m1.coeff(0))), maxc(internal::real(m1.coeff(0)));
for(int j = 0; j < cols; j++)
for(int i = 0; i < rows; i++)
{
s += m1(i,j);
p *= m1(i,j);
- minc = std::min(ei_real(minc), ei_real(m1(i,j)));
- maxc = std::max(ei_real(maxc), ei_real(m1(i,j)));
+ minc = std::min(internal::real(minc), internal::real(m1(i,j)));
+ maxc = std::max(internal::real(maxc), internal::real(m1(i,j)));
}
const Scalar mean = s/Scalar(RealScalar(rows*cols));
VERIFY_IS_APPROX(m1.sum(), s);
VERIFY_IS_APPROX(m1.mean(), mean);
VERIFY_IS_APPROX(m1.prod(), p);
- VERIFY_IS_APPROX(m1.real().minCoeff(), ei_real(minc));
- VERIFY_IS_APPROX(m1.real().maxCoeff(), ei_real(maxc));
+ VERIFY_IS_APPROX(m1.real().minCoeff(), internal::real(minc));
+ VERIFY_IS_APPROX(m1.real().maxCoeff(), internal::real(maxc));
// test slice vectorization assuming assign is ok
- Index r0 = ei_random<Index>(0,rows-1);
- Index c0 = ei_random<Index>(0,cols-1);
- Index r1 = ei_random<Index>(r0+1,rows)-r0;
- Index c1 = ei_random<Index>(c0+1,cols)-c0;
+ Index r0 = internal::random<Index>(0,rows-1);
+ Index c0 = internal::random<Index>(0,cols-1);
+ Index r1 = internal::random<Index>(r0+1,rows)-r0;
+ Index c1 = internal::random<Index>(c0+1,cols)-c0;
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).sum(), m1.block(r0,c0,r1,c1).eval().sum());
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).mean(), m1.block(r0,c0,r1,c1).eval().mean());
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).prod(), m1.block(r0,c0,r1,c1).eval().prod());
@@ -81,13 +81,13 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
for(int i = 1; i < size; i++)
{
Scalar s(0), p(1);
- RealScalar minc(ei_real(v.coeff(0))), maxc(ei_real(v.coeff(0)));
+ RealScalar minc(internal::real(v.coeff(0))), maxc(internal::real(v.coeff(0)));
for(int j = 0; j < i; j++)
{
s += v[j];
p *= v[j];
- minc = std::min(minc, ei_real(v[j]));
- maxc = std::max(maxc, ei_real(v[j]));
+ minc = std::min(minc, internal::real(v[j]));
+ maxc = std::max(maxc, internal::real(v[j]));
}
VERIFY_IS_APPROX(s, v.head(i).sum());
VERIFY_IS_APPROX(p, v.head(i).prod());
@@ -98,15 +98,15 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
for(int i = 0; i < size-1; i++)
{
Scalar s(0), p(1);
- RealScalar minc(ei_real(v.coeff(i))), maxc(ei_real(v.coeff(i)));
+ RealScalar minc(internal::real(v.coeff(i))), maxc(internal::real(v.coeff(i)));
for(int j = i; j < size; j++)
{
s += v[j];
p *= v[j];
- minc = std::min(minc, ei_real(v[j]));
- maxc = std::max(maxc, ei_real(v[j]));
+ minc = std::min(minc, internal::real(v[j]));
+ maxc = std::max(maxc, internal::real(v[j]));
}
- VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(s - v.tail(size-i).sum()), Scalar(1));
+ VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.tail(size-i).sum()), Scalar(1));
VERIFY_IS_APPROX(p, v.tail(size-i).prod());
VERIFY_IS_APPROX(minc, v.real().tail(size-i).minCoeff());
VERIFY_IS_APPROX(maxc, v.real().tail(size-i).maxCoeff());
@@ -115,13 +115,13 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
for(int i = 0; i < size/2; i++)
{
Scalar s(0), p(1);
- RealScalar minc(ei_real(v.coeff(i))), maxc(ei_real(v.coeff(i)));
+ RealScalar minc(internal::real(v.coeff(i))), maxc(internal::real(v.coeff(i)));
for(int j = i; j < size-i; j++)
{
s += v[j];
p *= v[j];
- minc = std::min(minc, ei_real(v[j]));
- maxc = std::max(maxc, ei_real(v[j]));
+ minc = std::min(minc, internal::real(v[j]));
+ maxc = std::max(maxc, internal::real(v[j]));
}
VERIFY_IS_APPROX(s, v.segment(i, size-2*i).sum());
VERIFY_IS_APPROX(p, v.segment(i, size-2*i).prod());
diff --git a/test/schur_complex.cpp b/test/schur_complex.cpp
index 7c4dcb21a..a2a89fd67 100644
--- a/test/schur_complex.cpp
+++ b/test/schur_complex.cpp
@@ -80,7 +80,7 @@ template<typename MatrixType> void schur(int size = MatrixType::ColsAtCompileTim
void test_schur_complex()
{
CALL_SUBTEST_1(( schur<Matrix4cd>() ));
- CALL_SUBTEST_2(( schur<MatrixXcf>(ei_random<int>(1,50)) ));
+ CALL_SUBTEST_2(( schur<MatrixXcf>(internal::random<int>(1,50)) ));
CALL_SUBTEST_3(( schur<Matrix<std::complex<float>, 1, 1> >() ));
CALL_SUBTEST_4(( schur<Matrix<float, 3, 3, Eigen::RowMajor> >() ));
diff --git a/test/schur_real.cpp b/test/schur_real.cpp
index ab1dd1b85..b61c698c2 100644
--- a/test/schur_real.cpp
+++ b/test/schur_real.cpp
@@ -99,7 +99,7 @@ template<typename MatrixType> void schur(int size = MatrixType::ColsAtCompileTim
void test_schur_real()
{
CALL_SUBTEST_1(( schur<Matrix4f>() ));
- CALL_SUBTEST_2(( schur<MatrixXd>(ei_random<int>(1,50)) ));
+ CALL_SUBTEST_2(( schur<MatrixXd>(internal::random<int>(1,50)) ));
CALL_SUBTEST_3(( schur<Matrix<float, 1, 1> >() ));
CALL_SUBTEST_4(( schur<Matrix<double, 3, 3, Eigen::RowMajor> >() ));
diff --git a/test/selfadjoint.cpp b/test/selfadjoint.cpp
index b1a910b0b..a92ad96b5 100644
--- a/test/selfadjoint.cpp
+++ b/test/selfadjoint.cpp
@@ -56,7 +56,7 @@ void test_selfadjoint()
{
for(int i = 0; i < g_repeat ; i++)
{
- int s = ei_random<int>(1,20); EIGEN_UNUSED_VARIABLE(s);
+ int s = internal::random<int>(1,20); EIGEN_UNUSED_VARIABLE(s);
CALL_SUBTEST_1( selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( selfadjoint(Matrix<float, 2, 2>()) );
diff --git a/test/smallvectors.cpp b/test/smallvectors.cpp
index d6dc8e97c..144944162 100644
--- a/test/smallvectors.cpp
+++ b/test/smallvectors.cpp
@@ -29,10 +29,10 @@ template<typename Scalar> void smallVectors()
typedef Matrix<Scalar, 1, 2> V2;
typedef Matrix<Scalar, 3, 1> V3;
typedef Matrix<Scalar, 1, 4> V4;
- Scalar x1 = ei_random<Scalar>(),
- x2 = ei_random<Scalar>(),
- x3 = ei_random<Scalar>(),
- x4 = ei_random<Scalar>();
+ Scalar x1 = internal::random<Scalar>(),
+ x2 = internal::random<Scalar>(),
+ x3 = internal::random<Scalar>(),
+ x4 = internal::random<Scalar>();
V2 v2(x1, x2);
V3 v3(x1, x2, x3);
V4 v4(x1, x2, x3, x4);
diff --git a/test/sparse.h b/test/sparse.h
index 4733e4d10..1489f2a0e 100644
--- a/test/sparse.h
+++ b/test/sparse.h
@@ -71,10 +71,10 @@ initSparse(double density,
sparseMat.startVec(j);
for(int i=0; i<refMat.rows(); i++)
{
- Scalar v = (ei_random<double>(0,1) < density) ? ei_random<Scalar>() : Scalar(0);
+ Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);
if ((flags&ForceNonZeroDiag) && (i==j))
{
- v = ei_random<Scalar>()*Scalar(3.);
+ v = internal::random<Scalar>()*Scalar(3.);
v = v*v + Scalar(5.);
}
if ((flags & MakeLowerTriangular) && j>i)
@@ -83,7 +83,7 @@ initSparse(double density,
v = Scalar(0);
if ((flags&ForceRealDiag) && (i==j))
- v = ei_real(v);
+ v = internal::real(v);
if (v!=Scalar(0))
{
@@ -116,10 +116,10 @@ initSparse(double density,
sparseMat.startVec(j); // not needed for DynamicSparseMatrix
for(int i=0; i<refMat.rows(); i++)
{
- Scalar v = (ei_random<double>(0,1) < density) ? ei_random<Scalar>() : Scalar(0);
+ Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);
if ((flags&ForceNonZeroDiag) && (i==j))
{
- v = ei_random<Scalar>()*Scalar(3.);
+ v = internal::random<Scalar>()*Scalar(3.);
v = v*v + Scalar(5.);
}
if ((flags & MakeLowerTriangular) && j>i)
@@ -128,7 +128,7 @@ initSparse(double density,
v = Scalar(0);
if ((flags&ForceRealDiag) && (i==j))
- v = ei_real(v);
+ v = internal::real(v);
if (v!=Scalar(0))
{
@@ -157,7 +157,7 @@ initSparse(double density,
sparseVec.setZero();
for(int i=0; i<refVec.size(); i++)
{
- Scalar v = (ei_random<double>(0,1) < density) ? ei_random<Scalar>() : Scalar(0);
+ Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);
if (v!=Scalar(0))
{
sparseVec.insertBack(i) = v;
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 8c93909c6..92fff4057 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -41,7 +41,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
SparseMatrixType m(rows, cols);
DenseMatrix refMat = DenseMatrix::Zero(rows, cols);
DenseVector vec1 = DenseVector::Random(rows);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
std::vector<Vector2i> zeroCoords;
std::vector<Vector2i> nonzeroCoords;
@@ -54,7 +54,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
for (int i=0; i<(int)zeroCoords.size(); ++i)
{
VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps );
- if(ei_is_same_type<SparseMatrixType,SparseMatrix<Scalar,Flags> >::ret)
+ if(internal::is_same<SparseMatrixType,SparseMatrix<Scalar,Flags> >::value)
VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[0].x(),zeroCoords[0].y()) = 5 );
}
VERIFY_IS_APPROX(m, refMat);
@@ -67,10 +67,10 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// test InnerIterators and Block expressions
for (int t=0; t<10; ++t)
{
- int j = ei_random<int>(0,cols-1);
- int i = ei_random<int>(0,rows-1);
- int w = ei_random<int>(1,cols-j-1);
- int h = ei_random<int>(1,rows-i-1);
+ int j = internal::random<int>(0,cols-1);
+ int i = internal::random<int>(0,rows-1);
+ int w = internal::random<int>(1,cols-j-1);
+ int h = internal::random<int>(1,rows-i-1);
// VERIFY_IS_APPROX(m.block(i,j,h,w), refMat.block(i,j,h,w));
for(int c=0; c<w; c++)
@@ -114,9 +114,9 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
{
for (int k=0; k<rows/2; ++k)
{
- int i = ei_random<int>(0,rows-1);
+ int i = internal::random<int>(0,rows-1);
if (m1.coeff(i,j)==Scalar(0))
- m2.insert(i,j) = m1(i,j) = ei_random<Scalar>();
+ m2.insert(i,j) = m1(i,j) = internal::random<Scalar>();
}
}
m2.finalize();
@@ -131,10 +131,10 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
m2.reserve(10);
for (int k=0; k<rows*cols; ++k)
{
- int i = ei_random<int>(0,rows-1);
- int j = ei_random<int>(0,cols-1);
+ int i = internal::random<int>(0,rows-1);
+ int j = internal::random<int>(0,cols-1);
if (m1.coeff(i,j)==Scalar(0))
- m2.insert(i,j) = m1(i,j) = ei_random<Scalar>();
+ m2.insert(i,j) = m1(i,j) = internal::random<Scalar>();
}
m2.finalize();
VERIFY_IS_APPROX(m2,m1);
@@ -190,8 +190,8 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);
SparseMatrixType m2(rows, rows);
initSparse<Scalar>(density, refMat2, m2);
- int j0 = ei_random(0,rows-1);
- int j1 = ei_random(0,rows-1);
+ int j0 = internal::random(0,rows-1);
+ int j1 = internal::random(0,rows-1);
VERIFY_IS_APPROX(m2.innerVector(j0), refMat2.col(j0));
VERIFY_IS_APPROX(m2.innerVector(j0)+m2.innerVector(j1), refMat2.col(j0)+refMat2.col(j1));
//m2.innerVector(j0) = 2*m2.innerVector(j1);
@@ -204,9 +204,9 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);
SparseMatrixType m2(rows, rows);
initSparse<Scalar>(density, refMat2, m2);
- int j0 = ei_random(0,rows-2);
- int j1 = ei_random(0,rows-2);
- int n0 = ei_random<int>(1,rows-std::max(j0,j1));
+ int j0 = internal::random(0,rows-2);
+ int j1 = internal::random(0,rows-2);
+ int n0 = internal::random<int>(1,rows-std::max(j0,j1));
VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(0,j0,rows,n0));
VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),
refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));
@@ -226,7 +226,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
m2.startVec(j);
for (int i=0; i<m2.innerSize(); ++i)
{
- float x = ei_random<float>(0,1);
+ float x = internal::random<float>(0,1);
if (x<0.1)
{
// do nothing
@@ -246,7 +246,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
m2.finalize();
VERIFY(countFalseNonZero+countTrueNonZero == m2.nonZeros());
VERIFY_IS_APPROX(m2, refM2);
- m2.prune(1);
+ m2.prune(Scalar(1));
VERIFY(countTrueNonZero==m2.nonZeros());
VERIFY_IS_APPROX(m2, refM2);
}
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp
index d4809711c..ce42c5f52 100644
--- a/test/sparse_product.cpp
+++ b/test/sparse_product.cpp
@@ -36,8 +36,8 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;
- Scalar s1 = ei_random<Scalar>();
- Scalar s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
+ Scalar s2 = internal::random<Scalar>();
// test matrix-matrix product
{
@@ -54,7 +54,7 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
initSparse<Scalar>(density, refMat3, m3);
initSparse<Scalar>(density, refMat4, m4);
- int c = ei_random<int>(0,rows-1);
+ int c = internal::random<int>(0,rows-1);
VERIFY_IS_APPROX(m4=m2*m3, refMat4=refMat2*refMat3);
VERIFY_IS_APPROX(m4=m2.transpose()*m3, refMat4=refMat2.transpose()*refMat3);
diff --git a/test/sparse_solvers.cpp b/test/sparse_solvers.cpp
index ed54feddc..aba61e6c0 100644
--- a/test/sparse_solvers.cpp
+++ b/test/sparse_solvers.cpp
@@ -111,7 +111,7 @@ void test_sparse_solvers()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1(sparse_solvers<double>(8, 8) );
- int s = ei_random<int>(1,300);
+ int s = internal::random<int>(1,300);
CALL_SUBTEST_2(sparse_solvers<std::complex<double> >(s,s) );
CALL_SUBTEST_1(sparse_solvers<double>(s,s) );
}
diff --git a/test/sparse_vector.cpp b/test/sparse_vector.cpp
index a5101398c..be85740c0 100644
--- a/test/sparse_vector.cpp
+++ b/test/sparse_vector.cpp
@@ -48,7 +48,7 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
initSparse<Scalar>(densityVec, refV2, v2);
initSparse<Scalar>(densityVec, refV3, v3);
- Scalar s1 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
// test coeff and coeffRef
for (unsigned int i=0; i<zerocoords.size(); ++i)
diff --git a/test/stable_norm.cpp b/test/stable_norm.cpp
index f3e671c3b..69e4a1b12 100644
--- a/test/stable_norm.cpp
+++ b/test/stable_norm.cpp
@@ -55,7 +55,7 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
Index rows = m.rows();
Index cols = m.cols();
- Scalar big = ei_random<Scalar>() * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
+ Scalar big = internal::random<Scalar>() * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
Scalar small = static_cast<RealScalar>(1)/big;
MatrixType vzero = MatrixType::Zero(rows, cols),
@@ -75,33 +75,33 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
// test isFinite
VERIFY(!isFinite( std::numeric_limits<RealScalar>::infinity()));
- VERIFY(!isFinite(ei_sqrt(-ei_abs(big))));
+ VERIFY(!isFinite(internal::sqrt(-internal::abs(big))));
// test overflow
- VERIFY(isFinite(ei_sqrt(size)*ei_abs(big)));
+ VERIFY(isFinite(internal::sqrt(size)*internal::abs(big)));
#ifdef EIGEN_VECTORIZE_SSE
// since x87 FPU uses 80bits of precision overflow is not detected
- if(ei_packet_traits<Scalar>::size>1)
+ if(internal::packet_traits<Scalar>::size>1)
{
- VERIFY_IS_NOT_APPROX(static_cast<Scalar>(vbig.norm()), ei_sqrt(size)*big); // here the default norm must fail
+ VERIFY_IS_NOT_APPROX(static_cast<Scalar>(vbig.norm()), internal::sqrt(size)*big); // here the default norm must fail
}
#endif
- VERIFY_IS_APPROX(vbig.stableNorm(), ei_sqrt(size)*ei_abs(big));
- VERIFY_IS_APPROX(vbig.blueNorm(), ei_sqrt(size)*ei_abs(big));
- VERIFY_IS_APPROX(vbig.hypotNorm(), ei_sqrt(size)*ei_abs(big));
+ VERIFY_IS_APPROX(vbig.stableNorm(), internal::sqrt(size)*internal::abs(big));
+ VERIFY_IS_APPROX(vbig.blueNorm(), internal::sqrt(size)*internal::abs(big));
+ VERIFY_IS_APPROX(vbig.hypotNorm(), internal::sqrt(size)*internal::abs(big));
// test underflow
- VERIFY(isFinite(ei_sqrt(size)*ei_abs(small)));
+ VERIFY(isFinite(internal::sqrt(size)*internal::abs(small)));
#ifdef EIGEN_VECTORIZE_SSE
// since x87 FPU uses 80bits of precision underflow is not detected
- if(ei_packet_traits<Scalar>::size>1)
+ if(internal::packet_traits<Scalar>::size>1)
{
- VERIFY_IS_NOT_APPROX(static_cast<Scalar>(vsmall.norm()), ei_sqrt(size)*small); // here the default norm must fail
+ VERIFY_IS_NOT_APPROX(static_cast<Scalar>(vsmall.norm()), internal::sqrt(size)*small); // here the default norm must fail
}
#endif
- VERIFY_IS_APPROX(vsmall.stableNorm(), ei_sqrt(size)*ei_abs(small));
- VERIFY_IS_APPROX(vsmall.blueNorm(), ei_sqrt(size)*ei_abs(small));
- VERIFY_IS_APPROX(vsmall.hypotNorm(), ei_sqrt(size)*ei_abs(small));
+ VERIFY_IS_APPROX(vsmall.stableNorm(), internal::sqrt(size)*internal::abs(small));
+ VERIFY_IS_APPROX(vsmall.blueNorm(), internal::sqrt(size)*internal::abs(small));
+ VERIFY_IS_APPROX(vsmall.hypotNorm(), internal::sqrt(size)*internal::abs(small));
// Test compilation of cwise() version
VERIFY_IS_APPROX(vrand.colwise().stableNorm(), vrand.colwise().norm());
@@ -117,8 +117,8 @@ void test_stable_norm()
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( stable_norm(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( stable_norm(Vector4d()) );
- CALL_SUBTEST_3( stable_norm(VectorXd(ei_random<int>(10,2000))) );
- CALL_SUBTEST_4( stable_norm(VectorXf(ei_random<int>(10,2000))) );
- CALL_SUBTEST_5( stable_norm(VectorXcd(ei_random<int>(10,2000))) );
+ CALL_SUBTEST_3( stable_norm(VectorXd(internal::random<int>(10,2000))) );
+ CALL_SUBTEST_4( stable_norm(VectorXf(internal::random<int>(10,2000))) );
+ CALL_SUBTEST_5( stable_norm(VectorXcd(internal::random<int>(10,2000))) );
}
}
diff --git a/test/stddeque.cpp b/test/stddeque.cpp
new file mode 100644
index 000000000..45084bdfc
--- /dev/null
+++ b/test/stddeque.cpp
@@ -0,0 +1,147 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>
+//
+// Eigen is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#include "main.h"
+#include <Eigen/StdDeque>
+#include <Eigen/Geometry>
+
+template<typename MatrixType>
+void check_stddeque_matrix(const MatrixType& m)
+{
+ typedef typename MatrixType::Index Index;
+
+ Index rows = m.rows();
+ Index cols = m.cols();
+ MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
+ std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);
+ v.front() = x;
+ w.front() = w.back();
+ VERIFY_IS_APPROX(w.front(), w.back());
+ v = w;
+
+ typename std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator vi = v.begin();
+ typename std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator wi = w.begin();
+ for(int i = 0; i < 20; i++)
+ {
+ VERIFY_IS_APPROX(*vi, *wi);
+ ++vi;
+ ++wi;
+ }
+
+ v.resize(21);
+ v.back() = x;
+ VERIFY_IS_APPROX(v.back(), x);
+ v.resize(22,y);
+ VERIFY_IS_APPROX(v.back(), y);
+ v.push_back(x);
+ VERIFY_IS_APPROX(v.back(), x);
+}
+
+template<typename TransformType>
+void check_stddeque_transform(const TransformType&)
+{
+ typedef typename TransformType::MatrixType MatrixType;
+ TransformType x(MatrixType::Random()), y(MatrixType::Random());
+ std::deque<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y);
+ v.front() = x;
+ w.front() = w.back();
+ VERIFY_IS_APPROX(w.front(), w.back());
+ v = w;
+
+ typename std::deque<TransformType,Eigen::aligned_allocator<TransformType> >::iterator vi = v.begin();
+ typename std::deque<TransformType,Eigen::aligned_allocator<TransformType> >::iterator wi = w.begin();
+ for(int i = 0; i < 20; i++)
+ {
+ VERIFY_IS_APPROX(*vi, *wi);
+ ++vi;
+ ++wi;
+ }
+
+ v.resize(21);
+ v.back() = x;
+ VERIFY_IS_APPROX(v.back(), x);
+ v.resize(22,y);
+ VERIFY_IS_APPROX(v.back(), y);
+ v.push_back(x);
+ VERIFY_IS_APPROX(v.back(), x);
+}
+
+template<typename QuaternionType>
+void check_stddeque_quaternion(const QuaternionType&)
+{
+ typedef typename QuaternionType::Coefficients Coefficients;
+ QuaternionType x(Coefficients::Random()), y(Coefficients::Random());
+ std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> > v(10), w(20, y);
+ v.front() = x;
+ w.front() = w.back();
+ VERIFY_IS_APPROX(w.front(), w.back());
+ v = w;
+
+ typename std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator vi = v.begin();
+ typename std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator wi = w.begin();
+ for(int i = 0; i < 20; i++)
+ {
+ VERIFY_IS_APPROX(*vi, *wi);
+ ++vi;
+ ++wi;
+ }
+
+ v.resize(21);
+ v.back() = x;
+ VERIFY_IS_APPROX(v.back(), x);
+ v.resize(22,y);
+ VERIFY_IS_APPROX(v.back(), y);
+ v.push_back(x);
+ VERIFY_IS_APPROX(v.back(), x);
+}
+
+void test_stddeque()
+{
+ // some non vectorizable fixed sizes
+ CALL_SUBTEST_1(check_stddeque_matrix(Vector2f()));
+ CALL_SUBTEST_1(check_stddeque_matrix(Matrix3f()));
+ CALL_SUBTEST_2(check_stddeque_matrix(Matrix3d()));
+
+ // some vectorizable fixed sizes
+ CALL_SUBTEST_1(check_stddeque_matrix(Matrix2f()));
+ CALL_SUBTEST_1(check_stddeque_matrix(Vector4f()));
+ CALL_SUBTEST_1(check_stddeque_matrix(Matrix4f()));
+ CALL_SUBTEST_2(check_stddeque_matrix(Matrix4d()));
+
+ // some dynamic sizes
+ CALL_SUBTEST_3(check_stddeque_matrix(MatrixXd(1,1)));
+ CALL_SUBTEST_3(check_stddeque_matrix(VectorXd(20)));
+ CALL_SUBTEST_3(check_stddeque_matrix(RowVectorXf(20)));
+ CALL_SUBTEST_3(check_stddeque_matrix(MatrixXcf(10,10)));
+
+ // some Transform
+ CALL_SUBTEST_4(check_stddeque_transform(Affine2f()));
+ CALL_SUBTEST_4(check_stddeque_transform(Affine3f()));
+ CALL_SUBTEST_4(check_stddeque_transform(Affine3d()));
+
+ // some Quaternion
+ CALL_SUBTEST_5(check_stddeque_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_stddeque_quaternion(Quaterniond()));
+}
diff --git a/test/svd.cpp b/test/svd.cpp
deleted file mode 100644
index 1452e39bf..000000000
--- a/test/svd.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// This file is part of Eigen, a lightweight C++ template library
-// for linear algebra.
-//
-// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
-//
-// Eigen is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// Alternatively, you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License and a copy of the GNU General Public License along with
-// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
-#include "main.h"
-#include <Eigen/SVD>
-#include <Eigen/LU>
-
-template<typename MatrixType> void svd(const MatrixType& m)
-{
- /* this test covers the following files:
- SVD.h
- */
- typename MatrixType::Index rows = m.rows();
- typename MatrixType::Index cols = m.cols();
-
- typedef typename MatrixType::Scalar Scalar;
- typedef typename NumTraits<Scalar>::Real RealScalar;
- MatrixType a = MatrixType::Random(rows,cols);
- Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> x(cols,1), x2(cols,1);
-
- {
- SVD<MatrixType> svd(a);
- MatrixType sigma = MatrixType::Zero(rows,cols);
- MatrixType matU = MatrixType::Zero(rows,rows);
- MatrixType matV = MatrixType::Zero(cols,cols);
-
- sigma.diagonal() = svd.singularValues();
- matU = svd.matrixU();
- VERIFY_IS_UNITARY(matU);
- matV = svd.matrixV();
- VERIFY_IS_UNITARY(matV);
- VERIFY_IS_APPROX(a, matU * sigma * matV.transpose());
- }
-
-
- if (rows>=cols)
- {
- SVD<MatrixType> svd(a);
- Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> b = Matrix<Scalar, MatrixType::ColsAtCompileTime, 1>::Random(rows,1);
- Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> x = svd.solve(b);
- // evaluate normal equation which works also for least-squares solutions
- VERIFY_IS_APPROX(a.adjoint()*a*x,a.adjoint()*b);
- }
-
-
- if(rows==cols)
- {
- SVD<MatrixType> svd(a);
- MatrixType unitary, positive;
- svd.computeUnitaryPositive(&unitary, &positive);
- VERIFY_IS_APPROX(unitary * unitary.adjoint(), MatrixType::Identity(unitary.rows(),unitary.rows()));
- VERIFY_IS_APPROX(positive, positive.adjoint());
- for(int i = 0; i < rows; i++) VERIFY(positive.diagonal()[i] >= 0); // cheap necessary (not sufficient) condition for positivity
- VERIFY_IS_APPROX(unitary*positive, a);
-
- svd.computePositiveUnitary(&positive, &unitary);
- VERIFY_IS_APPROX(unitary * unitary.adjoint(), MatrixType::Identity(unitary.rows(),unitary.rows()));
- VERIFY_IS_APPROX(positive, positive.adjoint());
- for(int i = 0; i < rows; i++) VERIFY(positive.diagonal()[i] >= 0); // cheap necessary (not sufficient) condition for positivity
- VERIFY_IS_APPROX(positive*unitary, a);
- }
-}
-
-template<typename MatrixType> void svd_verify_assert()
-{
- MatrixType tmp;
-
- SVD<MatrixType> svd;
- VERIFY_RAISES_ASSERT(svd.solve(tmp))
- VERIFY_RAISES_ASSERT(svd.matrixU())
- VERIFY_RAISES_ASSERT(svd.singularValues())
- VERIFY_RAISES_ASSERT(svd.matrixV())
- VERIFY_RAISES_ASSERT(svd.computeUnitaryPositive(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computePositiveUnitary(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computeRotationScaling(&tmp,&tmp))
- VERIFY_RAISES_ASSERT(svd.computeScalingRotation(&tmp,&tmp))
-
- VERIFY_RAISES_ASSERT(SVD<MatrixXf>(10, 20))
-}
-
-void test_svd()
-{
- for(int i = 0; i < g_repeat; i++)
- {
- CALL_SUBTEST_1( svd(Matrix3f()) );
- CALL_SUBTEST_2( svd(Matrix4d()) );
-
- int cols = ei_random<int>(2,50);
- int rows = cols + ei_random<int>(0,50);
- CALL_SUBTEST_3( svd(MatrixXf(rows,cols)) );
- CALL_SUBTEST_4( svd(MatrixXd(rows,cols)) );
-
- //complex are not implemented yet
- //CALL_SUBTEST(svd(MatrixXcd(6,6)) );
- //CALL_SUBTEST(svd(MatrixXcf(3,3)) );
- }
-
- CALL_SUBTEST_1( svd_verify_assert<Matrix3f>() );
- CALL_SUBTEST_2( svd_verify_assert<Matrix4d>() );
- CALL_SUBTEST_3( svd_verify_assert<MatrixXf>() );
- CALL_SUBTEST_4( svd_verify_assert<MatrixXd>() );
-}
diff --git a/test/swap.cpp b/test/swap.cpp
index 74543a662..b18562f28 100644
--- a/test/swap.cpp
+++ b/test/swap.cpp
@@ -42,7 +42,7 @@ template<typename MatrixType> void swap(const MatrixType& m)
typedef typename other_matrix_type<MatrixType>::type OtherMatrixType;
typedef typename MatrixType::Scalar Scalar;
- ei_assert((!ei_is_same_type<MatrixType,OtherMatrixType>::ret));
+ eigen_assert((!internal::is_same<MatrixType,OtherMatrixType>::value));
typename MatrixType::Index rows = m.rows();
typename MatrixType::Index cols = m.cols();
diff --git a/test/triangular.cpp b/test/triangular.cpp
index bf5db4e27..0c69749e0 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -88,7 +88,7 @@ template<typename MatrixType> void triangular_square(const MatrixType& m)
m1 = MatrixType::Random(rows, cols);
for (int i=0; i<rows; ++i)
- while (ei_abs2(m1(i,i))<1e-1) m1(i,i) = ei_random<Scalar>();
+ while (internal::abs2(m1(i,i))<1e-1) m1(i,i) = internal::random<Scalar>();
Transpose<MatrixType> trm4(m4);
// test back and forward subsitution with a vector as the rhs
@@ -239,8 +239,8 @@ void test_triangular()
{
for(int i = 0; i < g_repeat ; i++)
{
- int r = ei_random<int>(2,20); EIGEN_UNUSED_VARIABLE(r);
- int c = ei_random<int>(2,20); EIGEN_UNUSED_VARIABLE(c);
+ int r = internal::random<int>(2,20); EIGEN_UNUSED_VARIABLE(r);
+ int c = internal::random<int>(2,20); EIGEN_UNUSED_VARIABLE(c);
CALL_SUBTEST_1( triangular_square(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( triangular_square(Matrix<float, 2, 2>()) );
diff --git a/test/umeyama.cpp b/test/umeyama.cpp
index 6c710bc88..abbb1fc7f 100644
--- a/test/umeyama.cpp
+++ b/test/umeyama.cpp
@@ -82,7 +82,7 @@ Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> randMatrixUnitary(int size)
}
if (max_tries == 0)
- ei_assert(false && "randMatrixUnitary: Could not construct unitary matrix!");
+ eigen_assert(false && "randMatrixUnitary: Could not construct unitary matrix!");
return Q;
}
@@ -100,7 +100,7 @@ Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> randMatrixSpecialUnitary(int si
MatrixType Q = randMatrixUnitary<Scalar>(size);
// tweak the first column to make the determinant be 1
- Q.col(0) *= ei_conj(Q.determinant());
+ Q.col(0) *= internal::conj(Q.determinant());
return Q;
}
@@ -108,13 +108,13 @@ Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> randMatrixSpecialUnitary(int si
template <typename MatrixType>
void run_test(int dim, int num_elements)
{
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
+ typedef typename internal::traits<MatrixType>::Scalar Scalar;
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
typedef Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
// MUST be positive because in any other case det(cR_t) may become negative for
// odd dimensions!
- const Scalar c = ei_abs(ei_random<Scalar>());
+ const Scalar c = internal::abs(internal::random<Scalar>());
MatrixX R = randMatrixSpecialUnitary<Scalar>(dim);
VectorX t = Scalar(50)*VectorX::Random(dim,1);
@@ -147,7 +147,7 @@ void run_fixed_size_test(int num_elements)
// MUST be positive because in any other case det(cR_t) may become negative for
// odd dimensions!
- const Scalar c = ei_abs(ei_random<Scalar>());
+ const Scalar c = internal::abs(internal::random<Scalar>());
FixedMatrix R = randMatrixSpecialUnitary<Scalar>(dim);
FixedVector t = Scalar(50)*FixedVector::Random(dim,1);
@@ -175,7 +175,7 @@ void test_umeyama()
{
for (int i=0; i<g_repeat; ++i)
{
- const int num_elements = ei_random<int>(40,500);
+ const int num_elements = internal::random<int>(40,500);
// works also for dimensions bigger than 3...
for (int dim=2; dim<8; ++dim)
diff --git a/test/vectorization_logic.cpp b/test/vectorization_logic.cpp
index 2b23d4082..1a00af840 100644
--- a/test/vectorization_logic.cpp
+++ b/test/vectorization_logic.cpp
@@ -46,15 +46,15 @@ std::string demangle_unrolling(int t)
template<typename Dst, typename Src>
bool test_assign(const Dst&, const Src&, int traversal, int unrolling)
{
- ei_assign_traits<Dst,Src>::debug();
- bool res = ei_assign_traits<Dst,Src>::Traversal==traversal
- && ei_assign_traits<Dst,Src>::Unrolling==unrolling;
+ internal::assign_traits<Dst,Src>::debug();
+ bool res = internal::assign_traits<Dst,Src>::Traversal==traversal
+ && internal::assign_traits<Dst,Src>::Unrolling==unrolling;
if(!res)
{
std::cerr << " Expected Traversal == " << demangle_traversal(traversal)
- << " got " << demangle_traversal(ei_assign_traits<Dst,Src>::Traversal) << "\n";
+ << " got " << demangle_traversal(internal::assign_traits<Dst,Src>::Traversal) << "\n";
std::cerr << " Expected Unrolling == " << demangle_unrolling(unrolling)
- << " got " << demangle_unrolling(ei_assign_traits<Dst,Src>::Unrolling) << "\n";
+ << " got " << demangle_unrolling(internal::assign_traits<Dst,Src>::Unrolling) << "\n";
}
return res;
}
@@ -62,15 +62,15 @@ bool test_assign(const Dst&, const Src&, int traversal, int unrolling)
template<typename Dst, typename Src>
bool test_assign(int traversal, int unrolling)
{
- ei_assign_traits<Dst,Src>::debug();
- bool res = ei_assign_traits<Dst,Src>::Traversal==traversal
- && ei_assign_traits<Dst,Src>::Unrolling==unrolling;
+ internal::assign_traits<Dst,Src>::debug();
+ bool res = internal::assign_traits<Dst,Src>::Traversal==traversal
+ && internal::assign_traits<Dst,Src>::Unrolling==unrolling;
if(!res)
{
std::cerr << " Expected Traversal == " << demangle_traversal(traversal)
- << " got " << demangle_traversal(ei_assign_traits<Dst,Src>::Traversal) << "\n";
+ << " got " << demangle_traversal(internal::assign_traits<Dst,Src>::Traversal) << "\n";
std::cerr << " Expected Unrolling == " << demangle_unrolling(unrolling)
- << " got " << demangle_unrolling(ei_assign_traits<Dst,Src>::Unrolling) << "\n";
+ << " got " << demangle_unrolling(internal::assign_traits<Dst,Src>::Unrolling) << "\n";
}
return res;
}
@@ -78,7 +78,7 @@ bool test_assign(int traversal, int unrolling)
template<typename Xpr>
bool test_redux(const Xpr&, int traversal, int unrolling)
{
- typedef ei_redux_traits<ei_scalar_sum_op<typename Xpr::Scalar>,Xpr> traits;
+ typedef internal::redux_traits<internal::scalar_sum_op<typename Xpr::Scalar>,Xpr> traits;
bool res = traits::Traversal==traversal && traits::Unrolling==unrolling;
if(!res)
{
@@ -90,10 +90,10 @@ bool test_redux(const Xpr&, int traversal, int unrolling)
return res;
}
-template<typename Scalar, bool Enable = ei_packet_traits<Scalar>::Vectorizable> struct vectorization_logic
+template<typename Scalar, bool Enable = internal::packet_traits<Scalar>::Vectorizable> struct vectorization_logic
{
enum {
- PacketSize = ei_packet_traits<Scalar>::size
+ PacketSize = internal::packet_traits<Scalar>::size
};
static void run()
{
@@ -221,7 +221,7 @@ void test_vectorization_logic()
vectorization_logic<std::complex<float> >::run();
vectorization_logic<std::complex<double> >::run();
- if(ei_packet_traits<float>::Vectorizable)
+ if(internal::packet_traits<float>::Vectorizable)
{
VERIFY(test_assign(Matrix<float,3,3>(),Matrix<float,3,3>()+Matrix<float,3,3>(),
LinearTraversal,CompleteUnrolling));
@@ -230,7 +230,7 @@ void test_vectorization_logic()
DefaultTraversal,CompleteUnrolling));
}
- if(ei_packet_traits<double>::Vectorizable)
+ if(internal::packet_traits<double>::Vectorizable)
{
VERIFY(test_assign(Matrix<double,3,3>(),Matrix<double,3,3>()+Matrix<double,3,3>(),
LinearTraversal,CompleteUnrolling));
diff --git a/test/visitor.cpp b/test/visitor.cpp
index 1ddabc63d..2552c6c26 100644
--- a/test/visitor.cpp
+++ b/test/visitor.cpp
@@ -38,7 +38,7 @@ template<typename MatrixType> void matrixVisitor(const MatrixType& p)
for(Index i = 0; i < m.size(); i++)
for(Index i2 = 0; i2 < i; i2++)
while(m(i) == m(i2)) // yes, ==
- m(i) = ei_random<Scalar>();
+ m(i) = internal::random<Scalar>();
Scalar minc = Scalar(1000), maxc = Scalar(-1000);
Index minrow=0,mincol=0,maxrow=0,maxcol=0;
@@ -85,7 +85,7 @@ template<typename VectorType> void vectorVisitor(const VectorType& w)
for(Index i = 0; i < size; i++)
for(Index i2 = 0; i2 < i; i2++)
while(v(i) == v(i2)) // yes, ==
- v(i) = ei_random<Scalar>();
+ v(i) = internal::random<Scalar>();
Scalar minc = Scalar(1000), maxc = Scalar(-1000);
Index minidx=0,maxidx=0;
diff --git a/unsupported/Eigen/AdolcForward b/unsupported/Eigen/AdolcForward
index 8f1a00d20..cb71fbcd6 100644
--- a/unsupported/Eigen/AdolcForward
+++ b/unsupported/Eigen/AdolcForward
@@ -66,7 +66,7 @@ namespace Eigen {
* see https://projects.coin-or.org/ADOL-C for more information.
* It mainly consists in:
* - a struct Eigen::NumTraits<adtl::adouble> specialization
- * - overloads of ei_* math function for adtl::adouble type.
+ * - overloads of internal::* math function for adtl::adouble type.
*
* Note that the maximal number of directions is controlled by
* the preprocessor token NUMBER_DIRECTIONS. The default is 2.
@@ -80,21 +80,26 @@ namespace Eigen {
} // namespace Eigen
// the Adolc's type adouble is defined in the adtl namespace
-// therefore, the following ei_* functions *must* be defined
+// therefore, the following internal::* functions *must* be defined
// in the same namespace
-namespace adtl {
-
- inline const adouble& ei_conj(const adouble& x) { return x; }
- inline const adouble& ei_real(const adouble& x) { return x; }
- inline adouble ei_imag(const adouble&) { return 0.; }
- inline adouble ei_abs(const adouble& x) { return fabs(x); }
- inline adouble ei_abs2(const adouble& x) { return x*x; }
- inline adouble ei_sqrt(const adouble& x) { return sqrt(x); }
- inline adouble ei_exp(const adouble& x) { return exp(x); }
- inline adouble ei_log(const adouble& x) { return log(x); }
- inline adouble ei_sin(const adouble& x) { return sin(x); }
- inline adouble ei_cos(const adouble& x) { return cos(x); }
- inline adouble ei_pow(const adouble& x, adouble y) { return pow(x, y); }
+namespace Eigen {
+
+ namespace internal {
+
+ inline const adtl::adouble& conj(const adtl::adouble& x) { return x; }
+ inline const adtl::adouble& real(const adtl::adouble& x) { return x; }
+ inline adtl::adouble imag(const adtl::adouble&) { return 0.; }
+ inline adtl::adouble abs(const adtl::adouble& x) { return adtl::fabs(x); }
+ inline adtl::adouble abs2(const adtl::adouble& x) { return x*x; }
+
+ using adtl::sqrt;
+ using adtl::exp;
+ using adtl::log;
+ using adtl::sin;
+ using adtl::cos;
+ using adtl::pow;
+
+ }
}
@@ -140,7 +145,7 @@ public:
void operator() (const InputType& x, ValueType* v, JacobianType* _jac) const
{
- ei_assert(v!=0);
+ eigen_assert(v!=0);
if (!_jac)
{
Functor::operator()(x, v);
diff --git a/unsupported/Eigen/AlignedVector3 b/unsupported/Eigen/AlignedVector3
index 7efe4ac21..804142a00 100644
--- a/unsupported/Eigen/AlignedVector3
+++ b/unsupported/Eigen/AlignedVector3
@@ -52,10 +52,12 @@ namespace Eigen {
// TODO specialize Cwise
template<typename _Scalar> class AlignedVector3;
-template<typename _Scalar> struct ei_traits<AlignedVector3<_Scalar> >
- : ei_traits<Matrix<_Scalar,3,1,0,4,1> >
+namespace internal {
+template<typename _Scalar> struct traits<AlignedVector3<_Scalar> >
+ : traits<Matrix<_Scalar,3,1,0,4,1> >
{
};
+}
template<typename _Scalar> class AlignedVector3
: public MatrixBase<AlignedVector3<_Scalar> >
@@ -151,8 +153,8 @@ template<typename _Scalar> class AlignedVector3
inline Scalar dot(const AlignedVector3& other) const
{
- ei_assert(m_coeffs.w()==Scalar(0));
- ei_assert(other.m_coeffs.w()==Scalar(0));
+ eigen_assert(m_coeffs.w()==Scalar(0));
+ eigen_assert(other.m_coeffs.w()==Scalar(0));
return m_coeffs.dot(other.m_coeffs);
}
@@ -168,19 +170,19 @@ template<typename _Scalar> class AlignedVector3
inline Scalar sum() const
{
- ei_assert(m_coeffs.w()==Scalar(0));
+ eigen_assert(m_coeffs.w()==Scalar(0));
return m_coeffs.sum();
}
inline Scalar squaredNorm() const
{
- ei_assert(m_coeffs.w()==Scalar(0));
+ eigen_assert(m_coeffs.w()==Scalar(0));
return m_coeffs.squaredNorm();
}
inline Scalar norm() const
{
- return ei_sqrt(squaredNorm());
+ return internal::sqrt(squaredNorm());
}
inline AlignedVector3 cross(const AlignedVector3& other) const
diff --git a/unsupported/Eigen/CholmodSupport b/unsupported/Eigen/CholmodSupport
index 7b7cb2171..8253ad167 100644
--- a/unsupported/Eigen/CholmodSupport
+++ b/unsupported/Eigen/CholmodSupport
@@ -21,9 +21,10 @@ namespace Eigen {
*/
struct Cholmod {};
-
+#include "src/SparseExtra/CholmodSupportLegacy.h"
#include "src/SparseExtra/CholmodSupport.h"
+
} // namespace Eigen
#include "../../Eigen/src/Core/util/EnableMSVCWarnings.h"
diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT
index a72198ccf..0b2823058 100644
--- a/unsupported/Eigen/FFT
+++ b/unsupported/Eigen/FFT
@@ -88,23 +88,23 @@
# include <fftw3.h>
namespace Eigen {
# include "src/FFT/ei_fftw_impl.h"
- //template <typename T> typedef struct ei_fftw_impl default_fft_impl; this does not work
- template <typename T> struct default_fft_impl : public ei_fftw_impl<T> {};
+ //template <typename T> typedef struct internal::fftw_impl default_fft_impl; this does not work
+ template <typename T> struct default_fft_impl : public internal::fftw_impl<T> {};
}
#elif defined EIGEN_MKL_DEFAULT
// TODO
// intel Math Kernel Library: fastest, commercial -- may be incompatible with Eigen in GPL form
namespace Eigen {
# include "src/FFT/ei_imklfft_impl.h"
- template <typename T> struct default_fft_impl : public ei_imklfft_impl {};
+ template <typename T> struct default_fft_impl : public internal::imklfft_impl {};
}
#else
-// ei_kissfft_impl: small, free, reasonably efficient default, derived from kissfft
+// internal::kissfft_impl: small, free, reasonably efficient default, derived from kissfft
//
namespace Eigen {
# include "src/FFT/ei_kissfft_impl.h"
template <typename T>
- struct default_fft_impl : public ei_kissfft_impl<T> {};
+ struct default_fft_impl : public internal::kissfft_impl<T> {};
}
#endif
@@ -115,16 +115,18 @@ namespace Eigen {
template<typename T_SrcMat,typename T_FftIfc> struct fft_fwd_proxy;
template<typename T_SrcMat,typename T_FftIfc> struct fft_inv_proxy;
+namespace internal {
template<typename T_SrcMat,typename T_FftIfc>
-struct ei_traits< fft_fwd_proxy<T_SrcMat,T_FftIfc> >
+struct traits< fft_fwd_proxy<T_SrcMat,T_FftIfc> >
{
typedef typename T_SrcMat::PlainObject ReturnType;
};
template<typename T_SrcMat,typename T_FftIfc>
-struct ei_traits< fft_inv_proxy<T_SrcMat,T_FftIfc> >
+struct traits< fft_inv_proxy<T_SrcMat,T_FftIfc> >
{
typedef typename T_SrcMat::PlainObject ReturnType;
};
+}
template<typename T_SrcMat,typename T_FftIfc>
struct fft_fwd_proxy
@@ -238,7 +240,7 @@ class FFT
EIGEN_STATIC_ASSERT_VECTOR_ONLY(InputDerived)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived)
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived,InputDerived) // size at compile-time
- EIGEN_STATIC_ASSERT((ei_is_same_type<dst_type, Complex>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<dst_type, Complex>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
EIGEN_STATIC_ASSERT(int(InputDerived::Flags)&int(ComplexDerived::Flags)&DirectAccessBit,
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
@@ -307,7 +309,7 @@ class FFT
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OutputDerived)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived)
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived,OutputDerived) // size at compile-time
- EIGEN_STATIC_ASSERT((ei_is_same_type<src_type, Complex>::ret),
+ EIGEN_STATIC_ASSERT((internal::is_same<src_type, Complex>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
EIGEN_STATIC_ASSERT(int(OutputDerived::Flags)&int(ComplexDerived::Flags)&DirectAccessBit,
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
diff --git a/unsupported/Eigen/MPRealSupport b/unsupported/Eigen/MPRealSupport
index abc719ba7..37e75b2c7 100644
--- a/unsupported/Eigen/MPRealSupport
+++ b/unsupported/Eigen/MPRealSupport
@@ -102,7 +102,9 @@ int main()
}
};
- template<> mpfr::mpreal ei_random<mpfr::mpreal>()
+ namespace internal {
+
+ template<> mpfr::mpreal random<mpfr::mpreal>()
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
static gmp_randstate_t state;
@@ -117,44 +119,43 @@ int main()
return mpfr::urandom(state)*2-1;
#else
- return mpfr::mpreal(ei_random<double>());
+ return mpfr::mpreal(random<double>());
#endif
}
- template<> mpfr::mpreal ei_random<mpfr::mpreal>(const mpfr::mpreal& a, const mpfr::mpreal& b)
+ template<> mpfr::mpreal random<mpfr::mpreal>(const mpfr::mpreal& a, const mpfr::mpreal& b)
{
- return a + (b-a) * ei_random<mpfr::mpreal>();
+ return a + (b-a) * random<mpfr::mpreal>();
}
-}
-namespace mpfr {
-
- inline const mpreal& ei_conj(const mpreal& x) { return x; }
- inline const mpreal& ei_real(const mpreal& x) { return x; }
- inline mpreal ei_imag(const mpreal&) { return 0.0; }
- inline mpreal ei_abs(const mpreal& x) { return fabs(x); }
- inline mpreal ei_abs2(const mpreal& x) { return x*x; }
- inline mpreal ei_sqrt(const mpreal& x) { return sqrt(x); }
- inline mpreal ei_exp(const mpreal& x) { return exp(x); }
- inline mpreal ei_log(const mpreal& x) { return log(x); }
- inline mpreal ei_sin(const mpreal& x) { return sin(x); }
- inline mpreal ei_cos(const mpreal& x) { return cos(x); }
- inline mpreal ei_pow(const mpreal& x, mpreal& y) { return pow(x, y); }
-
- bool ei_isMuchSmallerThan(const mpreal& a, const mpreal& b, const mpreal& prec)
+ template<> struct conj_impl<mpfr::mpreal> { inline static const mpfr::mpreal& run(const mpfr::mpreal& x) { return x; } };
+ template<> struct real_impl<mpfr::mpreal> { inline static const mpfr::mpreal& run(const mpfr::mpreal& x) { return x; } };
+ template<> struct imag_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal&) { return mpfr::mpreal(0); } };
+ template<> struct abs_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::fabs(x); } };
+ template<> struct abs2_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return x*x; } };
+ template<> struct sqrt_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::sqrt(x); } };
+ template<> struct exp_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::exp(x); } };
+ template<> struct log_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::log(x); } };
+ template<> struct sin_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::sin(x); } };
+ template<> struct cos_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x) { return mpfr::cos(x); } };
+ template<> struct pow_impl<mpfr::mpreal> { inline static const mpfr::mpreal run(const mpfr::mpreal& x, const mpfr::mpreal& y) { return mpfr::pow(x, y); } };
+
+ bool isMuchSmallerThan(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
{
- return ei_abs(a) <= abs(b) * prec;
+ return mpfr::abs(a) <= mpfr::abs(b) * prec;
}
- inline bool ei_isApprox(const mpreal& a, const mpreal& b, const mpreal& prec)
+ inline bool isApprox(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
{
- return ei_abs(a - b) <= min(abs(a), abs(b)) * prec;
+ return mpfr::abs(a - b) <= mpfr::min(mpfr::abs(a), mpfr::abs(b)) * prec;
}
- inline bool ei_isApproxOrLessThan(const mpreal& a, const mpreal& b, const mpreal& prec)
+ inline bool isApproxOrLessThan(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
{
- return a <= b || ei_isApprox(a, b, prec);
+ return a <= b || isApprox(a, b, prec);
}
+
+ } // end namespace internal
}
#endif // EIGEN_MPREALSUPPORT_MODULE_H
diff --git a/unsupported/Eigen/MatrixFunctions b/unsupported/Eigen/MatrixFunctions
index e0bc4732c..d39c49e53 100644
--- a/unsupported/Eigen/MatrixFunctions
+++ b/unsupported/Eigen/MatrixFunctions
@@ -176,7 +176,7 @@ Output: \verbinclude MatrixExponential.out
Compute a matrix function.
\code
-const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::matrixFunction(typename ei_stem_function<typename ei_traits<Derived>::Scalar>::type f) const
+const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::matrixFunction(typename internal::stem_function<typename internal::traits<Derived>::Scalar>::type f) const
\endcode
\param[in] M argument of matrix function, should be a square matrix.
diff --git a/unsupported/Eigen/OpenGLSupport b/unsupported/Eigen/OpenGLSupport
index 75e7ad48a..0f09cee14 100644
--- a/unsupported/Eigen/OpenGLSupport
+++ b/unsupported/Eigen/OpenGLSupport
@@ -56,39 +56,45 @@ namespace Eigen {
//@{
#define EIGEN_GL_FUNC_DECLARATION(FUNC) \
-template< typename XprType, \
- typename Scalar = typename XprType::Scalar, \
- int Rows = XprType::RowsAtCompileTime, \
- int Cols = XprType::ColsAtCompileTime, \
- bool IsGLCompatible = bool(XprType::Flags&LinearAccessBit) \
- && bool(XprType::Flags&DirectAccessBit) \
- && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
-struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl); \
+namespace internal { \
+ template< typename XprType, \
+ typename Scalar = typename XprType::Scalar, \
+ int Rows = XprType::RowsAtCompileTime, \
+ int Cols = XprType::ColsAtCompileTime, \
+ bool IsGLCompatible = bool(XprType::Flags&LinearAccessBit) \
+ && bool(XprType::Flags&DirectAccessBit) \
+ && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
+ struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl); \
\
-template<typename XprType, typename Scalar, int Rows, int Cols> \
-struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
- inline static void run(const XprType& p) { \
- EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<typename ei_plain_matrix_type_column_major<XprType>::type>::run(p); } \
-}; \
+ template<typename XprType, typename Scalar, int Rows, int Cols> \
+ struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
+ inline static void run(const XprType& p) { \
+ EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<typename plain_matrix_type_column_major<XprType>::type>::run(p); } \
+ }; \
+} \
\
template<typename Derived> inline void FUNC(const Eigen::DenseBase<Derived>& p) { \
- EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<Derived>::run(p.derived()); \
+ EIGEN_CAT(EIGEN_CAT(internal::gl_,FUNC),_impl)<Derived>::run(p.derived()); \
}
#define EIGEN_GL_FUNC_SPECIALIZATION_MAT(FUNC,SCALAR,ROWS,COLS,SUFFIX) \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
+namespace internal { \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
- };
+ }; \
+}
#define EIGEN_GL_FUNC_SPECIALIZATION_VEC(FUNC,SCALAR,SIZE,SUFFIX) \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
+namespace internal { \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
}; \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
- };
+ }; \
+}
EIGEN_GL_FUNC_DECLARATION (glVertex)
@@ -202,45 +208,123 @@ template<typename Derived> void glRotate(const RotationBase<Derived,3>& rot)
#define EIGEN_GL_EVAL(X) X
#define EIGEN_GL_FUNC1_DECLARATION(FUNC,ARG1,CONST) \
-template< typename XprType, \
- typename Scalar = typename XprType::Scalar, \
- int Rows = XprType::RowsAtCompileTime, \
- int Cols = XprType::ColsAtCompileTime, \
- bool IsGLCompatible = bool(XprType::Flags&LinearAccessBit) \
- && bool(XprType::Flags&DirectAccessBit) \
- && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
-struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl); \
- \
-template<typename XprType, typename Scalar, int Rows, int Cols> \
-struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
- inline static void run(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { \
- EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<typename ei_plain_matrix_type_column_major<XprType>::type>::run(a,p); } \
-}; \
- \
-template<typename Derived> inline void FUNC(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) Eigen::DenseBase<Derived>& p) { \
- EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<Derived>::run(a,p.derived()); \
+namespace internal { \
+ template< typename XprType, \
+ typename Scalar = typename XprType::Scalar, \
+ int Rows = XprType::RowsAtCompileTime, \
+ int Cols = XprType::ColsAtCompileTime, \
+ bool IsGLCompatible = bool(XprType::Flags&LinearAccessBit) \
+ && bool(XprType::Flags&DirectAccessBit) \
+ && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
+ struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl); \
+ \
+ template<typename XprType, typename Scalar, int Rows, int Cols> \
+ struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
+ inline static void run(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { \
+ EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<typename plain_matrix_type_column_major<XprType>::type>::run(a,p); } \
+ }; \
+} \
+ \
+template<typename Derived> inline void FUNC(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) Eigen::DenseBase<Derived>& p) { \
+ EIGEN_CAT(EIGEN_CAT(internal::gl_,FUNC),_impl)<Derived>::run(a,p.derived()); \
}
#define EIGEN_GL_FUNC1_SPECIALIZATION_MAT(FUNC,ARG1,CONST,SCALAR,ROWS,COLS,SUFFIX) \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
- inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
- };
+namespace internal { \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
+ inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
+ }; \
+}
#define EIGEN_GL_FUNC1_SPECIALIZATION_VEC(FUNC,ARG1,CONST,SCALAR,SIZE,SUFFIX) \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
- inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
- }; \
- template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(ei_gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
- inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
- };
-
+namespace internal { \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
+ inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
+ }; \
+ template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
+ inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
+ }; \
+}
EIGEN_GL_FUNC1_DECLARATION (glGet,GLenum,_)
EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glGet,GLenum,_,float, 4,4,Floatv)
EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glGet,GLenum,_,double, 4,4,Doublev)
+// glUniform API
+
+#ifdef GL_VERSION_2_0
+
+void glUniform2fv_ei (GLint loc, const float* v) { glUniform2fv(loc,1,v); }
+void glUniform2iv_ei (GLint loc, const int* v) { glUniform2iv(loc,1,v); }
+
+void glUniform3fv_ei (GLint loc, const float* v) { glUniform3fv(loc,1,v); }
+void glUniform3iv_ei (GLint loc, const int* v) { glUniform3iv(loc,1,v); }
+
+void glUniform4fv_ei (GLint loc, const float* v) { glUniform4fv(loc,1,v); }
+void glUniform4iv_ei (GLint loc, const int* v) { glUniform4iv(loc,1,v); }
+
+void glUniformMatrix2fv_ei (GLint loc, const float* v) { glUniformMatrix2fv(loc,1,false,v); }
+void glUniformMatrix3fv_ei (GLint loc, const float* v) { glUniformMatrix3fv(loc,1,false,v); }
+void glUniformMatrix4fv_ei (GLint loc, const float* v) { glUniformMatrix4fv(loc,1,false,v); }
+
+
+EIGEN_GL_FUNC1_DECLARATION (glUniform,GLint,const)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,float, 2,2fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,int, 2,2iv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,float, 3,3fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,int, 3,3iv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,float, 4,4fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,int, 4,4iv_ei)
+
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 2,2,Matrix2fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 3,3,Matrix3fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 4,4,Matrix4fv_ei)
+
+#endif
+
+#ifdef GL_VERSION_2_1
+
+void glUniformMatrix2x3fv_ei(GLint loc, const float* v) { glUniformMatrix2x3fv(loc,1,false,v); }
+void glUniformMatrix3x2fv_ei(GLint loc, const float* v) { glUniformMatrix3x2fv(loc,1,false,v); }
+void glUniformMatrix2x4fv_ei(GLint loc, const float* v) { glUniformMatrix2x4fv(loc,1,false,v); }
+void glUniformMatrix4x2fv_ei(GLint loc, const float* v) { glUniformMatrix4x2fv(loc,1,false,v); }
+void glUniformMatrix3x4fv_ei(GLint loc, const float* v) { glUniformMatrix3x4fv(loc,1,false,v); }
+void glUniformMatrix4x3fv_ei(GLint loc, const float* v) { glUniformMatrix4x3fv(loc,1,false,v); }
+
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 2,3,Matrix2x3fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 3,2,Matrix3x2fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 2,4,Matrix2x4fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 4,2,Matrix4x2fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 3,4,Matrix3x4fv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_MAT(glUniform,GLint,const,float, 4,3,Matrix4x3fv_ei)
+
+#endif
+
+#ifdef GL_VERSION_3_0
+
+void glUniform2uiv_ei (GLint loc, const unsigned int* v) { glUniform2uiv(loc,1,v); }
+void glUniform3uiv_ei (GLint loc, const unsigned int* v) { glUniform3uiv(loc,1,v); }
+void glUniform4uiv_ei (GLint loc, const unsigned int* v) { glUniform4uiv(loc,1,v); }
+
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,unsigned int, 2,2uiv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,unsigned int, 3,3uiv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,unsigned int, 4,4uiv_ei)
+
+#endif
+
+#ifdef GL_ARB_gpu_shader_fp64
+void glUniform2dv_ei (GLint loc, const double* v) { glUniform2dv(loc,1,v); }
+void glUniform3dv_ei (GLint loc, const double* v) { glUniform3dv(loc,1,v); }
+void glUniform4dv_ei (GLint loc, const double* v) { glUniform4dv(loc,1,v); }
+
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,double, 2,2dv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,double, 3,3dv_ei)
+EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform,GLint,const,double, 4,4dv_ei)
+#endif
+
+
//@}
}
diff --git a/unsupported/Eigen/SparseExtra b/unsupported/Eigen/SparseExtra
index 712a63271..8b4afa3a8 100644
--- a/unsupported/Eigen/SparseExtra
+++ b/unsupported/Eigen/SparseExtra
@@ -51,6 +51,8 @@ enum {
OrderingMask = 0x0f00
};
+#include "src/misc/Solve.h"
+
#include "src/SparseExtra/RandomSetter.h"
#include "src/SparseExtra/SparseLLT.h"
#include "src/SparseExtra/SparseLDLT.h"
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h b/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
index 0c79214bd..4fe168a88 100644
--- a/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
+++ b/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
@@ -62,7 +62,7 @@ public:
void operator() (const InputType& x, ValueType* v, JacobianType* _jac=0) const
{
- ei_assert(v!=0);
+ eigen_assert(v!=0);
if (!_jac)
{
Functor::operator()(x, v);
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
index 9169c0b16..2f2992997 100644
--- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
+++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -27,18 +27,24 @@
namespace Eigen {
+namespace internal {
+
template<typename A, typename B>
-struct ei_make_coherent_impl {
+struct make_coherent_impl {
static void run(A&, B&) {}
};
// resize a to match b is a.size()==0, and conversely.
template<typename A, typename B>
-void ei_make_coherent(const A& a, const B&b)
+void make_coherent(const A& a, const B&b)
{
- ei_make_coherent_impl<A,B>::run(a.const_cast_derived(), b.const_cast_derived());
+ make_coherent_impl<A,B>::run(a.const_cast_derived(), b.const_cast_derived());
}
+template<typename _DerType, bool Enable> struct auto_diff_special_op;
+
+} // end namespace internal
+
/** \class AutoDiffScalar
* \brief A scalar type replacement with automatic differentation capability
*
@@ -56,8 +62,8 @@ void ei_make_coherent(const A& a, const B&b)
*
* It supports the following list of global math function:
* - std::abs, std::sqrt, std::pow, std::exp, std::log, std::sin, std::cos,
- * - ei_abs, ei_sqrt, ei_pow, ei_exp, ei_log, ei_sin, ei_cos,
- * - ei_conj, ei_real, ei_imag, ei_abs2.
+ * - internal::abs, internal::sqrt, internal::pow, internal::exp, internal::log, internal::sin, internal::cos,
+ * - internal::conj, internal::real, internal::imag, internal::abs2.
*
* AutoDiffScalar can be used as the scalar type of an Eigen::Matrix object. However,
* in that case, the expression template mechanism only occurs at the top Matrix level,
@@ -65,21 +71,18 @@ void ei_make_coherent(const A& a, const B&b)
*
*/
-template<typename _DerType, bool Enable> struct ei_auto_diff_special_op;
-
-
template<typename _DerType>
class AutoDiffScalar
- : public ei_auto_diff_special_op
- <_DerType, !ei_is_same_type<typename ei_traits<typename ei_cleantype<_DerType>::type>::Scalar,
- typename NumTraits<typename ei_traits<typename ei_cleantype<_DerType>::type>::Scalar>::Real>::ret>
+ : public internal::auto_diff_special_op
+ <_DerType, !internal::is_same<typename internal::traits<typename internal::remove_all<_DerType>::type>::Scalar,
+ typename NumTraits<typename internal::traits<typename internal::remove_all<_DerType>::type>::Scalar>::Real>::value>
{
public:
- typedef ei_auto_diff_special_op
- <_DerType, !ei_is_same_type<typename ei_traits<typename ei_cleantype<_DerType>::type>::Scalar,
- typename NumTraits<typename ei_traits<typename ei_cleantype<_DerType>::type>::Scalar>::Real>::ret> Base;
- typedef typename ei_cleantype<_DerType>::type DerType;
- typedef typename ei_traits<DerType>::Scalar Scalar;
+ typedef internal::auto_diff_special_op
+ <_DerType, !internal::is_same<typename internal::traits<typename internal::remove_all<_DerType>::type>::Scalar,
+ typename NumTraits<typename internal::traits<typename internal::remove_all<_DerType>::type>::Scalar>::Real>::value> Base;
+ typedef typename internal::remove_all<_DerType>::type DerType;
+ typedef typename internal::traits<DerType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real Real;
using Base::operator+;
@@ -175,11 +178,11 @@ class AutoDiffScalar
}
template<typename OtherDerType>
- inline const AutoDiffScalar<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerType,typename ei_cleantype<OtherDerType>::type> >
+ inline const AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>,DerType,typename internal::remove_all<OtherDerType>::type> >
operator+(const AutoDiffScalar<OtherDerType>& other) const
{
- ei_make_coherent(m_derivatives, other.derivatives());
- return AutoDiffScalar<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerType,typename ei_cleantype<OtherDerType>::type> >(
+ internal::make_coherent(m_derivatives, other.derivatives());
+ return AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>,DerType,typename internal::remove_all<OtherDerType>::type> >(
m_value + other.value(),
m_derivatives + other.derivatives());
}
@@ -193,11 +196,11 @@ class AutoDiffScalar
}
template<typename OtherDerType>
- inline const AutoDiffScalar<CwiseBinaryOp<ei_scalar_difference_op<Scalar>, DerType,typename ei_cleantype<OtherDerType>::type> >
+ inline const AutoDiffScalar<CwiseBinaryOp<internal::scalar_difference_op<Scalar>, DerType,typename internal::remove_all<OtherDerType>::type> >
operator-(const AutoDiffScalar<OtherDerType>& other) const
{
- ei_make_coherent(m_derivatives, other.derivatives());
- return AutoDiffScalar<CwiseBinaryOp<ei_scalar_difference_op<Scalar>, DerType,typename ei_cleantype<OtherDerType>::type> >(
+ internal::make_coherent(m_derivatives, other.derivatives());
+ return AutoDiffScalar<CwiseBinaryOp<internal::scalar_difference_op<Scalar>, DerType,typename internal::remove_all<OtherDerType>::type> >(
m_value - other.value(),
m_derivatives - other.derivatives());
}
@@ -211,105 +214,105 @@ class AutoDiffScalar
}
template<typename OtherDerType>
- inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, DerType> >
+ inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, DerType> >
operator-() const
{
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, DerType> >(
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, DerType> >(
-m_value,
-m_derivatives);
}
- inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >
+ inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >
operator*(const Scalar& other) const
{
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >(
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >(
m_value * other,
(m_derivatives * other));
}
- friend inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >
+ friend inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >
operator*(const Scalar& other, const AutoDiffScalar& a)
{
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >(
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >(
a.value() * other,
a.derivatives() * other);
}
-// inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >
+// inline const AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >
// operator*(const Real& other) const
// {
-// return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >(
+// return AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >(
// m_value * other,
// (m_derivatives * other));
// }
//
-// friend inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >
+// friend inline const AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >
// operator*(const Real& other, const AutoDiffScalar& a)
// {
-// return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >(
+// return AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >(
// a.value() * other,
// a.derivatives() * other);
// }
- inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >
+ inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >
operator/(const Scalar& other) const
{
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >(
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >(
m_value / other,
(m_derivatives * (Scalar(1)/other)));
}
- friend inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >
+ friend inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >
operator/(const Scalar& other, const AutoDiffScalar& a)
{
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >(
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >(
other / a.value(),
a.derivatives() * (-Scalar(1)/other));
}
-// inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >
+// inline const AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >
// operator/(const Real& other) const
// {
-// return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >(
+// return AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >(
// m_value / other,
// (m_derivatives * (Real(1)/other)));
// }
//
-// friend inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >
+// friend inline const AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >
// operator/(const Real& other, const AutoDiffScalar& a)
// {
-// return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple_op<Real>, DerType>::Type >(
+// return AutoDiffScalar<typename CwiseUnaryOp<internal::scalar_multiple_op<Real>, DerType>::Type >(
// other / a.value(),
// a.derivatives() * (-Real(1)/other));
// }
template<typename OtherDerType>
- inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>,
- CwiseBinaryOp<ei_scalar_difference_op<Scalar>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, typename ei_cleantype<OtherDerType>::type > > > >
+ inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>,
+ CwiseBinaryOp<internal::scalar_difference_op<Scalar>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, typename internal::remove_all<OtherDerType>::type > > > >
operator/(const AutoDiffScalar<OtherDerType>& other) const
{
- ei_make_coherent(m_derivatives, other.derivatives());
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>,
- CwiseBinaryOp<ei_scalar_difference_op<Scalar>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, typename ei_cleantype<OtherDerType>::type > > > >(
+ internal::make_coherent(m_derivatives, other.derivatives());
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>,
+ CwiseBinaryOp<internal::scalar_difference_op<Scalar>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, typename internal::remove_all<OtherDerType>::type > > > >(
m_value / other.value(),
((m_derivatives * other.value()) - (m_value * other.derivatives()))
* (Scalar(1)/(other.value()*other.value())));
}
template<typename OtherDerType>
- inline const AutoDiffScalar<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, typename ei_cleantype<OtherDerType>::type> > >
+ inline const AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, typename internal::remove_all<OtherDerType>::type> > >
operator*(const AutoDiffScalar<OtherDerType>& other) const
{
- ei_make_coherent(m_derivatives, other.derivatives());
- return AutoDiffScalar<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType>,
- CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, typename ei_cleantype<OtherDerType>::type > > >(
+ internal::make_coherent(m_derivatives, other.derivatives());
+ return AutoDiffScalar<CwiseBinaryOp<internal::scalar_sum_op<Scalar>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType>,
+ CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, typename internal::remove_all<OtherDerType>::type > > >(
m_value * other.value(),
(m_derivatives * other.value()) + (m_value * other.derivatives()));
}
@@ -333,18 +336,19 @@ class AutoDiffScalar
};
+namespace internal {
template<typename _DerType>
-struct ei_auto_diff_special_op<_DerType, true>
-// : ei_auto_diff_scalar_op<_DerType, typename NumTraits<Scalar>::Real,
-// ei_is_same_type<Scalar,typename NumTraits<Scalar>::Real>::ret>
+struct auto_diff_special_op<_DerType, true>
+// : auto_diff_scalar_op<_DerType, typename NumTraits<Scalar>::Real,
+// is_same<Scalar,typename NumTraits<Scalar>::Real>::value>
{
- typedef typename ei_cleantype<_DerType>::type DerType;
- typedef typename ei_traits<DerType>::Scalar Scalar;
+ typedef typename remove_all<_DerType>::type DerType;
+ typedef typename traits<DerType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real Real;
-// typedef ei_auto_diff_scalar_op<_DerType, typename NumTraits<Scalar>::Real,
-// ei_is_same_type<Scalar,typename NumTraits<Scalar>::Real>::ret> Base;
+// typedef auto_diff_scalar_op<_DerType, typename NumTraits<Scalar>::Real,
+// is_same<Scalar,typename NumTraits<Scalar>::Real>::value> Base;
// using Base::operator+;
// using Base::operator+=;
@@ -374,18 +378,18 @@ struct ei_auto_diff_special_op<_DerType, true>
}
- inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,Real>, DerType>::Type >
+ inline const AutoDiffScalar<typename CwiseUnaryOp<scalar_multiple2_op<Scalar,Real>, DerType>::Type >
operator*(const Real& other) const
{
- return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,Real>, DerType>::Type >(
+ return AutoDiffScalar<typename CwiseUnaryOp<scalar_multiple2_op<Scalar,Real>, DerType>::Type >(
derived().value() * other,
derived().derivatives() * other);
}
- friend inline const AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,Real>, DerType>::Type >
+ friend inline const AutoDiffScalar<typename CwiseUnaryOp<scalar_multiple2_op<Scalar,Real>, DerType>::Type >
operator*(const Real& other, const AutoDiffScalar<_DerType>& a)
{
- return AutoDiffScalar<typename CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,Real>, DerType>::Type >(
+ return AutoDiffScalar<typename CwiseUnaryOp<scalar_multiple2_op<Scalar,Real>, DerType>::Type >(
a.value() * other,
a.derivatives() * other);
}
@@ -398,7 +402,7 @@ struct ei_auto_diff_special_op<_DerType, true>
};
template<typename _DerType>
-struct ei_auto_diff_special_op<_DerType, false>
+struct auto_diff_special_op<_DerType, false>
{
void operator*() const;
void operator-() const;
@@ -406,7 +410,7 @@ struct ei_auto_diff_special_op<_DerType, false>
};
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols, typename B>
-struct ei_make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>, B> {
+struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>, B> {
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> A;
static void run(A& a, B& b) {
if((A_Rows==Dynamic || A_Cols==Dynamic) && (a.size()==0))
@@ -418,7 +422,7 @@ struct ei_make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRo
};
template<typename A, typename B_Scalar, int B_Rows, int B_Cols, int B_Options, int B_MaxRows, int B_MaxCols>
-struct ei_make_coherent_impl<A, Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> > {
+struct make_coherent_impl<A, Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> > {
typedef Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> B;
static void run(A& a, B& b) {
if((B_Rows==Dynamic || B_Cols==Dynamic) && (b.size()==0))
@@ -431,7 +435,7 @@ struct ei_make_coherent_impl<A, Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_Ma
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols,
typename B_Scalar, int B_Rows, int B_Cols, int B_Options, int B_MaxRows, int B_MaxCols>
-struct ei_make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,
+struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,
Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> > {
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> A;
typedef Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> B;
@@ -449,31 +453,33 @@ struct ei_make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRo
}
};
-template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols> struct ei_scalar_product_traits<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,A_Scalar>
+template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols> struct scalar_product_traits<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,A_Scalar>
{
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> ReturnType;
};
-template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols> struct ei_scalar_product_traits<A_Scalar, Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> >
+template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols> struct scalar_product_traits<A_Scalar, Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> >
{
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> ReturnType;
};
template<typename DerType, typename T>
-struct ei_scalar_product_traits<AutoDiffScalar<DerType>,T>
+struct scalar_product_traits<AutoDiffScalar<DerType>,T>
{
typedef AutoDiffScalar<DerType> ReturnType;
};
-}
+} // end namespace internal
+
+} // end namespace Eigen
#define EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(FUNC,CODE) \
template<typename DerType> \
- inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<typename Eigen::ei_traits<typename Eigen::ei_cleantype<DerType>::type>::Scalar>, typename Eigen::ei_cleantype<DerType>::type> > \
+ inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar>, typename Eigen::internal::remove_all<DerType>::type> > \
FUNC(const Eigen::AutoDiffScalar<DerType>& x) { \
using namespace Eigen; \
- typedef typename ei_traits<typename ei_cleantype<DerType>::type>::Scalar Scalar; \
- typedef AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, typename ei_cleantype<DerType>::type> > ReturnType; \
+ typedef typename internal::traits<typename internal::remove_all<DerType>::type>::Scalar Scalar; \
+ typedef AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, typename internal::remove_all<DerType>::type> > ReturnType; \
CODE; \
}
@@ -500,12 +506,12 @@ namespace std
return ReturnType(std::log(x.value()),x.derivatives() * (Scalar(1)/x.value()));)
template<typename DerType>
- inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::ei_scalar_multiple_op<typename Eigen::ei_traits<DerType>::Scalar>, DerType> >
- pow(const Eigen::AutoDiffScalar<DerType>& x, typename Eigen::ei_traits<DerType>::Scalar y)
+ inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<typename Eigen::internal::traits<DerType>::Scalar>, DerType> >
+ pow(const Eigen::AutoDiffScalar<DerType>& x, typename Eigen::internal::traits<DerType>::Scalar y)
{
using namespace Eigen;
- typedef typename ei_traits<DerType>::Scalar Scalar;
- return AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, DerType> >(
+ typedef typename internal::traits<DerType>::Scalar Scalar;
+ return AutoDiffScalar<CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, DerType> >(
std::pow(x.value(),y),
x.derivatives() * (y * std::pow(x.value(),y-1)));
}
@@ -514,41 +520,45 @@ namespace std
namespace Eigen {
+namespace internal {
+
template<typename DerType>
-inline const AutoDiffScalar<DerType>& ei_conj(const AutoDiffScalar<DerType>& x) { return x; }
+inline const AutoDiffScalar<DerType>& conj(const AutoDiffScalar<DerType>& x) { return x; }
template<typename DerType>
-inline const AutoDiffScalar<DerType>& ei_real(const AutoDiffScalar<DerType>& x) { return x; }
+inline const AutoDiffScalar<DerType>& real(const AutoDiffScalar<DerType>& x) { return x; }
template<typename DerType>
-inline typename DerType::Scalar ei_imag(const AutoDiffScalar<DerType>&) { return 0.; }
+inline typename DerType::Scalar imag(const AutoDiffScalar<DerType>&) { return 0.; }
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_abs,
- return ReturnType(ei_abs(x.value()), x.derivatives() * (sign(x.value())));)
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs,
+ return ReturnType(abs(x.value()), x.derivatives() * (sign(x.value())));)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_abs2,
- return ReturnType(ei_abs2(x.value()), x.derivatives() * (Scalar(2)*x.value()));)
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs2,
+ return ReturnType(abs2(x.value()), x.derivatives() * (Scalar(2)*x.value()));)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_sqrt,
- Scalar sqrtx = ei_sqrt(x.value());
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(sqrt,
+ Scalar sqrtx = sqrt(x.value());
return ReturnType(sqrtx,x.derivatives() * (Scalar(0.5) / sqrtx));)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_cos,
- return ReturnType(ei_cos(x.value()), x.derivatives() * (-ei_sin(x.value())));)
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(cos,
+ return ReturnType(cos(x.value()), x.derivatives() * (-sin(x.value())));)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_sin,
- return ReturnType(ei_sin(x.value()),x.derivatives() * ei_cos(x.value()));)
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(sin,
+ return ReturnType(sin(x.value()),x.derivatives() * cos(x.value()));)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_exp,
- Scalar expx = ei_exp(x.value());
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(exp,
+ Scalar expx = exp(x.value());
return ReturnType(expx,x.derivatives() * expx);)
-EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(ei_log,
- return ReturnType(ei_log(x.value()),x.derivatives() * (Scalar(1)/x.value()));)
+EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(log,
+ return ReturnType(log(x.value()),x.derivatives() * (Scalar(1)/x.value()));)
template<typename DerType>
-inline const AutoDiffScalar<CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<DerType>::Scalar>, DerType> >
-ei_pow(const AutoDiffScalar<DerType>& x, typename ei_traits<DerType>::Scalar y)
+inline const AutoDiffScalar<CwiseUnaryOp<scalar_multiple_op<typename traits<DerType>::Scalar>, DerType> >
+pow(const AutoDiffScalar<DerType>& x, typename traits<DerType>::Scalar y)
{ return std::pow(x,y);}
+} // end namespace internal
+
#undef EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY
template<typename DerType> struct NumTraits<AutoDiffScalar<DerType> >
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h b/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
index a160a216e..a8f041f6f 100644
--- a/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
+++ b/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
@@ -36,8 +36,8 @@ namespace Eigen {
*
* It supports the following list of global math function:
* - std::abs, std::sqrt, std::pow, std::exp, std::log, std::sin, std::cos,
- * - ei_abs, ei_sqrt, ei_pow, ei_exp, ei_log, ei_sin, ei_cos,
- * - ei_conj, ei_real, ei_imag, ei_abs2.
+ * - internal::abs, internal::sqrt, internal::pow, internal::exp, internal::log, internal::sin, internal::cos,
+ * - internal::conj, internal::real, internal::imag, internal::abs2.
*
* AutoDiffScalar can be used as the scalar type of an Eigen::Matrix object. However,
* in that case, the expression template mechanism only occurs at the top Matrix level,
@@ -48,8 +48,8 @@ template<typename ValueType, typename JacobianType>
class AutoDiffVector
{
public:
- //typedef typename ei_traits<ValueType>::Scalar Scalar;
- typedef typename ei_traits<ValueType>::Scalar BaseScalar;
+ //typedef typename internal::traits<ValueType>::Scalar Scalar;
+ typedef typename internal::traits<ValueType>::Scalar BaseScalar;
typedef AutoDiffScalar<Matrix<BaseScalar,JacobianType::RowsAtCompileTime,1> > ActiveScalar;
typedef ActiveScalar Scalar;
typedef AutoDiffScalar<typename JacobianType::ColXpr> CoeffType;
@@ -115,13 +115,13 @@ class AutoDiffVector
template<typename OtherValueType,typename OtherJacobianType>
inline const AutoDiffVector<
- typename MakeCwiseBinaryOp<ei_scalar_sum_op<BaseScalar>,ValueType,OtherValueType>::Type,
- typename MakeCwiseBinaryOp<ei_scalar_sum_op<BaseScalar>,JacobianType,OtherJacobianType>::Type >
+ typename MakeCwiseBinaryOp<internal::scalar_sum_op<BaseScalar>,ValueType,OtherValueType>::Type,
+ typename MakeCwiseBinaryOp<internal::scalar_sum_op<BaseScalar>,JacobianType,OtherJacobianType>::Type >
operator+(const AutoDiffVector<OtherValueType,OtherJacobianType>& other) const
{
return AutoDiffVector<
- typename MakeCwiseBinaryOp<ei_scalar_sum_op<BaseScalar>,ValueType,OtherValueType>::Type,
- typename MakeCwiseBinaryOp<ei_scalar_sum_op<BaseScalar>,JacobianType,OtherJacobianType>::Type >(
+ typename MakeCwiseBinaryOp<internal::scalar_sum_op<BaseScalar>,ValueType,OtherValueType>::Type,
+ typename MakeCwiseBinaryOp<internal::scalar_sum_op<BaseScalar>,JacobianType,OtherJacobianType>::Type >(
m_values + other.values(),
m_jacobian + other.jacobian());
}
@@ -137,13 +137,13 @@ class AutoDiffVector
template<typename OtherValueType,typename OtherJacobianType>
inline const AutoDiffVector<
- typename MakeCwiseBinaryOp<ei_scalar_difference_op<Scalar>,ValueType,OtherValueType>::Type,
- typename MakeCwiseBinaryOp<ei_scalar_difference_op<Scalar>,JacobianType,OtherJacobianType>::Type >
+ typename MakeCwiseBinaryOp<internal::scalar_difference_op<Scalar>,ValueType,OtherValueType>::Type,
+ typename MakeCwiseBinaryOp<internal::scalar_difference_op<Scalar>,JacobianType,OtherJacobianType>::Type >
operator-(const AutoDiffVector<OtherValueType,OtherJacobianType>& other) const
{
return AutoDiffVector<
- typename MakeCwiseBinaryOp<ei_scalar_difference_op<Scalar>,ValueType,OtherValueType>::Type,
- typename MakeCwiseBinaryOp<ei_scalar_difference_op<Scalar>,JacobianType,OtherJacobianType>::Type >(
+ typename MakeCwiseBinaryOp<internal::scalar_difference_op<Scalar>,ValueType,OtherValueType>::Type,
+ typename MakeCwiseBinaryOp<internal::scalar_difference_op<Scalar>,JacobianType,OtherJacobianType>::Type >(
m_values - other.values(),
m_jacobian - other.jacobian());
}
@@ -158,54 +158,54 @@ class AutoDiffVector
}
inline const AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_opposite_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_opposite_op<Scalar>, JacobianType>::Type >
+ typename MakeCwiseUnaryOp<internal::scalar_opposite_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_opposite_op<Scalar>, JacobianType>::Type >
operator-() const
{
return AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_opposite_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_opposite_op<Scalar>, JacobianType>::Type >(
+ typename MakeCwiseUnaryOp<internal::scalar_opposite_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_opposite_op<Scalar>, JacobianType>::Type >(
-m_values,
-m_jacobian);
}
inline const AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>::Type>
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>::Type>
operator*(const BaseScalar& other) const
{
return AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>::Type >(
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>::Type >(
m_values * other,
m_jacobian * other);
}
friend inline const AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>::Type >
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>::Type >
operator*(const Scalar& other, const AutoDiffVector& v)
{
return AutoDiffVector<
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, ValueType>::Type,
- typename MakeCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>::Type >(
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, ValueType>::Type,
+ typename MakeCwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>::Type >(
v.values() * other,
v.jacobian() * other);
}
// template<typename OtherValueType,typename OtherJacobianType>
// inline const AutoDiffVector<
-// CwiseBinaryOp<ei_scalar_multiple_op<Scalar>, ValueType, OtherValueType>
-// CwiseBinaryOp<ei_scalar_sum_op<Scalar>,
-// CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>,
-// CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, OtherJacobianType> > >
+// CwiseBinaryOp<internal::scalar_multiple_op<Scalar>, ValueType, OtherValueType>
+// CwiseBinaryOp<internal::scalar_sum_op<Scalar>,
+// CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>,
+// CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, OtherJacobianType> > >
// operator*(const AutoDiffVector<OtherValueType,OtherJacobianType>& other) const
// {
// return AutoDiffVector<
-// CwiseBinaryOp<ei_scalar_multiple_op<Scalar>, ValueType, OtherValueType>
-// CwiseBinaryOp<ei_scalar_sum_op<Scalar>,
-// CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, JacobianType>,
-// CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, OtherJacobianType> > >(
+// CwiseBinaryOp<internal::scalar_multiple_op<Scalar>, ValueType, OtherValueType>
+// CwiseBinaryOp<internal::scalar_sum_op<Scalar>,
+// CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, JacobianType>,
+// CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, OtherJacobianType> > >(
// m_values.cwise() * other.values(),
// (m_jacobian * other.values()) + (m_values * other.jacobian()));
// }
diff --git a/unsupported/Eigen/src/BVH/BVAlgorithms.h b/unsupported/Eigen/src/BVH/BVAlgorithms.h
index 40320291d..2412680e7 100644
--- a/unsupported/Eigen/src/BVH/BVAlgorithms.h
+++ b/unsupported/Eigen/src/BVH/BVAlgorithms.h
@@ -25,21 +25,11 @@
#ifndef EIGEN_BVALGORITHMS_H
#define EIGEN_BVALGORITHMS_H
-/** Given a BVH, runs the query encapsulated by \a intersector.
- * The Intersector type must provide the following members: \code
- bool intersectVolume(const BVH::Volume &volume) //returns true if volume intersects the query
- bool intersectObject(const BVH::Object &object) //returns true if the search should terminate immediately
- \endcode
- */
-template<typename BVH, typename Intersector>
-void BVIntersect(const BVH &tree, Intersector &intersector)
-{
- ei_intersect_helper(tree, intersector, tree.getRootIndex());
-}
+namespace internal {
#ifndef EIGEN_PARSED_BY_DOXYGEN
template<typename BVH, typename Intersector>
-bool ei_intersect_helper(const BVH &tree, Intersector &intersector, typename BVH::Index root)
+bool intersect_helper(const BVH &tree, Intersector &intersector, typename BVH::Index root)
{
typedef typename BVH::Index Index;
typedef typename BVH::VolumeIterator VolIter;
@@ -67,29 +57,43 @@ bool ei_intersect_helper(const BVH &tree, Intersector &intersector, typename BVH
#endif //not EIGEN_PARSED_BY_DOXYGEN
template<typename Volume1, typename Object1, typename Object2, typename Intersector>
-struct ei_intersector_helper1
+struct intersector_helper1
{
- ei_intersector_helper1(const Object2 &inStored, Intersector &in) : stored(inStored), intersector(in) {}
+ intersector_helper1(const Object2 &inStored, Intersector &in) : stored(inStored), intersector(in) {}
bool intersectVolume(const Volume1 &vol) { return intersector.intersectVolumeObject(vol, stored); }
bool intersectObject(const Object1 &obj) { return intersector.intersectObjectObject(obj, stored); }
Object2 stored;
Intersector &intersector;
private:
- ei_intersector_helper1& operator=(const ei_intersector_helper1&);
+ intersector_helper1& operator=(const intersector_helper1&);
};
template<typename Volume2, typename Object2, typename Object1, typename Intersector>
-struct ei_intersector_helper2
+struct intersector_helper2
{
- ei_intersector_helper2(const Object1 &inStored, Intersector &in) : stored(inStored), intersector(in) {}
+ intersector_helper2(const Object1 &inStored, Intersector &in) : stored(inStored), intersector(in) {}
bool intersectVolume(const Volume2 &vol) { return intersector.intersectObjectVolume(stored, vol); }
bool intersectObject(const Object2 &obj) { return intersector.intersectObjectObject(stored, obj); }
Object1 stored;
Intersector &intersector;
private:
- ei_intersector_helper2& operator=(const ei_intersector_helper2&);
+ intersector_helper2& operator=(const intersector_helper2&);
};
+} // end namespace internal
+
+/** Given a BVH, runs the query encapsulated by \a intersector.
+ * The Intersector type must provide the following members: \code
+ bool intersectVolume(const BVH::Volume &volume) //returns true if volume intersects the query
+ bool intersectObject(const BVH::Object &object) //returns true if the search should terminate immediately
+ \endcode
+ */
+template<typename BVH, typename Intersector>
+void BVIntersect(const BVH &tree, Intersector &intersector)
+{
+ internal::intersect_helper(tree, intersector, tree.getRootIndex());
+}
+
/** Given two BVH's, runs the query on their Cartesian product encapsulated by \a intersector.
* The Intersector type must provide the following members: \code
bool intersectVolumeVolume(const BVH1::Volume &v1, const BVH2::Volume &v2) //returns true if product of volumes intersects the query
@@ -103,8 +107,8 @@ void BVIntersect(const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector)
{
typedef typename BVH1::Index Index1;
typedef typename BVH2::Index Index2;
- typedef ei_intersector_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Intersector> Helper1;
- typedef ei_intersector_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Intersector> Helper2;
+ typedef internal::intersector_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Intersector> Helper1;
+ typedef internal::intersector_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Intersector> Helper2;
typedef typename BVH1::VolumeIterator VolIter1;
typedef typename BVH1::ObjectIterator ObjIter1;
typedef typename BVH2::VolumeIterator VolIter2;
@@ -131,7 +135,7 @@ void BVIntersect(const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector)
for(oCur2 = oBegin2; oCur2 != oEnd2; ++oCur2) {//go through child objects of second tree
Helper1 helper(*oCur2, intersector);
- if(ei_intersect_helper(tree1, helper, *vBegin1))
+ if(internal::intersect_helper(tree1, helper, *vBegin1))
return; //intersector said to stop query
}
}
@@ -139,7 +143,7 @@ void BVIntersect(const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector)
for(; oBegin1 != oEnd1; ++oBegin1) { //go through child objects of first tree
for(vCur2 = vBegin2; vCur2 != vEnd2; ++vCur2) { //go through child volumes of second tree
Helper2 helper(*oBegin1, intersector);
- if(ei_intersect_helper(tree2, helper, *vCur2))
+ if(internal::intersect_helper(tree2, helper, *vCur2))
return; //intersector said to stop query
}
@@ -151,23 +155,11 @@ void BVIntersect(const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector)
}
}
-/** Given a BVH, runs the query encapsulated by \a minimizer.
- * \returns the minimum value.
- * The Minimizer type must provide the following members: \code
- typedef Scalar //the numeric type of what is being minimized--not necessarily the Scalar type of the BVH (if it has one)
- Scalar minimumOnVolume(const BVH::Volume &volume)
- Scalar minimumOnObject(const BVH::Object &object)
- \endcode
- */
-template<typename BVH, typename Minimizer>
-typename Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
-{
- return ei_minimize_helper(tree, minimizer, tree.getRootIndex(), std::numeric_limits<typename Minimizer::Scalar>::max());
-}
+namespace internal {
#ifndef EIGEN_PARSED_BY_DOXYGEN
template<typename BVH, typename Minimizer>
-typename Minimizer::Scalar ei_minimize_helper(const BVH &tree, Minimizer &minimizer, typename BVH::Index root, typename Minimizer::Scalar minimum)
+typename Minimizer::Scalar minimize_helper(const BVH &tree, Minimizer &minimizer, typename BVH::Index root, typename Minimizer::Scalar minimum)
{
typedef typename Minimizer::Scalar Scalar;
typedef typename BVH::Index Index;
@@ -201,31 +193,47 @@ typename Minimizer::Scalar ei_minimize_helper(const BVH &tree, Minimizer &minimi
template<typename Volume1, typename Object1, typename Object2, typename Minimizer>
-struct ei_minimizer_helper1
+struct minimizer_helper1
{
typedef typename Minimizer::Scalar Scalar;
- ei_minimizer_helper1(const Object2 &inStored, Minimizer &m) : stored(inStored), minimizer(m) {}
+ minimizer_helper1(const Object2 &inStored, Minimizer &m) : stored(inStored), minimizer(m) {}
Scalar minimumOnVolume(const Volume1 &vol) { return minimizer.minimumOnVolumeObject(vol, stored); }
Scalar minimumOnObject(const Object1 &obj) { return minimizer.minimumOnObjectObject(obj, stored); }
Object2 stored;
Minimizer &minimizer;
private:
- ei_minimizer_helper1& operator=(const ei_minimizer_helper1&) {}
+ minimizer_helper1& operator=(const minimizer_helper1&) {}
};
template<typename Volume2, typename Object2, typename Object1, typename Minimizer>
-struct ei_minimizer_helper2
+struct minimizer_helper2
{
typedef typename Minimizer::Scalar Scalar;
- ei_minimizer_helper2(const Object1 &inStored, Minimizer &m) : stored(inStored), minimizer(m) {}
+ minimizer_helper2(const Object1 &inStored, Minimizer &m) : stored(inStored), minimizer(m) {}
Scalar minimumOnVolume(const Volume2 &vol) { return minimizer.minimumOnObjectVolume(stored, vol); }
Scalar minimumOnObject(const Object2 &obj) { return minimizer.minimumOnObjectObject(stored, obj); }
Object1 stored;
Minimizer &minimizer;
private:
- ei_minimizer_helper2& operator=(const ei_minimizer_helper2&);
+ minimizer_helper2& operator=(const minimizer_helper2&);
};
+} // end namespace internal
+
+/** Given a BVH, runs the query encapsulated by \a minimizer.
+ * \returns the minimum value.
+ * The Minimizer type must provide the following members: \code
+ typedef Scalar //the numeric type of what is being minimized--not necessarily the Scalar type of the BVH (if it has one)
+ Scalar minimumOnVolume(const BVH::Volume &volume)
+ Scalar minimumOnObject(const BVH::Object &object)
+ \endcode
+ */
+template<typename BVH, typename Minimizer>
+typename Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
+{
+ return internal::minimize_helper(tree, minimizer, tree.getRootIndex(), std::numeric_limits<typename Minimizer::Scalar>::max());
+}
+
/** Given two BVH's, runs the query on their cartesian product encapsulated by \a minimizer.
* \returns the minimum value.
* The Minimizer type must provide the following members: \code
@@ -242,8 +250,8 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
typedef typename Minimizer::Scalar Scalar;
typedef typename BVH1::Index Index1;
typedef typename BVH2::Index Index2;
- typedef ei_minimizer_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Minimizer> Helper1;
- typedef ei_minimizer_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Minimizer> Helper2;
+ typedef internal::minimizer_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Minimizer> Helper1;
+ typedef internal::minimizer_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Minimizer> Helper2;
typedef std::pair<Scalar, std::pair<Index1, Index2> > QueueElement; //first element is priority
typedef typename BVH1::VolumeIterator VolIter1;
typedef typename BVH1::ObjectIterator ObjIter1;
@@ -271,7 +279,7 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
for(vCur2 = vBegin2; vCur2 != vEnd2; ++vCur2) { //go through child volumes of second tree
Helper2 helper(*oBegin1, minimizer);
- minimum = std::min(minimum, ei_minimize_helper(tree2, helper, *vCur2, minimum));
+ minimum = std::min(minimum, internal::minimize_helper(tree2, helper, *vCur2, minimum));
}
}
@@ -280,7 +288,7 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
for(oCur2 = oBegin2; oCur2 != oEnd2; ++oCur2) {//go through child objects of second tree
Helper1 helper(*oCur2, minimizer);
- minimum = std::min(minimum, ei_minimize_helper(tree1, helper, *vBegin1, minimum));
+ minimum = std::min(minimum, internal::minimize_helper(tree1, helper, *vBegin1, minimum));
}
for(vCur2 = vBegin2; vCur2 != vEnd2; ++vCur2) { //go through child volumes of second tree
diff --git a/unsupported/Eigen/src/BVH/KdBVH.h b/unsupported/Eigen/src/BVH/KdBVH.h
index c4719607f..028b4811e 100644
--- a/unsupported/Eigen/src/BVH/KdBVH.h
+++ b/unsupported/Eigen/src/BVH/KdBVH.h
@@ -25,47 +25,51 @@
#ifndef KDBVH_H_INCLUDED
#define KDBVH_H_INCLUDED
+namespace internal {
+
//internal pair class for the BVH--used instead of std::pair because of alignment
template<typename Scalar, int Dim>
-struct ei_vector_int_pair
+struct vector_int_pair
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Dim)
typedef Matrix<Scalar, Dim, 1> VectorType;
- ei_vector_int_pair(const VectorType &v, int i) : first(v), second(i) {}
+ vector_int_pair(const VectorType &v, int i) : first(v), second(i) {}
VectorType first;
int second;
};
//these templates help the tree initializer get the bounding boxes either from a provided
-//iterator range or using ei_bounding_box in a unified way
+//iterator range or using bounding_box in a unified way
template<typename ObjectList, typename VolumeList, typename BoxIter>
-struct ei_get_boxes_helper {
+struct get_boxes_helper {
void operator()(const ObjectList &objects, BoxIter boxBegin, BoxIter boxEnd, VolumeList &outBoxes)
{
outBoxes.insert(outBoxes.end(), boxBegin, boxEnd);
- ei_assert(outBoxes.size() == objects.size());
+ eigen_assert(outBoxes.size() == objects.size());
}
};
template<typename ObjectList, typename VolumeList>
-struct ei_get_boxes_helper<ObjectList, VolumeList, int> {
+struct get_boxes_helper<ObjectList, VolumeList, int> {
void operator()(const ObjectList &objects, int, int, VolumeList &outBoxes)
{
outBoxes.reserve(objects.size());
for(int i = 0; i < (int)objects.size(); ++i)
- outBoxes.push_back(ei_bounding_box(objects[i]));
+ outBoxes.push_back(bounding_box(objects[i]));
}
};
+} // end namespace internal
+
/** \class KdBVH
* \brief A simple bounding volume hierarchy based on AlignedBox
*
* \param _Scalar The underlying scalar type of the bounding boxes
* \param _Dim The dimension of the space in which the hierarchy lives
- * \param _Object The object type that lives in the hierarchy. It must have value semantics. Either ei_bounding_box(_Object) must
+ * \param _Object The object type that lives in the hierarchy. It must have value semantics. Either internal::bounding_box(_Object) must
* be defined and return an AlignedBox<_Scalar, _Dim> or bounding boxes must be provided to the tree initializer.
*
* This class provides a simple (as opposed to optimized) implementation of a bounding volume hierarchy analogous to a Kd-tree.
@@ -88,14 +92,14 @@ public:
KdBVH() {}
- /** Given an iterator range over \a Object references, constructs the BVH. Requires that ei_bounding_box(Object) return a Volume. */
+ /** Given an iterator range over \a Object references, constructs the BVH. Requires that internal::bounding_box(Object) return a Volume. */
template<typename Iter> KdBVH(Iter begin, Iter end) { init(begin, end, 0, 0); } //int is recognized by init as not being an iterator type
/** Given an iterator range over \a Object references and an iterator range over their bounding boxes, constructs the BVH */
template<typename OIter, typename BIter> KdBVH(OIter begin, OIter end, BIter boxBegin, BIter boxEnd) { init(begin, end, boxBegin, boxEnd); }
/** Given an iterator range over \a Object references, constructs the BVH, overwriting whatever is in there currently.
- * Requires that ei_bounding_box(Object) return a Volume. */
+ * Requires that internal::bounding_box(Object) return a Volume. */
template<typename Iter> void init(Iter begin, Iter end) { init(begin, end, 0, 0); }
/** Given an iterator range over \a Object references and an iterator range over their bounding boxes,
@@ -116,7 +120,7 @@ public:
VIPairList objCenters;
//compute the bounding boxes depending on BIter type
- ei_get_boxes_helper<ObjectList, VolumeList, BIter>()(objects, boxBegin, boxEnd, objBoxes);
+ internal::get_boxes_helper<ObjectList, VolumeList, BIter>()(objects, boxBegin, boxEnd, objBoxes);
objCenters.reserve(n);
boxes.reserve(n - 1);
@@ -176,7 +180,7 @@ public:
}
private:
- typedef ei_vector_int_pair<Scalar, Dim> VIPair;
+ typedef internal::vector_int_pair<Scalar, Dim> VIPair;
typedef std::vector<VIPair, aligned_allocator<VIPair> > VIPairList;
typedef Matrix<Scalar, Dim, 1> VectorType;
struct VectorComparator //compares vectors, or, more specificall, VIPairs along a particular dimension
@@ -191,7 +195,7 @@ private:
//the two halves, and adds their parent node. TODO: a cache-friendlier layout
void build(VIPairList &objCenters, int from, int to, const VolumeList &objBoxes, int dim)
{
- ei_assert(to - from > 1);
+ eigen_assert(to - from > 1);
if(to - from == 2) {
boxes.push_back(objBoxes[objCenters[from].second].merged(objBoxes[objCenters[from + 1].second]));
children.push_back(from + (int)objects.size() - 1); //there are objects.size() - 1 tree nodes
diff --git a/unsupported/Eigen/src/FFT/ei_fftw_impl.h b/unsupported/Eigen/src/FFT/ei_fftw_impl.h
index c1f777e6d..84e4fcda5 100644
--- a/unsupported/Eigen/src/FFT/ei_fftw_impl.h
+++ b/unsupported/Eigen/src/FFT/ei_fftw_impl.h
@@ -22,7 +22,7 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
+namespace internal {
// FFTW uses non-const arguments
// so we must use ugly const_cast calls for all the args it uses
@@ -34,40 +34,40 @@
// This assumes std::complex<T> layout is array of size 2 with real,imag
template <typename T>
inline
- T * ei_fftw_cast(const T* p)
+ T * fftw_cast(const T* p)
{
return const_cast<T*>( p);
}
inline
- fftw_complex * ei_fftw_cast( const std::complex<double> * p)
+ fftw_complex * fftw_cast( const std::complex<double> * p)
{
return const_cast<fftw_complex*>( reinterpret_cast<const fftw_complex*>(p) );
}
inline
- fftwf_complex * ei_fftw_cast( const std::complex<float> * p)
+ fftwf_complex * fftw_cast( const std::complex<float> * p)
{
return const_cast<fftwf_complex*>( reinterpret_cast<const fftwf_complex*>(p) );
}
inline
- fftwl_complex * ei_fftw_cast( const std::complex<long double> * p)
+ fftwl_complex * fftw_cast( const std::complex<long double> * p)
{
return const_cast<fftwl_complex*>( reinterpret_cast<const fftwl_complex*>(p) );
}
template <typename T>
- struct ei_fftw_plan {};
+ struct fftw_plan {};
template <>
- struct ei_fftw_plan<float>
+ struct fftw_plan<float>
{
typedef float scalar_type;
typedef fftwf_complex complex_type;
fftwf_plan m_plan;
- ei_fftw_plan() :m_plan(NULL) {}
- ~ei_fftw_plan() {if (m_plan) fftwf_destroy_plan(m_plan);}
+ fftw_plan() :m_plan(NULL) {}
+ ~fftw_plan() {if (m_plan) fftwf_destroy_plan(m_plan);}
inline
void fwd(complex_type * dst,complex_type * src,int nfft) {
@@ -104,13 +104,13 @@
};
template <>
- struct ei_fftw_plan<double>
+ struct fftw_plan<double>
{
typedef double scalar_type;
typedef fftw_complex complex_type;
fftw_plan m_plan;
- ei_fftw_plan() :m_plan(NULL) {}
- ~ei_fftw_plan() {if (m_plan) fftw_destroy_plan(m_plan);}
+ fftw_plan() :m_plan(NULL) {}
+ ~fftw_plan() {if (m_plan) fftw_destroy_plan(m_plan);}
inline
void fwd(complex_type * dst,complex_type * src,int nfft) {
@@ -145,13 +145,13 @@
}
};
template <>
- struct ei_fftw_plan<long double>
+ struct fftw_plan<long double>
{
typedef long double scalar_type;
typedef fftwl_complex complex_type;
fftwl_plan m_plan;
- ei_fftw_plan() :m_plan(NULL) {}
- ~ei_fftw_plan() {if (m_plan) fftwl_destroy_plan(m_plan);}
+ fftw_plan() :m_plan(NULL) {}
+ ~fftw_plan() {if (m_plan) fftwl_destroy_plan(m_plan);}
inline
void fwd(complex_type * dst,complex_type * src,int nfft) {
@@ -187,7 +187,7 @@
};
template <typename _Scalar>
- struct ei_fftw_impl
+ struct fftw_impl
{
typedef _Scalar Scalar;
typedef std::complex<Scalar> Complex;
@@ -202,47 +202,47 @@
inline
void fwd( Complex * dst,const Complex *src,int nfft)
{
- get_plan(nfft,false,dst,src).fwd(ei_fftw_cast(dst), ei_fftw_cast(src),nfft );
+ get_plan(nfft,false,dst,src).fwd(fftw_cast(dst), fftw_cast(src),nfft );
}
// real-to-complex forward FFT
inline
void fwd( Complex * dst,const Scalar * src,int nfft)
{
- get_plan(nfft,false,dst,src).fwd(ei_fftw_cast(dst), ei_fftw_cast(src) ,nfft);
+ get_plan(nfft,false,dst,src).fwd(fftw_cast(dst), fftw_cast(src) ,nfft);
}
// 2-d complex-to-complex
inline
void fwd2(Complex * dst, const Complex * src, int n0,int n1)
{
- get_plan(n0,n1,false,dst,src).fwd2(ei_fftw_cast(dst), ei_fftw_cast(src) ,n0,n1);
+ get_plan(n0,n1,false,dst,src).fwd2(fftw_cast(dst), fftw_cast(src) ,n0,n1);
}
// inverse complex-to-complex
inline
void inv(Complex * dst,const Complex *src,int nfft)
{
- get_plan(nfft,true,dst,src).inv(ei_fftw_cast(dst), ei_fftw_cast(src),nfft );
+ get_plan(nfft,true,dst,src).inv(fftw_cast(dst), fftw_cast(src),nfft );
}
// half-complex to scalar
inline
void inv( Scalar * dst,const Complex * src,int nfft)
{
- get_plan(nfft,true,dst,src).inv(ei_fftw_cast(dst), ei_fftw_cast(src),nfft );
+ get_plan(nfft,true,dst,src).inv(fftw_cast(dst), fftw_cast(src),nfft );
}
// 2-d complex-to-complex
inline
void inv2(Complex * dst, const Complex * src, int n0,int n1)
{
- get_plan(n0,n1,true,dst,src).inv2(ei_fftw_cast(dst), ei_fftw_cast(src) ,n0,n1);
+ get_plan(n0,n1,true,dst,src).inv2(fftw_cast(dst), fftw_cast(src) ,n0,n1);
}
protected:
- typedef ei_fftw_plan<Scalar> PlanData;
+ typedef fftw_plan<Scalar> PlanData;
typedef std::map<int64_t,PlanData> PlanMap;
@@ -266,5 +266,7 @@
return m_plans[key];
}
};
-/* vim: set filetype=cpp et sw=2 ts=2 ai: */
+} // end namespace internal
+
+/* vim: set filetype=cpp et sw=2 ts=2 ai: */
diff --git a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
index 5db1bf37d..667638f40 100644
--- a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
+++ b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
@@ -22,13 +22,13 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
-
+namespace internal {
// This FFT implementation was derived from kissfft http:sourceforge.net/projects/kissfft
// Copyright 2003-2009 Mark Borgerding
template <typename _Scalar>
-struct ei_kiss_cpx_fft
+struct kiss_cpx_fft
{
typedef _Scalar Scalar;
typedef std::complex<Scalar> Complex;
@@ -274,7 +274,7 @@ struct ei_kiss_cpx_fft
};
template <typename _Scalar>
-struct ei_kissfft_impl
+struct kissfft_impl
{
typedef _Scalar Scalar;
typedef std::complex<Scalar> Complex;
@@ -378,7 +378,7 @@ struct ei_kissfft_impl
}
protected:
- typedef ei_kiss_cpx_fft<Scalar> PlanData;
+ typedef kiss_cpx_fft<Scalar> PlanData;
typedef std::map<int,PlanData> PlanMap;
PlanMap m_plans;
@@ -416,5 +416,7 @@ struct ei_kissfft_impl
}
};
+} // end namespace internal
+
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
diff --git a/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h b/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
index 88339b354..f4851d316 100644
--- a/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
+++ b/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
@@ -50,14 +50,16 @@
#include <Eigen/Core>
+namespace internal {
+
/** \ingroup IterativeSolvers_Module
* Compute the pseudo inverse of the non-square matrix C such that
* \f$ CINV = (C * C^T)^{-1} * C \f$ based on a conjugate gradient method.
*
- * This function is internally used by ei_constrained_cg.
+ * This function is internally used by constrained_cg.
*/
template <typename CMatrix, typename CINVMatrix>
-void ei_pseudo_inverse(const CMatrix &C, CINVMatrix &CINV)
+void pseudo_inverse(const CMatrix &C, CINVMatrix &CINV)
{
// optimisable : copie de la ligne, precalcul de C * trans(C).
typedef typename CMatrix::Scalar Scalar;
@@ -113,7 +115,7 @@ void ei_pseudo_inverse(const CMatrix &C, CINVMatrix &CINV)
*/
template<typename TMatrix, typename CMatrix,
typename VectorX, typename VectorB, typename VectorF>
-void ei_constrained_cg(const TMatrix& A, const CMatrix& C, VectorX& x,
+void constrained_cg(const TMatrix& A, const CMatrix& C, VectorX& x,
const VectorB& b, const VectorF& f, IterationController &iter)
{
typedef typename TMatrix::Scalar Scalar;
@@ -127,11 +129,11 @@ void ei_constrained_cg(const TMatrix& A, const CMatrix& C, VectorX& x,
memox(xSize);
std::vector<bool> satured(C.rows());
p.setZero();
- iter.setRhsNorm(ei_sqrt(b.dot(b))); // gael vect_sp(PS, b, b)
+ iter.setRhsNorm(sqrt(b.dot(b))); // gael vect_sp(PS, b, b)
if (iter.rhsNorm() == 0.0) iter.setRhsNorm(1.0);
SparseMatrix<Scalar,RowMajor> CINV(C.rows(), C.cols());
- ei_pseudo_inverse(C, CINV);
+ pseudo_inverse(C, CINV);
while(true)
{
@@ -191,4 +193,6 @@ void ei_constrained_cg(const TMatrix& A, const CMatrix& C, VectorX& x,
}
}
+} // end namespace internal
+
#endif // EIGEN_CONSTRAINEDCG_H
diff --git a/unsupported/Eigen/src/IterativeSolvers/IterationController.h b/unsupported/Eigen/src/IterativeSolvers/IterationController.h
index 7d579a6fd..385d8c546 100644
--- a/unsupported/Eigen/src/IterativeSolvers/IterationController.h
+++ b/unsupported/Eigen/src/IterativeSolvers/IterationController.h
@@ -140,7 +140,7 @@ class IterationController
bool converged() const { return m_res <= m_rhsn * m_resmax; }
bool converged(double nr)
{
- m_res = ei_abs(nr);
+ m_res = internal::abs(nr);
m_resminreach = std::min(m_resminreach, m_res);
return converged();
}
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index 006371474..ae937acda 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -128,11 +128,11 @@ class MatrixExponential {
*/
void computeUV(float);
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
+ typedef typename internal::traits<MatrixType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
/** \brief Reference to matrix whose exponential is to be computed. */
- typename ei_nested<MatrixType>::type m_M;
+ typename internal::nested<MatrixType>::type m_M;
/** \brief Even-degree terms in numerator of Pad&eacute; approximant. */
MatrixType m_U;
@@ -327,16 +327,18 @@ template<typename Derived> struct MatrixExponentialReturnValue
MatrixExponentialReturnValue& operator=(const MatrixExponentialReturnValue&);
};
+namespace internal {
template<typename Derived>
-struct ei_traits<MatrixExponentialReturnValue<Derived> >
+struct traits<MatrixExponentialReturnValue<Derived> >
{
typedef typename Derived::PlainObject ReturnType;
};
+}
template <typename Derived>
const MatrixExponentialReturnValue<Derived> MatrixBase<Derived>::exp() const
{
- ei_assert(rows() == cols());
+ eigen_assert(rows() == cols());
return MatrixExponentialReturnValue<Derived>(derived());
}
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
index ae5dcab59..a4aa9baa7 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
@@ -34,14 +34,14 @@
* \tparam MatrixType type of the argument of the matrix function,
* expected to be an instantiation of the Matrix class template.
*/
-template <typename MatrixType, int IsComplex = NumTraits<typename ei_traits<MatrixType>::Scalar>::IsComplex>
+template <typename MatrixType, int IsComplex = NumTraits<typename internal::traits<MatrixType>::Scalar>::IsComplex>
class MatrixFunction
{
private:
- typedef typename ei_traits<MatrixType>::Index Index;
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::traits<MatrixType>::Index Index;
+ typedef typename internal::traits<MatrixType>::Scalar Scalar;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
public:
@@ -76,7 +76,7 @@ class MatrixFunction<MatrixType, 0>
{
private:
- typedef ei_traits<MatrixType> Traits;
+ typedef internal::traits<MatrixType> Traits;
typedef typename Traits::Scalar Scalar;
static const int Rows = Traits::RowsAtCompileTime;
static const int Cols = Traits::ColsAtCompileTime;
@@ -86,7 +86,7 @@ class MatrixFunction<MatrixType, 0>
typedef std::complex<Scalar> ComplexScalar;
typedef Matrix<ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols> ComplexMatrix;
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
public:
@@ -117,7 +117,7 @@ class MatrixFunction<MatrixType, 0>
}
private:
- typename ei_nested<MatrixType>::type m_A; /**< \brief Reference to argument of matrix function. */
+ typename internal::nested<MatrixType>::type m_A; /**< \brief Reference to argument of matrix function. */
StemFunction *m_f; /**< \brief Stem function for matrix function under consideration */
MatrixFunction& operator=(const MatrixFunction&);
@@ -132,14 +132,14 @@ class MatrixFunction<MatrixType, 1>
{
private:
- typedef ei_traits<MatrixType> Traits;
+ typedef internal::traits<MatrixType> Traits;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Index Index;
static const int RowsAtCompileTime = Traits::RowsAtCompileTime;
static const int ColsAtCompileTime = Traits::ColsAtCompileTime;
static const int Options = MatrixType::Options;
typedef typename NumTraits<Scalar>::Real RealScalar;
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
typedef Matrix<Scalar, Traits::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Index, Traits::RowsAtCompileTime, 1> IntVectorType;
typedef Matrix<Index, Dynamic, 1> DynamicIntVectorType;
@@ -167,7 +167,7 @@ class MatrixFunction<MatrixType, 1>
void computeOffDiagonal();
DynMatrixType solveTriangularSylvester(const DynMatrixType& A, const DynMatrixType& B, const DynMatrixType& C);
- typename ei_nested<MatrixType>::type m_A; /**< \brief Reference to argument of matrix function. */
+ typename internal::nested<MatrixType>::type m_A; /**< \brief Reference to argument of matrix function. */
StemFunction *m_f; /**< \brief Stem function for matrix function under consideration */
MatrixType m_T; /**< \brief Triangular part of Schur decomposition */
MatrixType m_U; /**< \brief Unitary part of Schur decomposition */
@@ -260,7 +260,7 @@ void MatrixFunction<MatrixType,1>::partitionEigenvalues()
// Look for other element to add to the set
for (Index j=i+1; j<rows; ++j) {
- if (ei_abs(diag(j) - diag(i)) <= separation() && std::find(qi->begin(), qi->end(), diag(j)) == qi->end()) {
+ if (internal::abs(diag(j) - diag(i)) <= separation() && std::find(qi->begin(), qi->end(), diag(j)) == qi->end()) {
typename ListOfClusters::iterator qj = findCluster(diag(j));
if (qj == m_clusters.end()) {
qi->push_back(diag(j));
@@ -346,7 +346,7 @@ void MatrixFunction<MatrixType,1>::permuteSchur()
for (j = i; j < p.rows(); j++) {
if (p(j) == i) break;
}
- ei_assert(p(j) == i);
+ eigen_assert(p(j) == i);
for (Index k = j-1; k >= i; k--) {
swapEntriesInSchur(k);
std::swap(p.coeffRef(k), p.coeffRef(k+1));
@@ -358,7 +358,7 @@ void MatrixFunction<MatrixType,1>::permuteSchur()
template <typename MatrixType>
void MatrixFunction<MatrixType,1>::swapEntriesInSchur(Index index)
{
- PlanarRotation<Scalar> rotation;
+ JacobiRotation<Scalar> rotation;
rotation.makeGivens(m_T(index, index+1), m_T(index+1, index+1) - m_T(index, index));
m_T.applyOnTheLeft(index, index+1, rotation.adjoint());
m_T.applyOnTheRight(index, index+1, rotation);
@@ -445,12 +445,12 @@ typename MatrixFunction<MatrixType,1>::DynMatrixType MatrixFunction<MatrixType,1
const DynMatrixType& B,
const DynMatrixType& C)
{
- ei_assert(A.rows() == A.cols());
- ei_assert(A.isUpperTriangular());
- ei_assert(B.rows() == B.cols());
- ei_assert(B.isUpperTriangular());
- ei_assert(C.rows() == A.rows());
- ei_assert(C.cols() == B.rows());
+ eigen_assert(A.rows() == A.cols());
+ eigen_assert(A.isUpperTriangular());
+ eigen_assert(B.rows() == B.cols());
+ eigen_assert(B.isUpperTriangular());
+ eigen_assert(C.rows() == A.rows());
+ eigen_assert(C.cols() == B.rows());
Index m = A.rows();
Index n = B.rows();
@@ -502,7 +502,7 @@ template<typename Derived> class MatrixFunctionReturnValue
typedef typename Derived::Scalar Scalar;
typedef typename Derived::Index Index;
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
/** \brief Constructor.
*
@@ -529,58 +529,60 @@ template<typename Derived> class MatrixFunctionReturnValue
Index cols() const { return m_A.cols(); }
private:
- typename ei_nested<Derived>::type m_A;
+ typename internal::nested<Derived>::type m_A;
StemFunction *m_f;
MatrixFunctionReturnValue& operator=(const MatrixFunctionReturnValue&);
};
+namespace internal {
template<typename Derived>
-struct ei_traits<MatrixFunctionReturnValue<Derived> >
+struct traits<MatrixFunctionReturnValue<Derived> >
{
typedef typename Derived::PlainObject ReturnType;
};
+}
/********** MatrixBase methods **********/
template <typename Derived>
-const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::matrixFunction(typename ei_stem_function<typename ei_traits<Derived>::Scalar>::type f) const
+const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::matrixFunction(typename internal::stem_function<typename internal::traits<Derived>::Scalar>::type f) const
{
- ei_assert(rows() == cols());
+ eigen_assert(rows() == cols());
return MatrixFunctionReturnValue<Derived>(derived(), f);
}
template <typename Derived>
const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sin() const
{
- ei_assert(rows() == cols());
- typedef typename ei_stem_function<Scalar>::ComplexScalar ComplexScalar;
+ eigen_assert(rows() == cols());
+ typedef typename internal::stem_function<Scalar>::ComplexScalar ComplexScalar;
return MatrixFunctionReturnValue<Derived>(derived(), StdStemFunctions<ComplexScalar>::sin);
}
template <typename Derived>
const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cos() const
{
- ei_assert(rows() == cols());
- typedef typename ei_stem_function<Scalar>::ComplexScalar ComplexScalar;
+ eigen_assert(rows() == cols());
+ typedef typename internal::stem_function<Scalar>::ComplexScalar ComplexScalar;
return MatrixFunctionReturnValue<Derived>(derived(), StdStemFunctions<ComplexScalar>::cos);
}
template <typename Derived>
const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sinh() const
{
- ei_assert(rows() == cols());
- typedef typename ei_stem_function<Scalar>::ComplexScalar ComplexScalar;
+ eigen_assert(rows() == cols());
+ typedef typename internal::stem_function<Scalar>::ComplexScalar ComplexScalar;
return MatrixFunctionReturnValue<Derived>(derived(), StdStemFunctions<ComplexScalar>::sinh);
}
template <typename Derived>
const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cosh() const
{
- ei_assert(rows() == cols());
- typedef typename ei_stem_function<Scalar>::ComplexScalar ComplexScalar;
+ eigen_assert(rows() == cols());
+ typedef typename internal::stem_function<Scalar>::ComplexScalar ComplexScalar;
return MatrixFunctionReturnValue<Derived>(derived(), StdStemFunctions<ComplexScalar>::cosh);
}
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
index ceb0a84f1..87dc64ce1 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
@@ -41,7 +41,7 @@ class MatrixFunctionAtomic
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Index Index;
typedef typename NumTraits<Scalar>::Real RealScalar;
- typedef typename ei_stem_function<Scalar>::type StemFunction;
+ typedef typename internal::stem_function<Scalar>::type StemFunction;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
/** \brief Constructor
@@ -99,7 +99,7 @@ MatrixType MatrixFunctionAtomic<MatrixType>::compute(const MatrixType& A)
return F;
}
}
- ei_assert("Taylor series does not converge" && 0);
+ eigen_assert("Taylor series does not converge" && 0);
return F;
}
diff --git a/unsupported/Eigen/src/MoreVectorization/MathFunctions.h b/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
index a998a0615..bc948d0bd 100644
--- a/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
+++ b/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
@@ -26,12 +26,14 @@
#ifndef EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H
#define EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H
+namespace internal {
+
/** \internal \returns the arcsin of \a a (coeff-wise) */
-template<typename Packet> inline static Packet ei_pasin(Packet a) { return std::asin(a); }
+template<typename Packet> inline static Packet pasin(Packet a) { return std::asin(a); }
#ifdef EIGEN_VECTORIZE_SSE
-template<> EIGEN_DONT_INLINE Packet4f ei_pasin(Packet4f x)
+template<> EIGEN_DONT_INLINE Packet4f pasin(Packet4f x)
{
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5);
_EIGEN_DECLARE_CONST_Packet4f(minus_half, -0.5);
@@ -48,9 +50,9 @@ template<> EIGEN_DONT_INLINE Packet4f ei_pasin(Packet4f x)
_EIGEN_DECLARE_CONST_Packet4f(asin4, 7.4953002686E-2);
_EIGEN_DECLARE_CONST_Packet4f(asin5, 1.6666752422E-1);
- Packet4f a = ei_pabs(x);//got the absolute value
+ Packet4f a = pabs(x);//got the absolute value
- Packet4f sign_bit= _mm_and_ps(x, ei_p4f_sign_mask);//extracted the sign bit
+ Packet4f sign_bit= _mm_and_ps(x, p4f_sign_mask);//extracted the sign bit
Packet4f z1,z2;//will need them during computation
@@ -58,34 +60,34 @@ template<> EIGEN_DONT_INLINE Packet4f ei_pasin(Packet4f x)
//will compute the two branches for asin
//so first compare with half
- Packet4f branch_mask= _mm_cmpgt_ps(a, ei_p4f_half);//this is to select which branch to take
+ Packet4f branch_mask= _mm_cmpgt_ps(a, p4f_half);//this is to select which branch to take
//both will be taken, and finally results will be merged
//the branch for values >0.5
{
//the core series expansion
- z1=ei_pmadd(ei_p4f_minus_half,a,ei_p4f_half);
- Packet4f x1=ei_psqrt(z1);
- Packet4f s1=ei_pmadd(ei_p4f_asin1, z1, ei_p4f_asin2);
- Packet4f s2=ei_pmadd(s1, z1, ei_p4f_asin3);
- Packet4f s3=ei_pmadd(s2,z1, ei_p4f_asin4);
- Packet4f s4=ei_pmadd(s3,z1, ei_p4f_asin5);
- Packet4f temp=ei_pmul(s4,z1);//not really a madd but a mul by z so that the next term can be a madd
- z1=ei_pmadd(temp,x1,x1);
- z1=ei_padd(z1,z1);
- z1=ei_psub(ei_p4f_pi_over_2,z1);
+ z1=pmadd(p4f_minus_half,a,p4f_half);
+ Packet4f x1=psqrt(z1);
+ Packet4f s1=pmadd(p4f_asin1, z1, p4f_asin2);
+ Packet4f s2=pmadd(s1, z1, p4f_asin3);
+ Packet4f s3=pmadd(s2,z1, p4f_asin4);
+ Packet4f s4=pmadd(s3,z1, p4f_asin5);
+ Packet4f temp=pmul(s4,z1);//not really a madd but a mul by z so that the next term can be a madd
+ z1=pmadd(temp,x1,x1);
+ z1=padd(z1,z1);
+ z1=psub(p4f_pi_over_2,z1);
}
{
//the core series expansion
Packet4f x2=a;
- z2=ei_pmul(x2,x2);
- Packet4f s1=ei_pmadd(ei_p4f_asin1, z2, ei_p4f_asin2);
- Packet4f s2=ei_pmadd(s1, z2, ei_p4f_asin3);
- Packet4f s3=ei_pmadd(s2,z2, ei_p4f_asin4);
- Packet4f s4=ei_pmadd(s3,z2, ei_p4f_asin5);
- Packet4f temp=ei_pmul(s4,z2);//not really a madd but a mul by z so that the next term can be a madd
- z2=ei_pmadd(temp,x2,x2);
+ z2=pmul(x2,x2);
+ Packet4f s1=pmadd(p4f_asin1, z2, p4f_asin2);
+ Packet4f s2=pmadd(s1, z2, p4f_asin3);
+ Packet4f s3=pmadd(s2,z2, p4f_asin4);
+ Packet4f s4=pmadd(s3,z2, p4f_asin5);
+ Packet4f temp=pmul(s4,z2);//not really a madd but a mul by z so that the next term can be a madd
+ z2=pmadd(temp,x2,x2);
}
/* select the correct result from the two branch evaluations */
@@ -97,6 +99,7 @@ template<> EIGEN_DONT_INLINE Packet4f ei_pasin(Packet4f x)
return _mm_xor_ps(z, sign_bit);
}
+} // end namespace internal
#endif
diff --git a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
index 0ef3ecafa..a4863700e 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
@@ -65,7 +65,7 @@ public:
Parameters()
: factor(Scalar(100.))
, maxfev(1000)
- , xtol(ei_sqrt(NumTraits<Scalar>::epsilon()))
+ , xtol(internal::sqrt(NumTraits<Scalar>::epsilon()))
, nb_of_subdiagonals(-1)
, nb_of_superdiagonals(-1)
, epsfcn(Scalar(0.)) {}
@@ -83,7 +83,7 @@ public:
HybridNonLinearSolverSpace::Status hybrj1(
FVectorType &x,
- const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
+ const Scalar tol = internal::sqrt(NumTraits<Scalar>::epsilon())
);
HybridNonLinearSolverSpace::Status solveInit(FVectorType &x);
@@ -92,7 +92,7 @@ public:
HybridNonLinearSolverSpace::Status hybrd1(
FVectorType &x,
- const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
+ const Scalar tol = internal::sqrt(NumTraits<Scalar>::epsilon())
);
HybridNonLinearSolverSpace::Status solveNumericalDiffInit(FVectorType &x);
@@ -201,7 +201,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
assert(x.size()==n); // check the caller is not cheating us
Index j;
- std::vector<PlanarRotation<Scalar> > v_givens(n), w_givens(n);
+ std::vector<JacobiRotation<Scalar> > v_givens(n), w_givens(n);
jeval = true;
@@ -246,7 +246,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
while (true) {
/* determine the direction p. */
- ei_dogleg<Scalar>(R, diag, qtf, delta, wa1);
+ internal::dogleg<Scalar>(R, diag, qtf, delta, wa1);
/* store the direction p and x + p. calculate the norm of p. */
wa1 = -wa1;
@@ -266,14 +266,14 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
/* compute the scaled actual reduction. */
actred = -1.;
if (fnorm1 < fnorm) /* Computing 2nd power */
- actred = 1. - ei_abs2(fnorm1 / fnorm);
+ actred = 1. - internal::abs2(fnorm1 / fnorm);
/* compute the scaled predicted reduction. */
wa3 = R.template triangularView<Upper>()*wa1 + qtf;
temp = wa3.stableNorm();
prered = 0.;
if (temp < fnorm) /* Computing 2nd power */
- prered = 1. - ei_abs2(temp / fnorm);
+ prered = 1. - internal::abs2(temp / fnorm);
/* compute the ratio of the actual to the predicted reduction. */
ratio = 0.;
@@ -290,7 +290,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
++ncsuc;
if (ratio >= Scalar(.5) || ncsuc > 1)
delta = std::max(delta, pnorm / Scalar(.5));
- if (ei_abs(ratio - 1.) <= Scalar(.1)) {
+ if (internal::abs(ratio - 1.) <= Scalar(.1)) {
delta = pnorm / Scalar(.5);
}
}
@@ -342,9 +342,9 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
wa2 = (wa2-wa3)/pnorm;
/* compute the qr factorization of the updated jacobian. */
- ei_r1updt<Scalar>(R, wa1, v_givens, w_givens, wa2, wa3, &sing);
- ei_r1mpyq<Scalar>(n, n, fjac.data(), v_givens, w_givens);
- ei_r1mpyq<Scalar>(1, n, qtf.data(), v_givens, w_givens);
+ internal::r1updt<Scalar>(R, wa1, v_givens, w_givens, wa2, wa3, &sing);
+ internal::r1mpyq<Scalar>(n, n, fjac.data(), v_givens, w_givens);
+ internal::r1mpyq<Scalar>(1, n, qtf.data(), v_givens, w_givens);
jeval = false;
}
@@ -440,14 +440,14 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
assert(x.size()==n); // check the caller is not cheating us
Index j;
- std::vector<PlanarRotation<Scalar> > v_givens(n), w_givens(n);
+ std::vector<JacobiRotation<Scalar> > v_givens(n), w_givens(n);
jeval = true;
if (parameters.nb_of_subdiagonals<0) parameters.nb_of_subdiagonals= n-1;
if (parameters.nb_of_superdiagonals<0) parameters.nb_of_superdiagonals= n-1;
/* calculate the jacobian matrix. */
- if (ei_fdjac1(functor, x, fvec, fjac, parameters.nb_of_subdiagonals, parameters.nb_of_superdiagonals, parameters.epsfcn) <0)
+ if (internal::fdjac1(functor, x, fvec, fjac, parameters.nb_of_subdiagonals, parameters.nb_of_superdiagonals, parameters.epsfcn) <0)
return HybridNonLinearSolverSpace::UserAksed;
nfev += std::min(parameters.nb_of_subdiagonals+parameters.nb_of_superdiagonals+ 1, n);
@@ -487,7 +487,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
while (true) {
/* determine the direction p. */
- ei_dogleg<Scalar>(R, diag, qtf, delta, wa1);
+ internal::dogleg<Scalar>(R, diag, qtf, delta, wa1);
/* store the direction p and x + p. calculate the norm of p. */
wa1 = -wa1;
@@ -507,14 +507,14 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
/* compute the scaled actual reduction. */
actred = -1.;
if (fnorm1 < fnorm) /* Computing 2nd power */
- actred = 1. - ei_abs2(fnorm1 / fnorm);
+ actred = 1. - internal::abs2(fnorm1 / fnorm);
/* compute the scaled predicted reduction. */
wa3 = R.template triangularView<Upper>()*wa1 + qtf;
temp = wa3.stableNorm();
prered = 0.;
if (temp < fnorm) /* Computing 2nd power */
- prered = 1. - ei_abs2(temp / fnorm);
+ prered = 1. - internal::abs2(temp / fnorm);
/* compute the ratio of the actual to the predicted reduction. */
ratio = 0.;
@@ -531,7 +531,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
++ncsuc;
if (ratio >= Scalar(.5) || ncsuc > 1)
delta = std::max(delta, pnorm / Scalar(.5));
- if (ei_abs(ratio - 1.) <= Scalar(.1)) {
+ if (internal::abs(ratio - 1.) <= Scalar(.1)) {
delta = pnorm / Scalar(.5);
}
}
@@ -583,9 +583,9 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
wa2 = (wa2-wa3)/pnorm;
/* compute the qr factorization of the updated jacobian. */
- ei_r1updt<Scalar>(R, wa1, v_givens, w_givens, wa2, wa3, &sing);
- ei_r1mpyq<Scalar>(n, n, fjac.data(), v_givens, w_givens);
- ei_r1mpyq<Scalar>(1, n, qtf.data(), v_givens, w_givens);
+ internal::r1updt<Scalar>(R, wa1, v_givens, w_givens, wa2, wa3, &sing);
+ internal::r1mpyq<Scalar>(n, n, fjac.data(), v_givens, w_givens);
+ internal::r1mpyq<Scalar>(1, n, qtf.data(), v_givens, w_givens);
jeval = false;
}
diff --git a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
index a8f3f3e64..c43df3f7a 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
@@ -69,8 +69,8 @@ public:
Parameters()
: factor(Scalar(100.))
, maxfev(400)
- , ftol(ei_sqrt(NumTraits<Scalar>::epsilon()))
- , xtol(ei_sqrt(NumTraits<Scalar>::epsilon()))
+ , ftol(internal::sqrt(NumTraits<Scalar>::epsilon()))
+ , xtol(internal::sqrt(NumTraits<Scalar>::epsilon()))
, gtol(Scalar(0.))
, epsfcn(Scalar(0.)) {}
Scalar factor;
@@ -86,7 +86,7 @@ public:
LevenbergMarquardtSpace::Status lmder1(
FVectorType &x,
- const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
+ const Scalar tol = internal::sqrt(NumTraits<Scalar>::epsilon())
);
LevenbergMarquardtSpace::Status minimize(FVectorType &x);
@@ -97,12 +97,12 @@ public:
FunctorType &functor,
FVectorType &x,
Index *nfev,
- const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
+ const Scalar tol = internal::sqrt(NumTraits<Scalar>::epsilon())
);
LevenbergMarquardtSpace::Status lmstr1(
FVectorType &x,
- const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
+ const Scalar tol = internal::sqrt(NumTraits<Scalar>::epsilon())
);
LevenbergMarquardtSpace::Status minimizeOptimumStorage(FVectorType &x);
@@ -263,7 +263,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
if (fnorm != 0.)
for (Index j = 0; j < n; ++j)
if (wa2[permutation.indices()[j]] != 0.)
- gnorm = std::max(gnorm, ei_abs( fjac.col(j).head(j+1).dot(qtf.head(j+1)/fnorm) / wa2[permutation.indices()[j]]));
+ gnorm = std::max(gnorm, internal::abs( fjac.col(j).head(j+1).dot(qtf.head(j+1)/fnorm) / wa2[permutation.indices()[j]]));
/* test for convergence of the gradient norm. */
if (gnorm <= parameters.gtol)
@@ -276,7 +276,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
do {
/* determine the levenberg-marquardt parameter. */
- ei_lmpar2<Scalar>(qrfac, diag, qtf, delta, par, wa1);
+ internal::lmpar2<Scalar>(qrfac, diag, qtf, delta, par, wa1);
/* store the direction p and x + p. calculate the norm of p. */
wa1 = -wa1;
@@ -296,13 +296,13 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
/* compute the scaled actual reduction. */
actred = -1.;
if (Scalar(.1) * fnorm1 < fnorm)
- actred = 1. - ei_abs2(fnorm1 / fnorm);
+ actred = 1. - internal::abs2(fnorm1 / fnorm);
/* compute the scaled predicted reduction and */
/* the scaled directional derivative. */
wa3 = fjac.template triangularView<Upper>() * (qrfac.colsPermutation().inverse() *wa1);
- temp1 = ei_abs2(wa3.stableNorm() / fnorm);
- temp2 = ei_abs2(ei_sqrt(par) * pnorm / fnorm);
+ temp1 = internal::abs2(wa3.stableNorm() / fnorm);
+ temp2 = internal::abs2(internal::sqrt(par) * pnorm / fnorm);
prered = temp1 + temp2 / Scalar(.5);
dirder = -(temp1 + temp2);
@@ -340,9 +340,9 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
}
/* tests for convergence. */
- if (ei_abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1. && delta <= parameters.xtol * xnorm)
+ if (internal::abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1. && delta <= parameters.xtol * xnorm)
return LevenbergMarquardtSpace::RelativeErrorAndReductionTooSmall;
- if (ei_abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1.)
+ if (internal::abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1.)
return LevenbergMarquardtSpace::RelativeReductionTooSmall;
if (delta <= parameters.xtol * xnorm)
return LevenbergMarquardtSpace::RelativeErrorTooSmall;
@@ -350,7 +350,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
/* tests for termination and stringent tolerances. */
if (nfev >= parameters.maxfev)
return LevenbergMarquardtSpace::TooManyFunctionEvaluation;
- if (ei_abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
+ if (internal::abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
return LevenbergMarquardtSpace::FtolTooSmall;
if (delta <= NumTraits<Scalar>::epsilon() * xnorm)
return LevenbergMarquardtSpace::XtolTooSmall;
@@ -451,7 +451,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
Index rownb = 2;
for (i = 0; i < m; ++i) {
if (functor.df(x, wa3, rownb) < 0) return LevenbergMarquardtSpace::UserAsked;
- ei_rwupdt<Scalar>(fjac, wa3, qtf, fvec[i]);
+ internal::rwupdt<Scalar>(fjac, wa3, qtf, fvec[i]);
++rownb;
}
++njev;
@@ -510,7 +510,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
if (fnorm != 0.)
for (j = 0; j < n; ++j)
if (wa2[permutation.indices()[j]] != 0.)
- gnorm = std::max(gnorm, ei_abs( fjac.col(j).head(j+1).dot(qtf.head(j+1)/fnorm) / wa2[permutation.indices()[j]]));
+ gnorm = std::max(gnorm, internal::abs( fjac.col(j).head(j+1).dot(qtf.head(j+1)/fnorm) / wa2[permutation.indices()[j]]));
/* test for convergence of the gradient norm. */
if (gnorm <= parameters.gtol)
@@ -523,7 +523,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
do {
/* determine the levenberg-marquardt parameter. */
- ei_lmpar<Scalar>(fjac, permutation.indices(), diag, qtf, delta, par, wa1);
+ internal::lmpar<Scalar>(fjac, permutation.indices(), diag, qtf, delta, par, wa1);
/* store the direction p and x + p. calculate the norm of p. */
wa1 = -wa1;
@@ -543,13 +543,13 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
/* compute the scaled actual reduction. */
actred = -1.;
if (Scalar(.1) * fnorm1 < fnorm)
- actred = 1. - ei_abs2(fnorm1 / fnorm);
+ actred = 1. - internal::abs2(fnorm1 / fnorm);
/* compute the scaled predicted reduction and */
/* the scaled directional derivative. */
wa3 = fjac.topLeftCorner(n,n).template triangularView<Upper>() * (permutation.inverse() * wa1);
- temp1 = ei_abs2(wa3.stableNorm() / fnorm);
- temp2 = ei_abs2(ei_sqrt(par) * pnorm / fnorm);
+ temp1 = internal::abs2(wa3.stableNorm() / fnorm);
+ temp2 = internal::abs2(internal::sqrt(par) * pnorm / fnorm);
prered = temp1 + temp2 / Scalar(.5);
dirder = -(temp1 + temp2);
@@ -587,9 +587,9 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
}
/* tests for convergence. */
- if (ei_abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1. && delta <= parameters.xtol * xnorm)
+ if (internal::abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1. && delta <= parameters.xtol * xnorm)
return LevenbergMarquardtSpace::RelativeErrorAndReductionTooSmall;
- if (ei_abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1.)
+ if (internal::abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1.)
return LevenbergMarquardtSpace::RelativeReductionTooSmall;
if (delta <= parameters.xtol * xnorm)
return LevenbergMarquardtSpace::RelativeErrorTooSmall;
@@ -597,7 +597,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(FVectorTyp
/* tests for termination and stringent tolerances. */
if (nfev >= parameters.maxfev)
return LevenbergMarquardtSpace::TooManyFunctionEvaluation;
- if (ei_abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
+ if (internal::abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
return LevenbergMarquardtSpace::FtolTooSmall;
if (delta <= NumTraits<Scalar>::epsilon() * xnorm)
return LevenbergMarquardtSpace::XtolTooSmall;
diff --git a/unsupported/Eigen/src/NonLinearOptimization/chkder.h b/unsupported/Eigen/src/NonLinearOptimization/chkder.h
index 4cb4fbdef..e2bdf923c 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/chkder.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/chkder.h
@@ -2,8 +2,10 @@
#define chkder_log10e 0.43429448190325182765
#define chkder_factor 100.
+namespace internal {
+
template<typename Scalar>
-void ei_chkder(
+void chkder(
const Matrix< Scalar, Dynamic, 1 > &x,
const Matrix< Scalar, Dynamic, 1 > &fvec,
const Matrix< Scalar, Dynamic, Dynamic > &fjac,
@@ -15,9 +17,9 @@ void ei_chkder(
{
typedef DenseIndex Index;
- const Scalar eps = ei_sqrt(NumTraits<Scalar>::epsilon());
+ const Scalar eps = sqrt(NumTraits<Scalar>::epsilon());
const Scalar epsf = chkder_factor * NumTraits<Scalar>::epsilon();
- const Scalar epslog = chkder_log10e * ei_log(eps);
+ const Scalar epslog = chkder_log10e * log(eps);
Scalar temp;
const Index m = fvec.size(), n = x.size();
@@ -26,7 +28,7 @@ void ei_chkder(
/* mode = 1. */
xp.resize(n);
for (Index j = 0; j < n; ++j) {
- temp = eps * ei_abs(x[j]);
+ temp = eps * abs(x[j]);
if (temp == 0.)
temp = eps;
xp[j] = x[j] + temp;
@@ -36,21 +38,22 @@ void ei_chkder(
/* mode = 2. */
err.setZero(m);
for (Index j = 0; j < n; ++j) {
- temp = ei_abs(x[j]);
+ temp = abs(x[j]);
if (temp == 0.)
temp = 1.;
err += temp * fjac.col(j);
}
for (Index i = 0; i < m; ++i) {
temp = 1.;
- if (fvec[i] != 0. && fvecp[i] != 0. && ei_abs(fvecp[i] - fvec[i]) >= epsf * ei_abs(fvec[i]))
- temp = eps * ei_abs((fvecp[i] - fvec[i]) / eps - err[i]) / (ei_abs(fvec[i]) + ei_abs(fvecp[i]));
+ if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i]))
+ temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i]));
err[i] = 1.;
if (temp > NumTraits<Scalar>::epsilon() && temp < eps)
- err[i] = (chkder_log10e * ei_log(temp) - epslog) / epslog;
+ err[i] = (chkder_log10e * log(temp) - epslog) / epslog;
if (temp >= eps)
err[i] = 0.;
}
}
}
+} // end namespace internal \ No newline at end of file
diff --git a/unsupported/Eigen/src/NonLinearOptimization/covar.h b/unsupported/Eigen/src/NonLinearOptimization/covar.h
index 104898a30..6c77916f5 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/covar.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/covar.h
@@ -1,9 +1,10 @@
+namespace internal {
template <typename Scalar>
-void ei_covar(
+void covar(
Matrix< Scalar, Dynamic, Dynamic > &r,
const VectorXi &ipvt,
- Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon()) )
+ Scalar tol = sqrt(NumTraits<Scalar>::epsilon()) )
{
typedef DenseIndex Index;
@@ -14,14 +15,14 @@ void ei_covar(
/* Function Body */
const Index n = r.cols();
- const Scalar tolr = tol * ei_abs(r(0,0));
+ const Scalar tolr = tol * abs(r(0,0));
Matrix< Scalar, Dynamic, 1 > wa(n);
assert(ipvt.size()==n);
/* form the inverse of r in the full upper triangle of r. */
l = -1;
for (k = 0; k < n; ++k)
- if (ei_abs(r(k,k)) > tolr) {
+ if (abs(r(k,k)) > tolr) {
r(k,k) = 1. / r(k,k);
for (j = 0; j <= k-1; ++j) {
temp = r(k,k) * r(j,k);
@@ -61,3 +62,4 @@ void ei_covar(
r.diagonal() = wa;
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
index ab01d5c47..fffd9e0be 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
@@ -1,6 +1,7 @@
+namespace internal {
template <typename Scalar>
-void ei_dogleg(
+void dogleg(
const Matrix< Scalar, Dynamic, Dynamic > &qrfac,
const Matrix< Scalar, Dynamic, 1 > &diag,
const Matrix< Scalar, Dynamic, 1 > &qtb,
@@ -86,8 +87,8 @@ void ei_dogleg(
/* at which the quadratic is minimized. */
bnorm = qtb.stableNorm();
temp = bnorm / gnorm * (bnorm / qnorm) * (sgnorm / delta);
- temp = temp - delta / qnorm * ei_abs2(sgnorm / delta) + ei_sqrt(ei_abs2(temp - delta / qnorm) + (1.-ei_abs2(delta / qnorm)) * (1.-ei_abs2(sgnorm / delta)));
- alpha = delta / qnorm * (1. - ei_abs2(sgnorm / delta)) / temp;
+ temp = temp - delta / qnorm * abs2(sgnorm / delta) + sqrt(abs2(temp - delta / qnorm) + (1.-abs2(delta / qnorm)) * (1.-abs2(sgnorm / delta)));
+ alpha = delta / qnorm * (1. - abs2(sgnorm / delta)) / temp;
algo_end:
/* form appropriate convex combination of the gauss-newton */
@@ -96,3 +97,4 @@ algo_end:
x = temp * wa1 + alpha * x;
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
index 74cf53b90..887b76fa1 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
@@ -1,6 +1,7 @@
+namespace internal {
template<typename FunctorType, typename Scalar>
-DenseIndex ei_fdjac1(
+DenseIndex fdjac1(
const FunctorType &Functor,
Matrix< Scalar, Dynamic, 1 > &x,
Matrix< Scalar, Dynamic, 1 > &fvec,
@@ -25,13 +26,13 @@ DenseIndex ei_fdjac1(
Matrix< Scalar, Dynamic, 1 > wa1(n);
Matrix< Scalar, Dynamic, 1 > wa2(n);
- eps = ei_sqrt(std::max(epsfcn,epsmch));
+ eps = sqrt(std::max(epsfcn,epsmch));
msum = ml + mu + 1;
if (msum >= n) {
/* computation of dense approximate jacobian. */
for (j = 0; j < n; ++j) {
temp = x[j];
- h = eps * ei_abs(temp);
+ h = eps * abs(temp);
if (h == 0.)
h = eps;
x[j] = temp + h;
@@ -47,7 +48,7 @@ DenseIndex ei_fdjac1(
for (k = 0; k < msum; ++k) {
for (j = k; (msum<0) ? (j>n): (j<n); j += msum) {
wa2[j] = x[j];
- h = eps * ei_abs(wa2[j]);
+ h = eps * abs(wa2[j]);
if (h == 0.) h = eps;
x[j] = wa2[j] + h;
}
@@ -56,7 +57,7 @@ DenseIndex ei_fdjac1(
return iflag;
for (j = k; (msum<0) ? (j>n): (j<n); j += msum) {
x[j] = wa2[j];
- h = eps * ei_abs(wa2[j]);
+ h = eps * abs(wa2[j]);
if (h == 0.) h = eps;
fjac.col(j).setZero();
start = std::max<Index>(0,j-mu);
@@ -68,3 +69,4 @@ DenseIndex ei_fdjac1(
return 0;
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
index 27138de96..a6bbc50ba 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
@@ -1,6 +1,7 @@
+namespace internal {
template <typename Scalar>
-void ei_lmpar(
+void lmpar(
Matrix< Scalar, Dynamic, Dynamic > &r,
const VectorXi &ipvt,
const Matrix< Scalar, Dynamic, 1 > &diag,
@@ -106,10 +107,10 @@ void ei_lmpar(
/* evaluate the function at the current value of par. */
if (par == 0.)
par = std::max(dwarf,Scalar(.001) * paru); /* Computing MAX */
- wa1 = ei_sqrt(par)* diag;
+ wa1 = sqrt(par)* diag;
Matrix< Scalar, Dynamic, 1 > sdiag(n);
- ei_qrsolv<Scalar>(r, ipvt, wa1, qtb, x, sdiag);
+ qrsolv<Scalar>(r, ipvt, wa1, qtb, x, sdiag);
wa2 = diag.cwiseProduct(x);
dxnorm = wa2.blueNorm();
@@ -119,7 +120,7 @@ void ei_lmpar(
/* if the function is small enough, accept the current value */
/* of par. also test for the exceptional cases where parl */
/* is zero or the number of iterations has reached 10. */
- if (ei_abs(fp) <= Scalar(0.1) * delta || (parl == 0. && fp <= temp && temp < 0.) || iter == 10)
+ if (abs(fp) <= Scalar(0.1) * delta || (parl == 0. && fp <= temp && temp < 0.) || iter == 10)
break;
/* compute the newton correction. */
@@ -156,7 +157,7 @@ void ei_lmpar(
}
template <typename Scalar>
-void ei_lmpar2(
+void lmpar2(
const ColPivHouseholderQR<Matrix< Scalar, Dynamic, Dynamic> > &qr,
const Matrix< Scalar, Dynamic, 1 > &diag,
const Matrix< Scalar, Dynamic, 1 > &qtb,
@@ -243,10 +244,10 @@ void ei_lmpar2(
/* evaluate the function at the current value of par. */
if (par == 0.)
par = std::max(dwarf,Scalar(.001) * paru); /* Computing MAX */
- wa1 = ei_sqrt(par)* diag;
+ wa1 = sqrt(par)* diag;
Matrix< Scalar, Dynamic, 1 > sdiag(n);
- ei_qrsolv<Scalar>(s, qr.colsPermutation().indices(), wa1, qtb, x, sdiag);
+ qrsolv<Scalar>(s, qr.colsPermutation().indices(), wa1, qtb, x, sdiag);
wa2 = diag.cwiseProduct(x);
dxnorm = wa2.blueNorm();
@@ -256,7 +257,7 @@ void ei_lmpar2(
/* if the function is small enough, accept the current value */
/* of par. also test for the exceptional cases where parl */
/* is zero or the number of iterations has reached 10. */
- if (ei_abs(fp) <= Scalar(0.1) * delta || (parl == 0. && fp <= temp && temp < 0.) || iter == 10)
+ if (abs(fp) <= Scalar(0.1) * delta || (parl == 0. && fp <= temp && temp < 0.) || iter == 10)
break;
/* compute the newton correction. */
@@ -286,3 +287,4 @@ void ei_lmpar2(
return;
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h b/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
index 15a27d53d..cb1764a41 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
@@ -1,9 +1,10 @@
+namespace internal {
// TODO : once qrsolv2 is removed, use ColPivHouseholderQR or PermutationMatrix instead of ipvt
template <typename Scalar>
-void ei_qrsolv(
+void qrsolv(
Matrix< Scalar, Dynamic, Dynamic > &s,
- // TODO : use a PermutationMatrix once ei_lmpar is no more:
+ // TODO : use a PermutationMatrix once lmpar is no more:
const VectorXi &ipvt,
const Matrix< Scalar, Dynamic, 1 > &diag,
const Matrix< Scalar, Dynamic, 1 > &qtb,
@@ -18,7 +19,7 @@ void ei_qrsolv(
Scalar temp;
Index n = s.cols();
Matrix< Scalar, Dynamic, 1 > wa(n);
- PlanarRotation<Scalar> givens;
+ JacobiRotation<Scalar> givens;
/* Function Body */
// the following will only change the lower triangular part of s, including
@@ -83,3 +84,4 @@ void ei_qrsolv(
for (j = 0; j < n; ++j) x[ipvt[j]] = wa[j];
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
index ad319d9eb..ffe505cd5 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
@@ -1,8 +1,9 @@
+namespace internal {
// TODO : move this to GivensQR once there's such a thing in Eigen
template <typename Scalar>
-void ei_r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<PlanarRotation<Scalar> > &v_givens, const std::vector<PlanarRotation<Scalar> > &w_givens)
+void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<JacobiRotation<Scalar> > &v_givens, const std::vector<JacobiRotation<Scalar> > &w_givens)
{
typedef DenseIndex Index;
@@ -22,3 +23,4 @@ void ei_r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<PlanarRo
}
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
index e01d02910..0b8ede119 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
@@ -1,10 +1,11 @@
+namespace internal {
template <typename Scalar>
-void ei_r1updt(
+void r1updt(
Matrix< Scalar, Dynamic, Dynamic > &s,
const Matrix< Scalar, Dynamic, 1> &u,
- std::vector<PlanarRotation<Scalar> > &v_givens,
- std::vector<PlanarRotation<Scalar> > &w_givens,
+ std::vector<JacobiRotation<Scalar> > &v_givens,
+ std::vector<JacobiRotation<Scalar> > &w_givens,
Matrix< Scalar, Dynamic, 1> &v,
Matrix< Scalar, Dynamic, 1> &w,
bool *sing)
@@ -16,9 +17,9 @@ void ei_r1updt(
const Index n = s.cols();
Index i, j=1;
Scalar temp;
- PlanarRotation<Scalar> givens;
+ JacobiRotation<Scalar> givens;
- // ei_r1updt had a broader usecase, but we dont use it here. And, more
+ // r1updt had a broader usecase, but we dont use it here. And, more
// importantly, we can not test it.
assert(m==n);
assert(u.size()==m);
@@ -88,3 +89,4 @@ void ei_r1updt(
return;
}
+} // end namespace internal
diff --git a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
index aa0bf7d0f..96263f8c0 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
@@ -1,6 +1,7 @@
+namespace internal {
template <typename Scalar>
-void ei_rwupdt(
+void rwupdt(
Matrix< Scalar, Dynamic, Dynamic > &r,
const Matrix< Scalar, Dynamic, 1> &w,
Matrix< Scalar, Dynamic, 1> &b,
@@ -10,7 +11,7 @@ void ei_rwupdt(
const Index n = r.cols();
assert(r.rows()>=n);
- std::vector<PlanarRotation<Scalar> > givens(n);
+ std::vector<JacobiRotation<Scalar> > givens(n);
/* Local variables */
Scalar temp, rowj;
@@ -29,7 +30,7 @@ void ei_rwupdt(
if (rowj == 0.)
{
- givens[j] = PlanarRotation<Scalar>(1,0);
+ givens[j] = JacobiRotation<Scalar>(1,0);
continue;
}
@@ -44,3 +45,4 @@ void ei_rwupdt(
}
}
+} // end namespace internal \ No newline at end of file
diff --git a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
index e840dd461..dbf27c481 100644
--- a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
+++ b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
@@ -80,7 +80,7 @@ public:
Scalar h;
int nfev=0;
const typename InputType::Index n = _x.size();
- const Scalar eps = ei_sqrt((std::max(epsfcn,NumTraits<Scalar>::epsilon() )));
+ const Scalar eps = internal::sqrt((std::max(epsfcn,NumTraits<Scalar>::epsilon() )));
ValueType val1, val2;
InputType x = _x;
// TODO : we should do this only if the size is not already known
@@ -102,7 +102,7 @@ public:
// Function Body
for (int j = 0; j < n; ++j) {
- h = eps * ei_abs(x[j]);
+ h = eps * internal::abs(x[j]);
if (h == 0.) {
h = eps;
}
diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h
index bbd9073b3..608951d3c 100644
--- a/unsupported/Eigen/src/Polynomials/Companion.h
+++ b/unsupported/Eigen/src/Polynomials/Companion.h
@@ -31,14 +31,16 @@
#ifndef EIGEN_PARSED_BY_DOXYGEN
+namespace internal {
+
template <typename T>
-T ei_radix(){ return 2; }
+T radix(){ return 2; }
template <typename T>
-T ei_radix2(){ return ei_radix<T>()*ei_radix<T>(); }
+T radix2(){ return radix<T>()*radix<T>(); }
template<int Size>
-struct ei_decrement_if_fixed_size
+struct decrement_if_fixed_size
{
enum {
ret = (Size == Dynamic) ? Dynamic : Size-1 };
@@ -47,14 +49,14 @@ struct ei_decrement_if_fixed_size
#endif
template< typename _Scalar, int _Deg >
-class ei_companion
+class companion
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Deg==Dynamic ? Dynamic : _Deg)
enum {
Deg = _Deg,
- Deg_1=ei_decrement_if_fixed_size<Deg>::ret
+ Deg_1=decrement_if_fixed_size<Deg>::ret
};
typedef _Scalar Scalar;
@@ -92,7 +94,7 @@ class ei_companion
}
template<typename VectorType>
- ei_companion( const VectorType& poly ){
+ companion( const VectorType& poly ){
setPolynomial( poly ); }
public:
@@ -150,7 +152,7 @@ class ei_companion
template< typename _Scalar, int _Deg >
inline
-bool ei_companion<_Scalar,_Deg>::balanced( Scalar colNorm, Scalar rowNorm,
+bool companion<_Scalar,_Deg>::balanced( Scalar colNorm, Scalar rowNorm,
bool& isBalanced, Scalar& colB, Scalar& rowB )
{
if( Scalar(0) == colNorm || Scalar(0) == rowNorm ){ return true; }
@@ -161,22 +163,22 @@ bool ei_companion<_Scalar,_Deg>::balanced( Scalar colNorm, Scalar rowNorm,
// \f$ 2^{2\sigma-1} < rowNorm / colNorm \le 2^{2\sigma+1} \f$
// then the balancing coefficient for the row is \f$ 1/2^{\sigma} \f$
// and the balancing coefficient for the column is \f$ 2^{\sigma} \f$
- rowB = rowNorm / ei_radix<Scalar>();
+ rowB = rowNorm / radix<Scalar>();
colB = Scalar(1);
const Scalar s = colNorm + rowNorm;
while (colNorm < rowB)
{
- colB *= ei_radix<Scalar>();
- colNorm *= ei_radix2<Scalar>();
+ colB *= radix<Scalar>();
+ colNorm *= radix2<Scalar>();
}
- rowB = rowNorm * ei_radix<Scalar>();
+ rowB = rowNorm * radix<Scalar>();
while (colNorm >= rowB)
{
- colB /= ei_radix<Scalar>();
- colNorm /= ei_radix2<Scalar>();
+ colB /= radix<Scalar>();
+ colNorm /= radix2<Scalar>();
}
//This line is used to avoid insubstantial balancing
@@ -193,7 +195,7 @@ bool ei_companion<_Scalar,_Deg>::balanced( Scalar colNorm, Scalar rowNorm,
template< typename _Scalar, int _Deg >
inline
-bool ei_companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
+bool companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
bool& isBalanced, Scalar& colB, Scalar& rowB )
{
if( Scalar(0) == colNorm || Scalar(0) == rowNorm ){ return true; }
@@ -204,9 +206,9 @@ bool ei_companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
* of the row and column norm
*/
const _Scalar q = colNorm/rowNorm;
- if( !ei_isApprox( q, _Scalar(1) ) )
+ if( !isApprox( q, _Scalar(1) ) )
{
- rowB = ei_sqrt( colNorm/rowNorm );
+ rowB = sqrt( colNorm/rowNorm );
colB = Scalar(1)/rowB;
isBalanced = false;
@@ -219,7 +221,7 @@ bool ei_companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
template< typename _Scalar, int _Deg >
-void ei_companion<_Scalar,_Deg>::balance()
+void companion<_Scalar,_Deg>::balance()
{
EIGEN_STATIC_ASSERT( Deg == Dynamic || 1 < Deg, YOU_MADE_A_PROGRAMMING_MISTAKE );
const Index deg = m_monic.size();
@@ -234,8 +236,8 @@ void ei_companion<_Scalar,_Deg>::balance()
//First row, first column excluding the diagonal
//==============================================
- colNorm = ei_abs(m_bl_diag[0]);
- rowNorm = ei_abs(m_monic[0]);
+ colNorm = abs(m_bl_diag[0]);
+ rowNorm = abs(m_monic[0]);
//Compute balancing of the row and the column
if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
@@ -249,10 +251,10 @@ void ei_companion<_Scalar,_Deg>::balance()
for( Index i=1; i<deg_1; ++i )
{
// column norm, excluding the diagonal
- colNorm = ei_abs(m_bl_diag[i]);
+ colNorm = abs(m_bl_diag[i]);
// row norm, excluding the diagonal
- rowNorm = ei_abs(m_bl_diag[i-1]) + ei_abs(m_monic[i]);
+ rowNorm = abs(m_bl_diag[i-1]) + abs(m_monic[i]);
//Compute balancing of the row and the column
if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
@@ -268,7 +270,7 @@ void ei_companion<_Scalar,_Deg>::balance()
const Index ebl = m_bl_diag.size()-1;
VectorBlock<RightColumn,Deg_1> headMonic( m_monic, 0, deg_1 );
colNorm = headMonic.array().abs().sum();
- rowNorm = ei_abs( m_bl_diag[ebl] );
+ rowNorm = abs( m_bl_diag[ebl] );
//Compute balancing of the row and the column
if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
@@ -279,5 +281,6 @@ void ei_companion<_Scalar,_Deg>::balance()
}
}
+} // end namespace internal
#endif // EIGEN_COMPANION_H
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
index ba14b5911..417b93df2 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
@@ -85,7 +85,7 @@ class PolynomialSolverBase
bi_seq.clear();
for(Index i=0; i<m_roots.size(); ++i )
{
- if( ei_abs( m_roots[i].imag() ) < absImaginaryThreshold ){
+ if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold ){
bi_seq.push_back( m_roots[i].real() ); }
}
}
@@ -95,10 +95,10 @@ class PolynomialSolverBase
inline const RootType& selectComplexRoot_withRespectToNorm( squaredNormBinaryPredicate& pred ) const
{
Index res=0;
- RealScalar norm2 = ei_abs2( m_roots[0] );
+ RealScalar norm2 = internal::abs2( m_roots[0] );
for( Index i=1; i<m_roots.size(); ++i )
{
- const RealScalar currNorm2 = ei_abs2( m_roots[i] );
+ const RealScalar currNorm2 = internal::abs2( m_roots[i] );
if( pred( currNorm2, norm2 ) ){
res=i; norm2=currNorm2; }
}
@@ -137,7 +137,7 @@ class PolynomialSolverBase
for( Index i=0; i<m_roots.size(); ++i )
{
- if( ei_abs( m_roots[i].imag() ) < absImaginaryThreshold )
+ if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold )
{
if( !hasArealRoot )
{
@@ -157,11 +157,11 @@ class PolynomialSolverBase
}
else
{
- if( ei_abs( m_roots[i].imag() ) < ei_abs( m_roots[res].imag() ) ){
+ if( internal::abs( m_roots[i].imag() ) < internal::abs( m_roots[res].imag() ) ){
res = i; }
}
}
- return ei_real_ref(m_roots[res]);
+ return internal::real_ref(m_roots[res]);
}
@@ -177,7 +177,7 @@ class PolynomialSolverBase
for( Index i=0; i<m_roots.size(); ++i )
{
- if( ei_abs( m_roots[i].imag() ) < absImaginaryThreshold )
+ if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold )
{
if( !hasArealRoot )
{
@@ -197,11 +197,11 @@ class PolynomialSolverBase
}
else
{
- if( ei_abs( m_roots[i].imag() ) < ei_abs( m_roots[res].imag() ) ){
+ if( internal::abs( m_roots[i].imag() ) < internal::abs( m_roots[res].imag() ) ){
res = i; }
}
}
- return ei_real_ref(m_roots[res]);
+ return internal::real_ref(m_roots[res]);
}
public:
@@ -355,7 +355,7 @@ class PolynomialSolver : public PolynomialSolverBase<_Scalar,_Deg>
void compute( const OtherPolynomial& poly )
{
assert( Scalar(0) != poly[poly.size()-1] );
- ei_companion<Scalar,_Deg> companion( poly );
+ internal::companion<Scalar,_Deg> companion( poly );
companion.balance();
m_eigenSolver.compute( companion.denseMatrix() );
m_roots = m_eigenSolver.eigenvalues();
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
index d10b8f4dc..65942c52a 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
@@ -60,7 +60,7 @@ T poly_eval( const Polynomials& poly, const T& x )
{
typedef typename NumTraits<T>::Real Real;
- if( ei_abs2( x ) <= Real(1) ){
+ if( internal::abs2( x ) <= Real(1) ){
return poly_eval_horner( poly, x ); }
else
{
@@ -95,7 +95,7 @@ typename NumTraits<typename Polynomial::Scalar>::Real cauchy_max_bound( const Po
Real cb(0);
for( DenseIndex i=0; i<poly.size()-1; ++i ){
- cb += ei_abs(poly[i]*inv_leading_coeff); }
+ cb += internal::abs(poly[i]*inv_leading_coeff); }
return cb + Real(1);
}
@@ -120,7 +120,7 @@ typename NumTraits<typename Polynomial::Scalar>::Real cauchy_min_bound( const Po
const Scalar inv_min_coeff = Scalar(1)/poly[i];
Real cb(1);
for( DenseIndex j=i+1; j<poly.size(); ++j ){
- cb += ei_abs(poly[j]*inv_min_coeff); }
+ cb += internal::abs(poly[j]*inv_min_coeff); }
return Real(1)/cb;
}
diff --git a/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h b/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
index fa8f81908..51537402e 100644
--- a/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
+++ b/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
@@ -134,8 +134,8 @@ void SkylineInplaceLU<MatrixType>::compute() {
const size_t rows = m_lu.rows();
const size_t cols = m_lu.cols();
- ei_assert(rows == cols && "We do not (yet) support rectangular LU.");
- ei_assert(!m_lu.IsRowMajor && "LU decomposition does not work with rowMajor Storage");
+ eigen_assert(rows == cols && "We do not (yet) support rectangular LU.");
+ eigen_assert(!m_lu.IsRowMajor && "LU decomposition does not work with rowMajor Storage");
for (Index row = 0; row < rows; row++) {
const double pivot = m_lu.coeffDiag(row);
@@ -198,8 +198,8 @@ void SkylineInplaceLU<MatrixType>::computeRowMajor() {
const size_t rows = m_lu.rows();
const size_t cols = m_lu.cols();
- ei_assert(rows == cols && "We do not (yet) support rectangular LU.");
- ei_assert(m_lu.IsRowMajor && "You're trying to apply rowMajor decomposition on a ColMajor matrix !");
+ eigen_assert(rows == cols && "We do not (yet) support rectangular LU.");
+ eigen_assert(m_lu.IsRowMajor && "You're trying to apply rowMajor decomposition on a ColMajor matrix !");
for (Index row = 0; row < rows; row++) {
typename MatrixType::InnerLowerIterator llIt(m_lu, row);
diff --git a/unsupported/Eigen/src/Skyline/SkylineMatrix.h b/unsupported/Eigen/src/Skyline/SkylineMatrix.h
index 20fafafa8..31810df08 100644
--- a/unsupported/Eigen/src/Skyline/SkylineMatrix.h
+++ b/unsupported/Eigen/src/Skyline/SkylineMatrix.h
@@ -43,8 +43,9 @@
*
*
*/
+namespace internal {
template<typename _Scalar, int _Options>
-struct ei_traits<SkylineMatrix<_Scalar, _Options> > {
+struct traits<SkylineMatrix<_Scalar, _Options> > {
typedef _Scalar Scalar;
typedef Sparse StorageKind;
@@ -57,6 +58,7 @@ struct ei_traits<SkylineMatrix<_Scalar, _Options> > {
CoeffReadCost = NumTraits<Scalar>::ReadCost,
};
};
+}
template<typename _Scalar, int _Options>
class SkylineMatrix
@@ -158,8 +160,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
if (outer == inner)
return this->m_data.diag(outer);
@@ -207,8 +209,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
if (outer == inner)
return this->m_data.diag(outer);
@@ -217,34 +219,34 @@ public:
if (col > row) //upper matrix
{
const Index minOuterIndex = inner - m_data.upperProfile(inner);
- ei_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + outer - (inner - m_data.upperProfile(inner)));
}
if (col < row) //lower matrix
{
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
- ei_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + inner - (outer - m_data.lowerProfile(outer)));
}
} else {
if (outer > inner) //upper matrix
{
const Index maxOuterIndex = inner + m_data.upperProfile(inner);
- ei_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + (outer - inner));
}
if (outer < inner) //lower matrix
{
const Index maxInnerIndex = outer + m_data.lowerProfile(outer);
- ei_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + (inner - outer));
}
}
}
inline Scalar coeffDiag(Index idx) const {
- ei_assert(idx < outerSize());
- ei_assert(idx < innerSize());
+ eigen_assert(idx < outerSize());
+ eigen_assert(idx < innerSize());
return this->m_data.diag(idx);
}
@@ -252,9 +254,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
@@ -276,9 +278,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
@@ -296,8 +298,8 @@ public:
}
inline Scalar& coeffRefDiag(Index idx) {
- ei_assert(idx < outerSize());
- ei_assert(idx < innerSize());
+ eigen_assert(idx < outerSize());
+ eigen_assert(idx < innerSize());
return this->m_data.diag(idx);
}
@@ -305,17 +307,17 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
- ei_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + inner - (outer - m_data.lowerProfile(outer)));
} else {
const Index maxInnerIndex = outer + m_data.lowerProfile(outer);
- ei_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + (inner - outer));
}
}
@@ -324,9 +326,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
@@ -341,17 +343,17 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
- ei_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + outer - (inner - m_data.upperProfile(inner)));
} else {
const Index maxOuterIndex = inner + m_data.upperProfile(inner);
- ei_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
+ eigen_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + (outer - inner));
}
}
@@ -360,9 +362,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
- ei_assert(inner != outer);
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
+ eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
@@ -412,8 +414,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
- ei_assert(outer < outerSize());
- ei_assert(inner < innerSize());
+ eigen_assert(outer < outerSize());
+ eigen_assert(inner < innerSize());
if (outer == inner)
return m_data.diag(col);
@@ -549,7 +551,7 @@ public:
else
m_data.resize(rows(), cols(), rows(), m_colStartIndex[cols()] + 1, m_rowStartIndex[rows()] + 1);
- // ei_assert(rows() == cols() && "memory reorganisatrion only works with suare matrix");
+ // eigen_assert(rows() == cols() && "memory reorganisatrion only works with suare matrix");
//
// Scalar* newArray = new Scalar[m_colStartIndex[cols()] + 1 + m_rowStartIndex[rows()] + 1];
// Index dataIdx = 0;
@@ -601,7 +603,7 @@ public:
const Index diagSize = rows > cols ? cols : rows;
m_innerSize = IsRowMajor ? cols : rows;
- ei_assert(rows == cols && "Skyline matrix must be square matrix");
+ eigen_assert(rows == cols && "Skyline matrix must be square matrix");
if (diagSize % 2) { // diagSize is odd
const Index k = (diagSize - 1) / 2;
diff --git a/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h b/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
index 5f577de3d..4d0c2397c 100644
--- a/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
+++ b/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
@@ -39,26 +39,26 @@
template<typename Derived> class SkylineMatrixBase : public EigenBase<Derived> {
public:
- typedef typename ei_traits<Derived>::Scalar Scalar;
- typedef typename ei_traits<Derived>::StorageKind StorageKind;
- typedef typename ei_index<StorageKind>::type Index;
+ typedef typename internal::traits<Derived>::Scalar Scalar;
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
+ typedef typename internal::index<StorageKind>::type Index;
enum {
- RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
+ RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
/**< The number of rows at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
- ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
+ ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
/**< The number of columns at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
- SizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::RowsAtCompileTime,
- ei_traits<Derived>::ColsAtCompileTime>::ret),
+ SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
+ internal::traits<Derived>::ColsAtCompileTime>::ret),
/**< This is equal to the number of coefficients, i.e. the number of
* rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
@@ -66,7 +66,7 @@ public:
MaxRowsAtCompileTime = RowsAtCompileTime,
MaxColsAtCompileTime = ColsAtCompileTime,
- MaxSizeAtCompileTime = (ei_size_at_compile_time<MaxRowsAtCompileTime,
+ MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
MaxColsAtCompileTime>::ret),
IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
@@ -75,12 +75,12 @@ public:
* we are dealing with a column-vector (if there is only one column) or with
* a row-vector (if there is only one row). */
- Flags = ei_traits<Derived>::Flags,
+ Flags = internal::traits<Derived>::Flags,
/**< This stores expression \ref flags flags which may or may not be inherited by new expressions
* constructed from this one. See the \ref flags "list of flags".
*/
- CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
+ CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
/**< This is a rough measure of how expensive it is to read one coefficient from
* this expression.
*/
@@ -212,8 +212,8 @@ public:
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy.
*/
- EIGEN_STRONG_INLINE const typename ei_eval<Derived, IsSkyline>::type eval() const {
- return typename ei_eval<Derived>::type(derived());
+ EIGEN_STRONG_INLINE const typename internal::eval<Derived, IsSkyline>::type eval() const {
+ return typename internal::eval<Derived>::type(derived());
}
protected:
diff --git a/unsupported/Eigen/src/Skyline/SkylineProduct.h b/unsupported/Eigen/src/Skyline/SkylineProduct.h
index aabd07241..aeedc47ec 100644
--- a/unsupported/Eigen/src/Skyline/SkylineProduct.h
+++ b/unsupported/Eigen/src/Skyline/SkylineProduct.h
@@ -27,17 +27,17 @@
template<typename Lhs, typename Rhs, int ProductMode>
struct SkylineProductReturnType {
- typedef const typename ei_nested<Lhs, Rhs::RowsAtCompileTime>::type LhsNested;
- typedef const typename ei_nested<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
+ typedef const typename internal::nested<Lhs, Rhs::RowsAtCompileTime>::type LhsNested;
+ typedef const typename internal::nested<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
typedef SkylineProduct<LhsNested, RhsNested, ProductMode> Type;
};
template<typename LhsNested, typename RhsNested, int ProductMode>
-struct ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
+struct internal::traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
// clean the nested types:
- typedef typename ei_cleantype<LhsNested>::type _LhsNested;
- typedef typename ei_cleantype<RhsNested>::type _RhsNested;
+ typedef typename internal::remove_all<LhsNested>::type _LhsNested;
+ typedef typename internal::remove_all<RhsNested>::type _RhsNested;
typedef typename _LhsNested::Scalar Scalar;
enum {
@@ -65,29 +65,30 @@ struct ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
CoeffReadCost = Dynamic
};
- typedef typename ei_meta_if<ResultIsSkyline,
+ typedef typename internal::conditional<ResultIsSkyline,
SkylineMatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> >,
- MatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> > >::ret Base;
+ MatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> > >::type Base;
};
+namespace internal {
template<typename LhsNested, typename RhsNested, int ProductMode>
-class SkylineProduct : ei_no_assignment_operator,
-public ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> >::Base {
+class SkylineProduct : no_assignment_operator,
+public traits<SkylineProduct<LhsNested, RhsNested, ProductMode> >::Base {
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(SkylineProduct)
private:
- typedef typename ei_traits<SkylineProduct>::_LhsNested _LhsNested;
- typedef typename ei_traits<SkylineProduct>::_RhsNested _RhsNested;
+ typedef typename traits<SkylineProduct>::_LhsNested _LhsNested;
+ typedef typename traits<SkylineProduct>::_RhsNested _RhsNested;
public:
template<typename Lhs, typename Rhs>
EIGEN_STRONG_INLINE SkylineProduct(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs) {
- ei_assert(lhs.cols() == rhs.rows());
+ eigen_assert(lhs.cols() == rhs.rows());
enum {
ProductIsValid = _LhsNested::ColsAtCompileTime == Dynamic
@@ -131,10 +132,10 @@ protected:
// Note that here we force no inlining and separate the setZero() because GCC messes up otherwise
template<typename Lhs, typename Rhs, typename Dest>
-EIGEN_DONT_INLINE void ei_skyline_row_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
- typedef typename ei_traits<Lhs>::Scalar Scalar;
+EIGEN_DONT_INLINE void skyline_row_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
+ typedef typename remove_all<Lhs>::type _Lhs;
+ typedef typename remove_all<Rhs>::type _Rhs;
+ typedef typename traits<Lhs>::Scalar Scalar;
enum {
LhsIsRowMajor = (_Lhs::Flags & RowMajorBit) == RowMajorBit,
@@ -194,10 +195,10 @@ EIGEN_DONT_INLINE void ei_skyline_row_major_time_dense_product(const Lhs& lhs, c
}
template<typename Lhs, typename Rhs, typename Dest>
-EIGEN_DONT_INLINE void ei_skyline_col_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
- typedef typename ei_cleantype<Lhs>::type _Lhs;
- typedef typename ei_cleantype<Rhs>::type _Rhs;
- typedef typename ei_traits<Lhs>::Scalar Scalar;
+EIGEN_DONT_INLINE void skyline_col_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
+ typedef typename remove_all<Lhs>::type _Lhs;
+ typedef typename remove_all<Rhs>::type _Rhs;
+ typedef typename traits<Lhs>::Scalar Scalar;
enum {
LhsIsRowMajor = (_Lhs::Flags & RowMajorBit) == RowMajorBit,
@@ -258,33 +259,35 @@ EIGEN_DONT_INLINE void ei_skyline_col_major_time_dense_product(const Lhs& lhs, c
}
template<typename Lhs, typename Rhs, typename ResultType,
- int LhsStorageOrder = ei_traits<Lhs>::Flags&RowMajorBit>
- struct ei_skyline_product_selector;
+ int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit>
+ struct skyline_product_selector;
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_skyline_product_selector<Lhs, Rhs, ResultType, RowMajor> {
- typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
+struct skyline_product_selector<Lhs, Rhs, ResultType, RowMajor> {
+ typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType & res) {
- ei_skyline_row_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
+ skyline_row_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
}
};
template<typename Lhs, typename Rhs, typename ResultType>
-struct ei_skyline_product_selector<Lhs, Rhs, ResultType, ColMajor> {
- typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
+struct skyline_product_selector<Lhs, Rhs, ResultType, ColMajor> {
+ typedef typename traits<typename remove_all<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType & res) {
- ei_skyline_col_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
+ skyline_col_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
}
};
+} // end namespace internal
+
// template<typename Derived>
// template<typename Lhs, typename Rhs >
// Derived & MatrixBase<Derived>::lazyAssign(const SkylineProduct<Lhs, Rhs, SkylineTimeDenseProduct>& product) {
-// typedef typename ei_cleantype<Lhs>::type _Lhs;
-// ei_skyline_product_selector<typename ei_cleantype<Lhs>::type,
-// typename ei_cleantype<Rhs>::type,
+// typedef typename internal::remove_all<Lhs>::type _Lhs;
+// internal::skyline_product_selector<typename internal::remove_all<Lhs>::type,
+// typename internal::remove_all<Rhs>::type,
// Derived>::run(product.lhs(), product.rhs(), derived());
//
// return derived();
diff --git a/unsupported/Eigen/src/Skyline/SkylineUtil.h b/unsupported/Eigen/src/Skyline/SkylineUtil.h
index 7781c33e7..e0512476f 100644
--- a/unsupported/Eigen/src/Skyline/SkylineUtil.h
+++ b/unsupported/Eigen/src/Skyline/SkylineUtil.h
@@ -64,11 +64,11 @@ EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
#define _EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \
typedef BaseClass Base; \
- typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
+ typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
- typedef typename Eigen::ei_traits<Derived>::StorageKind StorageKind; \
- typedef typename Eigen::ei_index<StorageKind>::type Index; \
- enum { Flags = Eigen::ei_traits<Derived>::Flags, };
+ typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
+ typedef typename Eigen::internal::index<StorageKind>::type Index; \
+ enum { Flags = Eigen::internal::traits<Derived>::Flags, };
#define EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived) \
_EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived, Eigen::SkylineMatrixBase<Derived>)
@@ -79,20 +79,23 @@ template<typename _Scalar, int _Flags = 0> class DynamicSkylineMatrix;
template<typename _Scalar, int _Flags = 0> class SkylineVector;
template<typename _Scalar, int _Flags = 0> class MappedSkylineMatrix;
-template<typename Lhs, typename Rhs> struct ei_skyline_product_mode;
-template<typename Lhs, typename Rhs, int ProductMode = ei_skyline_product_mode<Lhs,Rhs>::value> struct SkylineProductReturnType;
+namespace internal {
+template<typename Lhs, typename Rhs> struct skyline_product_mode;
+template<typename Lhs, typename Rhs, int ProductMode = skyline_product_mode<Lhs,Rhs>::value> struct SkylineProductReturnType;
-template<typename T> class ei_eval<T,IsSkyline>
+template<typename T> class eval<T,IsSkyline>
{
- typedef typename ei_traits<T>::Scalar _Scalar;
+ typedef typename traits<T>::Scalar _Scalar;
enum {
- _Flags = ei_traits<T>::Flags
+ _Flags = traits<T>::Flags
};
public:
typedef SkylineMatrix<_Scalar, _Flags> type;
};
+} // end namespace internal
+
#endif // EIGEN_SKYLINEUTIL_H
diff --git a/unsupported/Eigen/src/SparseExtra/CholmodSupport.h b/unsupported/Eigen/src/SparseExtra/CholmodSupport.h
index 8b500062b..b0f1c8e42 100644
--- a/unsupported/Eigen/src/SparseExtra/CholmodSupport.h
+++ b/unsupported/Eigen/src/SparseExtra/CholmodSupport.h
@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
-// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -25,40 +25,96 @@
#ifndef EIGEN_CHOLMODSUPPORT_H
#define EIGEN_CHOLMODSUPPORT_H
+namespace internal {
+
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval_base;
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval;
+
+template<typename DecompositionType, typename Rhs>
+struct traits<sparse_solve_retval_base<DecompositionType, Rhs> >
+{
+ typedef typename DecompositionType::MatrixType MatrixType;
+ typedef SparseMatrix<typename Rhs::Scalar, Rhs::Options, typename Rhs::Index> ReturnType;
+};
+
+template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval_base
+ : public ReturnByValue<sparse_solve_retval_base<_DecompositionType, Rhs> >
+{
+ typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
+ typedef _DecompositionType DecompositionType;
+ typedef ReturnByValue<sparse_solve_retval_base> Base;
+ typedef typename Base::Index Index;
+
+ sparse_solve_retval_base(const DecompositionType& dec, const Rhs& rhs)
+ : m_dec(dec), m_rhs(rhs)
+ {}
+
+ inline Index rows() const { return m_dec.cols(); }
+ inline Index cols() const { return m_rhs.cols(); }
+ inline const DecompositionType& dec() const { return m_dec; }
+ inline const RhsNestedCleaned& rhs() const { return m_rhs; }
+
+ template<typename Dest> inline void evalTo(Dest& dst) const
+ {
+ static_cast<const sparse_solve_retval<DecompositionType,Rhs>*>(this)->evalTo(dst);
+ }
+
+ protected:
+ const DecompositionType& m_dec;
+ const typename Rhs::Nested m_rhs;
+};
+
+#define EIGEN_MAKE_SPARSE_SOLVE_HELPERS(DecompositionType,Rhs) \
+ typedef typename DecompositionType::MatrixType MatrixType; \
+ typedef typename MatrixType::Scalar Scalar; \
+ typedef typename MatrixType::RealScalar RealScalar; \
+ typedef typename MatrixType::Index Index; \
+ typedef Eigen::internal::sparse_solve_retval_base<DecompositionType,Rhs> Base; \
+ using Base::dec; \
+ using Base::rhs; \
+ using Base::rows; \
+ using Base::cols; \
+ sparse_solve_retval(const DecompositionType& dec, const Rhs& rhs) \
+ : Base(dec, rhs) {}
template<typename Scalar, typename CholmodType>
-void ei_cholmod_configure_matrix(CholmodType& mat)
+void cholmod_configure_matrix(CholmodType& mat)
{
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
{
mat.xtype = CHOLMOD_REAL;
mat.dtype = CHOLMOD_SINGLE;
}
- else if (ei_is_same_type<Scalar,double>::ret)
+ else if (internal::is_same<Scalar,double>::value)
{
mat.xtype = CHOLMOD_REAL;
mat.dtype = CHOLMOD_DOUBLE;
}
- else if (ei_is_same_type<Scalar,std::complex<float> >::ret)
+ else if (internal::is_same<Scalar,std::complex<float> >::value)
{
mat.xtype = CHOLMOD_COMPLEX;
mat.dtype = CHOLMOD_SINGLE;
}
- else if (ei_is_same_type<Scalar,std::complex<double> >::ret)
+ else if (internal::is_same<Scalar,std::complex<double> >::value)
{
mat.xtype = CHOLMOD_COMPLEX;
mat.dtype = CHOLMOD_DOUBLE;
}
else
{
- ei_assert(false && "Scalar type not supported by CHOLMOD");
+ eigen_assert(false && "Scalar type not supported by CHOLMOD");
}
}
-template<typename _MatrixType>
-cholmod_sparse ei_cholmod_map_eigen_to_sparse(_MatrixType& mat)
+} // namespace internal
+
+/** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object.
+ * Note that the data are shared.
+ */
+template<typename _Scalar, int _Options, typename _Index>
+cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat)
{
- typedef typename _MatrixType::Scalar Scalar;
+ typedef SparseMatrix<_Scalar,_Options,_Index> MatrixType;
cholmod_sparse res;
res.nzmax = mat.nonZeros();
res.nrow = mat.rows();;
@@ -66,35 +122,54 @@ cholmod_sparse ei_cholmod_map_eigen_to_sparse(_MatrixType& mat)
res.p = mat._outerIndexPtr();
res.i = mat._innerIndexPtr();
res.x = mat._valuePtr();
- res.xtype = CHOLMOD_REAL;
- res.itype = CHOLMOD_INT;
res.sorted = 1;
res.packed = 1;
res.dtype = 0;
res.stype = -1;
-
- ei_cholmod_configure_matrix<Scalar>(res);
-
-
- if (_MatrixType::Flags & SelfAdjoint)
+
+ if (internal::is_same<_Index,int>::value)
{
- if (_MatrixType::Flags & Upper)
- res.stype = 1;
- else if (_MatrixType::Flags & Lower)
- res.stype = -1;
- else
- res.stype = 0;
+ res.itype = CHOLMOD_INT;
}
else
- res.stype = -1; // by default we consider the lower part
+ {
+ eigen_assert(false && "Index type different than int is not supported yet");
+ }
+ // setup res.xtype
+ internal::cholmod_configure_matrix<_Scalar>(res);
+
+ res.stype = 0;
+
return res;
}
+template<typename _Scalar, int _Options, typename _Index>
+const cholmod_sparse viewAsCholmod(const SparseMatrix<_Scalar,_Options,_Index>& mat)
+{
+ cholmod_sparse res = viewAsCholmod(mat.const_cast_derived());
+ return res;
+}
+
+/** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix.
+ * The data are not copied but shared. */
+template<typename _Scalar, int _Options, typename _Index, unsigned int UpLo>
+cholmod_sparse viewAsCholmod(const SparseSelfAdjointView<SparseMatrix<_Scalar,_Options,_Index>, UpLo>& mat)
+{
+ cholmod_sparse res = viewAsCholmod(mat.matrix().const_cast_derived());
+
+ if(UpLo==Upper) res.stype = 1;
+ if(UpLo==Lower) res.stype = -1;
+
+ return res;
+}
+
+/** Returns a view of the Eigen \b dense matrix \a mat as Cholmod dense matrix.
+ * The data are not copied but shared. */
template<typename Derived>
-cholmod_dense ei_cholmod_map_eigen_to_dense(MatrixBase<Derived>& mat)
+cholmod_dense viewAsCholmod(MatrixBase<Derived>& mat)
{
- EIGEN_STATIC_ASSERT((ei_traits<Derived>::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+ EIGEN_STATIC_ASSERT((internal::traits<Derived>::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
typedef typename Derived::Scalar Scalar;
cholmod_dense res;
@@ -105,412 +180,265 @@ cholmod_dense ei_cholmod_map_eigen_to_dense(MatrixBase<Derived>& mat)
res.x = mat.derived().data();
res.z = 0;
- ei_cholmod_configure_matrix<Scalar>(res);
+ internal::cholmod_configure_matrix<Scalar>(res);
return res;
}
+/** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix.
+ * The data are not copied but shared. */
template<typename Scalar, int Flags, typename Index>
-MappedSparseMatrix<Scalar,Flags,Index> ei_map_cholmod_sparse_to_eigen(cholmod_sparse& cm)
+MappedSparseMatrix<Scalar,Flags,Index> viewAsEigen(cholmod_sparse& cm)
{
return MappedSparseMatrix<Scalar,Flags,Index>
(cm.nrow, cm.ncol, reinterpret_cast<Index*>(cm.p)[cm.ncol],
reinterpret_cast<Index*>(cm.p), reinterpret_cast<Index*>(cm.i),reinterpret_cast<Scalar*>(cm.x) );
}
+enum CholmodMode {
+ CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt
+};
-
-template<typename _MatrixType>
-class SparseLLT<_MatrixType, Cholmod> : public SparseLLT<_MatrixType>
+/** \brief A Cholesky factorization and solver based on Cholmod
+ *
+ * This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization
+ * using the Cholmod library. The sparse matrix A must be selfajoint and positive definite. The vectors or matrices
+ * X and B can be either dense or sparse.
+ *
+ * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
+ * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
+ * or Upper. Default is Lower.
+ *
+ */
+template<typename _MatrixType, int _UpLo = Lower>
+class CholmodDecomposition
{
- protected:
- typedef SparseLLT<_MatrixType> Base;
- typedef typename Base::Scalar Scalar;
- typedef typename Base::RealScalar RealScalar;
- typedef typename Base::CholMatrixType CholMatrixType;
- using Base::MatrixLIsDirty;
- using Base::SupernodalFactorIsDirty;
- using Base::m_flags;
- using Base::m_matrix;
- using Base::m_status;
-
public:
typedef _MatrixType MatrixType;
+ enum { UpLo = _UpLo };
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::RealScalar RealScalar;
+ typedef MatrixType CholMatrixType;
typedef typename MatrixType::Index Index;
- SparseLLT(int flags = 0)
- : Base(flags), m_cholmodFactor(0)
+ public:
+
+ CholmodDecomposition()
+ : m_cholmodFactor(0), m_info(Success), m_isInitialized(false)
{
cholmod_start(&m_cholmod);
}
- SparseLLT(const MatrixType& matrix, int flags = 0)
- : Base(flags), m_cholmodFactor(0)
+ CholmodDecomposition(const MatrixType& matrix)
+ : m_cholmodFactor(0), m_info(Success), m_isInitialized(false)
{
cholmod_start(&m_cholmod);
compute(matrix);
}
- ~SparseLLT()
+ ~CholmodDecomposition()
{
- if (m_cholmodFactor)
+ if(m_cholmodFactor)
cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
cholmod_finish(&m_cholmod);
}
+
+ int cols() const { return m_cholmodFactor->n; }
+ int rows() const { return m_cholmodFactor->n; }
+
+ void setMode(CholmodMode mode)
+ {
+ switch(mode)
+ {
+ case CholmodAuto:
+ m_cholmod.final_asis = 1;
+ m_cholmod.supernodal = CHOLMOD_AUTO;
+ break;
+ case CholmodSimplicialLLt:
+ m_cholmod.final_asis = 0;
+ m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+ m_cholmod.final_ll = 1;
+ break;
+ case CholmodSupernodalLLt:
+ m_cholmod.final_asis = 1;
+ m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
+ break;
+ case CholmodLDLt:
+ m_cholmod.final_asis = 1;
+ m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /** \brief Reports whether previous computation was successful.
+ *
+ * \returns \c Success if computation was succesful,
+ * \c NumericalIssue if the matrix.appears to be negative.
+ */
+ ComputationInfo info() const
+ {
+ eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+ return m_info;
+ }
- inline const CholMatrixType& matrixL() const;
-
- template<typename Derived>
- bool solveInPlace(MatrixBase<Derived> &b) const;
-
+ /** Computes the sparse Cholesky decomposition of \a matrix */
+ void compute(const MatrixType& matrix)
+ {
+ analyzePattern(matrix);
+ factorize(matrix);
+ }
+
+ /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+ *
+ * \sa compute()
+ */
template<typename Rhs>
- inline const ei_solve_retval<SparseLLT<MatrixType, Cholmod>, Rhs>
+ inline const internal::solve_retval<CholmodDecomposition, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(true && "SparseLLT is not initialized.");
- return ei_solve_retval<SparseLLT<MatrixType, Cholmod>, Rhs>(*this, b.derived());
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(rows()==b.rows()
+ && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b");
+ return internal::solve_retval<CholmodDecomposition, Rhs>(*this, b.derived());
}
-
- void compute(const MatrixType& matrix);
-
- inline Index cols() const { return m_matrix.cols(); }
- inline Index rows() const { return m_matrix.rows(); }
-
- inline const cholmod_factor* cholmodFactor() const
- { return m_cholmodFactor; }
-
- inline cholmod_common* cholmodCommon() const
- { return &m_cholmod; }
-
- bool succeeded() const;
-
- protected:
- mutable cholmod_common m_cholmod;
- cholmod_factor* m_cholmodFactor;
-};
-
-
-
-template<typename _MatrixType, typename Rhs>
- struct ei_solve_retval<SparseLLT<_MatrixType, Cholmod>, Rhs>
- : ei_solve_retval_base<SparseLLT<_MatrixType, Cholmod>, Rhs>
-{
- typedef SparseLLT<_MatrixType, Cholmod> SpLLTDecType;
- EIGEN_MAKE_SOLVE_HELPERS(SpLLTDecType,Rhs)
-
- template<typename Dest> void evalTo(Dest& dst) const
- {
- //Index size = dec().cholmodFactor()->n;
- ei_assert((Index)dec().cholmodFactor()->n==rhs().rows());
- cholmod_factor* cholmodFactor = const_cast<cholmod_factor*>(dec().cholmodFactor());
- cholmod_common* cholmodCommon = const_cast<cholmod_common*>(dec().cholmodCommon());
- // this uses Eigen's triangular sparse solver
- // if (m_status & MatrixLIsDirty)
- // matrixL();
- // Base::solveInPlace(b);
- // as long as our own triangular sparse solver is not fully optimal,
- // let's use CHOLMOD's one:
- cholmod_dense cdb = ei_cholmod_map_eigen_to_dense(rhs().const_cast_derived());
- cholmod_dense* x = cholmod_solve(CHOLMOD_A, cholmodFactor, &cdb, cholmodCommon);
-
- dst = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x), rhs().rows());
-
- cholmod_free_dense(&x, cholmodCommon);
-
- }
+ /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
+ *
+ * \sa compute()
+ */
+ template<typename Rhs>
+ inline const internal::sparse_solve_retval<CholmodDecomposition, Rhs>
+ solve(const SparseMatrixBase<Rhs>& b) const
+ {
+ eigen_assert(m_isInitialized && "LLT is not initialized.");
+ eigen_assert(rows()==b.rows()
+ && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b");
+ return internal::sparse_solve_retval<CholmodDecomposition, Rhs>(*this, b.derived());
+ }
-};
-
-
-
-
-
-template<typename _MatrixType>
-void SparseLLT<_MatrixType,Cholmod>::compute(const _MatrixType& a)
-{
- if (m_cholmodFactor)
- {
- cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
- m_cholmodFactor = 0;
- }
-
- cholmod_sparse A = ei_cholmod_map_eigen_to_sparse(const_cast<_MatrixType&>(a));
-// m_cholmod.supernodal = CHOLMOD_AUTO;
- // TODO
-// if (m_flags&IncompleteFactorization)
-// {
-// m_cholmod.nmethods = 1;
-// m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
-// m_cholmod.postorder = 0;
-// }
-// else
-// {
-// m_cholmod.nmethods = 1;
-// m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
-// m_cholmod.postorder = 0;
-// }
-// m_cholmod.final_ll = 1;
- m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
- cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
-
- m_status = (m_status & ~SupernodalFactorIsDirty) | MatrixLIsDirty;
-}
-
-
-// TODO
-template<typename _MatrixType>
-bool SparseLLT<_MatrixType,Cholmod>::succeeded() const
-{ return true; }
-
-
-
-template<typename _MatrixType>
-inline const typename SparseLLT<_MatrixType,Cholmod>::CholMatrixType&
-SparseLLT<_MatrixType,Cholmod>::matrixL() const
-{
- if (m_status & MatrixLIsDirty)
- {
- ei_assert(!(m_status & SupernodalFactorIsDirty));
-
- cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
- const_cast<typename Base::CholMatrixType&>(m_matrix) =
- ei_map_cholmod_sparse_to_eigen<Scalar,ColMajor,Index>(*cmRes);
- free(cmRes);
-
- m_status = (m_status & ~MatrixLIsDirty);
- }
- return m_matrix;
-}
-
-
-
-
-template<typename _MatrixType>
-template<typename Derived>
-bool SparseLLT<_MatrixType,Cholmod>::solveInPlace(MatrixBase<Derived> &b) const
-{
- //Index size = m_cholmodFactor->n;
- ei_assert((Index)m_cholmodFactor->n==b.rows());
-
- // this uses Eigen's triangular sparse solver
- // if (m_status & MatrixLIsDirty)
- // matrixL();
- // Base::solveInPlace(b);
- // as long as our own triangular sparse solver is not fully optimal,
- // let's use CHOLMOD's one:
- cholmod_dense cdb = ei_cholmod_map_eigen_to_dense(b);
-
- cholmod_dense* x = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &cdb, &m_cholmod);
- ei_assert(x && "Eigen: cholmod_solve failed.");
-
- b = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x),b.rows());
- cholmod_free_dense(&x, &m_cholmod);
- return true;
-}
-
-
-
-
-
-
-
-
-
-
-
-template<typename _MatrixType>
-class SparseLDLT<_MatrixType,Cholmod> : public SparseLDLT<_MatrixType>
-{
- protected:
- typedef SparseLDLT<_MatrixType> Base;
- typedef typename Base::Scalar Scalar;
- typedef typename Base::RealScalar RealScalar;
- using Base::MatrixLIsDirty;
- using Base::SupernodalFactorIsDirty;
- using Base::m_flags;
- using Base::m_matrix;
- using Base::m_status;
-
- public:
- typedef _MatrixType MatrixType;
- typedef typename MatrixType::Index Index;
-
- SparseLDLT(int flags = 0)
- : Base(flags), m_cholmodFactor(0)
+ /** Performs a symbolic decomposition on the sparcity of \a matrix.
+ *
+ * This function is particularly useful when solving for several problems having the same structure.
+ *
+ * \sa factorize()
+ */
+ void analyzePattern(const MatrixType& matrix)
{
- cholmod_start(&m_cholmod);
+ if(m_cholmodFactor)
+ {
+ cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+ m_cholmodFactor = 0;
+ }
+ cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());
+ m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
+
+ this->m_isInitialized = true;
+ this->m_info = Success;
+ m_analysisIsOk = true;
+ m_factorizationIsOk = false;
}
-
- SparseLDLT(const _MatrixType& matrix, int flags = 0)
- : Base(flags), m_cholmodFactor(0)
+
+ /** Performs a numeric decomposition of \a matrix
+ *
+ * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
+ *
+ * \sa analyzePattern()
+ */
+ void factorize(const MatrixType& matrix)
{
- cholmod_start(&m_cholmod);
- compute(matrix);
+ eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
+ cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());
+ cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
+
+ this->m_info = Success;
+ m_factorizationIsOk = true;
}
-
- ~SparseLDLT()
+
+ /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations.
+ * See the Cholmod user guide for details. */
+ cholmod_common& cholmod() { return m_cholmod; }
+
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
+ /** \internal */
+ template<typename Rhs,typename Dest>
+ void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
{
- if (m_cholmodFactor)
- cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
- cholmod_finish(&m_cholmod);
+ 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_assert(size==b.rows());
+
+ // note: cd stands for Cholmod Dense
+ cholmod_dense b_cd = viewAsCholmod(b.const_cast_derived());
+ cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod);
+ if(!x_cd)
+ {
+ this->m_info = NumericalIssue;
+ }
+ // TODO optimize this copy by swapping when possible (be carreful with alignment, etc.)
+ dest = Matrix<Scalar,Dest::RowsAtCompileTime,Dest::ColsAtCompileTime>::Map(reinterpret_cast<Scalar*>(x_cd->x),b.rows(),b.cols());
+ cholmod_free_dense(&x_cd, &m_cholmod);
}
-
- inline const typename Base::CholMatrixType& matrixL(void) const;
-
- template<typename Derived>
- void solveInPlace(MatrixBase<Derived> &b) const;
-
- template<typename Rhs>
- inline const ei_solve_retval<SparseLDLT<MatrixType, Cholmod>, Rhs>
- solve(const MatrixBase<Rhs>& b) const
+
+ /** \internal */
+ template<typename RhsScalar, int RhsOptions, typename RhsIndex, typename DestScalar, int DestOptions, typename DestIndex>
+ void _solve(const SparseMatrix<RhsScalar,RhsOptions,RhsIndex> &b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
{
- ei_assert(true && "SparseLDLT is not initialized.");
- return ei_solve_retval<SparseLDLT<MatrixType, Cholmod>, Rhs>(*this, b.derived());
+ 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_assert(size==b.rows());
+
+ // note: cs stands for Cholmod Sparse
+ cholmod_sparse b_cs = viewAsCholmod(b);
+ cholmod_sparse* x_cs = cholmod_spsolve(CHOLMOD_A, m_cholmodFactor, &b_cs, &m_cholmod);
+ if(!x_cs)
+ {
+ this->m_info = NumericalIssue;
+ }
+ // TODO optimize this copy by swapping when possible (be carreful with alignment, etc.)
+ dest = viewAsEigen<DestScalar,DestOptions,DestIndex>(*x_cs);
+ cholmod_free_sparse(&x_cs, &m_cholmod);
}
-
- void compute(const _MatrixType& matrix);
-
- inline Index cols() const { return m_matrix.cols(); }
- inline Index rows() const { return m_matrix.rows(); }
-
- inline const cholmod_factor* cholmodFactor() const
- { return m_cholmodFactor; }
-
- inline cholmod_common* cholmodCommon() const
- { return &m_cholmod; }
-
- bool succeeded() const;
+ #endif // EIGEN_PARSED_BY_DOXYGEN
protected:
mutable cholmod_common m_cholmod;
cholmod_factor* m_cholmodFactor;
+ mutable ComputationInfo m_info;
+ bool m_isInitialized;
+ int m_factorizationIsOk;
+ int m_analysisIsOk;
};
-
-
-
-
-template<typename _MatrixType, typename Rhs>
- struct ei_solve_retval<SparseLDLT<_MatrixType, Cholmod>, Rhs>
- : ei_solve_retval_base<SparseLDLT<_MatrixType, Cholmod>, Rhs>
+namespace internal {
+
+template<typename _MatrixType, int _UpLo, typename Rhs>
+struct solve_retval<CholmodDecomposition<_MatrixType,_UpLo>, Rhs>
+ : solve_retval_base<CholmodDecomposition<_MatrixType,_UpLo>, Rhs>
{
- typedef SparseLDLT<_MatrixType, Cholmod> SpLDLTDecType;
- EIGEN_MAKE_SOLVE_HELPERS(SpLDLTDecType,Rhs)
+ typedef CholmodDecomposition<_MatrixType,_UpLo> Dec;
+ EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
template<typename Dest> void evalTo(Dest& dst) const
{
- //Index size = dec().cholmodFactor()->n;
- ei_assert((Index)dec().cholmodFactor()->n==rhs().rows());
-
- cholmod_factor* cholmodFactor = const_cast<cholmod_factor*>(dec().cholmodFactor());
- cholmod_common* cholmodCommon = const_cast<cholmod_common*>(dec().cholmodCommon());
- // this uses Eigen's triangular sparse solver
- // if (m_status & MatrixLIsDirty)
- // matrixL();
- // Base::solveInPlace(b);
- // as long as our own triangular sparse solver is not fully optimal,
- // let's use CHOLMOD's one:
- cholmod_dense cdb = ei_cholmod_map_eigen_to_dense(rhs().const_cast_derived());
- cholmod_dense* x = cholmod_solve(CHOLMOD_LDLt, cholmodFactor, &cdb, cholmodCommon);
-
- dst = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x), rhs().rows());
- cholmod_free_dense(&x, cholmodCommon);
-
+ dec()._solve(rhs(),dst);
}
-
};
-
-
-
-
-template<typename _MatrixType>
-void SparseLDLT<_MatrixType,Cholmod>::compute(const _MatrixType& a)
+template<typename _MatrixType, int _UpLo, typename Rhs>
+struct sparse_solve_retval<CholmodDecomposition<_MatrixType,_UpLo>, Rhs>
+ : sparse_solve_retval_base<CholmodDecomposition<_MatrixType,_UpLo>, Rhs>
{
- if (m_cholmodFactor)
- {
- cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
- m_cholmodFactor = 0;
- }
+ typedef CholmodDecomposition<_MatrixType,_UpLo> Dec;
+ EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
- cholmod_sparse A = ei_cholmod_map_eigen_to_sparse(const_cast<_MatrixType&>(a));
-
- //m_cholmod.supernodal = CHOLMOD_AUTO;
- m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
- //m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
- // TODO
- if (m_flags & IncompleteFactorization)
- {
- m_cholmod.nmethods = 1;
- //m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
- m_cholmod.method[0].ordering = CHOLMOD_COLAMD;
- m_cholmod.postorder = 1;
- }
- else
- {
- m_cholmod.nmethods = 1;
- m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
- m_cholmod.postorder = 0;
- }
- m_cholmod.final_ll = 0;
- m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
- cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
-
- m_status = (m_status & ~SupernodalFactorIsDirty) | MatrixLIsDirty;
-}
-
-
-// TODO
-template<typename _MatrixType>
-bool SparseLDLT<_MatrixType,Cholmod>::succeeded() const
-{ return true; }
-
-
-template<typename _MatrixType>
-inline const typename SparseLDLT<_MatrixType>::CholMatrixType&
-SparseLDLT<_MatrixType,Cholmod>::matrixL() const
-{
- if (m_status & MatrixLIsDirty)
+ template<typename Dest> void evalTo(Dest& dst) const
{
- ei_assert(!(m_status & SupernodalFactorIsDirty));
-
- cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
- const_cast<typename Base::CholMatrixType&>(m_matrix) = MappedSparseMatrix<Scalar>(*cmRes);
- free(cmRes);
-
- m_status = (m_status & ~MatrixLIsDirty);
+ dec()._solve(rhs(),dst);
}
- return m_matrix;
-}
-
-
-
-
-
+};
-template<typename _MatrixType>
-template<typename Derived>
-void SparseLDLT<_MatrixType,Cholmod>::solveInPlace(MatrixBase<Derived> &b) const
-{
- //Index size = m_cholmodFactor->n;
- ei_assert((Index)m_cholmodFactor->n == b.rows());
-
- // this uses Eigen's triangular sparse solver
- // if (m_status & MatrixLIsDirty)
- // matrixL();
- // Base::solveInPlace(b);
- // as long as our own triangular sparse solver is not fully optimal,
- // let's use CHOLMOD's one:
- cholmod_dense cdb = ei_cholmod_map_eigen_to_dense(b);
- cholmod_dense* x = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &cdb, &m_cholmod);
- b = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x),b.rows());
- cholmod_free_dense(&x, &m_cholmod);
}
-
-
-
-
-
#endif // EIGEN_CHOLMODSUPPORT_H
diff --git a/unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h b/unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h
new file mode 100644
index 000000000..530585852
--- /dev/null
+++ b/unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h
@@ -0,0 +1,517 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
+//
+// Eigen is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EIGEN_CHOLMODSUPPORT_LEGACY_H
+#define EIGEN_CHOLMODSUPPORT_LEGACY_H
+
+namespace internal {
+
+template<typename Scalar, typename CholmodType>
+void cholmod_configure_matrix_legacy(CholmodType& mat)
+{
+ if (internal::is_same<Scalar,float>::value)
+ {
+ mat.xtype = CHOLMOD_REAL;
+ mat.dtype = CHOLMOD_SINGLE;
+ }
+ else if (internal::is_same<Scalar,double>::value)
+ {
+ mat.xtype = CHOLMOD_REAL;
+ mat.dtype = CHOLMOD_DOUBLE;
+ }
+ else if (internal::is_same<Scalar,std::complex<float> >::value)
+ {
+ mat.xtype = CHOLMOD_COMPLEX;
+ mat.dtype = CHOLMOD_SINGLE;
+ }
+ else if (internal::is_same<Scalar,std::complex<double> >::value)
+ {
+ mat.xtype = CHOLMOD_COMPLEX;
+ mat.dtype = CHOLMOD_DOUBLE;
+ }
+ else
+ {
+ eigen_assert(false && "Scalar type not supported by CHOLMOD");
+ }
+}
+
+template<typename _MatrixType>
+cholmod_sparse cholmod_map_eigen_to_sparse(_MatrixType& mat)
+{
+ typedef typename _MatrixType::Scalar Scalar;
+ cholmod_sparse res;
+ res.nzmax = mat.nonZeros();
+ res.nrow = mat.rows();;
+ res.ncol = mat.cols();
+ res.p = mat._outerIndexPtr();
+ res.i = mat._innerIndexPtr();
+ res.x = mat._valuePtr();
+ res.xtype = CHOLMOD_REAL;
+ res.itype = CHOLMOD_INT;
+ res.sorted = 1;
+ res.packed = 1;
+ res.dtype = 0;
+ res.stype = -1;
+
+ internal::cholmod_configure_matrix_legacy<Scalar>(res);
+
+
+ if (_MatrixType::Flags & SelfAdjoint)
+ {
+ if (_MatrixType::Flags & Upper)
+ res.stype = 1;
+ else if (_MatrixType::Flags & Lower)
+ res.stype = -1;
+ else
+ res.stype = 0;
+ }
+ else
+ res.stype = -1; // by default we consider the lower part
+
+ return res;
+}
+
+template<typename Derived>
+cholmod_dense cholmod_map_eigen_to_dense(MatrixBase<Derived>& mat)
+{
+ EIGEN_STATIC_ASSERT((internal::traits<Derived>::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
+ typedef typename Derived::Scalar Scalar;
+
+ cholmod_dense res;
+ res.nrow = mat.rows();
+ 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.z = 0;
+
+ internal::cholmod_configure_matrix_legacy<Scalar>(res);
+
+ return res;
+}
+
+template<typename Scalar, int Flags, typename Index>
+MappedSparseMatrix<Scalar,Flags,Index> map_cholmod_sparse_to_eigen(cholmod_sparse& cm)
+{
+ return MappedSparseMatrix<Scalar,Flags,Index>
+ (cm.nrow, cm.ncol, reinterpret_cast<Index*>(cm.p)[cm.ncol],
+ reinterpret_cast<Index*>(cm.p), reinterpret_cast<Index*>(cm.i),reinterpret_cast<Scalar*>(cm.x) );
+}
+
+} // namespace internal
+
+template<typename _MatrixType>
+class SparseLLT<_MatrixType, Cholmod> : public SparseLLT<_MatrixType>
+{
+ protected:
+ typedef SparseLLT<_MatrixType> Base;
+ typedef typename Base::Scalar Scalar;
+ typedef typename Base::RealScalar RealScalar;
+ typedef typename Base::CholMatrixType CholMatrixType;
+ using Base::MatrixLIsDirty;
+ using Base::SupernodalFactorIsDirty;
+ using Base::m_flags;
+ using Base::m_matrix;
+ using Base::m_status;
+
+ public:
+ typedef _MatrixType MatrixType;
+ typedef typename MatrixType::Index Index;
+
+ SparseLLT(int flags = 0)
+ : Base(flags), m_cholmodFactor(0)
+ {
+ cholmod_start(&m_cholmod);
+ }
+
+ SparseLLT(const MatrixType& matrix, int flags = 0)
+ : Base(flags), m_cholmodFactor(0)
+ {
+ cholmod_start(&m_cholmod);
+ compute(matrix);
+ }
+
+ ~SparseLLT()
+ {
+ if (m_cholmodFactor)
+ cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+ cholmod_finish(&m_cholmod);
+ }
+
+ inline const CholMatrixType& matrixL() const;
+
+ template<typename Derived>
+ bool solveInPlace(MatrixBase<Derived> &b) const;
+
+ template<typename Rhs>
+ inline const internal::solve_retval<SparseLLT<MatrixType, Cholmod>, Rhs>
+ solve(const MatrixBase<Rhs>& b) const
+ {
+ eigen_assert(true && "SparseLLT is not initialized.");
+ return internal::solve_retval<SparseLLT<MatrixType, Cholmod>, Rhs>(*this, b.derived());
+ }
+
+ void compute(const MatrixType& matrix);
+
+ inline Index cols() const { return m_matrix.cols(); }
+ inline Index rows() const { return m_matrix.rows(); }
+
+ inline const cholmod_factor* cholmodFactor() const
+ { return m_cholmodFactor; }
+
+ inline cholmod_common* cholmodCommon() const
+ { return &m_cholmod; }
+
+ bool succeeded() const;
+
+ protected:
+ mutable cholmod_common m_cholmod;
+ cholmod_factor* m_cholmodFactor;
+};
+
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+ struct solve_retval<SparseLLT<_MatrixType, Cholmod>, Rhs>
+ : solve_retval_base<SparseLLT<_MatrixType, Cholmod>, Rhs>
+{
+ typedef SparseLLT<_MatrixType, Cholmod> SpLLTDecType;
+ EIGEN_MAKE_SOLVE_HELPERS(SpLLTDecType,Rhs)
+
+ template<typename Dest> void evalTo(Dest& dst) const
+ {
+ //Index size = dec().cholmodFactor()->n;
+ eigen_assert((Index)dec().cholmodFactor()->n==rhs().rows());
+
+ cholmod_factor* cholmodFactor = const_cast<cholmod_factor*>(dec().cholmodFactor());
+ cholmod_common* cholmodCommon = const_cast<cholmod_common*>(dec().cholmodCommon());
+ // this uses Eigen's triangular sparse solver
+ // if (m_status & MatrixLIsDirty)
+ // matrixL();
+ // Base::solveInPlace(b);
+ // as long as our own triangular sparse solver is not fully optimal,
+ // let's use CHOLMOD's one:
+ cholmod_dense cdb = internal::cholmod_map_eigen_to_dense(rhs().const_cast_derived());
+ cholmod_dense* x = cholmod_solve(CHOLMOD_A, cholmodFactor, &cdb, cholmodCommon);
+
+ dst = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x), rhs().rows());
+
+ cholmod_free_dense(&x, cholmodCommon);
+
+ }
+
+};
+
+} // namespace internal
+
+
+
+template<typename _MatrixType>
+void SparseLLT<_MatrixType,Cholmod>::compute(const _MatrixType& a)
+{
+ if (m_cholmodFactor)
+ {
+ cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+ m_cholmodFactor = 0;
+ }
+
+ cholmod_sparse A = internal::cholmod_map_eigen_to_sparse(const_cast<_MatrixType&>(a));
+// m_cholmod.supernodal = CHOLMOD_AUTO;
+ // TODO
+// if (m_flags&IncompleteFactorization)
+// {
+// m_cholmod.nmethods = 1;
+// m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
+// m_cholmod.postorder = 0;
+// }
+// else
+// {
+// m_cholmod.nmethods = 1;
+// m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
+// m_cholmod.postorder = 0;
+// }
+// m_cholmod.final_ll = 1;
+ m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
+ cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
+
+ m_status = (m_status & ~SupernodalFactorIsDirty) | MatrixLIsDirty;
+}
+
+
+// TODO
+template<typename _MatrixType>
+bool SparseLLT<_MatrixType,Cholmod>::succeeded() const
+{ return true; }
+
+
+
+template<typename _MatrixType>
+inline const typename SparseLLT<_MatrixType,Cholmod>::CholMatrixType&
+SparseLLT<_MatrixType,Cholmod>::matrixL() const
+{
+ if (m_status & MatrixLIsDirty)
+ {
+ eigen_assert(!(m_status & SupernodalFactorIsDirty));
+
+ cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
+ const_cast<typename Base::CholMatrixType&>(m_matrix) =
+ internal::map_cholmod_sparse_to_eigen<Scalar,ColMajor,Index>(*cmRes);
+ free(cmRes);
+
+ m_status = (m_status & ~MatrixLIsDirty);
+ }
+ return m_matrix;
+}
+
+
+
+
+template<typename _MatrixType>
+template<typename Derived>
+bool SparseLLT<_MatrixType,Cholmod>::solveInPlace(MatrixBase<Derived> &b) const
+{
+ //Index size = m_cholmodFactor->n;
+ eigen_assert((Index)m_cholmodFactor->n==b.rows());
+
+ // this uses Eigen's triangular sparse solver
+ // if (m_status & MatrixLIsDirty)
+ // matrixL();
+ // Base::solveInPlace(b);
+ // as long as our own triangular sparse solver is not fully optimal,
+ // let's use CHOLMOD's one:
+ cholmod_dense cdb = internal::cholmod_map_eigen_to_dense(b);
+
+ cholmod_dense* x = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &cdb, &m_cholmod);
+ eigen_assert(x && "Eigen: cholmod_solve failed.");
+
+ b = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x),b.rows());
+ cholmod_free_dense(&x, &m_cholmod);
+ return true;
+}
+
+
+
+
+
+
+
+
+
+
+
+template<typename _MatrixType>
+class SparseLDLT<_MatrixType,Cholmod> : public SparseLDLT<_MatrixType>
+{
+ protected:
+ typedef SparseLDLT<_MatrixType> Base;
+ typedef typename Base::Scalar Scalar;
+ typedef typename Base::RealScalar RealScalar;
+ using Base::MatrixLIsDirty;
+ using Base::SupernodalFactorIsDirty;
+ using Base::m_flags;
+ using Base::m_matrix;
+ using Base::m_status;
+
+ public:
+ typedef _MatrixType MatrixType;
+ typedef typename MatrixType::Index Index;
+
+ SparseLDLT(int flags = 0)
+ : Base(flags), m_cholmodFactor(0)
+ {
+ cholmod_start(&m_cholmod);
+ }
+
+ SparseLDLT(const _MatrixType& matrix, int flags = 0)
+ : Base(flags), m_cholmodFactor(0)
+ {
+ cholmod_start(&m_cholmod);
+ compute(matrix);
+ }
+
+ ~SparseLDLT()
+ {
+ if (m_cholmodFactor)
+ cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+ cholmod_finish(&m_cholmod);
+ }
+
+ inline const typename Base::CholMatrixType& matrixL(void) const;
+
+ template<typename Derived>
+ void solveInPlace(MatrixBase<Derived> &b) const;
+
+ template<typename Rhs>
+ inline const internal::solve_retval<SparseLDLT<MatrixType, Cholmod>, Rhs>
+ solve(const MatrixBase<Rhs>& b) const
+ {
+ eigen_assert(true && "SparseLDLT is not initialized.");
+ return internal::solve_retval<SparseLDLT<MatrixType, Cholmod>, Rhs>(*this, b.derived());
+ }
+
+ void compute(const _MatrixType& matrix);
+
+ inline Index cols() const { return m_matrix.cols(); }
+ inline Index rows() const { return m_matrix.rows(); }
+
+ inline const cholmod_factor* cholmodFactor() const
+ { return m_cholmodFactor; }
+
+ inline cholmod_common* cholmodCommon() const
+ { return &m_cholmod; }
+
+ bool succeeded() const;
+
+ protected:
+ mutable cholmod_common m_cholmod;
+ cholmod_factor* m_cholmodFactor;
+};
+
+
+
+namespace internal {
+
+template<typename _MatrixType, typename Rhs>
+ struct solve_retval<SparseLDLT<_MatrixType, Cholmod>, Rhs>
+ : solve_retval_base<SparseLDLT<_MatrixType, Cholmod>, Rhs>
+{
+ typedef SparseLDLT<_MatrixType, Cholmod> SpLDLTDecType;
+ EIGEN_MAKE_SOLVE_HELPERS(SpLDLTDecType,Rhs)
+
+ template<typename Dest> void evalTo(Dest& dst) const
+ {
+ //Index size = dec().cholmodFactor()->n;
+ eigen_assert((Index)dec().cholmodFactor()->n==rhs().rows());
+
+ cholmod_factor* cholmodFactor = const_cast<cholmod_factor*>(dec().cholmodFactor());
+ cholmod_common* cholmodCommon = const_cast<cholmod_common*>(dec().cholmodCommon());
+ // this uses Eigen's triangular sparse solver
+ // if (m_status & MatrixLIsDirty)
+ // matrixL();
+ // Base::solveInPlace(b);
+ // as long as our own triangular sparse solver is not fully optimal,
+ // let's use CHOLMOD's one:
+ cholmod_dense cdb = internal::cholmod_map_eigen_to_dense(rhs().const_cast_derived());
+ cholmod_dense* x = cholmod_solve(CHOLMOD_LDLt, cholmodFactor, &cdb, cholmodCommon);
+
+ dst = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x), rhs().rows());
+ cholmod_free_dense(&x, cholmodCommon);
+
+ }
+
+};
+
+
+} // namespace internal
+
+template<typename _MatrixType>
+void SparseLDLT<_MatrixType,Cholmod>::compute(const _MatrixType& a)
+{
+ if (m_cholmodFactor)
+ {
+ cholmod_free_factor(&m_cholmodFactor, &m_cholmod);
+ m_cholmodFactor = 0;
+ }
+
+ cholmod_sparse A = internal::cholmod_map_eigen_to_sparse(const_cast<_MatrixType&>(a));
+
+ //m_cholmod.supernodal = CHOLMOD_AUTO;
+ m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
+ //m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
+ // TODO
+ if (m_flags & IncompleteFactorization)
+ {
+ m_cholmod.nmethods = 1;
+ //m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
+ m_cholmod.method[0].ordering = CHOLMOD_COLAMD;
+ m_cholmod.postorder = 1;
+ }
+ else
+ {
+ m_cholmod.nmethods = 1;
+ m_cholmod.method[0].ordering = CHOLMOD_NATURAL;
+ m_cholmod.postorder = 0;
+ }
+ m_cholmod.final_ll = 0;
+ m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);
+ cholmod_factorize(&A, m_cholmodFactor, &m_cholmod);
+
+ m_status = (m_status & ~SupernodalFactorIsDirty) | MatrixLIsDirty;
+}
+
+
+// TODO
+template<typename _MatrixType>
+bool SparseLDLT<_MatrixType,Cholmod>::succeeded() const
+{ return true; }
+
+
+template<typename _MatrixType>
+inline const typename SparseLDLT<_MatrixType>::CholMatrixType&
+SparseLDLT<_MatrixType,Cholmod>::matrixL() const
+{
+ if (m_status & MatrixLIsDirty)
+ {
+ eigen_assert(!(m_status & SupernodalFactorIsDirty));
+
+ cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
+ const_cast<typename Base::CholMatrixType&>(m_matrix) = MappedSparseMatrix<Scalar>(*cmRes);
+ free(cmRes);
+
+ m_status = (m_status & ~MatrixLIsDirty);
+ }
+ return m_matrix;
+}
+
+
+
+
+
+
+template<typename _MatrixType>
+template<typename Derived>
+void SparseLDLT<_MatrixType,Cholmod>::solveInPlace(MatrixBase<Derived> &b) const
+{
+ //Index size = m_cholmodFactor->n;
+ eigen_assert((Index)m_cholmodFactor->n == b.rows());
+
+ // this uses Eigen's triangular sparse solver
+ // if (m_status & MatrixLIsDirty)
+ // matrixL();
+ // Base::solveInPlace(b);
+ // as long as our own triangular sparse solver is not fully optimal,
+ // let's use CHOLMOD's one:
+ cholmod_dense cdb = internal::cholmod_map_eigen_to_dense(b);
+ cholmod_dense* x = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &cdb, &m_cholmod);
+ b = Matrix<typename Base::Scalar,Dynamic,1>::Map(reinterpret_cast<typename Base::Scalar*>(x->x),b.rows());
+ cholmod_free_dense(&x, &m_cholmod);
+}
+
+
+
+
+
+
+#endif // EIGEN_CHOLMODSUPPORT_LEGACY_H
diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h
index f81eb693d..4ea41af85 100644
--- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h
+++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h
@@ -305,8 +305,8 @@ class RandomSetter
/** \returns a reference to the coefficient at given coordinates \a row, \a col */
Scalar& operator() (Index row, Index col)
{
- ei_assert(((!IsUpper) || (row<=col)) && "Invalid access to an upper triangular matrix");
- ei_assert(((!IsLower) || (col<=row)) && "Invalid access to an upper triangular matrix");
+ eigen_assert(((!IsUpper) || (row<=col)) && "Invalid access to an upper triangular matrix");
+ eigen_assert(((!IsLower) || (col<=row)) && "Invalid access to an upper triangular matrix");
const Index outer = SetterRowMajor ? row : col;
const Index inner = SetterRowMajor ? col : row;
const Index outerMajor = outer >> OuterPacketBits; // index of the packet/map
diff --git a/unsupported/Eigen/src/SparseExtra/SparseLDLT.h b/unsupported/Eigen/src/SparseExtra/SparseLDLT.h
index a852f2b0f..837d70295 100644
--- a/unsupported/Eigen/src/SparseExtra/SparseLDLT.h
+++ b/unsupported/Eigen/src/SparseExtra/SparseLDLT.h
@@ -99,7 +99,7 @@ class SparseLDLT
SparseLDLT(int flags = 0)
: m_flags(flags), m_status(0)
{
- ei_assert((MatrixType::Flags&RowMajorBit)==0);
+ eigen_assert((MatrixType::Flags&RowMajorBit)==0);
m_precision = RealScalar(0.1) * Eigen::NumTraits<RealScalar>::dummy_precision();
}
@@ -108,7 +108,7 @@ class SparseLDLT
SparseLDLT(const MatrixType& matrix, int flags = 0)
: m_matrix(matrix.rows(), matrix.cols()), m_flags(flags), m_status(0)
{
- ei_assert((MatrixType::Flags&RowMajorBit)==0);
+ eigen_assert((MatrixType::Flags&RowMajorBit)==0);
m_precision = RealScalar(0.1) * Eigen::NumTraits<RealScalar>::dummy_precision();
compute(matrix);
}
@@ -166,11 +166,11 @@ class SparseLDLT
bool solveInPlace(MatrixBase<Derived> &b) const;
template<typename Rhs>
- inline const ei_solve_retval<SparseLDLT<MatrixType>, Rhs>
+ inline const internal::solve_retval<SparseLDLT<MatrixType>, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(true && "SparseLDLT is not initialized.");
- return ei_solve_retval<SparseLDLT<MatrixType>, Rhs>(*this, b.derived());
+ eigen_assert(true && "SparseLDLT is not initialized.");
+ return internal::solve_retval<SparseLDLT<MatrixType>, Rhs>(*this, b.derived());
}
inline Index cols() const { return m_matrix.cols(); }
@@ -193,13 +193,11 @@ class SparseLDLT
bool m_succeeded;
};
-
-
-
+namespace internal {
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<SparseLDLT<_MatrixType>, Rhs>
- : ei_solve_retval_base<SparseLDLT<_MatrixType>, Rhs>
+struct solve_retval<SparseLDLT<_MatrixType>, Rhs>
+ : solve_retval_base<SparseLDLT<_MatrixType>, Rhs>
{
typedef SparseLDLT<_MatrixType> SpLDLTDecType;
EIGEN_MAKE_SOLVE_HELPERS(SpLDLTDecType,Rhs)
@@ -207,7 +205,7 @@ struct ei_solve_retval<SparseLDLT<_MatrixType>, Rhs>
template<typename Dest> void evalTo(Dest& dst) const
{
//Index size = dec().matrixL().rows();
- ei_assert(dec().matrixL().rows()==rhs().rows());
+ eigen_assert(dec().matrixL().rows()==rhs().rows());
Rhs b(rhs().rows(), rhs().cols());
b = rhs();
@@ -225,7 +223,7 @@ struct ei_solve_retval<SparseLDLT<_MatrixType>, Rhs>
};
-
+} // end namespace internal
/** Computes / recomputes the LDLT decomposition of matrix \a a
* using the default algorithm.
@@ -332,7 +330,7 @@ bool SparseLDLT<_MatrixType,Backend>::_numeric(const _MatrixType& a)
Index i = Pinv ? Pinv[Ai[p]] : Ai[p]; /* get A(i,k) */
if (i <= k)
{
- y[i] += ei_conj(Ax[p]); /* scatter A(i,k) into Y (sum duplicates) */
+ y[i] += internal::conj(Ax[p]); /* scatter A(i,k) into Y (sum duplicates) */
Index len;
for (len = 0; tags[i] != k; i = m_parent[i])
{
@@ -355,9 +353,9 @@ bool SparseLDLT<_MatrixType,Backend>::_numeric(const _MatrixType& a)
Index p2 = Lp[i] + m_nonZerosPerCol[i];
Index p;
for (p = Lp[i]; p < p2; ++p)
- y[Li[p]] -= ei_conj(Lx[p]) * (yi);
+ y[Li[p]] -= internal::conj(Lx[p]) * (yi);
Scalar l_ki = yi / m_diag[i]; /* the nonzero entry L(k,i) */
- m_diag[k] -= l_ki * ei_conj(yi);
+ m_diag[k] -= l_ki * internal::conj(yi);
Li[p] = k; /* store L(k,i) in column form of L */
Lx[p] = (l_ki);
++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */
@@ -382,7 +380,7 @@ template<typename Derived>
bool SparseLDLT<_MatrixType, Backend>::solveInPlace(MatrixBase<Derived> &b) const
{
//Index size = m_matrix.rows();
- ei_assert(m_matrix.rows()==b.rows());
+ eigen_assert(m_matrix.rows()==b.rows());
if (!m_succeeded)
return false;
diff --git a/unsupported/Eigen/src/SparseExtra/SparseLLT.h b/unsupported/Eigen/src/SparseExtra/SparseLLT.h
index 5be914b6a..ac042217b 100644
--- a/unsupported/Eigen/src/SparseExtra/SparseLLT.h
+++ b/unsupported/Eigen/src/SparseExtra/SparseLLT.h
@@ -112,11 +112,11 @@ class SparseLLT
bool solveInPlace(MatrixBase<Derived> &b) const;
template<typename Rhs>
- inline const ei_solve_retval<SparseLLT<MatrixType>, Rhs>
+ inline const internal::solve_retval<SparseLLT<MatrixType>, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(true && "SparseLLT is not initialized.");
- return ei_solve_retval<SparseLLT<MatrixType>, Rhs>(*this, b.derived());
+ eigen_assert(true && "SparseLLT is not initialized.");
+ return internal::solve_retval<SparseLLT<MatrixType>, Rhs>(*this, b.derived());
}
inline Index cols() const { return m_matrix.cols(); }
@@ -134,13 +134,11 @@ class SparseLLT
};
-
-
-
+namespace internal {
template<typename _MatrixType, typename Rhs>
-struct ei_solve_retval<SparseLLT<_MatrixType>, Rhs>
- : ei_solve_retval_base<SparseLLT<_MatrixType>, Rhs>
+struct solve_retval<SparseLLT<_MatrixType>, Rhs>
+ : solve_retval_base<SparseLLT<_MatrixType>, Rhs>
{
typedef SparseLLT<_MatrixType> SpLLTDecType;
EIGEN_MAKE_SOLVE_HELPERS(SpLLTDecType,Rhs)
@@ -148,7 +146,7 @@ struct ei_solve_retval<SparseLLT<_MatrixType>, Rhs>
template<typename Dest> void evalTo(Dest& dst) const
{
const Index size = dec().matrixL().rows();
- ei_assert(size==rhs().rows());
+ eigen_assert(size==rhs().rows());
Rhs b(rhs().rows(), rhs().cols());
b = rhs();
@@ -162,7 +160,7 @@ struct ei_solve_retval<SparseLLT<_MatrixType>, Rhs>
};
-
+} // end namespace internal
/** Computes / recomputes the LLT decomposition of matrix \a a
@@ -184,7 +182,7 @@ void SparseLLT<_MatrixType,Backend>::compute(const _MatrixType& a)
m_matrix.reserve(a.nonZeros()*2);
for (Index j = 0; j < size; ++j)
{
- Scalar x = ei_real(a.coeff(j,j));
+ Scalar x = internal::real(a.coeff(j,j));
// TODO better estimate of the density !
tempVector.init(density>0.001? IsDense : IsSparse);
@@ -193,7 +191,7 @@ void SparseLLT<_MatrixType,Backend>::compute(const _MatrixType& a)
// init with current matrix a
{
typename _MatrixType::InnerIterator it(a,j);
- ei_assert(it.index()==j &&
+ eigen_assert(it.index()==j &&
"matrix must has non zero diagonal entries and only the lower triangular part must be stored");
++it; // skip diagonal element
for (; it; ++it)
@@ -207,7 +205,7 @@ void SparseLLT<_MatrixType,Backend>::compute(const _MatrixType& a)
if (it && it.index()==j)
{
Scalar y = it.value();
- x -= ei_abs2(y);
+ x -= internal::abs2(y);
++it; // skip j-th element, and process remaining column coefficients
tempVector.restart();
for (; it; ++it)
@@ -218,7 +216,7 @@ void SparseLLT<_MatrixType,Backend>::compute(const _MatrixType& a)
}
// copy the temporary vector to the respective m_matrix.col()
// while scaling the result by 1/real(x)
- RealScalar rx = ei_sqrt(ei_real(x));
+ RealScalar rx = internal::sqrt(internal::real(x));
m_matrix.insert(j,j) = rx; // FIXME use insertBack
Scalar y = Scalar(1)/rx;
for (typename AmbiVector<Scalar,Index>::Iterator it(tempVector, m_precision*rx); it; ++it)
@@ -236,7 +234,7 @@ template<typename Derived>
bool SparseLLT<_MatrixType, Backend>::solveInPlace(MatrixBase<Derived> &b) const
{
const Index size = m_matrix.rows();
- ei_assert(size==b.rows());
+ eigen_assert(size==b.rows());
m_matrix.template triangularView<Lower>().solveInPlace(b);
m_matrix.adjoint().template triangularView<Upper>().solveInPlace(b);
diff --git a/unsupported/Eigen/src/SparseExtra/SparseLU.h b/unsupported/Eigen/src/SparseExtra/SparseLU.h
index f6ced52c9..3d10dbbee 100644
--- a/unsupported/Eigen/src/SparseExtra/SparseLU.h
+++ b/unsupported/Eigen/src/SparseExtra/SparseLU.h
@@ -103,7 +103,7 @@ class SparseLU
void setOrderingMethod(int m)
{
- ei_assert( (m&~OrderingMask) == 0 && m!=0 && "invalid ordering method");
+ eigen_assert( (m&~OrderingMask) == 0 && m!=0 && "invalid ordering method");
m_flags = m_flags&~OrderingMask | m&OrderingMask;
}
@@ -141,7 +141,7 @@ class SparseLU
template<typename _MatrixType, typename Backend>
void SparseLU<_MatrixType,Backend>::compute(const _MatrixType& )
{
- ei_assert(false && "not implemented yet");
+ eigen_assert(false && "not implemented yet");
}
/** Computes *x = U^-1 L^-1 b
@@ -156,7 +156,7 @@ template<typename _MatrixType, typename Backend>
template<typename BDerived, typename XDerived>
bool SparseLU<_MatrixType,Backend>::solve(const MatrixBase<BDerived> &, MatrixBase<XDerived>* , const int ) const
{
- ei_assert(false && "not implemented yet");
+ eigen_assert(false && "not implemented yet");
return false;
}
diff --git a/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h b/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
index 9453aabce..a3e2de82e 100644
--- a/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
+++ b/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
@@ -126,7 +126,7 @@ struct SluMatrix : SuperMatrix
Store = &storage;
else
{
- ei_assert(false && "storage type not supported");
+ eigen_assert(false && "storage type not supported");
Store = 0;
}
}
@@ -134,17 +134,17 @@ struct SluMatrix : SuperMatrix
template<typename Scalar>
void setScalarType()
{
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same<Scalar,float>::value)
Dtype = SLU_S;
- else if (ei_is_same_type<Scalar,double>::ret)
+ else if (internal::is_same<Scalar,double>::value)
Dtype = SLU_D;
- else if (ei_is_same_type<Scalar,std::complex<float> >::ret)
+ else if (internal::is_same<Scalar,std::complex<float> >::value)
Dtype = SLU_C;
- else if (ei_is_same_type<Scalar,std::complex<double> >::ret)
+ else if (internal::is_same<Scalar,std::complex<double> >::value)
Dtype = SLU_Z;
else
{
- ei_assert(false && "Scalar type not supported by SuperLU");
+ eigen_assert(false && "Scalar type not supported by SuperLU");
}
}
@@ -152,7 +152,7 @@ struct SluMatrix : SuperMatrix
static SluMatrix Map(Matrix<Scalar,Rows,Cols,Options,MRows,MCols>& mat)
{
typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
- ei_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
+ eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
SluMatrix res;
res.setStorageType(SLU_DN);
res.setScalarType<Scalar>();
@@ -198,7 +198,7 @@ struct SluMatrix : SuperMatrix
if (MatrixType::Flags & Lower)
res.Mtype = SLU_TRL;
if (MatrixType::Flags & SelfAdjoint)
- ei_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
+ eigen_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
return res;
}
};
@@ -209,7 +209,7 @@ struct SluMatrixMapHelper<Matrix<Scalar,Rows,Cols,Options,MRows,MCols> >
typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
static void run(MatrixType& mat, SluMatrix& res)
{
- ei_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
+ eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
res.setStorageType(SLU_DN);
res.setScalarType<Scalar>();
res.Mtype = SLU_GE;
@@ -256,21 +256,23 @@ struct SluMatrixMapHelper<SparseMatrixBase<Derived> >
if (MatrixType::Flags & Lower)
res.Mtype = SLU_TRL;
if (MatrixType::Flags & SelfAdjoint)
- ei_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
+ eigen_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
}
};
+namespace internal {
+
template<typename MatrixType>
-SluMatrix ei_asSluMatrix(MatrixType& mat)
+SluMatrix asSluMatrix(MatrixType& mat)
{
return SluMatrix::Map(mat);
}
/** View a Super LU matrix as an Eigen expression */
template<typename Scalar, int Flags, typename Index>
-MappedSparseMatrix<Scalar,Flags,Index> ei_map_superlu(SluMatrix& sluMat)
+MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat)
{
- ei_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
+ eigen_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
|| (Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC);
Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow;
@@ -280,6 +282,8 @@ MappedSparseMatrix<Scalar,Flags,Index> ei_map_superlu(SluMatrix& sluMat)
sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast<Scalar*>(sluMat.storage.values) );
}
+} // end namespace internal
+
template<typename MatrixType>
class SparseLU<MatrixType,SuperLU> : public SparseLU<MatrixType>
{
@@ -393,7 +397,7 @@ void SparseLU<MatrixType,SuperLU>::compute(const MatrixType& a)
m_sluOptions.ColPerm = NATURAL;
};
- m_sluA = ei_asSluMatrix(m_matrix);
+ m_sluA = internal::asSluMatrix(m_matrix);
memset(&m_sluL,0,sizeof m_sluL);
memset(&m_sluU,0,sizeof m_sluU);
//m_sluEqued = 'B';
@@ -471,7 +475,7 @@ bool SparseLU<MatrixType,SuperLU>::solve(const MatrixBase<BDerived> &b,
{
const int size = m_matrix.rows();
const int rhsCols = b.cols();
- ei_assert(size==b.rows());
+ eigen_assert(size==b.rows());
switch (transposed) {
case SvNoTrans : m_sluOptions.Trans = NOTRANS; break;
@@ -637,7 +641,7 @@ typename SparseLU<MatrixType,SuperLU>::Scalar SparseLU<MatrixType,SuperLU>::dete
if (m_u._outerIndexPtr()[j+1]-m_u._outerIndexPtr()[j] > 0)
{
int lastId = m_u._outerIndexPtr()[j+1]-1;
- ei_assert(m_u._innerIndexPtr()[lastId]<=j);
+ eigen_assert(m_u._innerIndexPtr()[lastId]<=j);
if (m_u._innerIndexPtr()[lastId]==j)
{
det *= m_u._valuePtr()[lastId];
diff --git a/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h b/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
index 9d7e3e96e..4be1aca62 100644
--- a/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
+++ b/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
@@ -183,11 +183,11 @@ class SparseLU<_MatrixType,UmfPack> : public SparseLU<_MatrixType>
bool solve(const MatrixBase<BDerived> &b, MatrixBase<XDerived>* x) const;
template<typename Rhs>
- inline const ei_solve_retval<SparseLU<MatrixType, UmfPack>, Rhs>
+ inline const internal::solve_retval<SparseLU<MatrixType, UmfPack>, Rhs>
solve(const MatrixBase<Rhs>& b) const
{
- ei_assert(true && "SparseLU is not initialized.");
- return ei_solve_retval<SparseLU<MatrixType, UmfPack>, Rhs>(*this, b.derived());
+ eigen_assert(true && "SparseLU is not initialized.");
+ return internal::solve_retval<SparseLU<MatrixType, UmfPack>, Rhs>(*this, b.derived());
}
void compute(const MatrixType& matrix);
@@ -197,7 +197,7 @@ class SparseLU<_MatrixType,UmfPack> : public SparseLU<_MatrixType>
inline const MatrixType& matrixLU() const
{
- //ei_assert(m_isInitialized && "LU is not initialized.");
+ //eigen_assert(m_isInitialized && "LU is not initialized.");
return *m_matrixRef;
}
@@ -221,10 +221,11 @@ class SparseLU<_MatrixType,UmfPack> : public SparseLU<_MatrixType>
mutable bool m_extractedDataAreDirty;
};
+namespace internal {
template<typename _MatrixType, typename Rhs>
- struct ei_solve_retval<SparseLU<_MatrixType, UmfPack>, Rhs>
- : ei_solve_retval_base<SparseLU<_MatrixType, UmfPack>, Rhs>
+ struct solve_retval<SparseLU<_MatrixType, UmfPack>, Rhs>
+ : solve_retval_base<SparseLU<_MatrixType, UmfPack>, Rhs>
{
typedef SparseLU<_MatrixType, UmfPack> SpLUDecType;
EIGEN_MAKE_SOLVE_HELPERS(SpLUDecType,Rhs)
@@ -233,8 +234,8 @@ template<typename _MatrixType, typename Rhs>
{
const int rhsCols = rhs().cols();
- ei_assert((Rhs::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major rhs yet");
- ei_assert((Dest::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major result yet");
+ eigen_assert((Rhs::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major rhs yet");
+ eigen_assert((Dest::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major result yet");
void* numeric = const_cast<void*>(dec().numeric());
@@ -244,13 +245,13 @@ template<typename _MatrixType, typename Rhs>
errorCode = umfpack_solve(UMFPACK_A,
dec().matrixLU()._outerIndexPtr(), dec().matrixLU()._innerIndexPtr(), dec().matrixLU()._valuePtr(),
&dst.col(j).coeffRef(0), &rhs().const_cast_derived().col(j).coeffRef(0), numeric, 0, 0);
- ei_assert(!errorCode && "UmfPack could not solve the system.");
+ eigen_assert(!errorCode && "UmfPack could not solve the system.");
}
}
};
-
+} // end namespace internal
template<typename MatrixType>
void SparseLU<MatrixType,UmfPack>::compute(const MatrixType& a)
@@ -258,7 +259,7 @@ void SparseLU<MatrixType,UmfPack>::compute(const MatrixType& a)
typedef typename MatrixType::Index Index;
const Index rows = a.rows();
const Index cols = a.cols();
- ei_assert((MatrixType::Flags&RowMajorBit)==0 && "Row major matrices are not supported yet");
+ eigen_assert((MatrixType::Flags&RowMajorBit)==0 && "Row major matrices are not supported yet");
m_matrixRef = &a;
@@ -322,9 +323,9 @@ bool SparseLU<MatrixType,UmfPack>::solve(const MatrixBase<BDerived> &b, MatrixBa
{
//const int size = m_matrix.rows();
const int rhsCols = b.cols();
-// ei_assert(size==b.rows());
- ei_assert((BDerived::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major rhs yet");
- ei_assert((XDerived::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major result yet");
+// eigen_assert(size==b.rows());
+ eigen_assert((BDerived::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major rhs yet");
+ eigen_assert((XDerived::Flags&RowMajorBit)==0 && "UmfPack backend does not support non col-major result yet");
int errorCode;
for (int j=0; j<rhsCols; ++j)
diff --git a/unsupported/doc/examples/BVH_Example.cpp b/unsupported/doc/examples/BVH_Example.cpp
index d135fd990..9e9959a32 100644
--- a/unsupported/doc/examples/BVH_Example.cpp
+++ b/unsupported/doc/examples/BVH_Example.cpp
@@ -5,7 +5,7 @@
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
-Box2d ei_bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
+Box2d internal::bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
struct PointPointMinimizer //how to compute squared distances between points and rectangles
{
diff --git a/unsupported/doc/examples/PolynomialSolver1.cpp b/unsupported/doc/examples/PolynomialSolver1.cpp
index c875c9361..71e6b825f 100644
--- a/unsupported/doc/examples/PolynomialSolver1.cpp
+++ b/unsupported/doc/examples/PolynomialSolver1.cpp
@@ -49,5 +49,5 @@ int main()
cout.precision(10);
cout << "The last root in float then in double: " << psolvef.roots()[5] << "\t" << psolve6d.roots()[5] << endl;
std::complex<float> castedRoot( psolve6d.roots()[5].real(), psolve6d.roots()[5].imag() );
- cout << "Norm of the difference: " << ei_abs( psolvef.roots()[5] - castedRoot ) << endl;
+ cout << "Norm of the difference: " << internal::abs( psolvef.roots()[5] - castedRoot ) << endl;
}
diff --git a/unsupported/test/BVH.cpp b/unsupported/test/BVH.cpp
index 4abf7f5bd..ba5871e66 100644
--- a/unsupported/test/BVH.cpp
+++ b/unsupported/test/BVH.cpp
@@ -42,11 +42,15 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)
double radius;
};
+namespace Eigen {
+namespace internal {
-template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> ei_bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
-template<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)
+template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
+template<int Dim> AlignedBox<double, Dim> bounding_box(const Ball<Dim> &b)
{ return AlignedBox<double, Dim>(b.center.array() - b.radius, b.center.array() + b.radius); }
+} // end namespace internal
+}
template<int Dim>
struct BallPointStuff //this class provides functions to be both an intersector and a minimizer, both for a ball and a point and for two trees
@@ -113,7 +117,7 @@ struct TreeTest
{
BallTypeList b;
for(int i = 0; i < 500; ++i) {
- b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));
+ b.push_back(BallType(VectorType::Random(), 0.5 * internal::random(0., 1.)));
}
KdBVH<double, Dim, BallType> tree(b.begin(), b.end());
@@ -132,7 +136,7 @@ struct TreeTest
{
BallTypeList b;
for(int i = 0; i < 500; ++i) {
- b.push_back(BallType(VectorType::Random(), 0.01 * ei_random(0., 1.)));
+ b.push_back(BallType(VectorType::Random(), 0.01 * internal::random(0., 1.)));
}
KdBVH<double, Dim, BallType> tree(b.begin(), b.end());
@@ -155,7 +159,7 @@ struct TreeTest
VectorTypeList v;
for(int i = 0; i < 50; ++i) {
- b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));
+ b.push_back(BallType(VectorType::Random(), 0.5 * internal::random(0., 1.)));
for(int j = 0; j < 3; ++j)
v.push_back(VectorType::Random());
}
@@ -180,7 +184,7 @@ struct TreeTest
VectorTypeList v;
for(int i = 0; i < 50; ++i) {
- b.push_back(BallType(VectorType::Random(), 1e-7 + 1e-6 * ei_random(0., 1.)));
+ b.push_back(BallType(VectorType::Random(), 1e-7 + 1e-6 * internal::random(0., 1.)));
for(int j = 0; j < 3; ++j)
v.push_back(VectorType::Random());
}
diff --git a/unsupported/test/CMakeLists.txt b/unsupported/test/CMakeLists.txt
index f6e561914..a96ac72b8 100644
--- a/unsupported/test/CMakeLists.txt
+++ b/unsupported/test/CMakeLists.txt
@@ -1,4 +1,5 @@
-find_package(Adolc)
+
+include_directories(../../test ../../unsupported ../../Eigen)
set(SPARSE_LIBS "")
@@ -41,12 +42,11 @@ else(GOOGLEHASH_FOUND)
ei_add_property(EIGEN_MISSING_BACKENDS "GoogleHash, ")
endif(GOOGLEHASH_FOUND)
-include_directories(../../test ../../unsupported ../../Eigen)
-
+find_package(Adolc)
if(ADOLC_FOUND)
include_directories(${ADOLC_INCLUDES})
ei_add_property(EIGEN_TESTED_BACKENDS "Adolc, ")
- ei_add_test(forward_adolc " " ${ADOLC_LIBRARIES})
+ ei_add_test(forward_adolc "" ${ADOLC_LIBRARIES})
else(ADOLC_FOUND)
ei_add_property(EIGEN_MISSING_BACKENDS "Adolc, ")
endif(ADOLC_FOUND)
@@ -64,35 +64,42 @@ ei_add_test(alignedvector3)
ei_add_test(FFT)
find_package(MPFR 2.3.0)
+find_package(GMP)
if(MPFR_FOUND)
include_directories(${MPFR_INCLUDES})
ei_add_property(EIGEN_TESTED_BACKENDS "MPFR C++, ")
- ei_add_test(mpreal_support " " ${MPFR_LIBRARIES} )
+ set(EIGEN_MPFR_TEST_LIBRARIES ${MPFR_LIBRARIES} ${GMP_LIBRARIES})
+ ei_add_test(mpreal_support "" "${EIGEN_MPFR_TEST_LIBRARIES}" )
else()
ei_add_property(EIGEN_MISSING_BACKENDS "MPFR C++, ")
endif()
-ei_add_test(sparse_llt " " "${SPARSE_LIBS}")
-ei_add_test(sparse_ldlt " " "${SPARSE_LIBS}")
-ei_add_test(sparse_lu " " "${SPARSE_LIBS}")
-ei_add_test(sparse_extra " " " ")
+ei_add_test(sparse_llt "" "${SPARSE_LIBS}")
+ei_add_test(sparse_ldlt "" "${SPARSE_LIBS}")
+ei_add_test(sparse_lu "" "${SPARSE_LIBS}")
+ei_add_test(sparse_extra "" "")
find_package(FFTW)
if(FFTW_FOUND)
ei_add_property(EIGEN_TESTED_BACKENDS "fftw, ")
- ei_add_test(FFTW "-DEIGEN_FFTW_DEFAULT " "-lfftw3 -lfftw3f -lfftw3l" )
+ ei_add_test(FFTW "-DEIGEN_FFTW_DEFAULT " "fftw3 fftw3f fftw3l" )
else()
ei_add_property(EIGEN_MISSING_BACKENDS "fftw, ")
endif()
-find_package(OpenGL)
-find_package(GLUT)
-if(OPENGL_FOUND AND GLUT_FOUND AND GLUT_LIBRARIES)
- ei_add_property(EIGEN_TESTED_BACKENDS "opengl, ")
- ei_add_test(openglsupport "" "${GLUT_LIBRARIES}" )
-else()
- ei_add_property(EIGEN_MISSING_BACKENDS "opengl, ")
-endif()
+option(EIGEN_TEST_NO_OPENGL "Disable OpenGL support in unit tests" OFF)
+if(NOT EIGEN_TEST_NO_OPENGL)
+ find_package(OpenGL)
+ find_package(GLUT)
+ find_package(GLEW)
+ if(OPENGL_FOUND AND GLUT_FOUND AND GLEW_FOUND)
+ ei_add_property(EIGEN_TESTED_BACKENDS "OpenGL, ")
+ set(EIGEN_GL_LIB ${GLUT_LIBRARIES} ${GLEW_LIBRARIES})
+ ei_add_test(openglsupport "" "${EIGEN_GL_LIB}" )
+ else()
+ ei_add_property(EIGEN_MISSING_BACKENDS "OpenGL, ")
+ endif()
+endif(NOT EIGEN_TEST_NO_OPENGL)
find_package(GSL)
if(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
@@ -107,6 +114,5 @@ else(GSL_FOUND)
set(GSL_LIBRARIES " ")
endif(GSL_FOUND)
-ei_add_test(polynomialutils)
ei_add_test(polynomialsolver " " "${GSL_LIBRARIES}" )
-
+ei_add_test(polynomialutils)
diff --git a/unsupported/test/NonLinearOptimization.cpp b/unsupported/test/NonLinearOptimization.cpp
index 851c534f6..196cf15e0 100644
--- a/unsupported/test/NonLinearOptimization.cpp
+++ b/unsupported/test/NonLinearOptimization.cpp
@@ -66,11 +66,11 @@ void testChkder()
/* checking the jacobian matrix. */
x << 9.2e-1, 1.3e-1, 5.4e-1;
- ei_chkder(x, fvec, fjac, xp, fvecp, 1, err);
+ internal::chkder(x, fvec, fjac, xp, fvecp, 1, err);
fcn_chkder(x, fvec, fjac, 1);
fcn_chkder(x, fvec, fjac, 2);
fcn_chkder(xp, fvecp, fjac, 1);
- ei_chkder(x, fvec, fjac, xp, fvecp, 2, err);
+ internal::chkder(x, fvec, fjac, xp, fvecp, 2, err);
fvecp -= fvec;
@@ -220,7 +220,7 @@ void testLmder()
// check covariance
covfac = fnorm*fnorm/(m-n);
- ei_covar(lm.fjac, lm.permutation.indices()); // TODO : move this as a function of lm
+ internal::covar(lm.fjac, lm.permutation.indices()); // TODO : move this as a function of lm
MatrixXd cov_ref(n,n);
cov_ref <<
@@ -611,7 +611,7 @@ void testLmdif()
// check covariance
covfac = fnorm*fnorm/(m-n);
- ei_covar(lm.fjac, lm.permutation.indices()); // TODO : move this as a function of lm
+ internal::covar(lm.fjac, lm.permutation.indices()); // TODO : move this as a function of lm
MatrixXd cov_ref(n,n);
cov_ref <<
diff --git a/unsupported/test/alignedvector3.cpp b/unsupported/test/alignedvector3.cpp
index f4b6dd4d9..0b46ad561 100644
--- a/unsupported/test/alignedvector3.cpp
+++ b/unsupported/test/alignedvector3.cpp
@@ -28,8 +28,8 @@
template<typename Scalar>
void alignedvector3()
{
- Scalar s1 = ei_random<Scalar>();
- Scalar s2 = ei_random<Scalar>();
+ Scalar s1 = internal::random<Scalar>();
+ Scalar s2 = internal::random<Scalar>();
typedef Matrix<Scalar,3,1> RefType;
typedef Matrix<Scalar,3,3> Mat33;
typedef AlignedVector3<Scalar> FastType;
diff --git a/unsupported/test/forward_adolc.cpp b/unsupported/test/forward_adolc.cpp
index 4bb35b05c..1971d883b 100644
--- a/unsupported/test/forward_adolc.cpp
+++ b/unsupported/test/forward_adolc.cpp
@@ -106,7 +106,7 @@ struct TestFunc1
template<typename Func> void adolc_forward_jacobian(const Func& f)
{
- typename Func::InputType x = Func::InputType::Random();
+ typename Func::InputType x = Func::InputType::Random(f.inputs());
typename Func::ValueType y(f.values()), yref(f.values());
typename Func::JacobianType j(f.values(),f.inputs()), jref(f.values(),f.inputs());
diff --git a/unsupported/test/matrix_exponential.cpp b/unsupported/test/matrix_exponential.cpp
index 74b2634c8..17a0dadab 100644
--- a/unsupported/test/matrix_exponential.cpp
+++ b/unsupported/test/matrix_exponential.cpp
@@ -127,7 +127,7 @@ void randomTest(const MatrixType& m, double tol)
MatrixType m1(rows, cols), m2(rows, cols), m3(rows, cols),
identity = MatrixType::Identity(rows, rows);
- typedef typename NumTraits<typename ei_traits<MatrixType>::Scalar>::Real RealScalar;
+ typedef typename NumTraits<typename internal::traits<MatrixType>::Scalar>::Real RealScalar;
for(int i = 0; i < g_repeat; i++) {
m1 = MatrixType::Random(rows, cols);
diff --git a/unsupported/test/matrix_function.cpp b/unsupported/test/matrix_function.cpp
index 3b4cbfec6..04167abfb 100644
--- a/unsupported/test/matrix_function.cpp
+++ b/unsupported/test/matrix_function.cpp
@@ -45,15 +45,15 @@ MatrixType randomMatrixWithRealEivals(const typename MatrixType::Index size)
typedef typename MatrixType::RealScalar RealScalar;
MatrixType diag = MatrixType::Zero(size, size);
for (Index i = 0; i < size; ++i) {
- diag(i, i) = Scalar(RealScalar(ei_random<int>(0,2)))
- + ei_random<Scalar>() * Scalar(RealScalar(0.01));
+ diag(i, i) = Scalar(RealScalar(internal::random<int>(0,2)))
+ + internal::random<Scalar>() * Scalar(RealScalar(0.01));
}
MatrixType A = MatrixType::Random(size, size);
HouseholderQR<MatrixType> QRofA(A);
return QRofA.householderQ().inverse() * diag * QRofA.householderQ();
}
-template <typename MatrixType, int IsComplex = NumTraits<typename ei_traits<MatrixType>::Scalar>::IsComplex>
+template <typename MatrixType, int IsComplex = NumTraits<typename internal::traits<MatrixType>::Scalar>::IsComplex>
struct randomMatrixWithImagEivals
{
// Returns a matrix with eigenvalues clustered around 0 and +/- i.
@@ -71,12 +71,12 @@ struct randomMatrixWithImagEivals<MatrixType, 0>
MatrixType diag = MatrixType::Zero(size, size);
Index i = 0;
while (i < size) {
- Index randomInt = ei_random<Index>(-1, 1);
+ Index randomInt = internal::random<Index>(-1, 1);
if (randomInt == 0 || i == size-1) {
- diag(i, i) = ei_random<Scalar>() * Scalar(0.01);
+ diag(i, i) = internal::random<Scalar>() * Scalar(0.01);
++i;
} else {
- Scalar alpha = Scalar(randomInt) + ei_random<Scalar>() * Scalar(0.01);
+ Scalar alpha = Scalar(randomInt) + internal::random<Scalar>() * Scalar(0.01);
diag(i, i+1) = alpha;
diag(i+1, i) = -alpha;
i += 2;
@@ -100,8 +100,8 @@ struct randomMatrixWithImagEivals<MatrixType, 1>
const Scalar imagUnit(0, 1);
MatrixType diag = MatrixType::Zero(size, size);
for (Index i = 0; i < size; ++i) {
- diag(i, i) = Scalar(RealScalar(ei_random<Index>(-1, 1))) * imagUnit
- + ei_random<Scalar>() * Scalar(RealScalar(0.01));
+ diag(i, i) = Scalar(RealScalar(internal::random<Index>(-1, 1))) * imagUnit
+ + internal::random<Scalar>() * Scalar(RealScalar(0.01));
}
MatrixType A = MatrixType::Random(size, size);
HouseholderQR<MatrixType> QRofA(A);
@@ -113,7 +113,7 @@ struct randomMatrixWithImagEivals<MatrixType, 1>
template<typename MatrixType>
void testMatrixExponential(const MatrixType& A)
{
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
+ typedef typename internal::traits<MatrixType>::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef std::complex<RealScalar> ComplexScalar;
diff --git a/unsupported/test/mpreal_support.cpp b/unsupported/test/mpreal_support.cpp
index 32570f092..4e8e583f0 100644
--- a/unsupported/test/mpreal_support.cpp
+++ b/unsupported/test/mpreal_support.cpp
@@ -17,7 +17,7 @@ void test_mpreal_support()
std::cerr << "lowest = " << NumTraits<mpreal>::lowest() << "\n";
for(int i = 0; i < g_repeat; i++) {
- int s = ei_random<int>(1,100);
+ int s = Eigen::internal::random<int>(1,100);
MatrixXmp A = MatrixXmp::Random(s,s);
MatrixXmp B = MatrixXmp::Random(s,s);
MatrixXmp S = A.adjoint() * A;
diff --git a/unsupported/test/openglsupport.cpp b/unsupported/test/openglsupport.cpp
index 065679a40..63e1b44eb 100644
--- a/unsupported/test/openglsupport.cpp
+++ b/unsupported/test/openglsupport.cpp
@@ -24,8 +24,9 @@
#include <main.h>
#include <iostream>
-#include <GL/glut.h>
+#include <GL/glew.h>
#include <Eigen/OpenGLSupport>
+#include <GL/glut.h>
using namespace Eigen;
@@ -42,6 +43,84 @@ using namespace Eigen;
VERIFY_IS_APPROX((REF).cast<float>(), m); \
}
+#define VERIFY_UNIFORM(SUFFIX,NAME,TYPE) { \
+ TYPE value; value.setRandom(); \
+ TYPE data; \
+ int loc = glGetUniformLocation(prg_id, #NAME); \
+ VERIFY((loc!=-1) && "uniform not found"); \
+ glUniform(loc,value); \
+ EIGEN_CAT(glGetUniform,SUFFIX)(prg_id,loc,data.data()); \
+ if(!value.isApprox(data)) { \
+ std::cerr << "Expected:\n" << value << "\n" << "got\n" << data << "\n\n"; \
+ } \
+ VERIFY_IS_APPROX(value, data); \
+ }
+
+#define VERIFY_UNIFORMi(NAME,TYPE) { \
+ TYPE value; value.setRandom(); \
+ TYPE data; \
+ int loc = glGetUniformLocation(prg_id, #NAME); \
+ VERIFY((loc!=-1) && "uniform not found"); \
+ glUniform(loc,value); \
+ glGetUniformiv(prg_id,loc,(GLint*)data.data()); \
+ if(!value.isApprox(data)) { \
+ std::cerr << "Expected:\n" << value << "\n" << "got\n" << data << "\n\n"; \
+ } \
+ VERIFY_IS_APPROX(value, data); \
+ }
+
+void printInfoLog(GLuint objectID)
+{
+ int infologLength, charsWritten;
+ GLchar *infoLog;
+ glGetProgramiv(objectID,GL_INFO_LOG_LENGTH, &infologLength);
+ if(infologLength > 0)
+ {
+ infoLog = new GLchar[infologLength];
+ glGetProgramInfoLog(objectID, infologLength, &charsWritten, infoLog);
+ if (charsWritten>0)
+ std::cerr << "Shader info : \n" << infoLog << std::endl;
+ delete[] infoLog;
+ }
+}
+
+GLint createShader(const char* vtx, const char* frg)
+{
+ GLint prg_id = glCreateProgram();
+ GLint vtx_id = glCreateShader(GL_VERTEX_SHADER);
+ GLint frg_id = glCreateShader(GL_FRAGMENT_SHADER);
+ GLint ok;
+
+ glShaderSource(vtx_id, 1, &vtx, 0);
+ glCompileShader(vtx_id);
+ glGetShaderiv(vtx_id,GL_COMPILE_STATUS,&ok);
+ if(!ok)
+ {
+ std::cerr << "vtx compilation failed\n";
+ }
+
+ glShaderSource(frg_id, 1, &frg, 0);
+ glCompileShader(frg_id);
+ glGetShaderiv(frg_id,GL_COMPILE_STATUS,&ok);
+ if(!ok)
+ {
+ std::cerr << "frg compilation failed\n";
+ }
+
+ glAttachShader(prg_id, vtx_id);
+ glAttachShader(prg_id, frg_id);
+ glLinkProgram(prg_id);
+ glGetProgramiv(prg_id,GL_LINK_STATUS,&ok);
+ if(!ok)
+ {
+ std::cerr << "linking failed\n";
+ }
+ printInfoLog(prg_id);
+
+ glUseProgram(prg_id);
+ return prg_id;
+}
+
void test_openglsupport()
{
int argc = 0;
@@ -52,9 +131,15 @@ void test_openglsupport()
if(glutCreateWindow("Eigen") <= 0)
{
- std::cerr << "Unable to create GLUT Window.\n";
+ std::cerr << "Error: Unable to create GLUT Window.\n";
exit(1);
}
+
+ glewExperimental = GL_TRUE;
+ if(glewInit() != GLEW_OK)
+ {
+ std::cerr << "Warning: Failed to initialize GLEW\n";
+ }
Vector3f v3f;
Matrix3f rot;
@@ -75,10 +160,10 @@ void test_openglsupport()
VERIFY_MATRIX(glMultMatrix(md44), md44);
// Quaternion
- Quaterniond qd(AngleAxisd(ei_random<double>(), Vector3d::Random()));
+ Quaterniond qd(AngleAxisd(internal::random<double>(), Vector3d::Random()));
VERIFY_MATRIX(glRotate(qd), Projective3d(qd).matrix());
- Quaternionf qf(AngleAxisf(ei_random<double>(), Vector3f::Random()));
+ Quaternionf qf(AngleAxisf(internal::random<double>(), Vector3f::Random()));
VERIFY_MATRIX(glRotate(qf), Projective3f(qf).matrix());
// 3D Transform
@@ -137,11 +222,127 @@ void test_openglsupport()
Vector3d vd3; vd3.setRandom();
VERIFY_MATRIX(glScale(vd3), Projective3d(Scaling(vd3)).matrix());
- UniformScaling<float> usf(ei_random<float>());
+ UniformScaling<float> usf(internal::random<float>());
VERIFY_MATRIX(glScale(usf), Projective3f(usf).matrix());
- UniformScaling<double> usd(ei_random<double>());
+ UniformScaling<double> usd(internal::random<double>());
VERIFY_MATRIX(glScale(usd), Projective3d(usd).matrix());
}
+ // uniform
+ {
+ const char* vtx = "void main(void) { gl_Position = gl_Vertex; }\n";
+
+ if(GLEW_VERSION_2_0)
+ {
+ #ifdef GL_VERSION_2_0
+ const char* frg = ""
+ "uniform vec2 v2f;\n"
+ "uniform vec3 v3f;\n"
+ "uniform vec4 v4f;\n"
+ "uniform ivec2 v2i;\n"
+ "uniform ivec3 v3i;\n"
+ "uniform ivec4 v4i;\n"
+ "uniform mat2 m2f;\n"
+ "uniform mat3 m3f;\n"
+ "uniform mat4 m4f;\n"
+ "void main(void) { gl_FragColor = vec4(v2f[0]+v3f[0]+v4f[0])+vec4(v2i[0]+v3i[0]+v4i[0])+vec4(m2f[0][0]+m3f[0][0]+m4f[0][0]); }\n";
+
+ GLint prg_id = createShader(vtx,frg);
+
+ VERIFY_UNIFORM(fv,v2f, Vector2f);
+ VERIFY_UNIFORM(fv,v3f, Vector3f);
+ VERIFY_UNIFORM(fv,v4f, Vector4f);
+ VERIFY_UNIFORMi(v2i, Vector2i);
+ VERIFY_UNIFORMi(v3i, Vector3i);
+ VERIFY_UNIFORMi(v4i, Vector4i);
+ VERIFY_UNIFORM(fv,m2f, Matrix2f);
+ VERIFY_UNIFORM(fv,m3f, Matrix3f);
+ VERIFY_UNIFORM(fv,m4f, Matrix4f);
+ #endif
+ }
+ else
+ std::cerr << "Warning: opengl 2.0 was not tested\n";
+
+ if(GLEW_VERSION_2_1)
+ {
+ #ifdef GL_VERSION_2_1
+ const char* frg = "#version 120\n"
+ "uniform mat2x3 m23f;\n"
+ "uniform mat3x2 m32f;\n"
+ "uniform mat2x4 m24f;\n"
+ "uniform mat4x2 m42f;\n"
+ "uniform mat3x4 m34f;\n"
+ "uniform mat4x3 m43f;\n"
+ "void main(void) { gl_FragColor = vec4(m23f[0][0]+m32f[0][0]+m24f[0][0]+m42f[0][0]+m34f[0][0]+m43f[0][0]); }\n";
+
+ GLint prg_id = createShader(vtx,frg);
+
+ typedef Matrix<float,2,3> Matrix23f;
+ typedef Matrix<float,3,2> Matrix32f;
+ typedef Matrix<float,2,4> Matrix24f;
+ typedef Matrix<float,4,2> Matrix42f;
+ typedef Matrix<float,3,4> Matrix34f;
+ typedef Matrix<float,4,3> Matrix43f;
+
+ VERIFY_UNIFORM(fv,m23f, Matrix23f);
+ VERIFY_UNIFORM(fv,m32f, Matrix32f);
+ VERIFY_UNIFORM(fv,m24f, Matrix24f);
+ VERIFY_UNIFORM(fv,m42f, Matrix42f);
+ VERIFY_UNIFORM(fv,m34f, Matrix34f);
+ VERIFY_UNIFORM(fv,m43f, Matrix43f);
+ #endif
+ }
+ else
+ std::cerr << "Warning: opengl 2.1 was not tested\n";
+
+ if(GLEW_VERSION_3_0)
+ {
+ #ifdef GL_VERSION_3_0
+ const char* frg = "#version 150\n"
+ "uniform uvec2 v2ui;\n"
+ "uniform uvec3 v3ui;\n"
+ "uniform uvec4 v4ui;\n"
+ "out vec4 data;\n"
+ "void main(void) { data = vec4(v2ui[0]+v3ui[0]+v4ui[0]); }\n";
+
+ GLint prg_id = createShader(vtx,frg);
+
+ typedef Matrix<unsigned int,2,1> Vector2ui;
+ typedef Matrix<unsigned int,3,1> Vector3ui;
+ typedef Matrix<unsigned int,4,1> Vector4ui;
+
+ VERIFY_UNIFORMi(v2ui, Vector2ui);
+ VERIFY_UNIFORMi(v3ui, Vector3ui);
+ VERIFY_UNIFORMi(v4ui, Vector4ui);
+ #endif
+ }
+ else
+ std::cerr << "Warning: opengl 3.0 was not tested\n";
+
+ if(GLEW_ARB_gpu_shader_fp64)
+ {
+ #ifdef GL_ARB_gpu_shader_fp64
+ const char* frg = "#version 150\n"
+ "uniform dvec2 v2d;\n"
+ "uniform dvec3 v3d;\n"
+ "uniform dvec4 v4d;\n"
+ "out vec4 data;\n"
+ "void main(void) { data = vec4(v2d[0]+v3d[0]+v4d[0]); }\n";
+
+ GLint prg_id = createShader(vtx,frg);
+
+ typedef Vector2d Vector2d;
+ typedef Vector3d Vector3d;
+ typedef Vector4d Vector4d;
+
+ VERIFY_UNIFORM(dv,v2d, Vector2d);
+ VERIFY_UNIFORM(dv,v3d, Vector3d);
+ VERIFY_UNIFORM(dv,v4d, Vector4d);
+ #endif
+ }
+ else
+ std::cerr << "Warning: GLEW_ARB_gpu_shader_fp64 was not tested\n";
+ }
+
}
diff --git a/unsupported/test/polynomialsolver.cpp b/unsupported/test/polynomialsolver.cpp
index f6a574a60..dd55f8b36 100644
--- a/unsupported/test/polynomialsolver.cpp
+++ b/unsupported/test/polynomialsolver.cpp
@@ -33,15 +33,17 @@
using namespace std;
+namespace Eigen {
+namespace internal {
template<int Size>
-struct ei_increment_if_fixed_size
+struct increment_if_fixed_size
{
enum {
ret = (Size == Dynamic) ? Dynamic : Size+1
};
};
-
-
+}
+}
template<int Deg, typename POLYNOMIAL, typename SOLVER>
@@ -72,7 +74,7 @@ bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve )
}
#ifdef HAS_GSL
- if (ei_is_same_type< Scalar, double>::ret)
+ if (internal::is_same< Scalar, double>::value)
{
typedef GslTraits<Scalar> Gsl;
RootsType gslRoots(deg);
@@ -104,7 +106,7 @@ bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve )
bool distinctModuli=true;
for( size_t i=1; i<rootModuli.size() && distinctModuli; ++i )
{
- if( ei_isApprox( rootModuli[i], rootModuli[i-1] ) ){
+ if( internal::isApprox( rootModuli[i], rootModuli[i-1] ) ){
distinctModuli = false; }
}
VERIFY( evalToZero || !distinctModuli );
@@ -158,51 +160,51 @@ void evalSolverSugarFunction( const POLYNOMIAL& pols, const ROOTS& roots, const
psolve.realRoots( calc_realRoots );
VERIFY( calc_realRoots.size() == (size_t)real_roots.size() );
- const Scalar psPrec = ei_sqrt( test_precision<Scalar>() );
+ const Scalar psPrec = internal::sqrt( test_precision<Scalar>() );
for( size_t i=0; i<calc_realRoots.size(); ++i )
{
bool found = false;
for( size_t j=0; j<calc_realRoots.size()&& !found; ++j )
{
- if( ei_isApprox( calc_realRoots[i], real_roots[j] ), psPrec ){
+ if( internal::isApprox( calc_realRoots[i], real_roots[j] ), psPrec ){
found = true; }
}
VERIFY( found );
}
//Test greatestRoot
- VERIFY( ei_isApprox( roots.array().abs().maxCoeff(),
- ei_abs( psolve.greatestRoot() ), psPrec ) );
+ VERIFY( internal::isApprox( roots.array().abs().maxCoeff(),
+ internal::abs( psolve.greatestRoot() ), psPrec ) );
//Test smallestRoot
- VERIFY( ei_isApprox( roots.array().abs().minCoeff(),
- ei_abs( psolve.smallestRoot() ), psPrec ) );
+ VERIFY( internal::isApprox( roots.array().abs().minCoeff(),
+ internal::abs( psolve.smallestRoot() ), psPrec ) );
bool hasRealRoot;
//Test absGreatestRealRoot
Real r = psolve.absGreatestRealRoot( hasRealRoot );
VERIFY( hasRealRoot == (real_roots.size() > 0 ) );
if( hasRealRoot ){
- VERIFY( ei_isApprox( real_roots.array().abs().maxCoeff(), ei_abs(r), psPrec ) ); }
+ VERIFY( internal::isApprox( real_roots.array().abs().maxCoeff(), internal::abs(r), psPrec ) ); }
//Test absSmallestRealRoot
r = psolve.absSmallestRealRoot( hasRealRoot );
VERIFY( hasRealRoot == (real_roots.size() > 0 ) );
if( hasRealRoot ){
- VERIFY( ei_isApprox( real_roots.array().abs().minCoeff(), ei_abs( r ), psPrec ) ); }
+ VERIFY( internal::isApprox( real_roots.array().abs().minCoeff(), internal::abs( r ), psPrec ) ); }
//Test greatestRealRoot
r = psolve.greatestRealRoot( hasRealRoot );
VERIFY( hasRealRoot == (real_roots.size() > 0 ) );
if( hasRealRoot ){
- VERIFY( ei_isApprox( real_roots.array().maxCoeff(), r, psPrec ) ); }
+ VERIFY( internal::isApprox( real_roots.array().maxCoeff(), r, psPrec ) ); }
//Test smallestRealRoot
r = psolve.smallestRealRoot( hasRealRoot );
VERIFY( hasRealRoot == (real_roots.size() > 0 ) );
if( hasRealRoot ){
- VERIFY( ei_isApprox( real_roots.array().minCoeff(), r, psPrec ) ); }
+ VERIFY( internal::isApprox( real_roots.array().minCoeff(), r, psPrec ) ); }
}
}
@@ -210,7 +212,7 @@ void evalSolverSugarFunction( const POLYNOMIAL& pols, const ROOTS& roots, const
template<typename _Scalar, int _Deg>
void polynomialsolver(int deg)
{
- typedef ei_increment_if_fixed_size<_Deg> Dim;
+ typedef internal::increment_if_fixed_size<_Deg> Dim;
typedef Matrix<_Scalar,Dim::ret,1> PolynomialType;
typedef Matrix<_Scalar,_Deg,1> EvalRootsType;
@@ -219,7 +221,7 @@ void polynomialsolver(int deg)
evalSolver<_Deg,PolynomialType>( pols );
cout << "Hard cases" << endl;
- _Scalar multipleRoot = ei_random<_Scalar>();
+ _Scalar multipleRoot = internal::random<_Scalar>();
EvalRootsType allRoots = EvalRootsType::Constant(deg,multipleRoot);
roots_to_monicPolynomial( allRoots, pols );
evalSolver<_Deg,PolynomialType>( pols );
@@ -237,28 +239,24 @@ void polynomialsolver(int deg)
realRoots );
}
-
-template<typename _Scalar> void polynomialsolver_scalar()
-{
- CALL_SUBTEST_1( (polynomialsolver<_Scalar,1>(1)) );
- CALL_SUBTEST_2( (polynomialsolver<_Scalar,2>(2)) );
- CALL_SUBTEST_3( (polynomialsolver<_Scalar,3>(3)) );
- CALL_SUBTEST_4( (polynomialsolver<_Scalar,4>(4)) );
- CALL_SUBTEST_5( (polynomialsolver<_Scalar,5>(5)) );
- CALL_SUBTEST_6( (polynomialsolver<_Scalar,6>(6)) );
- CALL_SUBTEST_7( (polynomialsolver<_Scalar,7>(7)) );
- CALL_SUBTEST_8( (polynomialsolver<_Scalar,8>(8)) );
-
- CALL_SUBTEST_9( (polynomialsolver<_Scalar,Dynamic>(
- ei_random<int>(9,45)
- )) );
-}
-
void test_polynomialsolver()
{
for(int i = 0; i < g_repeat; i++)
{
- polynomialsolver_scalar<double>();
- polynomialsolver_scalar<float>();
+ CALL_SUBTEST_1( (polynomialsolver<float,1>(1)) );
+ CALL_SUBTEST_2( (polynomialsolver<double,2>(2)) );
+ CALL_SUBTEST_3( (polynomialsolver<double,3>(3)) );
+ CALL_SUBTEST_4( (polynomialsolver<float,4>(4)) );
+ CALL_SUBTEST_5( (polynomialsolver<double,5>(5)) );
+ CALL_SUBTEST_6( (polynomialsolver<float,6>(6)) );
+ CALL_SUBTEST_7( (polynomialsolver<float,7>(7)) );
+ CALL_SUBTEST_8( (polynomialsolver<double,8>(8)) );
+
+ CALL_SUBTEST_9( (polynomialsolver<float,Dynamic>(
+ internal::random<int>(9,45)
+ )) );
+ CALL_SUBTEST_10((polynomialsolver<double,Dynamic>(
+ internal::random<int>(9,45)
+ )) );
}
}
diff --git a/unsupported/test/polynomialutils.cpp b/unsupported/test/polynomialutils.cpp
index 7f93c2f0d..7ff913c37 100644
--- a/unsupported/test/polynomialutils.cpp
+++ b/unsupported/test/polynomialutils.cpp
@@ -28,18 +28,22 @@
using namespace std;
+namespace Eigen {
+namespace internal {
template<int Size>
-struct ei_increment_if_fixed_size
+struct increment_if_fixed_size
{
enum {
ret = (Size == Dynamic) ? Dynamic : Size+1
};
};
+}
+}
template<typename _Scalar, int _Deg>
void realRoots_to_monicPolynomial_test(int deg)
{
- typedef ei_increment_if_fixed_size<_Deg> Dim;
+ typedef internal::increment_if_fixed_size<_Deg> Dim;
typedef Matrix<_Scalar,Dim::ret,1> PolynomialType;
typedef Matrix<_Scalar,_Deg,1> EvalRootsType;
@@ -68,7 +72,7 @@ template<typename _Scalar> void realRoots_to_monicPolynomial_scalar()
CALL_SUBTEST_8( (realRoots_to_monicPolynomial_test<_Scalar,17>(17)) );
CALL_SUBTEST_9( (realRoots_to_monicPolynomial_test<_Scalar,Dynamic>(
- ei_random<int>(18,26) )) );
+ internal::random<int>(18,26) )) );
}
@@ -77,7 +81,7 @@ template<typename _Scalar> void realRoots_to_monicPolynomial_scalar()
template<typename _Scalar, int _Deg>
void CauchyBounds(int deg)
{
- typedef ei_increment_if_fixed_size<_Deg> Dim;
+ typedef internal::increment_if_fixed_size<_Deg> Dim;
typedef Matrix<_Scalar,Dim::ret,1> PolynomialType;
typedef Matrix<_Scalar,_Deg,1> EvalRootsType;
@@ -109,7 +113,7 @@ template<typename _Scalar> void CauchyBounds_scalar()
CALL_SUBTEST_8( (CauchyBounds<_Scalar,17>(17)) );
CALL_SUBTEST_9( (CauchyBounds<_Scalar,Dynamic>(
- ei_random<int>(18,26) )) );
+ internal::random<int>(18,26) )) );
}
void test_polynomialutils()
diff --git a/unsupported/test/sparse_extra.cpp b/unsupported/test/sparse_extra.cpp
index 6cf1f50c4..a004995f6 100644
--- a/unsupported/test/sparse_extra.cpp
+++ b/unsupported/test/sparse_extra.cpp
@@ -35,7 +35,7 @@ bool test_random_setter(SparseMatrix<Scalar,Options>& sm, const DenseType& ref,
std::vector<Vector2i> remaining = nonzeroCoords;
while(!remaining.empty())
{
- int i = ei_random<int>(0,static_cast<int>(remaining.size())-1);
+ int i = internal::random<int>(0,static_cast<int>(remaining.size())-1);
w(remaining[i].x(),remaining[i].y()) = ref.coeff(remaining[i].x(),remaining[i].y());
remaining[i] = remaining.back();
remaining.pop_back();
@@ -51,7 +51,7 @@ bool test_random_setter(DynamicSparseMatrix<T>& sm, const DenseType& ref, const
std::vector<Vector2i> remaining = nonzeroCoords;
while(!remaining.empty())
{
- int i = ei_random<int>(0,static_cast<int>(remaining.size())-1);
+ int i = internal::random<int>(0,static_cast<int>(remaining.size())-1);
sm.coeffRef(remaining[i].x(),remaining[i].y()) = ref.coeff(remaining[i].x(),remaining[i].y());
remaining[i] = remaining.back();
remaining.pop_back();
@@ -87,7 +87,7 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& re
for (int i=0; i<(int)zeroCoords.size(); ++i)
{
VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps );
- if(ei_is_same_type<SparseMatrixType,SparseMatrix<Scalar,Flags> >::ret)
+ if(internal::is_same<SparseMatrixType,SparseMatrix<Scalar,Flags> >::value)
VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[0].x(),zeroCoords[0].y()) = 5 );
}
VERIFY_IS_APPROX(m, refMat);
@@ -105,7 +105,7 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& re
// std::vector<Vector2i> remaining = nonzeroCoords;
// while(!remaining.empty())
// {
-// int i = ei_random<int>(0,remaining.size()-1);
+// int i = internal::random<int>(0,remaining.size()-1);
// w->coeffRef(remaining[i].x(),remaining[i].y()) = refMat.coeff(remaining[i].x(),remaining[i].y());
// remaining[i] = remaining.back();
// remaining.pop_back();
diff --git a/unsupported/test/sparse_ldlt.cpp b/unsupported/test/sparse_ldlt.cpp
index 5af4b77b4..275839670 100644
--- a/unsupported/test/sparse_ldlt.cpp
+++ b/unsupported/test/sparse_ldlt.cpp
@@ -43,7 +43,7 @@ template<typename Scalar> void sparse_ldlt(int rows, int cols)
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeUpperTriangular, 0, 0);
for(int i=0; i<rows; ++i)
- m2.coeffRef(i,i) = refMat2(i,i) = ei_abs(ei_real(refMat2(i,i)));
+ m2.coeffRef(i,i) = refMat2(i,i) = internal::abs(internal::real(refMat2(i,i)));
refX = refMat2.template selfadjointView<Upper>().ldlt().solve(b);
typedef SparseMatrix<Scalar,Upper|SelfAdjoint> SparseSelfAdjointMatrix;
@@ -85,7 +85,7 @@ void test_sparse_ldlt()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1(sparse_ldlt<double>(8, 8) );
- int s = ei_random<int>(1,300);
+ int s = internal::random<int>(1,300);
CALL_SUBTEST_2(sparse_ldlt<std::complex<double> >(s,s) );
CALL_SUBTEST_1(sparse_ldlt<double>(s,s) );
}
diff --git a/unsupported/test/sparse_llt.cpp b/unsupported/test/sparse_llt.cpp
index 72a8382a1..2fcd8b279 100644
--- a/unsupported/test/sparse_llt.cpp
+++ b/unsupported/test/sparse_llt.cpp
@@ -40,35 +40,87 @@ template<typename Scalar> void sparse_llt(int rows, int cols)
DenseMatrix refMat2(rows, cols);
DenseVector b = DenseVector::Random(cols);
- DenseVector refX(cols), x(cols);
+ DenseVector ref_x(cols), x(cols);
+ DenseMatrix B = DenseMatrix::Random(rows,cols);
+ DenseMatrix ref_X(rows,cols), X(rows,cols);
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, 0, 0);
for(int i=0; i<rows; ++i)
- m2.coeffRef(i,i) = refMat2(i,i) = ei_abs(ei_real(refMat2(i,i)));
+ m2.coeffRef(i,i) = refMat2(i,i) = internal::abs(internal::real(refMat2(i,i)));
- refX = refMat2.template selfadjointView<Lower>().llt().solve(b);
+ ref_x = refMat2.template selfadjointView<Lower>().llt().solve(b);
if (!NumTraits<Scalar>::IsComplex)
{
x = b;
SparseLLT<SparseMatrix<Scalar> > (m2).solveInPlace(x);
- VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LLT: default");
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT: default");
}
#ifdef EIGEN_CHOLMOD_SUPPORT
+ // legacy API
{
// Cholmod, as configured in CholmodSupport.h, only supports self-adjoint matrices
SparseMatrix<Scalar> m3 = m2.adjoint()*m2;
DenseMatrix refMat3 = refMat2.adjoint()*refMat2;
- refX = refMat3.template selfadjointView<Lower>().llt().solve(b);
+ ref_x = refMat3.template selfadjointView<Lower>().llt().solve(b);
x = b;
SparseLLT<SparseMatrix<Scalar>, Cholmod>(m3).solveInPlace(x);
- VERIFY((m3*x).isApprox(b,test_precision<Scalar>()) && "LLT: cholmod solveInPlace");
+ VERIFY((m3*x).isApprox(b,test_precision<Scalar>()) && "LLT legacy: cholmod solveInPlace");
x = SparseLLT<SparseMatrix<Scalar>, Cholmod>(m3).solve(b);
- VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LLT: cholmod solve");
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT legacy: cholmod solve");
+ }
+
+ // new API
+ {
+ // Cholmod, as configured in CholmodSupport.h, only supports self-adjoint matrices
+ SparseMatrix<Scalar> m3 = m2 * m2.adjoint(), m3_lo(rows,rows), m3_up(rows,rows);
+ DenseMatrix refMat3 = refMat2 * refMat2.adjoint();
+
+ m3_lo.template selfadjointView<Lower>().rankUpdate(m2,0);
+ m3_up.template selfadjointView<Upper>().rankUpdate(m2,0);
+
+ // with a single vector as the rhs
+ ref_x = refMat3.template selfadjointView<Lower>().llt().solve(b);
+
+ x = CholmodDecomposition<SparseMatrix<Scalar>, Lower>(m3).solve(b);
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT: cholmod solve, single dense rhs");
+
+ x = CholmodDecomposition<SparseMatrix<Scalar>, Upper>(m3).solve(b);
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT: cholmod solve, single dense rhs");
+
+ x = CholmodDecomposition<SparseMatrix<Scalar>, Lower>(m3_lo).solve(b);
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT: cholmod solve, single dense rhs");
+
+ x = CholmodDecomposition<SparseMatrix<Scalar>, Upper>(m3_up).solve(b);
+ VERIFY(ref_x.isApprox(x,test_precision<Scalar>()) && "LLT: cholmod solve, single dense rhs");
+
+
+ // with multiple rhs
+ ref_X = refMat3.template selfadjointView<Lower>().llt().solve(B);
+
+ X = CholmodDecomposition<SparseMatrix<Scalar>, Lower>(m3).solve(B);
+ VERIFY(ref_X.isApprox(X,test_precision<Scalar>()) && "LLT: cholmod solve, multiple dense rhs");
+
+ X = CholmodDecomposition<SparseMatrix<Scalar>, Upper>(m3).solve(B);
+ VERIFY(ref_X.isApprox(X,test_precision<Scalar>()) && "LLT: cholmod solve, multiple dense rhs");
+
+
+ // with a sparse rhs
+ SparseMatrix<Scalar> spB(rows,cols), spX(rows,cols);
+ B.diagonal().array() += 1;
+ spB = B.sparseView(0.5,1);
+
+ ref_X = refMat3.template selfadjointView<Lower>().llt().solve(DenseMatrix(spB));
+
+ spX = CholmodDecomposition<SparseMatrix<Scalar>, Lower>(m3).solve(spB);
+ VERIFY(ref_X.isApprox(spX.toDense(),test_precision<Scalar>()) && "LLT: cholmod solve, multiple sparse rhs");
+
+ spX = CholmodDecomposition<SparseMatrix<Scalar>, Upper>(m3).solve(spB);
+ VERIFY(ref_X.isApprox(spX.toDense(),test_precision<Scalar>()) && "LLT: cholmod solve, multiple sparse rhs");
}
#endif
@@ -78,7 +130,7 @@ void test_sparse_llt()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1(sparse_llt<double>(8, 8) );
- int s = ei_random<int>(1,300);
+ int s = internal::random<int>(1,300);
CALL_SUBTEST_2(sparse_llt<std::complex<double> >(s,s) );
CALL_SUBTEST_1(sparse_llt<double>(s,s) );
}
diff --git a/unsupported/test/sparse_lu.cpp b/unsupported/test/sparse_lu.cpp
index 75aa7a924..e693499bb 100644
--- a/unsupported/test/sparse_lu.cpp
+++ b/unsupported/test/sparse_lu.cpp
@@ -109,7 +109,7 @@ void test_sparse_lu()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1(sparse_lu<double>(8, 8) );
- int s = ei_random<int>(1,300);
+ int s = internal::random<int>(1,300);
CALL_SUBTEST_2(sparse_lu<std::complex<double> >(s,s) );
CALL_SUBTEST_1(sparse_lu<double>(s,s) );
}