From d6b96ce14ff4cd6cad7de538827fb727f91de6c9 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 21 Oct 2024 16:42:03 -0400 Subject: [PATCH] eigen because im a pussy --- .gitignore | 6 + .gitmodules | 3 + .idea/.gitignore | 8 + .idea/COSC-4P80-Assignment-2.iml | 2 + .idea/misc.xml | 7 + .idea/modules.xml | 8 + .idea/vcs.xml | 8 + CMakeLists.txt | 42 + commit.py | 285 + data/L30fft1000.out | 54 + data/L30fft150.out | 54 + data/L30fft16.out | 54 + data/L30fft25.out | 54 + data/L30fft_32.out | 55 + data/L30fft_64.out | 55 + include/assign2/common.h | 36 + include/assign2/layer.h | 54 + lib/blt | 1 + lib/eigen-3.4.0/.gitignore | 38 + lib/eigen-3.4.0/.gitlab-ci.yml | 23 + .../.gitlab/issue_templates/Bug Report.md | 69 + .../issue_templates/Feature Request.md | 7 + .../Merge Request Template.md | 26 + lib/eigen-3.4.0/.hgeol | 11 + lib/eigen-3.4.0/CMakeLists.txt | 653 + lib/eigen-3.4.0/COPYING.APACHE | 203 + lib/eigen-3.4.0/COPYING.BSD | 26 + lib/eigen-3.4.0/COPYING.GPL | 674 + lib/eigen-3.4.0/COPYING.LGPL | 502 + lib/eigen-3.4.0/COPYING.MINPACK | 51 + lib/eigen-3.4.0/COPYING.MPL2 | 373 + lib/eigen-3.4.0/COPYING.README | 18 + lib/eigen-3.4.0/CTestConfig.cmake | 17 + lib/eigen-3.4.0/CTestCustom.cmake.in | 4 + lib/eigen-3.4.0/Eigen/Cholesky | 45 + lib/eigen-3.4.0/Eigen/CholmodSupport | 48 + lib/eigen-3.4.0/Eigen/Core | 384 + lib/eigen-3.4.0/Eigen/Dense | 7 + lib/eigen-3.4.0/Eigen/Eigen | 2 + lib/eigen-3.4.0/Eigen/Eigenvalues | 60 + lib/eigen-3.4.0/Eigen/Geometry | 59 + lib/eigen-3.4.0/Eigen/Householder | 29 + lib/eigen-3.4.0/Eigen/IterativeLinearSolvers | 48 + lib/eigen-3.4.0/Eigen/Jacobi | 32 + lib/eigen-3.4.0/Eigen/KLUSupport | 41 + lib/eigen-3.4.0/Eigen/LU | 47 + lib/eigen-3.4.0/Eigen/MetisSupport | 35 + lib/eigen-3.4.0/Eigen/OrderingMethods | 70 + lib/eigen-3.4.0/Eigen/PaStiXSupport | 49 + lib/eigen-3.4.0/Eigen/PardisoSupport | 35 + lib/eigen-3.4.0/Eigen/QR | 50 + lib/eigen-3.4.0/Eigen/QtAlignedMalloc | 39 + lib/eigen-3.4.0/Eigen/SPQRSupport | 34 + lib/eigen-3.4.0/Eigen/SVD | 50 + lib/eigen-3.4.0/Eigen/Sparse | 34 + lib/eigen-3.4.0/Eigen/SparseCholesky | 37 + lib/eigen-3.4.0/Eigen/SparseCore | 69 + lib/eigen-3.4.0/Eigen/SparseLU | 50 + lib/eigen-3.4.0/Eigen/SparseQR | 36 + lib/eigen-3.4.0/Eigen/StdDeque | 27 + lib/eigen-3.4.0/Eigen/StdList | 26 + lib/eigen-3.4.0/Eigen/StdVector | 27 + lib/eigen-3.4.0/Eigen/SuperLUSupport | 64 + lib/eigen-3.4.0/Eigen/UmfPackSupport | 40 + lib/eigen-3.4.0/Eigen/src/Cholesky/LDLT.h | 688 + lib/eigen-3.4.0/Eigen/src/Cholesky/LLT.h | 558 + .../Eigen/src/Cholesky/LLT_LAPACKE.h | 99 + .../Eigen/src/CholmodSupport/CholmodSupport.h | 682 + .../Eigen/src/Core/ArithmeticSequence.h | 413 + lib/eigen-3.4.0/Eigen/src/Core/Array.h | 417 + lib/eigen-3.4.0/Eigen/src/Core/ArrayBase.h | 226 + lib/eigen-3.4.0/Eigen/src/Core/ArrayWrapper.h | 209 + lib/eigen-3.4.0/Eigen/src/Core/Assign.h | 90 + .../Eigen/src/Core/AssignEvaluator.h | 1010 + lib/eigen-3.4.0/Eigen/src/Core/Assign_MKL.h | 178 + lib/eigen-3.4.0/Eigen/src/Core/BandMatrix.h | 353 + lib/eigen-3.4.0/Eigen/src/Core/Block.h | 448 + lib/eigen-3.4.0/Eigen/src/Core/BooleanRedux.h | 162 + .../Eigen/src/Core/CommaInitializer.h | 164 + .../Eigen/src/Core/ConditionEstimator.h | 175 + .../Eigen/src/Core/CoreEvaluators.h | 1741 ++ .../Eigen/src/Core/CoreIterators.h | 132 + .../Eigen/src/Core/CwiseBinaryOp.h | 183 + .../Eigen/src/Core/CwiseNullaryOp.h | 1001 + .../Eigen/src/Core/CwiseTernaryOp.h | 197 + lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryOp.h | 103 + .../Eigen/src/Core/CwiseUnaryView.h | 132 + lib/eigen-3.4.0/Eigen/src/Core/DenseBase.h | 701 + .../Eigen/src/Core/DenseCoeffsBase.h | 685 + lib/eigen-3.4.0/Eigen/src/Core/DenseStorage.h | 652 + lib/eigen-3.4.0/Eigen/src/Core/Diagonal.h | 258 + .../Eigen/src/Core/DiagonalMatrix.h | 391 + .../Eigen/src/Core/DiagonalProduct.h | 28 + lib/eigen-3.4.0/Eigen/src/Core/Dot.h | 318 + lib/eigen-3.4.0/Eigen/src/Core/EigenBase.h | 160 + .../Eigen/src/Core/ForceAlignedAccess.h | 150 + lib/eigen-3.4.0/Eigen/src/Core/Fuzzy.h | 155 + .../Eigen/src/Core/GeneralProduct.h | 465 + .../Eigen/src/Core/GenericPacketMath.h | 1040 + .../Eigen/src/Core/GlobalFunctions.h | 194 + lib/eigen-3.4.0/Eigen/src/Core/IO.h | 258 + lib/eigen-3.4.0/Eigen/src/Core/IndexedView.h | 237 + lib/eigen-3.4.0/Eigen/src/Core/Inverse.h | 117 + lib/eigen-3.4.0/Eigen/src/Core/Map.h | 171 + lib/eigen-3.4.0/Eigen/src/Core/MapBase.h | 310 + .../Eigen/src/Core/MathFunctions.h | 2057 ++ .../Eigen/src/Core/MathFunctionsImpl.h | 200 + lib/eigen-3.4.0/Eigen/src/Core/Matrix.h | 565 + lib/eigen-3.4.0/Eigen/src/Core/MatrixBase.h | 547 + lib/eigen-3.4.0/Eigen/src/Core/NestByValue.h | 85 + lib/eigen-3.4.0/Eigen/src/Core/NoAlias.h | 109 + lib/eigen-3.4.0/Eigen/src/Core/NumTraits.h | 335 + .../Eigen/src/Core/PartialReduxEvaluator.h | 232 + .../Eigen/src/Core/PermutationMatrix.h | 605 + .../Eigen/src/Core/PlainObjectBase.h | 1128 ++ lib/eigen-3.4.0/Eigen/src/Core/Product.h | 191 + .../Eigen/src/Core/ProductEvaluators.h | 1179 ++ lib/eigen-3.4.0/Eigen/src/Core/Random.h | 218 + lib/eigen-3.4.0/Eigen/src/Core/Redux.h | 515 + lib/eigen-3.4.0/Eigen/src/Core/Ref.h | 381 + lib/eigen-3.4.0/Eigen/src/Core/Replicate.h | 142 + lib/eigen-3.4.0/Eigen/src/Core/Reshaped.h | 454 + .../Eigen/src/Core/ReturnByValue.h | 119 + lib/eigen-3.4.0/Eigen/src/Core/Reverse.h | 217 + lib/eigen-3.4.0/Eigen/src/Core/Select.h | 164 + .../Eigen/src/Core/SelfAdjointView.h | 365 + .../Eigen/src/Core/SelfCwiseBinaryOp.h | 47 + lib/eigen-3.4.0/Eigen/src/Core/Solve.h | 188 + .../Eigen/src/Core/SolveTriangular.h | 235 + lib/eigen-3.4.0/Eigen/src/Core/SolverBase.h | 168 + lib/eigen-3.4.0/Eigen/src/Core/StableNorm.h | 251 + lib/eigen-3.4.0/Eigen/src/Core/StlIterators.h | 463 + lib/eigen-3.4.0/Eigen/src/Core/Stride.h | 116 + lib/eigen-3.4.0/Eigen/src/Core/Swap.h | 68 + lib/eigen-3.4.0/Eigen/src/Core/Transpose.h | 464 + .../Eigen/src/Core/Transpositions.h | 386 + .../Eigen/src/Core/TriangularMatrix.h | 1001 + lib/eigen-3.4.0/Eigen/src/Core/VectorBlock.h | 96 + lib/eigen-3.4.0/Eigen/src/Core/VectorwiseOp.h | 784 + lib/eigen-3.4.0/Eigen/src/Core/Visitor.h | 381 + .../Eigen/src/Core/arch/AVX/Complex.h | 372 + .../Eigen/src/Core/arch/AVX/MathFunctions.h | 228 + .../Eigen/src/Core/arch/AVX/PacketMath.h | 1574 ++ .../Eigen/src/Core/arch/AVX/TypeCasting.h | 115 + .../Eigen/src/Core/arch/AVX512/Complex.h | 422 + .../src/Core/arch/AVX512/MathFunctions.h | 362 + .../Eigen/src/Core/arch/AVX512/PacketMath.h | 2303 +++ .../Eigen/src/Core/arch/AVX512/TypeCasting.h | 89 + .../Eigen/src/Core/arch/AltiVec/Complex.h | 417 + .../src/Core/arch/AltiVec/MathFunctions.h | 90 + .../src/Core/arch/AltiVec/MatrixProduct.h | 2937 +++ .../Core/arch/AltiVec/MatrixProductCommon.h | 221 + .../src/Core/arch/AltiVec/MatrixProductMMA.h | 629 + .../Eigen/src/Core/arch/AltiVec/PacketMath.h | 2711 +++ .../Eigen/src/Core/arch/CUDA/Complex.h | 258 + .../Eigen/src/Core/arch/Default/BFloat16.h | 700 + .../Eigen/src/Core/arch/Default/ConjHelper.h | 117 + .../arch/Default/GenericPacketMathFunctions.h | 1649 ++ .../Default/GenericPacketMathFunctionsFwd.h | 110 + .../Eigen/src/Core/arch/Default/Half.h | 942 + .../Eigen/src/Core/arch/Default/Settings.h | 49 + .../Eigen/src/Core/arch/Default/TypeCasting.h | 120 + .../Eigen/src/Core/arch/GPU/MathFunctions.h | 103 + .../Eigen/src/Core/arch/GPU/PacketMath.h | 1685 ++ .../Eigen/src/Core/arch/GPU/TypeCasting.h | 80 + .../src/Core/arch/HIP/hcc/math_constants.h | 23 + .../Eigen/src/Core/arch/MSA/Complex.h | 648 + .../Eigen/src/Core/arch/MSA/MathFunctions.h | 387 + .../Eigen/src/Core/arch/MSA/PacketMath.h | 1233 ++ .../Eigen/src/Core/arch/NEON/Complex.h | 584 + .../Core/arch/NEON/GeneralBlockPanelKernel.h | 183 + .../Eigen/src/Core/arch/NEON/MathFunctions.h | 75 + .../Eigen/src/Core/arch/NEON/PacketMath.h | 4587 +++++ .../Eigen/src/Core/arch/NEON/TypeCasting.h | 1419 ++ .../Eigen/src/Core/arch/SSE/Complex.h | 351 + .../Eigen/src/Core/arch/SSE/MathFunctions.h | 199 + .../Eigen/src/Core/arch/SSE/PacketMath.h | 1505 ++ .../Eigen/src/Core/arch/SSE/TypeCasting.h | 142 + .../Eigen/src/Core/arch/SVE/MathFunctions.h | 44 + .../Eigen/src/Core/arch/SVE/PacketMath.h | 752 + .../Eigen/src/Core/arch/SVE/TypeCasting.h | 49 + .../Eigen/src/Core/arch/SYCL/InteropHeaders.h | 232 + .../Eigen/src/Core/arch/SYCL/MathFunctions.h | 301 + .../Eigen/src/Core/arch/SYCL/PacketMath.h | 670 + .../src/Core/arch/SYCL/SyclMemoryModel.h | 694 + .../Eigen/src/Core/arch/SYCL/TypeCasting.h | 85 + .../Eigen/src/Core/arch/ZVector/Complex.h | 426 + .../src/Core/arch/ZVector/MathFunctions.h | 233 + .../Eigen/src/Core/arch/ZVector/PacketMath.h | 1060 + .../src/Core/functors/AssignmentFunctors.h | 177 + .../Eigen/src/Core/functors/BinaryFunctors.h | 541 + .../Eigen/src/Core/functors/NullaryFunctors.h | 189 + .../Eigen/src/Core/functors/StlFunctors.h | 166 + .../Eigen/src/Core/functors/TernaryFunctors.h | 25 + .../Eigen/src/Core/functors/UnaryFunctors.h | 1131 ++ .../Core/products/GeneralBlockPanelKernel.h | 2645 +++ .../src/Core/products/GeneralMatrixMatrix.h | 517 + .../products/GeneralMatrixMatrixTriangular.h | 317 + .../GeneralMatrixMatrixTriangular_BLAS.h | 145 + .../Core/products/GeneralMatrixMatrix_BLAS.h | 124 + .../src/Core/products/GeneralMatrixVector.h | 518 + .../Core/products/GeneralMatrixVector_BLAS.h | 136 + .../Eigen/src/Core/products/Parallelizer.h | 180 + .../Core/products/SelfadjointMatrixMatrix.h | 544 + .../products/SelfadjointMatrixMatrix_BLAS.h | 295 + .../Core/products/SelfadjointMatrixVector.h | 262 + .../products/SelfadjointMatrixVector_BLAS.h | 118 + .../src/Core/products/SelfadjointProduct.h | 133 + .../Core/products/SelfadjointRank2Update.h | 94 + .../Core/products/TriangularMatrixMatrix.h | 472 + .../products/TriangularMatrixMatrix_BLAS.h | 317 + .../Core/products/TriangularMatrixVector.h | 350 + .../products/TriangularMatrixVector_BLAS.h | 255 + .../Core/products/TriangularSolverMatrix.h | 337 + .../products/TriangularSolverMatrix_BLAS.h | 167 + .../Core/products/TriangularSolverVector.h | 148 + .../Eigen/src/Core/util/BlasUtil.h | 583 + .../src/Core/util/ConfigureVectorization.h | 512 + .../Eigen/src/Core/util/Constants.h | 563 + .../src/Core/util/DisableStupidWarnings.h | 106 + .../Eigen/src/Core/util/ForwardDeclarations.h | 322 + .../Eigen/src/Core/util/IndexedViewHelper.h | 186 + .../Eigen/src/Core/util/IntegralConstant.h | 272 + .../Eigen/src/Core/util/MKL_support.h | 137 + lib/eigen-3.4.0/Eigen/src/Core/util/Macros.h | 1464 ++ lib/eigen-3.4.0/Eigen/src/Core/util/Memory.h | 1163 ++ lib/eigen-3.4.0/Eigen/src/Core/util/Meta.h | 812 + lib/eigen-3.4.0/Eigen/src/Core/util/NonMPL2.h | 3 + .../src/Core/util/ReenableStupidWarnings.h | 31 + .../Eigen/src/Core/util/ReshapedHelper.h | 51 + .../Eigen/src/Core/util/StaticAssert.h | 221 + .../Eigen/src/Core/util/SymbolicIndex.h | 293 + .../Eigen/src/Core/util/XprHelper.h | 856 + .../src/Eigenvalues/ComplexEigenSolver.h | 346 + .../Eigen/src/Eigenvalues/ComplexSchur.h | 462 + .../src/Eigenvalues/ComplexSchur_LAPACKE.h | 91 + .../Eigen/src/Eigenvalues/EigenSolver.h | 622 + .../src/Eigenvalues/GeneralizedEigenSolver.h | 418 + .../GeneralizedSelfAdjointEigenSolver.h | 226 + .../src/Eigenvalues/HessenbergDecomposition.h | 374 + .../src/Eigenvalues/MatrixBaseEigenvalues.h | 158 + .../Eigen/src/Eigenvalues/RealQZ.h | 657 + .../Eigen/src/Eigenvalues/RealSchur.h | 558 + .../Eigen/src/Eigenvalues/RealSchur_LAPACKE.h | 77 + .../src/Eigenvalues/SelfAdjointEigenSolver.h | 904 + .../SelfAdjointEigenSolver_LAPACKE.h | 87 + .../src/Eigenvalues/Tridiagonalization.h | 561 + .../Eigen/src/Geometry/AlignedBox.h | 486 + .../Eigen/src/Geometry/AngleAxis.h | 247 + .../Eigen/src/Geometry/EulerAngles.h | 114 + .../Eigen/src/Geometry/Homogeneous.h | 501 + .../Eigen/src/Geometry/Hyperplane.h | 282 + .../Eigen/src/Geometry/OrthoMethods.h | 235 + .../Eigen/src/Geometry/ParametrizedLine.h | 232 + .../Eigen/src/Geometry/Quaternion.h | 870 + .../Eigen/src/Geometry/Rotation2D.h | 199 + .../Eigen/src/Geometry/RotationBase.h | 206 + lib/eigen-3.4.0/Eigen/src/Geometry/Scaling.h | 188 + .../Eigen/src/Geometry/Transform.h | 1563 ++ .../Eigen/src/Geometry/Translation.h | 202 + lib/eigen-3.4.0/Eigen/src/Geometry/Umeyama.h | 166 + .../Eigen/src/Geometry/arch/Geometry_SIMD.h | 168 + .../Eigen/src/Householder/BlockHouseholder.h | 110 + .../Eigen/src/Householder/Householder.h | 176 + .../src/Householder/HouseholderSequence.h | 545 + .../BasicPreconditioners.h | 226 + .../src/IterativeLinearSolvers/BiCGSTAB.h | 212 + .../ConjugateGradient.h | 229 + .../IncompleteCholesky.h | 394 + .../IterativeLinearSolvers/IncompleteLUT.h | 453 + .../IterativeSolverBase.h | 444 + .../LeastSquareConjugateGradient.h | 198 + .../IterativeLinearSolvers/SolveWithGuess.h | 117 + lib/eigen-3.4.0/Eigen/src/Jacobi/Jacobi.h | 483 + .../Eigen/src/KLUSupport/KLUSupport.h | 358 + lib/eigen-3.4.0/Eigen/src/LU/Determinant.h | 117 + lib/eigen-3.4.0/Eigen/src/LU/FullPivLU.h | 877 + lib/eigen-3.4.0/Eigen/src/LU/InverseImpl.h | 432 + lib/eigen-3.4.0/Eigen/src/LU/PartialPivLU.h | 624 + .../Eigen/src/LU/PartialPivLU_LAPACKE.h | 83 + .../Eigen/src/LU/arch/InverseSize4.h | 351 + .../Eigen/src/MetisSupport/MetisSupport.h | 137 + .../Eigen/src/OrderingMethods/Amd.h | 435 + .../Eigen/src/OrderingMethods/Eigen_Colamd.h | 1863 ++ .../Eigen/src/OrderingMethods/Ordering.h | 153 + .../Eigen/src/PaStiXSupport/PaStiXSupport.h | 678 + .../Eigen/src/PardisoSupport/PardisoSupport.h | 545 + .../Eigen/src/QR/ColPivHouseholderQR.h | 674 + .../src/QR/ColPivHouseholderQR_LAPACKE.h | 97 + .../src/QR/CompleteOrthogonalDecomposition.h | 635 + .../Eigen/src/QR/FullPivHouseholderQR.h | 713 + lib/eigen-3.4.0/Eigen/src/QR/HouseholderQR.h | 434 + .../Eigen/src/QR/HouseholderQR_LAPACKE.h | 68 + .../src/SPQRSupport/SuiteSparseQRSupport.h | 335 + lib/eigen-3.4.0/Eigen/src/SVD/BDCSVD.h | 1366 ++ lib/eigen-3.4.0/Eigen/src/SVD/JacobiSVD.h | 812 + .../Eigen/src/SVD/JacobiSVD_LAPACKE.h | 91 + lib/eigen-3.4.0/Eigen/src/SVD/SVDBase.h | 376 + .../Eigen/src/SVD/UpperBidiagonalization.h | 414 + .../src/SparseCholesky/SimplicialCholesky.h | 697 + .../SparseCholesky/SimplicialCholesky_impl.h | 174 + .../Eigen/src/SparseCore/AmbiVector.h | 378 + .../Eigen/src/SparseCore/CompressedStorage.h | 274 + .../ConservativeSparseSparseProduct.h | 352 + .../Eigen/src/SparseCore/MappedSparseMatrix.h | 67 + .../Eigen/src/SparseCore/SparseAssign.h | 270 + .../Eigen/src/SparseCore/SparseBlock.h | 571 + .../Eigen/src/SparseCore/SparseColEtree.h | 206 + .../src/SparseCore/SparseCompressedBase.h | 370 + .../src/SparseCore/SparseCwiseBinaryOp.h | 722 + .../Eigen/src/SparseCore/SparseCwiseUnaryOp.h | 150 + .../Eigen/src/SparseCore/SparseDenseProduct.h | 342 + .../src/SparseCore/SparseDiagonalProduct.h | 138 + .../Eigen/src/SparseCore/SparseDot.h | 98 + .../Eigen/src/SparseCore/SparseFuzzy.h | 29 + .../Eigen/src/SparseCore/SparseMap.h | 305 + .../Eigen/src/SparseCore/SparseMatrix.h | 1518 ++ .../Eigen/src/SparseCore/SparseMatrixBase.h | 398 + .../Eigen/src/SparseCore/SparsePermutation.h | 178 + .../Eigen/src/SparseCore/SparseProduct.h | 181 + .../Eigen/src/SparseCore/SparseRedux.h | 49 + .../Eigen/src/SparseCore/SparseRef.h | 397 + .../src/SparseCore/SparseSelfAdjointView.h | 659 + .../Eigen/src/SparseCore/SparseSolverBase.h | 124 + .../SparseSparseProductWithPruning.h | 198 + .../Eigen/src/SparseCore/SparseTranspose.h | 92 + .../src/SparseCore/SparseTriangularView.h | 189 + .../Eigen/src/SparseCore/SparseUtil.h | 186 + .../Eigen/src/SparseCore/SparseVector.h | 478 + .../Eigen/src/SparseCore/SparseView.h | 254 + .../Eigen/src/SparseCore/TriangularSolver.h | 315 + lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU.h | 923 + .../Eigen/src/SparseLU/SparseLUImpl.h | 66 + .../Eigen/src/SparseLU/SparseLU_Memory.h | 226 + .../Eigen/src/SparseLU/SparseLU_Structs.h | 110 + .../src/SparseLU/SparseLU_SupernodalMatrix.h | 375 + .../Eigen/src/SparseLU/SparseLU_Utils.h | 80 + .../Eigen/src/SparseLU/SparseLU_column_bmod.h | 181 + .../Eigen/src/SparseLU/SparseLU_column_dfs.h | 179 + .../src/SparseLU/SparseLU_copy_to_ucol.h | 107 + .../Eigen/src/SparseLU/SparseLU_gemm_kernel.h | 280 + .../src/SparseLU/SparseLU_heap_relax_snode.h | 126 + .../Eigen/src/SparseLU/SparseLU_kernel_bmod.h | 130 + .../Eigen/src/SparseLU/SparseLU_panel_bmod.h | 223 + .../Eigen/src/SparseLU/SparseLU_panel_dfs.h | 258 + .../Eigen/src/SparseLU/SparseLU_pivotL.h | 137 + .../Eigen/src/SparseLU/SparseLU_pruneL.h | 136 + .../Eigen/src/SparseLU/SparseLU_relax_snode.h | 83 + lib/eigen-3.4.0/Eigen/src/SparseQR/SparseQR.h | 758 + .../Eigen/src/StlSupport/StdDeque.h | 116 + .../Eigen/src/StlSupport/StdList.h | 106 + .../Eigen/src/StlSupport/StdVector.h | 131 + .../Eigen/src/StlSupport/details.h | 84 + .../Eigen/src/SuperLUSupport/SuperLUSupport.h | 1025 + .../Eigen/src/UmfPackSupport/UmfPackSupport.h | 642 + lib/eigen-3.4.0/Eigen/src/misc/Image.h | 82 + lib/eigen-3.4.0/Eigen/src/misc/Kernel.h | 79 + lib/eigen-3.4.0/Eigen/src/misc/RealSvd2x2.h | 55 + lib/eigen-3.4.0/Eigen/src/misc/blas.h | 440 + lib/eigen-3.4.0/Eigen/src/misc/lapack.h | 152 + lib/eigen-3.4.0/Eigen/src/misc/lapacke.h | 16292 ++++++++++++++++ .../Eigen/src/misc/lapacke_mangling.h | 17 + .../Eigen/src/plugins/ArrayCwiseBinaryOps.h | 358 + .../Eigen/src/plugins/ArrayCwiseUnaryOps.h | 696 + .../Eigen/src/plugins/BlockMethods.h | 1442 ++ .../Eigen/src/plugins/CommonCwiseBinaryOps.h | 115 + .../Eigen/src/plugins/CommonCwiseUnaryOps.h | 177 + .../Eigen/src/plugins/IndexedViewMethods.h | 262 + .../Eigen/src/plugins/MatrixCwiseBinaryOps.h | 152 + .../Eigen/src/plugins/MatrixCwiseUnaryOps.h | 95 + .../Eigen/src/plugins/ReshapedMethods.h | 149 + lib/eigen-3.4.0/INSTALL | 35 + lib/eigen-3.4.0/README.md | 5 + lib/eigen-3.4.0/bench/BenchSparseUtil.h | 149 + lib/eigen-3.4.0/bench/BenchTimer.h | 199 + lib/eigen-3.4.0/bench/BenchUtil.h | 92 + lib/eigen-3.4.0/bench/README.txt | 55 + .../bench/analyze-blocking-sizes.cpp | 876 + lib/eigen-3.4.0/bench/basicbench.cxxlist | 28 + lib/eigen-3.4.0/bench/basicbenchmark.cpp | 35 + lib/eigen-3.4.0/bench/basicbenchmark.h | 63 + lib/eigen-3.4.0/bench/benchBlasGemm.cpp | 219 + lib/eigen-3.4.0/bench/benchCholesky.cpp | 141 + lib/eigen-3.4.0/bench/benchEigenSolver.cpp | 212 + lib/eigen-3.4.0/bench/benchFFT.cpp | 115 + lib/eigen-3.4.0/bench/benchGeometry.cpp | 134 + lib/eigen-3.4.0/bench/benchVecAdd.cpp | 135 + lib/eigen-3.4.0/bench/bench_gemm.cpp | 375 + .../bench/bench_move_semantics.cpp | 57 + .../bench/bench_multi_compilers.sh | 28 + lib/eigen-3.4.0/bench/bench_norm.cpp | 360 + lib/eigen-3.4.0/bench/bench_reverse.cpp | 84 + lib/eigen-3.4.0/bench/bench_sum.cpp | 18 + lib/eigen-3.4.0/bench/bench_unrolling | 12 + .../bench/benchmark-blocking-sizes.cpp | 677 + lib/eigen-3.4.0/bench/benchmark.cpp | 39 + lib/eigen-3.4.0/bench/benchmarkSlice.cpp | 38 + lib/eigen-3.4.0/bench/benchmarkX.cpp | 36 + lib/eigen-3.4.0/bench/benchmarkXcwise.cpp | 35 + lib/eigen-3.4.0/bench/benchmark_suite | 18 + lib/eigen-3.4.0/bench/btl/CMakeLists.txt | 107 + lib/eigen-3.4.0/bench/btl/COPYING | 340 + lib/eigen-3.4.0/bench/btl/README | 154 + .../bench/btl/actions/action_aat_product.hh | 145 + .../bench/btl/actions/action_ata_product.hh | 145 + .../bench/btl/actions/action_atv_product.hh | 134 + .../bench/btl/actions/action_axpby.hh | 127 + .../bench/btl/actions/action_axpy.hh | 139 + .../bench/btl/actions/action_cholesky.hh | 128 + .../bench/btl/actions/action_ger.hh | 128 + .../bench/btl/actions/action_hessenberg.hh | 233 + .../bench/btl/actions/action_lu_decomp.hh | 124 + .../bench/btl/actions/action_lu_solve.hh | 136 + .../actions/action_matrix_matrix_product.hh | 150 + .../action_matrix_matrix_product_bis.hh | 152 + .../actions/action_matrix_vector_product.hh | 153 + .../bench/btl/actions/action_partial_lu.hh | 125 + .../bench/btl/actions/action_rot.hh | 116 + .../bench/btl/actions/action_symv.hh | 139 + .../bench/btl/actions/action_syr2.hh | 133 + .../bench/btl/actions/action_trisolve.hh | 137 + .../btl/actions/action_trisolve_matrix.hh | 165 + .../bench/btl/actions/action_trmm.hh | 165 + .../bench/btl/actions/basic_actions.hh | 21 + .../bench/btl/cmake/FindACML.cmake | 51 + .../bench/btl/cmake/FindATLAS.cmake | 31 + .../bench/btl/cmake/FindBLAZE.cmake | 31 + .../bench/btl/cmake/FindBlitz.cmake | 40 + .../bench/btl/cmake/FindCBLAS.cmake | 35 + lib/eigen-3.4.0/bench/btl/cmake/FindGMM.cmake | 17 + lib/eigen-3.4.0/bench/btl/cmake/FindMKL.cmake | 65 + .../bench/btl/cmake/FindMTL4.cmake | 31 + .../bench/btl/cmake/FindOPENBLAS.cmake | 17 + .../cmake/FindPackageHandleStandardArgs.cmake | 60 + .../bench/btl/cmake/FindTvmet.cmake | 32 + .../cmake/MacroOptionalAddSubdirectory.cmake | 31 + lib/eigen-3.4.0/bench/btl/data/CMakeLists.txt | 32 + .../bench/btl/data/action_settings.txt | 19 + .../bench/btl/data/gnuplot_common_settings.hh | 87 + lib/eigen-3.4.0/bench/btl/data/go_mean | 58 + lib/eigen-3.4.0/bench/btl/data/mean.cxx | 182 + .../bench/btl/data/mk_gnuplot_script.sh | 68 + .../bench/btl/data/mk_mean_script.sh | 52 + .../bench/btl/data/mk_new_gnuplot.sh | 54 + .../bench/btl/data/perlib_plot_settings.txt | 16 + lib/eigen-3.4.0/bench/btl/data/regularize.cxx | 131 + lib/eigen-3.4.0/bench/btl/data/smooth.cxx | 198 + lib/eigen-3.4.0/bench/btl/data/smooth_all.sh | 68 + .../bench/btl/generic_bench/bench.hh | 168 + .../btl/generic_bench/bench_parameter.hh | 53 + .../bench/btl/generic_bench/btl.hh | 242 + .../btl/generic_bench/init/init_function.hh | 54 + .../btl/generic_bench/init/init_matrix.hh | 64 + .../btl/generic_bench/init/init_vector.hh | 37 + .../btl/generic_bench/static/bench_static.hh | 80 + .../static/intel_bench_fixed_size.hh | 66 + .../static/static_size_generator.hh | 57 + .../generic_bench/timers/STL_perf_analyzer.hh | 82 + .../btl/generic_bench/timers/STL_timer.hh | 78 + .../timers/mixed_perf_analyzer.hh | 73 + .../timers/portable_perf_analyzer.hh | 103 + .../timers/portable_perf_analyzer_old.hh | 134 + .../generic_bench/timers/portable_timer.hh | 187 + .../generic_bench/timers/x86_perf_analyzer.hh | 108 + .../btl/generic_bench/timers/x86_timer.hh | 246 + .../btl/generic_bench/utils/size_lin_log.hh | 70 + .../bench/btl/generic_bench/utils/size_log.hh | 54 + .../bench/btl/generic_bench/utils/utilities.h | 90 + .../bench/btl/generic_bench/utils/xy_file.hh | 75 + .../bench/btl/libs/BLAS/CMakeLists.txt | 47 + lib/eigen-3.4.0/bench/btl/libs/BLAS/blas.h | 675 + .../bench/btl/libs/BLAS/blas_interface.hh | 83 + .../btl/libs/BLAS/blas_interface_impl.hh | 147 + .../bench/btl/libs/BLAS/c_interface_base.h | 73 + lib/eigen-3.4.0/bench/btl/libs/BLAS/main.cpp | 73 + .../bench/btl/libs/STL/CMakeLists.txt | 2 + .../bench/btl/libs/STL/STL_interface.hh | 244 + lib/eigen-3.4.0/bench/btl/libs/STL/main.cpp | 42 + .../bench/btl/libs/blaze/CMakeLists.txt | 13 + .../bench/btl/libs/blaze/blaze_interface.hh | 141 + lib/eigen-3.4.0/bench/btl/libs/blaze/main.cpp | 40 + .../bench/btl/libs/blitz/CMakeLists.txt | 17 + .../libs/blitz/blitz_LU_solve_interface.hh | 192 + .../bench/btl/libs/blitz/blitz_interface.hh | 147 + .../bench/btl/libs/blitz/btl_blitz.cpp | 51 + .../bench/btl/libs/blitz/btl_tiny_blitz.cpp | 38 + .../btl/libs/blitz/tiny_blitz_interface.hh | 106 + .../bench/btl/libs/eigen2/CMakeLists.txt | 19 + .../bench/btl/libs/eigen2/btl_tiny_eigen2.cpp | 46 + .../bench/btl/libs/eigen2/eigen2_interface.hh | 168 + .../bench/btl/libs/eigen2/main_adv.cpp | 44 + .../bench/btl/libs/eigen2/main_linear.cpp | 34 + .../bench/btl/libs/eigen2/main_matmat.cpp | 35 + .../bench/btl/libs/eigen2/main_vecmat.cpp | 36 + .../bench/btl/libs/eigen3/CMakeLists.txt | 65 + .../bench/btl/libs/eigen3/btl_tiny_eigen3.cpp | 46 + .../bench/btl/libs/eigen3/eigen3_interface.hh | 242 + .../bench/btl/libs/eigen3/main_adv.cpp | 44 + .../bench/btl/libs/eigen3/main_linear.cpp | 35 + .../bench/btl/libs/eigen3/main_matmat.cpp | 35 + .../bench/btl/libs/eigen3/main_vecmat.cpp | 36 + .../bench/btl/libs/gmm/CMakeLists.txt | 6 + .../btl/libs/gmm/gmm_LU_solve_interface.hh | 192 + .../bench/btl/libs/gmm/gmm_interface.hh | 144 + lib/eigen-3.4.0/bench/btl/libs/gmm/main.cpp | 51 + .../bench/btl/libs/mtl4/.kdbgrc.main | 12 + .../bench/btl/libs/mtl4/CMakeLists.txt | 6 + lib/eigen-3.4.0/bench/btl/libs/mtl4/main.cpp | 46 + .../btl/libs/mtl4/mtl4_LU_solve_interface.hh | 192 + .../bench/btl/libs/mtl4/mtl4_interface.hh | 144 + .../bench/btl/libs/tensors/CMakeLists.txt | 44 + .../bench/btl/libs/tensors/main_linear.cpp | 23 + .../bench/btl/libs/tensors/main_matmat.cpp | 21 + .../bench/btl/libs/tensors/main_vecmat.cpp | 21 + .../btl/libs/tensors/tensor_interface.hh | 105 + .../bench/btl/libs/tvmet/CMakeLists.txt | 6 + lib/eigen-3.4.0/bench/btl/libs/tvmet/main.cpp | 40 + .../bench/btl/libs/tvmet/tvmet_interface.hh | 104 + .../bench/btl/libs/ublas/CMakeLists.txt | 7 + lib/eigen-3.4.0/bench/btl/libs/ublas/main.cpp | 44 + .../bench/btl/libs/ublas/ublas_interface.hh | 141 + lib/eigen-3.4.0/bench/check_cache_queries.cpp | 101 + lib/eigen-3.4.0/bench/dense_solvers.cpp | 186 + lib/eigen-3.4.0/bench/eig33.cpp | 195 + lib/eigen-3.4.0/bench/geometry.cpp | 126 + .../bench/perf_monitoring/changesets.txt | 95 + .../bench/perf_monitoring/gemm.cpp | 12 + .../bench/perf_monitoring/gemm_common.h | 67 + .../bench/perf_monitoring/gemm_settings.txt | 15 + .../perf_monitoring/gemm_square_settings.txt | 11 + .../bench/perf_monitoring/gemv.cpp | 12 + .../bench/perf_monitoring/gemv_common.h | 69 + .../bench/perf_monitoring/gemv_settings.txt | 11 + .../perf_monitoring/gemv_square_settings.txt | 13 + .../bench/perf_monitoring/gemvt.cpp | 12 + .../bench/perf_monitoring/lazy_gemm.cpp | 101 + .../perf_monitoring/lazy_gemm_settings.txt | 15 + lib/eigen-3.4.0/bench/perf_monitoring/llt.cpp | 15 + .../bench/perf_monitoring/make_plot.sh | 112 + .../resources/chart_footer.html | 41 + .../resources/chart_header.html | 45 + .../perf_monitoring/resources/footer.html | 3 + .../perf_monitoring/resources/header.html | 42 + .../bench/perf_monitoring/resources/s1.js | 1 + .../bench/perf_monitoring/resources/s2.js | 1 + lib/eigen-3.4.0/bench/perf_monitoring/run.sh | 183 + .../bench/perf_monitoring/runall.sh | 72 + .../bench/perf_monitoring/trmv_lo.cpp | 12 + .../bench/perf_monitoring/trmv_lot.cpp | 12 + .../bench/perf_monitoring/trmv_up.cpp | 12 + .../bench/perf_monitoring/trmv_upt.cpp | 12 + lib/eigen-3.4.0/bench/product_threshold.cpp | 143 + lib/eigen-3.4.0/bench/quat_slerp.cpp | 247 + lib/eigen-3.4.0/bench/quatmul.cpp | 47 + lib/eigen-3.4.0/bench/sparse_cholesky.cpp | 216 + .../bench/sparse_dense_product.cpp | 187 + lib/eigen-3.4.0/bench/sparse_lu.cpp | 132 + lib/eigen-3.4.0/bench/sparse_product.cpp | 323 + lib/eigen-3.4.0/bench/sparse_randomsetter.cpp | 126 + lib/eigen-3.4.0/bench/sparse_setter.cpp | 485 + lib/eigen-3.4.0/bench/sparse_transpose.cpp | 104 + lib/eigen-3.4.0/bench/sparse_trisolver.cpp | 220 + lib/eigen-3.4.0/bench/spbench/CMakeLists.txt | 92 + lib/eigen-3.4.0/bench/spbench/sp_solver.cpp | 125 + lib/eigen-3.4.0/bench/spbench/spbench.dtd | 31 + .../bench/spbench/spbenchsolver.cpp | 87 + lib/eigen-3.4.0/bench/spbench/spbenchsolver.h | 573 + lib/eigen-3.4.0/bench/spbench/spbenchstyle.h | 95 + .../bench/spbench/test_sparseLU.cpp | 93 + lib/eigen-3.4.0/bench/spmv.cpp | 233 + lib/eigen-3.4.0/bench/tensors/README | 20 + lib/eigen-3.4.0/bench/tensors/benchmark.h | 49 + .../bench/tensors/benchmark_main.cc | 237 + .../tensors/contraction_benchmarks_cpu.cc | 39 + .../bench/tensors/eigen_sycl_bench.sh | 30 + .../tensors/eigen_sycl_bench_contract.sh | 7 + .../bench/tensors/tensor_benchmarks.h | 597 + .../bench/tensors/tensor_benchmarks_cpu.cc | 168 + .../tensors/tensor_benchmarks_fp16_gpu.cu | 77 + .../bench/tensors/tensor_benchmarks_gpu.cu | 75 + .../bench/tensors/tensor_benchmarks_sycl.cc | 140 + .../tensors/tensor_contract_sycl_bench.cc | 325 + lib/eigen-3.4.0/bench/vdw_new.cpp | 56 + lib/eigen-3.4.0/blas/BandTriangularSolver.h | 97 + lib/eigen-3.4.0/blas/CMakeLists.txt | 62 + lib/eigen-3.4.0/blas/GeneralRank1Update.h | 44 + .../blas/PackedSelfadjointProduct.h | 53 + .../blas/PackedTriangularMatrixVector.h | 79 + .../blas/PackedTriangularSolverVector.h | 88 + lib/eigen-3.4.0/blas/README.txt | 6 + lib/eigen-3.4.0/blas/Rank2Update.h | 57 + lib/eigen-3.4.0/blas/common.h | 175 + lib/eigen-3.4.0/blas/complex_double.cpp | 20 + lib/eigen-3.4.0/blas/complex_single.cpp | 20 + lib/eigen-3.4.0/blas/double.cpp | 32 + lib/eigen-3.4.0/blas/f2c/chbmv.c | 487 + lib/eigen-3.4.0/blas/f2c/chpmv.c | 438 + lib/eigen-3.4.0/blas/f2c/complexdots.c | 84 + lib/eigen-3.4.0/blas/f2c/ctbmv.c | 647 + lib/eigen-3.4.0/blas/f2c/d_cnjg.c | 6 + lib/eigen-3.4.0/blas/f2c/datatypes.h | 24 + lib/eigen-3.4.0/blas/f2c/drotm.c | 215 + lib/eigen-3.4.0/blas/f2c/drotmg.c | 293 + lib/eigen-3.4.0/blas/f2c/dsbmv.c | 366 + lib/eigen-3.4.0/blas/f2c/dspmv.c | 316 + lib/eigen-3.4.0/blas/f2c/dtbmv.c | 428 + lib/eigen-3.4.0/blas/f2c/lsame.c | 117 + lib/eigen-3.4.0/blas/f2c/r_cnjg.c | 6 + lib/eigen-3.4.0/blas/f2c/srotm.c | 216 + lib/eigen-3.4.0/blas/f2c/srotmg.c | 295 + lib/eigen-3.4.0/blas/f2c/ssbmv.c | 368 + lib/eigen-3.4.0/blas/f2c/sspmv.c | 316 + lib/eigen-3.4.0/blas/f2c/stbmv.c | 428 + lib/eigen-3.4.0/blas/f2c/zhbmv.c | 488 + lib/eigen-3.4.0/blas/f2c/zhpmv.c | 438 + lib/eigen-3.4.0/blas/f2c/ztbmv.c | 647 + lib/eigen-3.4.0/blas/fortran/complexdots.f | 43 + lib/eigen-3.4.0/blas/level1_cplx_impl.h | 155 + lib/eigen-3.4.0/blas/level1_impl.h | 144 + lib/eigen-3.4.0/blas/level1_real_impl.h | 122 + lib/eigen-3.4.0/blas/level2_cplx_impl.h | 360 + lib/eigen-3.4.0/blas/level2_impl.h | 553 + lib/eigen-3.4.0/blas/level2_real_impl.h | 306 + lib/eigen-3.4.0/blas/level3_impl.h | 702 + lib/eigen-3.4.0/blas/single.cpp | 22 + lib/eigen-3.4.0/blas/testing/CMakeLists.txt | 40 + lib/eigen-3.4.0/blas/testing/cblat1.f | 724 + lib/eigen-3.4.0/blas/testing/cblat2.dat | 35 + lib/eigen-3.4.0/blas/testing/cblat2.f | 3279 ++++ lib/eigen-3.4.0/blas/testing/cblat3.dat | 23 + lib/eigen-3.4.0/blas/testing/cblat3.f | 3492 ++++ lib/eigen-3.4.0/blas/testing/dblat1.f | 1065 + lib/eigen-3.4.0/blas/testing/dblat2.dat | 34 + lib/eigen-3.4.0/blas/testing/dblat2.f | 3176 +++ lib/eigen-3.4.0/blas/testing/dblat3.dat | 20 + lib/eigen-3.4.0/blas/testing/dblat3.f | 2873 +++ lib/eigen-3.4.0/blas/testing/runblastest.sh | 45 + lib/eigen-3.4.0/blas/testing/sblat1.f | 1021 + lib/eigen-3.4.0/blas/testing/sblat2.dat | 34 + lib/eigen-3.4.0/blas/testing/sblat2.f | 3176 +++ lib/eigen-3.4.0/blas/testing/sblat3.dat | 20 + lib/eigen-3.4.0/blas/testing/sblat3.f | 2873 +++ lib/eigen-3.4.0/blas/testing/zblat1.f | 724 + lib/eigen-3.4.0/blas/testing/zblat2.dat | 35 + lib/eigen-3.4.0/blas/testing/zblat2.f | 3287 ++++ lib/eigen-3.4.0/blas/testing/zblat3.dat | 23 + lib/eigen-3.4.0/blas/testing/zblat3.f | 3502 ++++ lib/eigen-3.4.0/blas/xerbla.cpp | 23 + lib/eigen-3.4.0/ci/CTest2JUnit.xsl | 120 + lib/eigen-3.4.0/ci/README.md | 56 + lib/eigen-3.4.0/ci/build.gitlab-ci.yml | 216 + lib/eigen-3.4.0/ci/smoketests.gitlab-ci.yml | 107 + lib/eigen-3.4.0/ci/test.gitlab-ci.yml | 388 + .../cmake/ComputeCppCompilerChecks.cmake | 50 + lib/eigen-3.4.0/cmake/ComputeCppIRMap.cmake | 18 + lib/eigen-3.4.0/cmake/Eigen3Config.cmake.in | 23 + .../cmake/Eigen3ConfigLegacy.cmake.in | 30 + .../cmake/EigenConfigureTesting.cmake | 58 + .../cmake/EigenDetermineOSVersion.cmake | 46 + .../cmake/EigenDetermineVSServicePack.cmake | 41 + .../cmake/EigenSmokeTestList.cmake | 131 + lib/eigen-3.4.0/cmake/EigenTesting.cmake | 782 + lib/eigen-3.4.0/cmake/EigenUninstall.cmake | 40 + lib/eigen-3.4.0/cmake/FindAdolc.cmake | 20 + lib/eigen-3.4.0/cmake/FindBLAS.cmake | 1407 ++ lib/eigen-3.4.0/cmake/FindBLASEXT.cmake | 384 + lib/eigen-3.4.0/cmake/FindCHOLMOD.cmake | 89 + lib/eigen-3.4.0/cmake/FindComputeCpp.cmake | 455 + lib/eigen-3.4.0/cmake/FindEigen2.cmake | 80 + lib/eigen-3.4.0/cmake/FindEigen3.cmake | 107 + lib/eigen-3.4.0/cmake/FindFFTW.cmake | 120 + lib/eigen-3.4.0/cmake/FindGLEW.cmake | 105 + lib/eigen-3.4.0/cmake/FindGMP.cmake | 21 + lib/eigen-3.4.0/cmake/FindGSL.cmake | 170 + lib/eigen-3.4.0/cmake/FindGoogleHash.cmake | 23 + lib/eigen-3.4.0/cmake/FindHWLOC.cmake | 332 + lib/eigen-3.4.0/cmake/FindKLU.cmake | 48 + lib/eigen-3.4.0/cmake/FindLAPACK.cmake | 274 + lib/eigen-3.4.0/cmake/FindMPFR.cmake | 83 + lib/eigen-3.4.0/cmake/FindMPREAL.cmake | 103 + lib/eigen-3.4.0/cmake/FindMetis.cmake | 265 + lib/eigen-3.4.0/cmake/FindPASTIX.cmake | 704 + lib/eigen-3.4.0/cmake/FindPTSCOTCH.cmake | 422 + lib/eigen-3.4.0/cmake/FindSCOTCH.cmake | 370 + lib/eigen-3.4.0/cmake/FindSPQR.cmake | 41 + .../cmake/FindStandardMathLibrary.cmake | 70 + lib/eigen-3.4.0/cmake/FindSuperLU.cmake | 97 + lib/eigen-3.4.0/cmake/FindTriSYCL.cmake | 173 + lib/eigen-3.4.0/cmake/FindUMFPACK.cmake | 53 + lib/eigen-3.4.0/cmake/RegexUtils.cmake | 19 + lib/eigen-3.4.0/cmake/UseEigen3.cmake | 6 + lib/eigen-3.4.0/debug/gdb/__init__.py | 1 + lib/eigen-3.4.0/debug/gdb/printers.py | 314 + lib/eigen-3.4.0/debug/msvc/eigen.natvis | 235 + .../debug/msvc/eigen_autoexp_part.dat | 295 + lib/eigen-3.4.0/demos/CMakeLists.txt | 13 + .../demos/mandelbrot/CMakeLists.txt | 21 + lib/eigen-3.4.0/demos/mandelbrot/README | 10 + .../demos/mandelbrot/mandelbrot.cpp | 213 + lib/eigen-3.4.0/demos/mandelbrot/mandelbrot.h | 71 + lib/eigen-3.4.0/demos/mix_eigen_and_c/README | 9 + .../demos/mix_eigen_and_c/binary_library.cpp | 185 + .../demos/mix_eigen_and_c/binary_library.h | 71 + .../demos/mix_eigen_and_c/example.c | 65 + lib/eigen-3.4.0/demos/opengl/CMakeLists.txt | 28 + lib/eigen-3.4.0/demos/opengl/README | 13 + lib/eigen-3.4.0/demos/opengl/camera.cpp | 264 + lib/eigen-3.4.0/demos/opengl/camera.h | 118 + lib/eigen-3.4.0/demos/opengl/gpuhelper.cpp | 126 + lib/eigen-3.4.0/demos/opengl/gpuhelper.h | 207 + lib/eigen-3.4.0/demos/opengl/icosphere.cpp | 120 + lib/eigen-3.4.0/demos/opengl/icosphere.h | 30 + .../demos/opengl/quaternion_demo.cpp | 656 + .../demos/opengl/quaternion_demo.h | 114 + lib/eigen-3.4.0/demos/opengl/trackball.cpp | 59 + lib/eigen-3.4.0/demos/opengl/trackball.h | 42 + lib/eigen-3.4.0/doc/AsciiQuickReference.txt | 226 + lib/eigen-3.4.0/doc/B01_Experimental.dox | 52 + lib/eigen-3.4.0/doc/CMakeLists.txt | 122 + lib/eigen-3.4.0/doc/ClassHierarchy.dox | 129 + .../doc/CoeffwiseMathFunctionsTable.dox | 600 + .../doc/CustomizingEigen_CustomScalar.dox | 120 + .../doc/CustomizingEigen_InheritingMatrix.dox | 34 + .../doc/CustomizingEigen_NullaryExpr.dox | 86 + .../doc/CustomizingEigen_Plugins.dox | 69 + .../doc/DenseDecompositionBenchmark.dox | 42 + lib/eigen-3.4.0/doc/Doxyfile.in | 1915 ++ .../doc/Eigen_Silly_Professor_64x64.png | Bin 0 -> 8355 bytes lib/eigen-3.4.0/doc/FixedSizeVectorizable.dox | 38 + .../doc/FunctionsTakingEigenTypes.dox | 217 + lib/eigen-3.4.0/doc/HiPerformance.dox | 128 + lib/eigen-3.4.0/doc/InplaceDecomposition.dox | 115 + lib/eigen-3.4.0/doc/InsideEigenExample.dox | 500 + lib/eigen-3.4.0/doc/LeastSquares.dox | 75 + lib/eigen-3.4.0/doc/Manual.dox | 192 + .../doc/MatrixfreeSolverExample.dox | 20 + lib/eigen-3.4.0/doc/NewExpressionType.dox | 143 + lib/eigen-3.4.0/doc/Overview.dox | 28 + lib/eigen-3.4.0/doc/PassingByValue.dox | 40 + lib/eigen-3.4.0/doc/Pitfalls.dox | 149 + .../doc/PreprocessorDirectives.dox | 179 + lib/eigen-3.4.0/doc/QuickReference.dox | 805 + lib/eigen-3.4.0/doc/QuickStartGuide.dox | 100 + lib/eigen-3.4.0/doc/SparseLinearSystems.dox | 232 + lib/eigen-3.4.0/doc/SparseQuickReference.dox | 272 + lib/eigen-3.4.0/doc/StlContainers.dox | 73 + lib/eigen-3.4.0/doc/StorageOrders.dox | 86 + .../doc/StructHavingEigenMembers.dox | 203 + lib/eigen-3.4.0/doc/TemplateKeyword.dox | 133 + lib/eigen-3.4.0/doc/TopicAliasing.dox | 237 + lib/eigen-3.4.0/doc/TopicAssertions.dox | 108 + lib/eigen-3.4.0/doc/TopicCMakeGuide.dox | 56 + .../doc/TopicEigenExpressionTemplates.dox | 12 + lib/eigen-3.4.0/doc/TopicLazyEvaluation.dox | 97 + .../doc/TopicLinearAlgebraDecompositions.dox | 287 + lib/eigen-3.4.0/doc/TopicMultithreading.dox | 67 + lib/eigen-3.4.0/doc/TopicResizing.dox | 11 + lib/eigen-3.4.0/doc/TopicScalarTypes.dox | 12 + lib/eigen-3.4.0/doc/TopicVectorization.dox | 9 + .../doc/TutorialAdvancedInitialization.dox | 162 + lib/eigen-3.4.0/doc/TutorialArrayClass.dox | 192 + .../doc/TutorialBlockOperations.dox | 242 + lib/eigen-3.4.0/doc/TutorialGeometry.dox | 242 + lib/eigen-3.4.0/doc/TutorialLinearAlgebra.dox | 299 + lib/eigen-3.4.0/doc/TutorialMapClass.dox | 86 + .../doc/TutorialMatrixArithmetic.dox | 214 + lib/eigen-3.4.0/doc/TutorialMatrixClass.dox | 293 + ...TutorialReductionsVisitorsBroadcasting.dox | 266 + lib/eigen-3.4.0/doc/TutorialReshape.dox | 82 + lib/eigen-3.4.0/doc/TutorialSTL.dox | 66 + .../doc/TutorialSlicingIndexing.dox | 244 + lib/eigen-3.4.0/doc/TutorialSparse.dox | 365 + .../doc/TutorialSparse_example_details.dox | 4 + lib/eigen-3.4.0/doc/UnalignedArrayAssert.dox | 133 + .../doc/UsingBlasLapackBackends.dox | 133 + lib/eigen-3.4.0/doc/UsingIntelMKL.dox | 113 + lib/eigen-3.4.0/doc/UsingNVCC.dox | 30 + lib/eigen-3.4.0/doc/WrongStackAlignment.dox | 56 + lib/eigen-3.4.0/doc/eigen_navtree_hacks.js | 247 + lib/eigen-3.4.0/doc/eigendoxy.css | 235 + lib/eigen-3.4.0/doc/eigendoxy_footer.html.in | 23 + lib/eigen-3.4.0/doc/eigendoxy_header.html.in | 62 + lib/eigen-3.4.0/doc/eigendoxy_layout.xml.in | 178 + lib/eigen-3.4.0/doc/eigendoxy_tabs.css | 59 + lib/eigen-3.4.0/doc/examples/.krazy | 2 + lib/eigen-3.4.0/doc/examples/CMakeLists.txt | 20 + .../examples/CustomizingEigen_Inheritance.cpp | 30 + lib/eigen-3.4.0/doc/examples/Cwise_erf.cpp | 9 + lib/eigen-3.4.0/doc/examples/Cwise_erfc.cpp | 9 + lib/eigen-3.4.0/doc/examples/Cwise_lgamma.cpp | 9 + .../doc/examples/DenseBase_middleCols_int.cpp | 15 + .../doc/examples/DenseBase_middleRows_int.cpp | 15 + .../DenseBase_template_int_middleCols.cpp | 15 + .../DenseBase_template_int_middleRows.cpp | 15 + .../doc/examples/QuickStart_example.cpp | 14 + .../examples/QuickStart_example2_dynamic.cpp | 15 + .../examples/QuickStart_example2_fixed.cpp | 15 + .../doc/examples/TemplateKeyword_flexible.cpp | 22 + .../doc/examples/TemplateKeyword_simple.cpp | 20 + .../doc/examples/TutorialInplaceLU.cpp | 61 + .../examples/TutorialLinAlgComputeTwice.cpp | 23 + .../TutorialLinAlgExComputeSolveError.cpp | 14 + ...torialLinAlgExSolveColPivHouseholderQR.cpp | 17 + .../examples/TutorialLinAlgExSolveLDLT.cpp | 16 + .../TutorialLinAlgInverseDeterminant.cpp | 16 + .../examples/TutorialLinAlgRankRevealing.cpp | 20 + .../doc/examples/TutorialLinAlgSVDSolve.cpp | 15 + .../TutorialLinAlgSelfAdjointEigenSolver.cpp | 18 + .../examples/TutorialLinAlgSetThreshold.cpp | 16 + .../Tutorial_ArrayClass_accessors.cpp | 24 + .../examples/Tutorial_ArrayClass_addition.cpp | 23 + .../Tutorial_ArrayClass_cwise_other.cpp | 19 + .../examples/Tutorial_ArrayClass_interop.cpp | 22 + .../Tutorial_ArrayClass_interop_matrix.cpp | 26 + .../doc/examples/Tutorial_ArrayClass_mult.cpp | 16 + ...orial_BlockOperations_block_assignment.cpp | 18 + .../Tutorial_BlockOperations_colrow.cpp | 17 + .../Tutorial_BlockOperations_corner.cpp | 17 + .../Tutorial_BlockOperations_print_block.cpp | 20 + .../Tutorial_BlockOperations_vector.cpp | 14 + .../doc/examples/Tutorial_PartialLU_solve.cpp | 18 + ...ionsVisitorsBroadcasting_broadcast_1nn.cpp | 24 + ...sVisitorsBroadcasting_broadcast_simple.cpp | 21 + ...sBroadcasting_broadcast_simple_rowwise.cpp | 20 + ...ReductionsVisitorsBroadcasting_colwise.cpp | 13 + ...ReductionsVisitorsBroadcasting_maxnorm.cpp | 20 + ...nsVisitorsBroadcasting_reductions_bool.cpp | 21 + ...nsVisitorsBroadcasting_reductions_norm.cpp | 28 + ...rsBroadcasting_reductions_operatornorm.cpp | 18 + ...ReductionsVisitorsBroadcasting_rowwise.cpp | 13 + ...eductionsVisitorsBroadcasting_visitors.cpp | 26 + .../Tutorial_simple_example_dynamic_size.cpp | 22 + .../Tutorial_simple_example_fixed_size.cpp | 15 + lib/eigen-3.4.0/doc/examples/class_Block.cpp | 27 + .../doc/examples/class_CwiseBinaryOp.cpp | 18 + .../doc/examples/class_CwiseUnaryOp.cpp | 19 + .../examples/class_CwiseUnaryOp_ptrfun.cpp | 20 + .../doc/examples/class_FixedBlock.cpp | 27 + .../doc/examples/class_FixedReshaped.cpp | 22 + .../doc/examples/class_FixedVectorBlock.cpp | 27 + .../doc/examples/class_Reshaped.cpp | 23 + .../doc/examples/class_VectorBlock.cpp | 27 + .../examples/function_taking_eigenbase.cpp | 18 + .../doc/examples/function_taking_ref.cpp | 19 + .../doc/examples/make_circulant.cpp | 11 + .../doc/examples/make_circulant.cpp.entry | 5 + .../doc/examples/make_circulant.cpp.evaluator | 32 + .../examples/make_circulant.cpp.expression | 20 + .../doc/examples/make_circulant.cpp.main | 8 + .../doc/examples/make_circulant.cpp.preamble | 4 + .../doc/examples/make_circulant.cpp.traits | 19 + .../doc/examples/make_circulant2.cpp | 52 + .../doc/examples/matrixfree_cg.cpp | 129 + .../doc/examples/nullary_indexing.cpp | 66 + .../doc/examples/tut_arithmetic_add_sub.cpp | 22 + .../doc/examples/tut_arithmetic_dot_cross.cpp | 15 + .../examples/tut_arithmetic_matrix_mul.cpp | 19 + .../examples/tut_arithmetic_redux_basic.cpp | 16 + .../tut_arithmetic_scalar_mul_div.cpp | 17 + .../tut_matrix_coefficient_accessors.cpp | 18 + .../doc/examples/tut_matrix_resize.cpp | 18 + .../examples/tut_matrix_resize_fixed_size.cpp | 12 + lib/eigen-3.4.0/doc/ftv2node.png | Bin 0 -> 86 bytes lib/eigen-3.4.0/doc/ftv2pnode.png | Bin 0 -> 229 bytes lib/eigen-3.4.0/doc/snippets/.krazy | 2 + .../doc/snippets/AngleAxis_mimic_euler.cpp | 5 + .../Array_initializer_list_23_cxx11.cpp | 5 + .../Array_initializer_list_vector_cxx11.cpp | 2 + .../snippets/Array_variadic_ctor_cxx11.cpp | 3 + .../doc/snippets/BiCGSTAB_simple.cpp | 11 + .../doc/snippets/BiCGSTAB_step_by_step.cpp | 14 + lib/eigen-3.4.0/doc/snippets/CMakeLists.txt | 36 + .../snippets/ColPivHouseholderQR_solve.cpp | 8 + .../snippets/ComplexEigenSolver_compute.cpp | 16 + .../ComplexEigenSolver_eigenvalues.cpp | 4 + .../ComplexEigenSolver_eigenvectors.cpp | 4 + .../doc/snippets/ComplexSchur_compute.cpp | 6 + .../doc/snippets/ComplexSchur_matrixT.cpp | 4 + .../doc/snippets/ComplexSchur_matrixU.cpp | 4 + lib/eigen-3.4.0/doc/snippets/Cwise_abs.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_abs2.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_acos.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_arg.cpp | 3 + .../doc/snippets/Cwise_array_power_array.cpp | 4 + lib/eigen-3.4.0/doc/snippets/Cwise_asin.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_atan.cpp | 2 + .../doc/snippets/Cwise_boolean_and.cpp | 2 + .../doc/snippets/Cwise_boolean_not.cpp | 5 + .../doc/snippets/Cwise_boolean_or.cpp | 2 + .../doc/snippets/Cwise_boolean_xor.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_ceil.cpp | 3 + lib/eigen-3.4.0/doc/snippets/Cwise_cos.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_cosh.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_cube.cpp | 2 + .../doc/snippets/Cwise_equal_equal.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_exp.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_floor.cpp | 3 + .../doc/snippets/Cwise_greater.cpp | 2 + .../doc/snippets/Cwise_greater_equal.cpp | 2 + .../doc/snippets/Cwise_inverse.cpp | 2 + .../doc/snippets/Cwise_isFinite.cpp | 5 + lib/eigen-3.4.0/doc/snippets/Cwise_isInf.cpp | 5 + lib/eigen-3.4.0/doc/snippets/Cwise_isNaN.cpp | 5 + lib/eigen-3.4.0/doc/snippets/Cwise_less.cpp | 2 + .../doc/snippets/Cwise_less_equal.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_log.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_log10.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_max.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_min.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_minus.cpp | 2 + .../doc/snippets/Cwise_minus_equal.cpp | 3 + .../doc/snippets/Cwise_not_equal.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_plus.cpp | 2 + .../doc/snippets/Cwise_plus_equal.cpp | 3 + lib/eigen-3.4.0/doc/snippets/Cwise_pow.cpp | 2 + .../doc/snippets/Cwise_product.cpp | 4 + .../doc/snippets/Cwise_quotient.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_rint.cpp | 3 + lib/eigen-3.4.0/doc/snippets/Cwise_round.cpp | 3 + .../doc/snippets/Cwise_scalar_power_array.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_sign.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_sin.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_sinh.cpp | 2 + .../doc/snippets/Cwise_slash_equal.cpp | 3 + lib/eigen-3.4.0/doc/snippets/Cwise_sqrt.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_square.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_tan.cpp | 2 + lib/eigen-3.4.0/doc/snippets/Cwise_tanh.cpp | 2 + .../doc/snippets/Cwise_times_equal.cpp | 3 + .../doc/snippets/DenseBase_LinSpaced.cpp | 2 + .../doc/snippets/DenseBase_LinSpacedInt.cpp | 8 + .../DenseBase_LinSpaced_seq_deprecated.cpp | 2 + .../doc/snippets/DenseBase_setLinSpaced.cpp | 3 + .../snippets/DirectionWise_hnormalized.cpp | 6 + .../doc/snippets/DirectionWise_replicate.cpp | 4 + .../snippets/DirectionWise_replicate_int.cpp | 4 + .../EigenSolver_EigenSolver_MatrixType.cpp | 16 + .../doc/snippets/EigenSolver_compute.cpp | 6 + .../doc/snippets/EigenSolver_eigenvalues.cpp | 4 + .../doc/snippets/EigenSolver_eigenvectors.cpp | 4 + .../EigenSolver_pseudoEigenvectors.cpp | 9 + .../snippets/FullPivHouseholderQR_solve.cpp | 8 + .../doc/snippets/FullPivLU_image.cpp | 9 + .../doc/snippets/FullPivLU_kernel.cpp | 7 + .../doc/snippets/FullPivLU_solve.cpp | 11 + .../doc/snippets/GeneralizedEigenSolver.cpp | 7 + .../HessenbergDecomposition_compute.cpp | 6 + .../HessenbergDecomposition_matrixH.cpp | 8 + .../HessenbergDecomposition_packedMatrix.cpp | 9 + .../snippets/HouseholderQR_householderQ.cpp | 7 + .../doc/snippets/HouseholderQR_solve.cpp | 9 + ...ouseholderSequence_HouseholderSequence.cpp | 31 + lib/eigen-3.4.0/doc/snippets/IOFormat.cpp | 14 + .../doc/snippets/JacobiSVD_basic.cpp | 9 + .../doc/snippets/Jacobi_makeGivens.cpp | 6 + .../doc/snippets/Jacobi_makeJacobi.cpp | 8 + lib/eigen-3.4.0/doc/snippets/LLT_example.cpp | 12 + lib/eigen-3.4.0/doc/snippets/LLT_solve.cpp | 8 + .../snippets/LeastSquaresNormalEquations.cpp | 4 + .../doc/snippets/LeastSquaresQR.cpp | 4 + .../doc/snippets/Map_general_stride.cpp | 5 + .../doc/snippets/Map_inner_stride.cpp | 5 + .../doc/snippets/Map_outer_stride.cpp | 3 + .../doc/snippets/Map_placement_new.cpp | 5 + lib/eigen-3.4.0/doc/snippets/Map_simple.cpp | 3 + .../doc/snippets/MatrixBase_adjoint.cpp | 3 + .../doc/snippets/MatrixBase_all.cpp | 7 + .../snippets/MatrixBase_applyOnTheLeft.cpp | 7 + .../snippets/MatrixBase_applyOnTheRight.cpp | 9 + .../doc/snippets/MatrixBase_array.cpp | 4 + .../doc/snippets/MatrixBase_array_const.cpp | 4 + .../doc/snippets/MatrixBase_asDiagonal.cpp | 1 + .../doc/snippets/MatrixBase_block_int_int.cpp | 5 + .../MatrixBase_block_int_int_int_int.cpp | 5 + .../MatrixBase_bottomLeftCorner_int_int.cpp | 6 + .../MatrixBase_bottomRightCorner_int_int.cpp | 6 + .../snippets/MatrixBase_bottomRows_int.cpp | 6 + .../doc/snippets/MatrixBase_cast.cpp | 3 + .../doc/snippets/MatrixBase_col.cpp | 3 + .../doc/snippets/MatrixBase_colwise.cpp | 5 + .../MatrixBase_colwise_iterator_cxx11.cpp | 12 + ...trixBase_computeInverseAndDetWithCheck.cpp | 13 + .../MatrixBase_computeInverseWithCheck.cpp | 11 + .../doc/snippets/MatrixBase_cwiseAbs.cpp | 4 + .../doc/snippets/MatrixBase_cwiseAbs2.cpp | 4 + .../doc/snippets/MatrixBase_cwiseArg.cpp | 3 + .../doc/snippets/MatrixBase_cwiseEqual.cpp | 7 + .../doc/snippets/MatrixBase_cwiseInverse.cpp | 4 + .../doc/snippets/MatrixBase_cwiseMax.cpp | 2 + .../doc/snippets/MatrixBase_cwiseMin.cpp | 2 + .../doc/snippets/MatrixBase_cwiseNotEqual.cpp | 7 + .../doc/snippets/MatrixBase_cwiseProduct.cpp | 4 + .../doc/snippets/MatrixBase_cwiseQuotient.cpp | 2 + .../doc/snippets/MatrixBase_cwiseSign.cpp | 4 + .../doc/snippets/MatrixBase_cwiseSqrt.cpp | 2 + .../doc/snippets/MatrixBase_diagonal.cpp | 4 + .../doc/snippets/MatrixBase_diagonal_int.cpp | 5 + .../MatrixBase_diagonal_template_int.cpp | 5 + .../doc/snippets/MatrixBase_eigenvalues.cpp | 3 + .../doc/snippets/MatrixBase_end_int.cpp | 5 + .../doc/snippets/MatrixBase_eval.cpp | 12 + .../MatrixBase_fixedBlock_int_int.cpp | 5 + .../doc/snippets/MatrixBase_hnormalized.cpp | 6 + .../doc/snippets/MatrixBase_homogeneous.cpp | 6 + .../doc/snippets/MatrixBase_identity.cpp | 1 + .../snippets/MatrixBase_identity_int_int.cpp | 1 + .../doc/snippets/MatrixBase_inverse.cpp | 3 + .../doc/snippets/MatrixBase_isDiagonal.cpp | 6 + .../doc/snippets/MatrixBase_isIdentity.cpp | 5 + .../doc/snippets/MatrixBase_isOnes.cpp | 5 + .../doc/snippets/MatrixBase_isOrthogonal.cpp | 6 + .../doc/snippets/MatrixBase_isUnitary.cpp | 5 + .../doc/snippets/MatrixBase_isZero.cpp | 5 + .../doc/snippets/MatrixBase_leftCols_int.cpp | 6 + .../doc/snippets/MatrixBase_noalias.cpp | 3 + .../doc/snippets/MatrixBase_ones.cpp | 2 + .../doc/snippets/MatrixBase_ones_int.cpp | 2 + .../doc/snippets/MatrixBase_ones_int_int.cpp | 1 + .../doc/snippets/MatrixBase_operatorNorm.cpp | 3 + .../doc/snippets/MatrixBase_prod.cpp | 3 + .../doc/snippets/MatrixBase_random.cpp | 1 + .../doc/snippets/MatrixBase_random_int.cpp | 1 + .../snippets/MatrixBase_random_int_int.cpp | 1 + .../doc/snippets/MatrixBase_replicate.cpp | 4 + .../snippets/MatrixBase_replicate_int_int.cpp | 4 + .../doc/snippets/MatrixBase_reshaped_auto.cpp | 4 + .../snippets/MatrixBase_reshaped_fixed.cpp | 3 + .../snippets/MatrixBase_reshaped_int_int.cpp | 3 + .../MatrixBase_reshaped_to_vector.cpp | 4 + .../doc/snippets/MatrixBase_reverse.cpp | 8 + .../doc/snippets/MatrixBase_rightCols_int.cpp | 6 + .../doc/snippets/MatrixBase_row.cpp | 3 + .../doc/snippets/MatrixBase_rowwise.cpp | 5 + .../snippets/MatrixBase_segment_int_int.cpp | 5 + .../doc/snippets/MatrixBase_select.cpp | 6 + .../snippets/MatrixBase_selfadjointView.cpp | 6 + .../doc/snippets/MatrixBase_set.cpp | 13 + .../doc/snippets/MatrixBase_setIdentity.cpp | 3 + .../doc/snippets/MatrixBase_setOnes.cpp | 3 + .../doc/snippets/MatrixBase_setRandom.cpp | 3 + .../doc/snippets/MatrixBase_setZero.cpp | 3 + .../doc/snippets/MatrixBase_start_int.cpp | 5 + .../MatrixBase_template_int_bottomRows.cpp | 6 + .../snippets/MatrixBase_template_int_end.cpp | 5 + ...template_int_int_block_int_int_int_int.cpp | 5 + ...Base_template_int_int_bottomLeftCorner.cpp | 6 + ...plate_int_int_bottomLeftCorner_int_int.cpp | 6 + ...ase_template_int_int_bottomRightCorner.cpp | 6 + ...late_int_int_bottomRightCorner_int_int.cpp | 6 + ...rixBase_template_int_int_topLeftCorner.cpp | 6 + ...template_int_int_topLeftCorner_int_int.cpp | 6 + ...ixBase_template_int_int_topRightCorner.cpp | 6 + ...emplate_int_int_topRightCorner_int_int.cpp | 6 + .../MatrixBase_template_int_leftCols.cpp | 6 + .../MatrixBase_template_int_rightCols.cpp | 6 + .../MatrixBase_template_int_segment.cpp | 5 + .../MatrixBase_template_int_start.cpp | 5 + .../MatrixBase_template_int_topRows.cpp | 6 + .../MatrixBase_topLeftCorner_int_int.cpp | 6 + .../MatrixBase_topRightCorner_int_int.cpp | 6 + .../doc/snippets/MatrixBase_topRows_int.cpp | 6 + .../doc/snippets/MatrixBase_transpose.cpp | 8 + .../snippets/MatrixBase_triangularView.cpp | 9 + .../doc/snippets/MatrixBase_zero.cpp | 2 + .../doc/snippets/MatrixBase_zero_int.cpp | 2 + .../doc/snippets/MatrixBase_zero_int_int.cpp | 1 + .../doc/snippets/Matrix_Map_stride.cpp | 7 + .../Matrix_initializer_list_23_cxx11.cpp | 5 + .../Matrix_initializer_list_vector_cxx11.cpp | 2 + .../snippets/Matrix_resize_NoChange_int.cpp | 3 + .../doc/snippets/Matrix_resize_int.cpp | 6 + .../snippets/Matrix_resize_int_NoChange.cpp | 3 + .../doc/snippets/Matrix_resize_int_int.cpp | 9 + .../doc/snippets/Matrix_setConstant_int.cpp | 3 + .../snippets/Matrix_setConstant_int_int.cpp | 3 + .../snippets/Matrix_setIdentity_int_int.cpp | 3 + .../doc/snippets/Matrix_setOnes_int.cpp | 3 + .../doc/snippets/Matrix_setOnes_int_int.cpp | 3 + .../doc/snippets/Matrix_setRandom_int.cpp | 3 + .../doc/snippets/Matrix_setRandom_int_int.cpp | 3 + .../doc/snippets/Matrix_setZero_int.cpp | 3 + .../doc/snippets/Matrix_setZero_int_int.cpp | 3 + .../snippets/Matrix_variadic_ctor_cxx11.cpp | 3 + .../doc/snippets/PartialPivLU_solve.cpp | 7 + .../doc/snippets/PartialRedux_count.cpp | 5 + .../doc/snippets/PartialRedux_maxCoeff.cpp | 3 + .../doc/snippets/PartialRedux_minCoeff.cpp | 3 + .../doc/snippets/PartialRedux_norm.cpp | 3 + .../doc/snippets/PartialRedux_prod.cpp | 3 + .../doc/snippets/PartialRedux_squaredNorm.cpp | 3 + .../doc/snippets/PartialRedux_sum.cpp | 3 + .../doc/snippets/RealQZ_compute.cpp | 17 + .../RealSchur_RealSchur_MatrixType.cpp | 10 + .../doc/snippets/RealSchur_compute.cpp | 6 + ...ointEigenSolver_SelfAdjointEigenSolver.cpp | 7 + ...lver_SelfAdjointEigenSolver_MatrixType.cpp | 17 + ...ver_SelfAdjointEigenSolver_MatrixType2.cpp | 16 + ...fAdjointEigenSolver_compute_MatrixType.cpp | 7 + ...AdjointEigenSolver_compute_MatrixType2.cpp | 9 + .../SelfAdjointEigenSolver_eigenvalues.cpp | 4 + .../SelfAdjointEigenSolver_eigenvectors.cpp | 4 + ...AdjointEigenSolver_operatorInverseSqrt.cpp | 9 + .../SelfAdjointEigenSolver_operatorSqrt.cpp | 8 + .../snippets/SelfAdjointView_eigenvalues.cpp | 3 + .../snippets/SelfAdjointView_operatorNorm.cpp | 3 + .../doc/snippets/Slicing_arrayexpr.cpp | 4 + .../snippets/Slicing_custom_padding_cxx11.cpp | 12 + .../doc/snippets/Slicing_rawarray_cxx11.cpp | 5 + .../doc/snippets/Slicing_stdvector_cxx11.cpp | 4 + .../doc/snippets/SparseMatrix_coeffs.cpp | 9 + .../doc/snippets/TopicAliasing_block.cpp | 7 + .../snippets/TopicAliasing_block_correct.cpp | 7 + .../doc/snippets/TopicAliasing_cwise.cpp | 20 + .../doc/snippets/TopicAliasing_mult1.cpp | 4 + .../doc/snippets/TopicAliasing_mult2.cpp | 10 + .../doc/snippets/TopicAliasing_mult3.cpp | 4 + .../doc/snippets/TopicAliasing_mult4.cpp | 5 + .../doc/snippets/TopicAliasing_mult5.cpp | 5 + .../snippets/TopicStorageOrders_example.cpp | 18 + .../doc/snippets/Triangular_solve.cpp | 11 + ...lization_Tridiagonalization_MatrixType.cpp | 9 + .../snippets/Tridiagonalization_compute.cpp | 9 + .../Tridiagonalization_decomposeInPlace.cpp | 11 + .../snippets/Tridiagonalization_diagonal.cpp | 13 + ...iagonalization_householderCoefficients.cpp | 6 + .../Tridiagonalization_packedMatrix.cpp | 8 + .../Tutorial_AdvancedInitialization_Block.cpp | 5 + ..._AdvancedInitialization_CommaTemporary.cpp | 4 + .../Tutorial_AdvancedInitialization_Join.cpp | 11 + ...orial_AdvancedInitialization_LinSpaced.cpp | 7 + ...orial_AdvancedInitialization_ThreeWays.cpp | 20 + .../Tutorial_AdvancedInitialization_Zero.cpp | 13 + .../doc/snippets/Tutorial_Map_rowmajor.cpp | 7 + .../doc/snippets/Tutorial_Map_using.cpp | 21 + .../doc/snippets/Tutorial_ReshapeMat2Mat.cpp | 6 + .../doc/snippets/Tutorial_ReshapeMat2Vec.cpp | 11 + .../doc/snippets/Tutorial_SlicingCol.cpp | 11 + .../doc/snippets/Tutorial_SlicingVec.cpp | 4 + .../doc/snippets/Tutorial_commainit_01.cpp | 5 + .../doc/snippets/Tutorial_commainit_01b.cpp | 5 + .../doc/snippets/Tutorial_commainit_02.cpp | 7 + .../Tutorial_range_for_loop_1d_cxx11.cpp | 4 + .../Tutorial_range_for_loop_2d_cxx11.cpp | 5 + .../Tutorial_reshaped_vs_resize_1.cpp | 5 + .../Tutorial_reshaped_vs_resize_2.cpp | 6 + .../Tutorial_solve_matrix_inverse.cpp | 6 + .../snippets/Tutorial_solve_multiple_rhs.cpp | 10 + .../Tutorial_solve_reuse_decomposition.cpp | 13 + .../doc/snippets/Tutorial_solve_singular.cpp | 9 + .../snippets/Tutorial_solve_triangular.cpp | 8 + .../Tutorial_solve_triangular_inplace.cpp | 6 + .../doc/snippets/Tutorial_std_sort.cpp | 4 + .../snippets/Tutorial_std_sort_rows_cxx11.cpp | 5 + .../doc/snippets/VectorwiseOp_homogeneous.cpp | 6 + .../doc/snippets/Vectorwise_reverse.cpp | 10 + .../doc/snippets/class_FullPivLU.cpp | 16 + .../doc/snippets/compile_snippet.cpp.in | 23 + .../snippets/tut_arithmetic_redux_minmax.cpp | 12 + .../tut_arithmetic_transpose_aliasing.cpp | 5 + .../tut_arithmetic_transpose_conjugate.cpp | 12 + .../tut_arithmetic_transpose_inplace.cpp | 6 + .../tut_matrix_assignment_resizing.cpp | 5 + .../doc/special_examples/CMakeLists.txt | 34 + .../Tutorial_sparse_example.cpp | 38 + .../Tutorial_sparse_example_details.cpp | 44 + .../doc/special_examples/random_cpp11.cpp | 14 + lib/eigen-3.4.0/doc/tutorial.cpp | 62 + lib/eigen-3.4.0/eigen3.pc.in | 9 + lib/eigen-3.4.0/failtest/CMakeLists.txt | 70 + lib/eigen-3.4.0/failtest/bdcsvd_int.cpp | 14 + .../block_nonconst_ctor_on_const_xpr_0.cpp | 15 + .../block_nonconst_ctor_on_const_xpr_1.cpp | 15 + .../block_nonconst_ctor_on_const_xpr_2.cpp | 16 + .../block_on_const_type_actually_const_0.cpp | 16 + .../block_on_const_type_actually_const_1.cpp | 16 + lib/eigen-3.4.0/failtest/colpivqr_int.cpp | 14 + .../const_qualified_block_method_retval_0.cpp | 15 + .../const_qualified_block_method_retval_1.cpp | 15 + ...const_qualified_diagonal_method_retval.cpp | 15 + ...onst_qualified_transpose_method_retval.cpp | 15 + ...seunaryview_nonconst_ctor_on_const_xpr.cpp | 15 + ...unaryview_on_const_type_actually_const.cpp | 16 + .../diagonal_nonconst_ctor_on_const_xpr.cpp | 15 + .../diagonal_on_const_type_actually_const.cpp | 16 + lib/eigen-3.4.0/failtest/eigensolver_cplx.cpp | 14 + lib/eigen-3.4.0/failtest/eigensolver_int.cpp | 14 + .../failtest/failtest_sanity_check.cpp | 5 + lib/eigen-3.4.0/failtest/fullpivlu_int.cpp | 14 + lib/eigen-3.4.0/failtest/fullpivqr_int.cpp | 14 + .../failtest/initializer_list_1.cpp | 14 + .../failtest/initializer_list_2.cpp | 16 + lib/eigen-3.4.0/failtest/jacobisvd_int.cpp | 14 + lib/eigen-3.4.0/failtest/ldlt_int.cpp | 14 + lib/eigen-3.4.0/failtest/llt_int.cpp | 14 + .../map_nonconst_ctor_on_const_ptr_0.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_1.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_2.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_3.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_4.cpp | 15 + .../map_on_const_type_actually_const_0.cpp | 15 + .../map_on_const_type_actually_const_1.cpp | 15 + lib/eigen-3.4.0/failtest/partialpivlu_int.cpp | 14 + lib/eigen-3.4.0/failtest/qr_int.cpp | 14 + lib/eigen-3.4.0/failtest/ref_1.cpp | 18 + lib/eigen-3.4.0/failtest/ref_2.cpp | 15 + lib/eigen-3.4.0/failtest/ref_3.cpp | 15 + lib/eigen-3.4.0/failtest/ref_4.cpp | 15 + lib/eigen-3.4.0/failtest/ref_5.cpp | 16 + ...adjointview_nonconst_ctor_on_const_xpr.cpp | 15 + ...jointview_on_const_type_actually_const.cpp | 16 + lib/eigen-3.4.0/failtest/sparse_ref_1.cpp | 18 + lib/eigen-3.4.0/failtest/sparse_ref_2.cpp | 15 + lib/eigen-3.4.0/failtest/sparse_ref_3.cpp | 15 + lib/eigen-3.4.0/failtest/sparse_ref_4.cpp | 15 + lib/eigen-3.4.0/failtest/sparse_ref_5.cpp | 16 + .../failtest/sparse_storage_mismatch.cpp | 16 + lib/eigen-3.4.0/failtest/swap_1.cpp | 14 + lib/eigen-3.4.0/failtest/swap_2.cpp | 14 + lib/eigen-3.4.0/failtest/ternary_1.cpp | 13 + lib/eigen-3.4.0/failtest/ternary_2.cpp | 13 + .../transpose_nonconst_ctor_on_const_xpr.cpp | 15 + ...transpose_on_const_type_actually_const.cpp | 16 + ...angularview_nonconst_ctor_on_const_xpr.cpp | 15 + ...gularview_on_const_type_actually_const.cpp | 16 + lib/eigen-3.4.0/lapack/CMakeLists.txt | 452 + lib/eigen-3.4.0/lapack/cholesky.cpp | 72 + lib/eigen-3.4.0/lapack/clacgv.f | 116 + lib/eigen-3.4.0/lapack/cladiv.f | 97 + lib/eigen-3.4.0/lapack/clarf.f | 232 + lib/eigen-3.4.0/lapack/clarfb.f | 771 + lib/eigen-3.4.0/lapack/clarfg.f | 203 + lib/eigen-3.4.0/lapack/clarft.f | 328 + lib/eigen-3.4.0/lapack/complex_double.cpp | 18 + lib/eigen-3.4.0/lapack/complex_single.cpp | 18 + lib/eigen-3.4.0/lapack/dladiv.f | 128 + lib/eigen-3.4.0/lapack/dlamch.f | 189 + lib/eigen-3.4.0/lapack/dlapy2.f | 104 + lib/eigen-3.4.0/lapack/dlapy3.f | 111 + lib/eigen-3.4.0/lapack/dlarf.f | 227 + lib/eigen-3.4.0/lapack/dlarfb.f | 762 + lib/eigen-3.4.0/lapack/dlarfg.f | 196 + lib/eigen-3.4.0/lapack/dlarft.f | 326 + lib/eigen-3.4.0/lapack/double.cpp | 18 + lib/eigen-3.4.0/lapack/dsecnd_NONE.f | 52 + lib/eigen-3.4.0/lapack/eigenvalues.cpp | 62 + lib/eigen-3.4.0/lapack/ilaclc.f | 118 + lib/eigen-3.4.0/lapack/ilaclr.f | 121 + lib/eigen-3.4.0/lapack/iladlc.f | 118 + lib/eigen-3.4.0/lapack/iladlr.f | 121 + lib/eigen-3.4.0/lapack/ilaslc.f | 118 + lib/eigen-3.4.0/lapack/ilaslr.f | 121 + lib/eigen-3.4.0/lapack/ilazlc.f | 118 + lib/eigen-3.4.0/lapack/ilazlr.f | 121 + lib/eigen-3.4.0/lapack/lapack_common.h | 29 + lib/eigen-3.4.0/lapack/lu.cpp | 89 + lib/eigen-3.4.0/lapack/second_NONE.f | 52 + lib/eigen-3.4.0/lapack/single.cpp | 18 + lib/eigen-3.4.0/lapack/sladiv.f | 128 + lib/eigen-3.4.0/lapack/slamch.f | 192 + lib/eigen-3.4.0/lapack/slapy2.f | 104 + lib/eigen-3.4.0/lapack/slapy3.f | 111 + lib/eigen-3.4.0/lapack/slarf.f | 227 + lib/eigen-3.4.0/lapack/slarfb.f | 763 + lib/eigen-3.4.0/lapack/slarfg.f | 196 + lib/eigen-3.4.0/lapack/slarft.f | 326 + lib/eigen-3.4.0/lapack/svd.cpp | 138 + lib/eigen-3.4.0/lapack/zlacgv.f | 116 + lib/eigen-3.4.0/lapack/zladiv.f | 97 + lib/eigen-3.4.0/lapack/zlarf.f | 232 + lib/eigen-3.4.0/lapack/zlarfb.f | 774 + lib/eigen-3.4.0/lapack/zlarfg.f | 203 + lib/eigen-3.4.0/lapack/zlarft.f | 327 + lib/eigen-3.4.0/scripts/CMakeLists.txt | 6 + lib/eigen-3.4.0/scripts/cdashtesting.cmake.in | 49 + lib/eigen-3.4.0/scripts/check.in | 21 + lib/eigen-3.4.0/scripts/debug.in | 3 + lib/eigen-3.4.0/scripts/eigen_gen_credits.cpp | 232 + lib/eigen-3.4.0/scripts/eigen_gen_docs | 24 + .../scripts/eigen_gen_split_test_help.cmake | 11 + lib/eigen-3.4.0/scripts/eigen_monitor_perf.sh | 25 + lib/eigen-3.4.0/scripts/release.in | 3 + lib/eigen-3.4.0/scripts/relicense.py | 69 + .../signature_of_eigen3_matrix_library | 1 + lib/eigen-3.4.0/test/AnnoyingScalar.h | 165 + lib/eigen-3.4.0/test/CMakeLists.txt | 465 + lib/eigen-3.4.0/test/MovableScalar.h | 35 + lib/eigen-3.4.0/test/SafeScalar.h | 30 + lib/eigen-3.4.0/test/adjoint.cpp | 219 + lib/eigen-3.4.0/test/array_cwise.cpp | 710 + lib/eigen-3.4.0/test/array_for_matrix.cpp | 307 + lib/eigen-3.4.0/test/array_of_string.cpp | 32 + lib/eigen-3.4.0/test/array_replicate.cpp | 81 + lib/eigen-3.4.0/test/array_reverse.cpp | 204 + lib/eigen-3.4.0/test/bandmatrix.cpp | 71 + lib/eigen-3.4.0/test/basicstuff.cpp | 356 + lib/eigen-3.4.0/test/bdcsvd.cpp | 118 + lib/eigen-3.4.0/test/bfloat16_float.cpp | 378 + lib/eigen-3.4.0/test/bicgstab.cpp | 34 + lib/eigen-3.4.0/test/blasutil.cpp | 210 + lib/eigen-3.4.0/test/block.cpp | 316 + lib/eigen-3.4.0/test/boostmultiprec.cpp | 208 + lib/eigen-3.4.0/test/bug1213.cpp | 13 + lib/eigen-3.4.0/test/bug1213.h | 8 + lib/eigen-3.4.0/test/bug1213_main.cpp | 18 + lib/eigen-3.4.0/test/cholesky.cpp | 532 + lib/eigen-3.4.0/test/cholmod_support.cpp | 69 + lib/eigen-3.4.0/test/commainitializer.cpp | 118 + lib/eigen-3.4.0/test/conjugate_gradient.cpp | 34 + lib/eigen-3.4.0/test/conservative_resize.cpp | 167 + lib/eigen-3.4.0/test/constructor.cpp | 98 + lib/eigen-3.4.0/test/corners.cpp | 117 + lib/eigen-3.4.0/test/ctorleak.cpp | 81 + lib/eigen-3.4.0/test/denseLM.cpp | 190 + lib/eigen-3.4.0/test/dense_storage.cpp | 190 + lib/eigen-3.4.0/test/determinant.cpp | 66 + lib/eigen-3.4.0/test/diagonal.cpp | 105 + .../test/diagonal_matrix_variadic_ctor.cpp | 185 + lib/eigen-3.4.0/test/diagonalmatrices.cpp | 173 + lib/eigen-3.4.0/test/dontalign.cpp | 62 + lib/eigen-3.4.0/test/dynalloc.cpp | 177 + lib/eigen-3.4.0/test/eigen2support.cpp | 65 + lib/eigen-3.4.0/test/eigensolver_complex.cpp | 176 + .../test/eigensolver_generalized_real.cpp | 103 + lib/eigen-3.4.0/test/eigensolver_generic.cpp | 247 + .../test/eigensolver_selfadjoint.cpp | 281 + lib/eigen-3.4.0/test/evaluator_common.h | 0 lib/eigen-3.4.0/test/evaluators.cpp | 525 + lib/eigen-3.4.0/test/exceptions.cpp | 49 + lib/eigen-3.4.0/test/fastmath.cpp | 99 + lib/eigen-3.4.0/test/first_aligned.cpp | 51 + lib/eigen-3.4.0/test/geo_alignedbox.cpp | 531 + lib/eigen-3.4.0/test/geo_eulerangles.cpp | 112 + lib/eigen-3.4.0/test/geo_homogeneous.cpp | 125 + lib/eigen-3.4.0/test/geo_hyperplane.cpp | 192 + lib/eigen-3.4.0/test/geo_orthomethods.cpp | 133 + lib/eigen-3.4.0/test/geo_parametrizedline.cpp | 125 + lib/eigen-3.4.0/test/geo_quaternion.cpp | 332 + lib/eigen-3.4.0/test/geo_transformations.cpp | 731 + lib/eigen-3.4.0/test/gpu_basic.cu | 461 + lib/eigen-3.4.0/test/gpu_common.h | 176 + lib/eigen-3.4.0/test/half_float.cpp | 349 + lib/eigen-3.4.0/test/hessenberg.cpp | 62 + lib/eigen-3.4.0/test/householder.cpp | 148 + lib/eigen-3.4.0/test/incomplete_cholesky.cpp | 69 + lib/eigen-3.4.0/test/indexed_view.cpp | 473 + .../test/initializer_list_construction.cpp | 385 + .../test/inplace_decomposition.cpp | 110 + lib/eigen-3.4.0/test/integer_types.cpp | 173 + lib/eigen-3.4.0/test/inverse.cpp | 150 + lib/eigen-3.4.0/test/io.cpp | 71 + lib/eigen-3.4.0/test/is_same_dense.cpp | 41 + lib/eigen-3.4.0/test/jacobi.cpp | 80 + lib/eigen-3.4.0/test/jacobisvd.cpp | 147 + lib/eigen-3.4.0/test/klu_support.cpp | 32 + lib/eigen-3.4.0/test/linearstructure.cpp | 147 + lib/eigen-3.4.0/test/lscg.cpp | 37 + lib/eigen-3.4.0/test/lu.cpp | 252 + lib/eigen-3.4.0/test/main.h | 857 + lib/eigen-3.4.0/test/mapped_matrix.cpp | 207 + lib/eigen-3.4.0/test/mapstaticmethods.cpp | 177 + lib/eigen-3.4.0/test/mapstride.cpp | 260 + lib/eigen-3.4.0/test/meta.cpp | 158 + lib/eigen-3.4.0/test/metis_support.cpp | 25 + lib/eigen-3.4.0/test/miscmatrices.cpp | 46 + lib/eigen-3.4.0/test/mixingtypes.cpp | 329 + lib/eigen-3.4.0/test/mpl2only.cpp | 24 + lib/eigen-3.4.0/test/nestbyvalue.cpp | 37 + lib/eigen-3.4.0/test/nesting_ops.cpp | 107 + lib/eigen-3.4.0/test/nomalloc.cpp | 228 + lib/eigen-3.4.0/test/nullary.cpp | 341 + lib/eigen-3.4.0/test/num_dimensions.cpp | 90 + lib/eigen-3.4.0/test/numext.cpp | 275 + lib/eigen-3.4.0/test/packetmath.cpp | 1302 ++ lib/eigen-3.4.0/test/packetmath_test_shared.h | 275 + lib/eigen-3.4.0/test/pardiso_support.cpp | 29 + lib/eigen-3.4.0/test/pastix_support.cpp | 54 + lib/eigen-3.4.0/test/permutationmatrices.cpp | 181 + lib/eigen-3.4.0/test/prec_inverse_4x4.cpp | 82 + lib/eigen-3.4.0/test/product.h | 259 + lib/eigen-3.4.0/test/product_extra.cpp | 390 + lib/eigen-3.4.0/test/product_large.cpp | 131 + lib/eigen-3.4.0/test/product_mmtr.cpp | 106 + lib/eigen-3.4.0/test/product_notemporary.cpp | 209 + lib/eigen-3.4.0/test/product_selfadjoint.cpp | 86 + lib/eigen-3.4.0/test/product_small.cpp | 323 + lib/eigen-3.4.0/test/product_symm.cpp | 125 + lib/eigen-3.4.0/test/product_syrk.cpp | 146 + lib/eigen-3.4.0/test/product_trmm.cpp | 137 + lib/eigen-3.4.0/test/product_trmv.cpp | 90 + lib/eigen-3.4.0/test/product_trsolve.cpp | 127 + lib/eigen-3.4.0/test/qr.cpp | 130 + lib/eigen-3.4.0/test/qr_colpivoting.cpp | 368 + lib/eigen-3.4.0/test/qr_fullpivoting.cpp | 159 + lib/eigen-3.4.0/test/qtvector.cpp | 156 + lib/eigen-3.4.0/test/rand.cpp | 118 + .../test/random_without_cast_overflow.h | 152 + lib/eigen-3.4.0/test/real_qz.cpp | 94 + lib/eigen-3.4.0/test/redux.cpp | 183 + lib/eigen-3.4.0/test/ref.cpp | 360 + lib/eigen-3.4.0/test/reshape.cpp | 216 + lib/eigen-3.4.0/test/resize.cpp | 41 + lib/eigen-3.4.0/test/rvalue_types.cpp | 157 + lib/eigen-3.4.0/test/schur_complex.cpp | 91 + lib/eigen-3.4.0/test/schur_real.cpp | 110 + lib/eigen-3.4.0/test/selfadjoint.cpp | 75 + lib/eigen-3.4.0/test/simplicial_cholesky.cpp | 50 + lib/eigen-3.4.0/test/sizeof.cpp | 47 + lib/eigen-3.4.0/test/sizeoverflow.cpp | 64 + lib/eigen-3.4.0/test/smallvectors.cpp | 67 + lib/eigen-3.4.0/test/solverbase.h | 36 + lib/eigen-3.4.0/test/sparse.h | 204 + lib/eigen-3.4.0/test/sparseLM.cpp | 176 + lib/eigen-3.4.0/test/sparse_basic.cpp | 760 + lib/eigen-3.4.0/test/sparse_block.cpp | 323 + lib/eigen-3.4.0/test/sparse_permutations.cpp | 236 + lib/eigen-3.4.0/test/sparse_product.cpp | 477 + lib/eigen-3.4.0/test/sparse_ref.cpp | 139 + lib/eigen-3.4.0/test/sparse_solver.h | 699 + lib/eigen-3.4.0/test/sparse_solvers.cpp | 125 + lib/eigen-3.4.0/test/sparse_vector.cpp | 163 + lib/eigen-3.4.0/test/sparselu.cpp | 45 + lib/eigen-3.4.0/test/sparseqr.cpp | 149 + lib/eigen-3.4.0/test/special_numbers.cpp | 58 + lib/eigen-3.4.0/test/split_test_helper.h | 5994 ++++++ lib/eigen-3.4.0/test/spqr_support.cpp | 64 + lib/eigen-3.4.0/test/stable_norm.cpp | 245 + lib/eigen-3.4.0/test/stddeque.cpp | 130 + lib/eigen-3.4.0/test/stddeque_overload.cpp | 158 + lib/eigen-3.4.0/test/stdlist.cpp | 130 + lib/eigen-3.4.0/test/stdlist_overload.cpp | 192 + lib/eigen-3.4.0/test/stdvector.cpp | 158 + lib/eigen-3.4.0/test/stdvector_overload.cpp | 161 + lib/eigen-3.4.0/test/stl_iterators.cpp | 562 + lib/eigen-3.4.0/test/superlu_support.cpp | 23 + lib/eigen-3.4.0/test/svd_common.h | 521 + lib/eigen-3.4.0/test/svd_fill.h | 118 + lib/eigen-3.4.0/test/swap.cpp | 94 + lib/eigen-3.4.0/test/symbolic_index.cpp | 84 + lib/eigen-3.4.0/test/triangular.cpp | 292 + lib/eigen-3.4.0/test/type_alias.cpp | 48 + lib/eigen-3.4.0/test/umeyama.cpp | 183 + lib/eigen-3.4.0/test/umfpack_support.cpp | 34 + lib/eigen-3.4.0/test/unalignedcount.cpp | 60 + .../test/upperbidiagonalization.cpp | 43 + lib/eigen-3.4.0/test/vectorization_logic.cpp | 429 + lib/eigen-3.4.0/test/vectorwiseop.cpp | 298 + lib/eigen-3.4.0/test/visitor.cpp | 193 + lib/eigen-3.4.0/test/zerosized.cpp | 111 + lib/eigen-3.4.0/unsupported/CMakeLists.txt | 11 + .../unsupported/Eigen/AdolcForward | 159 + .../unsupported/Eigen/AlignedVector3 | 234 + .../unsupported/Eigen/ArpackSupport | 30 + lib/eigen-3.4.0/unsupported/Eigen/AutoDiff | 46 + lib/eigen-3.4.0/unsupported/Eigen/BVH | 95 + .../unsupported/Eigen/CMakeLists.txt | 32 + .../unsupported/Eigen/CXX11/CMakeLists.txt | 8 + .../unsupported/Eigen/CXX11/Tensor | 137 + .../unsupported/Eigen/CXX11/TensorSymmetry | 42 + .../unsupported/Eigen/CXX11/ThreadPool | 74 + .../Eigen/CXX11/src/Tensor/README.md | 1815 ++ .../Eigen/CXX11/src/Tensor/Tensor.h | 554 + .../Eigen/CXX11/src/Tensor/TensorArgMax.h | 329 + .../Eigen/CXX11/src/Tensor/TensorAssign.h | 247 + .../Eigen/CXX11/src/Tensor/TensorBase.h | 1176 ++ .../Eigen/CXX11/src/Tensor/TensorBlock.h | 1559 ++ .../CXX11/src/Tensor/TensorBroadcasting.h | 1093 ++ .../Eigen/CXX11/src/Tensor/TensorChipping.h | 518 + .../CXX11/src/Tensor/TensorConcatenation.h | 377 + .../CXX11/src/Tensor/TensorContraction.h | 1023 + .../src/Tensor/TensorContractionBlocking.h | 73 + .../CXX11/src/Tensor/TensorContractionCuda.h | 6 + .../CXX11/src/Tensor/TensorContractionGpu.h | 1413 ++ .../src/Tensor/TensorContractionMapper.h | 575 + .../CXX11/src/Tensor/TensorContractionSycl.h | 1650 ++ .../src/Tensor/TensorContractionThreadPool.h | 1679 ++ .../Eigen/CXX11/src/Tensor/TensorConversion.h | 456 + .../CXX11/src/Tensor/TensorConvolution.h | 1132 ++ .../CXX11/src/Tensor/TensorConvolutionSycl.h | 544 + .../Eigen/CXX11/src/Tensor/TensorCostModel.h | 214 + .../Eigen/CXX11/src/Tensor/TensorCustomOp.h | 347 + .../Eigen/CXX11/src/Tensor/TensorDevice.h | 137 + .../Eigen/CXX11/src/Tensor/TensorDeviceCuda.h | 6 + .../CXX11/src/Tensor/TensorDeviceDefault.h | 104 + .../Eigen/CXX11/src/Tensor/TensorDeviceGpu.h | 389 + .../Eigen/CXX11/src/Tensor/TensorDeviceSycl.h | 1048 + .../CXX11/src/Tensor/TensorDeviceThreadPool.h | 409 + .../CXX11/src/Tensor/TensorDimensionList.h | 236 + .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 490 + .../Eigen/CXX11/src/Tensor/TensorEvalTo.h | 236 + .../Eigen/CXX11/src/Tensor/TensorEvaluator.h | 983 + .../Eigen/CXX11/src/Tensor/TensorExecutor.h | 703 + .../Eigen/CXX11/src/Tensor/TensorExpr.h | 388 + .../Eigen/CXX11/src/Tensor/TensorFFT.h | 669 + .../Eigen/CXX11/src/Tensor/TensorFixedSize.h | 379 + .../Eigen/CXX11/src/Tensor/TensorForcedEval.h | 237 + .../src/Tensor/TensorForwardDeclarations.h | 191 + .../Eigen/CXX11/src/Tensor/TensorFunctors.h | 488 + .../Eigen/CXX11/src/Tensor/TensorGenerator.h | 302 + .../CXX11/src/Tensor/TensorGlobalFunctions.h | 33 + .../src/Tensor/TensorGpuHipCudaDefines.h | 99 + .../src/Tensor/TensorGpuHipCudaUndefines.h | 44 + .../Eigen/CXX11/src/Tensor/TensorIO.h | 79 + .../Eigen/CXX11/src/Tensor/TensorImagePatch.h | 603 + .../Eigen/CXX11/src/Tensor/TensorIndexList.h | 738 + .../Eigen/CXX11/src/Tensor/TensorInflation.h | 247 + .../CXX11/src/Tensor/TensorInitializer.h | 82 + .../Eigen/CXX11/src/Tensor/TensorIntDiv.h | 263 + .../Eigen/CXX11/src/Tensor/TensorLayoutSwap.h | 216 + .../Eigen/CXX11/src/Tensor/TensorMacros.h | 98 + .../Eigen/CXX11/src/Tensor/TensorMap.h | 327 + .../Eigen/CXX11/src/Tensor/TensorMeta.h | 311 + .../Eigen/CXX11/src/Tensor/TensorMorphing.h | 1102 ++ .../Eigen/CXX11/src/Tensor/TensorPadding.h | 708 + .../Eigen/CXX11/src/Tensor/TensorPatch.h | 291 + .../Eigen/CXX11/src/Tensor/TensorRandom.h | 322 + .../Eigen/CXX11/src/Tensor/TensorReduction.h | 998 + .../CXX11/src/Tensor/TensorReductionCuda.h | 6 + .../CXX11/src/Tensor/TensorReductionGpu.h | 966 + .../CXX11/src/Tensor/TensorReductionSycl.h | 582 + .../Eigen/CXX11/src/Tensor/TensorRef.h | 454 + .../Eigen/CXX11/src/Tensor/TensorReverse.h | 465 + .../Eigen/CXX11/src/Tensor/TensorScan.h | 528 + .../Eigen/CXX11/src/Tensor/TensorScanSycl.h | 513 + .../Eigen/CXX11/src/Tensor/TensorShuffling.h | 471 + .../Eigen/CXX11/src/Tensor/TensorStorage.h | 161 + .../Eigen/CXX11/src/Tensor/TensorStriding.h | 346 + .../Eigen/CXX11/src/Tensor/TensorTrace.h | 303 + .../Eigen/CXX11/src/Tensor/TensorTraits.h | 264 + .../Eigen/CXX11/src/Tensor/TensorUInt128.h | 249 + .../CXX11/src/Tensor/TensorVolumePatch.h | 629 + .../src/TensorSymmetry/DynamicSymmetry.h | 293 + .../CXX11/src/TensorSymmetry/StaticSymmetry.h | 236 + .../Eigen/CXX11/src/TensorSymmetry/Symmetry.h | 338 + .../TensorSymmetry/util/TemplateGroupTheory.h | 669 + .../Eigen/CXX11/src/ThreadPool/Barrier.h | 67 + .../Eigen/CXX11/src/ThreadPool/EventCount.h | 249 + .../src/ThreadPool/NonBlockingThreadPool.h | 486 + .../Eigen/CXX11/src/ThreadPool/RunQueue.h | 236 + .../Eigen/CXX11/src/ThreadPool/ThreadCancel.h | 23 + .../CXX11/src/ThreadPool/ThreadEnvironment.h | 40 + .../Eigen/CXX11/src/ThreadPool/ThreadLocal.h | 301 + .../src/ThreadPool/ThreadPoolInterface.h | 48 + .../Eigen/CXX11/src/ThreadPool/ThreadYield.h | 20 + .../Eigen/CXX11/src/util/CXX11Meta.h | 537 + .../Eigen/CXX11/src/util/CXX11Workarounds.h | 88 + .../Eigen/CXX11/src/util/EmulateArray.h | 261 + .../Eigen/CXX11/src/util/MaxSizeVector.h | 158 + lib/eigen-3.4.0/unsupported/Eigen/EulerAngles | 43 + lib/eigen-3.4.0/unsupported/Eigen/FFT | 419 + .../unsupported/Eigen/IterativeSolvers | 51 + .../unsupported/Eigen/KroneckerProduct | 36 + .../unsupported/Eigen/LevenbergMarquardt | 49 + .../unsupported/Eigen/MPRealSupport | 213 + .../unsupported/Eigen/MatrixFunctions | 504 + .../unsupported/Eigen/MoreVectorization | 24 + .../unsupported/Eigen/NonLinearOptimization | 140 + .../unsupported/Eigen/NumericalDiff | 56 + .../unsupported/Eigen/OpenGLSupport | 322 + lib/eigen-3.4.0/unsupported/Eigen/Polynomials | 137 + lib/eigen-3.4.0/unsupported/Eigen/Skyline | 39 + lib/eigen-3.4.0/unsupported/Eigen/SparseExtra | 54 + .../unsupported/Eigen/SpecialFunctions | 103 + lib/eigen-3.4.0/unsupported/Eigen/Splines | 35 + .../Eigen/src/AutoDiff/AutoDiffJacobian.h | 108 + .../Eigen/src/AutoDiff/AutoDiffScalar.h | 730 + .../Eigen/src/AutoDiff/AutoDiffVector.h | 220 + .../unsupported/Eigen/src/BVH/BVAlgorithms.h | 293 + .../unsupported/Eigen/src/BVH/KdBVH.h | 223 + .../ArpackSelfAdjointEigenSolver.h | 790 + .../Eigen/src/EulerAngles/CMakeLists.txt | 6 + .../Eigen/src/EulerAngles/EulerAngles.h | 355 + .../Eigen/src/EulerAngles/EulerSystem.h | 305 + .../unsupported/Eigen/src/FFT/ei_fftw_impl.h | 261 + .../Eigen/src/FFT/ei_kissfft_impl.h | 449 + .../IterativeSolvers/ConstrainedConjGrad.h | 187 + .../Eigen/src/IterativeSolvers/DGMRES.h | 511 + .../Eigen/src/IterativeSolvers/GMRES.h | 335 + .../Eigen/src/IterativeSolvers/IDRS.h | 436 + .../Eigen/src/IterativeSolvers/IncompleteLU.h | 90 + .../IterativeSolvers/IterationController.h | 154 + .../Eigen/src/IterativeSolvers/MINRES.h | 267 + .../Eigen/src/IterativeSolvers/Scaling.h | 193 + .../KroneckerProduct/KroneckerTensorProduct.h | 305 + .../LevenbergMarquardt/CopyrightMINPACK.txt | 52 + .../Eigen/src/LevenbergMarquardt/LMcovar.h | 84 + .../Eigen/src/LevenbergMarquardt/LMonestep.h | 202 + .../Eigen/src/LevenbergMarquardt/LMpar.h | 160 + .../Eigen/src/LevenbergMarquardt/LMqrsolv.h | 188 + .../LevenbergMarquardt/LevenbergMarquardt.h | 396 + .../src/MatrixFunctions/MatrixExponential.h | 441 + .../src/MatrixFunctions/MatrixFunction.h | 569 + .../src/MatrixFunctions/MatrixLogarithm.h | 373 + .../Eigen/src/MatrixFunctions/MatrixPower.h | 705 + .../src/MatrixFunctions/MatrixSquareRoot.h | 368 + .../Eigen/src/MatrixFunctions/StemFunction.h | 117 + .../src/MoreVectorization/MathFunctions.h | 95 + .../HybridNonLinearSolver.h | 601 + .../LevenbergMarquardt.h | 657 + .../Eigen/src/NonLinearOptimization/chkder.h | 66 + .../Eigen/src/NonLinearOptimization/covar.h | 70 + .../Eigen/src/NonLinearOptimization/dogleg.h | 107 + .../Eigen/src/NonLinearOptimization/fdjac1.h | 79 + .../Eigen/src/NonLinearOptimization/lmpar.h | 298 + .../Eigen/src/NonLinearOptimization/qrsolv.h | 91 + .../Eigen/src/NonLinearOptimization/r1mpyq.h | 30 + .../Eigen/src/NonLinearOptimization/r1updt.h | 99 + .../Eigen/src/NonLinearOptimization/rwupdt.h | 49 + .../Eigen/src/NumericalDiff/NumericalDiff.h | 130 + .../Eigen/src/Polynomials/Companion.h | 280 + .../Eigen/src/Polynomials/PolynomialSolver.h | 428 + .../Eigen/src/Polynomials/PolynomialUtils.h | 143 + .../Eigen/src/Skyline/SkylineInplaceLU.h | 352 + .../Eigen/src/Skyline/SkylineMatrix.h | 862 + .../Eigen/src/Skyline/SkylineMatrixBase.h | 212 + .../Eigen/src/Skyline/SkylineProduct.h | 295 + .../Eigen/src/Skyline/SkylineStorage.h | 259 + .../Eigen/src/Skyline/SkylineUtil.h | 89 + .../SparseExtra/BlockOfDynamicSparseMatrix.h | 122 + .../Eigen/src/SparseExtra/BlockSparseMatrix.h | 1079 + .../src/SparseExtra/DynamicSparseMatrix.h | 404 + .../Eigen/src/SparseExtra/MarketIO.h | 282 + .../src/SparseExtra/MatrixMarketIterator.h | 247 + .../Eigen/src/SparseExtra/RandomSetter.h | 349 + .../BesselFunctionsArrayAPI.h | 286 + .../BesselFunctionsBFloat16.h | 68 + .../BesselFunctionsFunctors.h | 357 + .../SpecialFunctions/BesselFunctionsHalf.h | 66 + .../SpecialFunctions/BesselFunctionsImpl.h | 1959 ++ .../BesselFunctionsPacketMath.h | 118 + .../SpecialFunctions/HipVectorCompatibility.h | 67 + .../SpecialFunctionsArrayAPI.h | 167 + .../SpecialFunctionsBFloat16.h | 58 + .../SpecialFunctionsFunctors.h | 330 + .../SpecialFunctions/SpecialFunctionsHalf.h | 58 + .../SpecialFunctions/SpecialFunctionsImpl.h | 2045 ++ .../SpecialFunctionsPacketMath.h | 79 + .../arch/AVX/BesselFunctions.h | 46 + .../arch/AVX/SpecialFunctions.h | 16 + .../arch/AVX512/BesselFunctions.h | 46 + .../arch/AVX512/SpecialFunctions.h | 16 + .../arch/GPU/SpecialFunctions.h | 369 + .../arch/NEON/BesselFunctions.h | 54 + .../arch/NEON/SpecialFunctions.h | 34 + .../unsupported/Eigen/src/Splines/Spline.h | 507 + .../Eigen/src/Splines/SplineFitting.h | 431 + .../unsupported/Eigen/src/Splines/SplineFwd.h | 93 + lib/eigen-3.4.0/unsupported/README.txt | 50 + .../unsupported/bench/bench_svd.cpp | 123 + .../unsupported/doc/CMakeLists.txt | 4 + lib/eigen-3.4.0/unsupported/doc/Overview.dox | 31 + lib/eigen-3.4.0/unsupported/doc/SYCL.dox | 9 + .../unsupported/doc/eigendoxy_layout.xml.in | 177 + .../unsupported/doc/examples/BVH_Example.cpp | 50 + .../unsupported/doc/examples/CMakeLists.txt | 24 + .../unsupported/doc/examples/EulerAngles.cpp | 46 + .../unsupported/doc/examples/FFT.cpp | 118 + .../doc/examples/MatrixExponential.cpp | 16 + .../doc/examples/MatrixFunction.cpp | 23 + .../doc/examples/MatrixLogarithm.cpp | 15 + .../unsupported/doc/examples/MatrixPower.cpp | 16 + .../doc/examples/MatrixPower_optimal.cpp | 17 + .../unsupported/doc/examples/MatrixSine.cpp | 20 + .../unsupported/doc/examples/MatrixSinh.cpp | 20 + .../doc/examples/MatrixSquareRoot.cpp | 16 + .../doc/examples/PolynomialSolver1.cpp | 53 + .../doc/examples/PolynomialUtils1.cpp | 20 + .../doc/examples/SYCL/CMakeLists.txt | 37 + .../doc/examples/SYCL/CwiseMul.cpp | 63 + .../unsupported/doc/snippets/CMakeLists.txt | 26 + lib/eigen-3.4.0/unsupported/test/BVH.cpp | 222 + .../unsupported/test/CMakeLists.txt | 417 + .../unsupported/test/EulerAngles.cpp | 296 + lib/eigen-3.4.0/unsupported/test/FFT.cpp | 2 + lib/eigen-3.4.0/unsupported/test/FFTW.cpp | 262 + .../test/NonLinearOptimization.cpp | 1849 ++ .../unsupported/test/NumericalDiff.cpp | 114 + .../unsupported/test/alignedvector3.cpp | 87 + lib/eigen-3.4.0/unsupported/test/autodiff.cpp | 387 + .../unsupported/test/autodiff_scalar.cpp | 101 + .../unsupported/test/bessel_functions.cpp | 370 + .../unsupported/test/cxx11_eventcount.cpp | 142 + .../unsupported/test/cxx11_maxsizevector.cpp | 77 + .../unsupported/test/cxx11_meta.cpp | 357 + .../test/cxx11_non_blocking_thread_pool.cpp | 180 + .../unsupported/test/cxx11_runqueue.cpp | 235 + .../unsupported/test/cxx11_tensor_argmax.cpp | 294 + .../test/cxx11_tensor_argmax_gpu.cu | 253 + .../test/cxx11_tensor_argmax_sycl.cpp | 258 + .../unsupported/test/cxx11_tensor_assign.cpp | 370 + .../test/cxx11_tensor_block_access.cpp | 576 + .../test/cxx11_tensor_block_eval.cpp | 858 + .../test/cxx11_tensor_block_io.cpp | 445 + .../test/cxx11_tensor_broadcast_sycl.cpp | 144 + .../test/cxx11_tensor_broadcasting.cpp | 331 + .../test/cxx11_tensor_builtins_sycl.cpp | 354 + .../test/cxx11_tensor_cast_float16_gpu.cu | 79 + .../unsupported/test/cxx11_tensor_casts.cpp | 186 + .../test/cxx11_tensor_chipping.cpp | 425 + .../test/cxx11_tensor_chipping_sycl.cpp | 623 + .../test/cxx11_tensor_comparisons.cpp | 84 + .../cxx11_tensor_complex_cwise_ops_gpu.cu | 102 + .../test/cxx11_tensor_complex_gpu.cu | 186 + .../test/cxx11_tensor_concatenation.cpp | 143 + .../test/cxx11_tensor_concatenation_sycl.cpp | 180 + .../unsupported/test/cxx11_tensor_const.cpp | 62 + .../test/cxx11_tensor_contract_gpu.cu | 218 + .../test/cxx11_tensor_contract_sycl.cpp | 1026 + .../test/cxx11_tensor_contraction.cpp | 601 + .../test/cxx11_tensor_convolution.cpp | 150 + .../test/cxx11_tensor_convolution_sycl.cpp | 469 + .../test/cxx11_tensor_custom_index.cpp | 100 + .../test/cxx11_tensor_custom_op.cpp | 111 + .../test/cxx11_tensor_custom_op_sycl.cpp | 170 + .../unsupported/test/cxx11_tensor_device.cu | 396 + .../test/cxx11_tensor_device_sycl.cpp | 77 + .../test/cxx11_tensor_dimension.cpp | 88 + .../unsupported/test/cxx11_tensor_empty.cpp | 40 + .../test/cxx11_tensor_executor.cpp | 731 + .../unsupported/test/cxx11_tensor_expr.cpp | 464 + .../unsupported/test/cxx11_tensor_fft.cpp | 304 + .../test/cxx11_tensor_fixed_size.cpp | 261 + .../test/cxx11_tensor_forced_eval.cpp | 79 + .../test/cxx11_tensor_forced_eval_sycl.cpp | 77 + .../test/cxx11_tensor_generator.cpp | 91 + .../test/cxx11_tensor_generator_sycl.cpp | 147 + .../unsupported/test/cxx11_tensor_gpu.cu | 1643 ++ .../unsupported/test/cxx11_tensor_ifft.cpp | 154 + .../test/cxx11_tensor_image_op_sycl.cpp | 103 + .../test/cxx11_tensor_image_patch.cpp | 809 + .../test/cxx11_tensor_image_patch_sycl.cpp | 1092 ++ .../test/cxx11_tensor_index_list.cpp | 385 + .../test/cxx11_tensor_inflation.cpp | 81 + .../test/cxx11_tensor_inflation_sycl.cpp | 136 + .../unsupported/test/cxx11_tensor_intdiv.cpp | 147 + .../unsupported/test/cxx11_tensor_io.cpp | 136 + .../test/cxx11_tensor_layout_swap.cpp | 61 + .../test/cxx11_tensor_layout_swap_sycl.cpp | 126 + .../unsupported/test/cxx11_tensor_lvalue.cpp | 42 + .../unsupported/test/cxx11_tensor_map.cpp | 327 + .../unsupported/test/cxx11_tensor_math.cpp | 46 + .../test/cxx11_tensor_math_sycl.cpp | 105 + .../test/cxx11_tensor_mixed_indices.cpp | 53 + .../test/cxx11_tensor_morphing.cpp | 565 + .../test/cxx11_tensor_morphing_sycl.cpp | 386 + .../unsupported/test/cxx11_tensor_move.cpp | 76 + .../test/cxx11_tensor_notification.cpp | 64 + .../test/cxx11_tensor_of_complex.cpp | 103 + .../test/cxx11_tensor_of_const_values.cpp | 105 + .../test/cxx11_tensor_of_float16_gpu.cu | 488 + .../test/cxx11_tensor_of_strings.cpp | 152 + .../unsupported/test/cxx11_tensor_padding.cpp | 93 + .../test/cxx11_tensor_padding_sycl.cpp | 157 + .../unsupported/test/cxx11_tensor_patch.cpp | 172 + .../test/cxx11_tensor_patch_sycl.cpp | 249 + .../unsupported/test/cxx11_tensor_random.cpp | 86 + .../test/cxx11_tensor_random_gpu.cu | 86 + .../test/cxx11_tensor_random_sycl.cpp | 100 + .../test/cxx11_tensor_reduction.cpp | 532 + .../test/cxx11_tensor_reduction_gpu.cu | 154 + .../test/cxx11_tensor_reduction_sycl.cpp | 1014 + .../unsupported/test/cxx11_tensor_ref.cpp | 248 + .../unsupported/test/cxx11_tensor_reverse.cpp | 190 + .../test/cxx11_tensor_reverse_sycl.cpp | 253 + .../test/cxx11_tensor_roundings.cpp | 62 + .../unsupported/test/cxx11_tensor_scan.cpp | 110 + .../unsupported/test/cxx11_tensor_scan_gpu.cu | 78 + .../test/cxx11_tensor_scan_sycl.cpp | 141 + .../test/cxx11_tensor_shuffling.cpp | 283 + .../test/cxx11_tensor_shuffling_sycl.cpp | 117 + .../unsupported/test/cxx11_tensor_simple.cpp | 327 + .../test/cxx11_tensor_striding.cpp | 119 + .../test/cxx11_tensor_striding_sycl.cpp | 203 + .../unsupported/test/cxx11_tensor_sugar.cpp | 81 + .../unsupported/test/cxx11_tensor_sycl.cpp | 361 + .../test/cxx11_tensor_symmetry.cpp | 818 + .../test/cxx11_tensor_thread_local.cpp | 149 + .../test/cxx11_tensor_thread_pool.cpp | 721 + .../unsupported/test/cxx11_tensor_trace.cpp | 172 + .../unsupported/test/cxx11_tensor_uint128.cpp | 160 + .../test/cxx11_tensor_volume_patch.cpp | 112 + .../test/cxx11_tensor_volume_patch_sycl.cpp | 222 + lib/eigen-3.4.0/unsupported/test/dgmres.cpp | 31 + .../unsupported/test/forward_adolc.cpp | 141 + lib/eigen-3.4.0/unsupported/test/gmres.cpp | 31 + lib/eigen-3.4.0/unsupported/test/idrs.cpp | 27 + .../unsupported/test/kronecker_product.cpp | 252 + .../unsupported/test/levenberg_marquardt.cpp | 1477 ++ .../unsupported/test/matrix_exponential.cpp | 141 + .../unsupported/test/matrix_function.cpp | 227 + .../unsupported/test/matrix_functions.h | 67 + .../unsupported/test/matrix_power.cpp | 204 + .../unsupported/test/matrix_square_root.cpp | 31 + lib/eigen-3.4.0/unsupported/test/minres.cpp | 44 + .../unsupported/test/mpreal_support.cpp | 66 + .../unsupported/test/openglsupport.cpp | 600 + .../unsupported/test/polynomialsolver.cpp | 232 + .../unsupported/test/polynomialutils.cpp | 113 + .../unsupported/test/sparse_extra.cpp | 226 + .../unsupported/test/special_functions.cpp | 497 + .../unsupported/test/special_packetmath.cpp | 149 + lib/eigen-3.4.0/unsupported/test/splines.cpp | 281 + src/main.cpp | 97 + 1802 files changed, 395509 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .idea/.gitignore create mode 100644 .idea/COSC-4P80-Assignment-2.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CMakeLists.txt create mode 100755 commit.py create mode 100644 data/L30fft1000.out create mode 100644 data/L30fft150.out create mode 100644 data/L30fft16.out create mode 100644 data/L30fft25.out create mode 100644 data/L30fft_32.out create mode 100644 data/L30fft_64.out create mode 100644 include/assign2/common.h create mode 100644 include/assign2/layer.h create mode 160000 lib/blt create mode 100644 lib/eigen-3.4.0/.gitignore create mode 100644 lib/eigen-3.4.0/.gitlab-ci.yml create mode 100644 lib/eigen-3.4.0/.gitlab/issue_templates/Bug Report.md create mode 100644 lib/eigen-3.4.0/.gitlab/issue_templates/Feature Request.md create mode 100644 lib/eigen-3.4.0/.gitlab/merge_request_templates/Merge Request Template.md create mode 100644 lib/eigen-3.4.0/.hgeol create mode 100644 lib/eigen-3.4.0/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/COPYING.APACHE create mode 100644 lib/eigen-3.4.0/COPYING.BSD create mode 100644 lib/eigen-3.4.0/COPYING.GPL create mode 100644 lib/eigen-3.4.0/COPYING.LGPL create mode 100644 lib/eigen-3.4.0/COPYING.MINPACK create mode 100644 lib/eigen-3.4.0/COPYING.MPL2 create mode 100644 lib/eigen-3.4.0/COPYING.README create mode 100644 lib/eigen-3.4.0/CTestConfig.cmake create mode 100644 lib/eigen-3.4.0/CTestCustom.cmake.in create mode 100644 lib/eigen-3.4.0/Eigen/Cholesky create mode 100644 lib/eigen-3.4.0/Eigen/CholmodSupport create mode 100644 lib/eigen-3.4.0/Eigen/Core create mode 100644 lib/eigen-3.4.0/Eigen/Dense create mode 100644 lib/eigen-3.4.0/Eigen/Eigen create mode 100644 lib/eigen-3.4.0/Eigen/Eigenvalues create mode 100644 lib/eigen-3.4.0/Eigen/Geometry create mode 100644 lib/eigen-3.4.0/Eigen/Householder create mode 100644 lib/eigen-3.4.0/Eigen/IterativeLinearSolvers create mode 100644 lib/eigen-3.4.0/Eigen/Jacobi create mode 100644 lib/eigen-3.4.0/Eigen/KLUSupport create mode 100644 lib/eigen-3.4.0/Eigen/LU create mode 100644 lib/eigen-3.4.0/Eigen/MetisSupport create mode 100644 lib/eigen-3.4.0/Eigen/OrderingMethods create mode 100644 lib/eigen-3.4.0/Eigen/PaStiXSupport create mode 100644 lib/eigen-3.4.0/Eigen/PardisoSupport create mode 100644 lib/eigen-3.4.0/Eigen/QR create mode 100644 lib/eigen-3.4.0/Eigen/QtAlignedMalloc create mode 100644 lib/eigen-3.4.0/Eigen/SPQRSupport create mode 100644 lib/eigen-3.4.0/Eigen/SVD create mode 100644 lib/eigen-3.4.0/Eigen/Sparse create mode 100644 lib/eigen-3.4.0/Eigen/SparseCholesky create mode 100644 lib/eigen-3.4.0/Eigen/SparseCore create mode 100644 lib/eigen-3.4.0/Eigen/SparseLU create mode 100644 lib/eigen-3.4.0/Eigen/SparseQR create mode 100644 lib/eigen-3.4.0/Eigen/StdDeque create mode 100644 lib/eigen-3.4.0/Eigen/StdList create mode 100644 lib/eigen-3.4.0/Eigen/StdVector create mode 100644 lib/eigen-3.4.0/Eigen/SuperLUSupport create mode 100644 lib/eigen-3.4.0/Eigen/UmfPackSupport create mode 100644 lib/eigen-3.4.0/Eigen/src/Cholesky/LDLT.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Cholesky/LLT.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Cholesky/LLT_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/CholmodSupport/CholmodSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ArithmeticSequence.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Array.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ArrayBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ArrayWrapper.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Assign.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/AssignEvaluator.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/Assign_MKL.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/BandMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Block.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/BooleanRedux.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CommaInitializer.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ConditionEstimator.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CoreEvaluators.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CoreIterators.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CwiseBinaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CwiseNullaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CwiseTernaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/DenseBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/DenseCoeffsBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/DenseStorage.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Diagonal.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/DiagonalMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/DiagonalProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Dot.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/EigenBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ForceAlignedAccess.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Fuzzy.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/GeneralProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/GenericPacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/GlobalFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/IO.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/IndexedView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Inverse.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Map.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/MapBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/MathFunctionsImpl.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Matrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/MatrixBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/NestByValue.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/NoAlias.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/NumTraits.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/PartialReduxEvaluator.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/PermutationMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/PlainObjectBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Product.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ProductEvaluators.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Random.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Redux.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Ref.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Replicate.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Reshaped.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/ReturnByValue.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Reverse.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Select.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/SelfAdjointView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/SelfCwiseBinaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Solve.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/SolveTriangular.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/SolverBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/StableNorm.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/StlIterators.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Stride.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Swap.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Transpose.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Transpositions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/TriangularMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/VectorBlock.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/VectorwiseOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/Visitor.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX512/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX512/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX512/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AVX512/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/MatrixProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/arch/AltiVec/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/CUDA/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/BFloat16.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/ConjHelper.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/Half.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/Settings.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/Default/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/GPU/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/GPU/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/GPU/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/HIP/hcc/math_constants.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/MSA/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/MSA/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/MSA/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/NEON/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/NEON/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/NEON/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/NEON/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SSE/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SSE/MathFunctions.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/arch/SSE/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SSE/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SVE/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SVE/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SVE/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SYCL/InteropHeaders.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SYCL/MathFunctions.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SYCL/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/SYCL/TypeCasting.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/ZVector/Complex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/arch/ZVector/MathFunctions.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/arch/ZVector/PacketMath.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/AssignmentFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/BinaryFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/NullaryFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/StlFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/TernaryFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/functors/UnaryFunctors.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralBlockPanelKernel.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/Parallelizer.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointMatrixMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointMatrixVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/SelfadjointRank2Update.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularMatrixMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularMatrixVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularSolverMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/products/TriangularSolverVector.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/util/BlasUtil.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/ConfigureVectorization.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/Constants.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/util/DisableStupidWarnings.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/ForwardDeclarations.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/IndexedViewHelper.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/IntegralConstant.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/util/MKL_support.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/Macros.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/Memory.h create mode 100755 lib/eigen-3.4.0/Eigen/src/Core/util/Meta.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/NonMPL2.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/ReenableStupidWarnings.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/ReshapedHelper.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/StaticAssert.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/SymbolicIndex.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Core/util/XprHelper.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/ComplexEigenSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/ComplexSchur.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/EigenSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/HessenbergDecomposition.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/RealQZ.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/RealSchur.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Eigenvalues/Tridiagonalization.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/AlignedBox.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/AngleAxis.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/EulerAngles.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Homogeneous.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Hyperplane.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/OrthoMethods.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/ParametrizedLine.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Quaternion.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Rotation2D.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/RotationBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Scaling.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Transform.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Translation.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/Umeyama.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Geometry/arch/Geometry_SIMD.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Householder/BlockHouseholder.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Householder/Householder.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Householder/HouseholderSequence.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h create mode 100644 lib/eigen-3.4.0/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h create mode 100644 lib/eigen-3.4.0/Eigen/src/Jacobi/Jacobi.h create mode 100644 lib/eigen-3.4.0/Eigen/src/KLUSupport/KLUSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/Determinant.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/FullPivLU.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/InverseImpl.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/PartialPivLU.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/PartialPivLU_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/LU/arch/InverseSize4.h create mode 100644 lib/eigen-3.4.0/Eigen/src/MetisSupport/MetisSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/OrderingMethods/Amd.h create mode 100644 lib/eigen-3.4.0/Eigen/src/OrderingMethods/Eigen_Colamd.h create mode 100644 lib/eigen-3.4.0/Eigen/src/OrderingMethods/Ordering.h create mode 100644 lib/eigen-3.4.0/Eigen/src/PaStiXSupport/PaStiXSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/PardisoSupport/PardisoSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/ColPivHouseholderQR.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/CompleteOrthogonalDecomposition.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/FullPivHouseholderQR.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/HouseholderQR.h create mode 100644 lib/eigen-3.4.0/Eigen/src/QR/HouseholderQR_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SVD/BDCSVD.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SVD/JacobiSVD.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SVD/JacobiSVD_LAPACKE.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SVD/SVDBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SVD/UpperBidiagonalization.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCholesky/SimplicialCholesky.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/AmbiVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/CompressedStorage.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/MappedSparseMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseAssign.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseBlock.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseColEtree.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseCompressedBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseCwiseBinaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseCwiseUnaryOp.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseDenseProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseDiagonalProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseDot.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseFuzzy.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseMap.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseMatrixBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparsePermutation.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseProduct.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseRedux.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseRef.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseSelfAdjointView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseSolverBase.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseSparseProductWithPruning.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseTranspose.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseTriangularView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseUtil.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/SparseView.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseCore/TriangularSolver.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLUImpl.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_Memory.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_Structs.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_Utils.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_column_bmod.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_column_dfs.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_gemm_kernel.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_kernel_bmod.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_panel_bmod.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_panel_dfs.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_pivotL.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_pruneL.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseLU/SparseLU_relax_snode.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SparseQR/SparseQR.h create mode 100644 lib/eigen-3.4.0/Eigen/src/StlSupport/StdDeque.h create mode 100644 lib/eigen-3.4.0/Eigen/src/StlSupport/StdList.h create mode 100644 lib/eigen-3.4.0/Eigen/src/StlSupport/StdVector.h create mode 100644 lib/eigen-3.4.0/Eigen/src/StlSupport/details.h create mode 100644 lib/eigen-3.4.0/Eigen/src/SuperLUSupport/SuperLUSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/UmfPackSupport/UmfPackSupport.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/Image.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/Kernel.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/RealSvd2x2.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/blas.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/lapack.h create mode 100755 lib/eigen-3.4.0/Eigen/src/misc/lapacke.h create mode 100644 lib/eigen-3.4.0/Eigen/src/misc/lapacke_mangling.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/ArrayCwiseBinaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/ArrayCwiseUnaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/BlockMethods.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/CommonCwiseBinaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/CommonCwiseUnaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/IndexedViewMethods.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/MatrixCwiseBinaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/MatrixCwiseUnaryOps.h create mode 100644 lib/eigen-3.4.0/Eigen/src/plugins/ReshapedMethods.h create mode 100644 lib/eigen-3.4.0/INSTALL create mode 100644 lib/eigen-3.4.0/README.md create mode 100644 lib/eigen-3.4.0/bench/BenchSparseUtil.h create mode 100644 lib/eigen-3.4.0/bench/BenchTimer.h create mode 100644 lib/eigen-3.4.0/bench/BenchUtil.h create mode 100644 lib/eigen-3.4.0/bench/README.txt create mode 100644 lib/eigen-3.4.0/bench/analyze-blocking-sizes.cpp create mode 100644 lib/eigen-3.4.0/bench/basicbench.cxxlist create mode 100644 lib/eigen-3.4.0/bench/basicbenchmark.cpp create mode 100644 lib/eigen-3.4.0/bench/basicbenchmark.h create mode 100644 lib/eigen-3.4.0/bench/benchBlasGemm.cpp create mode 100644 lib/eigen-3.4.0/bench/benchCholesky.cpp create mode 100644 lib/eigen-3.4.0/bench/benchEigenSolver.cpp create mode 100644 lib/eigen-3.4.0/bench/benchFFT.cpp create mode 100644 lib/eigen-3.4.0/bench/benchGeometry.cpp create mode 100644 lib/eigen-3.4.0/bench/benchVecAdd.cpp create mode 100644 lib/eigen-3.4.0/bench/bench_gemm.cpp create mode 100644 lib/eigen-3.4.0/bench/bench_move_semantics.cpp create mode 100755 lib/eigen-3.4.0/bench/bench_multi_compilers.sh create mode 100644 lib/eigen-3.4.0/bench/bench_norm.cpp create mode 100644 lib/eigen-3.4.0/bench/bench_reverse.cpp create mode 100644 lib/eigen-3.4.0/bench/bench_sum.cpp create mode 100755 lib/eigen-3.4.0/bench/bench_unrolling create mode 100644 lib/eigen-3.4.0/bench/benchmark-blocking-sizes.cpp create mode 100644 lib/eigen-3.4.0/bench/benchmark.cpp create mode 100644 lib/eigen-3.4.0/bench/benchmarkSlice.cpp create mode 100644 lib/eigen-3.4.0/bench/benchmarkX.cpp create mode 100644 lib/eigen-3.4.0/bench/benchmarkXcwise.cpp create mode 100755 lib/eigen-3.4.0/bench/benchmark_suite create mode 100644 lib/eigen-3.4.0/bench/btl/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/COPYING create mode 100644 lib/eigen-3.4.0/bench/btl/README create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_aat_product.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_ata_product.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_atv_product.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_axpby.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_axpy.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_cholesky.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_ger.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_hessenberg.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_lu_decomp.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_lu_solve.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product_bis.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_matrix_vector_product.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_partial_lu.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_rot.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_symv.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_syr2.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_trisolve.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_trisolve_matrix.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/action_trmm.hh create mode 100644 lib/eigen-3.4.0/bench/btl/actions/basic_actions.hh create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindACML.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindATLAS.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindBLAZE.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindBlitz.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindCBLAS.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindGMM.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindMKL.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindMTL4.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindOPENBLAS.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindPackageHandleStandardArgs.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/FindTvmet.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake create mode 100644 lib/eigen-3.4.0/bench/btl/data/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/data/action_settings.txt create mode 100644 lib/eigen-3.4.0/bench/btl/data/gnuplot_common_settings.hh create mode 100755 lib/eigen-3.4.0/bench/btl/data/go_mean create mode 100644 lib/eigen-3.4.0/bench/btl/data/mean.cxx create mode 100644 lib/eigen-3.4.0/bench/btl/data/mk_gnuplot_script.sh create mode 100644 lib/eigen-3.4.0/bench/btl/data/mk_mean_script.sh create mode 100755 lib/eigen-3.4.0/bench/btl/data/mk_new_gnuplot.sh create mode 100644 lib/eigen-3.4.0/bench/btl/data/perlib_plot_settings.txt create mode 100644 lib/eigen-3.4.0/bench/btl/data/regularize.cxx create mode 100644 lib/eigen-3.4.0/bench/btl/data/smooth.cxx create mode 100755 lib/eigen-3.4.0/bench/btl/data/smooth_all.sh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/bench.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/bench_parameter.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/btl.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/init/init_function.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/init/init_matrix.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/init/init_vector.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/static/bench_static.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/static/intel_bench_fixed_size.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/static/static_size_generator.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/STL_perf_analyzer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/STL_timer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_perf_analyzer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_perf_analyzer_old.hh create mode 100755 lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_timer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/x86_perf_analyzer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/timers/x86_timer.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/utils/size_lin_log.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/utils/size_log.hh create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/utils/utilities.h create mode 100644 lib/eigen-3.4.0/bench/btl/generic_bench/utils/xy_file.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/blas.h create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface_impl.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/c_interface_base.h create mode 100644 lib/eigen-3.4.0/bench/btl/libs/BLAS/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/STL/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/STL/STL_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/STL/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blaze/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blaze/blaze_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blaze/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_LU_solve_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/btl_blitz.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/btl_tiny_blitz.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/blitz/tiny_blitz_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/btl_tiny_eigen2.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/eigen2_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/main_adv.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/main_linear.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/main_matmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen2/main_vecmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/eigen3_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/main_adv.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/main_linear.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/main_matmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/eigen3/main_vecmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/gmm/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_LU_solve_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/gmm/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/mtl4/.kdbgrc.main create mode 100644 lib/eigen-3.4.0/bench/btl/libs/mtl4/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/mtl4/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tensors/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tensors/main_linear.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tensors/main_matmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tensors/main_vecmat.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tensors/tensor_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tvmet/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tvmet/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/tvmet/tvmet_interface.hh create mode 100644 lib/eigen-3.4.0/bench/btl/libs/ublas/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/btl/libs/ublas/main.cpp create mode 100644 lib/eigen-3.4.0/bench/btl/libs/ublas/ublas_interface.hh create mode 100644 lib/eigen-3.4.0/bench/check_cache_queries.cpp create mode 100644 lib/eigen-3.4.0/bench/dense_solvers.cpp create mode 100644 lib/eigen-3.4.0/bench/eig33.cpp create mode 100644 lib/eigen-3.4.0/bench/geometry.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/changesets.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemm.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemm_common.h create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemm_settings.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemm_square_settings.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemv.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemv_common.h create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemv_settings.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemv_square_settings.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/gemvt.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm_settings.txt create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/llt.cpp create mode 100755 lib/eigen-3.4.0/bench/perf_monitoring/make_plot.sh create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_footer.html create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_header.html create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/footer.html create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/header.html create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/s1.js create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/resources/s2.js create mode 100755 lib/eigen-3.4.0/bench/perf_monitoring/run.sh create mode 100755 lib/eigen-3.4.0/bench/perf_monitoring/runall.sh create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/trmv_lo.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/trmv_lot.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/trmv_up.cpp create mode 100644 lib/eigen-3.4.0/bench/perf_monitoring/trmv_upt.cpp create mode 100644 lib/eigen-3.4.0/bench/product_threshold.cpp create mode 100644 lib/eigen-3.4.0/bench/quat_slerp.cpp create mode 100644 lib/eigen-3.4.0/bench/quatmul.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_cholesky.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_dense_product.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_lu.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_product.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_randomsetter.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_setter.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_transpose.cpp create mode 100644 lib/eigen-3.4.0/bench/sparse_trisolver.cpp create mode 100644 lib/eigen-3.4.0/bench/spbench/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/bench/spbench/sp_solver.cpp create mode 100644 lib/eigen-3.4.0/bench/spbench/spbench.dtd create mode 100644 lib/eigen-3.4.0/bench/spbench/spbenchsolver.cpp create mode 100644 lib/eigen-3.4.0/bench/spbench/spbenchsolver.h create mode 100644 lib/eigen-3.4.0/bench/spbench/spbenchstyle.h create mode 100644 lib/eigen-3.4.0/bench/spbench/test_sparseLU.cpp create mode 100644 lib/eigen-3.4.0/bench/spmv.cpp create mode 100644 lib/eigen-3.4.0/bench/tensors/README create mode 100644 lib/eigen-3.4.0/bench/tensors/benchmark.h create mode 100644 lib/eigen-3.4.0/bench/tensors/benchmark_main.cc create mode 100644 lib/eigen-3.4.0/bench/tensors/contraction_benchmarks_cpu.cc create mode 100755 lib/eigen-3.4.0/bench/tensors/eigen_sycl_bench.sh create mode 100644 lib/eigen-3.4.0/bench/tensors/eigen_sycl_bench_contract.sh create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_benchmarks.h create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_benchmarks_cpu.cc create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_benchmarks_fp16_gpu.cu create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_benchmarks_gpu.cu create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_benchmarks_sycl.cc create mode 100644 lib/eigen-3.4.0/bench/tensors/tensor_contract_sycl_bench.cc create mode 100644 lib/eigen-3.4.0/bench/vdw_new.cpp create mode 100644 lib/eigen-3.4.0/blas/BandTriangularSolver.h create mode 100644 lib/eigen-3.4.0/blas/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/blas/GeneralRank1Update.h create mode 100644 lib/eigen-3.4.0/blas/PackedSelfadjointProduct.h create mode 100644 lib/eigen-3.4.0/blas/PackedTriangularMatrixVector.h create mode 100644 lib/eigen-3.4.0/blas/PackedTriangularSolverVector.h create mode 100644 lib/eigen-3.4.0/blas/README.txt create mode 100644 lib/eigen-3.4.0/blas/Rank2Update.h create mode 100644 lib/eigen-3.4.0/blas/common.h create mode 100644 lib/eigen-3.4.0/blas/complex_double.cpp create mode 100644 lib/eigen-3.4.0/blas/complex_single.cpp create mode 100644 lib/eigen-3.4.0/blas/double.cpp create mode 100644 lib/eigen-3.4.0/blas/f2c/chbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/chpmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/complexdots.c create mode 100644 lib/eigen-3.4.0/blas/f2c/ctbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/d_cnjg.c create mode 100644 lib/eigen-3.4.0/blas/f2c/datatypes.h create mode 100644 lib/eigen-3.4.0/blas/f2c/drotm.c create mode 100644 lib/eigen-3.4.0/blas/f2c/drotmg.c create mode 100644 lib/eigen-3.4.0/blas/f2c/dsbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/dspmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/dtbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/lsame.c create mode 100644 lib/eigen-3.4.0/blas/f2c/r_cnjg.c create mode 100644 lib/eigen-3.4.0/blas/f2c/srotm.c create mode 100644 lib/eigen-3.4.0/blas/f2c/srotmg.c create mode 100644 lib/eigen-3.4.0/blas/f2c/ssbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/sspmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/stbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/zhbmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/zhpmv.c create mode 100644 lib/eigen-3.4.0/blas/f2c/ztbmv.c create mode 100644 lib/eigen-3.4.0/blas/fortran/complexdots.f create mode 100644 lib/eigen-3.4.0/blas/level1_cplx_impl.h create mode 100644 lib/eigen-3.4.0/blas/level1_impl.h create mode 100644 lib/eigen-3.4.0/blas/level1_real_impl.h create mode 100644 lib/eigen-3.4.0/blas/level2_cplx_impl.h create mode 100644 lib/eigen-3.4.0/blas/level2_impl.h create mode 100644 lib/eigen-3.4.0/blas/level2_real_impl.h create mode 100644 lib/eigen-3.4.0/blas/level3_impl.h create mode 100644 lib/eigen-3.4.0/blas/single.cpp create mode 100644 lib/eigen-3.4.0/blas/testing/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/blas/testing/cblat1.f create mode 100644 lib/eigen-3.4.0/blas/testing/cblat2.dat create mode 100644 lib/eigen-3.4.0/blas/testing/cblat2.f create mode 100644 lib/eigen-3.4.0/blas/testing/cblat3.dat create mode 100644 lib/eigen-3.4.0/blas/testing/cblat3.f create mode 100644 lib/eigen-3.4.0/blas/testing/dblat1.f create mode 100644 lib/eigen-3.4.0/blas/testing/dblat2.dat create mode 100644 lib/eigen-3.4.0/blas/testing/dblat2.f create mode 100644 lib/eigen-3.4.0/blas/testing/dblat3.dat create mode 100644 lib/eigen-3.4.0/blas/testing/dblat3.f create mode 100755 lib/eigen-3.4.0/blas/testing/runblastest.sh create mode 100644 lib/eigen-3.4.0/blas/testing/sblat1.f create mode 100644 lib/eigen-3.4.0/blas/testing/sblat2.dat create mode 100644 lib/eigen-3.4.0/blas/testing/sblat2.f create mode 100644 lib/eigen-3.4.0/blas/testing/sblat3.dat create mode 100644 lib/eigen-3.4.0/blas/testing/sblat3.f create mode 100644 lib/eigen-3.4.0/blas/testing/zblat1.f create mode 100644 lib/eigen-3.4.0/blas/testing/zblat2.dat create mode 100644 lib/eigen-3.4.0/blas/testing/zblat2.f create mode 100644 lib/eigen-3.4.0/blas/testing/zblat3.dat create mode 100644 lib/eigen-3.4.0/blas/testing/zblat3.f create mode 100644 lib/eigen-3.4.0/blas/xerbla.cpp create mode 100644 lib/eigen-3.4.0/ci/CTest2JUnit.xsl create mode 100644 lib/eigen-3.4.0/ci/README.md create mode 100644 lib/eigen-3.4.0/ci/build.gitlab-ci.yml create mode 100644 lib/eigen-3.4.0/ci/smoketests.gitlab-ci.yml create mode 100644 lib/eigen-3.4.0/ci/test.gitlab-ci.yml create mode 100644 lib/eigen-3.4.0/cmake/ComputeCppCompilerChecks.cmake create mode 100644 lib/eigen-3.4.0/cmake/ComputeCppIRMap.cmake create mode 100644 lib/eigen-3.4.0/cmake/Eigen3Config.cmake.in create mode 100644 lib/eigen-3.4.0/cmake/Eigen3ConfigLegacy.cmake.in create mode 100644 lib/eigen-3.4.0/cmake/EigenConfigureTesting.cmake create mode 100644 lib/eigen-3.4.0/cmake/EigenDetermineOSVersion.cmake create mode 100644 lib/eigen-3.4.0/cmake/EigenDetermineVSServicePack.cmake create mode 100644 lib/eigen-3.4.0/cmake/EigenSmokeTestList.cmake create mode 100644 lib/eigen-3.4.0/cmake/EigenTesting.cmake create mode 100644 lib/eigen-3.4.0/cmake/EigenUninstall.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindAdolc.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindBLAS.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindBLASEXT.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindCHOLMOD.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindComputeCpp.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindEigen2.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindEigen3.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindFFTW.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindGLEW.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindGMP.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindGSL.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindGoogleHash.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindHWLOC.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindKLU.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindLAPACK.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindMPFR.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindMPREAL.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindMetis.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindPASTIX.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindPTSCOTCH.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindSCOTCH.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindSPQR.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindStandardMathLibrary.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindSuperLU.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindTriSYCL.cmake create mode 100644 lib/eigen-3.4.0/cmake/FindUMFPACK.cmake create mode 100644 lib/eigen-3.4.0/cmake/RegexUtils.cmake create mode 100644 lib/eigen-3.4.0/cmake/UseEigen3.cmake create mode 100644 lib/eigen-3.4.0/debug/gdb/__init__.py create mode 100644 lib/eigen-3.4.0/debug/gdb/printers.py create mode 100644 lib/eigen-3.4.0/debug/msvc/eigen.natvis create mode 100644 lib/eigen-3.4.0/debug/msvc/eigen_autoexp_part.dat create mode 100644 lib/eigen-3.4.0/demos/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/demos/mandelbrot/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/demos/mandelbrot/README create mode 100644 lib/eigen-3.4.0/demos/mandelbrot/mandelbrot.cpp create mode 100644 lib/eigen-3.4.0/demos/mandelbrot/mandelbrot.h create mode 100644 lib/eigen-3.4.0/demos/mix_eigen_and_c/README create mode 100644 lib/eigen-3.4.0/demos/mix_eigen_and_c/binary_library.cpp create mode 100644 lib/eigen-3.4.0/demos/mix_eigen_and_c/binary_library.h create mode 100644 lib/eigen-3.4.0/demos/mix_eigen_and_c/example.c create mode 100644 lib/eigen-3.4.0/demos/opengl/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/demos/opengl/README create mode 100644 lib/eigen-3.4.0/demos/opengl/camera.cpp create mode 100644 lib/eigen-3.4.0/demos/opengl/camera.h create mode 100644 lib/eigen-3.4.0/demos/opengl/gpuhelper.cpp create mode 100644 lib/eigen-3.4.0/demos/opengl/gpuhelper.h create mode 100644 lib/eigen-3.4.0/demos/opengl/icosphere.cpp create mode 100644 lib/eigen-3.4.0/demos/opengl/icosphere.h create mode 100644 lib/eigen-3.4.0/demos/opengl/quaternion_demo.cpp create mode 100644 lib/eigen-3.4.0/demos/opengl/quaternion_demo.h create mode 100644 lib/eigen-3.4.0/demos/opengl/trackball.cpp create mode 100644 lib/eigen-3.4.0/demos/opengl/trackball.h create mode 100644 lib/eigen-3.4.0/doc/AsciiQuickReference.txt create mode 100644 lib/eigen-3.4.0/doc/B01_Experimental.dox create mode 100644 lib/eigen-3.4.0/doc/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/doc/ClassHierarchy.dox create mode 100644 lib/eigen-3.4.0/doc/CoeffwiseMathFunctionsTable.dox create mode 100644 lib/eigen-3.4.0/doc/CustomizingEigen_CustomScalar.dox create mode 100644 lib/eigen-3.4.0/doc/CustomizingEigen_InheritingMatrix.dox create mode 100644 lib/eigen-3.4.0/doc/CustomizingEigen_NullaryExpr.dox create mode 100644 lib/eigen-3.4.0/doc/CustomizingEigen_Plugins.dox create mode 100644 lib/eigen-3.4.0/doc/DenseDecompositionBenchmark.dox create mode 100644 lib/eigen-3.4.0/doc/Doxyfile.in create mode 100644 lib/eigen-3.4.0/doc/Eigen_Silly_Professor_64x64.png create mode 100644 lib/eigen-3.4.0/doc/FixedSizeVectorizable.dox create mode 100644 lib/eigen-3.4.0/doc/FunctionsTakingEigenTypes.dox create mode 100644 lib/eigen-3.4.0/doc/HiPerformance.dox create mode 100644 lib/eigen-3.4.0/doc/InplaceDecomposition.dox create mode 100644 lib/eigen-3.4.0/doc/InsideEigenExample.dox create mode 100644 lib/eigen-3.4.0/doc/LeastSquares.dox create mode 100644 lib/eigen-3.4.0/doc/Manual.dox create mode 100644 lib/eigen-3.4.0/doc/MatrixfreeSolverExample.dox create mode 100644 lib/eigen-3.4.0/doc/NewExpressionType.dox create mode 100644 lib/eigen-3.4.0/doc/Overview.dox create mode 100644 lib/eigen-3.4.0/doc/PassingByValue.dox create mode 100644 lib/eigen-3.4.0/doc/Pitfalls.dox create mode 100644 lib/eigen-3.4.0/doc/PreprocessorDirectives.dox create mode 100644 lib/eigen-3.4.0/doc/QuickReference.dox create mode 100644 lib/eigen-3.4.0/doc/QuickStartGuide.dox create mode 100644 lib/eigen-3.4.0/doc/SparseLinearSystems.dox create mode 100644 lib/eigen-3.4.0/doc/SparseQuickReference.dox create mode 100644 lib/eigen-3.4.0/doc/StlContainers.dox create mode 100644 lib/eigen-3.4.0/doc/StorageOrders.dox create mode 100644 lib/eigen-3.4.0/doc/StructHavingEigenMembers.dox create mode 100644 lib/eigen-3.4.0/doc/TemplateKeyword.dox create mode 100644 lib/eigen-3.4.0/doc/TopicAliasing.dox create mode 100644 lib/eigen-3.4.0/doc/TopicAssertions.dox create mode 100644 lib/eigen-3.4.0/doc/TopicCMakeGuide.dox create mode 100644 lib/eigen-3.4.0/doc/TopicEigenExpressionTemplates.dox create mode 100644 lib/eigen-3.4.0/doc/TopicLazyEvaluation.dox create mode 100644 lib/eigen-3.4.0/doc/TopicLinearAlgebraDecompositions.dox create mode 100644 lib/eigen-3.4.0/doc/TopicMultithreading.dox create mode 100644 lib/eigen-3.4.0/doc/TopicResizing.dox create mode 100644 lib/eigen-3.4.0/doc/TopicScalarTypes.dox create mode 100644 lib/eigen-3.4.0/doc/TopicVectorization.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialAdvancedInitialization.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialArrayClass.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialBlockOperations.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialGeometry.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialLinearAlgebra.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialMapClass.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialMatrixArithmetic.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialMatrixClass.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialReductionsVisitorsBroadcasting.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialReshape.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialSTL.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialSlicingIndexing.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialSparse.dox create mode 100644 lib/eigen-3.4.0/doc/TutorialSparse_example_details.dox create mode 100644 lib/eigen-3.4.0/doc/UnalignedArrayAssert.dox create mode 100644 lib/eigen-3.4.0/doc/UsingBlasLapackBackends.dox create mode 100644 lib/eigen-3.4.0/doc/UsingIntelMKL.dox create mode 100644 lib/eigen-3.4.0/doc/UsingNVCC.dox create mode 100644 lib/eigen-3.4.0/doc/WrongStackAlignment.dox create mode 100644 lib/eigen-3.4.0/doc/eigen_navtree_hacks.js create mode 100644 lib/eigen-3.4.0/doc/eigendoxy.css create mode 100644 lib/eigen-3.4.0/doc/eigendoxy_footer.html.in create mode 100644 lib/eigen-3.4.0/doc/eigendoxy_header.html.in create mode 100644 lib/eigen-3.4.0/doc/eigendoxy_layout.xml.in create mode 100644 lib/eigen-3.4.0/doc/eigendoxy_tabs.css create mode 100644 lib/eigen-3.4.0/doc/examples/.krazy create mode 100644 lib/eigen-3.4.0/doc/examples/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/doc/examples/CustomizingEigen_Inheritance.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Cwise_erf.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Cwise_erfc.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Cwise_lgamma.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/DenseBase_middleCols_int.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/DenseBase_middleRows_int.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleCols.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleRows.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/QuickStart_example.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/QuickStart_example2_fixed.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TemplateKeyword_flexible.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TemplateKeyword_simple.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialInplaceLU.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgComputeTwice.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgExComputeSolveError.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveLDLT.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgInverseDeterminant.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgRankRevealing.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/TutorialLinAlgSetThreshold.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_accessors.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_addition.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_cwise_other.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_mult.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_block_assignment.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_colrow.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_print_block.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_vector.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_PartialLU_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_simple_example_dynamic_size.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/Tutorial_simple_example_fixed_size.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_Block.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_CwiseBinaryOp.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_FixedBlock.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_FixedReshaped.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_FixedVectorBlock.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_Reshaped.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/class_VectorBlock.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/function_taking_eigenbase.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/function_taking_ref.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.entry create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.evaluator create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.expression create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.main create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.preamble create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant.cpp.traits create mode 100644 lib/eigen-3.4.0/doc/examples/make_circulant2.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/matrixfree_cg.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/nullary_indexing.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_arithmetic_add_sub.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_arithmetic_dot_cross.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_arithmetic_matrix_mul.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_arithmetic_scalar_mul_div.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_matrix_coefficient_accessors.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_matrix_resize.cpp create mode 100644 lib/eigen-3.4.0/doc/examples/tut_matrix_resize_fixed_size.cpp create mode 100644 lib/eigen-3.4.0/doc/ftv2node.png create mode 100644 lib/eigen-3.4.0/doc/ftv2pnode.png create mode 100644 lib/eigen-3.4.0/doc/snippets/.krazy create mode 100644 lib/eigen-3.4.0/doc/snippets/AngleAxis_mimic_euler.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Array_initializer_list_23_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Array_initializer_list_vector_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Array_variadic_ctor_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/BiCGSTAB_simple.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/BiCGSTAB_step_by_step.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/doc/snippets/ColPivHouseholderQR_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvectors.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexSchur_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixT.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixU.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_abs.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_abs2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_acos.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_arg.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_array_power_array.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_asin.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_atan.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_boolean_and.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_boolean_not.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_boolean_or.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_boolean_xor.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_ceil.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_cos.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_cosh.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_cube.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_equal_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_exp.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_floor.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_greater.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_greater_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_inverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_isFinite.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_isInf.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_isNaN.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_less.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_less_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_log.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_log10.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_max.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_min.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_minus.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_minus_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_not_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_plus.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_plus_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_pow.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_product.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_quotient.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_rint.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_round.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_scalar_power_array.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_sign.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_sin.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_sinh.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_slash_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_sqrt.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_square.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_tan.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_tanh.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Cwise_times_equal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpacedInt.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced_seq_deprecated.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DenseBase_setLinSpaced.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DirectionWise_hnormalized.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/EigenSolver_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvectors.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/EigenSolver_pseudoEigenvectors.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/FullPivHouseholderQR_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/FullPivLU_image.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/FullPivLU_kernel.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/FullPivLU_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/GeneralizedEigenSolver.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_matrixH.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_packedMatrix.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HouseholderQR_householderQ.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HouseholderQR_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/HouseholderSequence_HouseholderSequence.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/IOFormat.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/JacobiSVD_basic.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Jacobi_makeGivens.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Jacobi_makeJacobi.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/LLT_example.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/LLT_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/LeastSquaresNormalEquations.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/LeastSquaresQR.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Map_general_stride.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Map_inner_stride.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Map_outer_stride.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Map_placement_new.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Map_simple.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_adjoint.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_all.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheLeft.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheRight.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_array.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_array_const.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_asDiagonal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRows_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cast.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_col.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise_iterator_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseWithCheck.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseArg.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseEqual.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseInverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMax.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMin.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseNotEqual.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseProduct.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseQuotient.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSign.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSqrt.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_template_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_end_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_eval.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_fixedBlock_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_hnormalized.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_homogeneous.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_identity.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_identity_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_inverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isDiagonal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isIdentity.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isOnes.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isOrthogonal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isUnitary.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_isZero.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_leftCols_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_noalias.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_ones.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_operatorNorm.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_prod.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_random.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_auto.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_fixed.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_to_vector.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_reverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_rightCols_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_row.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_rowwise.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_segment_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_select.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_selfadjointView.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_set.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_setIdentity.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_setOnes.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_setRandom.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_setZero.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_start_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_bottomRows.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_end.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_leftCols.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_rightCols.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_segment.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_start.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_topRows.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_topRightCorner_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_topRows_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_transpose.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_triangularView.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_zero.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_Map_stride.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_23_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_vector_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_resize_NoChange_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_resize_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_NoChange.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setIdentity_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int_int.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Matrix_variadic_ctor_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialPivLU_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_count.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_maxCoeff.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_minCoeff.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_norm.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_prod.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_squaredNorm.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/PartialRedux_sum.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/RealQZ_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/RealSchur_RealSchur_MatrixType.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/RealSchur_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointView_eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SelfAdjointView_operatorNorm.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Slicing_arrayexpr.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Slicing_custom_padding_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Slicing_rawarray_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Slicing_stdvector_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/SparseMatrix_coeffs.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_block.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_block_correct.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_cwise.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult1.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult3.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult4.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult5.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/TopicStorageOrders_example.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Triangular_solve.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_compute.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_decomposeInPlace.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_diagonal.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_householderCoefficients.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tridiagonalization_packedMatrix.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_Map_rowmajor.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_Map_using.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Mat.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Vec.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingCol.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingVec.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01b.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_02.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_1.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_matrix_inverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_multiple_rhs.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_reuse_decomposition.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_singular.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular_inplace.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/VectorwiseOp_homogeneous.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/Vectorwise_reverse.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/class_FullPivLU.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/compile_snippet.cpp.in create mode 100644 lib/eigen-3.4.0/doc/snippets/tut_arithmetic_redux_minmax.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_aliasing.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_conjugate.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_inplace.cpp create mode 100644 lib/eigen-3.4.0/doc/snippets/tut_matrix_assignment_resizing.cpp create mode 100644 lib/eigen-3.4.0/doc/special_examples/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example.cpp create mode 100644 lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example_details.cpp create mode 100644 lib/eigen-3.4.0/doc/special_examples/random_cpp11.cpp create mode 100644 lib/eigen-3.4.0/doc/tutorial.cpp create mode 100644 lib/eigen-3.4.0/eigen3.pc.in create mode 100644 lib/eigen-3.4.0/failtest/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/failtest/bdcsvd_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_0.cpp create mode 100644 lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_0.cpp create mode 100644 lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/colpivqr_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_0.cpp create mode 100644 lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/const_qualified_diagonal_method_retval.cpp create mode 100644 lib/eigen-3.4.0/failtest/const_qualified_transpose_method_retval.cpp create mode 100644 lib/eigen-3.4.0/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp create mode 100644 lib/eigen-3.4.0/failtest/cwiseunaryview_on_const_type_actually_const.cpp create mode 100644 lib/eigen-3.4.0/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp create mode 100644 lib/eigen-3.4.0/failtest/diagonal_on_const_type_actually_const.cpp create mode 100644 lib/eigen-3.4.0/failtest/eigensolver_cplx.cpp create mode 100644 lib/eigen-3.4.0/failtest/eigensolver_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/failtest_sanity_check.cpp create mode 100644 lib/eigen-3.4.0/failtest/fullpivlu_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/fullpivqr_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/initializer_list_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/initializer_list_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/jacobisvd_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/ldlt_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/llt_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_0.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_3.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_4.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_0.cpp create mode 100644 lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/partialpivlu_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/qr_int.cpp create mode 100644 lib/eigen-3.4.0/failtest/ref_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/ref_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/ref_3.cpp create mode 100644 lib/eigen-3.4.0/failtest/ref_4.cpp create mode 100644 lib/eigen-3.4.0/failtest/ref_5.cpp create mode 100644 lib/eigen-3.4.0/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp create mode 100644 lib/eigen-3.4.0/failtest/selfadjointview_on_const_type_actually_const.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_ref_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_ref_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_ref_3.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_ref_4.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_ref_5.cpp create mode 100644 lib/eigen-3.4.0/failtest/sparse_storage_mismatch.cpp create mode 100644 lib/eigen-3.4.0/failtest/swap_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/swap_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/ternary_1.cpp create mode 100644 lib/eigen-3.4.0/failtest/ternary_2.cpp create mode 100644 lib/eigen-3.4.0/failtest/transpose_nonconst_ctor_on_const_xpr.cpp create mode 100644 lib/eigen-3.4.0/failtest/transpose_on_const_type_actually_const.cpp create mode 100644 lib/eigen-3.4.0/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp create mode 100644 lib/eigen-3.4.0/failtest/triangularview_on_const_type_actually_const.cpp create mode 100644 lib/eigen-3.4.0/lapack/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/lapack/cholesky.cpp create mode 100644 lib/eigen-3.4.0/lapack/clacgv.f create mode 100644 lib/eigen-3.4.0/lapack/cladiv.f create mode 100644 lib/eigen-3.4.0/lapack/clarf.f create mode 100644 lib/eigen-3.4.0/lapack/clarfb.f create mode 100644 lib/eigen-3.4.0/lapack/clarfg.f create mode 100644 lib/eigen-3.4.0/lapack/clarft.f create mode 100644 lib/eigen-3.4.0/lapack/complex_double.cpp create mode 100644 lib/eigen-3.4.0/lapack/complex_single.cpp create mode 100644 lib/eigen-3.4.0/lapack/dladiv.f create mode 100644 lib/eigen-3.4.0/lapack/dlamch.f create mode 100644 lib/eigen-3.4.0/lapack/dlapy2.f create mode 100644 lib/eigen-3.4.0/lapack/dlapy3.f create mode 100644 lib/eigen-3.4.0/lapack/dlarf.f create mode 100644 lib/eigen-3.4.0/lapack/dlarfb.f create mode 100644 lib/eigen-3.4.0/lapack/dlarfg.f create mode 100644 lib/eigen-3.4.0/lapack/dlarft.f create mode 100644 lib/eigen-3.4.0/lapack/double.cpp create mode 100644 lib/eigen-3.4.0/lapack/dsecnd_NONE.f create mode 100644 lib/eigen-3.4.0/lapack/eigenvalues.cpp create mode 100644 lib/eigen-3.4.0/lapack/ilaclc.f create mode 100644 lib/eigen-3.4.0/lapack/ilaclr.f create mode 100644 lib/eigen-3.4.0/lapack/iladlc.f create mode 100644 lib/eigen-3.4.0/lapack/iladlr.f create mode 100644 lib/eigen-3.4.0/lapack/ilaslc.f create mode 100644 lib/eigen-3.4.0/lapack/ilaslr.f create mode 100644 lib/eigen-3.4.0/lapack/ilazlc.f create mode 100644 lib/eigen-3.4.0/lapack/ilazlr.f create mode 100644 lib/eigen-3.4.0/lapack/lapack_common.h create mode 100644 lib/eigen-3.4.0/lapack/lu.cpp create mode 100644 lib/eigen-3.4.0/lapack/second_NONE.f create mode 100644 lib/eigen-3.4.0/lapack/single.cpp create mode 100644 lib/eigen-3.4.0/lapack/sladiv.f create mode 100644 lib/eigen-3.4.0/lapack/slamch.f create mode 100644 lib/eigen-3.4.0/lapack/slapy2.f create mode 100644 lib/eigen-3.4.0/lapack/slapy3.f create mode 100644 lib/eigen-3.4.0/lapack/slarf.f create mode 100644 lib/eigen-3.4.0/lapack/slarfb.f create mode 100644 lib/eigen-3.4.0/lapack/slarfg.f create mode 100644 lib/eigen-3.4.0/lapack/slarft.f create mode 100644 lib/eigen-3.4.0/lapack/svd.cpp create mode 100644 lib/eigen-3.4.0/lapack/zlacgv.f create mode 100644 lib/eigen-3.4.0/lapack/zladiv.f create mode 100644 lib/eigen-3.4.0/lapack/zlarf.f create mode 100644 lib/eigen-3.4.0/lapack/zlarfb.f create mode 100644 lib/eigen-3.4.0/lapack/zlarfg.f create mode 100644 lib/eigen-3.4.0/lapack/zlarft.f create mode 100644 lib/eigen-3.4.0/scripts/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/scripts/cdashtesting.cmake.in create mode 100755 lib/eigen-3.4.0/scripts/check.in create mode 100755 lib/eigen-3.4.0/scripts/debug.in create mode 100644 lib/eigen-3.4.0/scripts/eigen_gen_credits.cpp create mode 100644 lib/eigen-3.4.0/scripts/eigen_gen_docs create mode 100644 lib/eigen-3.4.0/scripts/eigen_gen_split_test_help.cmake create mode 100755 lib/eigen-3.4.0/scripts/eigen_monitor_perf.sh create mode 100755 lib/eigen-3.4.0/scripts/release.in create mode 100644 lib/eigen-3.4.0/scripts/relicense.py create mode 100644 lib/eigen-3.4.0/signature_of_eigen3_matrix_library create mode 100644 lib/eigen-3.4.0/test/AnnoyingScalar.h create mode 100644 lib/eigen-3.4.0/test/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/test/MovableScalar.h create mode 100644 lib/eigen-3.4.0/test/SafeScalar.h create mode 100644 lib/eigen-3.4.0/test/adjoint.cpp create mode 100644 lib/eigen-3.4.0/test/array_cwise.cpp create mode 100644 lib/eigen-3.4.0/test/array_for_matrix.cpp create mode 100644 lib/eigen-3.4.0/test/array_of_string.cpp create mode 100644 lib/eigen-3.4.0/test/array_replicate.cpp create mode 100644 lib/eigen-3.4.0/test/array_reverse.cpp create mode 100644 lib/eigen-3.4.0/test/bandmatrix.cpp create mode 100644 lib/eigen-3.4.0/test/basicstuff.cpp create mode 100644 lib/eigen-3.4.0/test/bdcsvd.cpp create mode 100644 lib/eigen-3.4.0/test/bfloat16_float.cpp create mode 100644 lib/eigen-3.4.0/test/bicgstab.cpp create mode 100644 lib/eigen-3.4.0/test/blasutil.cpp create mode 100644 lib/eigen-3.4.0/test/block.cpp create mode 100644 lib/eigen-3.4.0/test/boostmultiprec.cpp create mode 100644 lib/eigen-3.4.0/test/bug1213.cpp create mode 100644 lib/eigen-3.4.0/test/bug1213.h create mode 100644 lib/eigen-3.4.0/test/bug1213_main.cpp create mode 100644 lib/eigen-3.4.0/test/cholesky.cpp create mode 100644 lib/eigen-3.4.0/test/cholmod_support.cpp create mode 100644 lib/eigen-3.4.0/test/commainitializer.cpp create mode 100644 lib/eigen-3.4.0/test/conjugate_gradient.cpp create mode 100644 lib/eigen-3.4.0/test/conservative_resize.cpp create mode 100644 lib/eigen-3.4.0/test/constructor.cpp create mode 100644 lib/eigen-3.4.0/test/corners.cpp create mode 100644 lib/eigen-3.4.0/test/ctorleak.cpp create mode 100644 lib/eigen-3.4.0/test/denseLM.cpp create mode 100644 lib/eigen-3.4.0/test/dense_storage.cpp create mode 100644 lib/eigen-3.4.0/test/determinant.cpp create mode 100644 lib/eigen-3.4.0/test/diagonal.cpp create mode 100644 lib/eigen-3.4.0/test/diagonal_matrix_variadic_ctor.cpp create mode 100644 lib/eigen-3.4.0/test/diagonalmatrices.cpp create mode 100644 lib/eigen-3.4.0/test/dontalign.cpp create mode 100644 lib/eigen-3.4.0/test/dynalloc.cpp create mode 100644 lib/eigen-3.4.0/test/eigen2support.cpp create mode 100644 lib/eigen-3.4.0/test/eigensolver_complex.cpp create mode 100644 lib/eigen-3.4.0/test/eigensolver_generalized_real.cpp create mode 100644 lib/eigen-3.4.0/test/eigensolver_generic.cpp create mode 100644 lib/eigen-3.4.0/test/eigensolver_selfadjoint.cpp create mode 100644 lib/eigen-3.4.0/test/evaluator_common.h create mode 100644 lib/eigen-3.4.0/test/evaluators.cpp create mode 100644 lib/eigen-3.4.0/test/exceptions.cpp create mode 100644 lib/eigen-3.4.0/test/fastmath.cpp create mode 100644 lib/eigen-3.4.0/test/first_aligned.cpp create mode 100644 lib/eigen-3.4.0/test/geo_alignedbox.cpp create mode 100644 lib/eigen-3.4.0/test/geo_eulerangles.cpp create mode 100644 lib/eigen-3.4.0/test/geo_homogeneous.cpp create mode 100644 lib/eigen-3.4.0/test/geo_hyperplane.cpp create mode 100644 lib/eigen-3.4.0/test/geo_orthomethods.cpp create mode 100644 lib/eigen-3.4.0/test/geo_parametrizedline.cpp create mode 100644 lib/eigen-3.4.0/test/geo_quaternion.cpp create mode 100644 lib/eigen-3.4.0/test/geo_transformations.cpp create mode 100644 lib/eigen-3.4.0/test/gpu_basic.cu create mode 100644 lib/eigen-3.4.0/test/gpu_common.h create mode 100644 lib/eigen-3.4.0/test/half_float.cpp create mode 100644 lib/eigen-3.4.0/test/hessenberg.cpp create mode 100644 lib/eigen-3.4.0/test/householder.cpp create mode 100644 lib/eigen-3.4.0/test/incomplete_cholesky.cpp create mode 100644 lib/eigen-3.4.0/test/indexed_view.cpp create mode 100644 lib/eigen-3.4.0/test/initializer_list_construction.cpp create mode 100644 lib/eigen-3.4.0/test/inplace_decomposition.cpp create mode 100644 lib/eigen-3.4.0/test/integer_types.cpp create mode 100644 lib/eigen-3.4.0/test/inverse.cpp create mode 100644 lib/eigen-3.4.0/test/io.cpp create mode 100644 lib/eigen-3.4.0/test/is_same_dense.cpp create mode 100644 lib/eigen-3.4.0/test/jacobi.cpp create mode 100644 lib/eigen-3.4.0/test/jacobisvd.cpp create mode 100644 lib/eigen-3.4.0/test/klu_support.cpp create mode 100644 lib/eigen-3.4.0/test/linearstructure.cpp create mode 100644 lib/eigen-3.4.0/test/lscg.cpp create mode 100644 lib/eigen-3.4.0/test/lu.cpp create mode 100644 lib/eigen-3.4.0/test/main.h create mode 100644 lib/eigen-3.4.0/test/mapped_matrix.cpp create mode 100644 lib/eigen-3.4.0/test/mapstaticmethods.cpp create mode 100644 lib/eigen-3.4.0/test/mapstride.cpp create mode 100644 lib/eigen-3.4.0/test/meta.cpp create mode 100644 lib/eigen-3.4.0/test/metis_support.cpp create mode 100644 lib/eigen-3.4.0/test/miscmatrices.cpp create mode 100644 lib/eigen-3.4.0/test/mixingtypes.cpp create mode 100644 lib/eigen-3.4.0/test/mpl2only.cpp create mode 100644 lib/eigen-3.4.0/test/nestbyvalue.cpp create mode 100644 lib/eigen-3.4.0/test/nesting_ops.cpp create mode 100644 lib/eigen-3.4.0/test/nomalloc.cpp create mode 100644 lib/eigen-3.4.0/test/nullary.cpp create mode 100644 lib/eigen-3.4.0/test/num_dimensions.cpp create mode 100644 lib/eigen-3.4.0/test/numext.cpp create mode 100644 lib/eigen-3.4.0/test/packetmath.cpp create mode 100644 lib/eigen-3.4.0/test/packetmath_test_shared.h create mode 100644 lib/eigen-3.4.0/test/pardiso_support.cpp create mode 100644 lib/eigen-3.4.0/test/pastix_support.cpp create mode 100644 lib/eigen-3.4.0/test/permutationmatrices.cpp create mode 100644 lib/eigen-3.4.0/test/prec_inverse_4x4.cpp create mode 100644 lib/eigen-3.4.0/test/product.h create mode 100644 lib/eigen-3.4.0/test/product_extra.cpp create mode 100644 lib/eigen-3.4.0/test/product_large.cpp create mode 100644 lib/eigen-3.4.0/test/product_mmtr.cpp create mode 100644 lib/eigen-3.4.0/test/product_notemporary.cpp create mode 100644 lib/eigen-3.4.0/test/product_selfadjoint.cpp create mode 100644 lib/eigen-3.4.0/test/product_small.cpp create mode 100644 lib/eigen-3.4.0/test/product_symm.cpp create mode 100644 lib/eigen-3.4.0/test/product_syrk.cpp create mode 100644 lib/eigen-3.4.0/test/product_trmm.cpp create mode 100644 lib/eigen-3.4.0/test/product_trmv.cpp create mode 100644 lib/eigen-3.4.0/test/product_trsolve.cpp create mode 100644 lib/eigen-3.4.0/test/qr.cpp create mode 100644 lib/eigen-3.4.0/test/qr_colpivoting.cpp create mode 100644 lib/eigen-3.4.0/test/qr_fullpivoting.cpp create mode 100644 lib/eigen-3.4.0/test/qtvector.cpp create mode 100644 lib/eigen-3.4.0/test/rand.cpp create mode 100644 lib/eigen-3.4.0/test/random_without_cast_overflow.h create mode 100644 lib/eigen-3.4.0/test/real_qz.cpp create mode 100644 lib/eigen-3.4.0/test/redux.cpp create mode 100644 lib/eigen-3.4.0/test/ref.cpp create mode 100644 lib/eigen-3.4.0/test/reshape.cpp create mode 100644 lib/eigen-3.4.0/test/resize.cpp create mode 100644 lib/eigen-3.4.0/test/rvalue_types.cpp create mode 100644 lib/eigen-3.4.0/test/schur_complex.cpp create mode 100644 lib/eigen-3.4.0/test/schur_real.cpp create mode 100644 lib/eigen-3.4.0/test/selfadjoint.cpp create mode 100644 lib/eigen-3.4.0/test/simplicial_cholesky.cpp create mode 100644 lib/eigen-3.4.0/test/sizeof.cpp create mode 100644 lib/eigen-3.4.0/test/sizeoverflow.cpp create mode 100644 lib/eigen-3.4.0/test/smallvectors.cpp create mode 100644 lib/eigen-3.4.0/test/solverbase.h create mode 100644 lib/eigen-3.4.0/test/sparse.h create mode 100644 lib/eigen-3.4.0/test/sparseLM.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_basic.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_block.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_permutations.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_product.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_ref.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_solver.h create mode 100644 lib/eigen-3.4.0/test/sparse_solvers.cpp create mode 100644 lib/eigen-3.4.0/test/sparse_vector.cpp create mode 100644 lib/eigen-3.4.0/test/sparselu.cpp create mode 100644 lib/eigen-3.4.0/test/sparseqr.cpp create mode 100644 lib/eigen-3.4.0/test/special_numbers.cpp create mode 100644 lib/eigen-3.4.0/test/split_test_helper.h create mode 100644 lib/eigen-3.4.0/test/spqr_support.cpp create mode 100644 lib/eigen-3.4.0/test/stable_norm.cpp create mode 100644 lib/eigen-3.4.0/test/stddeque.cpp create mode 100644 lib/eigen-3.4.0/test/stddeque_overload.cpp create mode 100644 lib/eigen-3.4.0/test/stdlist.cpp create mode 100644 lib/eigen-3.4.0/test/stdlist_overload.cpp create mode 100644 lib/eigen-3.4.0/test/stdvector.cpp create mode 100644 lib/eigen-3.4.0/test/stdvector_overload.cpp create mode 100644 lib/eigen-3.4.0/test/stl_iterators.cpp create mode 100644 lib/eigen-3.4.0/test/superlu_support.cpp create mode 100644 lib/eigen-3.4.0/test/svd_common.h create mode 100644 lib/eigen-3.4.0/test/svd_fill.h create mode 100644 lib/eigen-3.4.0/test/swap.cpp create mode 100644 lib/eigen-3.4.0/test/symbolic_index.cpp create mode 100644 lib/eigen-3.4.0/test/triangular.cpp create mode 100644 lib/eigen-3.4.0/test/type_alias.cpp create mode 100644 lib/eigen-3.4.0/test/umeyama.cpp create mode 100644 lib/eigen-3.4.0/test/umfpack_support.cpp create mode 100644 lib/eigen-3.4.0/test/unalignedcount.cpp create mode 100644 lib/eigen-3.4.0/test/upperbidiagonalization.cpp create mode 100644 lib/eigen-3.4.0/test/vectorization_logic.cpp create mode 100644 lib/eigen-3.4.0/test/vectorwiseop.cpp create mode 100644 lib/eigen-3.4.0/test/visitor.cpp create mode 100644 lib/eigen-3.4.0/test/zerosized.cpp create mode 100644 lib/eigen-3.4.0/unsupported/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/AdolcForward create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/AlignedVector3 create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/ArpackSupport create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/AutoDiff create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/BVH create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/Tensor create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/TensorSymmetry create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/ThreadPool create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/README.md create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/Tensor.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h create mode 100755 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/util/CXX11Meta.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/util/EmulateArray.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/EulerAngles create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/FFT create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/IterativeSolvers create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/KroneckerProduct create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/LevenbergMarquardt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/MPRealSupport create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/MatrixFunctions create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/MoreVectorization create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/NonLinearOptimization create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/NumericalDiff create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/OpenGLSupport create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/Polynomials create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/Skyline create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/SparseExtra create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/SpecialFunctions create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/Splines create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h create mode 100755 lib/eigen-3.4.0/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/BVH/BVAlgorithms.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/BVH/KdBVH.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/EulerAngles/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/EulerAngles/EulerAngles.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/EulerAngles/EulerSystem.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/FFT/ei_fftw_impl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/FFT/ei_kissfft_impl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/DGMRES.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/GMRES.h create mode 100755 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/IDRS.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/IterationController.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/MINRES.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/IterativeSolvers/Scaling.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MatrixFunctions/StemFunction.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/MoreVectorization/MathFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/chkder.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/covar.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/dogleg.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/lmpar.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/r1updt.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Polynomials/Companion.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Polynomials/PolynomialSolver.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Polynomials/PolynomialUtils.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineMatrix.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineProduct.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineStorage.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Skyline/SkylineUtil.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/MarketIO.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SparseExtra/RandomSetter.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Splines/Spline.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Splines/SplineFitting.h create mode 100644 lib/eigen-3.4.0/unsupported/Eigen/src/Splines/SplineFwd.h create mode 100644 lib/eigen-3.4.0/unsupported/README.txt create mode 100644 lib/eigen-3.4.0/unsupported/bench/bench_svd.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/doc/Overview.dox create mode 100644 lib/eigen-3.4.0/unsupported/doc/SYCL.dox create mode 100644 lib/eigen-3.4.0/unsupported/doc/eigendoxy_layout.xml.in create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/BVH_Example.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/EulerAngles.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/FFT.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixExponential.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixFunction.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixLogarithm.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixPower.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixPower_optimal.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixSine.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixSinh.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/MatrixSquareRoot.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/PolynomialSolver1.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/PolynomialUtils1.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/SYCL/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/doc/examples/SYCL/CwiseMul.cpp create mode 100644 lib/eigen-3.4.0/unsupported/doc/snippets/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/test/BVH.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/CMakeLists.txt create mode 100644 lib/eigen-3.4.0/unsupported/test/EulerAngles.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/FFT.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/FFTW.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/NonLinearOptimization.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/NumericalDiff.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/alignedvector3.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/autodiff.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/autodiff_scalar.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/bessel_functions.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_eventcount.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_maxsizevector.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_meta.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_non_blocking_thread_pool.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_runqueue.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_argmax.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_argmax_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_argmax_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_assign.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_block_access.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_block_eval.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_block_io.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_broadcast_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_broadcasting.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_builtins_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_cast_float16_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_casts.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_chipping.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_chipping_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_comparisons.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_complex_cwise_ops_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_complex_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_concatenation.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_concatenation_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_const.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_contract_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_contract_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_contraction.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_convolution.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_convolution_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_custom_index.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_custom_op.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_custom_op_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_device.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_device_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_dimension.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_empty.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_executor.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_expr.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_fft.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_fixed_size.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_forced_eval.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_forced_eval_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_generator.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_generator_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_ifft.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_image_op_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_image_patch.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_image_patch_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_index_list.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_inflation.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_inflation_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_intdiv.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_io.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_layout_swap.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_layout_swap_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_lvalue.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_map.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_math.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_math_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_mixed_indices.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_morphing.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_morphing_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_move.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_notification.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_of_complex.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_of_const_values.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_of_float16_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_of_strings.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_padding.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_padding_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_patch.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_patch_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_random.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_random_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_random_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_reduction.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_reduction_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_reduction_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_ref.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_reverse.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_reverse_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_roundings.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_scan.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_scan_gpu.cu create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_scan_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_shuffling.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_shuffling_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_simple.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_striding.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_striding_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_sugar.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_symmetry.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_thread_local.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_thread_pool.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_trace.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_uint128.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_volume_patch.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/cxx11_tensor_volume_patch_sycl.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/dgmres.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/forward_adolc.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/gmres.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/idrs.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/kronecker_product.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/levenberg_marquardt.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/matrix_exponential.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/matrix_function.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/matrix_functions.h create mode 100644 lib/eigen-3.4.0/unsupported/test/matrix_power.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/matrix_square_root.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/minres.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/mpreal_support.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/openglsupport.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/polynomialsolver.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/polynomialutils.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/sparse_extra.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/special_functions.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/special_packetmath.cpp create mode 100644 lib/eigen-3.4.0/unsupported/test/splines.cpp create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ad02d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +cmake-build*/ +build/ +out/ +./cmake-build*/ +./build/ +./out/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..484b3a7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/blt"] + path = lib/blt + url = https://github.com/Tri11Paragon/BLT.git diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/COSC-4P80-Assignment-2.iml b/.idea/COSC-4P80-Assignment-2.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/COSC-4P80-Assignment-2.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0b76fe5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a6c0bdf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..0a294a1 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e4a393c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.28) +project(COSC-4P80-Assignment-2 VERSION 0.0.2) + +option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) +option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) +option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) +option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." ON) + +set(CMAKE_CXX_STANDARD 17) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +add_subdirectory(lib/blt) + +add_subdirectory(lib/eigen-3.4.0) + +include_directories(include/) +file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") + +add_executable(COSC-4P80-Assignment-2 ${PROJECT_BUILD_FILES}) + +target_compile_options(COSC-4P80-Assignment-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment) +target_link_options(COSC-4P80-Assignment-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment) + +target_link_libraries(COSC-4P80-Assignment-2 PRIVATE BLT Eigen3::Eigen) + +if (${ENABLE_ADDRSAN} MATCHES ON) + target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=address) + target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=address) +endif () + +if (${ENABLE_UBSAN} MATCHES ON) + target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=undefined) + target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=undefined) +endif () + +if (${ENABLE_TSAN} MATCHES ON) + target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=thread) + target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=thread) +endif () diff --git a/commit.py b/commit.py new file mode 100755 index 0000000..fb9d5cc --- /dev/null +++ b/commit.py @@ -0,0 +1,285 @@ +#!/usr/bin/python3 + +import subprocess +import argparse +import sys +import os +import itertools +import requests +import json +from pathlib import Path + +#--------------------------------------- +# CONFIG +#--------------------------------------- + +VERSION_BEGIN_STR = " VERSION " +VERSION_END_STR = ")" + +#--------------------------------------- +# DO NOT TOUCH +#--------------------------------------- + +USER_HOME = Path.home() +ENVIRONMENT_DATA_LOCATION = USER_HOME / ".brett_scripts.env" + +if sys.platform.startswith("win"): + CONFIG_FILE_DIRECTORY = Path(os.getenv('APPDATA') + "\BLT") + CONFIG_FILE_LOCATION = Path(CONFIG_FILE_DIRECTORY + "\commit_config.env") +else: + XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME') + if XDG_CONFIG_HOME is None: + XDG_CONFIG_HOME = USER_HOME / ".config" + else: + XDG_CONFIG_HOME = Path(XDG_CONFIG_HOME) + + if len(str(XDG_CONFIG_HOME)) == 0: + XDG_CONFIG_HOME = USER_HOME + CONFIG_FILE_DIRECTORY = XDG_CONFIG_HOME / "blt" + CONFIG_FILE_LOCATION = CONFIG_FILE_DIRECTORY / "commit_config.env" + +class Config: + def __init__(self): + # Inline with semantic versioning it doesn't make sense to branch / release on minor + self.branch_on_major = True + self.branch_on_minor = False + self.release_on_major = True + self.release_on_minor = False + self.main_branch = "main" + self.patch_limit = -1 + + def toJSON(self): + return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4) + + def fromJSON(file): + with open(file, "r") as f: + j = json.load(f) + obj = Config() + [setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)] + return obj + + def from_file(file): + values = {} + if (not os.path.exists(file)): + return Config() + + with open(file, "r") as f: + j = json.load(f) + obj = Config() + [setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)] + return obj + + def save_to_file(self, file): + dir_index = str(file).rfind("/") + dir = str(file)[:dir_index] + if not os.path.exists(dir): + print(f"Creating config directory {dir}") + os.makedirs(dir) + with open(file, "w") as f: + json.dump(self, f, default=lambda o: o.__dict__, sort_keys=True, indent=4) + + +class EnvData: + def __init__(self, github_username = '', github_token = ''): + self.github_token = github_token + self.github_username = github_username + + def get_env_from_file(file): + f = open(file, "rt") + values = {} + for line in f: + if line.startswith("export"): + content = line.split("=") + for idx, c in enumerate(content): + content[idx] = c.replace("export", "").strip() + values[content[0]] = content[1].replace("\"", "").replace("'", "") + try: + github_token = values["github_token"] + except Exception: + print("Failed to parse github token!") + try: + github_username = values["github_username"] + except: + print("Failed to parse github username! Assuming you are me!") + github_username = "Tri11Paragon" + return EnvData(github_username=github_username, github_token=github_token) + +def open_process(command, print_out = True): + process = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + stdout, stderr = process.communicate() + exit_code = process.wait() + str_out = stdout.decode('utf8') + str_err = stderr.decode('utf8') + if print_out and len(str_out) > 0: + print(str_out, end='') + if print_out and len(str_err) > 0: + print(str_err, end='') + #print(stdout, stderr, exit_code) + return (stdout, stderr, exit_code) + +def load_cmake(): + cmake_file = open("CMakeLists.txt", 'r') + cmake_text = cmake_file.read() + cmake_file.close() + return cmake_text + +def write_cmake(cmake_text): + cmake_file = open("CMakeLists.txt", 'w') + cmake_file.write(cmake_text) + cmake_file.close() + +def get_version(cmake_text): + begin = cmake_text.find(VERSION_BEGIN_STR) + len(VERSION_BEGIN_STR) + end = cmake_text.find(VERSION_END_STR, begin) + return (cmake_text[begin:end], begin, end) + +def split_version(cmake_text): + version, begin, end = get_version(cmake_text) + version_parts = version.split('.') + return (version_parts, begin, end) + +def recombine(cmake_text, version_parts, begin, end): + constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2] + constructed_text_begin = cmake_text[0:begin] + constructed_text_end = cmake_text[end::] + return constructed_text_begin + constructed_version + constructed_text_end + +def inc_major(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[0] = str(int(version_parts[0]) + 1) + version_parts[1] = '0' + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_minor(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[1] = str(int(version_parts[1]) + 1) + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_patch(config: Config, cmake_text): + version_parts, begin, end = split_version(cmake_text) + if config.patch_limit > 0 and int(version_parts[2]) + 1 >= config.patch_limit: + return inc_minor(cmake_text) + version_parts[2] = str(int(version_parts[2]) + 1) + return recombine(cmake_text, version_parts, begin, end) + +def make_branch(config: Config, name): + print(f"Making new branch {name}") + subprocess.call(["git", "checkout", "-b", name]) + subprocess.call(["git", "merge", config.main_branch]) + subprocess.call(["git", "checkout", config.main_branch]) + +def make_release(env: EnvData, name): + print(f"Making new release {name}") + repos_v = open_process(["git", "remote", "-v"])[0].splitlines() + urls = [] + for line in repos_v: + origin = ''.join(itertools.takewhile(str.isalpha, line.decode('utf8'))) + urls.append("https://api.github.com/repos/" + open_process(["git", "remote", "get-url", origin], False)[0].decode('utf8').replace("\n", "").replace("https://github.com/", "") + "/releases") + urls = set(urls) + data = { + 'tag_name': name, + 'name': name, + 'body': "Automated Release '" + name + "'", + 'draft': False, + 'prerelease': False + } + headers = { + 'Authorization': f'Bearer {env.github_token}', + 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28' + } + for url in urls: + response = requests.post(url, headers=headers, data=json.dumps(data)) + if response.status_code == 201: + print('Release created successfully!') + release_data = response.json() + print(f"Release URL: {release_data['html_url']}") + else: + print(f"Failed to create release: {response.status_code}") + print(response.json()) + + +def main(): + parser = argparse.ArgumentParser( + prog="Commit Helper", + description="Help you make pretty commits :3") + + parser.add_argument("action", nargs='?', default=None) + parser.add_argument("-p", "--patch", action='store_true', default=False, required=False) + parser.add_argument("-m", "--minor", action='store_true', default=False, required=False) + parser.add_argument("-M", "--major", action='store_true', default=False, required=False) + parser.add_argument('-e', "--env", help="environment file", required=False, default=None) + parser.add_argument('-c', "--config", help="config file", required=False, default=None) + parser.add_argument("--create_default_config", action="store_true", default=False, required=False) + + args = parser.parse_args() + + if args.env is not None: + env = EnvData.get_env_from_file(args.e) + else: + env = EnvData.get_env_from_file(ENVIRONMENT_DATA_LOCATION) + + if args.config is not None: + config = Config.from_file(args.config) + else: + config = Config.from_file(CONFIG_FILE_LOCATION) + + if args.create_default_config: + config.save_to_file(args.config if args.config is not None else CONFIG_FILE_LOCATION) + + cmake_text = load_cmake() + cmake_version = get_version(cmake_text)[0] + print(f"Current Version: {cmake_version}") + + if not (args.patch or args.minor or args.major): + try: + if args.action is not None: + type = args.action + else: + type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") + + if type.startswith('M'): + args.major = True + elif type.startswith('m'): + args.minor = True + elif type.startswith('p') or type.startswith('P') or len(type) == 0: + args.patch = True + except KeyboardInterrupt: + print("\nCancelling!") + return + + if args.major: + print("Selected major") + write_cmake(inc_major(cmake_text)) + elif args.minor: + print("Selected minor") + write_cmake(inc_minor(cmake_text)) + elif args.patch: + print("Selected patch") + write_cmake(inc_patch(config, cmake_text)) + + subprocess.call(["git", "add", "*"]) + subprocess.call(["git", "commit"]) + + cmake_text = load_cmake() + version_parts = split_version(cmake_text)[0] + if args.major: + if config.branch_on_major: + make_branch(config, "v" + str(version_parts[0])) + if args.minor: + if config.branch_on_minor: + make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1])) + + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) + + if args.major: + if config.release_on_major: + make_release(env, "v" + str(version_parts[0])) + if args.minor: + if config.release_on_minor: + make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1])) + +if __name__ == "__main__": + main() diff --git a/data/L30fft1000.out b/data/L30fft1000.out new file mode 100644 index 0000000..d1da29a --- /dev/null +++ b/data/L30fft1000.out @@ -0,0 +1,54 @@ +53 1000 +0 0.65 0.51 0.31 0.10 0.29 0.23 0.20 0.08 2.56 0.40 0.10 0.02 0.04 0.04 0.02 0.01 0.03 0.19 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.06 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.00 0.00 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.04 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.23 0.05 0.01 0.01 0.01 0.02 0.01 0.01 0.04 0.32 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.14 0.03 0.01 0.01 0.02 0.03 0.01 0.01 0.14 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.06 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.05 0.03 0.01 0.01 0.02 0.02 0.03 0.03 0.03 0.08 0.01 0.02 0.02 0.03 0.02 0.05 0.02 0.06 0.08 0.02 0.03 0.04 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.09 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.03 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.02 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.03 0.03 0.03 0.05 0.04 0.04 0.05 0.05 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.03 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.06 0.04 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.07 0.06 0.05 0.05 0.05 0.06 0.05 0.07 0.07 0.07 0.07 0.06 0.06 0.08 0.08 0.06 0.09 0.11 0.08 0.07 0.07 0.08 0.08 0.08 0.06 0.06 0.08 0.05 0.05 0.05 0.05 0.06 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.06 0.05 0.06 0.06 0.06 0.05 0.07 0.06 0.05 0.07 0.07 0.07 0.06 0.07 0.06 0.06 0.08 0.05 0.07 0.06 0.07 0.06 0.06 0.06 0.05 0.06 0.06 0.06 0.05 0.06 0.05 0.07 0.05 0.06 0.07 0.06 +0 0.57 0.42 0.25 0.07 0.19 0.15 0.13 0.06 1.70 0.31 0.10 0.02 0.06 0.07 0.03 0.01 0.03 0.16 0.03 0.02 0.03 0.04 0.02 0.01 0.03 0.04 0.07 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.06 0.02 0.01 0.01 0.03 0.03 0.02 0.02 0.20 0.06 0.02 0.01 0.02 0.04 0.02 0.01 0.04 0.47 0.06 0.02 0.01 0.04 0.02 0.03 0.02 0.06 0.29 0.02 0.02 0.02 0.05 0.02 0.01 0.02 0.15 0.03 0.01 0.02 0.02 0.04 0.01 0.02 0.05 0.17 0.02 0.02 0.02 0.07 0.03 0.03 0.03 0.08 0.07 0.03 0.03 0.02 0.04 0.03 0.03 0.02 0.08 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.04 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.07 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.04 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.05 0.04 0.04 0.05 0.05 0.05 0.06 0.06 0.07 0.06 0.06 0.06 0.07 0.06 0.06 0.05 0.06 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.06 0.05 0.05 0.06 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 +0 0.60 0.48 0.27 0.09 0.39 0.16 0.16 0.07 1.85 0.30 0.09 0.02 0.06 0.04 0.02 0.01 0.03 0.19 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.06 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.06 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.24 0.02 0.01 0.01 0.01 0.01 0.03 0.03 0.04 0.43 0.06 0.03 0.01 0.02 0.02 0.02 0.01 0.10 0.33 0.03 0.01 0.02 0.03 0.02 0.01 0.02 0.23 0.03 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.08 0.01 0.01 0.01 0.03 0.02 0.02 0.02 0.07 0.05 0.02 0.03 0.02 0.02 0.04 0.04 0.04 0.10 0.02 0.02 0.04 0.02 0.02 0.04 0.03 0.04 0.05 0.01 0.01 0.02 0.01 0.00 0.02 0.01 0.01 0.01 0.01 0.02 0.05 0.02 0.03 0.02 0.04 0.04 0.03 0.03 0.09 0.04 0.01 0.02 0.02 0.03 0.02 0.01 0.03 0.12 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.03 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.02 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.07 0.05 0.06 0.05 0.07 0.06 0.06 0.07 0.06 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 +0 0.55 0.43 0.25 0.07 0.32 0.19 0.17 0.08 2.23 0.36 0.10 0.02 0.07 0.06 0.02 0.01 0.03 0.19 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.04 0.08 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.07 0.07 0.01 0.00 0.01 0.05 0.02 0.01 0.02 0.37 0.04 0.02 0.03 0.07 0.04 0.02 0.04 0.10 0.60 0.04 0.04 0.03 0.17 0.02 0.04 0.03 0.36 0.29 0.05 0.03 0.05 0.18 0.04 0.02 0.03 0.41 0.07 0.02 0.02 0.17 0.06 0.03 0.03 0.11 0.21 0.02 0.03 0.02 0.21 0.03 0.03 0.02 0.15 0.04 0.03 0.01 0.05 0.05 0.03 0.03 0.04 0.07 0.01 0.02 0.02 0.04 0.02 0.03 0.01 0.03 0.03 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.05 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.04 0.02 0.01 0.02 0.09 0.01 0.01 0.02 0.06 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.04 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.02 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.01 0.00 0.01 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.04 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.05 0.05 0.05 0.04 0.06 0.05 0.05 0.05 0.06 0.06 0.05 0.05 0.05 0.06 0.05 0.08 0.07 0.08 0.06 0.07 0.06 0.07 0.05 0.06 0.06 0.06 0.07 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.07 0.06 0.05 0.05 0.06 0.06 0.07 0.06 0.07 0.06 0.06 0.07 0.06 0.06 0.06 0.06 0.07 0.06 0.06 0.06 0.06 0.06 0.05 +0 0.54 0.43 0.25 0.07 0.24 0.16 0.16 0.07 2.22 0.37 0.10 0.02 0.07 0.04 0.03 0.01 0.02 0.19 0.03 0.01 0.02 0.03 0.01 0.01 0.02 0.04 0.07 0.01 0.02 0.03 0.01 0.01 0.02 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.03 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.05 0.03 0.02 0.01 0.01 0.03 0.03 0.02 0.02 0.40 0.04 0.01 0.01 0.03 0.04 0.03 0.02 0.10 0.78 0.05 0.01 0.01 0.08 0.01 0.04 0.03 0.22 0.32 0.02 0.02 0.02 0.11 0.03 0.01 0.01 0.26 0.04 0.02 0.01 0.13 0.06 0.03 0.01 0.09 0.11 0.02 0.01 0.03 0.16 0.04 0.04 0.02 0.16 0.08 0.04 0.02 0.14 0.07 0.04 0.04 0.03 0.09 0.01 0.02 0.02 0.06 0.02 0.03 0.02 0.03 0.03 0.01 0.02 0.04 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.04 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.12 0.02 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.06 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.10 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.02 0.02 0.02 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.05 0.04 0.04 0.03 0.02 0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.04 0.04 0.05 0.06 0.05 0.07 0.06 0.05 0.06 0.05 0.06 0.06 0.06 0.05 0.06 0.06 0.04 0.05 0.05 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.05 0.04 0.05 +0 0.73 0.49 0.27 0.07 0.17 0.18 0.15 0.07 2.39 0.45 0.14 0.03 0.11 0.09 0.05 0.02 0.04 0.22 0.04 0.03 0.06 0.08 0.02 0.03 0.05 0.10 0.07 0.02 0.03 0.05 0.02 0.02 0.03 0.06 0.05 0.03 0.03 0.02 0.04 0.03 0.02 0.01 0.04 0.04 0.02 0.01 0.06 0.03 0.01 0.01 0.05 0.03 0.02 0.01 0.07 0.05 0.02 0.02 0.02 0.07 0.04 0.02 0.03 0.48 0.05 0.02 0.02 0.06 0.07 0.03 0.04 0.15 0.88 0.04 0.04 0.03 0.16 0.02 0.04 0.03 0.39 0.18 0.06 0.03 0.05 0.16 0.06 0.03 0.04 0.36 0.08 0.05 0.03 0.19 0.07 0.04 0.03 0.13 0.10 0.03 0.03 0.06 0.18 0.03 0.03 0.05 0.14 0.04 0.03 0.04 0.09 0.04 0.03 0.03 0.08 0.06 0.02 0.02 0.03 0.05 0.03 0.02 0.03 0.06 0.03 0.01 0.02 0.05 0.02 0.02 0.01 0.04 0.02 0.01 0.01 0.03 0.03 0.01 0.01 0.01 0.05 0.01 0.01 0.02 0.04 0.02 0.01 0.02 0.06 0.06 0.02 0.02 0.04 0.17 0.03 0.04 0.04 0.08 0.02 0.02 0.02 0.06 0.03 0.02 0.02 0.03 0.04 0.02 0.01 0.01 0.03 0.02 0.01 0.03 0.03 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.06 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.04 0.06 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.02 0.02 0.01 0.01 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.06 0.04 0.06 0.05 0.05 0.05 0.06 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.04 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 +0 0.53 0.45 0.27 0.07 0.20 0.19 0.19 0.09 2.58 0.41 0.11 0.02 0.05 0.04 0.02 0.01 0.02 0.18 0.02 0.01 0.01 0.02 0.01 0.00 0.01 0.02 0.06 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.00 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.08 0.03 0.01 0.01 0.02 0.02 0.02 0.03 0.05 0.29 0.03 0.01 0.01 0.04 0.04 0.04 0.04 0.08 0.86 0.08 0.02 0.01 0.12 0.03 0.05 0.03 0.81 0.26 0.03 0.02 0.02 0.16 0.03 0.02 0.05 0.41 0.03 0.03 0.03 0.04 0.03 0.02 0.02 0.06 0.05 0.02 0.02 0.02 0.06 0.03 0.03 0.02 0.12 0.05 0.03 0.02 0.04 0.04 0.04 0.05 0.06 0.07 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.04 0.03 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.02 0.08 0.28 0.02 0.02 0.02 0.09 0.02 0.01 0.01 0.06 0.02 0.01 0.02 0.03 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.09 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.02 0.05 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.00 0.00 0.01 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.05 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.02 0.03 0.04 0.03 0.04 0.05 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.05 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.05 0.04 0.04 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.06 0.07 0.06 0.07 0.06 0.06 0.06 0.08 0.07 0.07 0.07 0.07 0.06 0.05 0.06 0.06 0.07 0.05 0.05 0.06 0.05 0.05 0.05 0.06 0.05 0.04 0.06 0.04 0.05 0.04 0.05 0.05 0.04 0.05 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.03 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.05 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.04 0.04 0.05 0.06 0.06 0.07 0.07 0.05 0.06 0.06 0.07 0.06 0.06 0.06 +0 0.63 0.48 0.27 0.07 0.22 0.20 0.19 0.09 2.60 0.43 0.12 0.02 0.05 0.06 0.03 0.01 0.03 0.19 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.06 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.05 0.01 0.01 0.01 0.01 0.02 0.01 0.03 0.20 0.04 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.21 0.04 0.03 0.01 0.03 0.02 0.03 0.01 0.04 0.22 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.08 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.07 0.01 0.01 0.01 0.03 0.02 0.02 0.02 0.08 0.05 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.14 0.05 0.05 0.03 0.06 0.03 0.04 0.04 0.04 0.06 0.02 0.02 0.03 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.03 0.05 0.03 0.04 0.03 0.05 0.04 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.06 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.04 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.06 0.05 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.06 0.04 0.05 0.05 0.05 0.05 0.05 0.06 0.07 0.06 0.06 0.06 0.05 0.07 0.06 0.07 0.09 0.08 0.07 0.06 0.07 0.06 0.07 0.05 0.05 0.06 0.06 0.05 0.04 0.04 0.05 0.04 0.03 0.05 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.04 0.04 0.03 0.04 0.04 0.05 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.05 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 +0 0.61 0.47 0.27 0.11 0.39 0.12 0.07 0.04 2.27 0.49 0.18 0.04 0.11 0.13 0.07 0.03 0.09 0.17 0.03 0.03 0.06 0.06 0.02 0.03 0.05 0.05 0.06 0.03 0.05 0.04 0.01 0.03 0.04 0.02 0.02 0.03 0.04 0.02 0.02 0.03 0.03 0.02 0.01 0.04 0.03 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.07 0.02 0.01 0.02 0.03 0.02 0.01 0.03 0.21 0.03 0.02 0.02 0.02 0.05 0.03 0.02 0.03 0.40 0.07 0.04 0.02 0.04 0.03 0.04 0.02 0.07 0.36 0.03 0.02 0.01 0.05 0.02 0.02 0.02 0.16 0.03 0.01 0.01 0.02 0.05 0.02 0.02 0.02 0.14 0.02 0.02 0.02 0.04 0.04 0.04 0.02 0.07 0.07 0.02 0.02 0.03 0.03 0.04 0.03 0.02 0.07 0.05 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.05 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.04 0.02 0.03 0.02 0.03 0.02 0.02 0.01 0.06 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.05 0.03 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.08 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.06 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.04 0.04 0.03 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.03 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.03 0.03 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.05 0.06 0.06 0.06 0.07 0.07 0.07 0.06 0.06 0.07 0.06 0.05 0.06 0.06 0.07 0.06 0.05 0.07 0.06 0.06 0.07 0.07 0.08 0.06 0.07 0.07 0.08 0.08 0.07 0.05 0.06 0.06 0.05 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.05 0.04 0.05 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.05 +0 0.55 0.43 0.25 0.06 0.23 0.20 0.17 0.07 2.02 0.31 0.08 0.01 0.05 0.03 0.02 0.01 0.03 0.16 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.06 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.05 0.03 0.01 0.01 0.01 0.02 0.02 0.01 0.03 0.35 0.03 0.01 0.01 0.02 0.02 0.02 0.04 0.10 0.60 0.03 0.03 0.02 0.02 0.01 0.04 0.03 0.35 0.34 0.05 0.02 0.01 0.02 0.03 0.02 0.02 0.40 0.06 0.02 0.01 0.02 0.03 0.03 0.01 0.07 0.12 0.02 0.01 0.02 0.04 0.03 0.03 0.03 0.12 0.05 0.03 0.02 0.01 0.01 0.02 0.02 0.03 0.07 0.02 0.03 0.04 0.03 0.03 0.04 0.03 0.05 0.05 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.04 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.05 0.01 0.02 0.02 0.14 0.02 0.02 0.02 0.06 0.01 0.02 0.03 0.04 0.06 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.03 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.00 0.01 0.00 0.01 0.01 0.05 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.00 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.05 0.04 0.05 0.05 0.06 0.04 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.03 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.03 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.03 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.05 0.03 0.05 0.05 0.04 0.05 0.05 0.05 0.04 0.05 0.04 0.05 0.05 0.06 0.05 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.06 0.07 0.08 0.07 0.06 0.06 0.08 0.07 0.06 0.06 0.07 0.07 0.06 +0 0.53 0.43 0.26 0.07 0.43 0.15 0.14 0.07 2.30 0.40 0.12 0.03 0.09 0.05 0.03 0.01 0.02 0.18 0.03 0.01 0.03 0.04 0.02 0.01 0.03 0.05 0.06 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.05 0.03 0.02 0.01 0.01 0.02 0.03 0.02 0.01 0.34 0.04 0.01 0.01 0.02 0.03 0.02 0.02 0.09 0.73 0.05 0.01 0.01 0.01 0.02 0.03 0.02 0.28 0.22 0.02 0.02 0.01 0.03 0.02 0.02 0.01 0.20 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.07 0.14 0.02 0.01 0.01 0.02 0.04 0.03 0.02 0.15 0.08 0.04 0.02 0.03 0.03 0.04 0.04 0.05 0.11 0.02 0.02 0.02 0.02 0.04 0.04 0.03 0.08 0.09 0.02 0.02 0.05 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.05 0.02 0.01 0.03 0.01 0.04 0.03 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.15 0.02 0.01 0.02 0.03 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.03 0.10 0.02 0.02 0.03 0.02 0.01 0.05 0.03 0.13 0.11 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.09 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.04 0.10 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.02 0.02 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.06 0.06 0.06 0.06 0.07 0.06 0.07 0.06 0.08 0.08 0.08 0.07 0.07 0.08 0.06 0.08 0.07 0.09 0.08 0.08 0.08 0.07 0.06 0.06 0.06 0.07 0.05 0.05 0.05 0.06 0.04 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 +0 0.57 0.46 0.27 0.10 0.37 0.20 0.17 0.08 2.39 0.39 0.10 0.02 0.06 0.05 0.02 0.01 0.03 0.18 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.06 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.05 0.01 0.00 0.01 0.04 0.02 0.01 0.02 0.19 0.04 0.02 0.02 0.04 0.06 0.03 0.01 0.04 0.46 0.04 0.01 0.01 0.09 0.03 0.02 0.02 0.09 0.25 0.02 0.01 0.01 0.07 0.02 0.02 0.01 0.10 0.02 0.01 0.01 0.04 0.07 0.02 0.01 0.03 0.04 0.01 0.02 0.01 0.05 0.03 0.02 0.02 0.04 0.05 0.02 0.02 0.03 0.05 0.02 0.03 0.02 0.07 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.03 0.02 0.02 0.01 0.03 0.01 0.01 0.01 0.03 0.02 0.01 0.02 0.06 0.03 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.07 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.09 0.02 0.02 0.02 0.03 0.01 0.02 0.01 0.05 0.06 0.03 0.02 0.02 0.02 0.01 0.02 0.03 0.03 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.07 0.03 0.02 0.04 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.04 0.02 0.04 0.04 0.05 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.07 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.03 0.05 0.04 0.06 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.06 0.03 0.04 0.05 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.04 0.03 0.04 0.03 0.02 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.05 0.03 0.05 0.03 0.02 0.02 0.02 0.03 0.04 0.04 0.05 0.05 0.05 0.04 0.03 0.03 0.04 0.05 0.07 0.06 0.05 0.08 0.08 0.06 0.06 0.07 0.08 0.08 0.09 0.07 0.10 0.06 0.07 0.06 0.07 0.05 0.07 0.07 0.09 0.08 0.06 0.06 0.06 0.06 0.05 0.06 0.05 0.05 0.05 0.06 0.05 0.05 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.05 0.05 0.05 +0 0.54 0.41 0.22 0.05 0.11 0.04 0.04 0.05 2.76 0.58 0.20 0.04 0.12 0.13 0.07 0.03 0.08 0.24 0.04 0.03 0.06 0.06 0.02 0.03 0.05 0.04 0.07 0.03 0.05 0.04 0.02 0.03 0.04 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.01 0.04 0.03 0.01 0.03 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.06 0.04 0.02 0.01 0.01 0.02 0.01 0.01 0.03 0.34 0.02 0.02 0.02 0.03 0.01 0.02 0.03 0.08 0.51 0.07 0.05 0.03 0.03 0.03 0.05 0.02 0.31 0.13 0.04 0.01 0.02 0.05 0.03 0.01 0.02 0.24 0.03 0.01 0.01 0.04 0.02 0.02 0.01 0.16 0.07 0.02 0.02 0.02 0.05 0.03 0.03 0.02 0.16 0.05 0.02 0.02 0.03 0.02 0.03 0.03 0.05 0.10 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.04 0.04 0.01 0.02 0.04 0.02 0.02 0.02 0.03 0.02 0.02 0.04 0.07 0.02 0.01 0.03 0.03 0.04 0.02 0.01 0.02 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.05 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.03 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.05 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.07 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.13 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.06 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.05 0.04 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.06 0.05 0.06 0.06 0.06 0.05 0.07 0.06 0.06 0.05 0.05 0.06 0.07 0.07 0.07 0.07 0.07 0.08 0.08 0.07 0.08 0.08 0.09 0.09 0.08 0.07 0.09 0.08 0.07 0.09 0.07 0.07 0.08 0.07 0.08 0.07 0.06 0.06 0.08 0.07 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.04 0.05 0.04 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.04 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.07 0.06 0.07 0.07 0.08 0.07 0.07 0.08 0.08 0.07 0.07 0.09 0.08 0.07 0.09 0.10 0.07 0.10 0.10 0.10 0.11 0.08 0.11 0.10 0.11 0.11 0.09 0.10 0.10 0.10 0.10 0.09 0.09 0.09 0.08 0.10 0.10 0.09 0.10 0.08 +0 0.55 0.43 0.25 0.07 0.19 0.20 0.18 0.08 2.44 0.39 0.09 0.02 0.08 0.02 0.01 0.01 0.03 0.19 0.01 0.01 0.01 0.05 0.01 0.00 0.01 0.05 0.06 0.01 0.01 0.03 0.01 0.00 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.02 0.02 0.00 0.01 0.03 0.01 0.00 0.00 0.01 0.02 0.01 0.01 0.04 0.04 0.01 0.01 0.01 0.03 0.02 0.01 0.02 0.37 0.07 0.02 0.01 0.03 0.04 0.02 0.02 0.11 0.69 0.04 0.02 0.02 0.04 0.01 0.03 0.03 0.09 0.25 0.03 0.02 0.02 0.05 0.02 0.01 0.01 0.13 0.02 0.01 0.01 0.07 0.05 0.04 0.02 0.07 0.19 0.02 0.02 0.03 0.08 0.02 0.03 0.02 0.10 0.05 0.04 0.03 0.07 0.04 0.04 0.04 0.05 0.10 0.03 0.05 0.06 0.06 0.06 0.05 0.05 0.06 0.04 0.02 0.02 0.05 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.04 0.06 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.11 0.02 0.01 0.02 0.03 0.04 0.02 0.02 0.04 0.33 0.05 0.03 0.03 0.06 0.04 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.01 0.02 0.03 0.03 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.05 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.04 0.11 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.04 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.04 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.08 0.04 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.05 0.05 0.05 0.03 0.06 0.05 0.05 0.03 0.06 0.06 0.04 0.05 0.04 0.06 0.05 0.04 0.04 0.06 0.05 0.03 0.04 0.06 0.05 0.04 0.03 0.04 0.04 0.04 0.03 0.03 0.05 0.04 0.02 0.03 0.05 0.04 0.03 0.02 0.05 0.04 0.02 0.03 0.03 0.04 0.03 0.02 0.03 0.04 0.03 0.02 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.04 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.06 0.05 0.04 0.05 0.04 0.06 0.05 0.04 0.04 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.05 0.04 0.04 0.03 0.03 0.02 0.01 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.05 0.06 0.05 0.06 0.06 0.06 0.07 0.07 0.08 0.08 0.07 0.07 0.08 0.08 0.09 0.10 0.09 0.08 0.09 0.09 0.09 0.07 0.07 0.07 0.07 0.06 0.06 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.04 0.04 0.05 0.06 0.04 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 +0 1.32 1.05 0.57 0.18 0.73 0.35 0.22 0.11 3.04 0.59 0.18 0.05 0.20 0.15 0.07 0.03 0.08 0.24 0.05 0.05 0.10 0.09 0.03 0.05 0.08 0.09 0.06 0.04 0.07 0.06 0.04 0.04 0.05 0.04 0.06 0.05 0.05 0.03 0.04 0.05 0.04 0.02 0.04 0.06 0.04 0.01 0.03 0.07 0.03 0.01 0.03 0.06 0.03 0.01 0.02 0.13 0.02 0.02 0.03 0.04 0.05 0.03 0.03 0.04 0.32 0.02 0.02 0.02 0.06 0.04 0.02 0.02 0.38 0.11 0.04 0.03 0.02 0.13 0.03 0.03 0.02 0.21 0.05 0.03 0.01 0.04 0.04 0.02 0.01 0.03 0.34 0.04 0.02 0.04 0.13 0.03 0.02 0.03 0.12 0.04 0.04 0.03 0.06 0.09 0.04 0.02 0.03 0.11 0.03 0.03 0.02 0.08 0.04 0.03 0.01 0.07 0.06 0.03 0.02 0.02 0.04 0.04 0.02 0.02 0.05 0.03 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.03 0.01 0.02 0.01 0.04 0.01 0.01 0.02 0.03 0.02 0.02 0.03 0.13 0.06 0.03 0.03 0.03 0.09 0.03 0.02 0.02 0.13 0.02 0.01 0.02 0.03 0.03 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.06 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.07 0.03 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.04 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.03 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.05 0.03 0.05 0.05 0.06 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.05 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +0 1.09 0.86 0.50 0.19 0.60 0.33 0.24 0.11 3.10 0.46 0.08 0.03 0.08 0.07 0.04 0.02 0.03 0.22 0.03 0.02 0.05 0.07 0.02 0.02 0.03 0.05 0.07 0.03 0.04 0.03 0.03 0.02 0.03 0.02 0.06 0.03 0.03 0.02 0.04 0.02 0.03 0.02 0.02 0.05 0.02 0.01 0.03 0.04 0.02 0.01 0.01 0.05 0.02 0.02 0.02 0.13 0.04 0.01 0.01 0.03 0.06 0.02 0.02 0.05 0.30 0.02 0.02 0.02 0.10 0.06 0.01 0.03 0.15 0.35 0.04 0.03 0.02 0.17 0.04 0.02 0.03 0.29 0.08 0.02 0.01 0.04 0.09 0.03 0.01 0.05 0.43 0.04 0.02 0.03 0.19 0.07 0.05 0.02 0.08 0.09 0.04 0.02 0.06 0.21 0.04 0.03 0.03 0.17 0.07 0.03 0.02 0.11 0.08 0.03 0.02 0.06 0.13 0.03 0.02 0.03 0.08 0.04 0.03 0.02 0.05 0.06 0.01 0.01 0.02 0.03 0.02 0.01 0.01 0.04 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.02 0.07 0.02 0.02 0.01 0.03 0.04 0.02 0.02 0.05 0.05 0.02 0.02 0.02 0.07 0.02 0.02 0.02 0.07 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.06 0.02 0.01 0.02 0.04 0.03 0.02 0.01 0.03 0.03 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.07 0.02 0.02 0.01 0.02 0.02 0.03 0.01 0.03 0.09 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.07 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.07 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.05 0.05 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.03 0.03 0.04 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.06 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 +0 1.27 0.98 0.55 0.13 0.49 0.37 0.26 0.11 3.16 0.54 0.14 0.05 0.16 0.12 0.06 0.03 0.08 0.25 0.04 0.03 0.07 0.10 0.03 0.03 0.06 0.08 0.06 0.04 0.06 0.06 0.04 0.03 0.05 0.03 0.06 0.04 0.05 0.03 0.05 0.04 0.03 0.02 0.03 0.05 0.03 0.01 0.04 0.05 0.02 0.01 0.02 0.06 0.03 0.01 0.02 0.14 0.04 0.01 0.02 0.05 0.04 0.02 0.02 0.07 0.29 0.02 0.04 0.05 0.12 0.03 0.03 0.05 0.26 0.04 0.03 0.02 0.04 0.15 0.03 0.02 0.01 0.15 0.04 0.02 0.01 0.16 0.05 0.03 0.02 0.09 0.23 0.03 0.02 0.02 0.14 0.03 0.02 0.01 0.08 0.03 0.02 0.02 0.05 0.06 0.02 0.01 0.02 0.10 0.02 0.02 0.01 0.06 0.02 0.02 0.01 0.04 0.06 0.02 0.01 0.03 0.03 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.05 0.02 0.01 0.02 0.01 0.03 0.02 0.03 0.03 0.05 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.04 0.02 0.02 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +0 1.23 0.96 0.53 0.13 0.34 0.26 0.18 0.09 2.75 0.58 0.19 0.05 0.16 0.16 0.08 0.03 0.09 0.22 0.05 0.04 0.10 0.10 0.03 0.04 0.08 0.10 0.07 0.03 0.06 0.05 0.03 0.04 0.05 0.03 0.08 0.05 0.05 0.03 0.04 0.05 0.05 0.02 0.03 0.06 0.03 0.01 0.04 0.04 0.03 0.01 0.03 0.05 0.03 0.01 0.02 0.11 0.02 0.02 0.03 0.04 0.03 0.04 0.03 0.04 0.34 0.03 0.03 0.02 0.08 0.05 0.03 0.02 0.49 0.20 0.03 0.03 0.03 0.12 0.04 0.03 0.03 0.25 0.04 0.03 0.02 0.05 0.07 0.04 0.02 0.04 0.34 0.05 0.02 0.03 0.12 0.04 0.02 0.02 0.16 0.09 0.03 0.03 0.04 0.08 0.04 0.03 0.03 0.14 0.03 0.03 0.02 0.06 0.03 0.03 0.01 0.03 0.06 0.02 0.01 0.02 0.05 0.02 0.02 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.04 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.04 0.03 0.02 0.02 0.01 0.03 0.03 0.02 0.02 0.11 0.03 0.02 0.03 0.05 0.03 0.02 0.02 0.02 0.04 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.04 0.03 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.04 0.03 0.02 0.02 0.04 0.04 0.02 0.03 0.04 0.04 0.02 0.02 0.03 0.03 0.02 0.03 0.05 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.02 0.02 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.04 0.03 0.04 0.03 0.03 0.03 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.04 0.04 0.04 0.04 0.04 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.04 0.04 0.05 0.06 0.06 0.05 0.04 0.05 0.05 0.04 0.05 0.04 0.04 0.05 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.07 0.06 0.06 0.05 0.06 0.06 0.06 0.05 0.06 0.05 0.05 0.06 0.06 0.05 0.04 0.05 0.05 0.05 0.04 0.05 0.05 0.05 +0 1.21 0.96 0.53 0.14 0.23 0.21 0.13 0.06 1.85 0.49 0.18 0.05 0.15 0.18 0.09 0.04 0.12 0.18 0.05 0.04 0.09 0.08 0.03 0.04 0.07 0.06 0.05 0.05 0.07 0.05 0.02 0.04 0.06 0.04 0.03 0.05 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.04 0.03 0.01 0.02 0.04 0.03 0.01 0.03 0.09 0.03 0.01 0.03 0.05 0.04 0.02 0.04 0.10 0.28 0.01 0.02 0.02 0.07 0.03 0.04 0.05 0.27 0.07 0.03 0.02 0.02 0.08 0.02 0.01 0.02 0.31 0.07 0.02 0.02 0.08 0.05 0.02 0.02 0.05 0.18 0.02 0.02 0.02 0.06 0.02 0.02 0.02 0.10 0.04 0.02 0.02 0.03 0.07 0.03 0.02 0.02 0.11 0.03 0.02 0.01 0.04 0.03 0.04 0.01 0.02 0.05 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.04 0.01 0.03 0.02 0.03 0.02 0.02 0.02 0.06 0.02 0.02 0.02 0.01 0.04 0.02 0.01 0.02 0.10 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.05 0.04 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.05 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 +0 1.24 0.96 0.54 0.19 0.68 0.24 0.13 0.07 2.23 0.58 0.21 0.06 0.19 0.17 0.09 0.04 0.13 0.21 0.05 0.04 0.10 0.10 0.03 0.04 0.08 0.09 0.06 0.06 0.08 0.06 0.05 0.05 0.07 0.04 0.05 0.05 0.06 0.03 0.04 0.05 0.05 0.02 0.03 0.07 0.04 0.02 0.04 0.06 0.04 0.01 0.03 0.07 0.03 0.01 0.04 0.12 0.02 0.01 0.04 0.04 0.03 0.03 0.05 0.05 0.19 0.03 0.04 0.03 0.07 0.04 0.05 0.02 0.48 0.21 0.02 0.02 0.02 0.08 0.03 0.02 0.03 0.25 0.03 0.03 0.02 0.11 0.07 0.02 0.01 0.04 0.11 0.02 0.02 0.02 0.13 0.03 0.02 0.03 0.08 0.04 0.02 0.02 0.03 0.04 0.03 0.02 0.02 0.05 0.02 0.02 0.01 0.04 0.02 0.02 0.01 0.03 0.03 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.05 0.03 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.04 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.05 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.05 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 +0 1.04 0.83 0.46 0.11 0.28 0.31 0.24 0.12 3.23 0.46 0.07 0.02 0.09 0.07 0.02 0.01 0.02 0.24 0.02 0.02 0.03 0.09 0.01 0.01 0.02 0.05 0.06 0.02 0.02 0.03 0.04 0.01 0.02 0.02 0.07 0.01 0.02 0.02 0.05 0.04 0.02 0.01 0.04 0.06 0.02 0.01 0.04 0.08 0.01 0.01 0.02 0.08 0.03 0.02 0.03 0.13 0.05 0.01 0.02 0.08 0.13 0.02 0.02 0.03 0.34 0.05 0.02 0.02 0.13 0.09 0.02 0.03 0.36 0.57 0.03 0.03 0.04 0.16 0.08 0.04 0.10 0.66 0.12 0.05 0.05 0.16 0.32 0.05 0.05 0.08 0.60 0.10 0.04 0.07 0.46 0.15 0.04 0.05 0.19 0.31 0.06 0.04 0.09 0.49 0.09 0.05 0.07 0.31 0.15 0.04 0.04 0.11 0.23 0.04 0.03 0.09 0.28 0.05 0.03 0.04 0.12 0.09 0.03 0.03 0.10 0.10 0.03 0.03 0.07 0.09 0.04 0.02 0.04 0.12 0.05 0.02 0.02 0.06 0.04 0.02 0.01 0.06 0.06 0.03 0.02 0.02 0.06 0.03 0.02 0.02 0.04 0.04 0.02 0.01 0.04 0.04 0.02 0.02 0.02 0.05 0.02 0.01 0.01 0.04 0.02 0.02 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.02 0.02 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.04 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.04 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.05 0.04 0.02 0.03 0.03 0.03 0.03 0.02 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.02 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.02 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.05 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.05 0.06 0.07 0.05 0.05 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.02 0.03 0.02 0.01 0.01 0.01 0.02 0.02 0.04 0.05 0.07 0.06 0.05 0.06 0.05 0.05 0.05 0.04 0.06 0.07 0.04 0.05 0.04 0.05 0.06 0.05 0.05 0.06 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 +0 1.22 0.96 0.55 0.14 0.38 0.34 0.27 0.11 2.56 0.32 0.03 0.02 0.03 0.06 0.03 0.02 0.05 0.17 0.02 0.01 0.03 0.04 0.02 0.02 0.04 0.04 0.05 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.06 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.07 0.31 0.02 0.01 0.02 0.05 0.01 0.02 0.04 0.25 0.05 0.02 0.02 0.01 0.04 0.01 0.01 0.02 0.20 0.04 0.02 0.01 0.03 0.03 0.02 0.01 0.03 0.22 0.02 0.01 0.02 0.05 0.02 0.01 0.02 0.05 0.05 0.01 0.02 0.01 0.03 0.02 0.01 0.01 0.07 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.06 0.02 0.01 0.03 0.02 0.02 0.03 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.03 0.01 0.04 0.01 0.02 0.01 0.02 0.02 0.04 0.02 0.06 0.02 0.01 0.02 0.01 0.03 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.03 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.06 0.02 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.00 0.01 0.00 0.00 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.03 0.03 0.02 0.01 0.02 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.06 0.07 0.06 0.06 0.05 0.07 0.07 0.07 0.07 0.06 0.09 0.07 0.08 0.07 0.07 0.08 0.07 +0 1.21 0.97 0.55 0.14 0.57 0.33 0.25 0.10 2.47 0.33 0.06 0.02 0.06 0.05 0.03 0.01 0.02 0.18 0.03 0.02 0.04 0.05 0.02 0.02 0.03 0.04 0.04 0.02 0.04 0.03 0.01 0.02 0.03 0.02 0.04 0.02 0.03 0.02 0.02 0.02 0.03 0.01 0.02 0.04 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.07 0.02 0.01 0.01 0.03 0.01 0.02 0.02 0.05 0.26 0.02 0.01 0.02 0.06 0.03 0.02 0.04 0.45 0.10 0.01 0.01 0.03 0.05 0.02 0.01 0.03 0.16 0.03 0.02 0.01 0.05 0.03 0.02 0.01 0.04 0.24 0.03 0.01 0.02 0.06 0.02 0.01 0.02 0.10 0.06 0.03 0.02 0.04 0.04 0.04 0.01 0.02 0.09 0.02 0.02 0.01 0.03 0.02 0.03 0.01 0.06 0.06 0.02 0.02 0.02 0.03 0.04 0.02 0.02 0.04 0.04 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.06 0.04 0.02 0.03 0.02 0.04 0.03 0.03 0.02 0.04 0.01 0.02 0.02 0.03 0.02 0.02 0.01 0.01 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.08 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.05 0.04 0.05 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.03 0.04 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +0 1.23 0.96 0.54 0.15 0.59 0.40 0.29 0.12 3.27 0.44 0.06 0.02 0.04 0.07 0.03 0.02 0.06 0.18 0.02 0.01 0.02 0.03 0.02 0.01 0.03 0.03 0.05 0.02 0.03 0.04 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.08 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.05 0.21 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.30 0.12 0.04 0.02 0.01 0.04 0.03 0.02 0.03 0.33 0.03 0.01 0.01 0.03 0.02 0.02 0.02 0.05 0.20 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.05 0.05 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.08 0.02 0.02 0.01 0.03 0.02 0.03 0.01 0.05 0.04 0.03 0.01 0.02 0.03 0.02 0.02 0.01 0.04 0.03 0.01 0.01 0.03 0.02 0.03 0.02 0.03 0.05 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.03 0.03 0.02 0.01 0.04 0.03 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.08 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.03 0.04 0.05 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.04 0.04 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.05 0.06 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.04 0.03 0.04 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +0 1.21 0.96 0.54 0.18 0.83 0.31 0.22 0.09 2.96 0.58 0.17 0.06 0.17 0.15 0.07 0.04 0.11 0.23 0.04 0.03 0.08 0.08 0.03 0.04 0.07 0.06 0.05 0.03 0.06 0.05 0.03 0.04 0.05 0.03 0.03 0.03 0.05 0.03 0.03 0.04 0.04 0.02 0.03 0.04 0.03 0.01 0.03 0.03 0.03 0.01 0.02 0.04 0.02 0.01 0.02 0.08 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.05 0.27 0.02 0.04 0.04 0.04 0.03 0.05 0.05 0.27 0.08 0.03 0.02 0.01 0.04 0.03 0.02 0.02 0.31 0.04 0.01 0.01 0.04 0.03 0.02 0.01 0.03 0.14 0.01 0.02 0.02 0.06 0.02 0.02 0.02 0.08 0.03 0.01 0.02 0.03 0.03 0.02 0.02 0.02 0.10 0.03 0.02 0.02 0.05 0.02 0.03 0.02 0.07 0.07 0.03 0.01 0.03 0.05 0.03 0.04 0.02 0.05 0.04 0.01 0.02 0.03 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.06 0.01 0.02 0.01 0.03 0.02 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.08 0.02 0.01 0.02 0.08 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.08 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.05 0.03 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.04 +0 1.20 0.96 0.54 0.16 0.63 0.30 0.26 0.12 3.54 0.57 0.13 0.03 0.08 0.09 0.05 0.02 0.04 0.22 0.04 0.02 0.05 0.05 0.02 0.02 0.04 0.03 0.05 0.03 0.04 0.03 0.02 0.02 0.04 0.02 0.04 0.03 0.03 0.02 0.02 0.03 0.03 0.01 0.01 0.03 0.03 0.01 0.02 0.03 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.07 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.05 0.30 0.03 0.02 0.02 0.06 0.03 0.02 0.03 0.33 0.09 0.02 0.02 0.02 0.05 0.02 0.02 0.01 0.14 0.04 0.02 0.01 0.06 0.03 0.03 0.01 0.04 0.17 0.02 0.01 0.01 0.07 0.02 0.01 0.02 0.07 0.10 0.02 0.01 0.02 0.04 0.03 0.02 0.03 0.08 0.02 0.02 0.01 0.02 0.03 0.03 0.01 0.05 0.08 0.03 0.01 0.03 0.04 0.03 0.02 0.01 0.03 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.07 0.01 0.02 0.01 0.04 0.02 0.03 0.02 0.12 0.04 0.02 0.02 0.01 0.05 0.02 0.01 0.02 0.08 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.07 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.04 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.05 0.07 0.05 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.04 0.06 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 +0 1.10 0.85 0.45 0.12 0.40 0.18 0.12 0.08 2.48 0.59 0.20 0.05 0.17 0.17 0.09 0.04 0.13 0.21 0.05 0.03 0.08 0.08 0.03 0.03 0.07 0.07 0.06 0.04 0.07 0.05 0.02 0.04 0.06 0.04 0.03 0.05 0.05 0.03 0.03 0.04 0.05 0.02 0.02 0.04 0.04 0.02 0.02 0.04 0.04 0.01 0.02 0.05 0.03 0.01 0.03 0.10 0.03 0.01 0.03 0.04 0.04 0.02 0.03 0.07 0.33 0.02 0.02 0.03 0.06 0.04 0.04 0.05 0.10 0.27 0.03 0.02 0.02 0.10 0.02 0.01 0.02 0.25 0.08 0.03 0.01 0.04 0.08 0.02 0.01 0.03 0.19 0.02 0.01 0.02 0.16 0.03 0.02 0.03 0.08 0.06 0.02 0.02 0.03 0.09 0.03 0.02 0.02 0.09 0.04 0.03 0.02 0.04 0.06 0.02 0.01 0.02 0.07 0.02 0.01 0.02 0.04 0.02 0.02 0.01 0.03 0.03 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.06 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.05 0.02 0.02 0.02 0.06 0.03 0.01 0.02 0.07 0.04 0.01 0.03 0.02 0.05 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.04 0.04 0.02 0.02 0.02 0.02 0.01 0.03 0.03 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.03 0.02 0.03 0.04 0.04 0.04 0.04 0.05 0.08 0.06 0.05 0.05 0.05 0.04 0.05 0.04 0.04 0.05 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 +0 1.25 0.97 0.52 0.14 0.62 0.18 0.14 0.07 2.11 0.52 0.19 0.05 0.17 0.18 0.09 0.03 0.09 0.20 0.05 0.04 0.09 0.09 0.03 0.04 0.08 0.07 0.05 0.04 0.07 0.05 0.02 0.04 0.06 0.04 0.04 0.04 0.05 0.03 0.02 0.04 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.04 0.03 0.01 0.03 0.04 0.03 0.01 0.03 0.10 0.03 0.01 0.03 0.05 0.02 0.02 0.05 0.08 0.22 0.01 0.02 0.03 0.04 0.03 0.04 0.03 0.33 0.22 0.03 0.02 0.01 0.04 0.03 0.02 0.02 0.21 0.03 0.02 0.02 0.04 0.05 0.04 0.01 0.03 0.17 0.02 0.03 0.02 0.06 0.03 0.03 0.02 0.11 0.08 0.03 0.02 0.03 0.07 0.03 0.06 0.05 0.16 0.08 0.04 0.03 0.05 0.05 0.03 0.02 0.03 0.06 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.02 0.04 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.10 0.08 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.15 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.05 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.02 0.03 0.04 0.04 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.05 0.03 0.04 0.04 0.04 0.04 0.05 0.03 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.07 0.06 0.06 0.05 0.06 0.07 0.05 0.04 0.05 0.06 0.07 0.05 0.05 0.06 0.05 0.04 0.04 0.06 0.06 0.05 0.04 0.04 0.05 0.04 0.04 0.03 0.04 0.04 0.03 0.04 0.05 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.02 0.02 0.04 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 +0 1.14 0.91 0.51 0.18 0.76 0.34 0.25 0.10 2.60 0.35 0.07 0.02 0.05 0.06 0.03 0.02 0.06 0.17 0.02 0.01 0.03 0.04 0.02 0.01 0.03 0.03 0.04 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.07 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.19 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.27 0.18 0.04 0.02 0.01 0.02 0.02 0.01 0.02 0.21 0.03 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.10 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.07 0.07 0.02 0.01 0.01 0.02 0.03 0.02 0.02 0.10 0.03 0.02 0.01 0.02 0.03 0.04 0.03 0.05 0.15 0.04 0.03 0.03 0.03 0.07 0.04 0.03 0.03 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.03 0.02 0.08 0.02 0.03 0.02 0.06 0.03 0.03 0.03 0.03 0.03 0.01 0.02 0.01 0.03 0.01 0.01 0.01 0.09 0.01 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.04 0.04 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.04 0.04 0.03 0.03 0.03 0.05 0.05 0.04 0.04 0.05 0.05 0.03 0.03 0.02 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.03 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.04 0.04 0.03 0.04 0.06 0.05 0.05 0.04 0.05 0.06 0.06 0.05 0.07 0.08 0.07 0.06 0.06 0.08 0.06 0.05 0.04 0.05 0.06 0.04 0.05 0.05 0.04 0.04 0.04 0.03 0.05 0.05 0.03 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 +0 1.21 0.95 0.54 0.15 0.34 0.32 0.26 0.13 3.08 0.45 0.08 0.03 0.06 0.06 0.03 0.01 0.02 0.16 0.03 0.02 0.04 0.04 0.02 0.02 0.03 0.03 0.06 0.03 0.03 0.02 0.01 0.02 0.03 0.02 0.04 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.05 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.08 0.31 0.02 0.01 0.01 0.03 0.03 0.01 0.04 0.46 0.07 0.03 0.04 0.02 0.03 0.04 0.04 0.04 0.29 0.04 0.02 0.01 0.03 0.02 0.03 0.01 0.04 0.22 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.06 0.03 0.01 0.01 0.02 0.02 0.03 0.01 0.02 0.08 0.02 0.02 0.01 0.03 0.02 0.03 0.01 0.04 0.04 0.02 0.01 0.02 0.02 0.03 0.03 0.01 0.03 0.04 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.03 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.08 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.05 0.05 0.05 0.05 0.04 0.06 0.05 0.05 0.05 0.05 0.06 0.05 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +0 1.22 0.97 0.56 0.17 0.29 0.18 0.09 0.07 2.79 0.68 0.23 0.06 0.18 0.21 0.10 0.05 0.14 0.24 0.05 0.04 0.10 0.09 0.03 0.04 0.08 0.07 0.06 0.05 0.08 0.06 0.02 0.05 0.07 0.04 0.03 0.06 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.05 0.04 0.01 0.03 0.04 0.03 0.01 0.03 0.06 0.03 0.01 0.03 0.04 0.02 0.02 0.03 0.15 0.17 0.02 0.03 0.02 0.02 0.03 0.03 0.05 0.35 0.04 0.03 0.02 0.01 0.02 0.02 0.01 0.03 0.18 0.05 0.03 0.01 0.03 0.03 0.02 0.01 0.08 0.16 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.07 0.01 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.05 0.01 0.03 0.01 0.02 0.02 0.02 0.01 0.05 0.04 0.03 0.02 0.03 0.03 0.09 0.06 0.04 0.10 0.05 0.03 0.04 0.04 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.05 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.05 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.15 0.02 0.03 0.02 0.05 0.02 0.03 0.01 0.04 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.06 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.04 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.06 0.07 0.06 0.07 0.06 0.07 0.06 0.07 0.07 0.08 0.07 0.07 0.05 0.07 0.05 0.04 0.04 0.06 0.05 0.04 0.04 0.03 0.05 0.04 0.03 0.03 0.04 0.05 0.03 0.04 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.05 0.06 0.07 0.06 0.06 0.06 0.07 0.06 0.06 0.07 0.06 0.06 0.07 0.06 0.07 0.08 0.07 0.07 +0 1.21 0.94 0.53 0.13 0.36 0.34 0.25 0.09 2.28 0.35 0.09 0.03 0.14 0.08 0.05 0.02 0.04 0.20 0.04 0.03 0.06 0.06 0.02 0.02 0.04 0.07 0.05 0.03 0.05 0.08 0.04 0.03 0.04 0.03 0.06 0.04 0.04 0.02 0.06 0.04 0.04 0.02 0.06 0.04 0.02 0.01 0.04 0.09 0.03 0.01 0.02 0.08 0.02 0.01 0.03 0.14 0.04 0.01 0.02 0.12 0.07 0.02 0.03 0.07 0.33 0.03 0.02 0.03 0.15 0.03 0.02 0.06 0.53 0.10 0.02 0.03 0.08 0.18 0.03 0.02 0.02 0.21 0.04 0.03 0.01 0.14 0.07 0.03 0.02 0.07 0.09 0.02 0.02 0.03 0.18 0.03 0.03 0.02 0.19 0.05 0.03 0.03 0.08 0.06 0.03 0.03 0.05 0.16 0.04 0.04 0.04 0.17 0.07 0.05 0.05 0.17 0.09 0.06 0.05 0.10 0.16 0.04 0.07 0.09 0.23 0.06 0.07 0.05 0.21 0.09 0.05 0.04 0.13 0.13 0.04 0.04 0.08 0.12 0.03 0.03 0.03 0.09 0.04 0.03 0.02 0.09 0.04 0.02 0.03 0.04 0.04 0.02 0.02 0.02 0.10 0.02 0.02 0.02 0.05 0.02 0.02 0.01 0.03 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.05 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.01 0.01 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.01 0.02 0.03 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.04 0.05 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.06 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.07 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.04 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.06 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.04 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.06 0.06 0.06 0.06 0.06 0.05 0.06 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.03 +0 1.21 0.94 0.53 0.13 0.31 0.34 0.26 0.10 2.66 0.37 0.07 0.02 0.09 0.05 0.03 0.01 0.02 0.19 0.03 0.02 0.04 0.06 0.02 0.02 0.04 0.04 0.05 0.03 0.04 0.04 0.01 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.01 0.02 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.07 0.01 0.01 0.02 0.03 0.02 0.02 0.03 0.16 0.06 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.41 0.09 0.04 0.01 0.03 0.03 0.03 0.01 0.04 0.33 0.03 0.01 0.01 0.05 0.02 0.02 0.02 0.09 0.12 0.02 0.02 0.02 0.06 0.02 0.02 0.02 0.11 0.03 0.02 0.02 0.05 0.04 0.03 0.01 0.04 0.09 0.02 0.03 0.03 0.06 0.02 0.02 0.02 0.06 0.03 0.03 0.02 0.03 0.04 0.05 0.03 0.03 0.06 0.03 0.01 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.03 0.02 0.03 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.03 0.02 0.01 0.02 0.03 0.03 0.04 0.03 0.03 0.07 0.02 0.04 0.02 0.12 0.04 0.02 0.02 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.05 0.05 0.05 0.06 0.05 0.06 0.05 0.05 0.07 0.06 0.06 0.07 0.05 0.06 0.06 0.06 0.06 0.04 0.04 0.06 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.06 0.05 0.07 0.06 0.06 0.06 0.06 0.05 0.06 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.04 0.05 0.04 0.04 0.05 0.04 0.05 0.04 0.04 +0 1.14 0.88 0.49 0.15 0.46 0.19 0.10 0.07 2.73 0.66 0.22 0.06 0.19 0.18 0.10 0.04 0.12 0.25 0.06 0.04 0.10 0.11 0.03 0.04 0.08 0.07 0.07 0.06 0.08 0.06 0.04 0.05 0.07 0.04 0.07 0.04 0.06 0.03 0.04 0.05 0.05 0.02 0.02 0.06 0.04 0.01 0.03 0.06 0.04 0.01 0.03 0.08 0.04 0.01 0.04 0.15 0.03 0.01 0.03 0.06 0.05 0.02 0.02 0.04 0.24 0.04 0.05 0.05 0.16 0.03 0.04 0.04 0.33 0.17 0.05 0.03 0.03 0.19 0.03 0.02 0.02 0.23 0.03 0.01 0.01 0.05 0.10 0.03 0.02 0.05 0.17 0.02 0.02 0.02 0.11 0.04 0.03 0.02 0.09 0.05 0.02 0.02 0.04 0.07 0.03 0.02 0.02 0.05 0.02 0.02 0.02 0.03 0.04 0.03 0.01 0.03 0.04 0.02 0.01 0.02 0.04 0.02 0.02 0.01 0.04 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.01 0.02 0.01 0.03 0.02 0.02 0.01 0.04 0.03 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.03 0.03 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.07 0.05 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.04 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.06 0.06 0.04 0.05 0.05 0.04 0.04 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.04 0.05 0.05 0.06 0.05 0.06 0.06 0.06 0.05 0.05 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.04 +1 1.08 0.86 0.46 0.31 2.06 0.21 0.24 0.11 3.28 0.61 0.15 0.07 0.17 0.16 0.06 0.05 0.06 0.21 0.05 0.06 0.08 0.12 0.03 0.05 0.07 0.09 0.07 0.03 0.05 0.05 0.09 0.04 0.04 0.03 0.09 0.04 0.04 0.03 0.09 0.05 0.03 0.02 0.06 0.09 0.03 0.02 0.04 0.09 0.02 0.01 0.02 0.07 0.04 0.02 0.02 0.14 0.04 0.02 0.02 0.05 0.11 0.03 0.02 0.04 0.37 0.04 0.03 0.02 0.08 0.06 0.02 0.02 0.17 0.31 0.05 0.03 0.02 0.10 0.03 0.01 0.03 0.23 0.08 0.03 0.01 0.06 0.11 0.02 0.02 0.04 0.41 0.05 0.02 0.04 0.17 0.04 0.02 0.02 0.10 0.16 0.02 0.03 0.04 0.14 0.03 0.02 0.02 0.15 0.03 0.03 0.02 0.07 0.07 0.02 0.01 0.03 0.13 0.03 0.02 0.02 0.07 0.02 0.02 0.01 0.07 0.06 0.02 0.02 0.02 0.04 0.02 0.01 0.02 0.05 0.02 0.02 0.02 0.06 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.04 0.02 0.02 0.03 0.20 0.05 0.02 0.03 0.02 0.06 0.02 0.02 0.02 0.04 0.01 0.01 0.01 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.10 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.04 0.03 0.04 0.03 0.02 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.06 0.05 0.04 0.05 0.04 0.06 0.03 0.05 0.06 0.05 0.05 0.03 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +1 0.99 0.80 0.51 0.29 1.12 0.27 0.17 0.08 2.48 0.43 0.11 0.04 0.10 0.10 0.05 0.02 0.06 0.18 0.03 0.02 0.06 0.06 0.02 0.02 0.05 0.04 0.05 0.03 0.04 0.03 0.02 0.03 0.04 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.08 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.05 0.28 0.02 0.02 0.02 0.07 0.02 0.02 0.03 0.05 0.22 0.04 0.03 0.02 0.09 0.03 0.02 0.01 0.20 0.03 0.01 0.01 0.03 0.04 0.02 0.01 0.02 0.16 0.01 0.01 0.02 0.06 0.02 0.02 0.02 0.05 0.08 0.02 0.01 0.02 0.10 0.02 0.03 0.02 0.16 0.07 0.03 0.02 0.04 0.04 0.03 0.02 0.03 0.11 0.03 0.02 0.02 0.06 0.02 0.03 0.01 0.03 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.07 0.01 0.02 0.01 0.02 0.03 0.03 0.03 0.02 0.12 0.03 0.02 0.02 0.06 0.02 0.02 0.01 0.12 0.06 0.01 0.01 0.02 0.03 0.02 0.02 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.04 0.04 0.05 0.03 0.06 0.04 0.05 0.03 0.03 0.04 0.02 0.03 0.03 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.05 0.04 0.04 0.05 0.06 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.06 0.05 0.04 0.04 0.02 0.03 0.02 0.02 0.04 0.05 0.06 0.07 0.07 0.06 0.07 0.07 0.06 0.06 0.06 0.06 0.06 0.07 0.06 0.05 0.05 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.03 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 +1 1.49 1.14 0.62 0.22 1.17 0.26 0.24 0.10 2.78 0.55 0.17 0.06 0.17 0.18 0.08 0.05 0.12 0.26 0.04 0.03 0.08 0.10 0.03 0.04 0.08 0.07 0.06 0.03 0.06 0.05 0.05 0.04 0.06 0.04 0.07 0.04 0.05 0.03 0.03 0.06 0.04 0.02 0.03 0.08 0.04 0.02 0.04 0.06 0.03 0.01 0.02 0.05 0.05 0.02 0.03 0.10 0.05 0.01 0.03 0.06 0.05 0.01 0.03 0.05 0.36 0.05 0.03 0.03 0.08 0.06 0.02 0.04 0.44 0.35 0.04 0.04 0.02 0.11 0.06 0.03 0.03 0.31 0.08 0.02 0.01 0.07 0.12 0.04 0.02 0.06 0.44 0.07 0.02 0.04 0.17 0.10 0.04 0.02 0.10 0.24 0.04 0.02 0.04 0.24 0.11 0.03 0.03 0.23 0.13 0.05 0.03 0.13 0.15 0.05 0.02 0.04 0.15 0.05 0.03 0.02 0.08 0.05 0.03 0.02 0.04 0.06 0.02 0.02 0.02 0.04 0.03 0.02 0.03 0.03 0.03 0.02 0.01 0.05 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.14 0.04 0.03 0.03 0.02 0.05 0.03 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.04 0.04 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.05 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.04 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.02 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.05 0.04 0.05 0.05 0.04 0.05 0.05 0.06 0.05 0.06 0.05 0.05 0.04 0.04 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.06 0.05 0.07 0.06 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.04 0.04 0.03 0.04 0.05 0.03 0.02 0.02 0.02 0.01 0.02 0.04 0.06 0.05 0.06 0.06 0.05 0.07 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +1 1.22 0.94 0.52 0.21 0.83 0.21 0.12 0.07 2.14 0.56 0.22 0.06 0.17 0.18 0.10 0.04 0.12 0.23 0.06 0.04 0.09 0.09 0.04 0.04 0.08 0.06 0.05 0.05 0.08 0.06 0.02 0.05 0.07 0.04 0.02 0.04 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.06 0.04 0.01 0.03 0.04 0.03 0.01 0.04 0.03 0.04 0.01 0.03 0.08 0.02 0.01 0.03 0.04 0.01 0.03 0.02 0.37 0.14 0.02 0.05 0.04 0.07 0.03 0.05 0.09 0.62 0.06 0.06 0.05 0.05 0.06 0.06 0.04 0.05 0.49 0.08 0.03 0.03 0.14 0.05 0.04 0.03 0.28 0.26 0.02 0.02 0.03 0.05 0.02 0.02 0.04 0.10 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.02 0.04 0.03 0.10 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.01 0.04 0.02 0.01 0.01 0.02 0.05 0.02 0.01 0.02 0.04 0.01 0.01 0.02 0.05 0.02 0.02 0.02 0.03 0.05 0.02 0.02 0.01 0.03 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.05 0.01 0.01 0.01 0.04 0.02 0.01 0.02 0.03 0.04 0.01 0.01 0.02 0.03 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.03 0.04 0.01 0.02 0.02 0.05 0.01 0.01 0.02 0.09 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.05 0.05 0.06 0.06 0.05 0.06 0.04 0.05 0.05 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.02 0.03 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 +1 1.30 1.00 0.53 0.21 1.24 0.25 0.25 0.10 2.64 0.35 0.04 0.02 0.05 0.06 0.03 0.02 0.04 0.16 0.02 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.05 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.03 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.08 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.19 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.28 0.18 0.04 0.01 0.01 0.04 0.03 0.01 0.02 0.16 0.01 0.01 0.01 0.02 0.03 0.02 0.01 0.01 0.12 0.02 0.01 0.02 0.05 0.02 0.01 0.01 0.06 0.07 0.02 0.01 0.02 0.04 0.03 0.02 0.04 0.13 0.04 0.03 0.01 0.02 0.02 0.03 0.01 0.02 0.09 0.03 0.02 0.02 0.04 0.04 0.04 0.02 0.04 0.05 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.07 0.05 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.06 0.01 0.00 0.01 0.02 0.02 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.02 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.06 0.04 0.05 0.05 0.06 0.07 0.05 0.07 0.06 0.05 0.06 0.06 0.05 0.05 0.05 0.04 0.05 0.06 0.06 0.05 0.05 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 +1 1.21 0.92 0.50 0.20 2.10 0.52 0.32 0.11 2.30 0.28 0.07 0.02 0.18 0.10 0.05 0.02 0.04 0.16 0.04 0.02 0.06 0.06 0.02 0.02 0.05 0.04 0.04 0.03 0.05 0.04 0.02 0.03 0.05 0.03 0.02 0.03 0.04 0.02 0.02 0.03 0.03 0.02 0.01 0.04 0.03 0.01 0.02 0.04 0.02 0.01 0.02 0.03 0.03 0.01 0.03 0.08 0.02 0.01 0.02 0.04 0.02 0.02 0.03 0.06 0.27 0.03 0.02 0.03 0.05 0.02 0.02 0.04 0.59 0.13 0.02 0.01 0.03 0.06 0.02 0.02 0.05 0.28 0.04 0.03 0.01 0.04 0.03 0.02 0.01 0.05 0.10 0.03 0.01 0.02 0.04 0.02 0.02 0.04 0.16 0.06 0.02 0.02 0.02 0.06 0.04 0.02 0.03 0.14 0.03 0.03 0.02 0.06 0.04 0.04 0.02 0.08 0.14 0.05 0.02 0.03 0.05 0.04 0.04 0.02 0.05 0.05 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.03 0.05 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.04 0.02 0.02 0.05 0.33 0.05 0.03 0.04 0.04 0.02 0.02 0.02 0.03 0.03 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.06 0.05 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.16 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.03 0.03 0.04 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.04 0.03 0.03 0.03 0.06 0.04 0.04 0.05 0.07 0.06 0.04 0.04 0.06 0.05 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.03 0.04 0.04 0.06 0.04 0.03 0.03 0.04 0.05 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.05 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.03 0.03 0.02 0.01 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 +1 1.22 0.97 0.56 0.20 0.57 0.19 0.12 0.06 2.21 0.55 0.19 0.06 0.17 0.21 0.09 0.04 0.12 0.20 0.05 0.04 0.09 0.10 0.03 0.04 0.08 0.07 0.05 0.05 0.08 0.06 0.03 0.04 0.06 0.04 0.03 0.05 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.04 0.04 0.01 0.03 0.05 0.04 0.01 0.03 0.12 0.02 0.01 0.03 0.04 0.02 0.02 0.03 0.26 0.25 0.02 0.04 0.03 0.10 0.04 0.06 0.06 0.32 0.05 0.01 0.01 0.06 0.14 0.02 0.01 0.03 0.24 0.03 0.01 0.02 0.10 0.03 0.02 0.01 0.07 0.13 0.02 0.01 0.03 0.09 0.03 0.02 0.02 0.16 0.04 0.02 0.02 0.05 0.05 0.05 0.02 0.02 0.15 0.02 0.03 0.01 0.05 0.02 0.02 0.01 0.03 0.06 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.04 0.02 0.02 0.05 0.04 0.03 0.02 0.03 0.02 0.05 0.03 0.02 0.03 0.07 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.07 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.07 0.02 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.07 0.02 0.02 0.01 0.03 0.01 0.01 0.01 0.07 0.05 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.03 0.02 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.02 0.03 0.04 0.04 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.05 0.06 0.06 0.05 0.05 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +1 1.17 0.92 0.53 0.20 0.83 0.27 0.14 0.06 2.26 0.59 0.21 0.06 0.19 0.18 0.09 0.04 0.12 0.22 0.06 0.04 0.10 0.10 0.03 0.05 0.09 0.07 0.05 0.05 0.08 0.06 0.02 0.05 0.07 0.04 0.04 0.04 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.05 0.04 0.01 0.03 0.04 0.03 0.01 0.03 0.08 0.02 0.01 0.03 0.04 0.02 0.04 0.03 0.04 0.33 0.04 0.04 0.02 0.04 0.05 0.03 0.03 0.51 0.22 0.03 0.03 0.02 0.04 0.03 0.01 0.04 0.23 0.04 0.03 0.02 0.04 0.04 0.03 0.02 0.04 0.23 0.03 0.01 0.02 0.06 0.02 0.02 0.02 0.11 0.07 0.02 0.03 0.02 0.04 0.06 0.03 0.04 0.14 0.03 0.03 0.01 0.03 0.04 0.05 0.02 0.04 0.11 0.03 0.02 0.02 0.02 0.04 0.02 0.02 0.04 0.04 0.01 0.02 0.03 0.01 0.02 0.02 0.04 0.03 0.03 0.03 0.03 0.05 0.02 0.04 0.02 0.05 0.04 0.06 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.01 0.01 0.03 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.04 0.04 0.05 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.03 0.02 0.01 0.01 0.01 0.02 0.02 0.03 0.04 0.04 0.05 0.05 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 +1 1.30 1.02 0.56 0.19 1.10 0.18 0.18 0.07 1.61 0.34 0.13 0.04 0.12 0.15 0.06 0.03 0.07 0.16 0.04 0.04 0.07 0.07 0.03 0.03 0.06 0.06 0.05 0.03 0.05 0.04 0.02 0.03 0.05 0.03 0.03 0.04 0.04 0.03 0.02 0.04 0.04 0.02 0.02 0.05 0.03 0.02 0.02 0.04 0.03 0.01 0.02 0.03 0.03 0.01 0.02 0.06 0.03 0.01 0.03 0.04 0.03 0.02 0.03 0.07 0.22 0.02 0.03 0.03 0.03 0.03 0.04 0.05 0.26 0.08 0.02 0.01 0.01 0.05 0.04 0.02 0.03 0.40 0.07 0.01 0.01 0.04 0.05 0.02 0.02 0.05 0.28 0.02 0.01 0.02 0.05 0.02 0.01 0.01 0.06 0.04 0.02 0.01 0.02 0.05 0.05 0.02 0.05 0.16 0.06 0.04 0.02 0.06 0.06 0.08 0.02 0.08 0.14 0.04 0.03 0.04 0.05 0.04 0.06 0.02 0.05 0.05 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.01 0.02 0.01 0.04 0.02 0.03 0.03 0.03 0.02 0.05 0.05 0.02 0.04 0.02 0.05 0.02 0.03 0.03 0.16 0.03 0.04 0.03 0.03 0.04 0.05 0.03 0.02 0.05 0.02 0.03 0.02 0.04 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.08 0.02 0.01 0.03 0.02 0.02 0.02 0.02 0.10 0.05 0.01 0.02 0.02 0.03 0.01 0.01 0.02 0.08 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.05 0.03 0.03 0.02 0.05 0.02 0.02 0.03 0.05 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.04 0.03 0.03 0.04 0.05 0.04 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.04 0.03 0.02 0.03 0.04 0.04 0.03 0.02 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.04 0.07 0.04 0.05 0.05 0.07 0.07 0.06 0.06 0.09 0.10 0.07 0.07 0.10 0.13 0.07 0.08 0.08 0.13 0.10 0.07 0.07 0.11 0.10 0.06 0.06 0.06 0.09 0.07 0.05 0.06 0.09 0.07 0.05 0.05 0.06 0.06 0.04 0.05 0.06 0.07 0.04 0.04 0.04 0.06 0.04 0.04 0.04 0.05 0.05 0.03 0.03 0.05 0.05 0.03 0.03 0.04 0.06 0.03 0.03 0.03 0.05 0.04 0.02 0.03 0.05 0.05 0.02 0.02 0.03 0.06 0.02 0.02 0.03 0.05 0.03 0.02 0.02 0.04 0.04 0.02 0.02 0.04 0.05 0.02 0.02 0.02 0.06 0.03 0.02 0.02 0.05 0.04 0.02 0.02 0.04 0.04 0.02 0.02 0.03 0.06 0.02 0.02 0.02 0.06 0.04 0.02 0.02 0.04 0.04 0.02 0.01 0.03 0.04 0.02 0.01 0.02 0.04 0.02 0.01 0.01 0.03 0.03 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.02 0.01 0.02 0.03 0.03 0.01 0.02 0.03 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.02 0.01 0.02 0.04 0.03 0.01 0.01 0.03 0.04 0.01 0.01 0.02 0.05 0.02 0.01 0.02 0.05 0.03 0.01 0.02 0.03 0.04 0.01 0.01 0.03 0.05 0.02 0.01 0.02 0.05 0.03 0.01 0.01 0.03 0.04 0.01 0.01 0.03 0.04 0.02 0.01 0.02 0.04 0.03 0.01 0.01 0.03 0.03 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.04 0.03 0.01 0.02 0.03 0.03 0.02 0.02 0.03 0.04 0.02 0.02 0.02 0.04 0.03 0.02 0.02 0.04 0.04 0.02 0.02 0.04 0.04 0.02 0.02 0.03 0.05 0.03 0.02 0.02 0.04 0.04 0.02 0.02 0.04 0.05 0.03 0.02 0.03 0.05 0.03 0.02 0.03 0.04 0.04 0.02 0.02 0.03 0.05 0.03 0.02 0.03 0.05 0.03 0.02 0.02 0.04 0.04 0.02 0.02 0.03 0.04 0.03 0.02 0.03 0.05 0.03 0.03 0.03 0.05 0.04 0.03 0.03 0.04 0.05 0.04 0.04 0.05 0.06 0.05 0.04 0.04 0.06 0.06 0.05 0.05 0.08 0.07 0.05 0.04 0.06 0.06 0.04 0.04 0.05 0.06 0.04 0.03 0.03 0.06 0.05 0.03 0.05 0.05 0.05 0.03 0.03 0.06 0.05 0.04 0.04 0.05 0.06 0.04 0.03 0.05 0.07 0.06 0.03 0.04 0.06 0.06 0.04 0.03 0.06 0.07 0.05 0.04 0.05 0.07 0.05 0.03 0.04 0.06 0.06 0.05 0.05 0.07 0.08 0.05 0.04 0.05 0.08 0.07 0.05 0.05 0.06 0.08 0.05 0.05 0.06 0.09 0.06 0.04 0.06 0.09 0.06 0.04 0.06 0.08 0.08 0.05 0.05 0.07 0.07 0.06 0.06 0.08 0.09 0.06 0.07 0.07 0.08 0.07 0.06 0.07 0.09 0.09 0.07 0.07 0.09 0.10 0.09 0.07 0.07 +1 1.13 0.85 0.51 0.34 1.63 0.29 0.12 0.06 2.87 0.70 0.23 0.07 0.24 0.21 0.10 0.05 0.15 0.23 0.05 0.04 0.10 0.10 0.03 0.04 0.09 0.07 0.06 0.05 0.08 0.06 0.03 0.05 0.07 0.04 0.03 0.06 0.06 0.04 0.03 0.05 0.05 0.02 0.02 0.05 0.04 0.02 0.03 0.05 0.04 0.01 0.03 0.04 0.03 0.01 0.03 0.08 0.03 0.01 0.03 0.05 0.02 0.02 0.04 0.08 0.33 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.35 0.11 0.06 0.04 0.02 0.08 0.04 0.03 0.03 0.23 0.06 0.02 0.02 0.07 0.08 0.02 0.03 0.05 0.40 0.04 0.03 0.04 0.05 0.02 0.03 0.04 0.06 0.04 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.10 0.05 0.03 0.02 0.03 0.03 0.04 0.02 0.02 0.05 0.02 0.01 0.02 0.03 0.03 0.05 0.04 0.06 0.07 0.03 0.02 0.05 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.03 0.02 0.01 0.01 0.06 0.01 0.01 0.02 0.03 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.02 0.01 0.02 0.05 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.05 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.05 0.04 0.01 0.02 0.03 0.02 0.02 0.01 0.02 0.09 0.03 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.04 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.04 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.07 0.05 0.04 0.05 0.06 0.06 0.04 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.04 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.06 0.05 0.05 0.07 0.07 0.06 0.03 0.03 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.04 0.04 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.04 0.04 0.04 0.07 0.07 0.06 0.07 0.07 0.07 0.08 0.09 0.09 0.10 0.08 0.09 0.09 0.08 0.08 0.07 0.07 0.07 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.04 0.05 0.04 0.05 0.06 0.06 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 +1 1.69 1.26 0.59 0.53 3.68 0.25 0.30 0.15 2.32 0.28 0.07 0.04 0.09 0.12 0.05 0.02 0.03 0.16 0.04 0.02 0.04 0.06 0.03 0.02 0.04 0.04 0.04 0.02 0.04 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.01 0.02 0.03 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.05 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.03 0.25 0.04 0.03 0.01 0.02 0.03 0.02 0.01 0.22 0.30 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.18 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.07 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.05 0.06 0.02 0.01 0.01 0.03 0.03 0.01 0.02 0.08 0.03 0.03 0.01 0.02 0.02 0.02 0.01 0.03 0.12 0.02 0.03 0.02 0.03 0.02 0.02 0.01 0.04 0.03 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.06 0.04 0.06 0.02 0.04 0.02 0.04 0.02 0.07 0.04 0.03 0.03 0.04 0.10 0.02 0.03 0.02 0.08 0.02 0.01 0.01 0.04 0.01 0.01 0.02 0.03 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.06 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.08 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.03 0.05 0.05 0.03 0.04 0.02 0.03 0.03 0.02 0.03 0.06 0.04 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.06 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.04 0.05 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.05 0.06 0.05 0.04 0.04 0.04 0.03 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.04 0.04 0.04 0.06 0.04 0.05 0.04 0.05 0.04 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 +1 1.10 0.85 0.50 0.16 1.92 0.32 0.15 0.09 3.03 0.70 0.23 0.06 0.23 0.30 0.11 0.05 0.15 0.24 0.06 0.04 0.09 0.10 0.04 0.04 0.08 0.07 0.06 0.05 0.08 0.07 0.03 0.04 0.06 0.04 0.05 0.06 0.06 0.03 0.02 0.05 0.05 0.02 0.03 0.05 0.04 0.02 0.03 0.04 0.04 0.01 0.02 0.05 0.03 0.01 0.02 0.09 0.03 0.01 0.03 0.04 0.02 0.02 0.03 0.05 0.22 0.02 0.03 0.03 0.03 0.03 0.02 0.04 0.61 0.13 0.06 0.02 0.02 0.07 0.04 0.02 0.04 0.21 0.03 0.01 0.02 0.07 0.04 0.02 0.02 0.06 0.10 0.03 0.02 0.03 0.07 0.02 0.02 0.03 0.13 0.05 0.02 0.02 0.05 0.03 0.04 0.02 0.03 0.19 0.04 0.03 0.02 0.05 0.04 0.04 0.02 0.09 0.09 0.03 0.03 0.05 0.05 0.04 0.04 0.06 0.08 0.08 0.03 0.03 0.06 0.03 0.03 0.02 0.06 0.03 0.03 0.03 0.10 0.05 0.02 0.04 0.02 0.05 0.02 0.03 0.02 0.09 0.02 0.02 0.03 0.11 0.06 0.03 0.03 0.02 0.16 0.03 0.03 0.08 0.20 0.03 0.03 0.02 0.02 0.04 0.01 0.02 0.04 0.09 0.01 0.02 0.02 0.04 0.01 0.01 0.02 0.04 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.07 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.05 0.02 0.02 0.02 0.01 0.03 0.02 0.02 0.02 0.07 0.02 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.04 0.03 0.04 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.04 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.04 0.03 0.04 0.03 0.03 0.04 0.06 0.04 0.03 0.04 0.04 0.04 0.04 0.05 0.03 0.04 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.04 0.04 0.04 0.04 0.05 0.06 0.05 0.05 0.05 0.09 0.05 0.05 0.04 0.06 0.04 0.04 0.04 0.04 0.05 0.05 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.04 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 +1 1.26 1.03 0.60 0.25 2.68 0.44 0.27 0.11 2.87 0.41 0.06 0.04 0.19 0.20 0.04 0.04 0.07 0.18 0.02 0.03 0.05 0.09 0.02 0.02 0.04 0.07 0.09 0.03 0.04 0.05 0.09 0.02 0.03 0.03 0.11 0.03 0.03 0.02 0.05 0.05 0.03 0.02 0.04 0.06 0.02 0.02 0.04 0.06 0.02 0.01 0.03 0.08 0.02 0.01 0.02 0.07 0.06 0.01 0.02 0.05 0.06 0.02 0.03 0.07 0.25 0.03 0.02 0.03 0.20 0.06 0.02 0.03 0.36 0.11 0.02 0.02 0.03 0.15 0.03 0.02 0.03 0.20 0.03 0.02 0.02 0.05 0.05 0.03 0.01 0.06 0.11 0.02 0.01 0.02 0.19 0.03 0.02 0.02 0.09 0.08 0.02 0.03 0.03 0.06 0.03 0.02 0.02 0.07 0.02 0.02 0.02 0.06 0.03 0.03 0.02 0.05 0.05 0.04 0.02 0.03 0.05 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.05 0.06 0.02 0.02 0.02 0.06 0.02 0.02 0.02 0.07 0.02 0.01 0.02 0.03 0.05 0.02 0.02 0.01 0.08 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.06 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 +1 1.03 0.82 0.51 0.38 1.98 0.34 0.13 0.05 2.40 0.61 0.20 0.06 0.26 0.20 0.09 0.04 0.12 0.23 0.05 0.05 0.11 0.10 0.03 0.05 0.09 0.07 0.06 0.06 0.08 0.05 0.02 0.05 0.07 0.04 0.05 0.04 0.06 0.03 0.02 0.05 0.05 0.02 0.02 0.05 0.05 0.02 0.03 0.05 0.04 0.01 0.03 0.05 0.03 0.01 0.04 0.08 0.03 0.01 0.04 0.05 0.02 0.04 0.05 0.08 0.28 0.03 0.04 0.04 0.04 0.05 0.05 0.05 0.47 0.28 0.04 0.01 0.01 0.05 0.03 0.01 0.05 0.61 0.06 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.15 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.07 0.05 0.02 0.02 0.01 0.03 0.03 0.03 0.03 0.13 0.06 0.03 0.03 0.06 0.03 0.05 0.02 0.07 0.10 0.04 0.04 0.04 0.04 0.03 0.04 0.03 0.05 0.05 0.04 0.02 0.05 0.02 0.04 0.03 0.09 0.06 0.04 0.05 0.03 0.05 0.02 0.03 0.05 0.05 0.03 0.04 0.02 0.04 0.03 0.02 0.02 0.02 0.06 0.01 0.02 0.01 0.07 0.01 0.01 0.01 0.03 0.03 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04 0.04 0.04 0.05 0.06 0.05 0.05 0.05 0.05 0.06 0.06 0.06 0.05 0.06 0.05 0.05 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 +1 1.20 0.91 0.53 0.20 1.63 0.22 0.14 0.10 2.30 0.46 0.15 0.04 0.16 0.17 0.07 0.03 0.07 0.24 0.05 0.03 0.07 0.10 0.03 0.04 0.06 0.11 0.08 0.03 0.05 0.06 0.08 0.03 0.04 0.03 0.11 0.04 0.04 0.03 0.08 0.06 0.04 0.02 0.06 0.09 0.03 0.02 0.06 0.10 0.03 0.01 0.02 0.09 0.04 0.01 0.02 0.17 0.06 0.02 0.03 0.09 0.13 0.04 0.02 0.11 0.50 0.03 0.03 0.03 0.09 0.06 0.02 0.05 0.51 0.21 0.04 0.03 0.04 0.16 0.05 0.03 0.03 0.31 0.07 0.02 0.02 0.31 0.19 0.05 0.03 0.10 0.57 0.05 0.02 0.03 0.16 0.05 0.02 0.03 0.16 0.07 0.03 0.02 0.05 0.15 0.04 0.03 0.03 0.12 0.03 0.02 0.01 0.08 0.06 0.03 0.01 0.07 0.07 0.02 0.01 0.02 0.05 0.02 0.01 0.02 0.05 0.02 0.01 0.01 0.04 0.02 0.01 0.02 0.02 0.03 0.01 0.02 0.02 0.04 0.01 0.01 0.01 0.04 0.02 0.02 0.01 0.03 0.02 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.07 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.06 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.04 0.04 0.04 0.04 0.05 0.05 0.04 0.05 0.05 0.05 0.04 0.04 0.06 0.05 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.04 0.04 0.03 0.05 0.04 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.03 0.04 0.04 0.04 0.04 0.04 0.05 0.04 +1 1.19 0.89 0.45 0.15 1.60 0.42 0.22 0.08 2.59 0.67 0.24 0.07 0.30 0.21 0.10 0.05 0.12 0.25 0.07 0.05 0.12 0.11 0.04 0.05 0.10 0.08 0.07 0.06 0.09 0.07 0.02 0.06 0.08 0.05 0.04 0.05 0.06 0.04 0.02 0.06 0.06 0.03 0.02 0.06 0.05 0.02 0.03 0.05 0.04 0.01 0.03 0.05 0.03 0.01 0.04 0.08 0.02 0.01 0.03 0.03 0.02 0.02 0.02 0.07 0.31 0.02 0.04 0.04 0.02 0.03 0.03 0.04 0.32 0.09 0.07 0.04 0.02 0.04 0.04 0.02 0.02 0.27 0.06 0.02 0.02 0.06 0.03 0.02 0.02 0.04 0.11 0.01 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.08 0.04 0.03 0.02 0.03 0.03 0.03 0.02 0.08 0.07 0.04 0.02 0.03 0.04 0.03 0.05 0.05 0.09 0.06 0.04 0.03 0.05 0.03 0.03 0.03 0.09 0.03 0.03 0.03 0.07 0.06 0.02 0.03 0.03 0.06 0.03 0.05 0.04 0.09 0.02 0.02 0.02 0.06 0.07 0.02 0.01 0.01 0.04 0.02 0.01 0.03 0.14 0.03 0.01 0.02 0.02 0.06 0.01 0.02 0.03 0.07 0.02 0.02 0.03 0.02 0.01 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.05 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.03 0.01 0.01 0.02 0.03 0.02 0.01 0.01 0.05 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.03 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.03 0.03 0.04 0.03 0.04 0.03 0.04 0.05 0.03 0.05 0.04 0.06 0.05 0.04 0.05 0.07 0.06 0.04 0.07 0.07 0.07 0.05 0.06 0.06 0.06 0.05 0.05 0.06 0.06 0.04 0.04 0.04 0.06 0.05 0.04 0.04 0.04 0.04 0.04 0.02 0.04 0.04 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.04 +1 1.25 0.94 0.50 0.26 1.66 0.20 0.11 0.12 3.12 0.71 0.25 0.06 0.19 0.24 0.11 0.05 0.14 0.24 0.06 0.03 0.09 0.14 0.03 0.04 0.08 0.08 0.07 0.05 0.08 0.07 0.07 0.05 0.07 0.05 0.09 0.05 0.06 0.04 0.07 0.05 0.05 0.02 0.06 0.07 0.04 0.02 0.07 0.09 0.04 0.02 0.03 0.14 0.05 0.02 0.04 0.19 0.04 0.02 0.04 0.19 0.14 0.02 0.02 0.06 0.52 0.05 0.03 0.05 0.38 0.08 0.06 0.07 0.26 0.42 0.03 0.02 0.06 0.29 0.05 0.02 0.03 0.20 0.05 0.01 0.03 0.10 0.16 0.02 0.02 0.04 0.17 0.03 0.02 0.04 0.15 0.05 0.03 0.03 0.08 0.09 0.03 0.03 0.08 0.12 0.04 0.03 0.05 0.15 0.06 0.04 0.04 0.10 0.08 0.03 0.02 0.10 0.10 0.03 0.02 0.06 0.09 0.04 0.02 0.03 0.10 0.05 0.02 0.02 0.07 0.04 0.02 0.02 0.05 0.09 0.02 0.02 0.03 0.11 0.03 0.03 0.03 0.12 0.06 0.02 0.02 0.05 0.14 0.02 0.03 0.03 0.14 0.03 0.02 0.03 0.14 0.05 0.01 0.02 0.05 0.11 0.01 0.02 0.03 0.10 0.02 0.01 0.03 0.05 0.03 0.02 0.02 0.03 0.06 0.02 0.02 0.04 0.06 0.03 0.02 0.04 0.06 0.04 0.02 0.03 0.05 0.05 0.02 0.02 0.04 0.06 0.02 0.02 0.03 0.05 0.03 0.01 0.02 0.04 0.04 0.01 0.02 0.05 0.04 0.02 0.02 0.03 0.04 0.02 0.01 0.02 0.06 0.02 0.02 0.02 0.04 0.02 0.02 0.01 0.02 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.06 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.04 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.04 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.03 0.04 0.06 0.04 0.04 0.04 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.00 0.01 0.01 0.02 0.03 0.03 0.04 0.04 0.05 0.04 0.05 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.04 0.05 0.04 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.00 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 +1 0.82 0.67 0.36 0.19 0.82 0.24 0.22 0.10 2.14 0.31 0.08 0.03 0.07 0.03 0.02 0.01 0.03 0.19 0.03 0.01 0.02 0.03 0.02 0.01 0.02 0.03 0.06 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.00 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.05 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.20 0.08 0.02 0.01 0.01 0.03 0.02 0.01 0.05 0.51 0.05 0.01 0.02 0.03 0.02 0.02 0.03 0.06 0.24 0.01 0.01 0.01 0.03 0.02 0.01 0.01 0.11 0.03 0.01 0.01 0.01 0.03 0.01 0.00 0.02 0.13 0.02 0.01 0.01 0.02 0.02 0.02 0.01 0.04 0.07 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.08 0.04 0.03 0.02 0.03 0.03 0.08 0.04 0.05 0.13 0.04 0.03 0.08 0.03 0.03 0.03 0.02 0.07 0.03 0.02 0.02 0.06 0.02 0.01 0.03 0.05 0.03 0.03 0.01 0.02 0.05 0.01 0.02 0.01 0.05 0.01 0.01 0.01 0.09 0.03 0.01 0.01 0.02 0.05 0.01 0.02 0.01 0.06 0.02 0.02 0.02 0.05 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.08 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.04 0.03 0.02 0.01 0.01 0.03 0.01 0.01 0.02 0.06 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.04 0.05 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.05 0.04 0.04 0.03 0.03 0.03 0.03 0.05 0.04 0.04 0.04 0.03 0.03 0.03 0.02 0.02 0.02 0.04 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.04 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.02 0.04 0.03 0.04 0.04 0.04 0.05 0.05 0.04 0.04 0.04 0.05 0.07 0.05 0.06 0.06 0.05 0.05 0.04 0.05 0.05 0.04 0.03 0.03 0.02 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.03 0.03 0.04 0.04 0.04 0.03 0.04 0.06 0.05 0.04 0.04 0.03 0.03 0.02 0.03 0.04 0.03 0.03 0.03 0.04 0.04 0.05 0.05 0.05 0.05 0.06 0.05 0.07 0.07 0.08 0.06 0.08 0.09 0.09 0.08 0.08 0.08 0.11 0.09 0.08 0.07 0.06 0.07 0.07 0.07 0.05 0.06 0.07 0.05 0.05 0.04 0.05 0.05 0.04 0.04 0.05 0.04 0.04 0.03 0.04 0.03 0.04 0.04 0.03 0.04 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.04 0.04 0.03 0.03 +1 0.65 0.50 0.27 0.16 0.84 0.22 0.22 0.11 2.70 0.44 0.12 0.02 0.07 0.04 0.01 0.02 0.03 0.17 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.06 0.01 0.01 0.01 0.01 0.01 0.00 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.06 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.26 0.06 0.01 0.01 0.02 0.02 0.01 0.02 0.06 0.38 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.15 0.02 0.01 0.01 0.03 0.02 0.01 0.01 0.04 0.02 0.01 0.01 0.01 0.03 0.02 0.01 0.02 0.14 0.02 0.01 0.01 0.02 0.03 0.02 0.01 0.05 0.08 0.02 0.01 0.02 0.04 0.02 0.02 0.02 0.08 0.05 0.03 0.02 0.05 0.06 0.09 0.03 0.09 0.13 0.06 0.03 0.06 0.04 0.03 0.03 0.02 0.04 0.03 0.02 0.02 0.07 0.02 0.01 0.02 0.03 0.02 0.02 0.01 0.02 0.04 0.01 0.01 0.01 0.03 0.01 0.01 0.02 0.15 0.03 0.01 0.01 0.02 0.03 0.02 0.02 0.01 0.05 0.01 0.02 0.02 0.04 0.02 0.02 0.02 0.01 0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.03 0.04 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.12 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.03 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.04 0.03 0.03 0.03 0.03 0.03 0.04 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.01 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.03 0.02 0.04 0.02 0.04 0.03 0.03 0.03 0.03 0.04 0.05 0.04 0.04 0.06 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.04 0.03 0.03 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.03 0.02 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.04 0.05 0.05 0.05 0.05 0.05 0.06 0.05 0.06 0.06 0.06 0.07 0.07 0.06 0.07 0.07 0.07 0.08 0.07 0.06 0.08 0.08 0.07 0.07 0.07 0.08 0.08 0.09 0.08 0.08 0.08 0.07 0.08 0.08 0.08 0.09 0.06 0.07 0.09 0.08 0.07 0.07 0.07 0.08 0.07 0.07 0.08 0.08 0.06 0.06 0.05 0.05 0.06 0.05 0.06 0.06 0.06 0.05 0.05 0.05 0.05 0.05 0.05 0.06 0.05 0.05 0.05 0.05 0.04 0.04 0.04 0.04 0.04 0.03 0.03 0.04 0.04 0.03 0.03 0.03 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.01 0.01 0.02 0.01 0.01 0.01 0.01 0.02 0.01 0.02 0.02 0.01 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.03 0.02 0.02 0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 0.03 0.02 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.02 0.03 diff --git a/data/L30fft150.out b/data/L30fft150.out new file mode 100644 index 0000000..c8b414e --- /dev/null +++ b/data/L30fft150.out @@ -0,0 +1,54 @@ +53 150 +0 14.62 21.53 1.97 0.84 0.52 0.51 0.42 0.30 0.53 2.13 2.82 0.89 1.55 1.50 0.91 0.96 0.93 1.47 1.68 0.94 1.25 0.59 1.00 0.53 0.84 0.45 0.39 0.31 0.31 0.33 0.49 0.32 0.65 0.43 0.38 0.22 0.25 0.30 0.37 0.50 0.55 0.57 0.52 0.43 0.35 0.28 0.26 0.23 0.25 0.27 0.24 0.28 0.30 0.45 0.41 0.50 0.45 0.52 0.60 0.63 0.59 0.74 0.79 0.86 0.83 1.01 1.24 1.53 1.67 1.64 1.37 1.38 1.11 1.01 0.91 0.90 0.99 0.93 0.88 0.87 1.28 1.10 0.44 0.93 0.81 1.58 1.92 2.28 2.38 2.83 3.13 3.56 2.57 2.06 1.41 1.04 0.98 0.77 0.72 0.70 0.59 0.58 0.56 0.53 0.53 0.49 0.48 0.45 0.38 0.37 0.36 0.32 0.31 0.29 0.30 0.30 0.32 0.36 0.40 0.41 0.42 0.40 0.49 0.60 0.62 0.69 0.73 1.02 1.12 1.19 1.11 1.05 1.05 1.15 1.19 1.18 1.23 1.13 1.11 1.22 1.45 1.77 2.22 2.64 2.79 2.85 2.54 2.58 2.41 2.31 +0 11.48 15.18 2.06 1.53 0.85 0.78 0.70 0.63 1.07 2.28 4.34 1.27 2.82 1.90 2.01 2.08 1.27 1.39 1.02 0.58 0.65 0.51 0.88 0.44 0.63 0.78 0.57 0.45 0.38 0.50 0.66 0.48 0.85 0.57 0.43 0.27 0.28 0.26 0.22 0.28 0.36 0.74 0.55 0.41 0.36 0.31 0.27 0.29 0.26 0.31 0.28 0.33 0.37 0.41 0.37 0.47 0.52 0.49 0.53 0.56 0.64 0.71 0.83 0.93 0.95 1.08 1.10 1.25 1.32 1.33 1.17 1.16 1.09 0.83 0.68 0.83 0.83 0.90 0.96 1.08 1.59 1.43 0.41 0.49 0.81 1.36 1.83 2.54 2.65 2.19 2.27 1.98 1.69 1.31 1.18 0.93 0.79 0.69 0.61 0.56 0.55 0.54 0.49 0.44 0.44 0.40 0.40 0.39 0.36 0.39 0.34 0.32 0.32 0.32 0.32 0.30 0.32 0.32 0.31 0.31 0.32 0.30 0.29 0.32 0.39 0.40 0.47 0.57 0.72 0.86 1.04 1.19 1.25 1.14 1.19 1.16 1.00 0.97 0.97 0.85 0.88 1.05 1.13 1.44 1.82 1.94 1.77 1.76 1.53 1.30 +0 13.71 16.05 1.97 0.89 0.62 0.50 0.51 0.40 0.85 2.33 4.06 1.28 2.85 2.17 1.07 1.43 1.13 1.65 1.19 0.52 1.23 1.50 1.62 0.70 0.56 0.33 0.31 0.29 0.31 0.38 0.70 0.37 0.73 0.60 0.30 0.18 0.20 0.23 0.24 0.30 0.26 0.27 0.34 0.36 0.55 0.31 0.28 0.29 0.26 0.23 0.21 0.24 0.27 0.26 0.33 0.27 0.28 0.27 0.33 0.33 0.36 0.49 0.54 0.63 0.85 1.10 1.05 0.88 1.13 0.99 0.82 0.80 0.69 0.58 0.57 0.59 0.61 0.68 0.68 0.82 1.22 0.66 0.40 0.83 1.10 0.67 1.44 2.13 2.51 2.55 2.20 1.75 1.67 1.13 0.88 0.69 0.61 0.54 0.49 0.47 0.44 0.39 0.39 0.36 0.36 0.37 0.34 0.34 0.29 0.29 0.34 0.37 0.39 0.46 0.48 0.47 0.40 0.35 0.34 0.34 0.37 0.43 0.46 0.52 0.56 0.49 0.51 0.51 0.54 0.57 0.60 0.72 1.03 1.31 1.15 1.01 0.87 0.85 0.89 0.94 1.10 1.17 1.37 1.84 2.05 1.96 1.84 1.86 2.07 2.22 +0 12.77 19.30 1.95 1.20 0.60 0.81 0.74 0.59 1.46 3.38 5.94 4.46 4.24 5.10 2.79 3.26 1.33 1.53 0.98 0.53 0.88 0.51 1.48 0.98 0.74 0.60 0.37 0.32 0.33 0.46 0.65 0.37 0.73 0.43 0.32 0.21 0.20 0.23 0.27 0.36 0.52 0.68 0.71 0.41 0.39 0.27 0.24 0.25 0.22 0.24 0.30 0.32 0.36 0.35 0.42 0.37 0.44 0.37 0.36 0.42 0.48 0.55 0.74 0.89 1.11 1.06 1.11 0.99 0.91 0.87 0.84 0.79 0.78 0.73 0.77 0.69 0.68 0.78 0.82 0.98 0.96 1.11 1.26 1.10 0.34 0.50 1.20 2.06 2.45 2.99 2.70 2.19 1.75 1.38 1.14 0.87 0.75 0.70 0.57 0.56 0.49 0.46 0.40 0.39 0.37 0.36 0.37 0.37 0.37 0.34 0.30 0.32 0.32 0.32 0.38 0.34 0.30 0.34 0.36 0.42 0.42 0.47 0.61 0.66 0.71 0.74 0.77 0.80 0.78 0.84 0.83 1.06 1.38 1.45 1.22 1.09 0.97 1.03 1.13 1.21 1.28 1.47 1.84 2.12 2.34 2.64 2.72 2.61 2.50 2.33 +0 11.84 19.16 2.06 1.26 0.72 0.67 0.74 0.64 1.10 3.40 6.85 2.63 3.49 3.32 1.98 3.47 2.31 1.56 1.10 0.63 0.94 0.54 1.32 0.56 0.48 0.42 0.36 0.49 0.52 0.60 0.57 0.28 0.92 0.34 0.32 0.23 0.24 0.22 0.21 0.24 0.28 0.54 1.21 0.48 0.34 0.28 0.25 0.22 0.20 0.25 0.23 0.24 0.26 0.31 0.32 0.29 0.35 0.36 0.37 0.39 0.42 0.52 0.68 0.87 0.95 1.02 1.07 0.95 1.03 1.06 0.96 0.91 0.91 0.86 0.79 0.82 0.78 0.81 0.91 0.97 1.09 1.38 0.50 0.58 1.06 1.52 1.65 0.86 1.59 2.47 2.41 1.77 1.41 1.25 1.16 1.01 0.82 0.68 0.62 0.55 0.50 0.46 0.46 0.46 0.48 0.50 0.51 0.53 0.48 0.48 0.48 0.53 0.55 0.57 0.49 0.45 0.39 0.37 0.38 0.47 0.44 0.49 0.55 0.59 0.66 0.69 0.75 0.78 0.86 1.03 1.27 1.53 1.72 1.99 1.96 1.74 1.43 1.42 1.25 1.29 1.33 1.27 1.32 1.31 1.32 1.33 1.70 1.91 1.94 1.66 +0 13.19 21.60 2.90 2.51 1.28 1.64 1.33 1.01 1.78 4.22 8.27 4.65 3.67 5.14 2.49 3.39 1.88 1.76 1.37 0.87 1.04 0.84 2.47 1.75 1.07 0.91 0.63 0.64 0.67 0.76 0.83 0.57 1.09 0.67 0.54 0.39 0.43 0.39 0.42 0.44 0.49 0.72 1.17 1.00 0.69 0.48 0.43 0.44 0.38 0.43 0.43 0.43 0.49 0.45 0.54 0.59 0.56 0.61 0.67 0.65 0.74 0.93 1.08 1.33 1.52 1.57 1.55 1.60 1.67 1.58 1.55 1.54 1.46 1.34 0.99 0.81 0.82 0.87 1.00 1.37 0.96 0.39 0.77 1.34 1.57 0.80 1.59 1.98 2.04 2.25 2.24 1.99 1.61 1.38 1.09 1.03 0.92 0.75 0.69 0.63 0.58 0.52 0.52 0.57 0.53 0.51 0.52 0.46 0.44 0.43 0.42 0.44 0.42 0.43 0.44 0.42 0.40 0.42 0.41 0.42 0.44 0.47 0.49 0.51 0.50 0.58 0.54 0.61 0.69 0.82 0.97 1.23 1.51 1.68 1.70 1.51 1.43 1.25 1.22 1.22 1.14 1.17 1.04 1.15 1.11 1.26 1.24 1.40 1.44 1.59 +0 12.09 21.82 1.81 0.81 0.36 0.43 0.64 0.49 1.17 2.91 7.69 7.12 3.55 4.06 1.38 2.06 1.62 1.41 0.94 0.51 0.84 0.47 3.01 1.40 0.90 0.62 0.37 0.39 0.42 0.54 0.68 0.42 0.98 0.50 0.66 0.44 0.36 0.31 0.24 0.22 0.25 0.35 0.94 0.47 0.54 0.30 0.26 0.27 0.22 0.23 0.26 0.32 0.27 0.29 0.34 0.32 0.32 0.41 0.47 0.47 0.55 0.70 0.94 1.23 1.63 1.39 1.75 2.05 1.69 1.27 1.32 1.36 1.12 0.90 0.85 0.87 1.00 0.94 0.98 0.89 1.03 1.29 1.57 1.69 1.21 1.47 2.50 2.79 2.94 2.58 2.26 2.10 1.86 1.72 1.49 1.22 1.06 0.89 0.78 0.70 0.70 0.67 0.60 0.55 0.55 0.55 0.51 0.52 0.54 0.56 0.55 0.51 0.50 0.51 0.50 0.51 0.52 0.57 0.69 0.72 0.76 0.89 0.99 1.15 1.20 1.25 1.33 1.35 1.65 1.81 1.80 1.88 2.16 2.04 1.98 1.54 1.17 1.15 1.25 1.39 1.61 1.73 1.78 1.84 1.81 2.14 2.42 2.66 3.22 3.01 +0 13.15 22.24 2.16 1.06 0.63 0.65 0.57 0.49 0.76 2.02 2.22 1.04 2.09 1.11 0.94 1.46 1.23 2.55 1.48 0.68 1.53 1.45 1.09 0.73 0.66 0.46 0.40 0.38 0.42 0.46 0.59 0.43 0.85 0.56 0.34 0.27 0.32 0.40 0.46 0.55 0.50 0.65 0.94 0.48 0.41 0.25 0.24 0.26 0.28 0.34 0.39 0.38 0.37 0.40 0.44 0.46 0.39 0.40 0.43 0.54 0.60 0.79 0.81 0.90 1.18 1.27 1.28 1.39 1.21 1.06 1.05 1.04 0.95 0.95 0.87 0.75 0.75 0.79 0.88 0.96 1.19 0.42 0.81 1.08 1.38 0.77 1.21 1.94 2.23 2.33 2.29 2.73 3.17 2.42 1.85 1.43 1.27 0.95 0.80 0.67 0.57 0.53 0.53 0.48 0.46 0.42 0.42 0.39 0.37 0.35 0.35 0.38 0.37 0.38 0.39 0.36 0.40 0.41 0.39 0.39 0.38 0.36 0.36 0.38 0.44 0.55 0.67 0.94 1.35 1.67 1.83 1.87 1.59 1.35 1.14 1.04 1.10 1.10 1.11 1.11 1.09 1.10 1.20 1.43 1.40 1.60 1.64 1.70 1.95 1.98 +0 13.13 21.12 3.16 2.00 1.37 1.16 0.97 0.76 1.05 2.21 4.14 1.62 3.27 1.92 1.71 1.94 1.22 1.46 0.91 0.86 1.18 1.19 1.08 0.74 0.57 0.49 0.48 0.47 0.58 0.67 0.94 0.71 1.19 0.90 0.53 0.31 0.28 0.30 0.31 0.38 0.40 0.62 0.76 0.59 0.48 0.30 0.28 0.28 0.30 0.36 0.37 0.35 0.43 0.42 0.49 0.50 0.48 0.51 0.57 0.66 0.71 0.87 0.89 1.17 1.40 1.45 1.34 1.60 1.69 1.93 1.77 1.57 1.25 1.01 1.04 1.02 0.99 1.10 1.29 1.20 0.43 0.80 1.42 1.37 0.76 2.21 2.88 2.57 2.94 2.89 2.42 1.87 1.30 1.04 0.87 0.69 0.66 0.63 0.60 0.61 0.61 0.59 0.57 0.55 0.47 0.39 0.33 0.31 0.30 0.30 0.30 0.33 0.38 0.41 0.45 0.43 0.46 0.47 0.50 0.50 0.53 0.60 0.74 0.71 0.76 0.82 0.74 0.80 0.89 1.07 1.18 1.31 1.33 1.12 0.94 0.87 0.82 0.83 0.88 0.93 1.06 1.14 1.31 1.57 1.76 2.04 2.01 2.34 2.37 2.31 +0 12.12 17.07 1.59 0.78 0.51 0.53 0.53 0.46 0.83 2.97 5.54 3.26 3.19 3.66 1.73 2.06 0.81 1.69 1.30 0.69 0.79 0.75 1.86 1.27 1.08 0.44 0.32 0.30 0.34 0.41 0.38 0.26 0.71 0.38 0.34 0.20 0.20 0.20 0.19 0.21 0.25 0.49 0.43 0.28 0.30 0.23 0.24 0.22 0.26 0.24 0.26 0.27 0.32 0.39 0.50 0.49 0.57 0.58 0.63 0.60 0.59 0.62 0.56 0.59 0.57 0.66 0.69 0.76 0.81 0.88 0.96 1.21 1.31 0.70 0.95 1.08 1.19 1.31 1.40 1.35 1.05 0.48 0.85 1.31 0.60 1.60 2.01 2.04 1.90 1.74 1.59 1.26 1.08 0.88 0.76 0.67 0.59 0.50 0.46 0.46 0.48 0.46 0.49 0.49 0.57 0.59 0.68 0.66 0.62 0.65 0.64 0.63 0.67 0.64 0.51 0.47 0.44 0.41 0.43 0.44 0.51 0.53 0.58 0.67 0.73 0.80 0.83 0.92 1.08 1.34 1.60 1.97 1.97 1.80 1.68 1.96 1.90 1.91 1.80 1.94 1.75 1.81 1.92 2.01 2.41 2.54 2.86 3.06 3.03 3.05 +0 12.92 20.14 2.09 1.50 0.73 0.72 0.71 0.61 1.12 2.96 6.30 2.50 2.24 1.96 1.72 2.35 1.39 1.61 2.13 1.11 1.20 0.73 1.68 0.72 0.58 0.47 0.41 0.38 0.47 0.73 1.28 1.07 2.06 1.24 0.59 0.40 0.39 0.47 0.45 0.50 0.45 0.71 1.52 0.67 0.54 0.41 0.38 0.36 0.36 0.38 0.33 0.37 0.38 0.37 0.40 0.38 0.42 0.46 0.46 0.48 0.51 0.57 0.75 0.88 0.99 1.19 1.22 1.08 1.04 1.18 1.27 1.08 1.11 1.06 1.04 0.84 0.88 0.95 1.07 1.15 1.31 1.89 1.45 0.43 1.05 0.78 1.47 2.08 2.71 3.24 3.41 2.57 1.94 1.68 1.50 1.33 1.27 1.17 1.00 0.91 0.79 0.83 0.75 0.68 0.59 0.54 0.44 0.49 0.46 0.42 0.46 0.50 0.54 0.55 0.55 0.51 0.47 0.48 0.56 0.62 0.63 0.73 0.71 0.67 0.64 0.61 0.61 0.57 0.60 0.66 0.75 0.91 1.05 1.05 0.96 0.85 0.80 0.80 0.87 0.96 1.08 1.13 1.12 1.24 1.42 1.43 1.27 1.50 1.60 1.71 +0 13.74 20.45 1.94 1.01 0.65 0.62 0.54 0.45 0.92 2.12 4.50 1.78 2.56 1.65 0.81 1.47 1.13 1.32 1.00 0.79 0.72 0.97 0.75 0.55 0.53 0.45 0.38 0.42 0.49 0.58 1.03 1.03 1.46 1.28 0.92 0.52 0.40 0.30 0.28 0.34 0.58 0.65 1.18 0.91 0.58 0.49 0.44 0.43 0.44 0.50 0.37 0.44 0.43 0.40 0.44 0.53 0.54 0.53 0.55 0.56 0.57 0.62 0.73 1.01 1.27 1.44 1.73 1.80 1.93 1.68 1.82 1.87 1.90 1.72 1.47 1.13 1.32 1.22 1.33 1.37 1.40 1.03 0.77 1.18 1.55 1.65 1.34 1.80 2.92 3.43 2.91 2.89 2.37 1.95 1.93 1.47 1.04 0.87 0.76 0.75 0.78 0.79 0.91 0.94 0.96 0.93 0.81 0.63 0.63 0.58 0.45 0.45 0.44 0.44 0.43 0.44 0.38 0.34 0.36 0.35 0.38 0.35 0.38 0.43 0.45 0.52 0.63 0.70 0.77 0.93 1.22 1.56 1.60 1.41 1.20 1.07 1.07 0.91 0.90 0.85 0.96 1.02 1.19 1.13 1.26 1.54 1.70 1.96 2.24 2.51 +0 9.12 25.30 3.67 2.11 1.55 1.12 1.02 0.81 1.09 3.00 4.85 3.32 1.91 2.37 2.02 2.23 1.17 1.75 1.24 1.10 1.39 0.78 0.91 0.74 0.58 0.48 0.43 0.40 0.46 0.54 0.76 0.57 1.01 1.47 0.69 0.34 0.30 0.32 0.41 0.51 0.47 0.51 0.79 0.85 0.87 0.41 0.36 0.32 0.29 0.34 0.34 0.33 0.41 0.43 0.50 0.42 0.55 0.48 0.53 0.53 0.53 0.55 0.75 0.90 1.08 1.28 1.49 1.35 1.49 1.56 1.58 1.63 1.42 1.38 1.16 1.05 0.91 0.90 0.93 1.13 1.17 1.69 0.58 0.92 0.97 1.29 2.23 2.44 3.00 3.57 3.43 3.09 2.77 2.05 1.72 1.28 1.10 0.89 0.87 1.00 1.04 1.09 1.20 1.21 1.00 0.87 0.79 0.71 0.69 0.63 0.59 0.55 0.54 0.46 0.43 0.41 0.43 0.47 0.52 0.63 0.67 0.79 0.98 1.26 1.41 1.51 1.52 1.39 1.39 1.39 1.36 1.52 1.65 1.58 1.52 1.56 1.73 1.70 1.80 1.84 2.03 2.15 2.85 3.29 3.83 4.56 4.24 4.13 3.77 3.31 +0 11.91 20.77 1.75 1.19 0.47 0.60 0.59 0.42 0.87 3.34 6.18 1.66 2.60 1.95 2.49 2.10 1.76 2.58 1.83 0.81 1.13 1.34 3.47 1.42 0.89 0.80 0.50 0.57 0.58 0.57 0.84 0.80 1.59 1.24 1.09 0.96 0.90 0.93 0.61 0.68 0.73 1.03 1.41 0.88 0.53 0.62 0.62 0.73 0.78 0.95 0.92 0.97 0.97 0.93 0.79 0.80 0.71 0.92 1.02 1.04 1.19 1.38 1.82 1.96 2.26 2.05 2.07 1.64 1.48 1.51 1.24 1.33 1.24 0.89 1.11 1.20 1.16 1.06 0.93 1.08 1.44 1.82 2.08 2.06 1.98 0.96 1.69 2.58 3.37 3.88 2.92 1.72 0.99 1.91 1.52 1.09 0.77 0.59 0.49 0.43 0.45 0.42 0.44 0.50 0.55 0.53 0.54 0.57 0.48 0.50 0.47 0.42 0.38 0.37 0.35 0.33 0.31 0.31 0.37 0.40 0.46 0.43 0.42 0.44 0.48 0.53 0.61 0.78 0.87 1.03 1.25 1.23 1.27 1.28 1.07 0.96 0.92 0.99 0.99 1.11 1.14 1.17 1.15 1.21 1.31 1.69 1.86 2.14 2.29 2.04 +0 28.69 28.08 4.03 3.08 2.14 2.00 1.53 1.39 2.07 3.19 4.14 1.88 2.62 3.52 2.32 2.47 1.56 1.58 1.17 0.81 0.90 1.94 2.26 0.93 0.82 0.69 0.66 0.50 0.54 0.72 0.54 0.92 0.99 0.67 0.41 0.40 0.34 0.36 0.37 0.42 0.69 0.81 0.58 0.63 0.48 0.38 0.32 0.34 0.32 0.35 0.36 0.35 0.34 0.36 0.40 0.45 0.45 0.43 0.49 0.53 0.59 0.71 0.90 1.10 1.10 1.06 0.85 0.93 0.98 0.95 1.01 0.95 0.95 0.77 0.85 0.88 0.82 0.87 0.83 0.85 1.12 1.42 1.29 0.38 0.96 0.94 0.94 1.57 2.31 2.34 2.08 1.60 1.32 0.96 0.78 0.74 0.65 0.55 0.48 0.45 0.37 0.36 0.40 0.38 0.38 0.40 0.41 0.35 0.34 0.35 0.36 0.43 0.40 0.40 0.38 0.39 0.38 0.34 0.38 0.38 0.41 0.45 0.44 0.47 0.45 0.42 0.44 0.46 0.50 0.44 0.37 0.35 0.35 0.34 0.32 0.33 0.35 0.39 0.42 0.52 0.61 0.71 0.84 0.90 0.95 0.93 0.78 0.79 0.82 0.65 +0 24.50 25.96 2.62 1.86 1.23 1.45 1.11 1.12 1.88 2.84 4.30 2.26 3.64 4.06 3.32 3.62 2.38 2.44 1.28 0.93 0.87 1.14 1.32 1.42 1.41 1.01 1.08 0.66 0.81 0.86 0.82 1.23 1.32 0.70 0.35 0.41 0.36 0.35 0.38 0.36 0.60 0.84 0.95 0.96 0.67 0.40 0.33 0.30 0.30 0.28 0.32 0.36 0.41 0.40 0.47 0.47 0.47 0.47 0.52 0.67 0.70 0.58 0.73 0.88 1.21 1.46 1.56 1.47 1.14 0.83 0.88 0.82 0.80 0.81 0.79 0.84 0.87 0.88 0.86 1.10 1.65 1.25 0.68 0.64 1.14 1.65 1.79 2.15 2.22 1.89 1.67 1.40 0.98 0.96 0.88 0.83 0.81 0.78 0.59 0.57 0.48 0.42 0.37 0.33 0.30 0.28 0.26 0.24 0.27 0.29 0.28 0.27 0.31 0.31 0.31 0.28 0.24 0.25 0.24 0.26 0.26 0.28 0.29 0.29 0.29 0.31 0.34 0.35 0.36 0.37 0.37 0.41 0.43 0.42 0.39 0.40 0.39 0.37 0.39 0.41 0.42 0.53 0.60 0.66 0.78 0.72 0.71 0.65 0.55 0.57 +0 26.15 27.99 3.73 2.76 1.93 1.82 1.44 1.20 2.03 3.19 3.69 1.86 2.92 3.13 1.76 1.78 1.11 1.31 0.66 0.52 1.11 1.08 0.98 0.80 0.68 0.60 0.52 0.50 0.61 0.78 0.43 0.67 0.68 0.61 0.47 0.36 0.38 0.38 0.37 0.56 0.62 0.60 0.41 0.44 0.36 0.30 0.28 0.28 0.26 0.26 0.27 0.30 0.31 0.31 0.28 0.34 0.34 0.38 0.38 0.42 0.47 0.58 0.63 0.70 0.66 0.60 0.60 0.61 0.59 0.62 0.58 0.59 0.61 0.52 0.41 0.47 0.45 0.46 0.52 0.62 0.99 0.95 0.26 0.60 1.06 1.06 0.59 0.95 1.52 1.60 1.54 1.20 1.07 0.90 0.72 0.64 0.49 0.42 0.40 0.39 0.32 0.33 0.30 0.30 0.28 0.29 0.27 0.26 0.24 0.26 0.27 0.28 0.27 0.28 0.27 0.26 0.24 0.24 0.25 0.28 0.30 0.32 0.35 0.36 0.38 0.39 0.42 0.51 0.54 0.54 0.52 0.49 0.48 0.49 0.50 0.59 0.66 0.69 0.80 0.90 0.88 0.95 1.09 1.09 1.04 0.87 0.86 0.79 0.81 0.82 +0 23.35 25.82 4.06 3.22 1.95 2.14 1.52 1.19 1.68 3.44 5.61 1.95 3.19 3.52 2.68 2.45 1.37 1.32 0.82 0.74 0.83 0.92 1.59 1.23 1.03 0.85 0.76 0.59 0.64 0.72 0.53 0.74 0.75 0.54 0.41 0.40 0.39 0.41 0.37 0.35 0.40 0.71 0.70 0.80 0.46 0.37 0.32 0.30 0.34 0.31 0.31 0.30 0.34 0.35 0.44 0.45 0.39 0.46 0.50 0.58 0.72 0.77 0.91 1.00 1.43 1.24 1.45 1.38 1.16 1.08 0.91 0.80 0.81 0.62 0.76 0.85 0.71 0.78 0.80 0.96 1.15 0.32 0.79 1.28 1.05 0.79 1.88 2.21 2.18 1.98 1.78 1.25 1.09 0.94 0.86 0.79 0.65 0.54 0.57 0.53 0.48 0.39 0.39 0.37 0.37 0.34 0.36 0.31 0.30 0.31 0.33 0.33 0.34 0.38 0.35 0.36 0.32 0.38 0.44 0.51 0.51 0.52 0.57 0.63 0.66 0.74 0.84 0.82 0.71 0.68 0.71 0.79 0.95 1.21 1.34 1.52 1.20 1.07 0.87 0.97 1.21 1.60 2.08 2.51 2.50 2.57 2.41 2.17 2.02 1.91 +0 22.03 18.95 3.97 2.60 2.11 1.74 1.37 1.19 1.76 3.20 3.61 1.19 3.68 2.20 1.69 1.93 1.21 1.03 0.75 1.19 1.06 1.16 1.45 0.66 0.52 0.50 0.48 0.44 0.48 0.63 0.46 0.63 0.68 0.49 0.34 0.31 0.31 0.30 0.30 0.30 0.36 0.55 0.42 0.53 0.48 0.33 0.27 0.26 0.26 0.27 0.28 0.32 0.37 0.35 0.40 0.37 0.33 0.32 0.39 0.41 0.45 0.47 0.55 0.59 0.80 0.82 0.77 0.91 0.91 0.95 0.88 0.88 0.80 0.81 0.65 0.72 0.76 0.85 0.85 0.83 0.98 1.15 1.51 1.24 0.45 0.78 1.52 2.01 1.84 1.49 1.56 1.57 1.56 1.50 1.33 1.31 1.09 0.98 0.88 0.75 0.70 0.60 0.58 0.54 0.42 0.42 0.38 0.37 0.32 0.30 0.26 0.29 0.26 0.30 0.27 0.26 0.25 0.27 0.29 0.32 0.38 0.45 0.47 0.47 0.52 0.55 0.60 0.60 0.68 0.77 0.75 0.70 0.61 0.57 0.53 0.59 0.58 0.58 0.62 0.69 0.72 0.75 0.81 0.92 0.93 0.76 0.63 0.66 0.67 0.72 +0 25.75 22.63 4.36 3.11 2.60 2.04 1.68 1.55 1.91 2.72 5.64 1.40 3.49 1.74 1.87 1.33 0.92 0.84 0.72 1.08 1.09 1.13 0.89 0.73 0.57 0.55 0.52 0.42 0.45 0.56 0.40 0.56 0.65 0.45 0.37 0.34 0.33 0.32 0.33 0.38 0.49 0.46 0.40 0.41 0.34 0.34 0.31 0.28 0.26 0.29 0.27 0.30 0.28 0.29 0.31 0.31 0.32 0.33 0.37 0.40 0.47 0.60 0.70 0.72 0.75 0.76 0.62 0.49 0.53 0.56 0.53 0.52 0.66 0.74 0.68 0.60 0.48 0.52 0.57 0.74 0.97 0.64 0.44 0.80 0.84 0.50 0.96 1.49 1.70 1.53 1.60 1.34 1.05 0.82 0.71 0.59 0.49 0.39 0.42 0.37 0.34 0.33 0.33 0.34 0.31 0.32 0.31 0.32 0.30 0.34 0.37 0.35 0.35 0.32 0.31 0.33 0.33 0.30 0.30 0.28 0.33 0.34 0.36 0.38 0.41 0.41 0.46 0.49 0.43 0.53 0.56 0.72 0.75 0.76 0.70 0.59 0.40 0.36 0.35 0.46 0.59 0.77 0.99 1.11 1.05 1.04 1.00 1.09 1.05 1.08 +0 21.04 26.75 2.30 1.74 1.02 1.49 1.25 1.56 2.69 3.42 7.38 3.13 9.28 6.78 7.92 7.46 4.13 4.50 2.26 2.77 1.41 1.64 1.22 1.09 0.94 0.85 0.81 0.65 0.82 0.66 0.50 0.45 0.77 0.41 0.40 0.39 0.40 0.49 0.57 0.61 0.90 0.71 0.63 0.53 0.56 0.43 0.33 0.33 0.37 0.37 0.36 0.48 0.52 0.65 0.68 0.75 0.91 1.07 1.03 1.10 1.17 1.01 1.03 1.15 1.25 1.42 1.30 1.37 1.39 1.33 1.07 0.95 0.81 1.00 1.07 1.15 1.25 1.34 1.54 2.29 2.38 1.86 0.88 0.80 1.73 1.67 0.81 1.72 2.27 2.35 1.98 1.75 1.50 1.19 1.04 0.93 0.80 0.68 0.57 0.53 0.47 0.46 0.52 0.46 0.40 0.42 0.37 0.36 0.38 0.37 0.39 0.42 0.35 0.37 0.34 0.31 0.29 0.26 0.30 0.31 0.31 0.31 0.34 0.33 0.35 0.42 0.49 0.53 0.59 0.57 0.59 0.53 0.55 0.50 0.56 0.60 0.61 0.74 0.89 1.07 1.14 1.14 1.15 1.08 1.00 1.11 1.13 1.13 1.12 1.20 +0 24.83 20.67 2.14 1.45 0.82 0.88 0.73 0.62 0.93 2.95 2.87 0.82 2.26 2.09 1.29 1.22 1.01 1.19 0.73 0.61 0.88 1.27 0.94 0.50 0.49 0.35 0.32 0.27 0.30 0.33 0.27 0.39 0.69 0.31 0.26 0.26 0.23 0.22 0.21 0.21 0.35 0.47 0.41 0.51 0.31 0.23 0.19 0.21 0.18 0.19 0.22 0.24 0.29 0.26 0.30 0.39 0.30 0.31 0.43 0.51 0.51 0.73 0.90 1.15 1.00 0.81 0.80 1.02 0.89 0.63 0.79 0.78 0.70 0.57 0.49 0.62 0.69 0.63 0.59 0.67 0.86 1.45 1.94 1.17 0.38 0.84 1.32 1.81 1.91 2.10 2.04 1.49 1.14 1.00 0.87 0.69 0.61 0.61 0.55 0.53 0.47 0.42 0.41 0.43 0.47 0.50 0.48 0.45 0.43 0.44 0.41 0.40 0.44 0.47 0.47 0.42 0.37 0.42 0.54 0.61 0.73 0.83 1.03 1.08 0.94 0.91 0.88 0.89 0.95 1.15 1.27 1.22 1.21 1.28 1.28 1.38 1.47 1.56 1.66 1.57 1.54 1.37 1.46 1.62 1.88 2.45 2.76 3.28 3.38 3.19 +0 25.97 20.49 2.13 1.52 1.18 1.06 0.89 0.71 1.09 2.60 4.64 0.98 1.96 2.55 1.72 1.61 0.99 1.34 1.22 0.77 1.50 1.12 0.92 0.62 0.46 0.47 0.43 0.32 0.36 0.43 0.33 0.45 0.89 0.33 0.43 0.34 0.53 0.48 0.73 0.48 0.41 0.36 0.32 0.39 0.34 0.27 0.26 0.24 0.24 0.22 0.22 0.28 0.32 0.29 0.30 0.35 0.31 0.36 0.41 0.45 0.54 0.65 0.73 0.81 0.98 1.18 1.21 1.31 1.12 1.06 0.92 0.80 0.61 0.68 0.71 0.74 0.79 0.78 0.75 0.83 0.92 1.10 1.54 1.81 1.44 1.05 0.49 1.17 2.03 2.11 1.95 1.52 1.26 1.07 0.86 0.72 0.60 0.53 0.55 0.54 0.51 0.52 0.54 0.51 0.49 0.50 0.44 0.38 0.33 0.33 0.39 0.41 0.44 0.50 0.51 0.48 0.43 0.48 0.53 0.62 0.68 0.77 0.92 0.92 0.91 0.85 0.87 0.85 0.91 0.90 0.96 0.97 0.94 0.91 0.79 0.87 0.86 0.91 0.97 1.07 1.11 1.13 1.18 1.14 1.08 1.02 0.98 0.89 0.90 0.83 +0 26.74 26.60 2.29 1.29 0.99 0.95 0.71 0.56 0.93 2.18 3.42 1.15 3.03 2.14 1.22 1.37 0.85 1.17 1.08 1.32 0.91 1.00 1.24 0.57 0.47 0.43 0.38 0.36 0.32 0.50 0.35 0.76 0.70 0.55 0.35 0.28 0.27 0.36 0.54 0.87 0.88 0.58 0.38 0.52 0.34 0.30 0.31 0.31 0.27 0.25 0.30 0.30 0.36 0.32 0.35 0.41 0.37 0.40 0.52 0.56 0.59 0.80 0.75 0.92 1.39 1.48 1.75 1.54 1.37 1.05 0.98 0.79 0.68 0.78 0.68 0.70 0.71 0.72 0.77 0.81 1.06 1.15 0.38 0.88 0.65 1.10 1.89 2.12 2.01 1.90 1.74 1.34 1.19 0.97 0.78 0.65 0.59 0.52 0.49 0.48 0.47 0.45 0.41 0.40 0.34 0.30 0.28 0.29 0.24 0.26 0.27 0.32 0.33 0.38 0.44 0.47 0.51 0.58 0.59 0.61 0.51 0.45 0.45 0.45 0.40 0.44 0.46 0.46 0.44 0.47 0.44 0.48 0.47 0.44 0.46 0.40 0.42 0.43 0.48 0.51 0.56 0.64 0.78 0.90 1.14 1.09 0.97 0.88 0.86 0.81 +0 27.39 27.17 4.00 2.59 1.77 1.54 1.23 0.98 1.28 2.83 3.56 1.04 3.08 1.73 1.30 1.59 1.20 1.77 1.38 0.74 1.20 0.73 1.55 0.66 0.57 0.52 0.49 0.43 0.46 0.67 0.39 0.61 1.00 0.56 0.43 0.33 0.29 0.29 0.38 0.47 0.70 0.71 0.42 0.72 0.47 0.35 0.31 0.30 0.27 0.28 0.29 0.31 0.35 0.30 0.35 0.42 0.36 0.36 0.37 0.46 0.68 0.71 0.86 1.05 1.30 1.54 1.23 1.01 0.95 0.95 0.96 0.82 0.70 0.77 0.87 0.83 0.87 0.86 0.97 1.13 1.34 1.41 0.40 0.92 1.39 0.80 1.11 1.91 2.24 2.17 1.81 1.41 1.06 0.80 0.68 0.60 0.57 0.50 0.42 0.40 0.37 0.35 0.35 0.35 0.31 0.30 0.30 0.32 0.29 0.27 0.28 0.28 0.33 0.36 0.37 0.31 0.30 0.32 0.33 0.37 0.40 0.42 0.43 0.47 0.46 0.46 0.45 0.46 0.52 0.53 0.75 0.81 0.75 0.69 0.57 0.53 0.53 0.54 0.56 0.71 0.87 1.12 1.34 1.28 0.92 0.96 1.21 1.31 1.61 1.55 +0 26.00 30.08 2.86 1.62 1.28 1.23 0.87 0.80 1.19 2.87 3.69 0.98 2.16 1.77 1.89 1.42 0.92 1.62 0.78 0.60 1.21 1.75 1.24 0.70 0.53 0.48 0.44 0.35 0.40 0.59 0.39 1.05 0.54 0.65 0.37 0.33 0.36 0.43 0.49 0.63 0.83 0.87 0.61 0.66 0.55 0.38 0.33 0.31 0.29 0.30 0.28 0.25 0.30 0.32 0.39 0.40 0.42 0.41 0.41 0.47 0.40 0.52 0.65 0.82 1.13 1.12 1.16 0.90 0.95 1.09 0.94 0.83 0.78 0.81 0.68 0.70 0.69 0.70 0.70 0.81 0.85 0.93 1.09 1.50 1.54 0.93 0.67 1.51 2.19 2.51 2.31 2.37 2.08 2.21 1.79 1.70 1.35 1.21 1.00 0.87 0.78 0.66 0.63 0.60 0.53 0.51 0.52 0.51 0.47 0.44 0.40 0.38 0.40 0.40 0.43 0.42 0.46 0.43 0.52 0.57 0.54 0.58 0.58 0.59 0.56 0.58 0.60 0.60 0.62 0.70 0.86 0.98 1.07 0.85 0.78 0.66 0.62 0.68 0.70 0.69 0.75 0.82 0.93 1.12 1.15 1.02 0.92 1.01 1.20 1.15 +0 20.78 24.20 4.23 2.75 2.09 1.78 1.31 1.30 1.73 3.37 3.80 1.40 3.27 2.01 2.53 1.86 1.41 1.25 0.85 0.79 1.03 1.12 1.54 0.99 0.74 0.61 0.58 0.42 0.46 0.45 0.38 0.55 0.57 0.47 0.38 0.50 0.48 0.42 0.55 0.52 0.54 0.46 0.45 0.47 0.46 0.36 0.34 0.33 0.34 0.40 0.36 0.39 0.44 0.40 0.44 0.47 0.49 0.50 0.45 0.51 0.58 0.72 0.82 0.88 1.02 1.44 1.25 1.22 1.21 1.07 0.89 0.83 0.96 0.87 0.70 0.74 0.85 0.92 0.96 1.13 1.31 1.21 0.84 0.70 1.30 1.35 0.80 2.10 2.11 1.72 1.34 1.29 1.02 0.95 0.90 0.78 0.63 0.53 0.53 0.45 0.38 0.37 0.32 0.34 0.30 0.29 0.31 0.32 0.30 0.30 0.33 0.33 0.36 0.41 0.45 0.43 0.38 0.40 0.43 0.47 0.48 0.47 0.51 0.55 0.55 0.54 0.57 0.55 0.59 0.65 0.76 0.78 0.82 0.86 0.90 0.92 0.99 1.06 1.22 1.27 1.43 1.52 1.54 1.43 1.33 1.46 1.30 1.19 1.14 1.00 +0 24.77 21.10 3.93 2.86 2.08 1.62 1.38 1.20 1.71 2.76 4.36 1.03 2.56 2.03 2.28 2.68 1.94 1.30 0.97 0.68 1.01 1.84 1.75 0.72 0.63 0.50 0.53 0.44 0.48 0.63 0.53 0.78 0.63 0.51 0.33 0.39 0.37 0.34 0.31 0.32 0.42 0.45 0.42 0.57 0.47 0.35 0.31 0.29 0.27 0.28 0.35 0.44 0.47 0.45 0.52 0.62 0.51 0.52 0.53 0.56 0.67 0.69 0.73 0.95 1.08 1.03 1.49 1.06 0.96 0.65 1.10 1.39 1.22 1.30 1.03 1.06 1.09 1.03 1.12 1.44 1.70 0.92 0.53 0.64 1.16 1.42 2.01 2.56 2.30 2.28 1.74 1.62 1.71 1.66 1.53 1.56 1.56 1.48 1.24 1.16 1.12 1.01 1.00 0.87 0.86 0.86 0.67 0.57 0.59 0.60 0.70 0.70 0.89 0.84 0.82 0.80 0.70 0.67 0.58 0.53 0.62 0.57 0.56 0.66 0.67 0.70 0.72 0.76 0.78 0.81 0.81 0.86 0.98 0.85 0.81 0.73 0.64 0.65 0.68 0.75 0.82 0.98 1.12 1.32 1.22 1.13 1.11 1.09 1.09 1.07 +0 26.38 21.45 2.18 1.22 0.89 0.85 0.67 0.47 0.83 2.02 3.31 0.86 2.07 1.29 1.31 1.34 1.19 2.55 1.24 0.87 1.64 1.12 1.15 0.68 0.40 0.41 0.37 0.31 0.36 0.47 0.36 0.86 0.75 0.44 0.28 0.32 0.27 0.29 0.31 0.33 0.35 0.53 0.44 0.36 0.38 0.30 0.23 0.24 0.23 0.27 0.30 0.33 0.33 0.30 0.34 0.36 0.31 0.33 0.41 0.47 0.55 0.66 0.80 0.89 1.16 1.00 0.88 1.03 0.98 1.01 1.17 0.88 0.90 0.61 0.80 0.72 0.77 0.81 0.86 0.85 0.98 1.15 1.61 1.80 0.44 0.76 1.45 0.68 1.50 2.30 2.98 2.18 1.80 1.54 1.46 1.24 1.12 0.95 0.86 0.73 0.71 0.65 0.71 0.64 0.60 0.58 0.48 0.41 0.36 0.31 0.30 0.30 0.30 0.33 0.32 0.36 0.35 0.35 0.36 0.34 0.39 0.40 0.43 0.45 0.49 0.47 0.50 0.49 0.42 0.42 0.38 0.47 0.61 0.68 0.69 0.65 0.60 0.58 0.60 0.63 0.71 0.70 0.81 0.84 0.92 0.99 0.99 1.03 1.06 1.07 +0 24.18 25.67 1.97 1.48 1.06 1.00 0.82 0.65 0.85 3.00 4.12 1.45 2.87 2.10 1.01 1.22 0.89 1.03 0.98 0.73 0.77 0.69 1.11 0.70 0.50 0.41 0.37 0.35 0.35 0.38 0.29 0.37 0.58 0.29 0.29 0.24 0.25 0.28 0.34 0.51 0.64 0.66 0.46 0.55 0.39 0.31 0.28 0.26 0.25 0.27 0.29 0.31 0.31 0.37 0.36 0.37 0.35 0.39 0.46 0.50 0.56 0.57 0.50 0.60 0.64 0.67 0.68 0.63 0.61 0.58 0.58 0.56 0.50 0.55 0.63 0.69 0.72 0.76 0.79 0.87 0.98 1.41 0.87 0.30 0.93 1.20 0.49 1.76 2.26 1.90 1.43 1.17 1.13 0.93 0.74 0.70 0.61 0.52 0.50 0.42 0.40 0.36 0.33 0.31 0.28 0.30 0.29 0.29 0.32 0.33 0.34 0.33 0.38 0.34 0.34 0.29 0.25 0.25 0.24 0.27 0.29 0.32 0.33 0.40 0.40 0.45 0.44 0.48 0.47 0.52 0.55 0.54 0.41 0.35 0.32 0.31 0.35 0.36 0.40 0.41 0.40 0.46 0.46 0.55 0.68 0.71 0.68 0.76 0.77 0.78 +0 22.55 27.10 4.84 2.93 2.36 1.86 1.42 1.28 1.44 2.52 3.49 0.89 2.28 2.02 1.08 1.19 0.87 1.51 2.59 1.00 0.99 0.96 1.82 1.05 0.99 0.71 0.60 0.46 0.48 0.51 0.39 0.56 0.69 0.46 0.53 0.41 0.54 0.35 0.33 0.32 0.45 1.12 0.90 0.82 0.63 0.40 0.39 0.35 0.31 0.34 0.35 0.32 0.30 0.36 0.41 0.47 0.42 0.43 0.42 0.40 0.48 0.62 0.71 0.86 1.01 1.12 1.08 1.20 1.11 1.06 1.06 0.95 0.74 0.62 0.69 0.65 0.70 0.66 0.80 0.99 1.19 1.29 0.54 0.75 0.83 0.94 1.61 2.12 2.59 3.00 2.35 1.79 1.60 1.14 1.05 0.84 0.67 0.61 0.56 0.51 0.53 0.49 0.48 0.45 0.47 0.47 0.44 0.39 0.42 0.37 0.32 0.35 0.32 0.32 0.33 0.34 0.34 0.36 0.35 0.32 0.34 0.36 0.40 0.46 0.46 0.50 0.55 0.57 0.69 0.70 0.85 0.87 0.85 0.77 0.73 0.63 0.70 0.76 0.83 0.90 1.01 1.25 1.44 1.92 2.28 2.57 2.72 2.95 2.81 2.49 +0 24.17 20.14 2.75 2.08 1.87 1.77 1.67 1.49 2.81 3.35 6.00 2.46 3.36 2.24 2.80 2.85 2.81 4.24 4.02 4.23 2.54 1.89 1.69 0.99 1.09 1.05 0.93 0.94 0.99 1.29 0.93 1.11 1.02 0.45 0.44 0.33 0.41 0.43 0.67 0.68 0.97 0.98 0.53 0.48 0.44 0.33 0.31 0.32 0.30 0.30 0.28 0.28 0.31 0.37 0.36 0.40 0.43 0.43 0.48 0.56 0.69 0.97 0.91 1.00 1.34 1.60 1.39 1.10 0.92 0.98 0.95 0.90 0.78 1.03 0.74 0.83 0.91 0.94 0.94 1.23 0.96 0.41 0.85 1.03 1.15 1.21 1.15 2.35 2.46 1.96 1.66 1.35 1.24 1.06 0.89 0.75 0.64 0.59 0.63 0.58 0.62 0.61 0.55 0.50 0.42 0.41 0.37 0.34 0.31 0.31 0.33 0.30 0.32 0.31 0.32 0.35 0.36 0.40 0.42 0.50 0.58 0.66 0.71 0.78 0.73 0.79 0.83 0.99 1.06 1.19 1.45 1.61 1.74 1.68 1.18 0.82 0.71 0.65 0.68 0.73 0.79 0.99 1.14 1.18 1.13 1.30 1.40 1.56 1.73 1.68 +0 23.84 22.26 2.28 1.60 1.25 1.12 0.93 0.76 1.07 1.94 3.85 1.19 3.05 2.20 1.47 1.78 1.27 1.64 1.42 0.91 0.98 0.68 0.96 1.53 1.58 0.65 0.53 0.40 0.44 0.42 0.40 0.47 0.60 0.32 0.41 0.36 0.38 0.29 0.30 0.35 0.67 0.88 0.55 0.52 0.37 0.29 0.31 0.30 0.28 0.27 0.28 0.34 0.36 0.41 0.42 0.54 0.52 0.58 0.51 0.57 0.62 0.70 0.74 0.76 0.84 1.04 1.23 1.43 1.21 0.92 0.93 0.80 0.86 0.91 1.06 1.19 0.94 0.90 0.85 0.93 1.20 1.45 1.06 0.37 0.85 0.84 0.73 1.51 2.01 2.51 2.44 2.08 1.59 1.15 0.95 0.69 0.63 0.59 0.52 0.51 0.49 0.45 0.46 0.45 0.45 0.43 0.40 0.36 0.33 0.32 0.30 0.30 0.34 0.34 0.39 0.38 0.36 0.39 0.43 0.50 0.56 0.55 0.66 0.68 0.71 0.86 0.97 1.16 1.19 1.28 1.48 1.60 1.56 1.32 1.26 1.20 1.17 1.25 1.44 1.43 1.56 1.67 1.78 1.96 2.39 2.42 2.02 1.93 2.23 2.18 +0 22.06 26.51 4.65 3.06 2.52 2.18 1.57 1.65 2.34 2.88 4.96 2.27 2.93 2.18 2.19 1.60 1.03 1.11 0.94 0.92 0.86 0.90 0.82 0.65 0.66 0.54 0.59 0.43 0.48 0.63 0.46 0.81 0.95 0.66 0.46 0.46 0.37 0.33 0.32 0.33 0.50 0.94 0.63 0.68 0.45 0.40 0.33 0.34 0.34 0.30 0.30 0.31 0.28 0.31 0.34 0.48 0.46 0.42 0.44 0.50 0.63 0.73 0.77 0.89 0.91 1.09 1.13 1.03 1.04 1.00 0.98 0.85 0.85 0.75 0.93 0.72 0.73 0.86 0.86 1.03 1.25 1.77 2.20 1.22 0.43 1.18 1.41 0.96 1.16 2.47 2.36 2.03 1.52 1.14 0.97 0.81 0.71 0.71 0.70 0.67 0.55 0.53 0.47 0.40 0.35 0.37 0.38 0.32 0.33 0.35 0.35 0.37 0.38 0.40 0.39 0.41 0.37 0.37 0.35 0.36 0.37 0.40 0.42 0.40 0.42 0.43 0.45 0.44 0.50 0.54 0.55 0.72 0.85 1.05 1.15 1.03 0.88 0.80 0.76 0.81 0.94 1.17 1.47 1.89 2.17 2.12 1.98 1.99 1.92 1.85 +1 33.75 29.77 3.66 3.22 2.08 2.36 1.91 1.69 2.42 3.59 4.26 1.70 3.63 4.21 3.24 2.86 1.58 1.93 1.36 1.11 0.98 0.91 2.33 1.21 0.92 0.73 0.73 0.53 0.64 0.77 0.51 0.76 1.15 0.52 0.36 0.38 0.35 0.35 0.36 0.44 0.64 0.64 0.51 0.71 0.33 0.34 0.32 0.36 0.32 0.32 0.31 0.28 0.31 0.31 0.33 0.38 0.42 0.45 0.44 0.49 0.62 0.71 0.68 0.91 0.86 1.00 0.86 0.74 0.87 0.65 0.70 0.70 0.71 0.77 0.69 0.68 0.71 0.65 0.86 1.00 1.15 1.37 1.54 1.54 1.12 0.42 1.61 2.10 1.68 1.37 1.25 0.95 0.83 0.76 0.68 0.70 0.66 0.58 0.53 0.47 0.42 0.48 0.33 0.29 0.29 0.27 0.29 0.28 0.31 0.45 0.42 0.29 0.26 0.29 0.33 0.32 0.32 0.34 0.34 0.37 0.37 0.44 0.52 0.48 0.44 0.43 0.43 0.42 0.48 0.50 0.60 0.60 0.55 0.48 0.43 0.41 0.44 0.52 0.58 0.68 0.87 1.05 1.13 1.15 1.21 1.11 1.07 0.98 0.94 0.90 +1 26.87 21.82 2.82 1.86 1.39 1.19 0.89 0.89 1.19 2.82 2.96 1.45 2.12 1.62 1.75 2.31 1.65 1.79 0.81 0.61 1.01 1.81 1.93 0.92 0.75 0.52 0.51 0.50 0.50 0.69 0.47 0.87 0.63 0.44 0.33 0.37 0.39 0.53 0.66 0.61 0.54 0.54 0.46 0.51 0.35 0.31 0.29 0.29 0.25 0.25 0.29 0.29 0.35 0.34 0.38 0.44 0.43 0.44 0.52 0.50 0.60 0.68 0.73 1.06 1.46 1.60 1.75 1.47 1.61 1.28 0.93 1.16 1.14 1.32 1.05 0.98 0.89 0.92 0.98 1.18 1.33 1.58 1.88 2.01 2.18 1.80 1.79 2.81 2.62 2.03 1.56 1.41 1.25 1.07 0.85 0.76 0.63 0.58 0.50 0.54 0.49 0.46 0.44 0.42 0.44 0.42 0.40 0.36 0.31 0.28 0.27 0.29 0.31 0.31 0.46 0.34 0.32 0.33 0.33 0.35 0.37 0.40 0.41 0.41 0.47 0.48 0.49 0.49 0.42 0.58 0.58 0.64 0.68 0.72 0.78 0.74 0.76 0.88 0.89 0.94 0.86 0.89 0.87 0.84 0.72 0.68 0.61 0.54 0.50 0.53 +1 33.20 26.14 4.43 2.87 2.02 2.04 1.62 1.47 2.12 3.65 5.73 2.08 4.11 4.62 4.42 4.56 3.55 2.64 1.39 1.23 0.99 0.84 1.66 1.32 0.87 0.76 0.71 0.52 0.59 0.62 0.47 0.61 0.82 0.46 0.38 0.34 0.36 0.39 0.50 0.70 1.14 0.82 0.54 0.44 0.46 0.43 0.39 0.38 0.37 0.37 0.41 0.45 0.54 0.58 0.59 0.72 0.78 0.64 0.64 0.69 0.83 0.89 0.89 1.07 1.11 1.24 1.51 1.43 1.25 1.49 1.50 0.98 1.15 1.16 1.35 1.55 1.63 1.53 1.52 1.65 2.28 1.81 0.40 1.15 2.43 2.17 1.43 1.68 2.35 1.99 1.74 1.42 1.11 1.00 0.79 0.74 0.64 0.63 0.58 0.52 0.44 0.44 0.42 0.42 0.40 0.46 0.46 0.38 0.34 0.34 0.36 0.35 0.37 0.36 0.38 0.38 0.37 0.37 0.40 0.36 0.38 0.48 0.46 0.46 0.47 0.47 0.47 0.52 0.49 0.53 0.58 0.60 0.63 0.61 0.58 0.57 0.58 0.62 0.70 0.73 0.84 0.99 0.99 1.17 1.08 1.07 0.97 0.95 0.80 0.70 +1 26.34 21.90 4.50 2.84 2.27 1.69 1.49 1.28 1.39 4.24 6.22 2.26 5.65 4.06 1.44 1.05 1.29 1.68 1.12 0.86 1.14 1.04 0.82 0.58 0.95 0.92 0.60 0.64 0.49 0.76 0.89 0.90 1.24 0.67 0.46 0.34 0.36 0.36 0.36 0.37 0.41 0.50 0.57 0.67 0.47 0.37 0.39 0.35 0.33 0.30 0.31 0.33 0.39 0.45 0.44 0.56 0.46 0.42 0.47 0.44 0.51 0.52 0.54 0.55 0.56 0.48 0.50 0.52 0.52 0.57 0.65 0.72 0.37 0.66 0.75 0.70 0.70 0.61 0.54 0.65 0.89 1.39 1.75 1.67 1.15 0.75 2.05 2.48 2.31 1.80 1.45 1.12 0.86 0.71 0.70 0.67 0.66 0.58 0.53 0.46 0.53 0.46 0.38 0.36 0.35 0.37 0.41 0.46 0.55 0.52 0.51 0.52 0.54 0.54 0.58 0.55 0.62 0.64 0.72 0.78 0.89 1.00 1.21 1.27 1.37 1.49 1.45 1.31 1.26 1.37 1.41 1.38 1.41 1.11 1.16 1.23 1.24 1.32 1.27 1.26 1.33 1.44 1.69 1.71 1.33 1.23 1.31 1.44 1.35 1.22 +1 30.99 21.58 1.94 1.19 0.62 0.77 0.59 0.46 0.98 1.94 3.50 1.00 1.63 1.31 1.46 1.89 1.06 1.55 1.40 1.11 0.73 1.03 0.85 0.48 0.63 0.63 0.49 0.42 0.38 0.50 0.35 0.77 0.79 0.50 0.28 0.30 0.25 0.25 0.25 0.32 0.39 0.57 0.42 0.76 0.51 0.33 0.26 0.27 0.23 0.26 0.25 0.29 0.36 0.37 0.47 0.49 0.48 0.40 0.49 0.53 0.72 0.77 0.83 0.85 0.93 0.83 0.79 0.80 0.80 0.84 0.66 0.58 0.62 0.60 0.62 0.61 0.68 0.72 0.74 0.94 1.51 1.47 0.51 0.63 0.59 0.93 2.02 2.57 2.29 2.09 1.79 1.56 1.37 1.35 1.05 0.97 0.80 0.72 0.60 0.50 0.44 0.44 0.40 0.37 0.35 0.34 0.31 0.30 0.26 0.25 0.25 0.24 0.26 0.27 0.30 0.30 0.32 0.34 0.31 0.33 0.34 0.33 0.37 0.38 0.38 0.39 0.41 0.43 0.50 0.50 0.48 0.49 0.47 0.47 0.55 0.56 0.60 0.70 0.79 0.98 1.00 1.12 1.06 1.11 1.08 1.26 1.14 1.13 0.92 0.82 +1 37.37 20.20 2.46 1.91 1.58 1.25 1.03 0.93 1.33 2.83 5.64 1.29 3.03 1.51 2.23 2.10 1.48 2.65 1.43 0.74 1.00 0.71 3.25 1.34 0.84 0.62 0.55 0.52 0.47 0.69 0.59 1.23 1.72 0.66 0.49 0.40 0.55 0.69 0.66 0.87 0.71 0.56 0.46 0.55 0.41 0.39 0.34 0.33 0.31 0.35 0.36 0.35 0.39 0.35 0.33 0.38 0.38 0.43 0.45 0.49 0.52 0.64 0.81 0.80 0.95 1.02 1.39 1.48 1.66 1.54 1.34 0.91 0.83 0.82 0.82 0.90 0.82 0.83 0.81 0.90 1.11 1.31 1.45 0.89 0.48 0.41 1.29 2.19 2.14 1.66 1.90 1.37 1.46 1.07 0.79 0.77 0.70 0.68 0.69 0.72 0.65 0.61 0.52 0.49 0.44 0.46 0.42 0.42 0.40 0.38 0.38 0.48 0.40 0.45 0.50 0.53 0.59 0.60 0.65 0.52 0.49 0.51 0.52 0.63 0.64 0.84 0.82 0.87 0.96 0.84 0.88 0.81 0.86 0.72 0.79 0.72 0.60 0.59 0.54 0.65 0.73 0.86 1.18 1.34 1.21 1.07 0.99 1.09 1.23 1.25 +1 24.90 22.14 4.33 2.84 2.30 1.75 1.41 1.40 1.77 3.52 4.25 1.74 2.92 2.08 2.11 2.33 1.00 1.16 0.96 1.06 1.51 1.30 1.20 0.70 0.64 0.55 0.53 0.46 0.59 0.71 0.66 1.04 1.17 1.09 0.70 0.38 0.40 0.34 0.38 0.45 0.49 0.64 0.55 0.61 0.46 0.35 0.34 0.33 0.32 0.30 0.27 0.32 0.35 0.32 0.36 0.47 0.46 0.42 0.48 0.52 0.58 0.65 0.81 0.96 1.19 1.61 1.42 1.11 0.87 0.86 0.90 0.80 0.58 0.59 0.71 0.64 0.63 0.62 0.63 0.74 0.78 0.77 0.99 1.38 1.44 1.20 0.78 1.57 2.11 2.32 2.21 1.98 1.90 1.62 1.15 1.02 0.87 0.84 0.75 0.74 0.74 0.72 0.61 0.63 0.57 0.56 0.51 0.40 0.36 0.37 0.36 0.41 0.37 0.40 0.39 0.37 0.38 0.37 0.36 0.35 0.36 0.41 0.45 0.46 0.50 0.54 0.52 0.53 0.55 0.56 0.64 0.72 0.80 0.69 0.61 0.54 0.50 0.53 0.57 0.63 0.79 0.88 0.82 0.85 0.76 0.83 0.90 0.84 0.92 0.98 +1 26.40 22.80 4.41 3.07 2.31 1.79 1.42 1.27 1.54 3.52 5.68 1.27 2.72 2.35 2.02 2.32 1.31 1.65 1.21 1.12 1.38 1.35 0.89 0.68 0.56 0.57 0.49 0.50 0.53 0.66 0.56 0.84 0.82 0.49 0.38 0.43 0.44 0.43 0.51 0.55 0.54 0.43 0.42 0.39 0.33 0.30 0.28 0.32 0.30 0.32 0.36 0.36 0.44 0.41 0.44 0.49 0.41 0.43 0.47 0.55 0.62 0.81 0.81 0.78 0.85 0.90 0.98 0.85 0.86 0.79 0.82 0.87 0.80 0.63 0.59 0.80 0.81 0.85 0.96 1.00 1.05 1.38 1.72 1.67 1.08 0.87 0.79 0.82 1.68 1.91 1.55 1.38 1.16 0.93 0.92 0.82 0.78 0.68 0.57 0.55 0.51 0.43 0.39 0.38 0.37 0.36 0.36 0.33 0.30 0.32 0.33 0.34 0.40 0.39 0.41 0.42 0.45 0.42 0.42 0.43 0.51 0.56 0.54 0.55 0.49 0.47 0.46 0.51 0.53 0.53 0.49 0.47 0.46 0.43 0.47 0.54 0.60 0.66 0.76 0.87 0.98 1.05 1.11 1.07 0.97 0.99 0.92 0.82 0.77 0.65 +1 29.46 15.93 3.06 2.35 1.65 1.41 1.17 1.08 1.37 2.69 3.30 1.12 3.84 2.71 1.25 2.35 2.14 2.60 1.62 0.91 0.97 1.52 2.17 1.59 1.29 0.89 0.65 0.52 0.50 0.58 0.59 1.27 1.46 1.23 0.58 0.54 0.40 0.38 0.41 0.44 0.47 0.68 0.69 0.64 0.47 0.35 0.29 0.31 0.28 0.30 0.33 0.28 0.39 0.39 0.52 0.64 0.62 0.66 0.67 0.60 0.58 0.76 0.90 0.92 1.29 1.45 1.52 1.36 1.32 1.25 0.84 1.00 1.04 1.11 1.09 1.08 1.04 1.05 0.96 0.94 1.52 0.82 0.76 1.28 1.23 1.77 2.66 3.95 3.98 3.35 2.65 2.20 2.04 1.60 1.79 1.42 1.50 1.36 1.23 1.43 1.13 1.39 0.98 1.01 0.92 0.89 1.03 0.84 1.08 1.00 1.11 1.16 0.97 1.15 0.86 0.95 0.65 0.75 0.79 0.79 1.04 0.99 1.29 1.22 1.28 1.39 1.30 1.46 1.25 1.45 1.36 1.79 2.12 2.52 2.28 1.80 2.03 2.10 2.12 2.37 2.23 2.70 2.58 2.87 2.70 3.11 3.27 3.69 3.61 2.93 +1 31.72 28.17 4.86 3.03 2.48 1.94 1.47 1.28 1.64 3.47 3.94 1.74 3.16 4.00 1.53 1.88 1.34 1.10 1.92 1.05 0.98 0.84 1.00 0.74 0.78 0.70 0.67 0.55 0.71 1.00 0.78 1.05 1.06 1.29 0.65 0.54 0.44 0.45 0.52 0.63 0.97 0.76 0.58 0.55 0.61 0.45 0.38 0.36 0.36 0.35 0.37 0.44 0.52 0.42 0.48 0.53 0.47 0.45 0.42 0.43 0.41 0.50 0.57 0.64 0.77 0.92 0.99 1.07 1.24 1.73 2.03 1.03 1.12 1.16 0.91 0.91 0.94 0.99 1.02 0.97 1.10 1.64 2.53 1.00 0.69 1.41 1.26 2.04 3.24 3.71 2.54 2.14 2.12 1.84 1.50 1.28 1.03 0.90 0.78 0.76 0.69 0.56 0.57 0.48 0.50 0.52 0.49 0.47 0.45 0.49 0.49 0.51 0.58 0.57 0.57 0.59 0.52 0.52 0.56 0.57 0.58 0.67 0.69 0.69 0.72 0.68 0.60 0.58 0.55 0.54 0.61 0.75 0.78 0.89 0.76 0.65 0.65 0.64 0.64 0.67 0.72 0.95 1.13 1.31 1.45 1.67 1.36 1.44 1.36 1.47 +1 53.88 20.23 2.40 1.69 1.15 0.97 0.78 0.74 0.88 2.46 3.61 0.98 1.73 0.89 1.26 1.22 0.93 1.74 0.97 1.35 1.72 1.87 1.22 0.86 0.60 0.42 0.47 0.32 0.34 0.39 0.32 0.46 0.82 0.51 0.28 0.30 0.25 0.29 0.28 0.37 0.40 0.58 0.74 1.22 0.49 0.43 0.37 0.30 0.27 0.25 0.28 0.30 0.31 0.33 0.36 0.41 0.39 0.37 0.42 0.42 0.49 0.58 0.70 0.87 0.96 1.11 1.35 1.35 1.44 1.58 1.41 1.31 1.05 0.85 0.88 0.89 0.98 0.93 1.11 1.21 1.16 1.55 1.96 0.79 0.77 1.28 1.39 0.94 1.58 1.85 1.87 1.96 2.07 1.98 1.52 1.17 0.79 0.88 0.62 0.62 0.52 0.44 0.44 0.46 0.41 0.40 0.41 0.39 0.36 0.38 0.43 0.47 0.44 0.42 0.38 0.35 0.35 0.29 0.35 0.32 0.37 0.41 0.48 0.44 0.48 0.49 0.49 0.48 0.48 0.47 0.54 0.50 0.54 0.68 0.85 0.90 0.77 0.72 0.76 0.75 0.86 0.97 1.14 1.10 1.10 1.02 0.93 1.08 1.09 1.32 +1 32.58 29.66 4.92 3.10 2.46 2.01 1.44 1.26 1.54 2.57 5.93 1.62 2.64 1.83 1.96 2.47 1.50 2.21 2.44 1.53 1.98 1.50 2.76 2.59 1.48 0.94 0.81 0.58 0.70 0.75 0.55 0.82 0.97 0.62 0.57 0.41 0.48 0.41 0.59 0.53 0.57 0.90 0.81 1.04 0.53 0.53 0.47 0.42 0.41 0.37 0.40 0.37 0.48 0.48 0.36 0.56 0.56 0.55 0.59 0.73 0.88 0.84 0.83 0.71 0.99 1.01 1.26 0.99 0.77 0.67 0.64 0.60 0.60 0.73 0.71 0.64 0.80 0.87 0.89 0.96 1.07 1.18 1.49 1.65 1.63 1.05 1.64 2.46 1.97 1.52 1.42 1.12 0.92 0.73 0.60 0.63 0.57 0.52 0.49 0.57 0.54 0.49 0.42 0.37 0.36 0.35 0.33 0.29 0.29 0.29 0.30 0.31 0.30 0.32 0.34 0.30 0.30 0.28 0.33 0.32 0.37 0.40 0.39 0.42 0.44 0.48 0.46 0.52 0.54 0.53 0.60 0.54 0.49 0.43 0.41 0.51 0.46 0.47 0.48 0.57 0.57 0.69 0.87 0.89 0.89 0.86 0.95 1.01 1.04 0.97 +1 42.40 25.27 2.82 2.31 1.76 2.01 1.40 1.45 1.81 2.93 5.17 1.82 2.63 1.93 2.62 1.60 1.20 1.67 0.89 0.79 1.50 1.23 1.41 0.79 0.60 0.50 0.47 0.36 0.40 0.45 0.37 0.41 0.71 0.38 0.36 0.31 0.31 0.26 0.31 0.37 0.58 0.79 0.42 0.50 0.37 0.29 0.21 0.21 0.26 0.25 0.25 0.26 0.30 0.25 0.30 0.32 0.32 0.35 0.35 0.43 0.50 0.54 0.69 0.66 0.56 0.57 0.86 0.91 0.77 0.72 0.70 0.73 0.68 0.68 0.56 0.48 0.58 0.61 0.68 0.71 1.04 0.46 0.46 0.90 0.48 1.06 1.60 1.85 1.84 1.82 1.46 1.29 1.21 1.05 0.83 0.74 0.64 0.61 0.58 0.49 0.45 0.42 0.45 0.42 0.44 0.43 0.42 0.38 0.35 0.36 0.35 0.38 0.37 0.37 0.39 0.43 0.38 0.39 0.38 0.43 0.50 0.58 0.63 0.62 0.64 0.63 0.64 0.65 0.64 0.61 0.68 0.76 0.74 0.69 0.69 0.67 0.77 0.75 0.73 0.72 0.71 0.65 0.66 0.69 0.68 0.74 0.79 1.01 1.11 1.26 +1 33.89 24.27 4.47 3.10 2.45 1.86 1.49 1.38 1.69 3.58 6.18 1.30 5.05 1.58 1.28 1.83 1.81 2.33 1.57 1.99 1.75 1.30 1.34 0.79 0.59 0.55 0.54 0.46 0.42 0.42 0.37 0.53 0.81 0.57 0.37 0.38 0.41 0.41 0.46 0.48 0.64 0.78 0.53 0.82 0.40 0.39 0.34 0.34 0.33 0.32 0.32 0.36 0.41 0.36 0.42 0.54 0.53 0.58 0.61 0.83 0.83 0.92 0.89 0.96 0.99 1.05 0.93 0.81 0.78 0.83 0.74 0.74 0.67 0.71 0.66 0.89 1.12 1.31 1.49 1.50 0.80 0.38 0.89 0.48 1.13 2.09 2.42 1.93 1.55 1.28 1.09 0.98 0.83 0.78 0.65 0.59 0.66 0.62 0.65 0.58 0.57 0.58 0.54 0.53 0.50 0.46 0.38 0.35 0.36 0.35 0.38 0.42 0.41 0.43 0.42 0.47 0.42 0.38 0.39 0.43 0.48 0.53 0.53 0.53 0.55 0.57 0.50 0.53 0.49 0.51 0.57 0.55 0.54 0.49 0.46 0.51 0.55 0.59 0.55 0.66 0.68 0.70 0.74 0.86 0.79 0.97 1.00 1.37 1.44 1.57 +1 31.39 21.79 3.70 3.04 2.08 2.51 2.02 1.88 3.27 4.98 6.27 2.52 6.32 5.65 3.07 2.81 1.56 1.66 0.86 0.93 0.93 0.77 1.09 0.60 0.94 0.82 0.85 0.44 0.46 0.61 0.51 0.66 0.70 0.50 0.34 0.28 0.27 0.27 0.26 0.26 0.38 0.66 0.35 0.45 0.28 0.26 0.25 0.23 0.22 0.22 0.24 0.24 0.27 0.26 0.31 0.35 0.36 0.37 0.43 0.48 0.63 0.70 0.80 0.78 0.76 0.69 0.74 0.74 0.80 0.72 0.66 0.66 0.67 0.67 0.63 0.65 0.60 0.62 0.70 0.94 0.76 0.31 0.59 0.88 0.45 0.99 1.36 1.62 1.82 2.05 2.34 1.83 1.47 1.27 0.98 0.93 0.77 0.68 0.62 0.61 0.55 0.56 0.55 0.52 0.50 0.45 0.43 0.37 0.32 0.35 0.35 0.39 0.39 0.36 0.37 0.35 0.37 0.33 0.37 0.41 0.47 0.55 0.60 0.63 0.77 0.83 0.89 0.96 1.11 1.27 1.39 1.62 1.43 1.43 1.33 1.16 1.22 1.18 1.15 1.13 1.02 1.05 1.08 1.30 1.44 1.70 1.58 1.76 1.88 2.18 +1 31.88 26.84 4.96 3.59 2.66 1.97 1.56 1.40 1.45 3.23 3.57 1.57 3.19 1.61 1.11 1.44 1.14 1.90 2.33 1.74 1.82 1.70 1.36 1.69 1.50 0.85 0.93 0.65 0.65 0.80 0.54 0.75 0.88 0.67 0.51 0.44 0.50 0.49 0.57 0.52 0.66 0.84 0.81 0.80 0.56 0.64 0.52 0.46 0.50 0.31 0.37 0.41 0.45 0.40 0.41 0.65 0.50 0.41 0.40 0.50 0.59 0.69 0.84 0.83 1.10 1.12 1.26 1.17 0.98 0.92 0.87 0.71 0.65 0.82 0.80 0.74 0.76 0.73 0.88 1.08 1.25 0.39 0.66 0.94 0.65 1.23 1.84 2.33 2.84 2.16 1.88 1.31 1.11 0.95 0.79 0.76 0.71 0.68 0.59 0.54 0.48 0.51 0.45 0.40 0.42 0.40 0.39 0.42 0.38 0.32 0.34 0.32 0.34 0.36 0.37 0.39 0.39 0.37 0.36 0.30 0.32 0.32 0.33 0.30 0.33 0.37 0.41 0.45 0.42 0.43 0.47 0.48 0.46 0.53 0.56 0.56 0.58 0.63 0.57 0.63 0.66 0.75 0.94 1.12 1.32 1.31 1.35 1.43 1.56 1.57 +1 32.02 30.05 4.81 3.35 2.70 2.60 2.23 2.32 3.86 4.77 8.30 3.10 3.72 2.30 2.80 3.19 2.37 2.77 1.73 1.91 2.02 2.48 2.78 1.64 1.76 1.27 1.85 1.46 1.38 1.39 0.95 1.28 0.78 1.01 0.51 0.53 0.44 0.35 0.41 0.40 0.50 0.66 0.72 0.57 0.48 0.37 0.32 0.35 0.28 0.32 0.35 0.35 0.38 0.39 0.42 0.49 0.51 0.49 0.55 0.73 0.83 0.81 0.75 0.74 0.75 0.76 0.94 0.87 0.83 0.86 0.92 0.84 0.98 0.96 0.79 0.67 0.74 0.84 0.82 0.97 1.20 1.17 0.89 0.85 0.77 0.75 1.63 0.54 1.39 1.99 1.76 1.38 0.99 0.99 0.83 0.79 0.66 0.64 0.58 0.47 0.43 0.41 0.39 0.37 0.37 0.35 0.34 0.30 0.29 0.27 0.26 0.28 0.24 0.26 0.25 0.25 0.26 0.25 0.23 0.26 0.27 0.34 0.43 0.52 0.56 0.58 0.67 0.68 0.68 0.66 0.61 0.55 0.48 0.44 0.44 0.51 0.49 0.59 0.66 0.79 1.12 1.37 1.48 1.82 1.52 1.31 1.21 1.09 1.02 1.00 +1 21.38 18.37 1.92 1.18 0.60 0.57 0.48 0.37 0.69 2.27 4.38 1.19 2.22 1.36 1.32 1.16 0.69 1.82 2.86 1.42 1.37 0.97 1.34 0.82 1.30 0.70 0.48 0.43 0.53 0.53 0.46 0.39 0.93 0.46 0.39 0.33 0.41 0.35 0.37 0.44 0.54 0.94 0.72 0.80 0.45 0.47 0.48 0.38 0.38 0.41 0.38 0.42 0.48 0.54 0.49 0.48 0.58 0.50 0.51 0.45 0.55 0.67 0.85 1.08 1.40 1.69 1.63 1.61 1.27 1.30 1.37 1.46 1.39 1.07 1.13 1.09 0.99 0.73 0.77 0.78 1.05 1.57 2.09 2.32 1.50 0.72 1.63 1.66 1.47 2.27 3.44 3.67 2.80 2.01 1.75 1.41 1.30 1.07 0.89 0.89 0.82 0.76 0.76 0.77 0.75 0.81 0.68 0.66 0.54 0.50 0.53 0.58 0.69 0.74 0.74 0.63 0.64 0.59 0.59 0.63 0.71 0.85 0.85 0.75 0.90 0.78 0.70 0.81 0.76 0.79 0.78 0.76 0.84 0.79 0.77 0.79 0.80 0.88 0.87 0.89 0.84 0.81 0.77 0.74 0.78 0.98 1.28 1.47 1.57 1.62 +1 18.37 23.18 1.76 0.85 0.38 0.43 0.45 0.39 0.77 2.46 3.44 0.75 1.57 0.81 1.47 1.38 0.93 2.08 3.17 1.33 1.17 0.83 1.61 0.78 1.23 0.83 0.57 0.50 0.52 0.60 0.63 0.45 1.22 0.52 0.60 0.39 0.38 0.38 0.57 0.86 1.17 1.36 0.81 0.68 0.79 0.41 0.40 0.36 0.43 0.38 0.39 0.41 0.43 0.60 0.51 0.53 0.47 0.44 0.49 0.56 0.54 0.74 0.76 0.88 0.99 1.07 1.40 1.91 1.60 1.52 1.20 0.94 0.78 0.83 0.88 0.95 1.00 1.03 1.13 1.30 1.17 0.54 0.89 1.15 1.45 1.63 2.20 2.83 3.21 3.50 3.48 3.39 3.16 2.53 2.28 2.11 1.68 1.44 1.29 1.18 1.08 1.00 0.93 0.97 0.97 0.87 0.78 0.63 0.54 0.53 0.58 0.53 0.57 0.57 0.61 0.62 0.58 0.65 0.64 0.75 0.80 0.86 0.87 0.84 0.81 0.83 0.89 0.93 0.95 0.95 0.87 0.92 0.90 0.99 1.04 1.11 1.01 0.94 0.90 0.96 1.07 1.08 1.09 1.02 1.17 1.29 1.19 1.23 1.24 1.27 diff --git a/data/L30fft16.out b/data/L30fft16.out new file mode 100644 index 0000000..3358fdd --- /dev/null +++ b/data/L30fft16.out @@ -0,0 +1,54 @@ +53 16 +0 389.05 133.34 62.14 32.60 36.97 29.03 62.28 114.07 79.41 212.39 70.29 36.73 31.30 76.01 103.99 214.09 +0 324.10 185.78 53.32 42.18 33.74 30.92 64.02 96.03 81.98 170.60 60.72 33.12 27.39 53.91 92.18 132.29 +0 337.26 172.77 67.46 35.96 28.25 23.16 45.26 73.37 67.25 152.17 47.03 29.95 35.61 47.26 88.57 162.72 +0 374.35 296.55 62.14 35.16 36.96 28.18 56.53 75.65 78.38 162.61 56.70 30.64 32.97 67.67 104.95 200.48 +0 363.99 270.16 57.34 37.74 36.75 23.03 52.53 83.38 77.21 144.07 60.19 43.87 39.82 74.65 138.00 134.36 +0 451.01 330.85 99.71 56.79 56.01 41.09 85.36 128.34 85.71 153.54 65.00 41.44 37.51 59.31 122.89 113.58 +0 379.95 293.99 81.84 47.81 34.40 24.66 71.39 119.74 102.66 191.83 77.68 46.95 55.56 125.88 140.75 206.51 +0 394.40 145.07 71.63 40.96 43.49 32.47 63.88 95.54 77.51 183.66 81.59 34.37 33.57 86.55 106.25 138.53 +0 423.49 184.24 68.79 57.62 39.71 34.94 76.70 127.91 91.56 191.60 56.62 31.34 42.80 78.53 86.65 166.32 +0 327.95 227.49 71.65 30.59 25.42 29.93 52.06 80.28 95.60 133.54 47.18 55.04 43.04 90.17 163.09 223.91 +0 385.59 220.88 71.88 78.68 54.42 32.75 58.84 98.70 96.27 190.03 91.75 43.93 50.09 58.10 82.29 121.77 +0 380.33 166.52 54.72 72.84 52.19 39.06 68.98 153.62 106.08 204.99 89.83 59.51 33.84 64.06 99.44 145.30 +0 436.20 213.06 67.31 58.24 49.71 33.79 62.87 126.26 90.95 225.95 99.53 65.23 47.70 121.35 149.46 311.34 +0 365.29 239.79 107.11 83.75 70.09 75.96 127.97 121.83 129.51 194.37 59.35 43.39 32.79 66.23 95.44 146.08 +0 688.01 222.50 91.42 52.63 44.97 32.32 65.25 80.79 81.48 136.00 45.98 33.35 34.36 38.46 35.42 71.39 +0 581.05 277.65 95.05 64.03 52.50 32.67 67.44 89.28 86.24 141.64 54.55 24.51 23.83 29.41 35.47 55.73 +0 650.12 195.28 65.50 47.66 38.33 25.62 45.81 49.89 54.93 101.53 38.42 23.66 23.82 39.67 57.97 80.14 +0 613.10 240.01 82.24 48.66 43.29 30.90 71.40 86.73 76.72 134.38 50.07 29.28 36.82 62.52 100.02 190.73 +0 527.66 184.18 72.22 40.83 34.06 28.06 45.01 73.51 84.49 130.87 78.83 30.55 27.25 53.92 53.40 66.50 +0 620.78 185.55 67.55 38.99 33.61 25.54 48.07 52.24 57.41 105.72 38.41 28.96 27.80 40.99 49.20 89.65 +0 564.65 517.17 110.90 45.18 50.97 45.71 97.75 101.35 132.78 149.10 57.57 34.17 27.53 41.78 64.44 98.19 +0 500.22 149.52 53.79 29.07 28.01 22.29 59.76 64.63 81.64 128.85 49.73 39.06 48.43 89.61 125.78 212.88 +0 518.35 178.87 63.43 40.01 35.40 24.00 57.15 81.89 93.39 123.57 52.03 36.53 49.48 79.02 82.25 88.21 +0 574.24 160.93 64.06 39.41 45.47 28.03 68.70 93.94 70.14 134.93 46.60 26.06 44.03 39.25 40.72 78.29 +0 638.52 178.17 66.92 45.03 43.57 27.93 68.36 81.30 87.46 129.58 40.97 26.11 31.13 46.12 56.60 111.59 +0 619.89 166.02 69.66 45.44 51.53 28.35 55.50 79.83 82.19 161.87 95.30 41.36 42.37 57.67 67.42 91.15 +0 567.86 196.90 75.48 40.91 40.34 35.26 64.99 87.48 86.66 123.50 46.99 27.50 38.25 52.67 91.76 114.06 +0 573.97 197.02 78.31 44.47 35.05 36.57 64.28 99.10 92.27 167.30 112.29 62.95 60.07 64.26 67.67 99.04 +0 516.91 156.94 66.41 39.24 31.43 26.32 58.10 80.33 90.94 143.02 80.78 37.06 31.23 39.68 55.76 82.35 +0 543.44 170.13 54.80 29.22 39.59 27.32 46.44 51.96 71.75 119.28 43.78 27.93 25.37 40.24 33.08 57.47 +0 620.51 163.79 84.81 43.58 51.24 31.56 57.05 82.62 74.72 162.18 55.19 34.99 29.84 52.49 70.95 200.03 +0 553.81 309.61 150.57 65.60 51.72 29.03 74.68 85.62 81.26 138.50 56.57 31.15 38.69 87.42 90.10 119.21 +0 520.29 178.60 79.88 36.25 40.71 31.86 60.44 91.46 85.34 142.43 50.83 31.99 38.69 91.42 120.63 181.23 +0 625.94 202.08 62.10 50.04 43.89 29.81 59.95 83.72 100.06 134.74 58.36 31.45 33.43 41.91 80.15 161.63 +1 760.65 259.02 91.07 51.30 41.26 29.00 58.41 65.18 94.50 105.50 46.02 27.85 30.93 42.72 48.63 92.02 +1 555.11 175.20 81.95 45.45 41.89 28.51 70.02 115.11 120.38 159.98 50.25 30.61 31.39 43.05 70.35 59.41 +1 714.99 337.78 86.18 44.02 52.22 44.06 77.35 115.06 137.99 146.81 49.80 34.03 34.06 44.42 56.66 83.59 +1 600.63 264.10 74.51 58.27 39.50 34.39 43.47 51.51 89.11 129.46 47.81 40.45 62.69 119.12 110.59 122.86 +1 555.65 153.23 61.37 39.27 36.50 29.70 60.31 61.58 74.82 151.64 56.47 25.41 27.77 38.04 58.79 92.98 +1 640.88 220.98 92.35 66.39 48.73 30.67 57.64 104.29 85.79 127.28 58.95 37.21 46.92 69.47 60.41 100.01 +1 592.67 199.84 77.53 63.53 41.05 29.97 67.59 76.91 74.57 151.45 71.65 39.01 33.03 47.61 55.67 77.13 +1 614.21 217.55 73.17 49.25 36.67 33.68 58.64 70.25 100.42 107.36 53.77 30.38 39.40 44.31 55.79 80.33 +1 543.20 214.33 100.56 68.16 42.76 33.70 74.82 102.74 93.61 230.61 118.02 88.20 78.63 118.37 189.92 267.11 +1 722.19 218.05 71.53 71.39 52.59 37.45 48.67 108.72 105.27 193.02 76.71 43.48 50.38 55.76 62.64 119.86 +1 776.90 144.36 84.33 35.37 46.72 27.55 55.88 108.38 100.02 143.58 66.53 36.20 32.15 42.31 65.97 96.45 +1 744.23 227.00 137.16 55.99 57.06 37.88 68.17 67.92 97.75 125.85 46.50 27.89 28.96 43.58 42.78 80.12 +1 765.63 203.79 73.34 35.06 36.65 23.53 44.28 63.51 56.69 125.47 50.04 33.98 37.83 56.93 63.14 76.88 +1 706.03 238.59 89.54 41.43 46.74 33.73 72.71 67.66 87.31 125.57 52.98 35.68 38.48 46.88 49.09 94.08 +1 676.94 326.98 71.22 40.78 30.39 23.06 53.55 61.35 56.81 140.22 60.29 35.25 35.23 87.33 109.02 140.23 +1 717.32 191.14 118.29 55.38 56.95 38.62 61.65 80.18 72.46 147.61 52.71 32.62 30.96 34.72 50.20 112.43 +1 789.22 321.61 166.56 74.93 42.55 32.92 61.68 77.11 79.65 108.98 49.79 26.97 23.40 52.92 53.61 114.17 +1 428.81 171.97 89.48 42.50 49.86 39.08 72.94 118.26 115.75 186.50 92.81 56.18 60.41 69.21 72.81 99.44 +1 438.88 161.21 88.47 51.06 67.14 39.54 61.10 106.92 91.50 248.35 124.17 60.37 59.80 77.50 86.56 104.43 diff --git a/data/L30fft25.out b/data/L30fft25.out new file mode 100644 index 0000000..e68242d --- /dev/null +++ b/data/L30fft25.out @@ -0,0 +1,54 @@ +53 25 +0 239.71 46.53 40.65 35.90 14.97 14.95 15.28 12.27 10.76 18.93 29.56 52.61 35.26 31.97 74.13 79.94 24.81 18.05 11.91 12.80 20.15 38.00 41.81 66.70 90.68 +0 191.07 69.64 61.85 24.73 19.13 19.65 12.88 13.01 11.84 17.96 31.15 44.20 30.89 35.01 71.31 53.30 21.90 15.07 12.28 11.20 12.48 31.05 39.59 39.67 59.03 +0 202.23 66.08 52.75 40.38 12.44 17.31 8.94 12.85 8.78 10.98 24.77 33.38 22.39 28.53 63.91 47.00 17.16 12.71 13.12 14.14 17.18 21.79 37.27 46.54 73.13 +0 219.53 104.16 101.37 31.81 16.58 16.20 13.75 13.38 10.77 14.41 30.05 31.95 26.89 36.62 60.97 56.87 20.35 13.55 11.70 12.86 22.31 31.76 42.51 56.60 91.20 +0 214.02 101.11 86.30 30.72 16.41 15.98 10.41 16.63 8.96 12.64 27.60 35.56 29.91 32.59 57.47 51.51 21.00 17.74 18.42 15.22 21.10 39.85 60.08 46.99 59.57 +0 258.36 130.43 105.33 50.03 27.68 24.50 17.62 24.87 15.65 21.96 44.05 57.19 36.46 36.30 61.92 54.00 23.77 18.57 15.44 14.91 18.18 31.36 53.89 41.19 50.16 +0 223.70 125.05 78.29 42.92 19.14 22.04 10.27 16.56 9.61 14.15 40.09 55.58 34.04 46.05 81.61 61.70 28.01 19.45 18.94 21.50 38.69 61.22 57.69 59.06 96.01 +0 239.06 48.84 50.93 41.23 16.20 18.31 17.57 15.16 12.91 16.38 33.90 41.56 30.17 32.55 60.34 81.95 27.18 15.77 13.14 14.00 15.17 52.56 42.49 42.91 63.25 +0 251.49 74.09 60.42 35.49 19.49 27.32 13.86 15.97 13.67 19.30 39.68 59.87 38.05 38.25 88.06 46.28 22.11 15.12 12.44 16.92 25.63 37.68 33.91 43.18 78.78 +0 195.37 85.58 68.11 41.08 15.22 13.59 9.31 10.24 10.52 20.40 21.73 32.70 38.98 38.07 60.90 35.22 17.40 21.22 22.98 16.18 23.48 49.32 66.15 68.97 103.70 +0 228.40 88.88 60.75 45.03 18.11 39.52 17.84 23.03 13.15 15.78 30.12 41.06 35.21 43.24 71.93 71.15 34.95 20.15 17.67 19.32 23.85 25.83 32.44 39.68 54.06 +0 230.23 69.47 46.45 28.51 16.81 37.40 15.55 23.79 15.46 18.96 34.87 65.14 52.44 42.10 79.02 77.73 29.61 30.29 17.64 13.69 15.58 37.42 41.69 37.27 70.12 +0 257.01 86.60 66.19 36.53 17.33 29.07 15.29 21.26 12.99 18.09 32.01 54.12 40.41 39.04 84.41 82.19 36.05 33.64 20.25 17.71 41.74 51.84 58.72 88.18 140.99 +0 219.91 87.06 72.91 59.29 23.43 38.92 29.61 27.98 33.53 31.88 65.92 53.81 39.36 58.17 88.66 56.93 17.95 18.83 15.42 12.66 16.78 36.45 38.22 41.02 69.55 +0 407.69 85.16 84.38 47.78 23.46 23.60 18.04 16.06 12.73 16.46 33.25 34.10 30.50 35.07 57.01 42.21 16.65 13.77 13.74 13.47 15.97 15.20 12.60 25.30 28.91 +0 345.36 81.28 116.25 41.58 35.10 28.58 19.03 19.93 12.68 18.21 34.72 39.14 30.10 36.93 66.15 38.73 21.06 10.44 10.47 9.32 10.45 13.45 14.29 19.24 22.93 +0 385.95 80.88 71.27 30.76 22.10 19.30 17.47 12.27 10.29 12.96 22.05 21.53 17.26 24.39 42.01 34.33 13.66 10.00 9.64 9.23 12.83 18.27 21.11 34.81 30.37 +0 362.91 92.37 86.86 36.64 27.43 20.18 16.23 17.09 12.02 16.83 37.18 39.96 26.90 32.66 61.48 38.20 18.43 12.55 12.07 14.41 22.59 27.20 43.73 60.09 78.67 +0 308.18 74.28 69.91 37.47 18.13 17.34 12.72 13.55 11.25 13.20 22.59 31.76 27.38 39.19 49.52 52.51 29.31 15.50 10.34 10.13 17.44 24.62 20.67 27.98 25.42 +0 362.62 89.45 60.55 34.02 18.24 16.67 13.91 12.21 10.33 12.43 24.11 19.44 21.98 25.55 43.35 34.60 13.70 11.52 12.16 11.11 13.68 19.88 20.41 27.38 37.72 +0 325.74 117.67 237.94 61.53 28.39 17.26 22.35 16.47 16.68 33.86 42.30 43.66 40.43 58.26 64.30 48.39 20.57 14.88 13.61 10.76 12.60 20.23 22.15 39.05 40.49 +0 304.45 53.40 54.32 29.21 12.40 13.17 10.26 11.01 8.38 13.57 30.84 29.33 22.02 40.02 52.40 41.01 18.67 16.50 15.54 17.43 33.54 38.69 50.07 55.98 105.51 +0 313.75 65.58 61.61 35.84 14.70 16.68 17.88 10.87 9.51 13.26 30.23 37.69 26.02 42.70 50.75 42.09 19.27 16.64 14.79 18.56 30.71 33.09 31.59 39.69 33.32 +0 352.81 54.33 58.23 36.26 14.69 17.83 21.02 12.90 10.90 15.73 37.00 43.23 25.88 30.70 59.44 37.78 17.69 11.80 11.16 19.32 16.05 16.52 15.74 24.88 33.52 +0 386.43 66.08 63.68 37.18 18.62 20.07 17.15 15.27 10.90 14.11 37.77 34.80 29.51 37.68 59.04 35.35 15.23 11.48 10.95 12.06 15.93 21.93 21.07 36.25 46.79 +0 378.14 62.32 58.76 37.36 16.70 19.94 21.94 16.66 10.64 15.04 28.74 34.76 26.07 36.97 57.21 72.71 33.90 19.33 14.84 17.21 20.62 27.42 27.05 30.96 38.69 +0 334.67 77.31 73.29 37.92 19.52 17.11 17.96 14.19 14.12 17.19 33.26 38.98 29.82 37.00 56.78 36.38 16.87 11.14 12.35 15.36 18.69 23.83 34.37 50.98 43.07 +0 337.85 74.54 76.50 41.68 19.17 18.98 13.36 14.32 13.90 19.67 31.70 40.07 39.89 37.76 71.69 58.21 45.00 27.79 26.23 24.21 23.20 28.79 27.22 35.47 40.06 +0 317.55 49.15 58.29 39.81 13.79 18.04 12.69 11.40 10.67 13.56 30.47 35.85 27.49 43.44 45.79 64.40 29.53 19.79 11.22 12.73 15.98 16.28 22.90 26.65 36.45 +0 331.89 65.35 54.80 29.66 14.17 12.29 16.38 13.13 10.79 14.87 21.26 21.66 23.27 30.85 53.15 34.88 16.27 10.69 12.28 9.68 13.38 18.10 12.54 16.85 26.44 +0 369.55 66.47 55.17 48.22 22.26 18.30 19.09 20.29 12.01 15.46 29.40 38.42 23.99 33.74 69.14 49.30 19.83 16.15 12.42 12.08 15.53 26.18 26.58 47.73 95.23 +0 316.40 106.94 109.54 91.56 37.58 25.29 25.06 14.10 11.07 16.45 39.75 36.56 31.50 33.15 62.67 39.39 21.99 14.99 11.29 14.59 26.19 44.73 38.20 34.36 53.96 +0 313.88 60.41 67.62 38.92 23.15 15.55 17.13 13.87 11.81 19.01 29.34 38.19 35.25 34.75 53.70 50.15 18.77 15.13 11.60 15.17 25.14 47.23 46.29 60.95 78.74 +0 365.60 93.98 66.01 30.49 19.74 22.85 17.02 16.55 11.22 15.97 30.55 36.05 28.90 49.58 48.32 50.30 22.94 13.23 13.09 13.51 14.82 20.10 34.49 45.46 71.40 +1 448.59 93.27 103.89 47.18 25.75 22.01 16.82 15.11 11.21 15.29 28.81 27.09 25.20 46.07 48.97 29.92 18.15 10.42 12.11 12.26 16.19 18.70 16.86 34.42 36.12 +1 335.48 61.32 66.75 42.12 21.01 18.44 19.72 12.91 10.87 16.42 38.84 47.44 37.76 55.99 77.48 39.94 18.75 14.77 10.72 12.70 15.69 19.30 28.15 31.41 20.56 +1 423.79 99.86 143.52 44.04 24.28 18.46 23.66 15.52 16.61 24.50 37.04 48.39 50.47 54.24 71.09 38.90 18.99 15.09 12.77 13.55 16.70 19.40 21.57 33.43 32.12 +1 357.04 105.54 87.89 33.72 25.64 27.03 14.02 16.79 12.82 16.82 18.96 20.63 22.95 42.60 63.45 31.36 18.77 14.34 19.06 24.00 44.86 49.00 44.24 52.44 46.46 +1 342.27 51.01 53.76 32.83 18.26 17.87 12.29 15.07 10.80 17.24 29.70 26.59 23.01 34.52 64.86 47.07 20.01 12.14 9.22 11.59 13.25 16.92 20.76 37.04 37.38 +1 388.28 78.77 77.81 50.82 21.77 30.45 24.28 14.70 12.69 14.94 29.24 49.31 30.04 38.52 51.76 41.32 24.05 16.08 15.03 20.52 22.40 31.31 24.75 33.55 40.75 +1 349.32 84.90 69.07 39.97 20.92 30.10 16.19 15.65 11.15 16.61 35.50 35.16 22.51 33.24 58.10 56.02 27.68 19.10 13.58 13.11 16.56 22.00 21.26 27.75 32.43 +1 364.39 88.56 74.19 39.16 20.01 20.83 17.28 12.17 13.19 16.89 29.11 30.49 26.86 47.08 44.19 38.98 20.02 12.91 12.73 15.44 18.69 17.97 19.35 35.71 29.97 +1 322.92 64.51 89.34 52.35 26.28 33.84 17.05 16.09 12.24 21.87 36.85 43.07 37.88 38.50 103.34 68.99 46.18 35.25 37.20 29.54 43.65 53.77 76.38 91.01 115.93 +1 432.91 80.99 78.08 38.90 26.24 32.14 22.77 17.23 15.10 16.44 23.43 48.54 36.48 48.57 77.95 65.24 27.32 17.72 18.73 19.99 24.08 22.32 25.73 34.64 52.91 +1 481.64 56.92 46.33 47.72 15.01 16.21 13.70 20.64 10.50 14.27 29.18 50.52 33.15 45.82 48.85 61.59 22.60 14.78 15.05 12.18 16.32 17.75 27.36 34.40 39.95 +1 447.99 86.52 75.60 76.13 31.25 23.67 21.21 22.23 15.13 20.67 32.46 28.14 26.65 44.49 61.79 30.60 18.91 12.44 11.04 11.30 15.25 19.11 16.67 25.39 34.57 +1 459.06 87.58 69.40 39.39 16.61 15.19 15.89 11.68 9.58 12.47 21.55 27.90 21.58 25.14 53.40 37.97 18.65 15.01 13.20 14.54 21.98 24.37 25.64 24.89 35.65 +1 419.91 94.52 82.22 52.31 17.71 18.21 19.45 16.45 12.81 21.20 34.01 28.57 33.90 32.05 62.37 28.94 21.72 16.28 14.16 15.16 19.21 19.01 18.72 25.72 44.79 +1 386.75 126.03 125.49 31.20 24.50 17.87 12.65 10.75 9.00 13.89 26.45 25.58 23.06 24.44 52.91 50.29 22.12 16.55 13.03 13.45 24.09 44.80 45.61 40.94 66.06 +1 431.06 76.57 62.27 63.40 32.08 22.86 21.43 22.56 14.77 17.24 32.05 34.40 27.52 31.22 68.30 38.24 20.36 14.88 12.19 13.01 11.99 15.83 20.31 29.88 52.11 +1 452.95 147.32 101.93 75.47 54.42 29.90 17.03 16.02 12.68 19.40 28.04 31.91 29.08 35.77 43.59 38.66 18.53 12.56 9.58 9.03 17.01 22.88 17.97 45.89 41.39 +1 263.82 59.29 51.02 51.68 23.15 17.69 18.49 19.51 15.86 18.15 38.53 51.32 37.82 53.66 56.99 87.40 33.16 26.04 21.76 22.74 29.06 27.99 29.43 29.20 48.12 +1 269.54 53.40 50.07 51.60 25.01 22.91 28.67 20.16 15.92 17.92 30.96 50.74 33.14 37.41 92.38 98.55 44.30 30.04 20.03 23.47 30.36 33.05 35.79 37.06 45.23 diff --git a/data/L30fft_32.out b/data/L30fft_32.out new file mode 100644 index 0000000..37e7a48 --- /dev/null +++ b/data/L30fft_32.out @@ -0,0 +1,55 @@ +53 32 +0 184.20 10.27 40.46 26.18 20.42 10.79 9.42 6.89 10.41 8.08 5.52 8.95 12.51 18.47 32.67 24.44 20.17 19.57 43.49 62.56 22.04 13.37 10.78 7.62 6.75 8.87 13.94 23.90 25.10 26.78 53.10 53.88 +0 144.26 17.80 57.50 35.40 13.95 12.70 12.97 8.16 8.75 8.12 6.44 8.98 12.08 19.86 27.17 20.90 20.27 20.65 44.31 40.91 18.83 11.75 8.99 7.61 6.97 6.74 8.24 18.34 25.90 20.43 31.44 34.57 +0 154.61 13.94 57.00 29.44 25.23 8.55 11.24 6.74 5.77 8.34 5.41 6.20 6.98 15.60 22.01 14.66 14.80 18.72 36.28 39.96 14.35 9.28 7.67 7.29 9.73 8.09 11.15 12.36 23.78 20.45 36.50 44.66 +0 166.85 20.04 103.26 45.08 19.62 11.45 11.48 6.11 9.67 8.82 5.65 8.41 9.17 19.02 20.90 17.00 17.21 22.06 33.48 47.66 18.15 10.39 8.13 7.19 7.31 9.08 15.28 18.49 27.42 24.89 44.56 55.59 +0 162.94 18.70 88.49 46.83 18.99 9.66 12.95 5.95 7.05 11.32 4.95 6.56 8.50 17.69 22.43 19.27 18.72 19.79 31.86 40.15 19.30 11.04 10.91 10.98 10.24 9.68 14.25 22.78 39.93 29.07 28.88 38.23 +0 192.43 32.60 117.66 48.14 30.78 19.09 17.53 10.88 11.38 16.64 9.17 11.35 14.24 28.19 34.79 29.57 21.13 21.65 35.52 41.28 20.11 12.52 11.31 9.49 9.15 9.57 11.49 17.98 34.22 27.28 25.07 31.41 +0 172.29 17.30 113.80 33.35 27.41 13.53 13.78 10.13 5.97 11.25 5.58 6.74 10.05 25.44 36.54 23.50 20.56 30.76 50.23 45.60 24.33 14.58 11.72 11.78 11.26 16.36 26.02 36.71 41.53 28.83 40.20 62.13 +0 182.79 14.35 37.89 34.64 25.27 10.59 12.28 8.26 11.76 10.00 7.12 9.12 10.54 21.21 27.08 20.86 17.85 20.67 34.64 57.07 28.50 12.67 9.29 7.90 8.42 8.37 10.56 32.39 29.14 24.14 28.78 40.12 +0 188.78 22.91 59.50 32.64 22.94 11.50 18.23 10.62 9.37 10.49 7.32 10.13 12.89 25.32 36.11 27.92 25.13 20.72 55.27 40.61 15.34 12.99 8.66 7.08 9.56 11.71 16.61 22.38 23.52 19.89 33.62 49.31 +0 149.37 14.35 79.69 34.24 23.13 12.73 9.43 5.87 6.17 6.54 5.44 9.49 13.04 12.99 17.40 22.61 28.24 19.72 38.66 28.07 13.23 10.41 13.36 14.16 11.16 10.37 15.89 28.73 41.17 40.51 46.28 65.57 +0 173.83 18.66 69.66 41.00 25.65 10.32 25.50 13.80 11.97 15.30 7.95 8.40 10.41 18.90 25.22 24.17 21.24 26.88 39.90 55.18 27.93 18.07 11.66 10.37 11.37 13.62 14.09 14.84 21.28 19.93 27.37 33.29 +0 176.09 14.05 57.75 25.51 17.76 9.69 20.87 15.54 10.26 15.85 9.71 9.79 12.13 22.22 39.08 37.83 27.88 25.05 43.39 59.15 27.43 17.69 18.49 11.37 8.96 7.94 10.57 21.22 29.27 20.53 26.38 45.99 +0 193.03 24.50 69.40 37.42 22.69 11.01 14.96 14.16 10.35 14.50 7.05 9.82 11.53 19.75 32.59 30.59 21.46 24.16 47.59 65.16 26.30 23.64 19.57 13.11 9.62 14.12 29.66 30.80 34.70 39.92 70.93 84.41 +0 168.65 13.90 71.86 48.08 37.78 15.94 19.34 22.55 17.64 17.28 19.24 18.90 21.77 42.08 35.91 25.17 23.84 40.65 49.30 47.94 20.28 9.72 11.86 9.82 7.44 8.94 10.74 22.07 24.97 22.79 27.77 45.00 +0 306.02 38.00 72.07 39.18 30.18 15.54 16.35 9.92 12.16 10.36 7.50 8.66 10.92 21.56 20.52 19.84 18.56 22.28 32.09 35.90 14.39 8.74 8.44 8.21 8.36 8.77 9.78 9.49 7.36 10.23 19.06 16.66 +0 261.35 29.15 84.01 54.89 23.15 24.33 22.38 9.72 12.95 13.33 6.72 9.58 12.64 20.98 26.83 17.86 19.72 23.31 41.34 29.60 17.39 10.02 6.07 6.16 6.21 5.73 6.63 8.06 8.98 8.72 14.44 13.44 +0 290.29 34.77 69.71 27.95 19.15 13.61 14.10 9.74 11.40 7.77 5.99 6.81 8.88 13.99 13.16 11.80 11.06 16.28 23.43 27.40 11.85 7.45 6.05 5.80 5.67 6.21 8.32 11.47 11.28 17.41 22.15 18.04 +0 270.40 36.17 82.71 37.34 21.89 19.21 14.98 9.33 10.73 10.96 6.79 8.63 11.82 23.82 26.44 16.90 17.71 20.68 37.24 29.98 15.29 9.79 7.59 7.09 7.75 10.60 15.13 16.08 26.75 23.06 48.87 46.56 +0 229.10 34.69 63.19 28.96 24.96 11.17 12.73 7.68 8.24 8.80 5.97 8.05 8.36 14.07 19.45 17.38 17.63 24.67 31.93 33.35 25.10 14.47 9.00 6.37 5.87 7.71 11.45 15.43 12.68 14.07 18.61 14.60 +0 269.96 40.44 69.81 23.05 21.66 12.14 11.50 7.99 9.04 7.75 6.09 6.67 8.45 15.56 12.12 13.99 12.67 16.02 25.50 27.41 11.54 7.74 6.91 7.59 6.98 6.86 8.90 11.47 15.17 9.46 21.74 22.98 +0 246.26 36.02 151.28 107.36 36.37 19.01 13.79 8.87 15.14 10.40 8.23 14.60 23.22 25.64 28.85 21.64 32.91 33.41 37.48 37.34 18.13 10.73 8.78 8.35 7.04 6.72 8.44 12.40 12.18 19.84 23.92 25.16 +0 232.29 17.78 51.02 23.78 18.63 8.28 8.83 5.69 6.81 7.22 4.55 6.57 9.51 20.28 18.09 14.29 14.09 26.78 30.75 33.57 14.92 10.04 10.30 9.21 9.38 14.69 21.14 23.67 28.49 34.18 36.91 69.20 +0 238.27 20.92 59.02 30.41 22.17 9.58 11.01 8.98 10.79 6.92 5.24 6.76 9.35 19.15 25.22 15.75 17.16 29.48 27.78 34.01 14.52 11.68 9.95 8.32 10.52 14.15 19.46 20.00 19.42 21.61 24.56 19.69 +0 269.70 17.41 55.12 25.36 22.66 9.41 11.76 7.94 14.58 8.14 6.32 7.70 11.07 23.12 30.30 16.70 16.24 18.90 36.79 30.61 13.47 9.92 6.91 6.16 10.02 11.95 9.57 9.98 9.74 10.62 19.77 19.37 +0 291.67 27.61 56.92 32.17 22.05 11.40 14.02 8.51 11.78 10.00 6.39 7.56 10.15 23.91 22.69 18.04 20.34 23.28 34.33 30.61 12.48 8.14 6.80 6.27 7.26 8.23 9.99 13.03 13.98 14.26 24.87 30.76 +0 287.69 22.25 54.29 28.78 24.01 10.85 13.39 9.30 14.92 10.86 6.39 7.80 9.23 18.46 22.42 17.53 15.67 25.28 30.91 49.96 31.83 16.08 11.55 9.16 9.32 11.81 12.79 15.90 18.51 15.25 22.12 23.34 +0 249.73 34.18 66.98 31.52 23.62 14.14 10.55 9.86 11.27 8.95 7.91 9.68 11.10 21.30 25.29 18.60 20.23 22.91 35.28 26.63 15.20 8.37 6.76 7.00 9.01 10.05 11.90 14.37 19.08 26.60 32.03 25.30 +0 252.89 34.07 58.12 40.45 26.91 12.28 13.61 8.62 8.29 9.26 6.95 11.28 12.33 19.69 22.78 26.80 24.79 21.42 44.89 38.66 32.94 23.44 16.43 15.08 17.14 12.96 14.53 17.56 18.18 15.61 25.39 23.97 +0 242.66 15.78 43.78 34.80 23.97 9.24 12.65 6.97 8.40 7.32 5.96 7.19 9.31 19.67 22.16 18.03 17.66 27.97 23.89 47.39 25.14 15.43 11.73 6.87 7.48 8.12 10.31 9.51 14.05 13.76 18.41 22.63 +0 252.90 18.79 62.40 22.69 17.72 9.69 8.66 5.95 11.24 8.55 5.97 7.67 10.07 13.17 13.50 12.43 16.81 19.07 31.60 28.05 13.82 8.24 6.47 7.46 6.57 6.10 8.87 11.18 8.09 8.47 12.22 16.37 +0 276.14 34.11 50.50 31.46 26.88 15.53 11.58 10.22 12.30 13.34 7.25 8.52 9.45 18.99 24.18 17.22 16.45 20.89 38.86 42.22 16.73 10.90 9.82 7.76 7.29 7.61 10.40 15.70 16.72 18.66 39.81 59.79 +0 236.53 40.39 82.24 72.51 53.22 22.15 23.73 9.10 16.98 8.92 6.46 8.04 11.67 25.54 23.79 19.20 21.21 19.28 38.26 31.10 15.60 12.76 8.83 6.80 7.55 11.69 16.99 26.50 29.61 15.59 24.82 34.75 +0 238.12 22.01 55.70 33.64 21.76 18.26 10.28 7.86 11.62 8.76 6.39 9.50 12.48 17.64 26.07 19.73 21.15 21.56 28.73 42.48 15.05 10.50 9.12 6.90 8.20 11.07 16.91 28.45 30.01 30.23 44.26 46.26 +0 271.57 41.43 72.45 28.69 18.35 12.71 14.83 10.18 11.36 10.60 7.06 7.83 10.84 19.07 23.29 18.63 18.24 31.88 25.89 41.33 17.28 12.03 7.96 7.75 8.61 8.12 9.24 11.62 21.77 18.18 38.11 42.56 +1 337.05 43.30 83.37 46.18 28.09 17.46 16.96 8.68 11.29 9.37 7.04 7.43 10.74 18.33 16.92 15.79 17.14 30.07 31.12 21.65 14.07 9.05 6.28 7.68 6.93 8.44 10.00 11.33 10.49 13.71 24.73 21.34 +1 254.34 23.20 51.20 36.44 27.34 13.67 14.08 8.63 12.80 8.18 5.99 8.20 11.20 23.70 32.13 25.35 21.64 38.52 48.96 31.20 14.75 10.49 9.07 6.31 7.82 7.82 10.00 11.45 16.04 19.11 17.87 11.92 +1 318.37 39.14 96.89 72.31 25.71 17.38 13.67 8.34 16.45 9.66 8.60 13.36 15.72 22.86 31.08 26.50 34.55 34.17 42.84 30.99 15.05 9.93 9.32 7.72 8.21 8.84 10.28 11.89 12.94 15.30 23.32 18.50 +1 267.28 33.04 103.34 28.81 21.01 16.29 19.19 9.94 8.84 10.93 7.06 10.11 9.98 11.67 11.77 14.00 13.79 30.66 39.86 24.99 13.99 9.99 8.61 11.55 12.67 18.45 29.96 29.66 27.00 28.21 32.93 28.65 +1 262.72 15.11 44.08 32.63 18.97 11.73 12.60 7.04 8.28 9.96 5.67 9.16 11.63 18.51 17.43 13.33 16.00 21.42 40.72 34.98 18.53 9.89 7.23 5.52 6.60 7.25 8.45 10.56 11.11 18.17 24.44 22.13 +1 294.93 25.54 65.80 44.68 31.29 14.91 21.26 11.88 15.11 9.34 7.46 7.87 10.21 18.51 32.35 19.80 18.68 24.35 31.15 32.42 16.01 13.55 9.73 8.95 11.37 12.07 15.01 19.51 16.75 13.60 25.04 24.73 +1 261.16 35.17 66.75 33.22 26.74 12.07 18.06 13.70 10.44 10.12 6.67 8.29 10.89 22.80 23.55 14.99 14.40 22.83 31.99 43.70 20.65 15.36 11.41 8.18 8.40 8.11 10.81 12.87 14.44 13.34 18.11 20.32 +1 272.46 34.67 71.50 37.32 24.40 12.19 15.25 9.36 10.85 7.50 7.21 9.60 11.18 18.12 19.11 16.03 19.29 30.89 24.03 29.65 16.83 10.24 7.85 7.34 9.22 10.38 11.10 11.14 10.50 17.20 22.98 17.35 +1 242.91 28.67 62.63 44.59 29.97 20.37 19.60 14.43 10.90 10.51 6.55 10.27 14.20 23.18 28.75 22.63 22.14 24.52 65.68 49.59 32.91 26.38 20.33 23.82 18.94 20.12 28.20 30.86 47.38 47.46 60.49 73.18 +1 325.17 35.93 74.79 34.30 20.82 14.96 20.30 15.37 15.49 10.84 8.16 10.54 9.56 14.74 28.98 25.39 21.14 31.53 44.16 52.28 24.64 13.84 10.84 10.90 12.29 12.89 14.90 12.95 16.79 14.52 27.99 31.61 +1 369.75 18.65 45.09 27.07 30.81 11.38 10.43 7.25 9.38 13.99 6.09 7.67 9.24 18.65 30.36 23.77 22.40 27.76 28.87 42.63 22.60 11.08 9.00 9.10 8.18 7.88 10.34 10.81 15.82 16.99 23.54 24.58 +1 336.86 35.26 67.14 46.40 43.73 24.96 16.78 11.19 14.09 14.40 8.77 10.16 14.93 19.18 19.52 14.45 18.13 30.55 38.85 24.24 12.58 10.76 7.37 6.60 6.80 7.66 9.64 12.10 10.12 11.26 18.23 21.73 +1 347.20 35.61 69.37 32.59 24.86 11.90 10.30 7.24 10.65 7.68 5.44 6.31 8.83 13.22 17.44 14.36 13.62 14.73 33.32 29.33 15.11 10.04 9.06 7.97 8.62 10.25 13.95 14.48 15.61 15.99 14.97 23.17 +1 315.37 37.63 79.73 39.74 32.22 12.57 11.32 9.41 12.72 10.67 7.33 9.49 15.20 20.97 18.46 15.58 27.90 15.67 41.50 21.39 13.85 12.65 9.51 8.35 9.46 9.75 11.84 11.61 11.10 13.35 17.56 29.14 +1 287.72 50.72 121.22 42.38 19.15 16.49 13.04 7.34 8.29 6.93 5.02 6.50 10.27 16.43 16.21 14.47 15.16 13.31 30.94 39.02 17.77 12.51 9.78 7.92 7.82 9.68 16.47 26.86 29.81 24.90 27.91 41.70 +1 323.15 35.55 60.72 34.79 35.50 23.75 16.16 11.54 13.73 14.75 9.10 10.23 10.77 19.95 23.25 16.86 18.23 18.13 42.11 31.51 15.73 10.86 8.89 7.44 8.29 7.19 7.59 9.72 11.56 13.49 23.53 32.28 +1 337.83 56.74 106.02 54.87 46.56 36.71 24.65 12.82 11.16 10.13 7.23 9.18 14.04 16.80 18.95 19.61 17.82 22.01 23.89 30.56 15.65 9.33 7.57 5.95 5.56 6.08 12.14 14.30 10.29 16.37 33.36 23.68 +1 202.47 11.91 52.61 33.38 29.28 15.46 12.56 8.71 12.14 12.82 8.54 11.02 11.29 25.09 31.61 27.62 18.99 38.82 29.81 63.37 28.86 17.71 16.02 12.10 15.08 15.07 17.43 17.12 17.57 18.85 17.38 32.20 +1 208.15 11.23 41.29 39.29 27.51 16.72 15.42 10.10 20.29 13.31 8.61 11.16 11.07 19.35 34.13 19.40 23.72 21.93 53.78 70.16 39.48 23.01 18.28 11.95 13.21 16.57 18.50 20.24 21.93 21.37 24.43 27.73 + \ No newline at end of file diff --git a/data/L30fft_64.out b/data/L30fft_64.out new file mode 100644 index 0000000..9601a18 --- /dev/null +++ b/data/L30fft_64.out @@ -0,0 +1,55 @@ +53 64 +0 85.26 6.84 2.54 2.54 12.43 7.85 4.88 8.15 6.11 4.13 3.45 1.94 1.77 2.94 2.11 1.35 2.26 2.93 2.57 1.48 1.32 1.43 1.98 2.45 2.92 3.31 4.28 4.90 7.44 8.86 6.88 5.43 5.24 4.89 6.01 3.73 8.70 12.66 17.50 14.06 6.77 4.43 3.63 3.12 2.82 2.58 1.99 1.83 1.63 1.75 2.12 2.28 3.09 3.79 5.73 6.19 5.95 6.45 6.43 6.82 11.03 15.07 14.29 12.99 +0 63.47 8.66 4.18 4.72 16.50 12.25 10.63 7.08 3.45 3.55 3.51 2.86 2.46 3.99 2.62 1.48 1.39 2.92 2.54 1.58 1.53 1.68 2.09 2.38 2.74 3.31 4.40 5.46 6.34 7.23 6.09 4.47 4.57 5.50 7.67 2.68 7.95 13.90 12.13 8.61 5.63 3.86 3.11 2.80 2.35 2.19 2.03 1.78 1.75 1.73 1.69 1.70 1.76 2.31 3.45 5.50 6.60 6.40 5.42 4.87 5.92 9.52 9.85 7.68 +0 70.40 6.91 2.91 4.01 15.21 13.34 6.77 7.93 5.01 7.62 2.58 1.70 2.04 3.59 2.28 1.09 1.45 1.44 2.55 1.61 1.46 1.25 1.42 1.66 1.56 1.90 2.84 4.89 5.32 5.67 4.17 3.24 3.36 3.95 4.90 4.41 5.22 12.52 12.40 8.03 4.34 3.02 2.52 2.15 1.95 1.89 1.63 2.00 2.52 2.34 1.87 2.14 2.80 2.78 2.84 3.27 5.86 6.01 4.79 5.36 7.21 10.70 10.23 11.85 +0 75.82 7.61 4.11 5.70 25.39 26.53 15.21 7.37 3.84 5.98 3.56 2.17 2.10 3.65 1.93 1.11 1.62 3.22 2.99 1.43 1.29 1.54 1.95 2.24 2.07 2.45 3.69 5.77 5.66 4.83 4.35 4.15 3.82 4.73 5.80 5.42 3.65 12.47 14.89 9.34 5.51 3.75 2.90 2.34 2.07 2.01 1.92 1.70 1.87 1.78 2.03 2.44 3.57 4.00 4.40 4.80 7.31 6.44 5.65 6.69 9.27 12.55 14.76 13.30 +0 73.42 8.05 3.89 5.22 25.29 19.16 15.27 8.25 4.55 4.95 2.43 2.40 2.78 3.71 1.72 1.26 1.23 2.24 4.20 1.53 1.17 1.28 1.59 1.70 2.00 2.22 3.47 5.32 5.44 5.77 5.06 4.55 4.31 5.03 6.61 3.31 8.13 7.52 12.69 7.62 5.94 3.80 3.03 2.55 2.57 2.87 2.64 2.81 2.96 2.22 2.24 2.57 3.25 3.80 4.54 6.70 9.73 10.17 7.45 7.19 7.13 7.18 9.52 9.63 +0 82.97 13.26 7.90 8.11 32.19 27.00 15.55 8.77 5.47 9.91 5.88 3.68 3.97 4.81 3.17 2.30 2.27 3.39 5.64 2.69 2.26 2.30 2.58 3.09 3.38 3.73 5.87 8.08 8.70 8.77 8.45 6.39 4.43 5.98 4.19 6.71 6.47 11.18 12.01 8.82 5.81 4.32 3.41 2.89 2.94 2.74 2.38 2.35 2.34 2.26 2.26 2.48 2.74 2.98 3.57 5.25 8.30 8.72 7.21 6.51 6.06 6.37 7.09 8.47 +0 80.02 6.13 2.77 5.75 26.50 30.46 9.31 7.40 3.69 10.01 4.52 2.27 2.50 4.39 2.90 2.17 1.32 1.66 4.05 1.58 1.31 1.48 1.60 1.76 2.26 2.73 4.86 7.78 10.25 7.97 6.97 4.91 5.13 5.17 6.33 9.02 9.07 15.82 12.78 10.15 7.30 5.04 3.90 3.42 2.96 2.93 3.00 2.90 2.74 2.84 3.59 4.53 5.95 6.95 8.18 10.02 11.30 9.68 6.43 7.81 9.73 10.32 13.50 17.18 +0 83.79 7.61 3.36 3.77 10.75 8.25 6.53 10.78 6.37 6.27 3.11 2.12 2.42 3.76 2.35 1.78 2.70 3.18 3.66 1.36 1.47 2.06 2.10 2.45 2.22 3.02 4.51 5.97 7.48 6.11 5.46 5.03 4.16 4.73 4.56 5.68 5.84 11.30 13.15 15.64 8.78 5.61 3.53 2.89 2.41 2.24 1.93 2.00 2.12 2.09 2.19 2.01 2.06 3.11 6.02 9.85 8.65 6.12 6.01 6.07 6.34 7.92 9.26 10.56 +0 82.49 11.91 6.20 5.21 16.29 13.52 9.44 6.92 5.65 5.82 3.07 2.68 3.45 5.62 3.74 1.61 1.86 2.80 3.64 1.63 1.64 2.02 2.25 2.79 2.74 3.68 5.01 7.55 8.13 9.87 8.50 5.51 5.60 7.10 3.38 6.97 12.03 15.04 13.84 7.01 4.22 3.47 3.34 3.20 2.57 1.81 1.66 1.87 2.30 2.44 2.72 3.07 4.01 4.32 4.65 6.35 6.96 5.00 4.57 5.23 6.85 9.67 11.69 12.86 +0 68.89 5.80 2.90 4.09 20.69 19.29 9.53 7.60 4.15 7.39 4.59 1.81 1.95 2.76 1.83 1.12 1.10 1.95 2.02 1.27 1.31 1.40 1.89 2.83 3.18 3.31 3.26 3.24 3.94 4.74 6.57 4.72 6.53 7.52 4.24 5.76 8.25 10.81 8.49 5.75 3.85 2.85 2.57 2.61 3.04 3.59 3.48 3.60 3.20 2.45 2.34 2.80 3.50 4.36 5.42 8.67 10.57 9.91 10.16 10.26 10.10 12.73 15.65 16.93 +0 78.43 8.48 4.03 4.92 22.06 13.12 10.69 9.82 6.60 6.23 2.92 2.24 3.46 9.28 4.71 2.20 2.67 3.25 5.60 2.12 1.98 1.98 2.05 2.17 2.51 2.65 3.72 5.64 6.32 6.31 6.26 5.81 4.64 5.92 8.90 4.59 6.06 13.36 17.49 10.52 7.78 6.29 4.85 4.27 3.29 2.57 2.40 2.76 3.04 2.66 3.04 3.69 3.75 3.36 3.27 4.03 5.69 4.98 4.41 5.47 6.13 7.44 7.64 9.00 +0 80.80 7.25 3.21 3.81 17.28 11.61 6.08 6.67 4.26 4.60 2.61 2.25 3.13 7.29 5.55 2.24 1.67 3.40 5.41 2.56 2.43 2.41 2.21 2.69 2.98 3.07 3.95 6.97 9.41 10.09 9.89 9.09 6.62 7.36 6.48 5.88 8.27 13.11 17.60 12.27 9.03 4.94 4.12 4.68 5.24 4.09 3.28 2.43 2.36 2.17 1.98 1.99 2.25 2.92 4.05 6.36 8.45 6.30 5.38 4.92 6.03 6.94 9.60 13.09 +0 82.93 13.59 6.35 5.66 19.80 15.10 10.74 7.96 6.72 4.65 3.12 2.40 2.61 4.88 5.32 1.76 2.40 2.77 5.16 2.12 1.75 1.76 2.29 2.61 2.85 2.89 3.64 6.08 7.77 8.56 8.38 6.97 5.20 5.52 7.52 4.60 8.19 15.22 18.95 13.84 8.16 5.24 5.44 6.30 5.70 4.17 3.57 3.04 2.52 2.34 2.97 3.96 6.33 8.30 7.74 7.70 8.73 8.48 9.52 10.41 13.74 20.59 23.71 19.36 +0 76.95 7.38 3.02 3.83 23.54 12.48 12.49 11.57 5.76 12.87 5.07 3.14 3.28 6.41 6.11 5.17 3.85 4.96 5.45 3.07 4.52 5.21 5.13 4.24 4.75 6.20 8.97 11.98 10.15 7.86 7.09 5.53 6.36 5.59 8.80 11.37 7.63 16.49 16.45 8.01 7.12 3.36 2.46 2.41 2.89 3.02 2.71 2.23 2.01 1.74 1.98 2.44 2.37 2.94 4.50 6.42 6.99 5.58 5.36 5.93 6.46 7.17 10.78 11.81 +0 135.42 17.59 10.05 8.95 19.79 16.29 11.08 8.53 4.58 10.50 4.53 3.27 3.37 4.83 2.97 1.99 2.10 3.95 3.21 2.01 1.78 1.95 1.93 2.38 2.46 3.00 4.69 5.98 4.99 5.32 5.45 4.47 4.61 4.69 6.91 4.22 5.31 10.55 11.51 6.70 4.21 3.10 2.31 2.07 2.14 2.10 1.87 2.21 2.14 2.07 2.01 2.33 2.52 2.37 2.63 2.17 1.89 1.80 2.06 2.93 4.22 5.21 4.40 4.07 +0 119.36 11.32 6.99 7.59 20.61 21.32 15.35 12.25 4.87 6.67 7.36 4.79 4.48 6.75 2.94 1.93 2.01 4.42 4.46 2.30 1.64 1.72 2.20 2.59 2.66 3.60 3.79 6.60 8.18 5.34 4.49 4.40 4.67 5.15 7.66 3.96 8.67 11.96 9.17 5.82 4.66 4.08 2.93 2.15 1.66 1.39 1.52 1.54 1.74 1.39 1.37 1.48 1.56 1.74 1.97 2.07 2.33 2.15 2.09 2.23 3.10 4.04 3.74 3.06 +0 128.92 16.23 9.12 8.27 19.07 15.79 7.85 6.17 4.29 5.20 4.01 2.87 3.61 3.45 2.81 2.06 2.44 3.24 2.29 1.61 1.47 1.53 1.67 1.71 2.04 2.39 3.28 3.71 3.33 3.27 3.29 2.63 2.53 2.96 4.93 3.02 5.10 6.65 8.22 5.58 3.70 2.35 2.00 1.75 1.55 1.48 1.39 1.51 1.50 1.35 1.39 1.69 1.98 2.15 2.85 2.86 2.67 2.94 3.82 4.80 5.55 5.53 4.65 4.38 +0 117.90 17.31 10.25 7.81 23.71 17.68 11.99 6.70 4.15 6.78 5.84 3.78 3.58 3.93 2.58 2.07 2.07 3.28 3.53 1.98 1.74 1.64 1.88 2.43 2.32 3.54 4.59 7.30 7.49 5.69 4.53 3.95 4.36 4.28 4.37 6.11 6.21 12.23 9.42 5.84 4.46 3.20 2.81 2.15 1.95 1.84 1.70 1.84 1.98 1.88 2.41 2.85 3.36 4.13 4.19 3.85 5.53 7.70 5.90 5.67 10.06 13.93 12.87 10.69 +0 98.91 15.65 9.18 8.13 16.86 14.80 8.93 5.54 5.88 6.61 2.98 2.62 2.91 3.49 2.14 1.68 1.62 2.51 2.72 1.69 1.42 1.54 1.94 2.10 1.84 2.33 2.84 4.10 4.74 5.01 4.76 3.94 4.19 4.62 5.86 6.61 5.22 10.43 8.32 8.43 7.11 5.60 4.02 3.23 2.46 2.14 1.70 1.49 1.52 1.41 1.59 2.20 2.63 3.04 3.56 4.17 3.31 3.06 3.22 3.73 4.33 4.96 3.61 3.78 +0 116.34 18.64 10.86 9.32 20.57 14.39 6.88 4.70 5.62 5.19 3.36 2.72 2.62 3.15 2.19 1.78 1.92 2.61 2.08 1.81 1.48 1.57 1.59 1.71 1.83 2.37 3.66 4.13 3.17 2.90 3.14 3.81 3.00 3.35 4.21 3.80 4.04 8.54 8.26 5.60 3.54 2.33 2.05 1.82 1.73 1.75 1.82 1.98 1.70 1.79 1.60 1.82 2.11 2.31 2.57 3.13 4.14 3.50 2.08 2.55 4.82 5.97 5.67 5.83 +0 112.50 10.62 7.50 10.52 29.30 46.07 32.71 21.40 11.48 6.75 5.37 4.14 3.62 3.32 2.22 2.17 3.20 4.37 3.07 2.22 1.93 2.14 3.13 4.17 5.35 6.21 5.81 6.94 7.37 7.15 5.14 5.62 6.85 9.22 11.54 5.33 7.92 10.82 11.16 7.71 5.31 3.87 2.76 2.64 2.34 2.06 2.04 2.15 1.95 1.60 1.62 1.71 1.84 2.35 3.02 3.16 2.88 3.20 3.90 5.83 6.19 5.79 6.18 6.36 +0 107.51 8.64 4.56 4.27 14.35 11.23 6.28 5.61 3.87 5.45 2.39 1.75 1.65 2.77 1.63 1.21 1.17 2.22 2.41 1.22 1.09 1.19 1.45 1.84 1.86 2.82 4.77 5.40 4.94 4.12 4.15 3.00 3.61 3.42 6.38 7.11 4.91 10.07 10.80 6.23 4.28 3.32 2.76 2.26 2.57 2.57 2.33 2.27 2.56 2.15 2.94 4.21 5.67 4.99 5.09 6.65 6.69 7.38 8.45 8.70 7.82 10.37 16.09 18.09 +0 109.76 9.37 5.56 4.91 17.83 11.67 8.12 7.05 5.97 5.14 2.65 2.18 2.13 3.38 2.03 2.45 3.25 2.16 1.95 1.53 1.32 1.30 1.62 1.74 1.93 2.72 3.86 5.62 6.82 5.78 4.09 3.84 4.31 4.23 5.47 9.17 5.04 8.71 10.51 6.73 4.37 2.99 2.91 2.93 2.71 2.32 1.86 2.26 2.75 2.51 2.98 3.94 5.08 4.66 4.86 5.15 5.15 4.59 4.95 5.77 6.37 5.97 5.17 4.70 +0 125.93 8.93 4.69 3.99 14.50 13.09 6.49 6.19 5.85 5.48 2.67 2.06 2.17 3.71 2.37 1.60 3.51 3.77 2.43 1.63 1.60 1.58 1.80 2.03 2.42 3.08 4.38 7.01 8.91 6.39 4.43 4.00 3.82 4.25 5.73 3.79 6.77 11.29 9.49 6.15 3.87 2.95 2.61 2.36 1.94 1.54 1.36 1.71 2.20 2.73 3.28 2.72 2.42 2.38 2.48 2.52 2.54 2.34 2.40 2.86 3.89 5.78 5.23 4.60 +0 130.35 15.49 8.09 5.73 16.30 12.16 7.34 8.76 5.09 5.93 3.11 2.62 2.91 4.09 2.61 1.66 2.19 3.67 3.18 1.85 1.55 1.65 1.68 2.09 1.96 3.02 4.42 7.52 6.24 5.11 4.58 4.48 4.72 5.31 7.10 4.59 5.55 11.27 10.14 5.57 3.55 2.77 2.17 1.92 1.74 1.69 1.53 1.57 1.99 1.66 1.86 2.22 2.53 2.46 2.63 3.79 4.01 3.03 3.05 3.98 6.66 5.72 6.57 8.66 +0 132.83 11.01 5.96 5.13 16.65 10.52 7.55 6.87 4.70 7.30 3.23 2.21 2.61 4.09 2.73 1.90 2.92 4.53 3.48 1.99 1.62 1.58 1.66 2.20 2.24 2.39 3.36 5.79 5.74 5.50 4.67 4.07 3.73 4.09 4.92 7.60 5.08 10.19 13.16 11.88 9.54 6.69 4.59 3.51 2.98 2.84 2.47 2.11 2.26 2.38 2.76 3.11 3.21 3.16 3.42 4.44 5.48 3.95 3.65 3.84 4.86 6.18 5.29 6.32 +0 108.41 16.48 9.07 8.01 18.58 14.91 9.22 6.60 4.92 6.88 4.24 2.85 2.38 2.90 2.48 2.42 2.86 2.78 2.44 2.04 1.91 2.06 2.27 2.55 2.55 3.00 4.39 6.08 6.77 5.98 4.99 4.33 4.50 5.52 6.64 4.78 6.28 11.18 7.96 5.65 4.51 3.18 2.33 1.90 1.69 1.69 1.66 1.82 2.31 2.18 2.38 2.61 2.90 3.03 3.16 3.97 4.54 4.92 5.83 7.22 8.50 7.58 7.05 5.82 +0 110.23 16.21 8.88 8.11 17.02 12.08 13.06 7.20 4.55 8.90 3.42 2.73 3.04 3.79 2.35 1.95 1.73 2.40 2.79 1.85 1.55 1.92 2.55 3.07 2.87 3.29 4.10 5.70 6.78 4.53 7.11 6.37 5.79 6.44 7.11 3.70 8.85 13.31 10.28 9.18 8.48 8.15 6.27 5.47 4.75 3.63 3.33 4.05 4.66 4.04 3.28 3.22 3.32 3.90 4.19 4.50 5.01 4.16 3.56 4.18 5.89 6.63 6.17 5.91 +0 113.05 8.28 4.37 3.47 13.52 8.38 7.04 10.36 6.50 5.49 2.71 1.92 2.22 4.11 2.00 1.50 1.76 2.42 2.17 1.50 1.28 1.69 1.70 1.91 1.84 2.77 4.06 5.78 5.28 5.67 5.23 3.94 4.16 4.64 5.77 8.32 5.03 6.55 14.05 9.74 7.32 5.43 4.05 3.67 3.32 2.61 1.82 1.63 1.77 1.95 1.95 2.11 2.47 2.66 2.55 2.21 3.26 3.75 3.22 3.57 4.21 4.97 5.60 5.72 +0 117.69 8.76 5.17 4.20 18.27 12.96 5.68 5.69 4.03 4.82 2.77 2.11 1.89 2.45 1.56 1.40 2.13 3.48 2.69 1.60 1.39 1.59 1.78 2.04 2.13 2.90 2.99 3.54 3.58 3.21 3.01 3.18 3.99 4.39 6.40 3.06 5.08 10.63 8.41 5.76 3.98 2.98 2.29 1.86 1.60 1.62 1.77 1.93 1.87 1.47 1.39 1.64 2.03 2.37 2.59 2.93 2.34 1.77 1.99 2.23 2.51 3.55 3.92 4.20 +0 119.72 18.36 9.74 7.31 14.49 10.79 5.99 9.73 5.83 7.32 5.05 3.06 2.56 3.22 2.61 2.50 1.80 4.31 4.47 2.25 1.80 1.83 1.85 2.40 2.26 2.45 3.73 5.67 6.17 5.82 5.19 3.59 3.63 4.50 6.66 3.82 6.19 12.86 13.51 8.00 5.09 3.43 2.83 2.63 2.59 2.31 2.11 1.83 1.79 1.85 1.90 1.88 2.41 2.75 3.43 4.33 4.63 3.79 4.13 5.10 7.39 12.12 15.33 14.50 +0 105.24 13.02 9.48 10.70 26.08 15.05 13.49 22.70 18.06 8.50 5.91 5.29 6.06 5.81 2.37 2.17 3.41 5.07 2.65 1.83 1.71 1.53 1.84 2.16 2.33 3.41 5.01 7.59 6.89 5.19 4.80 4.80 4.92 5.60 4.09 5.64 6.05 12.83 9.26 6.48 4.47 3.40 3.28 3.15 2.41 2.03 1.73 1.68 1.77 1.99 2.39 3.34 4.05 4.40 5.50 7.54 9.34 5.72 3.71 4.02 5.87 6.40 7.98 9.36 +0 109.00 10.06 5.79 5.19 14.50 13.37 8.49 8.36 5.18 5.52 6.92 2.63 2.33 2.85 1.94 1.98 1.67 4.07 2.78 1.66 1.56 1.63 2.06 2.67 2.95 3.25 3.91 4.87 7.28 5.74 4.53 5.36 5.77 4.81 7.13 3.69 4.47 9.73 13.28 8.16 4.44 3.17 2.82 2.49 2.44 2.12 1.77 1.69 2.02 2.08 2.40 3.05 3.68 4.65 6.38 7.65 8.41 6.75 6.83 8.16 9.40 12.48 11.27 11.94 +0 116.99 18.80 10.98 9.74 22.34 13.87 8.48 5.92 4.88 4.29 3.52 2.85 2.90 4.55 3.13 1.95 1.81 3.88 3.30 2.03 1.84 1.68 1.63 2.24 2.44 2.96 4.19 5.27 5.92 5.74 4.75 4.62 4.11 4.90 8.33 7.81 5.97 6.55 13.04 7.91 4.84 3.89 3.42 2.66 2.06 1.92 1.86 2.01 2.15 2.15 1.95 2.10 2.25 2.36 2.57 3.13 4.91 5.93 4.52 4.54 7.37 11.32 11.09 10.42 +1 151.12 17.41 11.60 10.11 20.80 20.85 13.39 9.79 5.69 8.34 5.14 3.59 3.57 4.97 2.47 1.87 2.12 3.51 2.88 1.84 1.84 1.69 1.69 2.00 2.34 3.02 4.09 4.97 4.54 4.00 3.95 3.94 3.72 4.71 6.87 8.26 5.15 10.25 6.40 4.60 3.80 3.27 2.45 2.14 1.59 1.56 2.20 1.65 1.65 1.80 1.93 2.22 2.68 2.36 2.50 3.14 2.95 2.34 2.70 3.99 5.94 6.38 5.70 5.10 +1 115.75 11.42 6.17 5.42 15.74 9.85 10.44 7.82 4.45 9.10 4.10 2.84 3.11 3.94 2.12 2.14 3.46 2.97 2.39 1.70 1.44 1.56 1.88 2.21 2.55 3.03 4.25 7.46 9.00 7.19 6.27 6.35 5.01 5.70 8.05 11.12 9.66 14.82 9.31 6.50 4.37 3.13 2.81 2.47 2.40 2.14 1.60 1.58 2.07 1.83 1.79 2.10 2.33 2.65 2.51 3.16 3.81 4.17 4.66 4.87 4.83 4.13 3.29 2.80 +1 141.76 17.44 10.42 9.10 24.95 23.38 21.96 14.25 5.91 6.95 5.17 3.51 3.06 3.81 2.23 1.93 3.11 5.10 2.56 2.28 2.07 2.24 2.97 3.61 3.81 4.09 5.08 6.19 7.89 7.66 6.41 6.88 8.74 8.45 10.59 6.40 10.74 10.67 9.59 6.14 4.12 3.51 2.68 2.30 2.32 2.36 1.86 1.97 2.04 2.08 2.08 2.27 2.56 2.62 2.72 3.13 3.34 3.16 3.41 4.16 5.47 6.08 5.42 4.04 +1 116.18 17.47 9.42 7.04 27.62 24.13 6.77 7.63 5.66 4.83 4.68 3.51 3.67 5.87 3.05 1.99 1.96 2.44 3.41 2.06 1.81 1.74 2.27 2.71 2.50 2.56 2.99 2.83 2.79 3.07 3.20 3.75 3.76 3.16 6.14 9.13 6.76 13.03 8.19 4.56 3.74 3.32 2.69 2.31 1.92 2.34 2.92 2.84 3.08 3.26 3.92 5.12 7.02 7.92 7.10 7.81 6.95 6.55 7.02 7.06 8.57 7.90 7.34 6.97 +1 123.97 7.39 3.83 3.68 14.15 7.89 8.47 7.84 4.84 4.66 3.28 2.59 2.39 3.92 2.22 1.29 1.56 2.57 3.31 1.69 1.41 1.42 1.93 2.65 2.39 3.37 4.46 4.80 4.39 4.32 3.36 3.31 3.63 4.29 7.70 3.10 6.83 13.25 9.99 7.69 5.63 3.81 2.71 2.27 1.93 1.72 1.39 1.36 1.55 1.72 1.80 1.83 2.03 2.18 2.51 2.74 2.56 2.98 3.70 5.25 5.93 6.23 6.38 4.79 +1 136.16 11.30 6.75 6.04 20.95 11.96 10.96 11.38 4.72 10.89 4.48 3.02 3.22 7.41 3.02 2.87 4.18 3.41 2.73 1.94 1.78 1.95 1.99 1.96 2.35 2.73 4.01 5.15 7.64 8.53 5.42 4.48 4.75 4.61 6.66 5.58 3.83 11.52 9.26 7.09 4.30 3.79 3.80 3.01 2.60 2.27 2.13 2.37 2.53 3.06 3.31 2.78 3.15 4.30 5.02 4.56 4.51 4.09 3.20 3.52 5.63 6.79 5.59 6.80 +1 113.37 17.22 9.28 8.31 20.58 12.83 10.74 5.88 6.81 6.38 3.35 2.88 3.53 5.50 4.79 2.10 2.18 3.05 3.14 1.92 1.75 1.59 1.83 2.30 2.43 3.00 4.06 7.25 6.94 4.82 4.13 3.47 3.53 3.61 4.27 7.09 5.76 10.05 12.13 9.85 5.93 4.58 4.05 3.67 3.19 2.56 1.99 2.10 2.13 2.06 1.95 2.08 2.49 2.90 2.96 3.41 4.10 3.18 2.86 3.67 4.71 4.38 4.77 5.28 +1 118.27 17.97 9.57 7.75 22.46 13.33 10.49 8.19 6.66 5.54 3.28 2.83 3.30 4.35 2.41 2.26 2.80 2.62 2.17 1.59 1.71 1.89 2.26 2.53 2.33 3.16 4.52 4.57 4.96 4.59 4.44 3.55 4.43 5.17 6.73 8.69 4.70 7.14 9.03 6.04 4.83 3.69 2.92 2.23 2.04 1.89 1.72 1.89 2.24 2.39 2.30 2.87 2.94 2.60 2.84 2.74 2.46 2.77 3.49 4.97 5.94 5.58 4.86 3.90 +1 108.42 13.04 7.54 6.76 14.78 16.60 9.60 12.70 5.17 9.75 7.01 3.24 2.99 6.76 5.11 2.16 2.30 3.17 3.49 1.78 1.59 1.69 2.03 3.07 3.72 3.31 4.55 7.05 7.83 6.56 5.30 5.99 5.83 5.25 6.18 5.93 10.80 21.75 14.54 10.69 8.93 7.28 6.98 6.60 4.95 5.06 5.86 6.09 5.21 4.41 4.32 5.34 6.85 7.50 7.29 8.07 12.23 11.22 11.12 12.65 14.47 15.27 19.04 17.80 +1 143.75 18.85 10.12 7.80 19.51 17.94 8.90 8.23 5.47 4.93 4.02 3.49 4.59 5.58 5.26 2.43 3.01 4.69 3.12 2.36 1.93 2.15 2.51 2.73 2.48 2.31 3.01 4.32 5.67 8.55 7.34 5.62 5.25 5.24 7.76 8.11 6.81 14.73 15.35 11.23 7.46 4.97 4.00 3.00 2.76 2.65 2.56 2.89 3.12 3.03 3.02 3.38 3.80 3.68 3.08 3.33 4.48 3.98 3.51 3.71 5.70 7.91 7.99 7.85 +1 175.16 9.71 5.17 4.18 15.21 7.34 6.39 7.15 8.12 7.28 3.44 2.27 1.93 3.30 2.11 1.51 1.71 2.98 4.77 2.23 1.52 1.52 1.74 2.10 2.14 2.46 3.60 5.62 7.35 7.77 7.25 4.77 5.18 5.89 7.50 6.54 6.88 7.30 10.15 11.05 7.31 4.39 3.13 2.41 2.33 2.20 2.09 2.44 2.24 1.90 1.78 2.09 2.53 2.67 2.61 2.79 3.09 4.72 4.14 4.31 5.70 5.99 5.45 6.77 +1 149.43 19.01 10.06 7.56 21.76 11.86 10.97 12.24 9.34 11.99 8.95 4.02 3.83 4.60 3.12 2.45 2.82 4.20 4.62 2.59 2.29 2.16 2.47 2.59 3.12 4.33 4.38 5.21 5.95 3.79 3.44 3.85 4.24 4.78 6.26 8.88 7.25 12.22 7.56 4.64 3.40 3.00 2.91 2.50 1.98 1.73 1.60 1.69 1.77 1.62 1.72 2.06 2.27 2.55 2.84 3.15 2.57 2.55 2.62 2.95 4.22 4.83 5.28 5.55 +1 160.19 13.42 9.37 8.43 21.27 13.37 8.73 7.64 5.93 6.41 3.48 2.54 2.27 2.88 2.01 1.61 1.75 3.56 2.47 1.40 1.30 1.42 1.45 1.71 1.87 2.50 3.46 3.14 4.71 3.99 3.85 3.40 3.05 3.70 3.94 3.49 6.34 10.07 8.38 6.38 4.29 3.37 2.64 2.40 2.31 2.24 1.96 2.03 2.06 2.22 2.14 2.92 3.44 3.49 3.56 3.68 4.01 3.75 4.13 3.91 3.59 3.86 4.72 6.67 +1 139.26 18.43 9.97 8.78 23.26 16.62 8.77 11.14 9.67 6.42 3.56 2.74 2.24 3.41 2.55 2.16 2.53 3.82 3.37 1.98 1.82 1.85 2.07 2.64 3.16 4.42 5.17 5.24 4.91 4.39 3.98 3.82 5.69 8.10 3.79 4.10 11.10 9.61 6.19 4.65 3.50 3.50 3.24 3.10 2.71 2.11 1.95 2.22 2.30 2.42 2.15 2.71 2.93 3.00 2.75 3.06 2.85 2.68 3.10 3.51 4.03 4.65 6.27 8.21 +1 126.76 17.11 12.52 12.83 30.09 30.52 12.97 8.32 4.96 4.60 4.63 3.63 2.90 3.63 2.21 1.46 1.39 2.75 2.06 1.41 1.25 1.27 1.42 1.81 2.12 2.96 4.22 4.00 4.06 4.06 3.63 3.60 3.43 4.03 3.19 3.64 5.68 9.48 11.74 7.93 5.20 3.83 3.21 3.03 2.67 2.25 1.84 2.11 2.01 1.93 2.04 2.73 3.56 4.57 5.67 7.57 8.20 6.80 6.58 5.94 5.91 7.89 9.17 11.33 +1 140.91 20.67 10.63 7.19 18.24 12.12 6.84 10.53 9.36 8.14 7.86 4.29 3.85 4.25 3.03 2.72 2.86 4.00 4.34 3.06 2.49 2.05 2.27 2.81 2.47 2.91 4.20 5.73 6.55 5.11 4.02 4.39 4.09 4.95 4.53 4.66 6.91 13.75 10.34 5.75 4.31 3.64 2.89 2.57 2.25 2.20 1.91 1.84 1.95 2.17 1.84 1.77 1.71 2.06 2.37 2.46 2.67 3.07 3.32 3.42 4.59 6.99 7.46 8.55 +1 148.94 19.98 13.53 14.87 36.44 16.51 13.96 13.61 11.31 11.93 9.07 9.37 6.68 5.74 4.16 2.23 2.20 3.39 3.14 1.94 1.76 1.87 2.08 2.48 2.83 4.16 4.27 4.15 4.82 4.66 5.09 4.73 3.96 4.81 6.40 4.78 5.90 5.80 9.57 5.99 4.39 3.53 2.51 2.18 2.04 1.77 1.53 1.46 1.39 1.39 1.34 1.66 2.71 3.28 3.76 3.43 2.60 2.59 3.13 4.78 7.95 8.74 6.43 5.52 +1 93.60 7.64 2.97 2.98 16.63 9.69 6.19 10.46 8.52 6.15 5.07 2.66 2.80 3.48 2.35 1.99 2.19 3.87 3.86 2.57 2.07 2.20 2.75 2.74 2.82 2.80 4.28 8.14 8.67 7.12 7.72 6.18 5.38 4.16 7.22 12.12 5.78 8.94 17.19 14.60 8.65 6.00 4.65 4.22 4.29 3.74 2.80 3.19 4.13 3.49 3.24 4.20 4.52 4.24 4.25 4.33 4.39 4.33 4.67 4.78 4.29 4.37 7.17 8.72 +1 97.91 6.17 2.27 3.29 14.49 6.19 7.29 12.34 7.48 6.29 5.40 2.99 2.88 4.83 3.02 2.03 3.60 6.50 4.28 2.45 2.17 2.13 2.73 2.82 2.57 2.93 4.16 5.48 8.64 8.32 5.14 4.66 5.44 6.39 4.92 6.00 9.96 16.55 19.18 16.17 11.97 8.08 6.32 5.28 5.25 3.93 3.01 3.04 3.22 3.35 3.68 4.55 4.61 4.61 5.16 4.97 5.16 5.81 5.26 5.35 5.98 6.23 6.79 6.87 + \ No newline at end of file diff --git a/include/assign2/common.h b/include/assign2/common.h new file mode 100644 index 0000000..769e074 --- /dev/null +++ b/include/assign2/common.h @@ -0,0 +1,36 @@ +#pragma once +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef COSC_4P80_ASSIGNMENT_2_COMMON_H +#define COSC_4P80_ASSIGNMENT_2_COMMON_H + +namespace assign2 +{ + struct data_t + { + bool is_bad = false; + std::vector bins; + }; + + struct data_file_t + { + std::vector data_points; + }; +} + +#endif //COSC_4P80_ASSIGNMENT_2_COMMON_H diff --git a/include/assign2/layer.h b/include/assign2/layer.h new file mode 100644 index 0000000..8b77567 --- /dev/null +++ b/include/assign2/layer.h @@ -0,0 +1,54 @@ +#pragma once +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef COSC_4P80_ASSIGNMENT_2_LAYER_H +#define COSC_4P80_ASSIGNMENT_2_LAYER_H + +#include +#include + +namespace assign2 +{ + + class layer_t + { + public: + using matrix_t = Eigen::Matrix; + using vector_t = Eigen::Matrix; + + layer_t(const blt::i32 in, const blt::i32 out): in_size(in), out_size(out) + {} + + template + vector_t forward(const vector_t & in, ActFunction func = ActFunction{}) + { + vector_t out; + out.resize(out_size, Eigen::NoChange_t{}); + out.noalias() = weights.transpose() * in; + out.colwise() += bias; + return func(out); + } + + private: + const blt::i32 in_size, out_size; + matrix_t weights{}; + vector_t bias{}; + }; +} + +#endif //COSC_4P80_ASSIGNMENT_2_LAYER_H diff --git a/lib/blt b/lib/blt new file mode 160000 index 0000000..e81f590 --- /dev/null +++ b/lib/blt @@ -0,0 +1 @@ +Subproject commit e81f590f5e4f8c79ec99307fcf7d7cbbfcc83217 diff --git a/lib/eigen-3.4.0/.gitignore b/lib/eigen-3.4.0/.gitignore new file mode 100644 index 0000000..f6ab76f --- /dev/null +++ b/lib/eigen-3.4.0/.gitignore @@ -0,0 +1,38 @@ +qrc_*cxx +*.orig +*.pyc +*.diff +diff +*.save +save +*.old +*.gmo +*.qm +core +core.* +*.bak +*~ +*build* +*.moc.* +*.moc +ui_* +CMakeCache.txt +tags +.*.swp +activity.png +*.out +*.php* +*.log +*.orig +*.rej +log +patch +*.patch +a +a.* +lapack/testing +lapack/reference +.*project +.settings +Makefile +!ci/build.gitlab-ci.yml diff --git a/lib/eigen-3.4.0/.gitlab-ci.yml b/lib/eigen-3.4.0/.gitlab-ci.yml new file mode 100644 index 0000000..e5a3c00 --- /dev/null +++ b/lib/eigen-3.4.0/.gitlab-ci.yml @@ -0,0 +1,23 @@ +# This file is part of Eigen, a lightweight C++ template library +# for linear algebra. +# +# Copyright (C) 2020 Arm Ltd. and Contributors +# +# This Source Code Form is subject to the terms of the Mozilla +# Public License v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +stages: + - buildsmoketests + - smoketests + - build + - test + +variables: + BUILDDIR: builddir + EIGEN_CI_CMAKE_GENEATOR: "Ninja" + +include: + - "/ci/smoketests.gitlab-ci.yml" + - "/ci/build.gitlab-ci.yml" + - "/ci/test.gitlab-ci.yml" diff --git a/lib/eigen-3.4.0/.gitlab/issue_templates/Bug Report.md b/lib/eigen-3.4.0/.gitlab/issue_templates/Bug Report.md new file mode 100644 index 0000000..0c49b0f --- /dev/null +++ b/lib/eigen-3.4.0/.gitlab/issue_templates/Bug Report.md @@ -0,0 +1,69 @@ + + +### Summary + + +### Environment + +- **Operating System** : Windows/Linux +- **Architecture** : x64/Arm64/PowerPC ... +- **Eigen Version** : 3.3.9 +- **Compiler Version** : Gcc7.0 +- **Compile Flags** : -O3 -march=native +- **Vector Extension** : SSE/AVX/NEON ... + +### Minimal Example + + +```cpp +//show your code here +``` + +### Steps to reproduce + + +1. first step +2. second step +3. ... + +### What is the current *bug* behavior? + + +### What is the expected *correct* behavior? + + +### Relevant logs + + + +### Warning Messages + + + +### Benchmark scripts and results + + +### Anything else that might help + + +- [ ] Have a plan to fix this issue. diff --git a/lib/eigen-3.4.0/.gitlab/issue_templates/Feature Request.md b/lib/eigen-3.4.0/.gitlab/issue_templates/Feature Request.md new file mode 100644 index 0000000..2c6f908 --- /dev/null +++ b/lib/eigen-3.4.0/.gitlab/issue_templates/Feature Request.md @@ -0,0 +1,7 @@ +### Describe the feature you would like to be implemented. + +### Would such a feature be useful for other users? Why? + +### Any hints on how to implement the requested feature? + +### Additional resources diff --git a/lib/eigen-3.4.0/.gitlab/merge_request_templates/Merge Request Template.md b/lib/eigen-3.4.0/.gitlab/merge_request_templates/Merge Request Template.md new file mode 100644 index 0000000..3fe963a --- /dev/null +++ b/lib/eigen-3.4.0/.gitlab/merge_request_templates/Merge Request Template.md @@ -0,0 +1,26 @@ + + +### Reference issue + + +### What does this implement/fix? + + +### Additional information + diff --git a/lib/eigen-3.4.0/.hgeol b/lib/eigen-3.4.0/.hgeol new file mode 100644 index 0000000..5327df1 --- /dev/null +++ b/lib/eigen-3.4.0/.hgeol @@ -0,0 +1,11 @@ +[patterns] +*.sh = LF +*.MINPACK = CRLF +scripts/*.in = LF +debug/msvc/*.dat = CRLF +debug/msvc/*.natvis = CRLF +unsupported/test/mpreal/*.* = CRLF +** = native + +[repository] +native = LF diff --git a/lib/eigen-3.4.0/CMakeLists.txt b/lib/eigen-3.4.0/CMakeLists.txt new file mode 100644 index 0000000..f3e69b8 --- /dev/null +++ b/lib/eigen-3.4.0/CMakeLists.txt @@ -0,0 +1,653 @@ +# cmake_minimum_require must be the first command of the file +cmake_minimum_required(VERSION 3.5.0) + +project(Eigen3) + +# 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() + + +# Alias Eigen_*_DIR to Eigen3_*_DIR: + +set(Eigen_SOURCE_DIR ${Eigen3_SOURCE_DIR}) +set(Eigen_BINARY_DIR ${Eigen3_BINARY_DIR}) + +# guard against bad build-type strings + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + + +############################################################################# +# retrieve version information # +############################################################################# + +# automatically parse the version number +file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header) +string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") +set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") +set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") +set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") +set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) + +# if we are not in a git clone +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) + # if the git program is absent or this will leave the EIGEN_GIT_REVNUM string empty, + # but won't stop CMake. + execute_process(COMMAND git ls-remote --refs -q ${CMAKE_SOURCE_DIR} HEAD OUTPUT_VARIABLE EIGEN_GIT_OUTPUT) +endif() + +# extract the git rev number from the git output... +if(EIGEN_GIT_OUTPUT) +string(REGEX MATCH "^([0-9;a-f]+).*" EIGEN_GIT_CHANGESET_MATCH "${EIGEN_GIT_OUTPUT}") +set(EIGEN_GIT_REVNUM "${CMAKE_MATCH_1}") +endif() +#...and show it next to the version number +if(EIGEN_GIT_REVNUM) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (git rev ${EIGEN_GIT_REVNUM})") +else() + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") +endif() + +include(CheckCXXCompilerFlag) +include(GNUInstallDirs) +include(CMakeDependentOption) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + + +option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF) + + +macro(ei_add_cxx_compiler_flag FLAG) + string(REGEX REPLACE "-" "" SFLAG1 ${FLAG}) + string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1}) + check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) + if(COMPILER_SUPPORT_${SFLAG}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") + endif() +endmacro() + +check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11) + +if(EIGEN_TEST_CXX11) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_EXTENSIONS OFF) + if(EIGEN_COMPILER_SUPPORT_CPP11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() +else() + #set(CMAKE_CXX_STANDARD 03) + #set(CMAKE_CXX_EXTENSIONS OFF) + ei_add_cxx_compiler_flag("-std=c++03") +endif() + +# Determine if we should build shared libraries on this platform. +get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS) + +############################################################################# +# find how to link to the standard libraries # +############################################################################# + +find_package(StandardMathLibrary) + + +set(EIGEN_TEST_CUSTOM_LINKER_FLAGS "" CACHE STRING "Additional linker flags when linking unit tests.") +set(EIGEN_TEST_CUSTOM_CXX_FLAGS "" CACHE STRING "Additional compiler flags when compiling unit tests.") + +set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "") + +if(NOT STANDARD_MATH_LIBRARY_FOUND) + + message(FATAL_ERROR + "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.") + +else() + + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}") + else() + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}") + endif() + +endif() + +if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}") +else() + message(STATUS "Standard libraries to link to explicitly: none") +endif() + +option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) + +# Disable pkgconfig only for native Windows builds +if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR OFF) + +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") +endif() + +set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") + +if(NOT MSVC) + # We assume that other compilers are partly compatible with GNUCC + + # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag + # adding -Werror turns such warnings into errors + check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) + if(COMPILER_SUPPORT_WERROR) + set(CMAKE_REQUIRED_FLAGS "-Werror") + endif() + ei_add_cxx_compiler_flag("-pedantic") + ei_add_cxx_compiler_flag("-Wall") + ei_add_cxx_compiler_flag("-Wextra") + #ei_add_cxx_compiler_flag("-Weverything") # clang + + ei_add_cxx_compiler_flag("-Wundef") + ei_add_cxx_compiler_flag("-Wcast-align") + ei_add_cxx_compiler_flag("-Wchar-subscripts") + ei_add_cxx_compiler_flag("-Wnon-virtual-dtor") + ei_add_cxx_compiler_flag("-Wunused-local-typedefs") + ei_add_cxx_compiler_flag("-Wpointer-arith") + ei_add_cxx_compiler_flag("-Wwrite-strings") + ei_add_cxx_compiler_flag("-Wformat-security") + ei_add_cxx_compiler_flag("-Wshorten-64-to-32") + ei_add_cxx_compiler_flag("-Wlogical-op") + ei_add_cxx_compiler_flag("-Wenum-conversion") + ei_add_cxx_compiler_flag("-Wc++11-extensions") + ei_add_cxx_compiler_flag("-Wdouble-promotion") +# ei_add_cxx_compiler_flag("-Wconversion") + + ei_add_cxx_compiler_flag("-Wshadow") + + ei_add_cxx_compiler_flag("-Wno-psabi") + ei_add_cxx_compiler_flag("-Wno-variadic-macros") + ei_add_cxx_compiler_flag("-Wno-long-long") + + ei_add_cxx_compiler_flag("-fno-check-new") + ei_add_cxx_compiler_flag("-fno-common") + ei_add_cxx_compiler_flag("-fstrict-aliasing") + ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark + ei_add_cxx_compiler_flag("-wd2304") # disable ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor + + + # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails + # Moreover we should not set both -strict-ansi and -ansi + check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) + ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi' + + if(COMPILER_SUPPORT_STRICTANSI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi") + else() + ei_add_cxx_compiler_flag("-ansi") + endif() + + if(ANDROID_NDK) + ei_add_cxx_compiler_flag("-pie") + ei_add_cxx_compiler_flag("-fPIE") + endif() + + set(CMAKE_REQUIRED_FLAGS "") + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") + message(STATUS "Enabling SSE2 in tests/examples") + endif() + + option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") + message(STATUS "Enabling SSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") + message(STATUS "Enabling SSSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") + message(STATUS "Enabling SSE4.1 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") + message(STATUS "Enabling SSE4.2 in tests/examples") + endif() + + option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) + if(EIGEN_TEST_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") + message(STATUS "Enabling AVX in tests/examples") + endif() + + option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF) + if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") + message(STATUS "Enabling FMA in tests/examples") + endif() + + option(EIGEN_TEST_AVX2 "Enable/Disable AVX2 in tests/examples" OFF) + if(EIGEN_TEST_AVX2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma") + message(STATUS "Enabling AVX2 in tests/examples") + endif() + + option(EIGEN_TEST_AVX512 "Enable/Disable AVX512 in tests/examples" OFF) + if(EIGEN_TEST_AVX512) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mfma") + if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") + endif() + message(STATUS "Enabling AVX512 in tests/examples") + endif() + + option(EIGEN_TEST_AVX512DQ "Enable/Disable AVX512DQ in tests/examples" OFF) + if(EIGEN_TEST_AVX512DQ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512dq") + if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") + endif() + message(STATUS "Enabling AVX512DQ in tests/examples") + endif() + + option(EIGEN_TEST_F16C "Enable/Disable F16C in tests/examples" OFF) + if(EIGEN_TEST_F16C) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mf16c") + message(STATUS "Enabling F16C in tests/examples") + endif() + + option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) + if(EIGEN_TEST_ALTIVEC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") + message(STATUS "Enabling AltiVec in tests/examples") + endif() + + option(EIGEN_TEST_VSX "Enable/Disable VSX in tests/examples" OFF) + if(EIGEN_TEST_VSX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx") + message(STATUS "Enabling VSX in tests/examples") + endif() + + option(EIGEN_TEST_MSA "Enable/Disable MSA in tests/examples" OFF) + if(EIGEN_TEST_MSA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmsa") + message(STATUS "Enabling MSA in tests/examples") + endif() + + option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON) + if(EIGEN_TEST_FMA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") + message(STATUS "Enabling NEON in tests/examples") + endif() + + option(EIGEN_TEST_NEON64 "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + message(STATUS "Enabling NEON in tests/examples") + endif() + + option(EIGEN_TEST_Z13 "Enable/Disable S390X(zEC13) ZVECTOR in tests/examples" OFF) + if(EIGEN_TEST_Z13) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z13 -mzvector") + message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") + endif() + + option(EIGEN_TEST_Z14 "Enable/Disable S390X(zEC14) ZVECTOR in tests/examples" OFF) + if(EIGEN_TEST_Z14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z14 -mzvector") + message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") + endif() + + check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + +else() + + # C4127 - conditional expression is constant + # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) + # We can disable this warning in the unit tests since it is clear that it occurs + # because we are oftentimes returning objects that have a destructor or may + # throw exceptions - in particular in the unit tests we are throwing extra many + # exceptions to cover indexing errors. + # C4505 - unreferenced local function has been removed (impossible to deactivate selectively) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714") + + # replace all /Wx by /W4 + string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + + check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + if(NOT CMAKE_CL_64) + # arch is not supported on 64 bit systems, SSE is enabled automatically. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif() + message(STATUS "Enabling SSE2 in tests/examples") + endif() + + option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) + if(EIGEN_TEST_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX") + message(STATUS "Enabling AVX in tests/examples") + endif() + + option(EIGEN_TEST_FMA "Enable/Disable FMA/AVX2 in tests/examples" OFF) + if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") + message(STATUS "Enabling FMA/AVX2 in tests/examples") + endif() + +endif() + +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) +option(EIGEN_TEST_32BIT "Force generating 32bit code." 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(STATUS "Forcing use of x87 instructions in tests/examples") + else() + message(STATUS "EIGEN_TEST_X87 ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_32BIT) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") + message(STATUS "Forcing generation of 32-bit code in tests/examples") + else() + message(STATUS "EIGEN_TEST_32BIT ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) + add_definitions(-DEIGEN_DONT_VECTORIZE=1) + message(STATUS "Disabling vectorization in tests/examples") +endif() + +option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF) +if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT) + add_definitions(-DEIGEN_DONT_ALIGN=1) + message(STATUS "Disabling alignment in tests/examples") +endif() + +option(EIGEN_TEST_NO_EXCEPTIONS "Disables C++ exceptions" OFF) +if(EIGEN_TEST_NO_EXCEPTIONS) + ei_add_cxx_compiler_flag("-fno-exceptions") + message(STATUS "Disabling exceptions in tests/examples") +endif() + +set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +# Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR +if(EIGEN_INCLUDE_INSTALL_DIR) + message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.") +endif() + +if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR) + set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed") +else() + set(INCLUDE_INSTALL_DIR + "${CMAKE_INSTALL_INCLUDEDIR}/eigen3" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed" + ) +endif() +set(CMAKEPACKAGE_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/eigen3/cmake" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen3Config.cmake is installed" + ) +set(PKGCONFIG_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/pkgconfig" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where eigen3.pc is installed" + ) + +foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR) + # If an absolute path is specified, make it relative to "{CMAKE_INSTALL_PREFIX}". + if(IS_ABSOLUTE "${${var}}") + file(RELATIVE_PATH "${var}" "${CMAKE_INSTALL_PREFIX}" "${${var}}") + endif() +endforeach() + +# similar to set_target_properties but append the property instead of overwriting it +macro(ei_add_target_property target prop value) + + get_target_property(previous ${target} ${prop}) + # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if() + if(NOT previous) + set(previous "") + endif() + set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") +endmacro() + +install(FILES + signature_of_eigen3_matrix_library + DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel + ) + +if(EIGEN_BUILD_PKGCONFIG) + configure_file(eigen3.pc.in eigen3.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc + DESTINATION ${PKGCONFIG_INSTALL_DIR} + ) +endif() + +install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) + + +option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ON) +if(EIGEN_BUILD_DOC) + add_subdirectory(doc EXCLUDE_FROM_ALL) +endif() + + +option(BUILD_TESTING "Enable creation of Eigen tests." ON) +if(BUILD_TESTING) + include(EigenConfigureTesting) + + if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest + else() + add_subdirectory(test EXCLUDE_FROM_ALL) + endif() + + add_subdirectory(failtest) +endif() + +if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(blas) + add_subdirectory(lapack) +else() + add_subdirectory(blas EXCLUDE_FROM_ALL) + add_subdirectory(lapack EXCLUDE_FROM_ALL) +endif() + +# add SYCL +option(EIGEN_TEST_SYCL "Add Sycl support." OFF) +option(EIGEN_SYCL_TRISYCL "Use the triSYCL Sycl implementation (ComputeCPP by default)." OFF) +if(EIGEN_TEST_SYCL) + set (CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "cmake/Modules/" "${CMAKE_MODULE_PATH}") + find_package(Threads REQUIRED) + if(EIGEN_SYCL_TRISYCL) + message(STATUS "Using triSYCL") + include(FindTriSYCL) + else() + message(STATUS "Using ComputeCPP SYCL") + include(FindComputeCpp) + set(COMPUTECPP_DRIVER_DEFAULT_VALUE OFF) + if (NOT MSVC) + set(COMPUTECPP_DRIVER_DEFAULT_VALUE ON) + endif() + option(COMPUTECPP_USE_COMPILER_DRIVER + "Use ComputeCpp driver instead of a 2 steps compilation" + ${COMPUTECPP_DRIVER_DEFAULT_VALUE} + ) + endif(EIGEN_SYCL_TRISYCL) + option(EIGEN_DONT_VECTORIZE_SYCL "Don't use vectorisation in the SYCL tests." OFF) + if(EIGEN_DONT_VECTORIZE_SYCL) + message(STATUS "Disabling SYCL vectorization in tests/examples") + # When disabling SYCL vectorization, also disable Eigen default vectorization + add_definitions(-DEIGEN_DONT_VECTORIZE=1) + add_definitions(-DEIGEN_DONT_VECTORIZE_SYCL=1) + endif() +endif() + +add_subdirectory(unsupported) + +add_subdirectory(demos EXCLUDE_FROM_ALL) + +# must be after test and unsupported, for configuring buildtests.in +add_subdirectory(scripts EXCLUDE_FROM_ALL) + +# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? +if(EIGEN_BUILD_BTL) + add_subdirectory(bench/btl EXCLUDE_FROM_ALL) +endif() + +if(NOT WIN32) + add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) +endif() + +configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) + +if(BUILD_TESTING) + ei_testing_print_summary() +endif() + +message(STATUS "") +message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") +message(STATUS "") + +string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) +if(cmake_generator_tolower MATCHES "makefile") + message(STATUS "Available targets (use: make TARGET):") +else() + message(STATUS "Available targets (use: cmake --build . --target TARGET):") +endif() +message(STATUS "---------+--------------------------------------------------------------") +message(STATUS "Target | Description") +message(STATUS "---------+--------------------------------------------------------------") +message(STATUS "install | Install Eigen. Headers will be installed to:") +message(STATUS " | /") +message(STATUS " | Using the following values:") +message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") +message(STATUS " | Change the install location of Eigen headers using:") +message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") +message(STATUS " | Or:") +message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") +message(STATUS "doc | Generate the API documentation, requires Doxygen & LaTeX") +if(BUILD_TESTING) + message(STATUS "check | Build and run the unit-tests. Read this page:") + message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") +endif() +message(STATUS "blas | Build BLAS library (not the same thing as Eigen)") +message(STATUS "uninstall| Remove files installed by the install target") +message(STATUS "---------+--------------------------------------------------------------") +message(STATUS "") + + +set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) +set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) +set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) +set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) +set ( EIGEN_DEFINITIONS "") +set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) +set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) + +include (CMakePackageConfigHelpers) + +# Imported target support +add_library (eigen INTERFACE) +add_library (Eigen3::Eigen ALIAS eigen) +target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) +target_include_directories (eigen INTERFACE + $ + $ +) + +# Export as title case Eigen +set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen) + +install (TARGETS eigen EXPORT Eigen3Targets) + +configure_package_config_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR + INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} + NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components +) +# Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does +# not depend on architecture specific settings or libraries. More +# specifically, an Eigen3Config.cmake generated from a 64 bit target can be +# used for 32 bit targets as well (and vice versa). +set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) +unset (CMAKE_SIZEOF_VOID_P) +write_basic_package_version_file (Eigen3ConfigVersion.cmake + VERSION ${EIGEN_VERSION_NUMBER} + COMPATIBILITY SameMajorVersion) +set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P}) + +# The Eigen target will be located in the Eigen3 namespace. Other CMake +# targets can refer to it using Eigen3::Eigen. +export (TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake) +# Export Eigen3 package to CMake registry such that it can be easily found by +# CMake even if it has not been installed to a standard directory. +export (PACKAGE Eigen3) + +install (EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) + +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake + DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} ) + +# Add uninstall target +add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake) + +if (EIGEN_SPLIT_TESTSUITE) + ei_split_testsuite("${EIGEN_SPLIT_TESTSUITE}") +endif() diff --git a/lib/eigen-3.4.0/COPYING.APACHE b/lib/eigen-3.4.0/COPYING.APACHE new file mode 100644 index 0000000..61e948d --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.APACHE @@ -0,0 +1,203 @@ +/* + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ \ No newline at end of file diff --git a/lib/eigen-3.4.0/COPYING.BSD b/lib/eigen-3.4.0/COPYING.BSD new file mode 100644 index 0000000..8964ddf --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.BSD @@ -0,0 +1,26 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/lib/eigen-3.4.0/COPYING.GPL b/lib/eigen-3.4.0/COPYING.GPL new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: 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 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/lib/eigen-3.4.0/COPYING.LGPL b/lib/eigen-3.4.0/COPYING.LGPL new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.LGPL @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library 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 2.1 of the License, or (at your option) any later version. + + This library 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 for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lib/eigen-3.4.0/COPYING.MINPACK b/lib/eigen-3.4.0/COPYING.MINPACK new file mode 100644 index 0000000..132cc3f --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.MINPACK @@ -0,0 +1,51 @@ +Minpack Copyright Notice (1999) University of Chicago. All rights reserved + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above +copyright notice, this list of conditions and the following +disclaimer. + +2. Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials +provided with the distribution. + +3. The end-user documentation included with the +redistribution, if any, must include the following +acknowledgment: + + "This product includes software developed by the + University of Chicago, as Operator of Argonne National + Laboratory. + +Alternately, this acknowledgment may appear in the software +itself, if and wherever such third-party acknowledgments +normally appear. + +4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" +WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE +UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND +THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE +OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY +OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR +USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF +THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) +DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION +UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL +BE CORRECTED. + +5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT +HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF +ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, +INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF +ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF +PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER +SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT +(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, +EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE +POSSIBILITY OF SUCH LOSS OR DAMAGES. diff --git a/lib/eigen-3.4.0/COPYING.MPL2 b/lib/eigen-3.4.0/COPYING.MPL2 new file mode 100644 index 0000000..14e2f77 --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.MPL2 @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/lib/eigen-3.4.0/COPYING.README b/lib/eigen-3.4.0/COPYING.README new file mode 100644 index 0000000..de5b632 --- /dev/null +++ b/lib/eigen-3.4.0/COPYING.README @@ -0,0 +1,18 @@ +Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links: + http://www.mozilla.org/MPL/2.0/ + http://www.mozilla.org/MPL/2.0/FAQ.html + +Some files contain third-party code under BSD or LGPL licenses, whence the other +COPYING.* files here. + +All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later. +For this reason, the COPYING.LGPL file contains the LGPL 2.1 text. + +If you want to guarantee that the Eigen code that you are #including is licensed +under the MPL2 and possibly more permissive licenses (like BSD), #define this +preprocessor symbol: + EIGEN_MPL2_ONLY +For example, with most compilers, you could add this to your project CXXFLAGS: + -DEIGEN_MPL2_ONLY +This will cause a compilation error to be generated if you #include any code that is +LGPL licensed. diff --git a/lib/eigen-3.4.0/CTestConfig.cmake b/lib/eigen-3.4.0/CTestConfig.cmake new file mode 100644 index 0000000..0ea24b8 --- /dev/null +++ b/lib/eigen-3.4.0/CTestConfig.cmake @@ -0,0 +1,17 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## # The following are required to uses Dart and the Cdash dashboard +## enable_testing() +## include(CTest) +set(CTEST_PROJECT_NAME "Eigen") +set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "my.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=Eigen") +set(CTEST_DROP_SITE_CDASH TRUE) +#set(CTEST_PROJECT_SUBPROJECTS +#Official +#Unsupported +#) diff --git a/lib/eigen-3.4.0/CTestCustom.cmake.in b/lib/eigen-3.4.0/CTestCustom.cmake.in new file mode 100644 index 0000000..89e487f --- /dev/null +++ b/lib/eigen-3.4.0/CTestCustom.cmake.in @@ -0,0 +1,4 @@ + +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000") +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000") +list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION @EIGEN_CTEST_ERROR_EXCEPTION@) diff --git a/lib/eigen-3.4.0/Eigen/Cholesky b/lib/eigen-3.4.0/Eigen/Cholesky new file mode 100644 index 0000000..a318ceb --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Cholesky @@ -0,0 +1,45 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLESKY_MODULE_H +#define EIGEN_CHOLESKY_MODULE_H + +#include "Core" +#include "Jacobi" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Cholesky_Module Cholesky module + * + * + * + * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are also accessible via the following methods: + * - MatrixBase::llt() + * - MatrixBase::ldlt() + * - SelfAdjointView::llt() + * - SelfAdjointView::ldlt() + * + * \code + * #include + * \endcode + */ + +#include "src/Cholesky/LLT.h" +#include "src/Cholesky/LDLT.h" +#ifdef EIGEN_USE_LAPACKE +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/Cholesky/LLT_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLESKY_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/CholmodSupport b/lib/eigen-3.4.0/Eigen/CholmodSupport new file mode 100644 index 0000000..bed8924 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/CholmodSupport @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H +#define EIGEN_CHOLMODSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { + #include +} + +/** \ingroup Support_modules + * \defgroup CholmodSupport_Module CholmodSupport module + * + * This module provides an interface to the Cholmod library which is part of the suitesparse package. + * It provides the two following main factorization classes: + * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. + * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). + * + * For the sake of completeness, this module also propose the two following classes: + * - class CholmodSimplicialLLT + * - class CholmodSimplicialLDLT + * Note that these classes does not bring any particular advantage compared to the built-in + * SimplicialLLT and SimplicialLDLT factorization classes. + * + * \code + * #include + * \endcode + * + * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. + * The dependencies depend on how cholmod has been compiled. + * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. + * + */ + +#include "src/CholmodSupport/CholmodSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLMODSUPPORT_MODULE_H + diff --git a/lib/eigen-3.4.0/Eigen/Core b/lib/eigen-3.4.0/Eigen/Core new file mode 100644 index 0000000..5921e15 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Core @@ -0,0 +1,384 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2011 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CORE_H +#define EIGEN_CORE_H + +// first thing Eigen does: stop the compiler from reporting useless warnings. +#include "src/Core/util/DisableStupidWarnings.h" + +// then include this file where all our macros are defined. It's really important to do it first because +// it's where we do all the compiler/OS/arch detections and define most defaults. +#include "src/Core/util/Macros.h" + +// This detects SSE/AVX/NEON/etc. and configure alignment settings +#include "src/Core/util/ConfigureVectorization.h" + +// We need cuda_runtime.h/hip_runtime.h to ensure that +// the EIGEN_USING_STD macro works properly on the device side +#if defined(EIGEN_CUDACC) + #include +#elif defined(EIGEN_HIPCC) + #include +#endif + + +#ifdef EIGEN_EXCEPTIONS + #include +#endif + +// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) +// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. +#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) && EIGEN_GNUC_AT_MOST(5,5) + #pragma GCC optimize ("-fno-ipa-cp-clone") +#endif + +// Prevent ICC from specializing std::complex operators that silently fail +// on device. This allows us to use our own device-compatible specializations +// instead. +#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \ + && !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_) +#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 +#endif +#include + +// this include file manages BLAS and MKL related macros +// and inclusion of their respective header files +#include "src/Core/util/MKL_support.h" + + +#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16) + #define EIGEN_HAS_GPU_FP16 +#endif + +#if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16) + #define EIGEN_HAS_GPU_BF16 +#endif + +#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) + #define EIGEN_HAS_OPENMP +#endif + +#ifdef EIGEN_HAS_OPENMP +#include +#endif + +// MSVC for windows mobile does not have the errno.h file +#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM +#define EIGEN_HAS_ERRNO +#endif + +#ifdef EIGEN_HAS_ERRNO +#include +#endif +#include +#include +#include +#include +#include +#include +#ifndef EIGEN_NO_IO + #include +#endif +#include +#include +#include +#include // for CHAR_BIT +// for min/max: +#include + +#if EIGEN_HAS_CXX11 +#include +#endif + +// for std::is_nothrow_move_assignable +#ifdef EIGEN_INCLUDE_TYPE_TRAITS +#include +#endif + +// for outputting debug info +#ifdef EIGEN_DEBUG_ASSIGN +#include +#endif + +// required for __cpuid, needs to be included after cmath +#if EIGEN_COMP_MSVC && EIGEN_ARCH_i386_OR_x86_64 && !EIGEN_OS_WINCE + #include +#endif + +#if defined(EIGEN_USE_SYCL) + #undef min + #undef max + #undef isnan + #undef isinf + #undef isfinite + #include + #include + #include + #include + #include + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM0 + #define EIGEN_SYCL_LOCAL_THREAD_DIM0 16 + #endif + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM1 + #define EIGEN_SYCL_LOCAL_THREAD_DIM1 16 + #endif +#endif + + +#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || defined EIGEN2_SUPPORT +// This will generate an error message: +#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information +#endif + +namespace Eigen { + +// we use size_t frequently and we'll never remember to prepend it with std:: every time just to +// ensure QNX/QCC support +using std::size_t; +// gcc 4.6.0 wants std:: for ptrdiff_t +using std::ptrdiff_t; + +} + +/** \defgroup Core_Module Core module + * This is the main module of Eigen providing dense matrix and vector support + * (both fixed and dynamic size) with all the features corresponding to a BLAS library + * and much more... + * + * \code + * #include + * \endcode + */ + +#include "src/Core/util/Constants.h" +#include "src/Core/util/Meta.h" +#include "src/Core/util/ForwardDeclarations.h" +#include "src/Core/util/StaticAssert.h" +#include "src/Core/util/XprHelper.h" +#include "src/Core/util/Memory.h" +#include "src/Core/util/IntegralConstant.h" +#include "src/Core/util/SymbolicIndex.h" + +#include "src/Core/NumTraits.h" +#include "src/Core/MathFunctions.h" +#include "src/Core/GenericPacketMath.h" +#include "src/Core/MathFunctionsImpl.h" +#include "src/Core/arch/Default/ConjHelper.h" +// Generic half float support +#include "src/Core/arch/Default/Half.h" +#include "src/Core/arch/Default/BFloat16.h" +#include "src/Core/arch/Default/TypeCasting.h" +#include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" + +#if defined EIGEN_VECTORIZE_AVX512 + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/AVX512/PacketMath.h" + #include "src/Core/arch/AVX512/TypeCasting.h" + #include "src/Core/arch/AVX512/Complex.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" + #include "src/Core/arch/AVX512/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_AVX + // Use AVX for floats and doubles, SSE for integers + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_SSE + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/SSE/Complex.h" +#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + #include "src/Core/arch/AltiVec/PacketMath.h" + #include "src/Core/arch/AltiVec/MathFunctions.h" + #include "src/Core/arch/AltiVec/Complex.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/PacketMath.h" + #include "src/Core/arch/NEON/TypeCasting.h" + #include "src/Core/arch/NEON/MathFunctions.h" + #include "src/Core/arch/NEON/Complex.h" +#elif defined EIGEN_VECTORIZE_SVE + #include "src/Core/arch/SVE/PacketMath.h" + #include "src/Core/arch/SVE/TypeCasting.h" + #include "src/Core/arch/SVE/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_ZVECTOR + #include "src/Core/arch/ZVector/PacketMath.h" + #include "src/Core/arch/ZVector/MathFunctions.h" + #include "src/Core/arch/ZVector/Complex.h" +#elif defined EIGEN_VECTORIZE_MSA + #include "src/Core/arch/MSA/PacketMath.h" + #include "src/Core/arch/MSA/MathFunctions.h" + #include "src/Core/arch/MSA/Complex.h" +#endif + +#if defined EIGEN_VECTORIZE_GPU + #include "src/Core/arch/GPU/PacketMath.h" + #include "src/Core/arch/GPU/MathFunctions.h" + #include "src/Core/arch/GPU/TypeCasting.h" +#endif + +#if defined(EIGEN_USE_SYCL) + #include "src/Core/arch/SYCL/SyclMemoryModel.h" + #include "src/Core/arch/SYCL/InteropHeaders.h" +#if !defined(EIGEN_DONT_VECTORIZE_SYCL) + #include "src/Core/arch/SYCL/PacketMath.h" + #include "src/Core/arch/SYCL/MathFunctions.h" + #include "src/Core/arch/SYCL/TypeCasting.h" +#endif +#endif + +#include "src/Core/arch/Default/Settings.h" +// This file provides generic implementations valid for scalar as well +#include "src/Core/arch/Default/GenericPacketMathFunctions.h" + +#include "src/Core/functors/TernaryFunctors.h" +#include "src/Core/functors/BinaryFunctors.h" +#include "src/Core/functors/UnaryFunctors.h" +#include "src/Core/functors/NullaryFunctors.h" +#include "src/Core/functors/StlFunctors.h" +#include "src/Core/functors/AssignmentFunctors.h" + +// Specialized functors to enable the processing of complex numbers +// on CUDA devices +#ifdef EIGEN_CUDACC +#include "src/Core/arch/CUDA/Complex.h" +#endif + +#include "src/Core/util/IndexedViewHelper.h" +#include "src/Core/util/ReshapedHelper.h" +#include "src/Core/ArithmeticSequence.h" +#ifndef EIGEN_NO_IO + #include "src/Core/IO.h" +#endif +#include "src/Core/DenseCoeffsBase.h" +#include "src/Core/DenseBase.h" +#include "src/Core/MatrixBase.h" +#include "src/Core/EigenBase.h" + +#include "src/Core/Product.h" +#include "src/Core/CoreEvaluators.h" +#include "src/Core/AssignEvaluator.h" + +#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 + // at least confirmed with Doxygen 1.5.5 and 1.5.6 + #include "src/Core/Assign.h" +#endif + +#include "src/Core/ArrayBase.h" +#include "src/Core/util/BlasUtil.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/PlainObjectBase.h" +#include "src/Core/Matrix.h" +#include "src/Core/Array.h" +#include "src/Core/CwiseTernaryOp.h" +#include "src/Core/CwiseBinaryOp.h" +#include "src/Core/CwiseUnaryOp.h" +#include "src/Core/CwiseNullaryOp.h" +#include "src/Core/CwiseUnaryView.h" +#include "src/Core/SelfCwiseBinaryOp.h" +#include "src/Core/Dot.h" +#include "src/Core/StableNorm.h" +#include "src/Core/Stride.h" +#include "src/Core/MapBase.h" +#include "src/Core/Map.h" +#include "src/Core/Ref.h" +#include "src/Core/Block.h" +#include "src/Core/VectorBlock.h" +#include "src/Core/IndexedView.h" +#include "src/Core/Reshaped.h" +#include "src/Core/Transpose.h" +#include "src/Core/DiagonalMatrix.h" +#include "src/Core/Diagonal.h" +#include "src/Core/DiagonalProduct.h" +#include "src/Core/Redux.h" +#include "src/Core/Visitor.h" +#include "src/Core/Fuzzy.h" +#include "src/Core/Swap.h" +#include "src/Core/CommaInitializer.h" +#include "src/Core/GeneralProduct.h" +#include "src/Core/Solve.h" +#include "src/Core/Inverse.h" +#include "src/Core/SolverBase.h" +#include "src/Core/PermutationMatrix.h" +#include "src/Core/Transpositions.h" +#include "src/Core/TriangularMatrix.h" +#include "src/Core/SelfAdjointView.h" +#include "src/Core/products/GeneralBlockPanelKernel.h" +#include "src/Core/products/Parallelizer.h" +#include "src/Core/ProductEvaluators.h" +#include "src/Core/products/GeneralMatrixVector.h" +#include "src/Core/products/GeneralMatrixMatrix.h" +#include "src/Core/SolveTriangular.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular.h" +#include "src/Core/products/SelfadjointMatrixVector.h" +#include "src/Core/products/SelfadjointMatrixMatrix.h" +#include "src/Core/products/SelfadjointProduct.h" +#include "src/Core/products/SelfadjointRank2Update.h" +#include "src/Core/products/TriangularMatrixVector.h" +#include "src/Core/products/TriangularMatrixMatrix.h" +#include "src/Core/products/TriangularSolverMatrix.h" +#include "src/Core/products/TriangularSolverVector.h" +#include "src/Core/BandMatrix.h" +#include "src/Core/CoreIterators.h" +#include "src/Core/ConditionEstimator.h" + +#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + #include "src/Core/arch/AltiVec/MatrixProduct.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/GeneralBlockPanelKernel.h" +#endif + +#include "src/Core/BooleanRedux.h" +#include "src/Core/Select.h" +#include "src/Core/VectorwiseOp.h" +#include "src/Core/PartialReduxEvaluator.h" +#include "src/Core/Random.h" +#include "src/Core/Replicate.h" +#include "src/Core/Reverse.h" +#include "src/Core/ArrayWrapper.h" +#include "src/Core/StlIterators.h" + +#ifdef EIGEN_USE_BLAS +#include "src/Core/products/GeneralMatrixMatrix_BLAS.h" +#include "src/Core/products/GeneralMatrixVector_BLAS.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h" +#include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h" +#include "src/Core/products/SelfadjointMatrixVector_BLAS.h" +#include "src/Core/products/TriangularMatrixMatrix_BLAS.h" +#include "src/Core/products/TriangularMatrixVector_BLAS.h" +#include "src/Core/products/TriangularSolverMatrix_BLAS.h" +#endif // EIGEN_USE_BLAS + +#ifdef EIGEN_USE_MKL_VML +#include "src/Core/Assign_MKL.h" +#endif + +#include "src/Core/GlobalFunctions.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CORE_H diff --git a/lib/eigen-3.4.0/Eigen/Dense b/lib/eigen-3.4.0/Eigen/Dense new file mode 100644 index 0000000..5768910 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Dense @@ -0,0 +1,7 @@ +#include "Core" +#include "LU" +#include "Cholesky" +#include "QR" +#include "SVD" +#include "Geometry" +#include "Eigenvalues" diff --git a/lib/eigen-3.4.0/Eigen/Eigen b/lib/eigen-3.4.0/Eigen/Eigen new file mode 100644 index 0000000..654c8dc --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Eigen @@ -0,0 +1,2 @@ +#include "Dense" +#include "Sparse" diff --git a/lib/eigen-3.4.0/Eigen/Eigenvalues b/lib/eigen-3.4.0/Eigen/Eigenvalues new file mode 100644 index 0000000..5467a2e --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Eigenvalues @@ -0,0 +1,60 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_EIGENVALUES_MODULE_H +#define EIGEN_EIGENVALUES_MODULE_H + +#include "Core" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" +#include "LU" +#include "Geometry" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Eigenvalues_Module Eigenvalues module + * + * + * + * This module mainly provides various eigenvalue solvers. + * This module also provides some MatrixBase methods, including: + * - MatrixBase::eigenvalues(), + * - MatrixBase::operatorNorm() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/RealSvd2x2.h" +#include "src/Eigenvalues/Tridiagonalization.h" +#include "src/Eigenvalues/RealSchur.h" +#include "src/Eigenvalues/EigenSolver.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver.h" +#include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" +#include "src/Eigenvalues/HessenbergDecomposition.h" +#include "src/Eigenvalues/ComplexSchur.h" +#include "src/Eigenvalues/ComplexEigenSolver.h" +#include "src/Eigenvalues/RealQZ.h" +#include "src/Eigenvalues/GeneralizedEigenSolver.h" +#include "src/Eigenvalues/MatrixBaseEigenvalues.h" +#ifdef EIGEN_USE_LAPACKE +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/Eigenvalues/RealSchur_LAPACKE.h" +#include "src/Eigenvalues/ComplexSchur_LAPACKE.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_EIGENVALUES_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/Geometry b/lib/eigen-3.4.0/Eigen/Geometry new file mode 100644 index 0000000..bc78110 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Geometry @@ -0,0 +1,59 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GEOMETRY_MODULE_H +#define EIGEN_GEOMETRY_MODULE_H + +#include "Core" + +#include "SVD" +#include "LU" +#include + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Geometry_Module Geometry module + * + * This module provides support for: + * - fixed-size homogeneous transformations + * - translation, scaling, 2D and 3D rotations + * - \link Quaternion quaternions \endlink + * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) + * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) + * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink + * - \link AlignedBox axis aligned bounding boxes \endlink + * - \link umeyama least-square transformation fitting \endlink + * + * \code + * #include + * \endcode + */ + +#include "src/Geometry/OrthoMethods.h" +#include "src/Geometry/EulerAngles.h" + +#include "src/Geometry/Homogeneous.h" +#include "src/Geometry/RotationBase.h" +#include "src/Geometry/Rotation2D.h" +#include "src/Geometry/Quaternion.h" +#include "src/Geometry/AngleAxis.h" +#include "src/Geometry/Transform.h" +#include "src/Geometry/Translation.h" +#include "src/Geometry/Scaling.h" +#include "src/Geometry/Hyperplane.h" +#include "src/Geometry/ParametrizedLine.h" +#include "src/Geometry/AlignedBox.h" +#include "src/Geometry/Umeyama.h" + +// Use the SSE optimized version whenever possible. +#if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) +#include "src/Geometry/arch/Geometry_SIMD.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_GEOMETRY_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/Householder b/lib/eigen-3.4.0/Eigen/Householder new file mode 100644 index 0000000..f2fa799 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Householder @@ -0,0 +1,29 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_HOUSEHOLDER_MODULE_H +#define EIGEN_HOUSEHOLDER_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Householder_Module Householder module + * This module provides Householder transformations. + * + * \code + * #include + * \endcode + */ + +#include "src/Householder/Householder.h" +#include "src/Householder/HouseholderSequence.h" +#include "src/Householder/BlockHouseholder.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_HOUSEHOLDER_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/IterativeLinearSolvers b/lib/eigen-3.4.0/Eigen/IterativeLinearSolvers new file mode 100644 index 0000000..957d575 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/IterativeLinearSolvers @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H +#define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module + * + * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. + * Those solvers are accessible via the following classes: + * - ConjugateGradient for selfadjoint (hermitian) matrices, + * - LeastSquaresConjugateGradient for rectangular least-square problems, + * - BiCGSTAB for general square matrices. + * + * These iterative solvers are associated with some preconditioners: + * - IdentityPreconditioner - not really useful + * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. + * - IncompleteLUT - incomplete LU factorization with dual thresholding + * + * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. + * + \code + #include + \endcode + */ + +#include "src/IterativeLinearSolvers/SolveWithGuess.h" +#include "src/IterativeLinearSolvers/IterativeSolverBase.h" +#include "src/IterativeLinearSolvers/BasicPreconditioners.h" +#include "src/IterativeLinearSolvers/ConjugateGradient.h" +#include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" +#include "src/IterativeLinearSolvers/BiCGSTAB.h" +#include "src/IterativeLinearSolvers/IncompleteLUT.h" +#include "src/IterativeLinearSolvers/IncompleteCholesky.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/Jacobi b/lib/eigen-3.4.0/Eigen/Jacobi new file mode 100644 index 0000000..43edc7a --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Jacobi @@ -0,0 +1,32 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_JACOBI_MODULE_H +#define EIGEN_JACOBI_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Jacobi_Module Jacobi module + * This module provides Jacobi and Givens rotations. + * + * \code + * #include + * \endcode + * + * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: + * - MatrixBase::applyOnTheLeft() + * - MatrixBase::applyOnTheRight(). + */ + +#include "src/Jacobi/Jacobi.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_JACOBI_MODULE_H + diff --git a/lib/eigen-3.4.0/Eigen/KLUSupport b/lib/eigen-3.4.0/Eigen/KLUSupport new file mode 100644 index 0000000..b23d905 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/KLUSupport @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_KLUSUPPORT_MODULE_H +#define EIGEN_KLUSUPPORT_MODULE_H + +#include + +#include + +extern "C" { +#include +#include + } + +/** \ingroup Support_modules + * \defgroup KLUSupport_Module KLUSupport module + * + * This module provides an interface to the KLU library which is part of the suitesparse package. + * It provides the following factorization class: + * - class KLU: a sparse LU factorization, well-suited for circuit simulation. + * + * \code + * #include + * \endcode + * + * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. + * + */ + +#include "src/KLUSupport/KLUSupport.h" + +#include + +#endif // EIGEN_KLUSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/LU b/lib/eigen-3.4.0/Eigen/LU new file mode 100644 index 0000000..1236ceb --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/LU @@ -0,0 +1,47 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LU_MODULE_H +#define EIGEN_LU_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup LU_Module LU module + * This module includes %LU decomposition and related notions such as matrix inversion and determinant. + * This module defines the following MatrixBase methods: + * - MatrixBase::inverse() + * - MatrixBase::determinant() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Kernel.h" +#include "src/misc/Image.h" +#include "src/LU/FullPivLU.h" +#include "src/LU/PartialPivLU.h" +#ifdef EIGEN_USE_LAPACKE +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/LU/PartialPivLU_LAPACKE.h" +#endif +#include "src/LU/Determinant.h" +#include "src/LU/InverseImpl.h" + +#if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON + #include "src/LU/arch/InverseSize4.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_LU_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/MetisSupport b/lib/eigen-3.4.0/Eigen/MetisSupport new file mode 100644 index 0000000..85c41bf --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/MetisSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_METISSUPPORT_MODULE_H +#define EIGEN_METISSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + + +/** \ingroup Support_modules + * \defgroup MetisSupport_Module MetisSupport module + * + * \code + * #include + * \endcode + * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). + * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink + */ + + +#include "src/MetisSupport/MetisSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_METISSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/OrderingMethods b/lib/eigen-3.4.0/Eigen/OrderingMethods new file mode 100644 index 0000000..29691a6 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/OrderingMethods @@ -0,0 +1,70 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ORDERINGMETHODS_MODULE_H +#define EIGEN_ORDERINGMETHODS_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup OrderingMethods_Module OrderingMethods module + * + * This module is currently for internal use only + * + * It defines various built-in and external ordering methods for sparse matrices. + * They are typically used to reduce the number of elements during + * the sparse matrix decomposition (LLT, LU, QR). + * Precisely, in a preprocessing step, a permutation matrix P is computed using + * those ordering methods and applied to the columns of the matrix. + * Using for instance the sparse Cholesky decomposition, it is expected that + * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). + * + * + * Usage : + * \code + * #include + * \endcode + * + * A simple usage is as a template parameter in the sparse decomposition classes : + * + * \code + * SparseLU > solver; + * \endcode + * + * \code + * SparseQR > solver; + * \endcode + * + * It is possible as well to call directly a particular ordering method for your own purpose, + * \code + * AMDOrdering ordering; + * PermutationMatrix perm; + * SparseMatrix A; + * //Fill the matrix ... + * + * ordering(A, perm); // Call AMD + * \endcode + * + * \note Some of these methods (like AMD or METIS), need the sparsity pattern + * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, + * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. + * If your matrix is already symmetric (at leat in structure), you can avoid that + * by calling the method with a SelfAdjointView type. + * + * \code + * // Call the ordering on the pattern of the lower triangular matrix A + * ordering(A.selfadjointView(), perm); + * \endcode + */ + +#include "src/OrderingMethods/Amd.h" +#include "src/OrderingMethods/Ordering.h" +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ORDERINGMETHODS_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/PaStiXSupport b/lib/eigen-3.4.0/Eigen/PaStiXSupport new file mode 100644 index 0000000..234619a --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/PaStiXSupport @@ -0,0 +1,49 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PASTIXSUPPORT_MODULE_H +#define EIGEN_PASTIXSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +#include +} + +#ifdef complex +#undef complex +#endif + +/** \ingroup Support_modules + * \defgroup PaStiXSupport_Module PaStiXSupport module + * + * This module provides an interface to the PaSTiX library. + * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. + * It provides the two following main factorization classes: + * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. + * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. + * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). + * + * \code + * #include + * \endcode + * + * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. + * This wrapper resuires PaStiX version 5.x compiled without MPI support. + * The dependencies depend on how PaSTiX has been compiled. + * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. + * + */ + +#include "src/PaStiXSupport/PaStiXSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PASTIXSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/PardisoSupport b/lib/eigen-3.4.0/Eigen/PardisoSupport new file mode 100644 index 0000000..340edf5 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/PardisoSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARDISOSUPPORT_MODULE_H +#define EIGEN_PARDISOSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include + +/** \ingroup Support_modules + * \defgroup PardisoSupport_Module PardisoSupport module + * + * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. + * + * \code + * #include + * \endcode + * + * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. + * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. + * + */ + +#include "src/PardisoSupport/PardisoSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PARDISOSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/QR b/lib/eigen-3.4.0/Eigen/QR new file mode 100644 index 0000000..8465b62 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/QR @@ -0,0 +1,50 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_QR_MODULE_H +#define EIGEN_QR_MODULE_H + +#include "Core" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup QR_Module QR module + * + * + * + * This module provides various QR decompositions + * This module also provides some MatrixBase methods, including: + * - MatrixBase::householderQr() + * - MatrixBase::colPivHouseholderQr() + * - MatrixBase::fullPivHouseholderQr() + * + * \code + * #include + * \endcode + */ + +#include "src/QR/HouseholderQR.h" +#include "src/QR/FullPivHouseholderQR.h" +#include "src/QR/ColPivHouseholderQR.h" +#include "src/QR/CompleteOrthogonalDecomposition.h" +#ifdef EIGEN_USE_LAPACKE +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/QR/HouseholderQR_LAPACKE.h" +#include "src/QR/ColPivHouseholderQR_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_QR_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/QtAlignedMalloc b/lib/eigen-3.4.0/Eigen/QtAlignedMalloc new file mode 100644 index 0000000..6fe8237 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/QtAlignedMalloc @@ -0,0 +1,39 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_QTMALLOC_MODULE_H +#define EIGEN_QTMALLOC_MODULE_H + +#include "Core" + +#if (!EIGEN_MALLOC_ALREADY_ALIGNED) + +#include "src/Core/util/DisableStupidWarnings.h" + +void *qMalloc(std::size_t size) +{ + return Eigen::internal::aligned_malloc(size); +} + +void qFree(void *ptr) +{ + Eigen::internal::aligned_free(ptr); +} + +void *qRealloc(void *ptr, std::size_t size) +{ + void* newPtr = Eigen::internal::aligned_malloc(size); + std::memcpy(newPtr, ptr, size); + Eigen::internal::aligned_free(ptr); + return newPtr; +} + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif + +#endif // EIGEN_QTMALLOC_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/SPQRSupport b/lib/eigen-3.4.0/Eigen/SPQRSupport new file mode 100644 index 0000000..f70390c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SPQRSupport @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPQRSUPPORT_MODULE_H +#define EIGEN_SPQRSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SuiteSparseQR.hpp" + +/** \ingroup Support_modules + * \defgroup SPQRSupport_Module SuiteSparseQR module + * + * This module provides an interface to the SPQR library, which is part of the suitesparse package. + * + * \code + * #include + * \endcode + * + * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). + * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules + * + */ + +#include "src/CholmodSupport/CholmodSupport.h" +#include "src/SPQRSupport/SuiteSparseQRSupport.h" + +#endif diff --git a/lib/eigen-3.4.0/Eigen/SVD b/lib/eigen-3.4.0/Eigen/SVD new file mode 100644 index 0000000..3451794 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SVD @@ -0,0 +1,50 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SVD_MODULE_H +#define EIGEN_SVD_MODULE_H + +#include "QR" +#include "Householder" +#include "Jacobi" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SVD_Module SVD module + * + * + * + * This module provides SVD decomposition for matrices (both real and complex). + * Two decomposition algorithms are provided: + * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. + * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. + * These decompositions are accessible via the respective classes and following MatrixBase methods: + * - MatrixBase::jacobiSvd() + * - MatrixBase::bdcSvd() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/RealSvd2x2.h" +#include "src/SVD/UpperBidiagonalization.h" +#include "src/SVD/SVDBase.h" +#include "src/SVD/JacobiSVD.h" +#include "src/SVD/BDCSVD.h" +#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/SVD/JacobiSVD_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SVD_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/Sparse b/lib/eigen-3.4.0/Eigen/Sparse new file mode 100644 index 0000000..a2ef7a6 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/Sparse @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSE_MODULE_H +#define EIGEN_SPARSE_MODULE_H + +/** \defgroup Sparse_Module Sparse meta-module + * + * Meta-module including all related modules: + * - \ref SparseCore_Module + * - \ref OrderingMethods_Module + * - \ref SparseCholesky_Module + * - \ref SparseLU_Module + * - \ref SparseQR_Module + * - \ref IterativeLinearSolvers_Module + * + \code + #include + \endcode + */ + +#include "SparseCore" +#include "OrderingMethods" +#include "SparseCholesky" +#include "SparseLU" +#include "SparseQR" +#include "IterativeLinearSolvers" + +#endif // EIGEN_SPARSE_MODULE_H + diff --git a/lib/eigen-3.4.0/Eigen/SparseCholesky b/lib/eigen-3.4.0/Eigen/SparseCholesky new file mode 100644 index 0000000..d2b1f12 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SparseCholesky @@ -0,0 +1,37 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2013 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECHOLESKY_MODULE_H +#define EIGEN_SPARSECHOLESKY_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup SparseCholesky_Module SparseCholesky module + * + * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are accessible via the following classes: + * - SimplicialLLt, + * - SimplicialLDLt + * + * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. + * + * \code + * #include + * \endcode + */ + +#include "src/SparseCholesky/SimplicialCholesky.h" +#include "src/SparseCholesky/SimplicialCholesky_impl.h" +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECHOLESKY_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/SparseCore b/lib/eigen-3.4.0/Eigen/SparseCore new file mode 100644 index 0000000..76966c4 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SparseCore @@ -0,0 +1,69 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECORE_MODULE_H +#define EIGEN_SPARSECORE_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include +#include +#include +#include +#include + +/** + * \defgroup SparseCore_Module SparseCore module + * + * This module provides a sparse matrix representation, and basic associated matrix manipulations + * and operations. + * + * See the \ref TutorialSparse "Sparse tutorial" + * + * \code + * #include + * \endcode + * + * This module depends on: Core. + */ + +#include "src/SparseCore/SparseUtil.h" +#include "src/SparseCore/SparseMatrixBase.h" +#include "src/SparseCore/SparseAssign.h" +#include "src/SparseCore/CompressedStorage.h" +#include "src/SparseCore/AmbiVector.h" +#include "src/SparseCore/SparseCompressedBase.h" +#include "src/SparseCore/SparseMatrix.h" +#include "src/SparseCore/SparseMap.h" +#include "src/SparseCore/MappedSparseMatrix.h" +#include "src/SparseCore/SparseVector.h" +#include "src/SparseCore/SparseRef.h" +#include "src/SparseCore/SparseCwiseUnaryOp.h" +#include "src/SparseCore/SparseCwiseBinaryOp.h" +#include "src/SparseCore/SparseTranspose.h" +#include "src/SparseCore/SparseBlock.h" +#include "src/SparseCore/SparseDot.h" +#include "src/SparseCore/SparseRedux.h" +#include "src/SparseCore/SparseView.h" +#include "src/SparseCore/SparseDiagonalProduct.h" +#include "src/SparseCore/ConservativeSparseSparseProduct.h" +#include "src/SparseCore/SparseSparseProductWithPruning.h" +#include "src/SparseCore/SparseProduct.h" +#include "src/SparseCore/SparseDenseProduct.h" +#include "src/SparseCore/SparseSelfAdjointView.h" +#include "src/SparseCore/SparseTriangularView.h" +#include "src/SparseCore/TriangularSolver.h" +#include "src/SparseCore/SparsePermutation.h" +#include "src/SparseCore/SparseFuzzy.h" +#include "src/SparseCore/SparseSolverBase.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECORE_MODULE_H + diff --git a/lib/eigen-3.4.0/Eigen/SparseLU b/lib/eigen-3.4.0/Eigen/SparseLU new file mode 100644 index 0000000..37c4a5c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SparseLU @@ -0,0 +1,50 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSELU_MODULE_H +#define EIGEN_SPARSELU_MODULE_H + +#include "SparseCore" + +/** + * \defgroup SparseLU_Module SparseLU module + * This module defines a supernodal factorization of general sparse matrices. + * The code is fully optimized for supernode-panel updates with specialized kernels. + * Please, see the documentation of the SparseLU class for more details. + */ + +// Ordering interface +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "src/SparseLU/SparseLU_gemm_kernel.h" + +#include "src/SparseLU/SparseLU_Structs.h" +#include "src/SparseLU/SparseLU_SupernodalMatrix.h" +#include "src/SparseLU/SparseLUImpl.h" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseLU/SparseLU_Memory.h" +#include "src/SparseLU/SparseLU_heap_relax_snode.h" +#include "src/SparseLU/SparseLU_relax_snode.h" +#include "src/SparseLU/SparseLU_pivotL.h" +#include "src/SparseLU/SparseLU_panel_dfs.h" +#include "src/SparseLU/SparseLU_kernel_bmod.h" +#include "src/SparseLU/SparseLU_panel_bmod.h" +#include "src/SparseLU/SparseLU_column_dfs.h" +#include "src/SparseLU/SparseLU_column_bmod.h" +#include "src/SparseLU/SparseLU_copy_to_ucol.h" +#include "src/SparseLU/SparseLU_pruneL.h" +#include "src/SparseLU/SparseLU_Utils.h" +#include "src/SparseLU/SparseLU.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSELU_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/SparseQR b/lib/eigen-3.4.0/Eigen/SparseQR new file mode 100644 index 0000000..f5fc5fa --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SparseQR @@ -0,0 +1,36 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSEQR_MODULE_H +#define EIGEN_SPARSEQR_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SparseQR_Module SparseQR module + * \brief Provides QR decomposition for sparse matrices + * + * This module provides a simplicial version of the left-looking Sparse QR decomposition. + * The columns of the input matrix should be reordered to limit the fill-in during the + * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. + * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list + * of built-in and external ordering methods. + * + * \code + * #include + * \endcode + * + * + */ + +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseQR/SparseQR.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif diff --git a/lib/eigen-3.4.0/Eigen/StdDeque b/lib/eigen-3.4.0/Eigen/StdDeque new file mode 100644 index 0000000..bc68397 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/StdDeque @@ -0,0 +1,27 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDDEQUE_MODULE_H +#define EIGEN_STDDEQUE_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdDeque.h" + +#endif + +#endif // EIGEN_STDDEQUE_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/StdList b/lib/eigen-3.4.0/Eigen/StdList new file mode 100644 index 0000000..4c6262c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/StdList @@ -0,0 +1,26 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDLIST_MODULE_H +#define EIGEN_STDLIST_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdList.h" + +#endif + +#endif // EIGEN_STDLIST_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/StdVector b/lib/eigen-3.4.0/Eigen/StdVector new file mode 100644 index 0000000..0c4697a --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/StdVector @@ -0,0 +1,27 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDVECTOR_MODULE_H +#define EIGEN_STDVECTOR_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdVector.h" + +#endif + +#endif // EIGEN_STDVECTOR_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/SuperLUSupport b/lib/eigen-3.4.0/Eigen/SuperLUSupport new file mode 100644 index 0000000..59312a8 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/SuperLUSupport @@ -0,0 +1,64 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SUPERLUSUPPORT_MODULE_H +#define EIGEN_SUPERLUSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#ifdef EMPTY +#define EIGEN_EMPTY_WAS_ALREADY_DEFINED +#endif + +typedef int int_t; +#include +#include +#include + +// slu_util.h defines a preprocessor token named EMPTY which is really polluting, +// so we remove it in favor of a SUPERLU_EMPTY token. +// If EMPTY was already defined then we don't undef it. + +#if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) +# undef EIGEN_EMPTY_WAS_ALREADY_DEFINED +#elif defined(EMPTY) +# undef EMPTY +#endif + +#define SUPERLU_EMPTY (-1) + +namespace Eigen { struct SluMatrix; } + +/** \ingroup Support_modules + * \defgroup SuperLUSupport_Module SuperLUSupport module + * + * This module provides an interface to the SuperLU library. + * It provides the following factorization class: + * - class SuperLU: a supernodal sequential LU factorization. + * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). + * + * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. + * + * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. + * + * \code + * #include + * \endcode + * + * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. + * The dependencies depend on how superlu has been compiled. + * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. + * + */ + +#include "src/SuperLUSupport/SuperLUSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SUPERLUSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/UmfPackSupport b/lib/eigen-3.4.0/Eigen/UmfPackSupport new file mode 100644 index 0000000..00eec80 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/UmfPackSupport @@ -0,0 +1,40 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_UMFPACKSUPPORT_MODULE_H +#define EIGEN_UMFPACKSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + +/** \ingroup Support_modules + * \defgroup UmfPackSupport_Module UmfPackSupport module + * + * This module provides an interface to the UmfPack library which is part of the suitesparse package. + * It provides the following factorization class: + * - class UmfPackLU: a multifrontal sequential LU factorization. + * + * \code + * #include + * \endcode + * + * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. + * + */ + +#include "src/UmfPackSupport/UmfPackSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_UMFPACKSUPPORT_MODULE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Cholesky/LDLT.h b/lib/eigen-3.4.0/Eigen/src/Cholesky/LDLT.h new file mode 100644 index 0000000..1013ca0 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Cholesky/LDLT.h @@ -0,0 +1,688 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2011 Gael Guennebaud +// Copyright (C) 2009 Keir Mierle +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2011 Timothy E. Holy +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LDLT_H +#define EIGEN_LDLT_H + +namespace Eigen { + +namespace internal { + template struct traits > + : traits<_MatrixType> + { + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; + }; + + template struct LDLT_Traits; + + // PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef + enum SignMatrix { PositiveSemiDef, NegativeSemiDef, ZeroSign, Indefinite }; +} + +/** \ingroup Cholesky_Module + * + * \class LDLT + * + * \brief Robust Cholesky decomposition of a matrix with pivoting + * + * \tparam _MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * The other triangular part won't be read. + * + * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite + * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L + * is lower triangular with a unit diagonal and D is a diagonal matrix. + * + * The decomposition uses pivoting to ensure stability, so that D will have + * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root + * on D also stabilizes the computation. + * + * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky + * decomposition to determine whether a system of equations has a solution. + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT + */ +template class LDLT + : public SolverBase > +{ + public: + typedef _MatrixType MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LDLT) + enum { + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + UpLo = _UpLo + }; + typedef Matrix TmpMatrixType; + + typedef Transpositions TranspositionType; + typedef PermutationMatrix PermutationType; + + typedef internal::LDLT_Traits Traits; + + /** \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LDLT::compute(const MatrixType&). + */ + LDLT() + : m_matrix(), + m_transpositions(), + m_sign(internal::ZeroSign), + 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 LDLT() + */ + explicit LDLT(Index size) + : m_matrix(size, size), + m_transpositions(size), + m_temporary(size), + m_sign(internal::ZeroSign), + m_isInitialized(false) + {} + + /** \brief Constructor with decomposition + * + * This calculates the decomposition for the input \a matrix. + * + * \sa LDLT(Index size) + */ + template + explicit LDLT(const EigenBase& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \brief Constructs a LDLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. + * + * \sa LDLT(const EigenBase&) + */ + template + explicit LDLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** Clear any existing decomposition + * \sa rankUpdate(w,sigma) + */ + void setZero() + { + m_isInitialized = false; + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + 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 + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return Traits::getL(m_matrix); + } + + /** \returns the permutation matrix P as a transposition sequence. + */ + inline const TranspositionType& transpositionsP() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_transpositions; + } + + /** \returns the coefficients of the diagonal matrix D */ + inline Diagonal vectorD() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix.diagonal(); + } + + /** \returns true if the matrix is positive (semidefinite) */ + inline bool isPositive() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign; + } + + /** \returns true if the matrix is negative (semidefinite) */ + inline bool isNegative(void) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign; + } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * This function also supports in-place solves using the syntax x = decompositionObject.solve(x) . + * + * \note_about_checking_solutions + * + * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ + * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, + * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then + * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the + * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function + * computes the least-square solution of \f$ A x = b \f$ if \f$ A \f$ is singular. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt() + */ + template + inline const Solve + solve(const MatrixBase& b) const; + #endif + + template + bool solveInPlace(MatrixBase &bAndX) const; + + template + LDLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the LDLT decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } + + template + LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); + + /** \returns the internal LDLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLDLT() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LDLT& adjoint() const { return *this; }; + + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was successful, + * \c NumericalIssue if the factorization failed because of a zero pivot. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_info; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif + + protected: + + static void check_template_parameters() + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); + } + + /** \internal + * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. + * The strict upper part is used during the decomposition, the strict lower + * part correspond to the coefficients of L (its diagonal is equal to 1 and + * is not stored), and the diagonal entries correspond to D. + */ + MatrixType m_matrix; + RealScalar m_l1_norm; + TranspositionType m_transpositions; + TmpMatrixType m_temporary; + internal::SignMatrix m_sign; + bool m_isInitialized; + ComputationInfo m_info; +}; + +namespace internal { + +template struct ldlt_inplace; + +template<> struct ldlt_inplace +{ + template + static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) + { + using std::abs; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename TranspositionType::StorageIndex IndexType; + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + bool found_zero_pivot = false; + bool ret = true; + + if (size <= 1) + { + transpositions.setIdentity(); + if(size==0) sign = ZeroSign; + else if (numext::real(mat.coeff(0,0)) > static_cast(0) ) sign = PositiveSemiDef; + else if (numext::real(mat.coeff(0,0)) < static_cast(0)) sign = NegativeSemiDef; + else sign = ZeroSign; + return true; + } + + for (Index k = 0; k < size; ++k) + { + // Find largest diagonal element + Index index_of_biggest_in_corner; + mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); + index_of_biggest_in_corner += k; + + transpositions.coeffRef(k) = IndexType(index_of_biggest_in_corner); + if(k != index_of_biggest_in_corner) + { + // apply the transposition while taking care to consider only + // the lower triangular part + Index s = size-index_of_biggest_in_corner-1; // trailing size after the biggest element + mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); + mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); + std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); + for(Index i=k+1;i::IsComplex) + mat.coeffRef(index_of_biggest_in_corner,k) = numext::conj(mat.coeff(index_of_biggest_in_corner,k)); + } + + // partition the matrix: + // A00 | - | - + // lu = A10 | A11 | - + // A20 | A21 | A22 + Index rs = size - k - 1; + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + if(k>0) + { + temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint(); + mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); + if(rs>0) + A21.noalias() -= A20 * temp.head(k); + } + + // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot + // was smaller than the cutoff value. However, since LDLT is not rank-revealing + // we should only make sure that we do not introduce INF or NaN values. + // Remark that LAPACK also uses 0 as the cutoff value. + RealScalar realAkk = numext::real(mat.coeffRef(k,k)); + bool pivot_is_valid = (abs(realAkk) > RealScalar(0)); + + if(k==0 && !pivot_is_valid) + { + // The entire diagonal is zero, there is nothing more to do + // except filling the transpositions, and checking whether the matrix is zero. + sign = ZeroSign; + for(Index j = 0; j0) && pivot_is_valid) + A21 /= realAkk; + else if(rs>0) + ret = ret && (A21.array()==Scalar(0)).all(); + + if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed + else if(!pivot_is_valid) found_zero_pivot = true; + + if (sign == PositiveSemiDef) { + if (realAkk < static_cast(0)) sign = Indefinite; + } else if (sign == NegativeSemiDef) { + if (realAkk > static_cast(0)) sign = Indefinite; + } else if (sign == ZeroSign) { + if (realAkk > static_cast(0)) sign = PositiveSemiDef; + else if (realAkk < static_cast(0)) sign = NegativeSemiDef; + } + } + + return ret; + } + + // Reference for the algorithm: Davis and Hager, "Multiple Rank + // Modifications of a Sparse Cholesky Factorization" (Algorithm 1) + // Trivial rearrangements of their computations (Timothy E. Holy) + // allow their algorithm to work for rank-1 updates even if the + // original matrix is not of full rank. + // Here only rank-1 updates are implemented, to reduce the + // requirement for intermediate storage and improve accuracy + template + static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) + { + using numext::isfinite; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + const Index size = mat.rows(); + eigen_assert(mat.cols() == size && w.size()==size); + + RealScalar alpha = 1; + + // Apply the update + for (Index j = 0; j < size; j++) + { + // Check for termination due to an original decomposition of low-rank + if (!(isfinite)(alpha)) + break; + + // Update the diagonal terms + RealScalar dj = numext::real(mat.coeff(j,j)); + Scalar wj = w.coeff(j); + RealScalar swj2 = sigma*numext::abs2(wj); + RealScalar gamma = dj*alpha + swj2; + + mat.coeffRef(j,j) += swj2/alpha; + alpha += swj2/dj; + + + // Update the terms of L + Index rs = size-j-1; + w.tail(rs) -= wj * mat.col(j).tail(rs); + if(gamma != 0) + mat.col(j).tail(rs) += (sigma*numext::conj(wj)/gamma)*w.tail(rs); + } + return true; + } + + template + static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) + { + // Apply the permutation to the input w + tmp = transpositions * w; + + return ldlt_inplace::updateInPlace(mat,tmp,sigma); + } +}; + +template<> struct ldlt_inplace +{ + template + static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) + { + Transpose matt(mat); + return ldlt_inplace::unblocked(matt, transpositions, temp, sign); + } + + template + static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) + { + Transpose matt(mat); + return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); + } +}; + +template struct LDLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } +}; + +template struct LDLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } +}; + +} // end namespace internal + +/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix + */ +template +template +LDLT& LDLT::compute(const EigenBase& a) +{ + check_template_parameters(); + + eigen_assert(a.rows()==a.cols()); + const Index size = a.rows(); + + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } + + m_transpositions.resize(size); + m_isInitialized = false; + m_temporary.resize(size); + m_sign = internal::ZeroSign; + + m_info = internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success : NumericalIssue; + + m_isInitialized = true; + return *this; +} + +/** Update the LDLT decomposition: given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T. + * \param w a vector to be incorporated into the decomposition. + * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1. + * \sa setZero() + */ +template +template +LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename LDLT::RealScalar& sigma) +{ + typedef typename TranspositionType::StorageIndex IndexType; + const Index size = w.rows(); + if (m_isInitialized) + { + eigen_assert(m_matrix.rows()==size); + } + else + { + m_matrix.resize(size,size); + m_matrix.setZero(); + m_transpositions.resize(size); + for (Index i = 0; i < size; i++) + m_transpositions.coeffRef(i) = IndexType(i); + m_temporary.resize(size); + m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; + m_isInitialized = true; + } + + internal::ldlt_inplace::update(m_matrix, m_transpositions, m_temporary, w, sigma); + + return *this; +} + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + _solve_impl_transposed(rhs, dst); +} + +template +template +void LDLT<_MatrixType,_UpLo>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const +{ + // dst = P b + dst = m_transpositions * rhs; + + // dst = L^-1 (P b) + // dst = L^-*T (P b) + matrixL().template conjugateIf().solveInPlace(dst); + + // dst = D^-* (L^-1 P b) + // dst = D^-1 (L^-*T P b) + // more precisely, use pseudo-inverse of D (see bug 241) + using std::abs; + const typename Diagonal::RealReturnType vecD(vectorD()); + // In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min()) + // and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS: + // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); + // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest + // diagonal element is not well justified and leads to numerical issues in some cases. + // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. + // Using numeric_limits::min() gives us more robustness to denormals. + RealScalar tolerance = (std::numeric_limits::min)(); + for (Index i = 0; i < vecD.size(); ++i) + { + if(abs(vecD(i)) > tolerance) + dst.row(i) /= vecD(i); + else + dst.row(i).setZero(); + } + + // dst = L^-* (D^-* L^-1 P b) + // dst = L^-T (D^-1 L^-*T P b) + matrixL().transpose().template conjugateIf().solveInPlace(dst); + + // dst = P^T (L^-* D^-* L^-1 P b) = A^-1 b + // dst = P^-T (L^-T D^-1 L^-*T P b) = A^-1 b + dst = m_transpositions.transpose() * dst; +} +#endif + +/** \internal use x = ldlt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * + * This version avoids a copy when the right hand side matrix b is not + * needed anymore. + * + * \sa LDLT::solve(), MatrixBase::ldlt() + */ +template +template +bool LDLT::solveInPlace(MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + eigen_assert(m_matrix.rows() == bAndX.rows()); + + bAndX = this->solve(bAndX); + + return true; +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: P^T L D L^* P. + * This function is provided for debug purpose. */ +template +MatrixType LDLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + const Index size = m_matrix.rows(); + MatrixType res(size,size); + + // P + res.setIdentity(); + res = transpositionsP() * res; + // L^* P + res = matrixU() * res; + // D(L^*P) + res = vectorD().real().asDiagonal() * res; + // L(DL^*P) + res = matrixL() * res; + // P^T (LDL^*P) + res = transpositionsP().transpose() * res; + + return res; +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa MatrixBase::ldlt() + */ +template +inline const LDLT::PlainObject, UpLo> +SelfAdjointView::ldlt() const +{ + return LDLT(m_matrix); +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa SelfAdjointView::ldlt() + */ +template +inline const LDLT::PlainObject> +MatrixBase::ldlt() const +{ + return LDLT(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_LDLT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT.h b/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT.h new file mode 100644 index 0000000..8c9b2b3 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT.h @@ -0,0 +1,558 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LLT_H +#define EIGEN_LLT_H + +namespace Eigen { + +namespace internal{ + +template struct traits > + : traits<_MatrixType> +{ + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; +}; + +template struct LLT_Traits; +} + +/** \ingroup Cholesky_Module + * + * \class LLT + * + * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features + * + * \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * The other triangular part won't be read. + * + * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite + * matrix A such that A = LL^* = U^*U, where L is lower triangular. + * + * While the Cholesky decomposition is particularly useful to solve selfadjoint problems like D^*D x = b, + * for that purpose, we recommend the Cholesky decomposition without square root which is more stable + * and even faster. Nevertheless, this standard Cholesky decomposition remains useful in many other + * situations like generalised eigen problems with hermitian matrices. + * + * Remember that Cholesky decompositions are not rank-revealing. This LLT decomposition is only stable on positive definite matrices, + * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations + * has a solution. + * + * Example: \include LLT_example.cpp + * Output: \verbinclude LLT_example.out + * + * \b Performance: for best performance, it is recommended to use a column-major storage format + * with the Lower triangular part (the default), or, equivalently, a row-major storage format + * with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization + * step, and rank-updates can be up to 3 times slower. + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * Note that during the decomposition, only the lower (or upper, as defined by _UpLo) triangular part of A is considered. + * Therefore, the strict lower part does not have to store correct values. + * + * \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT + */ +template class LLT + : public SolverBase > +{ + public: + typedef _MatrixType MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LLT) + enum { + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + + enum { + PacketSize = internal::packet_traits::size, + AlignmentMask = int(PacketSize)-1, + UpLo = _UpLo + }; + + typedef internal::LLT_Traits Traits; + + /** + * \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LLT::compute(const MatrixType&). + */ + LLT() : m_matrix(), 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 LLT() + */ + explicit LLT(Index size) : m_matrix(size, size), + m_isInitialized(false) {} + + template + explicit LLT(const EigenBase& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \brief Constructs a LLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when + * \c MatrixType is a Eigen::Ref. + * + * \sa LLT(const EigenBase&) + */ + template + explicit LLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + 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 + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return Traits::getL(m_matrix); + } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * Since this LLT class assumes anyway that the matrix A is invertible, the solution + * theoretically exists and is unique regardless of b. + * + * Example: \include LLT_solve.cpp + * Output: \verbinclude LLT_solve.out + * + * \sa solveInPlace(), MatrixBase::llt(), SelfAdjointView::llt() + */ + template + inline const Solve + solve(const MatrixBase& b) const; + #endif + + template + void solveInPlace(const MatrixBase &bAndX) const; + + template + LLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the Cholesky decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_info == Success && "LLT failed because matrix appears to be negative"); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } + + /** \returns the LLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLLT() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was successful, + * \c NumericalIssue if the matrix.appears not to be positive definite. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_info; + } + + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; }; + + inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + template + LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif + + protected: + + static void check_template_parameters() + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); + } + + /** \internal + * Used to compute and store L + * The strict upper part is not used and even not initialized. + */ + MatrixType m_matrix; + RealScalar m_l1_norm; + bool m_isInitialized; + ComputationInfo m_info; +}; + +namespace internal { + +template struct llt_inplace; + +template +static Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) +{ + using std::sqrt; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename MatrixType::ColXpr ColXpr; + typedef typename internal::remove_all::type ColXprCleaned; + typedef typename ColXprCleaned::SegmentReturnType ColXprSegment; + typedef Matrix TempVectorType; + typedef typename TempVectorType::SegmentReturnType TempVecSegment; + + Index n = mat.cols(); + eigen_assert(mat.rows()==n && vec.size()==n); + + TempVectorType temp; + + if(sigma>0) + { + // This version is based on Givens rotations. + // It is faster than the other one below, but only works for updates, + // i.e., for sigma > 0 + temp = sqrt(sigma) * vec; + + for(Index i=0; i g; + g.makeGivens(mat(i,i), -temp(i), &mat(i,i)); + + Index rs = n-i-1; + if(rs>0) + { + ColXprSegment x(mat.col(i).tail(rs)); + TempVecSegment y(temp.tail(rs)); + apply_rotation_in_the_plane(x, y, g); + } + } + } + else + { + temp = vec; + RealScalar beta = 1; + for(Index j=0; j struct llt_inplace +{ + typedef typename NumTraits::Real RealScalar; + template + static Index unblocked(MatrixType& mat) + { + using std::sqrt; + + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + for(Index k = 0; k < size; ++k) + { + Index rs = size-k-1; // remaining size + + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + RealScalar x = numext::real(mat.coeff(k,k)); + if (k>0) x -= A10.squaredNorm(); + if (x<=RealScalar(0)) + return k; + mat.coeffRef(k,k) = x = sqrt(x); + if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint(); + if (rs>0) A21 /= x; + } + return -1; + } + + template + static Index blocked(MatrixType& m) + { + eigen_assert(m.rows()==m.cols()); + Index size = m.rows(); + if(size<32) + return unblocked(m); + + Index blockSize = size/8; + blockSize = (blockSize/16)*16; + blockSize = (std::min)((std::max)(blockSize,Index(8)), Index(128)); + + for (Index k=0; k A11(m,k, k, bs,bs); + Block A21(m,k+bs,k, rs,bs); + Block A22(m,k+bs,k+bs,rs,rs); + + Index ret; + if((ret=unblocked(A11))>=0) return k+ret; + if(rs>0) A11.adjoint().template triangularView().template solveInPlace(A21); + if(rs>0) A22.template selfadjointView().rankUpdate(A21,typename NumTraits::Literal(-1)); // bottleneck + } + return -1; + } + + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); + } +}; + +template struct llt_inplace +{ + typedef typename NumTraits::Real RealScalar; + + template + static EIGEN_STRONG_INLINE Index unblocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::unblocked(matt); + } + template + static EIGEN_STRONG_INLINE Index blocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::blocked(matt); + } + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + Transpose matt(mat); + return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); + } +}; + +template struct LLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +template struct LLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +} // end namespace internal + +/** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix + * + * \returns a reference to *this + * + * Example: \include TutorialLinAlgComputeTwice.cpp + * Output: \verbinclude TutorialLinAlgComputeTwice.out + */ +template +template +LLT& LLT::compute(const EigenBase& a) +{ + check_template_parameters(); + + eigen_assert(a.rows()==a.cols()); + const Index size = a.rows(); + m_matrix.resize(size, size); + if (!internal::is_same_dense(m_matrix, a.derived())) + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } + + m_isInitialized = true; + bool ok = Traits::inplace_decomposition(m_matrix); + m_info = ok ? Success : NumericalIssue; + + return *this; +} + +/** Performs a rank one update (or dowdate) of the current decomposition. + * If A = LL^* before the rank one update, + * then after it we have LL^* = A + sigma * v v^* where \a v must be a vector + * of same dimension. + */ +template +template +LLT<_MatrixType,_UpLo> & LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, const RealScalar& sigma) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType); + eigen_assert(v.size()==m_matrix.cols()); + eigen_assert(m_isInitialized); + if(internal::llt_inplace::rankUpdate(m_matrix,v,sigma)>=0) + m_info = NumericalIssue; + else + m_info = Success; + + return *this; +} + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + _solve_impl_transposed(rhs, dst); +} + +template +template +void LLT<_MatrixType,_UpLo>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const +{ + dst = rhs; + + matrixL().template conjugateIf().solveInPlace(dst); + matrixU().template conjugateIf().solveInPlace(dst); +} +#endif + +/** \internal use x = llt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * This version avoids a copy when the right hand side matrix b is not needed anymore. + * + * \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. + * This function will const_cast it, so constness isn't honored here. + * + * \sa LLT::solve(), MatrixBase::llt() + */ +template +template +void LLT::solveInPlace(const MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_matrix.rows()==bAndX.rows()); + matrixL().solveInPlace(bAndX); + matrixU().solveInPlace(bAndX); +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: L L^*. + * This function is provided for debug purpose. */ +template +MatrixType LLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + return matrixL() * matrixL().adjoint().toDenseMatrix(); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() + */ +template +inline const LLT::PlainObject> +MatrixBase::llt() const +{ + return LLT(derived()); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() + */ +template +inline const LLT::PlainObject, UpLo> +SelfAdjointView::llt() const +{ + return LLT(m_matrix); +} + +} // end namespace Eigen + +#endif // EIGEN_LLT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT_LAPACKE.h b/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT_LAPACKE.h new file mode 100644 index 0000000..bc6489e --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Cholesky/LLT_LAPACKE.h @@ -0,0 +1,99 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to LAPACKe + * LLt decomposition based on LAPACKE_?potrf function. + ******************************************************************************** +*/ + +#ifndef EIGEN_LLT_LAPACKE_H +#define EIGEN_LLT_LAPACKE_H + +namespace Eigen { + +namespace internal { + +template struct lapacke_llt; + +#define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \ +template<> struct lapacke_llt \ +{ \ + template \ + static inline Index potrf(MatrixType& m, char uplo) \ + { \ + lapack_int matrix_order; \ + lapack_int size, lda, info, StorageOrder; \ + EIGTYPE* a; \ + eigen_assert(m.rows()==m.cols()); \ + /* Set up parameters for ?potrf */ \ + size = convert_index(m.rows()); \ + StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ + matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ + a = &(m.coeffRef(0,0)); \ + lda = convert_index(m.outerStride()); \ +\ + info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \ + info = (info==0) ? -1 : info>0 ? info-1 : size; \ + return info; \ + } \ +}; \ +template<> struct llt_inplace \ +{ \ + template \ + static Index blocked(MatrixType& m) \ + { \ + return lapacke_llt::potrf(m, 'L'); \ + } \ + template \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ +}; \ +template<> struct llt_inplace \ +{ \ + template \ + static Index blocked(MatrixType& m) \ + { \ + return lapacke_llt::potrf(m, 'U'); \ + } \ + template \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + { \ + Transpose matt(mat); \ + return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \ + } \ +}; + +EIGEN_LAPACKE_LLT(double, double, d) +EIGEN_LAPACKE_LLT(float, float, s) +EIGEN_LAPACKE_LLT(dcomplex, lapack_complex_double, z) +EIGEN_LAPACKE_LLT(scomplex, lapack_complex_float, c) + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_LLT_LAPACKE_H diff --git a/lib/eigen-3.4.0/Eigen/src/CholmodSupport/CholmodSupport.h b/lib/eigen-3.4.0/Eigen/src/CholmodSupport/CholmodSupport.h new file mode 100644 index 0000000..adaf528 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/CholmodSupport/CholmodSupport.h @@ -0,0 +1,682 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_H +#define EIGEN_CHOLMODSUPPORT_H + +namespace Eigen { + +namespace internal { + +template struct cholmod_configure_matrix; + +template<> struct cholmod_configure_matrix { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_REAL; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +template<> struct cholmod_configure_matrix > { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_COMPLEX; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +// Other scalar types are not yet supported by Cholmod +// template<> struct cholmod_configure_matrix { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_REAL; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; +// +// template<> struct cholmod_configure_matrix > { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_COMPLEX; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; + +} // namespace internal + +/** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object. + * Note that the data are shared. + */ +template +cholmod_sparse viewAsCholmod(Ref > mat) +{ + 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.z = 0; + res.sorted = 1; + if(mat.isCompressed()) + { + res.packed = 1; + res.nz = 0; + } + else + { + res.packed = 0; + res.nz = mat.innerNonZeroPtr(); + } + + res.dtype = 0; + res.stype = -1; + + if (internal::is_same<_StorageIndex,int>::value) + { + res.itype = CHOLMOD_INT; + } + else if (internal::is_same<_StorageIndex,SuiteSparse_long>::value) + { + res.itype = CHOLMOD_LONG; + } + else + { + eigen_assert(false && "Index type not supported yet"); + } + + // setup res.xtype + internal::cholmod_configure_matrix<_Scalar>::run(res); + + res.stype = 0; + + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseMatrix<_Scalar,_Options,_Index>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseVector<_Scalar,_Options,_Index>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(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 +cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.matrix().const_cast_derived())); + + if(UpLo==Upper) res.stype = 1; + if(UpLo==Lower) res.stype = -1; + // swap stype for rowmajor matrices (only works for real matrices) + EIGEN_STATIC_ASSERT((_Options & RowMajorBit) == 0 || NumTraits<_Scalar>::IsComplex == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + if(_Options & RowMajorBit) 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 +cholmod_dense viewAsCholmod(MatrixBase& mat) +{ + EIGEN_STATIC_ASSERT((internal::traits::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 = (void*)(mat.derived().data()); + res.z = 0; + + internal::cholmod_configure_matrix::run(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 +MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) +{ + return MappedSparseMatrix + (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], + static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); +} + +namespace internal { + +// template specializations for int and long that call the correct cholmod method + +#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \ + template inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); } \ + template<> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_l_ ## name (&Common); } + +#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \ + template inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); } \ + template<> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_l_ ## name (&a1, &Common); } + +EIGEN_CHOLMOD_SPECIALIZE0(int, start) +EIGEN_CHOLMOD_SPECIALIZE0(int, finish) + +EIGEN_CHOLMOD_SPECIALIZE1(int, free_factor, cholmod_factor*, L) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_dense, cholmod_dense*, X) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A) + +EIGEN_CHOLMOD_SPECIALIZE1(cholmod_factor*, analyze, cholmod_sparse, A) + +template inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_solve (sys, &L, &B, &Common); } +template<> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_l_solve (sys, &L, &B, &Common); } + +template inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_spsolve (sys, &L, &B, &Common); } +template<> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); } + +template +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], _StorageIndex* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_factorize_p (A, beta, fset, fsize, L, &Common); } +template<> +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common); } + +#undef EIGEN_CHOLMOD_SPECIALIZE0 +#undef EIGEN_CHOLMOD_SPECIALIZE1 + +} // namespace internal + + +enum CholmodMode { + CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodBase + * \brief The base class for the direct Cholesky factorization of Cholmod + * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT + */ +template +class CholmodBase : public SparseSolverBase +{ + protected: + typedef SparseSolverBase Base; + using Base::derived; + using Base::m_isInitialized; + public: + typedef _MatrixType MatrixType; + enum { UpLo = _UpLo }; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef MatrixType CholMatrixType; + typedef typename MatrixType::StorageIndex StorageIndex; + enum { + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + + public: + + CholmodBase() + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); + } + + explicit CholmodBase(const MatrixType& matrix) + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); + compute(matrix); + } + + ~CholmodBase() + { + if(m_cholmodFactor) + internal::cm_free_factor(m_cholmodFactor, m_cholmod); + internal::cm_finish(m_cholmod); + } + + inline StorageIndex cols() const { return internal::convert_index(m_cholmodFactor->n); } + inline StorageIndex rows() const { return internal::convert_index(m_cholmodFactor->n); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was successful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "Decomposition is not initialized."); + return m_info; + } + + /** Computes the sparse Cholesky decomposition of \a matrix */ + Derived& compute(const MatrixType& matrix) + { + analyzePattern(matrix); + factorize(matrix); + return derived(); + } + + /** Performs a symbolic decomposition on the sparsity pattern of \a matrix. + * + * This function is particularly useful when solving for several problems having the same structure. + * + * \sa factorize() + */ + void analyzePattern(const MatrixType& matrix) + { + if(m_cholmodFactor) + { + internal::cm_free_factor(m_cholmodFactor, m_cholmod); + m_cholmodFactor = 0; + } + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + m_cholmodFactor = internal::cm_analyze(A, m_cholmod); + + this->m_isInitialized = true; + this->m_info = Success; + m_analysisIsOk = true; + m_factorizationIsOk = false; + } + + /** Performs a numeric decomposition of \a matrix + * + * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. + * + * \sa analyzePattern() + */ + void factorize(const MatrixType& matrix) + { + eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + internal::cm_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, m_cholmod); + + // If the factorization failed, minor is the column at which it did. On success minor == n. + this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); + m_factorizationIsOk = true; + } + + /** 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 + void _solve_impl(const MatrixBase &b, MatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // Cholmod needs column-major storage without inner-stride, which corresponds to the default behavior of Ref. + Ref > b_ref(b.derived()); + + cholmod_dense b_cd = viewAsCholmod(b_ref); + cholmod_dense* x_cd = internal::cm_solve(CHOLMOD_A, *m_cholmodFactor, b_cd, m_cholmod); + if(!x_cd) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + // NOTE Actually, the copy can be avoided by calling cholmod_solve2 instead of cholmod_solve + dest = Matrix::Map(reinterpret_cast(x_cd->x),b.rows(),b.cols()); + internal::cm_free_dense(x_cd, m_cholmod); + } + + /** \internal */ + template + void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // note: cs stands for Cholmod Sparse + Ref > b_ref(b.const_cast_derived()); + cholmod_sparse b_cs = viewAsCholmod(b_ref); + cholmod_sparse* x_cs = internal::cm_spsolve(CHOLMOD_A, *m_cholmodFactor, b_cs, m_cholmod); + if(!x_cs) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + // NOTE cholmod_spsolve in fact just calls the dense solver for blocks of 4 columns at a time (similar to Eigen's sparse solver) + dest.derived() = viewAsEigen(*x_cs); + internal::cm_free_sparse(x_cs, m_cholmod); + } + #endif // EIGEN_PARSED_BY_DOXYGEN + + + /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. + * + * During the numerical factorization, an offset term is added to the diagonal coefficients:\n + * \c d_ii = \a offset + \c d_ii + * + * The default is \a offset=0. + * + * \returns a reference to \c *this. + */ + Derived& setShift(const RealScalar& offset) + { + m_shiftOffset[0] = double(offset); + return derived(); + } + + /** \returns the determinant of the underlying matrix from the current factorization */ + Scalar determinant() const + { + using std::exp; + return exp(logDeterminant()); + } + + /** \returns the log determinant of the underlying matrix from the current factorization */ + Scalar logDeterminant() const + { + using std::log; + using numext::real; + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + + RealScalar logDet = 0; + Scalar *x = static_cast(m_cholmodFactor->x); + if (m_cholmodFactor->is_super) + { + // Supernodal factorization stored as a packed list of dense column-major blocs, + // as described by the following structure: + + // super[k] == index of the first column of the j-th super node + StorageIndex *super = static_cast(m_cholmodFactor->super); + // pi[k] == offset to the description of row indices + StorageIndex *pi = static_cast(m_cholmodFactor->pi); + // px[k] == offset to the respective dense block + StorageIndex *px = static_cast(m_cholmodFactor->px); + + Index nb_super_nodes = m_cholmodFactor->nsuper; + for (Index k=0; k < nb_super_nodes; ++k) + { + StorageIndex ncols = super[k + 1] - super[k]; + StorageIndex nrows = pi[k + 1] - pi[k]; + + Map, 0, InnerStride<> > sk(x + px[k], ncols, InnerStride<>(nrows+1)); + logDet += sk.real().log().sum(); + } + } + else + { + // Simplicial factorization stored as standard CSC matrix. + StorageIndex *p = static_cast(m_cholmodFactor->p); + Index size = m_cholmodFactor->n; + for (Index k=0; kis_ll) + logDet *= 2.0; + return logDet; + }; + + template + void dumpMemory(Stream& /*s*/) + {} + + protected: + mutable cholmod_common m_cholmod; + cholmod_factor* m_cholmodFactor; + double m_shiftOffset[2]; + mutable ComputationInfo m_info; + int m_factorizationIsOk; + int m_analysisIsOk; +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLLT + * \brief A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint 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. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLLT + */ +template +class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSimplicialLLT() : Base() { init(); } + + CholmodSimplicialLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 0; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + m_cholmod.final_ll = 1; + } +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLDLT + * \brief A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLDLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint 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. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLDLT + */ +template +class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSimplicialLDLT() : Base() { init(); } + + CholmodSimplicialLDLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLDLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSupernodalLLT + * \brief A supernodal Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a supernodal LL^T Cholesky factorization + * using the Cholmod library. + * This supernodal variant performs best on dense enough problems, e.g., 3D FEM, or very high order 2D FEM. + * The sparse matrix A must be selfadjoint 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. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSupernodalLLT() : Base() { init(); } + + CholmodSupernodalLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSupernodalLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SUPERNODAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodDecomposition + * \brief A general 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 selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * This variant permits to change the underlying Cholesky method at runtime. + * On the other hand, it does not provide access to the result of the factorization. + * The default is to let Cholmod automatically choose between a simplicial and supernodal factorization. + * + * \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. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecomposition<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodDecomposition> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodDecomposition() : Base() { init(); } + + CholmodDecomposition(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodDecomposition() {} + + 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; + } + } + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_AUTO; + } +}; + +} // end namespace Eigen + +#endif // EIGEN_CHOLMODSUPPORT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ArithmeticSequence.h b/lib/eigen-3.4.0/Eigen/src/Core/ArithmeticSequence.h new file mode 100644 index 0000000..b6200fa --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ArithmeticSequence.h @@ -0,0 +1,413 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARITHMETIC_SEQUENCE_H +#define EIGEN_ARITHMETIC_SEQUENCE_H + +namespace Eigen { + +namespace internal { + +#if (!EIGEN_HAS_CXX11) || !((!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48) +template struct aseq_negate {}; + +template<> struct aseq_negate { + typedef Index type; +}; + +template struct aseq_negate > { + typedef FixedInt<-N> type; +}; + +// Compilation error in the following case: +template<> struct aseq_negate > {}; + +template::value, + bool SizeIsSymbolic =symbolic::is_symbolic::value> +struct aseq_reverse_first_type { + typedef Index type; +}; + +template +struct aseq_reverse_first_type { + typedef symbolic::AddExpr > >, + symbolic::ValueExpr > + > type; +}; + +template +struct aseq_reverse_first_type_aux { + typedef Index type; +}; + +template +struct aseq_reverse_first_type_aux::type> { + typedef FixedInt<(SizeType::value-1)*IncrType::value> type; +}; + +template +struct aseq_reverse_first_type { + typedef typename aseq_reverse_first_type_aux::type Aux; + typedef symbolic::AddExpr > type; +}; + +template +struct aseq_reverse_first_type { + typedef symbolic::AddExpr > >, + symbolic::ValueExpr >, + symbolic::ValueExpr<> > type; +}; +#endif + +// Helper to cleanup the type of the increment: +template struct cleanup_seq_incr { + typedef typename cleanup_index_type::type type; +}; + +} + +//-------------------------------------------------------------------------------- +// seq(first,last,incr) and seqN(first,size,incr) +//-------------------------------------------------------------------------------- + +template > +class ArithmeticSequence; + +template +ArithmeticSequence::type, + typename internal::cleanup_index_type::type, + typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr); + +/** \class ArithmeticSequence + * \ingroup Core_Module + * + * This class represents an arithmetic progression \f$ a_0, a_1, a_2, ..., a_{n-1}\f$ defined by + * its \em first value \f$ a_0 \f$, its \em size (aka length) \em n, and the \em increment (aka stride) + * that is equal to \f$ a_{i+1}-a_{i}\f$ for any \em i. + * + * It is internally used as the return type of the Eigen::seq and Eigen::seqN functions, and as the input arguments + * of DenseBase::operator()(const RowIndices&, const ColIndices&), and most of the time this is the + * only way it is used. + * + * \tparam FirstType type of the first element, usually an Index, + * but internally it can be a symbolic expression + * \tparam SizeType type representing the size of the sequence, usually an Index + * or a compile time integral constant. Internally, it can also be a symbolic expression + * \tparam IncrType type of the increment, can be a runtime Index, or a compile time integral constant (default is compile-time 1) + * + * \sa Eigen::seq, Eigen::seqN, DenseBase::operator()(const RowIndices&, const ColIndices&), class IndexedView + */ +template +class ArithmeticSequence +{ +public: + ArithmeticSequence(FirstType first, SizeType size) : m_first(first), m_size(size) {} + ArithmeticSequence(FirstType first, SizeType size, IncrType incr) : m_first(first), m_size(size), m_incr(incr) {} + + enum { + SizeAtCompileTime = internal::get_fixed_value::value, + IncrAtCompileTime = internal::get_fixed_value::value + }; + + /** \returns the size, i.e., number of elements, of the sequence */ + Index size() const { return m_size; } + + /** \returns the first element \f$ a_0 \f$ in the sequence */ + Index first() const { return m_first; } + + /** \returns the value \f$ a_i \f$ at index \a i in the sequence. */ + Index operator[](Index i) const { return m_first + i * m_incr; } + + const FirstType& firstObject() const { return m_first; } + const SizeType& sizeObject() const { return m_size; } + const IncrType& incrObject() const { return m_incr; } + +protected: + FirstType m_first; + SizeType m_size; + IncrType m_incr; + +public: + +#if EIGEN_HAS_CXX11 && ((!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48) + auto reverse() const -> decltype(Eigen::seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr)) { + return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); + } +#else +protected: + typedef typename internal::aseq_negate::type ReverseIncrType; + typedef typename internal::aseq_reverse_first_type::type ReverseFirstType; +public: + ArithmeticSequence + reverse() const { + return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); + } +#endif +}; + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and increment \a incr + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type>(first,size,incr); +} + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and unit increment + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type > +seqN(FirstType first, SizeType size) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type>(first,size); +} + +#ifdef EIGEN_PARSED_BY_DOXYGEN + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and with positive (or negative) increment \a incr + * + * It is essentially an alias to: + * \code + * seqN(f, (l-f+incr)/incr, incr); + * \endcode + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) + */ +template +auto seq(FirstType f, LastType l, IncrType incr); + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and unit increment + * + * It is essentially an alias to: + * \code + * seqN(f,l-f+1); + * \endcode + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) + */ +template +auto seq(FirstType f, LastType l); + +#else // EIGEN_PARSED_BY_DOXYGEN + +#if EIGEN_HAS_CXX11 +template +auto seq(FirstType f, LastType l) -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+fix<1>()))) +{ + return seqN(typename internal::cleanup_index_type::type(f), + (typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+fix<1>())); +} + +template +auto seq(FirstType f, LastType l, IncrType incr) + -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+typename internal::cleanup_seq_incr::type(incr) + ) / typename internal::cleanup_seq_incr::type(incr), + typename internal::cleanup_seq_incr::type(incr))) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr)) / CleanedIncrType(incr), + CleanedIncrType(incr)); +} + +#else // EIGEN_HAS_CXX11 + +template +typename internal::enable_if::value || symbolic::is_symbolic::value), + ArithmeticSequence::type,Index> >::type +seq(FirstType f, LastType l) +{ + return seqN(typename internal::cleanup_index_type::type(f), + Index((typename internal::cleanup_index_type::type(l)-typename internal::cleanup_index_type::type(f)+fix<1>()))); +} + +template +typename internal::enable_if::value, + ArithmeticSequence,symbolic::ValueExpr<> >, + symbolic::ValueExpr > > > >::type +seq(const symbolic::BaseExpr &f, LastType l) +{ + return seqN(f.derived(),(typename internal::cleanup_index_type::type(l)-f.derived()+fix<1>())); +} + +template +typename internal::enable_if::value, + ArithmeticSequence::type, + symbolic::AddExpr >, + symbolic::ValueExpr > > > >::type +seq(FirstType f, const symbolic::BaseExpr &l) +{ + return seqN(typename internal::cleanup_index_type::type(f),(l.derived()-typename internal::cleanup_index_type::type(f)+fix<1>())); +} + +template +ArithmeticSequence >,symbolic::ValueExpr > > > +seq(const symbolic::BaseExpr &f, const symbolic::BaseExpr &l) +{ + return seqN(f.derived(),(l.derived()-f.derived()+fix<1>())); +} + + +template +typename internal::enable_if::value || symbolic::is_symbolic::value), + ArithmeticSequence::type,Index,typename internal::cleanup_seq_incr::type> >::type +seq(FirstType f, LastType l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + Index((typename internal::cleanup_index_type::type(l)-typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr))/CleanedIncrType(incr)), incr); +} + +template +typename internal::enable_if::value, + ArithmeticSequence, + symbolic::ValueExpr<> >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> >::type +seq(const symbolic::BaseExpr &f, LastType l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(f.derived(),(typename internal::cleanup_index_type::type(l)-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} + +template +typename internal::enable_if::value, + ArithmeticSequence::type, + symbolic::QuotientExpr >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> >::type +seq(FirstType f, const symbolic::BaseExpr &l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + (l.derived()-typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} + +template +ArithmeticSequence >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> +seq(const symbolic::BaseExpr &f, const symbolic::BaseExpr &l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(f.derived(),(l.derived()-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} +#endif // EIGEN_HAS_CXX11 + +#endif // EIGEN_PARSED_BY_DOXYGEN + + +#if EIGEN_HAS_CXX11 || defined(EIGEN_PARSED_BY_DOXYGEN) +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with increment \a incr. + * + * It is a shortcut for: \code seqN(last-(size-fix<1>)*incr, size, incr) \endcode + * + * \sa lastN(SizeType), seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +auto lastN(SizeType size, IncrType incr) +-> decltype(seqN(Eigen::last-(size-fix<1>())*incr, size, incr)) +{ + return seqN(Eigen::last-(size-fix<1>())*incr, size, incr); +} + +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with a unit increment. + * + * It is a shortcut for: \code seq(last+fix<1>-size, last) \endcode + * + * \sa lastN(SizeType,IncrType, seqN(FirstType,SizeType), seq(FirstType,LastType) */ +template +auto lastN(SizeType size) +-> decltype(seqN(Eigen::last+fix<1>()-size, size)) +{ + return seqN(Eigen::last+fix<1>()-size, size); +} +#endif + +namespace internal { + +// Convert a symbolic span into a usable one (i.e., remove last/end "keywords") +template +struct make_size_type { + typedef typename internal::conditional::value, Index, T>::type type; +}; + +template +struct IndexedViewCompatibleType, XprSize> { + typedef ArithmeticSequence::type,IncrType> type; +}; + +template +ArithmeticSequence::type,IncrType> +makeIndexedViewCompatible(const ArithmeticSequence& ids, Index size,SpecializedType) { + return ArithmeticSequence::type,IncrType>( + eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.sizeObject(),size),ids.incrObject()); +} + +template +struct get_compile_time_incr > { + enum { value = get_fixed_value::value }; +}; + +} // end namespace internal + +/** \namespace Eigen::indexing + * \ingroup Core_Module + * + * The sole purpose of this namespace is to be able to import all functions + * and symbols that are expected to be used within operator() for indexing + * and slicing. If you already imported the whole Eigen namespace: + * \code using namespace Eigen; \endcode + * then you are already all set. Otherwise, if you don't want/cannot import + * the whole Eigen namespace, the following line: + * \code using namespace Eigen::indexing; \endcode + * is equivalent to: + * \code + using Eigen::all; + using Eigen::seq; + using Eigen::seqN; + using Eigen::lastN; // c++11 only + using Eigen::last; + using Eigen::lastp1; + using Eigen::fix; + \endcode + */ +namespace indexing { + using Eigen::all; + using Eigen::seq; + using Eigen::seqN; + #if EIGEN_HAS_CXX11 + using Eigen::lastN; + #endif + using Eigen::last; + using Eigen::lastp1; + using Eigen::fix; +} + +} // end namespace Eigen + +#endif // EIGEN_ARITHMETIC_SEQUENCE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Array.h b/lib/eigen-3.4.0/Eigen/src/Core/Array.h new file mode 100644 index 0000000..20c789b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Array.h @@ -0,0 +1,417 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAY_H +#define EIGEN_ARRAY_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits > +{ + typedef ArrayXpr XprKind; + typedef ArrayBase > XprBase; +}; +} + +/** \class Array + * \ingroup Core_Module + * + * \brief General-purpose arrays with easy API for coefficient-wise operations + * + * The %Array class is very similar to the Matrix class. It provides + * general-purpose one- and two-dimensional arrays. The difference between the + * %Array and the %Matrix class is primarily in the API: the API for the + * %Array class provides easy access to coefficient-wise operations, while the + * API for the %Matrix class provides easy access to linear-algebra + * operations. + * + * See documentation of class Matrix for detailed information on the template parameters + * storage layout. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. + * + * \sa \blank \ref TutorialArrayClass, \ref TopicClassHierarchy + */ +template +class Array + : public PlainObjectBase > +{ + public: + + typedef PlainObjectBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Array) + + enum { Options = _Options }; + typedef typename Base::PlainObject PlainObject; + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; + + public: + + using Base::base; + using Base::coeff; + using Base::coeffRef; + + /** + * The usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() + */ + /* This overload is needed because the usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Scalar &value) + { + Base::setConstant(value); + return *this; + } + + /** Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const DenseBase& other) + { + return Base::_set(other); + } + + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Array& other) + { + return Base::_set(other); + } + + /** Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ?? + /** \internal */ + EIGEN_DEVICE_FUNC + Array(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } +#endif + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + Array(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) + { + Base::_check_template_params(); + } + EIGEN_DEVICE_FUNC + Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + Base::operator=(std::move(other)); + return *this; + } +#endif + + #if EIGEN_HAS_CXX11 + /** \copydoc PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + * + * Example: \include Array_variadic_ctor_cxx11.cpp + * Output: \verbinclude Array_variadic_ctor_cxx11.out + * + * \sa Array(const std::initializer_list>&) + * \sa Array(const Scalar&), Array(const Scalar&,const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 + * + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Array_initializer_list_23_cxx11.cpp + * Output: \verbinclude Array_initializer_list_23_cxx11.out + * + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column 1D array, implicit transposition from a single row is allowed. + * Therefore Array{{1,2,3,4,5}} is legal and the more verbose syntax + * Array{{1},{2},{3},{4},{5}} can be avoided: + * + * Example: \include Array_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Array_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes, + * and implicit transposition is allowed for compile-time 1D arrays only. + * + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const std::initializer_list>& list) : Base(list) {} + #endif // end EIGEN_HAS_CXX11 + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(const T& x) + { + Base::_check_template_params(); + Base::template _init1(x); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) + { + Base::_check_template_params(); + this->template _init2(val0, val1); + } + + #else + /** \brief Constructs a fixed-sized array initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC explicit Array(const Scalar *data); + /** Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Array() instead. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(Index dim); + /** constructs an initialized 1x1 Array with the given coefficient + * \sa const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args */ + Array(const Scalar& value); + /** constructs an uninitialized array with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size arrays. For fixed-size arrays, + * it is redundant to pass these parameters, so one should use the default constructor + * Array() instead. */ + Array(Index rows, Index cols); + /** constructs an initialized 2D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ + Array(const Scalar& val0, const Scalar& val1); + #endif // end EIGEN_PARSED_BY_DOXYGEN + + /** constructs an initialized 3D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + } + /** constructs an initialized 4D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + m_storage.data()[3] = val3; + } + + /** Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Array& other) + : Base(other) + { } + + private: + struct PrivateType {}; + public: + + /** \sa MatrixBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const EigenBase &other, + typename internal::enable_if::value, + PrivateType>::type = PrivateType()) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT{ return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } + + #ifdef EIGEN_ARRAY_PLUGIN + #include EIGEN_ARRAY_PLUGIN + #endif + + private: + + template + friend struct internal::matrix_swap_impl; +}; + +/** \defgroup arraytypedefs Global array typedefs + * \ingroup Core_Module + * + * %Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * + * The general patterns are the following: + * + * \c ArrayRowsColsType where \c Rows and \c Cols can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, + * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd + * for complex double. + * + * For example, \c Array33d is a fixed-size 3x3 array type of doubles, and \c ArrayXXf is a dynamic-size matrix of floats. + * + * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is + * a fixed-size 1D array of 4 complex floats. + * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `ArrayRowsCols` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size. + * - `ArraySize` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays. + * + * \sa class Array + */ + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##SizeSuffix##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##Size##X##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##X##Size##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS + +#if EIGEN_HAS_CXX11 + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix##SizeSuffix = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix = Array; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##Size##X = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##X##Size = Array; + +EIGEN_MAKE_ARRAY_TYPEDEFS(2, 2) +EIGEN_MAKE_ARRAY_TYPEDEFS(3, 3) +EIGEN_MAKE_ARRAY_TYPEDEFS(4, 4) +EIGEN_MAKE_ARRAY_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(2) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(3) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(4) + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS + +#endif // EIGEN_HAS_CXX11 + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ +using Eigen::Matrix##SizeSuffix##TypeSuffix; \ +using Eigen::Vector##SizeSuffix##TypeSuffix; \ +using Eigen::RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(TypeSuffix) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ + +#define EIGEN_USING_ARRAY_TYPEDEFS \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(i) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(f) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd) + +} // end namespace Eigen + +#endif // EIGEN_ARRAY_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ArrayBase.h b/lib/eigen-3.4.0/Eigen/src/Core/ArrayBase.h new file mode 100644 index 0000000..ea3dd1c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ArrayBase.h @@ -0,0 +1,226 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAYBASE_H +#define EIGEN_ARRAYBASE_H + +namespace Eigen { + +template class MatrixWrapper; + +/** \class ArrayBase + * \ingroup Core_Module + * + * \brief Base class for all 1D and 2D array, and related expressions + * + * An array is similar to a dense vector or matrix. While matrices are mathematical + * objects with well defined linear algebra operators, an array is just a collection + * of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, + * all operations applied to an array are performed coefficient wise. Furthermore, + * arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient + * constructors allowing to easily write generic code working for both scalar values + * and arrays. + * + * This class is the base that is inherited by all array expression types. + * + * \tparam Derived is the derived type, e.g., an array or an expression type. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. + * + * \sa class MatrixBase, \ref TopicClassHierarchy + */ +template class ArrayBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** The base class for a given storage type. */ + typedef ArrayBase StorageBaseType; + + typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::operator-; + using Base::operator=; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Base::PlainObject PlainObject; + + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/ArrayCwiseUnaryOps.h" +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# include "../plugins/ArrayCwiseBinaryOps.h" +# ifdef EIGEN_ARRAYBASE_PLUGIN +# include EIGEN_ARRAYBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const ArrayBase& other) + { + internal::call_assignment(derived(), other.derived()); + return derived(); + } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const Scalar &value) + { Base::setConstant(value); return derived(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const Scalar& scalar); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const Scalar& scalar); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const ArrayBase& other); + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const ArrayBase& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const ArrayBase& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const ArrayBase& other); + + public: + EIGEN_DEVICE_FUNC + ArrayBase& array() { return *this; } + EIGEN_DEVICE_FUNC + const ArrayBase& array() const { return *this; } + + /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array + * \sa MatrixBase::array() */ + EIGEN_DEVICE_FUNC + MatrixWrapper matrix() { return MatrixWrapper(derived()); } + EIGEN_DEVICE_FUNC + const MatrixWrapper matrix() const { return MatrixWrapper(derived()); } + +// template +// inline void evalTo(Dest& dst) const { dst = matrix(); } + + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase) + + private: + explicit ArrayBase(Index); + ArrayBase(Index,Index); + template explicit ArrayBase(const ArrayBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} + // mixing arrays and matrices is not legal + template Derived& operator-=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator-=(const ArrayBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator+=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator*=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::mul_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this / \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator/=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::div_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_ARRAYBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ArrayWrapper.h b/lib/eigen-3.4.0/Eigen/src/Core/ArrayWrapper.h new file mode 100644 index 0000000..2e9555b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ArrayWrapper.h @@ -0,0 +1,209 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAYWRAPPER_H +#define EIGEN_ARRAYWRAPPER_H + +namespace Eigen { + +/** \class ArrayWrapper + * \ingroup Core_Module + * + * \brief Expression of a mathematical vector or matrix as an array object + * + * This class is the return type of MatrixBase::array(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::array(), class MatrixWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef ArrayXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits::type >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; +}; +} + +template +class ArrayWrapper : public ArrayBase > +{ + public: + typedef ArrayBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename internal::remove_all::type NestedExpression; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; + + using Base::coeffRef; + + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_expression.coeffRef(rowId, colId); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_expression.coeffRef(index); + } + + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { dst = m_expression; } + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const + { + return m_expression; + } + + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } + + protected: + NestedExpressionType m_expression; +}; + +/** \class MatrixWrapper + * \ingroup Core_Module + * + * \brief Expression of an array as a mathematical vector or matrix + * + * This class is the return type of ArrayBase::matrix(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::matrix(), class ArrayWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef MatrixXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits::type >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; +}; +} + +template +class MatrixWrapper : public MatrixBase > +{ + public: + typedef MatrixBase > Base; + EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef typename internal::remove_all::type NestedExpression; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; + + using Base::coeffRef; + + EIGEN_DEVICE_FUNC + explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_expression.derived().coeffRef(rowId, colId); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_expression.coeffRef(index); + } + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const + { + return m_expression; + } + + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } + + protected: + NestedExpressionType m_expression; +}; + +} // end namespace Eigen + +#endif // EIGEN_ARRAYWRAPPER_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Assign.h b/lib/eigen-3.4.0/Eigen/src/Core/Assign.h new file mode 100644 index 0000000..655412e --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Assign.h @@ -0,0 +1,90 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007 Michael Olbrich +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_H +#define EIGEN_ASSIGN_H + +namespace Eigen { + +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase + ::lazyAssign(const DenseBase& other) +{ + enum{ + SameType = internal::is_same::value + }; + + EIGEN_STATIC_ASSERT_LVALUE(Derived) + 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) + + eigen_assert(rows() == other.rows() && cols() == other.cols()); + internal::call_assignment_no_alias(derived(),other.derived()); + + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) +{ + other.derived().evalTo(derived()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/AssignEvaluator.h b/lib/eigen-3.4.0/Eigen/src/Core/AssignEvaluator.h new file mode 100644 index 0000000..7d76f0c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/AssignEvaluator.h @@ -0,0 +1,1010 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_EVALUATOR_H +#define EIGEN_ASSIGN_EVALUATOR_H + +namespace Eigen { + +// This implementation is based on Assign.h + +namespace internal { + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for traversal and unrolling * +***************************************************************************/ + +// copy_using_evaluator_traits is based on assign_traits + +template +struct copy_using_evaluator_traits +{ + typedef typename DstEvaluator::XprType Dst; + typedef typename Dst::Scalar DstScalar; + + enum { + DstFlags = DstEvaluator::Flags, + SrcFlags = SrcEvaluator::Flags + }; + +public: + enum { + DstAlignment = DstEvaluator::Alignment, + SrcAlignment = SrcEvaluator::Alignment, + DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit, + JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment) + }; + +private: + enum { + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + RestrictedInnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(InnerSize,MaxPacketSize), + RestrictedLinearSize = EIGEN_SIZE_MIN_PREFER_FIXED(Dst::SizeAtCompileTime,MaxPacketSize), + OuterStride = int(outer_stride_at_compile_time::ret), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime + }; + + // TODO distinguish between linear traversal and inner-traversals + typedef typename find_best_packet::type LinearPacketType; + typedef typename find_best_packet::type InnerPacketType; + + enum { + LinearPacketSize = unpacket_traits::size, + InnerPacketSize = unpacket_traits::size + }; + +public: + enum { + LinearRequiredAlignment = unpacket_traits::alignment, + InnerRequiredAlignment = unpacket_traits::alignment + }; + +private: + enum { + DstIsRowMajor = DstFlags&RowMajorBit, + SrcIsRowMajor = SrcFlags&RowMajorBit, + StorageOrdersAgree = (int(DstIsRowMajor) == int(SrcIsRowMajor)), + MightVectorize = bool(StorageOrdersAgree) + && (int(DstFlags) & int(SrcFlags) & ActualPacketAccessBit) + && bool(functor_traits::PacketAccess), + MayInnerVectorize = MightVectorize + && int(InnerSize)!=Dynamic && int(InnerSize)%int(InnerPacketSize)==0 + && int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0 + && (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)), + MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit), + MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess) + && (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic), + /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, + so it's only good for large enough sizes. */ + MaySliceVectorize = bool(MightVectorize) && bool(DstHasDirectAccess) + && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=(EIGEN_UNALIGNED_VECTORIZE?InnerPacketSize:(3*InnerPacketSize))) + /* slice vectorization can be slow, so we only want it if the slices are big, which is + indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block + in a fixed-size matrix + However, with EIGEN_UNALIGNED_VECTORIZE and unrolling, slice vectorization is still worth it */ + }; + +public: + enum { + Traversal = int(Dst::SizeAtCompileTime) == 0 ? int(AllAtOnceTraversal) // If compile-size is zero, traversing will fail at compile-time. + : (int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize)) ? int(LinearVectorizedTraversal) + : int(MayInnerVectorize) ? int(InnerVectorizedTraversal) + : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(MayLinearize) ? int(LinearTraversal) + : int(DefaultTraversal), + Vectorized = int(Traversal) == InnerVectorizedTraversal + || int(Traversal) == LinearVectorizedTraversal + || int(Traversal) == SliceVectorizedTraversal + }; + + typedef typename conditional::type PacketType; + +private: + enum { + ActualPacketSize = int(Traversal)==LinearVectorizedTraversal ? LinearPacketSize + : Vectorized ? InnerPacketSize + : 1, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * ActualPacketSize, + MayUnrollCompletely = int(Dst::SizeAtCompileTime) != Dynamic + && int(Dst::SizeAtCompileTime) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit), + MayUnrollInner = int(InnerSize) != Dynamic + && int(InnerSize) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit) + }; + +public: + enum { + Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) + ? ( + int(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) + ) + : int(Traversal) == int(LinearVectorizedTraversal) + ? ( bool(MayUnrollCompletely) && ( EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment))) + ? int(CompleteUnrolling) + : int(NoUnrolling) ) + : int(Traversal) == int(LinearTraversal) + ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(NoUnrolling) ) +#if EIGEN_UNALIGNED_VECTORIZE + : int(Traversal) == int(SliceVectorizedTraversal) + ? ( bool(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) ) +#endif + : int(NoUnrolling) + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl; + std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl; + std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl; + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(DstAlignment) + EIGEN_DEBUG_VAR(SrcAlignment) + EIGEN_DEBUG_VAR(LinearRequiredAlignment) + EIGEN_DEBUG_VAR(InnerRequiredAlignment) + EIGEN_DEBUG_VAR(JointAlignment) + EIGEN_DEBUG_VAR(InnerSize) + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(LinearPacketSize) + EIGEN_DEBUG_VAR(InnerPacketSize) + EIGEN_DEBUG_VAR(ActualPacketSize) + EIGEN_DEBUG_VAR(StorageOrdersAgree) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearize) + EIGEN_DEBUG_VAR(MayInnerVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(SrcEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(DstEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(Dst::SizeAtCompileTime) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(MayUnrollCompletely) + EIGEN_DEBUG_VAR(MayUnrollInner) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : meta-unrollers +***************************************************************************/ + +/************************ +*** Default traversal *** +************************/ + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.assignCoeffByOuterInner(outer, inner); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.assignCoeffByOuterInner(outer, Index_); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel) + { + kernel.assignCoeff(Index); + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime, + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.template assignPacketByOuterInner(outer, inner); + enum { NextIndex = Index + unpacket_traits::size }; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + typedef typename Kernel::PacketType PacketType; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.template assignPacketByOuterInner(outer, Index_); + enum { NextIndex = Index_ + unpacket_traits::size }; + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +// dense_assignment_loop is based on assign_impl + +template +struct dense_assignment_loop; + +/************************ +***** Special Cases ***** +************************/ + +// Zero-sized assignment is a no-op. +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel& /*kernel*/) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + EIGEN_STATIC_ASSERT(int(DstXprType::SizeAtCompileTime) == 0, + EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT) + } +}; + +/************************ +*** Default traversal *** +************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel &kernel) + { + for(Index outer = 0; outer < kernel.outerSize(); ++outer) { + for(Index inner = 0; inner < kernel.innerSize(); ++inner) { + kernel.assignCoeffByOuterInner(outer, inner); + } + } + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +/*************************** +*** Linear vectorization *** +***************************/ + + +// The goal of unaligned_dense_assignment_loop is simply to factorize the handling +// of the non vectorizable beginning and ending parts + +template +struct unaligned_dense_assignment_loop +{ + // if IsAligned = true, then do nothing + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {} +}; + +template <> +struct unaligned_dense_assignment_loop +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. + // FIXME check which version exhibits this issue +#if EIGEN_COMP_MSVC + template + static EIGEN_DONT_INLINE void run(Kernel &kernel, + Index start, + Index end) +#else + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, + Index start, + Index end) +#endif + { + for (Index index = start; index < end; ++index) + kernel.assignCoeff(index); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + requestedAlignment = Kernel::AssignmentTraits::LinearRequiredAlignment, + packetSize = unpacket_traits::size, + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = packet_traits::AlignedOnScalar ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment), + srcAlignment = Kernel::AssignmentTraits::JointAlignment + }; + const Index alignedStart = dstIsAligned ? 0 : internal::first_aligned(kernel.dstDataPtr(), size); + const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; + + unaligned_dense_assignment_loop::run(kernel, 0, alignedStart); + + for(Index index = alignedStart; index < alignedEnd; index += packetSize) + kernel.template assignPacket(index); + + unaligned_dense_assignment_loop<>::run(kernel, alignedEnd, size); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { size = DstXprType::SizeAtCompileTime, + packetSize =unpacket_traits::size, + alignedSize = (int(size)/packetSize)*packetSize }; + + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct dense_assignment_loop +{ + typedef typename Kernel::PacketType PacketType; + enum { + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index packetSize = unpacket_traits::size; + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; inner+=packetSize) + kernel.template assignPacketByOuterInner(outer, inner); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::AssignmentTraits Traits; + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + for(Index i = 0; i < size; ++i) + kernel.assignCoeff(i); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Slice vectorization *** +***************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + packetSize = unpacket_traits::size, + requestedAlignment = int(Kernel::AssignmentTraits::InnerRequiredAlignment), + alignable = packet_traits::AlignedOnScalar || int(Kernel::AssignmentTraits::DstAlignment)>=sizeof(Scalar), + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = alignable ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment) + }; + const Scalar *dst_ptr = kernel.dstDataPtr(); + if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0) + { + // the pointer is not aligned-on scalar, so alignment is not possible + return dense_assignment_loop::run(kernel); + } + const Index packetAlignedMask = packetSize - 1; + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index alignedStep = alignable ? (packetSize - kernel.outerStride() % packetSize) & packetAlignedMask : 0; + Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize); + + for(Index outer = 0; outer < outerSize; ++outer) + { + const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); + // do the non-vectorizable part of the assignment + for(Index inner = 0; inner(outer, inner); + + // do the non-vectorizable part of the assignment + for(Index inner = alignedEnd; inner +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { innerSize = DstXprType::InnerSizeAtCompileTime, + packetSize =unpacket_traits::size, + vectorizableSize = (int(innerSize) / int(packetSize)) * int(packetSize), + size = DstXprType::SizeAtCompileTime }; + + for(Index outer = 0; outer < kernel.outerSize(); ++outer) + { + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } + } +}; +#endif + + +/*************************************************************************** +* Part 4 : Generic dense assignment kernel +***************************************************************************/ + +// This class generalize the assignment of a coefficient (or packet) from one dense evaluator +// to another dense writable evaluator. +// It is parametrized by the two evaluators, and the actual assignment functor. +// This abstraction level permits to keep the evaluation loops as simple and as generic as possible. +// One can customize the assignment using this generic dense_assignment_kernel with different +// functors, or by completely overloading it, by-passing a functor. +template +class generic_dense_assignment_kernel +{ +protected: + typedef typename DstEvaluatorTypeT::XprType DstXprType; + typedef typename SrcEvaluatorTypeT::XprType SrcXprType; +public: + + typedef DstEvaluatorTypeT DstEvaluatorType; + typedef SrcEvaluatorTypeT SrcEvaluatorType; + typedef typename DstEvaluatorType::Scalar Scalar; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + generic_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) + : m_dst(dst), m_src(src), m_functor(func), m_dstExpr(dstExpr) + { + #ifdef EIGEN_DEBUG_ASSIGN + AssignmentTraits::debug(); + #endif + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_dstExpr.size(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const EIGEN_NOEXCEPT { return m_dstExpr.innerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const EIGEN_NOEXCEPT { return m_dstExpr.outerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dstExpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_dstExpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT { return m_dstExpr.outerStride(); } + + EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() EIGEN_NOEXCEPT { return m_dst; } + EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const EIGEN_NOEXCEPT { return m_src; } + + /// Assign src(row,col) to dst(row,col) through the assignment functor. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col) + { + m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index) + { + m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignCoeff(row, col); + } + + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index row, Index col) + { + m_functor.template assignPacket(&m_dst.coeffRef(row,col), m_src.template packet(row,col)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index index) + { + m_functor.template assignPacket(&m_dst.coeffRef(index), m_src.template packet(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignPacket(row, col); + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::RowsAtCompileTime) == 1 ? 0 + : int(Traits::ColsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::ColsAtCompileTime) == 1 ? 0 + : int(Traits::RowsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? inner + : outer; + } + + EIGEN_DEVICE_FUNC const Scalar* dstDataPtr() const + { + return m_dstExpr.data(); + } + +protected: + DstEvaluatorType& m_dst; + const SrcEvaluatorType& m_src; + const Functor &m_functor; + // TODO find a way to avoid the needs of the original expression + DstXprType& m_dstExpr; +}; + +// Special kernel used when computing small products whose operands have dynamic dimensions. It ensures that the +// PacketSize used is no larger than 4, thereby increasing the chance that vectorized instructions will be used +// when computing the product. + +template +class restricted_packet_dense_assignment_kernel : public generic_dense_assignment_kernel +{ +protected: + typedef generic_dense_assignment_kernel Base; + public: + typedef typename Base::Scalar Scalar; + typedef typename Base::DstXprType DstXprType; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + EIGEN_DEVICE_FUNC restricted_packet_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) + : Base(dst, src, func, dstExpr) + { + } + }; + +/*************************************************************************** +* Part 5 : Entry point for dense rectangular assignment +***************************************************************************/ + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/) +{ + EIGEN_ONLY_USED_FOR_DEBUG(dst); + EIGEN_ONLY_USED_FOR_DEBUG(src); + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op &/*func*/) +{ + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols))) + dst.resize(dstRows, dstCols); + eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + + SrcEvaluatorType srcEvaluator(src); + + // NOTE To properly handle A = (A*A.transpose())/s with A rectangular, + // we need to resize the destination after the source evaluator has been created. + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + + typedef generic_dense_assignment_kernel Kernel; + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +// Specialization for filling the destination with a constant value. +#ifndef EIGEN_GPU_COMPILE_PHASE +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const Eigen::CwiseNullaryOp, DstXprType>& src, const internal::assign_op& func) +{ + resize_if_allowed(dst, src, func); + std::fill_n(dst.data(), dst.size(), src.functor()()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) +{ + call_dense_assignment_loop(dst, src, internal::assign_op()); +} + +/*************************************************************************** +* Part 6 : Generic assignment +***************************************************************************/ + +// Based on the respective shapes of the destination and source, +// the class AssignmentKind determine the kind of assignment mechanism. +// AssignmentKind must define a Kind typedef. +template struct AssignmentKind; + +// Assignment kind defined in this file: +struct Dense2Dense {}; +struct EigenBase2EigenBase {}; + +template struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; +template<> struct AssignmentKind { typedef Dense2Dense Kind; }; + +// This is the main assignment class +template< typename DstXprType, typename SrcXprType, typename Functor, + typename Kind = typename AssignmentKind< typename evaluator_traits::Shape , typename evaluator_traits::Shape >::Kind, + typename EnableIf = void> +struct Assignment; + + +// The only purpose of this call_assignment() function is to deal with noalias() / "assume-aliasing" and automatic transposition. +// Indeed, I (Gael) think that this concept of "assume-aliasing" was a mistake, and it makes thing quite complicated. +// So this intermediate function removes everything related to "assume-aliasing" such that Assignment +// does not has to bother about these annoying details. + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(const Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} + +// Deal with "assume-aliasing" +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if< evaluator_assume_aliasing::value, void*>::type = 0) +{ + typename plain_matrix_type::type tmp(src); + call_assignment_no_alias(dst, tmp, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if::value, void*>::type = 0) +{ + call_assignment_no_alias(dst, src, func); +} + +// by-pass "assume-aliasing" +// When there is no aliasing, we require that 'dst' has been properly resized +template class StorageBase, typename Src, typename Func> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(NoAlias& dst, const Src& src, const Func& func) +{ + call_assignment_no_alias(dst.expression(), src, func); +} + + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + enum { + NeedToTranspose = ( (int(Dst::RowsAtCompileTime) == 1 && int(Src::ColsAtCompileTime) == 1) + || (int(Dst::ColsAtCompileTime) == 1 && int(Src::RowsAtCompileTime) == 1) + ) && int(Dst::SizeAtCompileTime) != 1 + }; + + typedef typename internal::conditional, Dst>::type ActualDstTypeCleaned; + typedef typename internal::conditional, Dst&>::type ActualDstType; + ActualDstType actualDst(dst); + + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + + Assignment::run(actualDst, src, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_restricted_packet_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + typedef restricted_packet_dense_assignment_kernel Kernel; + + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + SrcEvaluatorType srcEvaluator(src); + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src) +{ + call_assignment_no_alias(dst, src, internal::assign_op()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src, const Func& func) +{ + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + Assignment::run(dst, src, func); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src) +{ + call_assignment_no_alias_no_transpose(dst, src, internal::assign_op()); +} + +// forward declaration +template void check_for_aliasing(const Dst &dst, const Src &src); + +// Generic Dense to Dense assignment +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const Functor &func) + { +#ifndef EIGEN_NO_DEBUG + internal::check_for_aliasing(dst, src); +#endif + + call_dense_assignment_loop(dst, src, func); + } +}; + +// Generic assignment through evalTo. +// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism. +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.evalTo(dst); + } + + // NOTE The following two functions are templated to avoid their instantiation if not needed + // This is needed because some expressions supports evalTo only and/or have 'void' as scalar type. + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.addTo(dst); + } + + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.subTo(dst); + } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_EVALUATOR_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Assign_MKL.h b/lib/eigen-3.4.0/Eigen/src/Core/Assign_MKL.h new file mode 100755 index 0000000..c6140d1 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Assign_MKL.h @@ -0,0 +1,178 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + Copyright (C) 2015 Gael Guennebaud + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to Intel(R) MKL + * MKL VML support for coefficient-wise unary Eigen expressions like a=b.sin() + ******************************************************************************** +*/ + +#ifndef EIGEN_ASSIGN_VML_H +#define EIGEN_ASSIGN_VML_H + +namespace Eigen { + +namespace internal { + +template +class vml_assign_traits +{ + private: + enum { + DstHasDirectAccess = Dst::Flags & DirectAccessBit, + SrcHasDirectAccess = Src::Flags & DirectAccessBit, + StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)), + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime, + + MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1, + MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit), + VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize, + LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD + }; + public: + enum { + EnableVml = MightEnableVml && LargeEnough, + Traversal = MightLinearize ? LinearTraversal : DefaultTraversal + }; +}; + +#define EIGEN_PP_EXPAND(ARG) ARG +#if !defined (EIGEN_FAST_MATH) || (EIGEN_FAST_MATH != 1) +#define EIGEN_VMLMODE_EXPAND_xLA , VML_HA +#else +#define EIGEN_VMLMODE_EXPAND_xLA , VML_LA +#endif + +#define EIGEN_VMLMODE_EXPAND_x_ + +#define EIGEN_VMLMODE_PREFIX_xLA vm +#define EIGEN_VMLMODE_PREFIX_x_ v +#define EIGEN_VMLMODE_PREFIX(VMLMODE) EIGEN_CAT(EIGEN_VMLMODE_PREFIX_x,VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested> \ + struct Assignment, SrcXprNested>, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseUnaryOp, SrcXprNested> SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + if(vml_assign_traits::Traversal==LinearTraversal) { \ + VMLOP(dst.size(), (const VMLTYPE*)src.nestedExpression().data(), \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.nestedExpression().coeffRef(outer,0)) : \ + &(src.nestedExpression().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ + }; \ + + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),s##VMLOP), float, float, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),d##VMLOP), double, double, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),c##VMLOP), scomplex, MKL_Complex8, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),z##VMLOP), dcomplex, MKL_Complex16, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) + + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sin, Sin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(asin, Asin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sinh, Sinh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cos, Cos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(acos, Acos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cosh, Cosh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tan, Tan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(atan, Atan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tanh, Tanh, LA) +// EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs, Abs, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(exp, Exp, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log, Ln, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log10, Log10, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sqrt, Sqrt, _) + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(arg, Arg, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(round, Round, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(floor, Floor, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(ceil, Ceil, _) + +#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested, typename Plain> \ + struct Assignment, SrcXprNested, \ + const CwiseNullaryOp,Plain> >, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseBinaryOp, SrcXprNested, \ + const CwiseNullaryOp,Plain> > SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + VMLTYPE exponent = reinterpret_cast(src.rhs().functor().m_other); \ + if(vml_assign_traits::Traversal==LinearTraversal) \ + { \ + VMLOP( dst.size(), (const VMLTYPE*)src.lhs().data(), exponent, \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.lhs().coeffRef(outer,0)) : \ + &(src.lhs().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, exponent, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ + }; + +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmsPowx, float, float, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdPowx, double, double, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcPowx, scomplex, MKL_Complex8, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzPowx, dcomplex, MKL_Complex16, LA) + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_VML_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/BandMatrix.h b/lib/eigen-3.4.0/Eigen/src/Core/BandMatrix.h new file mode 100644 index 0000000..878c024 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/BandMatrix.h @@ -0,0 +1,353 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_BANDMATRIX_H +#define EIGEN_BANDMATRIX_H + +namespace Eigen { + +namespace internal { + +template +class BandMatrixBase : public EigenBase +{ + public: + + enum { + Flags = internal::traits::Flags, + CoeffReadCost = internal::traits::CoeffReadCost, + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime, + Supers = internal::traits::Supers, + Subs = internal::traits::Subs, + Options = internal::traits::Options + }; + typedef typename internal::traits::Scalar Scalar; + typedef Matrix DenseMatrixType; + typedef typename DenseMatrixType::StorageIndex StorageIndex; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef EigenBase Base; + + protected: + enum { + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) + ? 1 + Supers + Subs + : Dynamic, + SizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime) + }; + + public: + + using Base::derived; + using Base::rows; + using Base::cols; + + /** \returns the number of super diagonals */ + inline Index supers() const { return derived().supers(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return derived().subs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline const CoefficientsType& coeffs() const { return derived().coeffs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline CoefficientsType& coeffs() { return derived().coeffs(); } + + /** \returns a vector expression of the \a i -th column, + * only the meaningful part is returned. + * \warning the internal storage must be column major. */ + inline Block col(Index i) + { + EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + Index start = 0; + Index len = coeffs().rows(); + if (i<=supers()) + { + start = supers()-i; + len = (std::min)(rows(),std::max(0,coeffs().rows() - (supers()-i))); + } + else if (i>=rows()-subs()) + len = std::max(0,coeffs().rows() - (i + 1 - rows() + subs())); + return Block(coeffs(), start, i, len, 1); + } + + /** \returns a vector expression of the main diagonal */ + inline Block diagonal() + { return Block(coeffs(),supers(),0,1,(std::min)(rows(),cols())); } + + /** \returns a vector expression of the main diagonal (const version) */ + inline const Block diagonal() const + { return Block(coeffs(),supers(),0,1,(std::min)(rows(),cols())); } + + template struct DiagonalIntReturnType { + enum { + ReturnOpposite = (int(Options) & int(SelfAdjoint)) && (((Index) > 0 && Supers == 0) || ((Index) < 0 && Subs == 0)), + Conjugate = ReturnOpposite && NumTraits::IsComplex, + ActualIndex = ReturnOpposite ? -Index : Index, + DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic) + ? Dynamic + : (ActualIndex<0 + ? EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime, RowsAtCompileTime + ActualIndex) + : EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime - ActualIndex)) + }; + typedef Block BuildType; + typedef typename internal::conditional,BuildType >, + BuildType>::type Type; + }; + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline typename DiagonalIntReturnType::Type diagonal() + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, (std::max)(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline const typename DiagonalIntReturnType::Type diagonal() const + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, (std::max)(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline Block diagonal(Index i) + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline const Block diagonal(Index i) const + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + template inline void evalTo(Dest& dst) const + { + dst.resize(rows(),cols()); + dst.setZero(); + dst.diagonal() = diagonal(); + for (Index i=1; i<=supers();++i) + dst.diagonal(i) = diagonal(i); + for (Index i=1; i<=subs();++i) + dst.diagonal(-i) = diagonal(-i); + } + + DenseMatrixType toDenseMatrix() const + { + DenseMatrixType res(rows(),cols()); + evalTo(res); + return res; + } + + protected: + + inline Index diagonalLength(Index i) const + { return i<0 ? (std::min)(cols(),rows()+i) : (std::min)(rows(),cols()-i); } +}; + +/** + * \class BandMatrix + * \ingroup Core_Module + * + * \brief Represents a rectangular matrix with a banded storage + * + * \tparam _Scalar Numeric type, i.e. float, double, int + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * \tparam _Supers Number of super diagonal + * \tparam _Subs Number of sub diagonal + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint + * The former controls \ref TopicStorageOrders "storage order", and defaults to + * column-major. The latter controls whether the matrix represents a selfadjoint + * matrix in which case either Supers of Subs have to be null. + * + * \sa class TridiagonalMatrix + */ + +template +struct traits > +{ + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + enum { + CoeffReadCost = NumTraits::ReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef Matrix CoefficientsType; +}; + +template +class BandMatrix : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::StorageIndex StorageIndex; + typedef typename internal::traits::CoefficientsType CoefficientsType; + + explicit inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) + : m_coeffs(1+supers+subs,cols), + m_rows(rows), m_supers(supers), m_subs(subs) + { + } + + /** \returns the number of columns */ + inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + inline CoefficientsType& coeffs() { return m_coeffs; } + + protected: + + CoefficientsType m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +template +class BandMatrixWrapper; + +template +struct traits > +{ + typedef typename _CoefficientsType::Scalar Scalar; + typedef typename _CoefficientsType::StorageKind StorageKind; + typedef typename _CoefficientsType::StorageIndex StorageIndex; + enum { + CoeffReadCost = internal::traits<_CoefficientsType>::CoeffReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef _CoefficientsType CoefficientsType; +}; + +template +class BandMatrixWrapper : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef typename internal::traits::StorageIndex StorageIndex; + + explicit inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) + : m_coeffs(coeffs), + m_rows(rows), m_supers(supers), m_subs(subs) + { + EIGEN_UNUSED_VARIABLE(cols); + //internal::assert(coeffs.cols()==cols() && (supers()+subs()+1)==coeffs.rows()); + } + + /** \returns the number of columns */ + inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + + protected: + + const CoefficientsType& m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +/** + * \class TridiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a tridiagonal matrix with a compact banded storage + * + * \tparam Scalar Numeric type, i.e. float, double, int + * \tparam Size Number of rows and cols, or \b Dynamic + * \tparam Options Can be 0 or \b SelfAdjoint + * + * \sa class BandMatrix + */ +template +class TridiagonalMatrix : public BandMatrix +{ + typedef BandMatrix Base; + typedef typename Base::StorageIndex StorageIndex; + public: + explicit TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} + + inline typename Base::template DiagonalIntReturnType<1>::Type super() + { return Base::template diagonal<1>(); } + inline const typename Base::template DiagonalIntReturnType<1>::Type super() const + { return Base::template diagonal<1>(); } + inline typename Base::template DiagonalIntReturnType<-1>::Type sub() + { return Base::template diagonal<-1>(); } + inline const typename Base::template DiagonalIntReturnType<-1>::Type sub() const + { return Base::template diagonal<-1>(); } + protected: +}; + + +struct BandShape {}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_BANDMATRIX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Block.h b/lib/eigen-3.4.0/Eigen/src/Core/Block.h new file mode 100644 index 0000000..3206d66 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Block.h @@ -0,0 +1,448 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_BLOCK_H +#define EIGEN_BLOCK_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows, + ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols, + MaxRowsAtCompileTime = BlockRows==0 ? 0 + : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) + : int(traits::MaxRowsAtCompileTime), + MaxColsAtCompileTime = BlockCols==0 ? 0 + : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) + : int(traits::MaxColsAtCompileTime), + + XprTypeIsRowMajor = (int(traits::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(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + + // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + Flags = (traits::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, + // FIXME DirectAccessBit should not be handled by expressions + // + // Alignment is needed by MapBase's assertions + // We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator + Alignment = 0 + }; +}; + +template::ret> class BlockImpl_dense; + +} // end namespace internal + +template class BlockImpl; + +/** \class Block + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size block + * + * \tparam XprType the type of the expression in which we are taking a block + * \tparam BlockRows the number of rows of the block we are taking at compile time (optional) + * \tparam BlockCols the number of columns of the block we are taking at compile time (optional) + * \tparam InnerPanel is true, if the block maps to a set of rows of a row major matrix or + * to set of columns of a column major matrix (optional). The parameter allows to determine + * at compile time whether aligned access is possible on the block expression. + * + * This class represents an expression of either a fixed-size or dynamic-size block. It is the return + * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and + * most of the time this is the only way it is used. + * + * However, if you want to directly maniputate block expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. + * + * Here is an example illustrating the dynamic case: + * \include class_Block.cpp + * Output: \verbinclude class_Block.out + * + * \note Even though this expression has dynamic size, in the case where \a XprType + * has fixed size, this expression inherits a fixed maximal size which means that evaluating + * it does not cause a dynamic memory allocation. + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedBlock.cpp + * Output: \verbinclude class_FixedBlock.out + * + * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock + */ +template class Block + : public BlockImpl::StorageKind> +{ + typedef BlockImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Block) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + + typedef typename internal::remove_all::type NestedExpression; + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, Index i) : Impl(xpr,i) + { + eigen_assert( (i>=0) && ( + ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 0 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 0 && startCol + BlockCols <= xpr.cols()); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow <= xpr.rows() - blockRows + && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols); + } +}; + +// The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense +// that must be specialized for direct and non-direct access... +template +class BlockImpl + : public internal::BlockImpl_dense +{ + typedef internal::BlockImpl_dense Impl; + typedef typename XprType::StorageIndex StorageIndex; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol) : Impl(xpr, startRow, startCol) {} + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Blocks in the general case. */ +template class BlockImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + // class InnerIterator; // FIXME apparently never used + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index i) + : m_xpr(xpr), + // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, + // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, + // all other cases are invalid. + // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), + m_blockRows(BlockRows==1 ? 1 : xpr.rows()), + m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + {} + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(BlockRows), m_blockCols(BlockCols) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(blockRows), m_blockCols(blockCols) + {} + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_blockRows.value(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_blockCols.value(); } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_xpr.derived().coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const + { + return m_xpr.coeff(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + EIGEN_DEVICE_FUNC + inline const CoeffReturnType coeff(Index index) const + { + return m_xpr.coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline PacketScalar packet(Index rowId, Index colId) const + { + return m_xpr.template packet(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + template + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + m_xpr.template writePacket(rowId + m_startRow.value(), colId + m_startCol.value(), val); + } + + template + inline PacketScalar packet(Index index) const + { + return m_xpr.template packet + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline void writePacket(Index index, const PacketScalar& val) + { + m_xpr.template writePacket + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val); + } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; + #endif + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT + { + return m_startRow.value(); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT + { + return m_startCol.value(); + } + + protected: + + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; +}; + +/** \internal Internal implementation of dense Blocks in the direct access case.*/ +template +class BlockImpl_dense + : public MapBase > +{ + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + enum { + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0 + }; + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index i) + : Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) + || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()), + BlockRows==1 ? 1 : xpr.rows(), + BlockCols==1 ? 1 : xpr.cols()), + m_xpr(xpr), + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0) + { + init(); + } + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) + { + init(); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol), blockRows, blockCols), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) + { + init(); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& nestedExpression() const EIGEN_NOEXCEPT + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + + /** \sa MapBase::innerStride() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index innerStride() const EIGEN_NOEXCEPT + { + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.innerStride() + : m_xpr.outerStride(); + } + + /** \sa MapBase::outerStride() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT + { + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT { return m_startRow.value(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT { return m_startCol.value(); } + + #ifndef __SUNPRO_CC + // FIXME sunstudio is not friendly with the above friend... + // META-FIXME there is no 'friend' keyword around here. Is this obsolete? + protected: + #endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal used by allowAligned() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + : Base(data, blockRows, blockCols), m_xpr(xpr) + { + init(); + } + #endif + + protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void init() + { + m_outerStride = internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); + } + + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + Index m_outerStride; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_BLOCK_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/BooleanRedux.h b/lib/eigen-3.4.0/Eigen/src/Core/BooleanRedux.h new file mode 100644 index 0000000..852de8b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/BooleanRedux.h @@ -0,0 +1,162 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ALLANDANY_H +#define EIGEN_ALLANDANY_H + +namespace Eigen { + +namespace internal { + +template +struct all_unroller +{ + enum { + col = (UnrollCount-1) / Rows, + row = (UnrollCount-1) % Rows + }; + + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) + { + return all_unroller::run(mat) && mat.coeff(row, col); + } +}; + +template +struct all_unroller +{ + EIGEN_DEVICE_FUNC static inline bool run(const Derived &/*mat*/) { return true; } +}; + +template +struct all_unroller +{ + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } +}; + +template +struct any_unroller +{ + enum { + col = (UnrollCount-1) / Rows, + row = (UnrollCount-1) % Rows + }; + + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) + { + return any_unroller::run(mat) || mat.coeff(row, col); + } +}; + +template +struct any_unroller +{ + EIGEN_DEVICE_FUNC static inline bool run(const Derived & /*mat*/) { return false; } +}; + +template +struct any_unroller +{ + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } +}; + +} // end namespace internal + +/** \returns true if all coefficients are true + * + * Example: \include MatrixBase_all.cpp + * Output: \verbinclude MatrixBase_all.out + * + * \sa any(), Cwise::operator<() + */ +template +EIGEN_DEVICE_FUNC inline bool DenseBase::all() const +{ + typedef internal::evaluator Evaluator; + enum { + unroll = SizeAtCompileTime != Dynamic + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT + }; + Evaluator evaluator(derived()); + if(unroll) + return internal::all_unroller::RowsAtCompileTime>::run(evaluator); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (!evaluator.coeff(i, j)) return false; + return true; + } +} + +/** \returns true if at least one coefficient is true + * + * \sa all() + */ +template +EIGEN_DEVICE_FUNC inline bool DenseBase::any() const +{ + typedef internal::evaluator Evaluator; + enum { + unroll = SizeAtCompileTime != Dynamic + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT + }; + Evaluator evaluator(derived()); + if(unroll) + return internal::any_unroller::RowsAtCompileTime>::run(evaluator); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (evaluator.coeff(i, j)) return true; + return false; + } +} + +/** \returns the number of coefficients which evaluate to true + * + * \sa all(), any() + */ +template +EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase::count() const +{ + return derived().template cast().template cast().sum(); +} + +/** \returns true is \c *this contains at least one Not A Number (NaN). + * + * \sa allFinite() + */ +template +inline bool DenseBase::hasNaN() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isNaN().any(); +#else + return !((derived().array()==derived().array()).all()); +#endif +} + +/** \returns true if \c *this contains only finite numbers, i.e., no NaN and no +/-INF values. + * + * \sa hasNaN() + */ +template +inline bool DenseBase::allFinite() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isFinite().all(); +#else + return !((derived()-derived()).hasNaN()); +#endif +} + +} // end namespace Eigen + +#endif // EIGEN_ALLANDANY_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CommaInitializer.h b/lib/eigen-3.4.0/Eigen/src/Core/CommaInitializer.h new file mode 100644 index 0000000..c0e29c7 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CommaInitializer.h @@ -0,0 +1,164 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COMMAINITIALIZER_H +#define EIGEN_COMMAINITIALIZER_H + +namespace Eigen { + +/** \class CommaInitializer + * \ingroup Core_Module + * + * \brief Helper class used by the comma initializer operator + * + * This class is internally used to implement the comma initializer feature. It is + * the return type of MatrixBase::operator<<, and most of the time this is the only + * way it is used. + * + * \sa \blank \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() + */ +template +struct CommaInitializer +{ + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC + inline CommaInitializer(XprType& xpr, const Scalar& s) + : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) + { + eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0 + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); + m_xpr.coeffRef(0,0) = s; + } + + template + EIGEN_DEVICE_FUNC + inline CommaInitializer(XprType& xpr, const DenseBase& other) + : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) + { + eigen_assert(m_xpr.rows() >= other.rows() && m_xpr.cols() >= other.cols() + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); + m_xpr.block(0, 0, other.rows(), other.cols()) = other; + } + + /* Copy/Move constructor which transfers ownership. This is crucial in + * absence of return value optimization to avoid assertions during destruction. */ + // FIXME in C++11 mode this could be replaced by a proper RValue constructor + EIGEN_DEVICE_FUNC + inline CommaInitializer(const CommaInitializer& o) + : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) { + // Mark original object as finished. In absence of R-value references we need to const_cast: + const_cast(o).m_row = m_xpr.rows(); + const_cast(o).m_col = m_xpr.cols(); + const_cast(o).m_currentBlockRows = 0; + } + + /* inserts a scalar value in the target matrix */ + EIGEN_DEVICE_FUNC + CommaInitializer& operator,(const Scalar& s) + { + if (m_col==m_xpr.cols()) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = 1; + eigen_assert(m_row + EIGEN_DEVICE_FUNC + CommaInitializer& operator,(const DenseBase& other) + { + if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows)) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = other.rows(); + eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() + && "Too many rows passed to comma initializer (operator<<)"); + } + eigen_assert((m_col + other.cols() <= m_xpr.cols()) + && "Too many coefficients passed to comma initializer (operator<<)"); + eigen_assert(m_currentBlockRows==other.rows()); + m_xpr.template block + (m_row, m_col, other.rows(), other.cols()) = other; + m_col += other.cols(); + return *this; + } + + EIGEN_DEVICE_FUNC + inline ~CommaInitializer() +#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS + EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) +#endif + { + finished(); + } + + /** \returns the built matrix once all its coefficients have been set. + * Calling finished is 100% optional. Its purpose is to write expressions + * like this: + * \code + * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished()); + * \endcode + */ + EIGEN_DEVICE_FUNC + inline XprType& finished() { + eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + return m_xpr; + } + + XprType& m_xpr; // target expression + Index m_row; // current row id + Index m_col; // current col id + Index m_currentBlockRows; // current block height +}; + +/** \anchor MatrixBaseCommaInitRef + * Convenient operator to set the coefficients of a matrix. + * + * The coefficients must be provided in a row major order and exactly match + * the size of the matrix. Otherwise an assertion is raised. + * + * Example: \include MatrixBase_set.cpp + * Output: \verbinclude MatrixBase_set.out + * + * \note According the c++ standard, the argument expressions of this comma initializer are evaluated in arbitrary order. + * + * \sa CommaInitializer::finished(), class CommaInitializer + */ +template +EIGEN_DEVICE_FUNC inline CommaInitializer DenseBase::operator<< (const Scalar& s) +{ + return CommaInitializer(*static_cast(this), s); +} + +/** \sa operator<<(const Scalar&) */ +template +template +EIGEN_DEVICE_FUNC inline CommaInitializer +DenseBase::operator<<(const DenseBase& other) +{ + return CommaInitializer(*static_cast(this), other); +} + +} // end namespace Eigen + +#endif // EIGEN_COMMAINITIALIZER_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ConditionEstimator.h b/lib/eigen-3.4.0/Eigen/src/Core/ConditionEstimator.h new file mode 100644 index 0000000..51a2e5f --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ConditionEstimator.h @@ -0,0 +1,175 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@google.com) +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CONDITIONESTIMATOR_H +#define EIGEN_CONDITIONESTIMATOR_H + +namespace Eigen { + +namespace internal { + +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + const RealVector v_abs = v.cwiseAbs(); + return (v_abs.array() == static_cast(0)) + .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); + } +}; + +// Partial specialization to avoid elementwise division for real vectors. +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + return (v.array() < static_cast(0)) + .select(-Vector::Ones(v.size()), Vector::Ones(v.size())); + } +}; + +/** + * \returns an estimate of ||inv(matrix)||_1 given a decomposition of + * \a matrix that implements .solve() and .adjoint().solve() methods. + * + * This function implements Algorithms 4.1 and 5.1 from + * http://www.maths.manchester.ac.uk/~higham/narep/narep135.pdf + * which also forms the basis for the condition number estimators in + * LAPACK. Since at most 10 calls to the solve method of dec are + * performed, the total cost is O(dims^2), as opposed to O(dims^3) + * needed to compute the inverse matrix explicitly. + * + * The most common usage is in estimating the condition number + * ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be + * computed directly in O(n^2) operations. + * + * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and + * LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomposition& dec) +{ + typedef typename Decomposition::MatrixType MatrixType; + typedef typename Decomposition::Scalar Scalar; + typedef typename Decomposition::RealScalar RealScalar; + typedef typename internal::plain_col_type::type Vector; + typedef typename internal::plain_col_type::type RealVector; + const bool is_complex = (NumTraits::IsComplex != 0); + + eigen_assert(dec.rows() == dec.cols()); + const Index n = dec.rows(); + if (n == 0) + return 0; + + // Disable Index to float conversion warning +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + Vector v = dec.solve(Vector::Ones(n) / Scalar(n)); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif + + // lower_bound is a lower bound on + // ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1 + // and is the objective maximized by the ("super-") gradient ascent + // algorithm below. + RealScalar lower_bound = v.template lpNorm<1>(); + if (n == 1) + return lower_bound; + + // Gradient ascent algorithm follows: We know that the optimum is achieved at + // one of the simplices v = e_i, so in each iteration we follow a + // super-gradient to move towards the optimal one. + RealScalar old_lower_bound = lower_bound; + Vector sign_vector(n); + Vector old_sign_vector; + Index v_max_abs_index = -1; + Index old_v_max_abs_index = v_max_abs_index; + for (int k = 0; k < 4; ++k) + { + sign_vector = internal::rcond_compute_sign::run(v); + if (k > 0 && !is_complex && sign_vector == old_sign_vector) { + // Break if the solution stagnated. + break; + } + // v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )| + v = dec.adjoint().solve(sign_vector); + v.real().cwiseAbs().maxCoeff(&v_max_abs_index); + if (v_max_abs_index == old_v_max_abs_index) { + // Break if the solution stagnated. + break; + } + // Move to the new simplex e_j, where j = v_max_abs_index. + v = dec.solve(Vector::Unit(n, v_max_abs_index)); // v = inv(matrix) * e_j. + lower_bound = v.template lpNorm<1>(); + if (lower_bound <= old_lower_bound) { + // Break if the gradient step did not increase the lower_bound. + break; + } + if (!is_complex) { + old_sign_vector = sign_vector; + } + old_v_max_abs_index = v_max_abs_index; + old_lower_bound = lower_bound; + } + // The following calculates an independent estimate of ||matrix||_1 by + // multiplying matrix by a vector with entries of slowly increasing + // magnitude and alternating sign: + // v_i = (-1)^{i} (1 + (i / (dim-1))), i = 0,...,dim-1. + // This improvement to Hager's algorithm above is due to Higham. It was + // added to make the algorithm more robust in certain corner cases where + // large elements in the matrix might otherwise escape detection due to + // exact cancellation (especially when op and op_adjoint correspond to a + // sequence of backsubstitutions and permutations), which could cause + // Hager's algorithm to vastly underestimate ||matrix||_1. + Scalar alternating_sign(RealScalar(1)); + for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates + v[i] = alternating_sign * static_cast(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); + alternating_sign = -alternating_sign; + } + v = dec.solve(v); + const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); + return numext::maxi(lower_bound, alternate_lower_bound); +} + +/** \brief Reciprocal condition number estimator. + * + * Computing a decomposition of a dense matrix takes O(n^3) operations, while + * this method estimates the condition number quickly and reliably in O(n^2) + * operations. + * + * \returns an estimate of the reciprocal condition number + * (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and + * its decomposition. Supports the following decompositions: FullPivLU, + * PartialPivLU, LDLT, and LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar +rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec) +{ + typedef typename Decomposition::RealScalar RealScalar; + eigen_assert(dec.rows() == dec.cols()); + if (dec.rows() == 0) return NumTraits::infinity(); + if (matrix_norm == RealScalar(0)) return RealScalar(0); + if (dec.rows() == 1) return RealScalar(1); + const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); + return (inverse_matrix_norm == RealScalar(0) ? RealScalar(0) + : (RealScalar(1) / inverse_matrix_norm) / matrix_norm); +} + +} // namespace internal + +} // namespace Eigen + +#endif diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CoreEvaluators.h b/lib/eigen-3.4.0/Eigen/src/Core/CoreEvaluators.h new file mode 100644 index 0000000..0ff8c8d --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CoreEvaluators.h @@ -0,0 +1,1741 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_COREEVALUATORS_H +#define EIGEN_COREEVALUATORS_H + +namespace Eigen { + +namespace internal { + +// This class returns the evaluator kind from the expression storage kind. +// Default assumes index based accessors +template +struct storage_kind_to_evaluator_kind { + typedef IndexBased Kind; +}; + +// This class returns the evaluator shape from the expression storage kind. +// It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc. +template struct storage_kind_to_shape; + +template<> struct storage_kind_to_shape { typedef DenseShape Shape; }; +template<> struct storage_kind_to_shape { typedef SolverShape Shape; }; +template<> struct storage_kind_to_shape { typedef PermutationShape Shape; }; +template<> struct storage_kind_to_shape { typedef TranspositionsShape Shape; }; + +// Evaluators have to be specialized with respect to various criteria such as: +// - storage/structure/shape +// - scalar type +// - etc. +// Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators. +// We currently distinguish the following kind of evaluators: +// - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose, MatrixWrapper, ArrayWrapper, Reverse, Replicate) +// - binary_evaluator for expression taking two arguments (CwiseBinaryOp) +// - ternary_evaluator for expression taking three arguments (CwiseTernaryOp) +// - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires additional tags for dispatching. +// - mapbase_evaluator for Map, Block, Ref +// - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator) + +template< typename T, + typename Arg1Kind = typename evaluator_traits::Kind, + typename Arg2Kind = typename evaluator_traits::Kind, + typename Arg3Kind = typename evaluator_traits::Kind, + typename Arg1Scalar = typename traits::Scalar, + typename Arg2Scalar = typename traits::Scalar, + typename Arg3Scalar = typename traits::Scalar> struct ternary_evaluator; + +template< typename T, + typename LhsKind = typename evaluator_traits::Kind, + typename RhsKind = typename evaluator_traits::Kind, + typename LhsScalar = typename traits::Scalar, + typename RhsScalar = typename traits::Scalar> struct binary_evaluator; + +template< typename T, + typename Kind = typename evaluator_traits::Kind, + typename Scalar = typename T::Scalar> struct unary_evaluator; + +// evaluator_traits contains traits for evaluator + +template +struct evaluator_traits_base +{ + // by default, get evaluator kind and shape from storage + typedef typename storage_kind_to_evaluator_kind::StorageKind>::Kind Kind; + typedef typename storage_kind_to_shape::StorageKind>::Shape Shape; +}; + +// Default evaluator traits +template +struct evaluator_traits : public evaluator_traits_base +{ +}; + +template::Shape > +struct evaluator_assume_aliasing { + static const bool value = false; +}; + +// By default, we assume a unary expression: +template +struct evaluator : public unary_evaluator +{ + typedef unary_evaluator Base; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : Base(xpr) {} +}; + + +// TODO: Think about const-correctness +template +struct evaluator + : evaluator +{ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : evaluator(xpr) {} +}; + +// ---------- base class for all evaluators ---------- + +template +struct evaluator_base +{ + // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. + typedef traits ExpressionTraits; + + enum { + Alignment = 0 + }; + // noncopyable: + // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization) + // and make complex evaluator much larger than then should do. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_base() {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~evaluator_base() {} +private: + EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&); + EIGEN_DEVICE_FUNC const evaluator_base& operator=(const evaluator_base&); +}; + +// -------------------- Matrix and Array -------------------- +// +// evaluator is a common base class for the +// Matrix and Array evaluators. +// Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense, +// so no need for more sophisticated dispatching. + +// this helper permits to completely eliminate m_outerStride if it is known at compiletime. +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr) + { +#ifndef EIGEN_INTERNAL_DEBUGGING + EIGEN_UNUSED_VARIABLE(outerStride); +#endif + eigen_internal_assert(outerStride==OuterStride); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT { return OuterStride; } + const Scalar *data; +}; + +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Index outerStride() const { return m_outerStride; } + const Scalar *data; +protected: + Index m_outerStride; +}; + +template +struct evaluator > + : evaluator_base +{ + typedef PlainObjectBase PlainObjectType; + typedef typename PlainObjectType::Scalar Scalar; + typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = PlainObjectType::IsRowMajor, + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime, + RowsAtCompileTime = PlainObjectType::RowsAtCompileTime, + ColsAtCompileTime = PlainObjectType::ColsAtCompileTime, + + CoeffReadCost = NumTraits::ReadCost, + Flags = traits::EvaluatorFlags, + Alignment = traits::Alignment + }; + enum { + // We do not need to know the outer stride for vectors + OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0 + : int(IsRowMajor) ? ColsAtCompileTime + : RowsAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() + : m_d(0,OuterStrideAtCompileTime) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const PlainObjectType& m) + : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (IsRowMajor) + return m_d.data[row * m_d.outerStride() + col]; + else + return m_d.data[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.data[index]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + if (IsRowMajor) + return const_cast(m_d.data)[row * m_d.outerStride() + col]; + else + return const_cast(m_d.data)[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return const_cast(m_d.data)[index]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + if (IsRowMajor) + return ploadt(m_d.data + row * m_d.outerStride() + col); + else + return ploadt(m_d.data + row + col * m_d.outerStride()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return ploadt(m_d.data + index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + if (IsRowMajor) + return pstoret + (const_cast(m_d.data) + row * m_d.outerStride() + col, x); + else + return pstoret + (const_cast(m_d.data) + row + col * m_d.outerStride(), x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + return pstoret(const_cast(m_d.data) + index, x); + } + +protected: + + plainobjectbase_evaluator_data m_d; +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Matrix XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Array XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +// -------------------- Transpose -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Transpose XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags ^ RowMajorBit, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename XprType::Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(col, row); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(col, row, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +// -------------------- CwiseNullaryOp -------------------- +// Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator. +// Likewise, there is not need to more sophisticated dispatching here. + +template::value, + bool has_unary = has_unary_operator::value, + bool has_binary = has_binary_operator::value> +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { return op(i,j); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { return op.template packetOp(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType=0, IndexType=0) const { return op(); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType=0, IndexType=0) const { return op.template packetOp(); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j=0) const { return op(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j=0) const { return op.template packetOp(i,j); } +}; + +// We need the following specialization for vector-only functors assigned to a runtime vector, +// for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd. +// In this case, i==0 and j is used for the actual iteration. +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op(i+j); + } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op.template packetOp(i+j); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper {}; + +#if 0 && EIGEN_COMP_MSVC>0 +// Disable this ugly workaround. This is now handled in traits::match, +// but this piece of code might still become handly if some other weird compilation +// erros pop up again. + +// MSVC exhibits a weird compilation error when +// compiling: +// Eigen::MatrixXf A = MatrixXf::Random(3,3); +// Ref R = 2.f*A; +// and that has_*ary_operator> have not been instantiated yet. +// The "problem" is that evaluator<2.f*A> is instantiated by traits::match<2.f*A> +// and at that time has_*ary_operator returns true regardless of T. +// Then nullary_wrapper is badly instantiated as nullary_wrapper<.,.,true,true,true>. +// The trick is thus to defer the proper instantiation of nullary_wrapper when coeff(), +// and packet() are really instantiated as implemented below: + +// This is a simple wrapper around Index to enforce the re-instantiation of +// has_*ary_operator when needed. +template struct nullary_wrapper_workaround_msvc { + nullary_wrapper_workaround_msvc(const T&); + operator T()const; +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i); + } +}; +#endif // MSVC workaround + +template +struct evaluator > + : evaluator_base > +{ + typedef CwiseNullaryOp XprType; + typedef typename internal::remove_all::type PlainObjectTypeCleaned; + + enum { + CoeffReadCost = internal::functor_traits::Cost, + + Flags = (evaluator::Flags + & ( HereditaryBits + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + Alignment = AlignedMax + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) + : m_functor(n.functor()), m_wrapper() + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType row, IndexType col) const + { + return m_wrapper(m_functor, row, col); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType index) const + { + return m_wrapper(m_functor,index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType row, IndexType col) const + { + return m_wrapper.template packetOp(m_functor, row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType index) const + { + return m_wrapper.template packetOp(m_functor, index); + } + +protected: + const NullaryOp m_functor; + const internal::nullary_wrapper m_wrapper; +}; + +// -------------------- CwiseUnaryOp -------------------- + +template +struct unary_evaluator, IndexBased > + : evaluator_base > +{ + typedef CwiseUnaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = evaluator::Flags + & (HereditaryBits | LinearAccessBit | (functor_traits::PacketAccess ? PacketAccessBit : 0)), + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseTernaryOp -------------------- + +// this is a ternary expression +template +struct evaluator > + : public ternary_evaluator > +{ + typedef CwiseTernaryOp XprType; + typedef ternary_evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct ternary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseTernaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Arg1Flags = evaluator::Flags, + Arg2Flags = evaluator::Flags, + Arg3Flags = evaluator::Flags, + SameType = is_same::value && is_same::value, + StorageOrdersAgree = (int(Arg1Flags)&RowMajorBit)==(int(Arg2Flags)&RowMajorBit) && (int(Arg1Flags)&RowMajorBit)==(int(Arg3Flags)&RowMajorBit), + Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & ( + HereditaryBits + | (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN( + EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment), + evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(row, col), + m_d.arg2Impl.template packet(row, col), + m_d.arg3Impl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(index), + m_d.arg2Impl.template packet(index), + m_d.arg3Impl.template packet(index)); + } + +protected: + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TernaryOp& func() const { return op; } + TernaryOp op; + evaluator arg1Impl; + evaluator arg2Impl; + evaluator arg3Impl; + }; + + Data m_d; +}; + +// -------------------- CwiseBinaryOp -------------------- + +// this is a binary expression +template +struct evaluator > + : public binary_evaluator > +{ + typedef CwiseBinaryOp XprType; + typedef binary_evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct binary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseBinaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + LhsFlags = evaluator::Flags, + RhsFlags = evaluator::Flags, + SameType = is_same::value, + StorageOrdersAgree = (int(LhsFlags)&RowMajorBit)==(int(RhsFlags)&RowMajorBit), + Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( + HereditaryBits + | (int(LhsFlags) & int(RhsFlags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment,evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit binary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(row, col), + m_d.rhsImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(index), + m_d.rhsImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const BinaryOp& func() const { return op; } + BinaryOp op; + evaluator lhsImpl; + evaluator rhsImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseUnaryView -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef CwiseUnaryView XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = (evaluator::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)), + + Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost... + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_d.func()(m_d.argImpl.coeffRef(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_d.func()(m_d.argImpl.coeffRef(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- Map -------------------- + +// FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ? +// but that might complicate template specialization +template +struct mapbase_evaluator; + +template +struct mapbase_evaluator : evaluator_base +{ + typedef Derived XprType; + typedef typename XprType::PointerType PointerType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::RowsAtCompileTime, + ColsAtCompileTime = XprType::ColsAtCompileTime, + CoeffReadCost = NumTraits::ReadCost + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit mapbase_evaluator(const XprType& map) + : m_data(const_cast(map.data())), + m_innerStride(map.innerStride()), + m_outerStride(map.outerStride()) + { + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(evaluator::Flags&PacketAccessBit, internal::inner_stride_at_compile_time::ret==1), + PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_data[index * m_innerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_data[index * m_innerStride.value()]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::ploadt(ptr); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return internal::ploadt(m_data + index * m_innerStride.value()); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::pstoret(ptr, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + internal::pstoret(m_data + index * m_innerStride.value(), x); + } +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value(); + } + + PointerType m_data; + const internal::variable_if_dynamic m_innerStride; + const internal::variable_if_dynamic m_outerStride; +}; + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Map XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + HasNoInnerStride = InnerStrideAtCompileTime == 1, + HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, + HasNoStride = HasNoInnerStride && HasNoOuterStride, + IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, + + PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit), + LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit), + Flags = int( evaluator::Flags) & (LinearAccessMask&PacketAccessMask), + + Alignment = int(MapOptions)&int(AlignedMask) + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) + : mapbase_evaluator(map) + { } +}; + +// -------------------- Ref -------------------- + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Ref XprType; + + enum { + Flags = evaluator >::Flags, + Alignment = evaluator >::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& ref) + : mapbase_evaluator(ref) + { } +}; + +// -------------------- Block -------------------- + +template::ret> struct block_evaluator; + +template +struct evaluator > + : block_evaluator +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime, + + ArgTypeIsRowMajor = (int(evaluator::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ArgTypeIsRowMajor, + HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0, + + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator::Flags&LinearAccessBit))) ? LinearAccessBit : 0, + FlagsRowMajorBit = XprType::Flags&RowMajorBit, + Flags0 = evaluator::Flags & ( (HereditaryBits & ~RowMajorBit) | + DirectAccessBit | + MaskPacketAccessBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) + && (OuterStrideAtCompileTime!=0) + && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0, + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, Alignment0) + }; + typedef block_evaluator block_evaluator_type; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& block) : block_evaluator_type(block) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +// no direct-access => dispatch to a unary evaluator +template +struct block_evaluator + : unary_evaluator > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : unary_evaluator(block) + {} +}; + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& block) + : m_argImpl(block.nestedExpression()), + m_startRow(block.startRow()), + m_startCol(block.startCol()), + m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + RowsAtCompileTime = XprType::RowsAtCompileTime, + ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator::Flags&LinearAccessBit) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return linear_coeff_impl(index, bool_constant()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return linear_coeffRef_impl(index, bool_constant()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(m_startRow.value() + row, m_startCol.value() + col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + if (ForwardLinearAccess) + return m_argImpl.template packet(m_linear_offset.value() + index); + else + return packet(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + return m_argImpl.template writePacket(m_startRow.value() + row, m_startCol.value() + col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + if (ForwardLinearAccess) + return m_argImpl.template writePacket(m_linear_offset.value() + index, x); + else + return writePacket(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0, + x); + } + +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const + { + return m_argImpl.coeff(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const + { + return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */) + { + return m_argImpl.coeffRef(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */) + { + return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + evaluator m_argImpl; + const variable_if_dynamic m_startRow; + const variable_if_dynamic m_startCol; + const variable_if_dynamic m_linear_offset; +}; + +// TODO: This evaluator does not actually use the child evaluator; +// all action is via the data() as returned by the Block expression. + +template +struct block_evaluator + : mapbase_evaluator, + typename Block::PlainObject> +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : mapbase_evaluator(block) + { + // TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + + +// -------------------- Select -------------------- +// NOTE shall we introduce a ternary_evaluator? + +// TODO enable vectorization for Select +template +struct evaluator > + : evaluator_base > +{ + typedef Select XprType; + enum { + CoeffReadCost = evaluator::CoeffReadCost + + EIGEN_PLAIN_ENUM_MAX(evaluator::CoeffReadCost, + evaluator::CoeffReadCost), + + Flags = (unsigned int)evaluator::Flags & evaluator::Flags & HereditaryBits, + + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& select) + : m_conditionImpl(select.conditionMatrix()), + m_thenImpl(select.thenMatrix()), + m_elseImpl(select.elseMatrix()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (m_conditionImpl.coeff(row, col)) + return m_thenImpl.coeff(row, col); + else + return m_elseImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + if (m_conditionImpl.coeff(index)) + return m_thenImpl.coeff(index); + else + return m_elseImpl.coeff(index); + } + +protected: + evaluator m_conditionImpl; + evaluator m_thenImpl; + evaluator m_elseImpl; +}; + + +// -------------------- Replicate -------------------- + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Replicate XprType; + typedef typename XprType::CoeffReturnType CoeffReturnType; + enum { + Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor + }; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0, + Flags = (evaluator::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits::Flags & RowMajorBit), + + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& replicate) + : m_arg(replicate.nestedExpression()), + m_argImpl(m_arg), + m_rows(replicate.nestedExpression().rows()), + m_cols(replicate.nestedExpression().cols()) + {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.coeff(actual_row, actual_col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.coeff(actual_index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.template packet(actual_row, actual_col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.template packet(actual_index); + } + +protected: + const ArgTypeNested m_arg; + evaluator m_argImpl; + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + +// -------------------- MatrixWrapper and ArrayWrapper -------------------- +// +// evaluator_wrapper_base is a common base class for the +// MatrixWrapper and ArrayWrapper evaluators. + +template +struct evaluator_wrapper_base + : evaluator_base +{ + typedef typename remove_all::type ArgType; + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {} + + typedef typename ArgType::Scalar Scalar; + typedef typename ArgType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(row, col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef MatrixWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef ArrayWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + + +// -------------------- Reverse -------------------- + +// defined in Reverse.h: +template struct reverse_packet_cond; + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Reverse XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::IsRowMajor, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor), + + CoeffReadCost = evaluator::CoeffReadCost, + + // let's enable LinearAccess only with vectorization because of the product overhead + // FIXME enable DirectAccess with negative strides? + Flags0 = evaluator::Flags, + LinearAccess = ( (Direction==BothDirections) && (int(Flags0)&PacketAccessBit) ) + || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1)) + ? LinearAccessBit : 0, + + Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess), + + Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f. + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& reverse) + : m_argImpl(reverse.nestedExpression()), + m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1), + m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) + { } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + return reverse_packet::run(m_argImpl.template packet( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + enum { PacketSize = unpacket_traits::size }; + return preverse(m_argImpl.template packet(m_rows.value() * m_cols.value() - index - PacketSize)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + // FIXME we could factorize some code with packet(i,j) + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + m_argImpl.template writePacket( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col, + reverse_packet::run(x)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + enum { PacketSize = unpacket_traits::size }; + m_argImpl.template writePacket + (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x)); + } + +protected: + evaluator m_argImpl; + + // If we do not reverse rows, then we do not need to know the number of rows; same for columns + // Nonetheless, in this case it is important to set to 1 such that the coeff(index) method works fine for vectors. + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + + +// -------------------- Diagonal -------------------- + +template +struct evaluator > + : evaluator_base > +{ + typedef Diagonal XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + Flags = (unsigned int)(evaluator::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& diagonal) + : m_argImpl(diagonal.nestedExpression()), + m_index(diagonal.index()) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index) const + { + return m_argImpl.coeff(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index + rowOffset(), index + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index) + { + return m_argImpl.coeffRef(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index + rowOffset(), index + colOffset()); + } + +protected: + evaluator m_argImpl; + const internal::variable_if_dynamicindex m_index; + +private: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; } +}; + + +//---------------------------------------------------------------------- +// deprecated code +//---------------------------------------------------------------------- + +// -------------------- EvalToTemp -------------------- + +// expression class for evaluating nested expression to a temporary + +template class EvalToTemp; + +template +struct traits > + : public traits +{ }; + +template +class EvalToTemp + : public dense_xpr_base >::type +{ + public: + + typedef typename dense_xpr_base::type Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) + + explicit EvalToTemp(const ArgType& arg) + : m_arg(arg) + { } + + const ArgType& arg() const + { + return m_arg; + } + + EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT + { + return m_arg.rows(); + } + + EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT + { + return m_arg.cols(); + } + + private: + const ArgType& m_arg; +}; + +template +struct evaluator > + : public evaluator +{ + typedef EvalToTemp XprType; + typedef typename ArgType::PlainObject PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.arg()) + { + ::new (static_cast(this)) Base(m_result); + } + + // This constructor is used when nesting an EvalTo evaluator in another evaluator + EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) + : m_result(arg) + { + ::new (static_cast(this)) Base(m_result); + } + +protected: + PlainObject m_result; +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREEVALUATORS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CoreIterators.h b/lib/eigen-3.4.0/Eigen/src/Core/CoreIterators.h new file mode 100644 index 0000000..b967196 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CoreIterators.h @@ -0,0 +1,132 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COREITERATORS_H +#define EIGEN_COREITERATORS_H + +namespace Eigen { + +/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core + */ + +namespace internal { + +template +class inner_iterator_selector; + +} + +/** \class InnerIterator + * \brief An InnerIterator allows to loop over the element of any matrix expression. + * + * \warning To be used with care because an evaluator is constructed every time an InnerIterator iterator is constructed. + * + * TODO: add a usage example + */ +template +class InnerIterator +{ +protected: + typedef internal::inner_iterator_selector::Kind> IteratorType; + typedef internal::evaluator EvaluatorType; + typedef typename internal::traits::Scalar Scalar; +public: + /** Construct an iterator over the \a outerId -th row or column of \a xpr */ + InnerIterator(const XprType &xpr, const Index &outerId) + : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize()) + {} + + /// \returns the value of the current coefficient. + EIGEN_STRONG_INLINE Scalar value() const { return m_iter.value(); } + /** Increment the iterator \c *this to the next non-zero coefficient. + * Explicit zeros are not skipped over. To skip explicit zeros, see class SparseView + */ + EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++(); return *this; } + EIGEN_STRONG_INLINE InnerIterator& operator+=(Index i) { m_iter.operator+=(i); return *this; } + EIGEN_STRONG_INLINE InnerIterator operator+(Index i) + { InnerIterator result(*this); result+=i; return result; } + + + /// \returns the column or row index of the current coefficient. + EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } + /// \returns the row index of the current coefficient. + EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } + /// \returns the column index of the current coefficient. + EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); } + /// \returns \c true if the iterator \c *this still references a valid coefficient. + EIGEN_STRONG_INLINE operator bool() const { return m_iter; } + +protected: + EvaluatorType m_eval; + IteratorType m_iter; +private: + // If you get here, then you're not using the right InnerIterator type, e.g.: + // SparseMatrix A; + // SparseMatrix::InnerIterator it(A,0); + template InnerIterator(const EigenBase&,Index outer); +}; + +namespace internal { + +// Generic inner iterator implementation for dense objects +template +class inner_iterator_selector +{ +protected: + typedef evaluator EvaluatorType; + typedef typename traits::Scalar Scalar; + enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &innerSize) + : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize) + {} + + EIGEN_STRONG_INLINE Scalar value() const + { + return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner) + : m_eval.coeff(m_inner, m_outer); + } + + EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } + + EIGEN_STRONG_INLINE Index index() const { return m_inner; } + inline Index row() const { return IsRowMajor ? m_outer : index(); } + inline Index col() const { return IsRowMajor ? index() : m_outer; } + + EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } + +protected: + const EvaluatorType& m_eval; + Index m_inner; + const Index m_outer; + const Index m_end; +}; + +// For iterator-based evaluator, inner-iterator is already implemented as +// evaluator<>::InnerIterator +template +class inner_iterator_selector + : public evaluator::InnerIterator +{ +protected: + typedef typename evaluator::InnerIterator Base; + typedef evaluator EvaluatorType; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &/*innerSize*/) + : Base(eval, outerId) + {} +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREITERATORS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CwiseBinaryOp.h b/lib/eigen-3.4.0/Eigen/src/Core/CwiseBinaryOp.h new file mode 100644 index 0000000..2202b1c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CwiseBinaryOp.h @@ -0,0 +1,183 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_BINARY_OP_H +#define EIGEN_CWISE_BINARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > +{ + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::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 result_of< + BinaryOp( + const typename Lhs::Scalar&, + const typename Rhs::Scalar& + ) + >::type Scalar; + typedef typename cwise_promote_storage_type::StorageKind, + typename traits::StorageKind, + BinaryOp>::ret StorageKind; + typedef typename promote_index_type::StorageIndex, + typename traits::StorageIndex>::type StorageIndex; + typedef typename Lhs::Nested LhsNested; + typedef typename Rhs::Nested RhsNested; + typedef typename remove_reference::type _LhsNested; + typedef typename remove_reference::type _RhsNested; + enum { + Flags = cwise_promote_storage_order::StorageKind,typename traits::StorageKind,_LhsNested::Flags & RowMajorBit,_RhsNested::Flags & RowMajorBit>::value + }; +}; +} // end namespace internal + +template +class CwiseBinaryOpImpl; + +/** \class CwiseBinaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions + * + * \tparam BinaryOp template functor implementing the operator + * \tparam LhsType the type of the left-hand side + * \tparam RhsType the type of the right-hand side + * + * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. + * It is the return type of binary operators, by which we mean only those binary operators where + * both the left-hand side and the right-hand side are Eigen expressions. + * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseBinaryOp types explicitly. + * + * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseBinaryOp : + public CwiseBinaryOpImpl< + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>, + internal::no_assignment_operator +{ + public: + + typedef typename internal::remove_all::type Functor; + typedef typename internal::remove_all::type Lhs; + typedef typename internal::remove_all::type Rhs; + + typedef typename CwiseBinaryOpImpl< + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef typename internal::remove_reference::type _LhsNested; + typedef typename internal::remove_reference::type _RhsNested; + +#if EIGEN_COMP_MSVC && EIGEN_HAS_CXX11 + //Required for Visual Studio or the Copy constructor will probably not get inlined! + EIGEN_STRONG_INLINE + CwiseBinaryOp(const CwiseBinaryOp&) = default; +#endif + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) + : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) + { + EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) + eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { + // return the fixed size type if available to enable compile time optimizations + return internal::traits::type>::RowsAtCompileTime==Dynamic ? m_rhs.rows() : m_lhs.rows(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { + // return the fixed size type if available to enable compile time optimizations + return internal::traits::type>::ColsAtCompileTime==Dynamic ? m_rhs.cols() : m_lhs.cols(); + } + + /** \returns the left hand side nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const _LhsNested& lhs() const { return m_lhs; } + /** \returns the right hand side nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const _RhsNested& rhs() const { return m_rhs; } + /** \returns the functor representing the binary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const BinaryOp& functor() const { return m_functor; } + + protected: + LhsNested m_lhs; + RhsNested m_rhs; + const BinaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseBinaryOpImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +MatrixBase::operator-=(const MatrixBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +MatrixBase::operator+=(const MatrixBase& other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_CWISE_BINARY_OP_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CwiseNullaryOp.h b/lib/eigen-3.4.0/Eigen/src/Core/CwiseNullaryOp.h new file mode 100644 index 0000000..289ec51 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CwiseNullaryOp.h @@ -0,0 +1,1001 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_NULLARY_OP_H +#define EIGEN_CWISE_NULLARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits +{ + enum { + Flags = traits::Flags & RowMajorBit + }; +}; + +} // namespace internal + +/** \class CwiseNullaryOp + * \ingroup Core_Module + * + * \brief Generic expression of a matrix where all coefficients are defined by a functor + * + * \tparam NullaryOp template functor implementing the operator + * \tparam PlainObjectType the underlying plain matrix/array type + * + * This class represents an expression of a generic nullary operator. + * It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, + * and most of the time this is the only way it is used. + * + * However, if you want to write a function returning such an expression, you + * will need to use this class. + * + * The functor NullaryOp must expose one of the following method: + + + + +
\c operator()() if the procedural generation does not depend on the coefficient entries (e.g., random numbers)
\c operator()(Index i)if the procedural generation makes sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace)
\c operator()(Index i,Index j)if the procedural generation depends on the matrix coordinates \c i, \c j (e.g., to generate a checkerboard with 0 and 1)
+ * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors. + * + * See DenseBase::NullaryExpr(Index,const CustomNullaryOp&) for an example binding + * C++11 random number generators. + * + * A nullary expression can also be used to implement custom sophisticated matrix manipulations + * that cannot be covered by the existing set of natively supported matrix manipulations. + * See this \ref TopicCustomizing_NullaryExpr "page" for some examples and additional explanations + * on the behavior of CwiseNullaryOp. + * + * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr + */ +template +class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp >::type, internal::no_assignment_operator +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) + + EIGEN_DEVICE_FUNC + CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) + : m_rows(rows), m_cols(cols), m_functor(func) + { + eigen_assert(rows >= 0 + && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 + && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const { return m_rows.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const { return m_cols.value(); } + + /** \returns the functor representing the nullary operation */ + EIGEN_DEVICE_FUNC + const NullaryOp& functor() const { return m_functor; } + + protected: + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; + const NullaryOp m_functor; +}; + + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif +DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) +{ + return CwiseNullaryOp(rows, cols, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * Here is an example with C++11 random generators: \include random_cpp11.cpp + * Output: \verbinclude random_cpp11.out + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif +DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); + else return CwiseNullaryOp(size, 1, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif +DenseBase::NullaryExpr(const CustomNullaryOp& func) +{ + return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this DenseBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index rows, Index cols, const Scalar& value) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this DenseBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index size, const Scalar& value) +{ + return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(const Scalar& value) +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); +} + +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(Index,const Scalar&,const Scalar&) + * + * \only_for_vectors + * + * Example: \include DenseBase_LinSpaced_seq_deprecated.cpp + * Output: \verbinclude DenseBase_LinSpaced_seq_deprecated.out + * + * \sa LinSpaced(Index,const Scalar&, const Scalar&), setLinSpaced(Index,const Scalar&,const Scalar&) + */ +template +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(const Scalar&,const Scalar&) + * + * \sa LinSpaced(const Scalar&, const Scalar&) + */ +template +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * Example: \include DenseBase_LinSpaced.cpp + * Output: \verbinclude DenseBase_LinSpaced.out + * + * For integer scalar types, an even spacing is possible if and only if the length of the range, + * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the + * number of values \c high-low+1 (meaning each value can be repeated the same number of time). + * If one of these two considions is not satisfied, then \c high is lowered to the largest value + * satisfying one of this constraint. + * Here are some examples: + * + * Example: \include DenseBase_LinSpacedInt.cpp + * Output: \verbinclude DenseBase_LinSpacedInt.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** + * \copydoc DenseBase::LinSpaced(Index, const Scalar&, const Scalar&) + * Special version for fixed size types which does not require the size parameter. + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isApproxToConstant +(const Scalar& val, const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isApprox(self.coeff(i, j), val, prec)) + return false; + return true; +} + +/** This is just an alias for isApproxToConstant(). + * + * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isConstant +(const Scalar& val, const RealScalar& prec) const +{ + return isApproxToConstant(val, prec); +} + +/** Alias for setConstant(): sets all coefficients in this expression to \a val. + * + * \sa setConstant(), Constant(), class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) +{ + setConstant(val); +} + +/** Sets all coefficients in this expression to value \a val. + * + * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) +{ + return derived() = Constant(rows(), cols(), val); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to the given value \a val. + * + * \only_for_vectors + * + * Example: \include Matrix_setConstant_int.cpp + * Output: \verbinclude Matrix_setConstant_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index size, const Scalar& val) +{ + resize(size); + return setConstant(val); +} + +/** Resizes to the given size, and sets all coefficients in this expression to the given value \a val. + * + * \param rows the new number of rows + * \param cols the new number of columns + * \param val the value to which all coefficients are set + * + * Example: \include Matrix_setConstant_int_int.cpp + * Output: \verbinclude Matrix_setConstant_int_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& val) +{ + resize(rows, cols); + return setConstant(val); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(NoChange_t, Index cols, const Scalar& val) +{ + return setConstant(rows(), cols, val); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, NoChange_t, const Scalar& val) +{ + return setConstant(rows, cols(), val); +} + + +/** + * \brief Sets a linearly spaced vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * Example: \include DenseBase_setLinSpaced.cpp + * Output: \verbinclude DenseBase_setLinSpaced.out + * + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function fills \c *this with equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return setLinSpaced(size(), low, high); +} + +// zero: + +/** \returns an expression of a zero matrix. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int_int.cpp + * Output: \verbinclude MatrixBase_zero_int_int.out + * + * \sa Zero(), Zero(Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(0)); +} + +/** \returns an expression of a zero vector. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int.cpp + * Output: \verbinclude MatrixBase_zero_int.out + * + * \sa Zero(), Zero(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index size) +{ + return Constant(size, Scalar(0)); +} + +/** \returns an expression of a fixed-size zero matrix or vector. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_zero.cpp + * Output: \verbinclude MatrixBase_zero.out + * + * \sa Zero(Index), Zero(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero() +{ + return Constant(Scalar(0)); +} + +/** \returns true if *this is approximately equal to the zero matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isZero.cpp + * Output: \verbinclude MatrixBase_isZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isZero(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) + return false; + return true; +} + +/** Sets all coefficients in this expression to zero. + * + * Example: \include MatrixBase_setZero.cpp + * Output: \verbinclude MatrixBase_setZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setZero() +{ + return setConstant(Scalar(0)); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to zero. + * + * \only_for_vectors + * + * Example: \include Matrix_setZero_int.cpp + * Output: \verbinclude Matrix_setZero_int.out + * + * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index newSize) +{ + resize(newSize); + return setConstant(Scalar(0)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to zero. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setZero_int_int.cpp + * Output: \verbinclude Matrix_setZero_int_int.out + * + * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(0)); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(NoChange_t, Index cols) +{ + return setZero(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, NoChange_t) +{ + return setZero(rows, cols()); +} + +// ones: + +/** \returns an expression of a matrix where all coefficients equal one. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int_int.cpp + * Output: \verbinclude MatrixBase_ones_int_int.out + * + * \sa Ones(), Ones(Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(1)); +} + +/** \returns an expression of a vector where all coefficients equal one. + * + * The parameter \a newSize is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int.cpp + * Output: \verbinclude MatrixBase_ones_int.out + * + * \sa Ones(), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index newSize) +{ + return Constant(newSize, Scalar(1)); +} + +/** \returns an expression of a fixed-size matrix or vector where all coefficients equal one. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_ones.cpp + * Output: \verbinclude MatrixBase_ones.out + * + * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones() +{ + return Constant(Scalar(1)); +} + +/** \returns true if *this is approximately equal to the matrix where all coefficients + * are equal to 1, within the precision given by \a prec. + * + * Example: \include MatrixBase_isOnes.cpp + * Output: \verbinclude MatrixBase_isOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isOnes +(const RealScalar& prec) const +{ + return isApproxToConstant(Scalar(1), prec); +} + +/** Sets all coefficients in this expression to one. + * + * Example: \include MatrixBase_setOnes.cpp + * Output: \verbinclude MatrixBase_setOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() +{ + return setConstant(Scalar(1)); +} + +/** Resizes to the given \a newSize, and sets all coefficients in this expression to one. + * + * \only_for_vectors + * + * Example: \include Matrix_setOnes_int.cpp + * Output: \verbinclude Matrix_setOnes_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index newSize) +{ + resize(newSize); + return setConstant(Scalar(1)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to one. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setOnes_int_int.cpp + * Output: \verbinclude Matrix_setOnes_int_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(1)); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, NoChange_t) +{ + return setOnes(rows, cols()); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(NoChange_t, Index cols) +{ + return setOnes(rows(), cols); +} + +// Identity: + +/** \returns an expression of the identity matrix (not necessarily square). + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used + * instead. + * + * Example: \include MatrixBase_identity_int_int.cpp + * Output: \verbinclude MatrixBase_identity_int_int.out + * + * \sa Identity(), setIdentity(), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity(Index rows, Index cols) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); +} + +/** \returns an expression of the identity matrix (not necessarily square). + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variant taking size arguments. + * + * Example: \include MatrixBase_identity.cpp + * Output: \verbinclude MatrixBase_identity.out + * + * \sa Identity(Index,Index), setIdentity(), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity() +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return MatrixBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op()); +} + +/** \returns true if *this is approximately equal to the identity matrix + * (not necessarily square), + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isIdentity.cpp + * Output: \verbinclude MatrixBase_isIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity() + */ +template +bool MatrixBase::isIdentity +(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + { + for(Index i = 0; i < rows(); ++i) + { + if(i == j) + { + if(!internal::isApprox(self.coeff(i, j), static_cast(1), prec)) + return false; + } + else + { + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) + return false; + } + } + } + return true; +} + +namespace internal { + +template=16)> +struct setIdentity_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + return m = Derived::Identity(m.rows(), m.cols()); + } +}; + +template +struct setIdentity_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + m.setZero(); + const Index size = numext::mini(m.rows(), m.cols()); + for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); + return m; + } +}; + +} // end namespace internal + +/** Writes the identity expression (not necessarily square) into *this. + * + * Example: \include MatrixBase_setIdentity.cpp + * Output: \verbinclude MatrixBase_setIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() +{ + return internal::setIdentity_impl::run(derived()); +} + +/** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setIdentity_int_int.cpp + * Output: \verbinclude Matrix_setIdentity_int_int.out + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) +{ + derived().resize(rows, cols); + return setIdentity(); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * This variant is for fixed-size vector only. + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(),i); +} + +/** \returns an expression of the X axis unit vector (1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() +{ return Derived::Unit(0); } + +/** \returns an expression of the Y axis unit vector (0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() +{ return Derived::Unit(1); } + +/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() +{ return Derived::Unit(2); } + +/** \returns an expression of the W axis unit vector (0,0,0,1) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() +{ return Derived::Unit(3); } + +/** \brief Set the coefficients of \c *this to the i-th unit (basis) vector + * + * \param i index of the unique coefficient to be set to 1 + * + * \only_for_vectors + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index newSize, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2016 Eugene Brevdo +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_TERNARY_OP_H +#define EIGEN_CWISE_TERNARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > { + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Arg1, Arg2, and Arg3 to have the same scalar type + // (see CwiseTernaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of::type Scalar; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + typedef typename Arg1::Nested Arg1Nested; + typedef typename Arg2::Nested Arg2Nested; + typedef typename Arg3::Nested Arg3Nested; + typedef typename remove_reference::type _Arg1Nested; + typedef typename remove_reference::type _Arg2Nested; + typedef typename remove_reference::type _Arg3Nested; + enum { Flags = _Arg1Nested::Flags & RowMajorBit }; +}; +} // end namespace internal + +template +class CwiseTernaryOpImpl; + +/** \class CwiseTernaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise ternary operator is + * applied to two expressions + * + * \tparam TernaryOp template functor implementing the operator + * \tparam Arg1Type the type of the first argument + * \tparam Arg2Type the type of the second argument + * \tparam Arg3Type the type of the third argument + * + * This class represents an expression where a coefficient-wise ternary + * operator is applied to three expressions. + * It is the return type of ternary operators, by which we mean only those + * ternary operators where + * all three arguments are Eigen expressions. + * For example, the return type of betainc(matrix1, matrix2, matrix3) is a + * CwiseTernaryOp. + * + * Most of the time, this is the only way that it is used, so you typically + * don't have to name + * CwiseTernaryOp types explicitly. + * + * \sa MatrixBase::ternaryExpr(const MatrixBase &, const + * MatrixBase &, const CustomTernaryOp &) const, class CwiseBinaryOp, + * class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseTernaryOp : public CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>, + internal::no_assignment_operator +{ + public: + typedef typename internal::remove_all::type Arg1; + typedef typename internal::remove_all::type Arg2; + typedef typename internal::remove_all::type Arg3; + + typedef typename CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseTernaryOp) + + typedef typename internal::ref_selector::type Arg1Nested; + typedef typename internal::ref_selector::type Arg2Nested; + typedef typename internal::ref_selector::type Arg3Nested; + typedef typename internal::remove_reference::type _Arg1Nested; + typedef typename internal::remove_reference::type _Arg2Nested; + typedef typename internal::remove_reference::type _Arg3Nested; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CwiseTernaryOp(const Arg1& a1, const Arg2& a2, + const Arg3& a3, + const TernaryOp& func = TernaryOp()) + : m_arg1(a1), m_arg2(a2), m_arg3(a3), m_functor(func) { + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + + eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && + a1.rows() == a3.rows() && a1.cols() == a3.cols()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg3.rows(); + else if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg2.rows(); + else + return m_arg1.rows(); + } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg3.cols(); + else if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg2.cols(); + else + return m_arg1.cols(); + } + + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg1Nested& arg1() const { return m_arg1; } + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg2Nested& arg2() const { return m_arg2; } + /** \returns the third argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg3Nested& arg3() const { return m_arg3; } + /** \returns the functor representing the ternary operation */ + EIGEN_DEVICE_FUNC + const TernaryOp& functor() const { return m_functor; } + + protected: + Arg1Nested m_arg1; + Arg2Nested m_arg2; + Arg3Nested m_arg3; + const TernaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseTernaryOpImpl + : public internal::generic_xpr_base< + CwiseTernaryOp >::type { + public: + typedef typename internal::generic_xpr_base< + CwiseTernaryOp >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_TERNARY_OP_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryOp.h b/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryOp.h new file mode 100644 index 0000000..e68c4f7 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryOp.h @@ -0,0 +1,103 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_UNARY_OP_H +#define EIGEN_CWISE_UNARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + UnaryOp(const typename XprType::Scalar&) + >::type Scalar; + typedef typename XprType::Nested XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum { + Flags = _XprTypeNested::Flags & RowMajorBit + }; +}; +} + +template +class CwiseUnaryOpImpl; + +/** \class CwiseUnaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise unary operator is applied to an expression + * + * \tparam UnaryOp template functor implementing the operator + * \tparam XprType the type of the expression to which we are applying the unary operator + * + * This class represents an expression where a unary operator is applied to an expression. + * It is the return type of all operations taking exactly 1 input expression, regardless of the + * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix + * is considered unary, because only the right-hand side is an expression, and its + * return type is a specialization of CwiseUnaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseUnaryOp types explicitly. + * + * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp + */ +template +class CwiseUnaryOp : public CwiseUnaryOpImpl::StorageKind>, internal::no_assignment_operator +{ + public: + + typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) + : m_xpr(xpr), m_functor(func) {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); } + + /** \returns the functor representing the unary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename internal::remove_all::type& + nestedExpression() { return m_xpr; } + + protected: + XprTypeNested m_xpr; + const UnaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseUnaryOpImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_UNARY_OP_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryView.h b/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryView.h new file mode 100644 index 0000000..a06d762 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/CwiseUnaryView.h @@ -0,0 +1,132 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_UNARY_VIEW_H +#define EIGEN_CWISE_UNARY_VIEW_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + ViewOp(const typename traits::Scalar&) + >::type Scalar; + typedef typename MatrixType::Nested MatrixTypeNested; + typedef typename remove_all::type _MatrixTypeNested; + enum { + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = traits<_MatrixTypeNested>::Flags & (RowMajorBit | FlagsLvalueBit | DirectAccessBit), // FIXME DirectAccessBit should not be handled by expressions + MatrixTypeInnerStride = inner_stride_at_compile_time::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 traits::Scalar) / sizeof(Scalar)), + OuterStrideAtCompileTime = outer_stride_at_compile_time::ret == Dynamic + ? int(Dynamic) + : outer_stride_at_compile_time::ret * int(sizeof(typename traits::Scalar) / sizeof(Scalar)) + }; +}; +} + +template +class CwiseUnaryViewImpl; + +/** \class CwiseUnaryView + * \ingroup Core_Module + * + * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector + * + * \tparam ViewOp template functor implementing the view + * \tparam MatrixType the type of the matrix we are applying the unary operator + * + * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. + * It is the return type of real() and imag(), and most of the time this is the only way it is used. + * + * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp + */ +template +class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind> +{ + public: + + typedef typename CwiseUnaryViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView) + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + explicit EIGEN_DEVICE_FUNC inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp()) + : m_matrix(mat), m_functor(func) {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + /** \returns the functor representing unary operation */ + EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC const typename internal::remove_all::type& + nestedExpression() const { return m_matrix; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC typename internal::remove_reference::type& + nestedExpression() { return m_matrix; } + + protected: + MatrixTypeNested m_matrix; + ViewOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseUnaryViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +template +class CwiseUnaryViewImpl + : public internal::dense_xpr_base< CwiseUnaryView >::type +{ + public: + + typedef CwiseUnaryView Derived; + typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; + + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) + + EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const + { + return derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const + { + return derived().nestedExpression().outerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); + } + protected: + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(CwiseUnaryViewImpl) +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_UNARY_VIEW_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/DenseBase.h b/lib/eigen-3.4.0/Eigen/src/Core/DenseBase.h new file mode 100644 index 0000000..9b16db6 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/DenseBase.h @@ -0,0 +1,701 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSEBASE_H +#define EIGEN_DENSEBASE_H + +namespace Eigen { + +namespace internal { + +// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. +// This dummy function simply aims at checking that at compile time. +static inline void check_DenseIndex_is_signed() { + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) +} + +} // end namespace internal + +/** \class DenseBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and arrays + * + * This class is the base that is inherited by all dense objects (matrix, vector, arrays, + * and related expression types). The common Eigen API for dense objects is contained in this class. + * + * \tparam Derived is the derived type, e.g., a matrix type or an expression. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. + * + * \sa \blank \ref TopicClassHierarchy + */ +template class DenseBase +#ifndef EIGEN_PARSED_BY_DOXYGEN + : public DenseCoeffsBase::value> +#else + : public DenseCoeffsBase +#endif // not EIGEN_PARSED_BY_DOXYGEN +{ + public: + + /** Inner iterator type to iterate over the coefficients of a row or column. + * \sa class InnerIterator + */ + typedef Eigen::InnerIterator InnerIterator; + + typedef typename internal::traits::StorageKind StorageKind; + + /** + * \brief The type used to store indices + * \details This typedef is relevant for types that store multiple indices such as + * PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index + * \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase. + */ + typedef typename internal::traits::StorageIndex StorageIndex; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. */ + typedef typename internal::traits::Scalar Scalar; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. + * + * It is an alias for the Scalar type */ + typedef Scalar value_type; + + typedef typename NumTraits::Real RealScalar; + typedef DenseCoeffsBase::value> Base; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::coeff; + using Base::coeffByOuterInner; + using Base::operator(); + using Base::operator[]; + using Base::x; + using Base::y; + using Base::z; + using Base::w; + using Base::stride; + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + typedef typename Base::CoeffReturnType CoeffReturnType; + + enum { + + RowsAtCompileTime = internal::traits::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 = internal::traits::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 = (internal::size_at_compile_time::RowsAtCompileTime, + internal::traits::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 = internal::traits::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. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxColsAtCompileTime = internal::traits::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. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxSizeAtCompileTime = (internal::size_at_compile_time::MaxRowsAtCompileTime, + internal::traits::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. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime + */ + + IsVectorAtCompileTime = internal::traits::RowsAtCompileTime == 1 + || internal::traits::ColsAtCompileTime == 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). */ + + NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2, + /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, + * and 2 for matrices. + */ + + Flags = internal::traits::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". + */ + + IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression has row-major storage order. */ + + InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) + : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + + InnerStrideAtCompileTime = internal::inner_stride_at_compile_time::ret, + OuterStrideAtCompileTime = internal::outer_stride_at_compile_time::ret + }; + + typedef typename internal::find_best_packet::type PacketScalar; + + enum { IsPlainObjectBase = 0 }; + + /** The plain matrix type corresponding to this expression. + * \sa PlainObject */ + typedef Matrix::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainMatrix; + + /** The plain array type corresponding to this expression. + * \sa PlainObject */ + typedef Array::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainArray; + + /** \brief The plain matrix or array type corresponding to this expression. + * + * This is not necessarily exactly the return type of eval(). In the case of plain matrices, + * 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 typename internal::conditional::XprKind,MatrixXpr >::value, + PlainMatrix, PlainArray>::type PlainObject; + + /** \returns the number of nonzero coefficients which is in practice the number + * of stored coefficients. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index nonZeros() const { return size(); } + + /** \returns the outer size. + * + * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a + * column-major matrix, and the number of rows for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + Index outerSize() const + { + return IsVectorAtCompileTime ? 1 + : int(IsRowMajor) ? this->rows() : this->cols(); + } + + /** \returns the inner size. + * + * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a + * column-major matrix, and the number of columns for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + Index innerSize() const + { + return IsVectorAtCompileTime ? this->size() + : int(IsRowMajor) ? this->cols() : this->rows(); + } + + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) + { + EIGEN_ONLY_USED_FOR_DEBUG(newSize); + eigen_assert(newSize == this->size() + && "DenseBase::resize() does not actually allow to resize."); + } + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) + { + EIGEN_ONLY_USED_FOR_DEBUG(rows); + EIGEN_ONLY_USED_FOR_DEBUG(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,PlainObject> ConstantReturnType; + /** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */ + EIGEN_DEPRECATED typedef CwiseNullaryOp,PlainObject> SequentialLinSpacedReturnType; + /** \internal Represents a vector with linearly spaced coefficients that allows random access. */ + typedef CwiseNullaryOp,PlainObject> RandomAccessLinSpacedReturnType; + /** \internal the return type of MatrixBase::eigenvalues() */ + typedef Matrix::Scalar>::Real, internal::traits::ColsAtCompileTime, 1> EigenvaluesReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** Copies \a other into *this. \returns a reference to *this. */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator+=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator-=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const ReturnByValue& func); + + /** \internal + * Copies \a other into *this without evaluating other. \returns a reference to *this. */ + template + /** \deprecated */ + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC + Derived& lazyAssign(const DenseBase& other); + + EIGEN_DEVICE_FUNC + CommaInitializer operator<< (const Scalar& s); + + template + /** \deprecated it now returns \c *this */ + EIGEN_DEPRECATED + const Derived& flagged() const + { return derived(); } + + template + EIGEN_DEVICE_FUNC + CommaInitializer operator<< (const DenseBase& other); + + typedef Transpose TransposeReturnType; + EIGEN_DEVICE_FUNC + TransposeReturnType transpose(); + typedef typename internal::add_const >::type ConstTransposeReturnType; + EIGEN_DEVICE_FUNC + ConstTransposeReturnType transpose() const; + EIGEN_DEVICE_FUNC + void transposeInPlace(); + + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(Index rows, Index cols, const Scalar& value); + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(Index size, const Scalar& value); + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(const Scalar& value); + + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high); + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Sequential_t, const Scalar& low, const Scalar& high); + + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(const Scalar& low, const Scalar& high); + + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func); + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(Index size, const CustomNullaryOp& func); + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(const CustomNullaryOp& func); + + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(); + + EIGEN_DEVICE_FUNC void fill(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setZero(); + EIGEN_DEVICE_FUNC Derived& setOnes(); + EIGEN_DEVICE_FUNC Derived& setRandom(); + + template EIGEN_DEVICE_FUNC + bool isApprox(const DenseBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC + bool isMuchSmallerThan(const RealScalar& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + template EIGEN_DEVICE_FUNC + bool isMuchSmallerThan(const DenseBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + + EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; + + inline bool hasNaN() const; + inline bool allFinite() const; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const Scalar& other); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const Scalar& other); + + typedef typename internal::add_const_on_value_type::type>::type EvalReturnType; + /** \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. + * + * \warning Be careful with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE EvalReturnType 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 internal::eval::type(derived()); + } + + /** swaps *this with the expression \a other. + * + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(const DenseBase& other) + { + EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op()); + } + + /** swaps *this with the matrix or array \a other. + * + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(PlainObjectBase& other) + { + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.derived(), internal::swap_assign_op()); + } + + EIGEN_DEVICE_FUNC inline const NestByValue nestByValue() const; + EIGEN_DEVICE_FUNC inline const ForceAlignedAccess forceAlignedAccess() const; + EIGEN_DEVICE_FUNC inline ForceAlignedAccess forceAlignedAccess(); + template EIGEN_DEVICE_FUNC + inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; + template EIGEN_DEVICE_FUNC + inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + + EIGEN_DEVICE_FUNC Scalar sum() const; + EIGEN_DEVICE_FUNC Scalar mean() const; + EIGEN_DEVICE_FUNC Scalar trace() const; + + EIGEN_DEVICE_FUNC Scalar prod() const; + + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff() const; + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff() const; + + + // By default, the fastest version with undefined NaN propagation semantics is + // used. + // TODO(rmlarsen): Replace with default template argument when we move to + // c++11 or beyond. + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar minCoeff() const { + return minCoeff(); + } + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar maxCoeff() const { + return maxCoeff(); + } + + template + EIGEN_DEVICE_FUNC + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const; + template + EIGEN_DEVICE_FUNC + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const; + template + EIGEN_DEVICE_FUNC + typename internal::traits::Scalar minCoeff(IndexType* index) const; + template + EIGEN_DEVICE_FUNC + typename internal::traits::Scalar maxCoeff(IndexType* index) const; + + // TODO(rmlarsen): Replace these methods with a default template argument. + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const { + return minCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const { + return maxCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* index) const { + return minCoeff(index); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* index) const { + return maxCoeff(index); + } + + template + EIGEN_DEVICE_FUNC + Scalar redux(const BinaryOp& func) const; + + template + EIGEN_DEVICE_FUNC + void visit(Visitor& func) const; + + /** \returns a WithFormat proxy object allowing to print a matrix the with given + * format \a fmt. + * + * See class IOFormat for some examples. + * + * \sa class IOFormat, class WithFormat + */ + inline const WithFormat format(const IOFormat& fmt) const + { + return WithFormat(derived(), fmt); + } + + /** \returns the unique coefficient of a 1x1 expression */ + EIGEN_DEVICE_FUNC + CoeffReturnType value() const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeff(0,0); + } + + EIGEN_DEVICE_FUNC bool all() const; + EIGEN_DEVICE_FUNC bool any() const; + EIGEN_DEVICE_FUNC Index count() const; + + typedef VectorwiseOp RowwiseReturnType; + typedef const VectorwiseOp ConstRowwiseReturnType; + typedef VectorwiseOp ColwiseReturnType; + typedef const VectorwiseOp ConstColwiseReturnType; + + /** \returns a VectorwiseOp wrapper of *this for broadcasting and partial reductions + * + * Example: \include MatrixBase_rowwise.cpp + * Output: \verbinclude MatrixBase_rowwise.out + * + * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const { + return ConstRowwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC RowwiseReturnType rowwise(); + + /** \returns a VectorwiseOp wrapper of *this broadcasting and partial reductions + * + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * + * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const { + return ConstColwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC ColwiseReturnType colwise(); + + typedef CwiseNullaryOp,PlainObject> RandomReturnType; + static const RandomReturnType Random(Index rows, Index cols); + static const RandomReturnType Random(Index size); + static const RandomReturnType Random(); + + template + inline EIGEN_DEVICE_FUNC const Select + select(const DenseBase& thenMatrix, + const DenseBase& elseMatrix) const; + + template + inline EIGEN_DEVICE_FUNC const Select + select(const DenseBase& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const; + + template + inline EIGEN_DEVICE_FUNC const Select + select(const typename ElseDerived::Scalar& thenScalar, const DenseBase& elseMatrix) const; + + template RealScalar lpNorm() const; + + template + EIGEN_DEVICE_FUNC + const Replicate replicate() const; + /** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate_int_int.cpp + * Output: \verbinclude MatrixBase_replicate_int_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC + const Replicate replicate(Index rowFactor, Index colFactor) const + { + return Replicate(derived(), rowFactor, colFactor); + } + + typedef Reverse ReverseReturnType; + typedef const Reverse ConstReverseReturnType; + EIGEN_DEVICE_FUNC ReverseReturnType reverse(); + /** This is the const version of reverse(). */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const + { + return ConstReverseReturnType(derived()); + } + EIGEN_DEVICE_FUNC void reverseInPlace(); + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** STL-like RandomAccessIterator + * iterator type as returned by the begin() and end() methods. + */ + typedef random_access_iterator_type iterator; + /** This is the const version of iterator (aka read-only) */ + typedef random_access_iterator_type const_iterator; + #else + typedef typename internal::conditional< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + >::type iterator_type; + + typedef typename internal::conditional< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + >::type const_iterator_type; + + // Stl-style iterators are supported only for vectors. + + typedef typename internal::conditional< IsVectorAtCompileTime, + iterator_type, + void + >::type iterator; + + typedef typename internal::conditional< IsVectorAtCompileTime, + const_iterator_type, + void + >::type const_iterator; + #endif + + inline iterator begin(); + inline const_iterator begin() const; + inline const_iterator cbegin() const; + inline iterator end(); + inline const_iterator end() const; + inline const_iterator cend() const; + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase +#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseUnaryOps.h" +# include "../plugins/BlockMethods.h" +# include "../plugins/IndexedViewMethods.h" +# include "../plugins/ReshapedMethods.h" +# ifdef EIGEN_DENSEBASE_PLUGIN +# include EIGEN_DENSEBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF +#undef EIGEN_DOC_UNARY_ADDONS + + // disable the use of evalTo for dense objects with a nice compilation error + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& ) const + { + EIGEN_STATIC_ASSERT((internal::is_same::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); + } + + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase) + /** Default constructor. Do nothing. */ + EIGEN_DEVICE_FUNC DenseBase() + { + /* Just checks for self-consistency of the flags. + * Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down + */ +#ifdef EIGEN_INTERNAL_DEBUGGING + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))), + INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION) +#endif + } + + private: + EIGEN_DEVICE_FUNC explicit DenseBase(int); + EIGEN_DEVICE_FUNC DenseBase(int,int); + template EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase&); +}; + +} // end namespace Eigen + +#endif // EIGEN_DENSEBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/DenseCoeffsBase.h b/lib/eigen-3.4.0/Eigen/src/Core/DenseCoeffsBase.h new file mode 100644 index 0000000..37fcdb5 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/DenseCoeffsBase.h @@ -0,0 +1,685 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSECOEFFSBASE_H +#define EIGEN_DENSECOEFFSBASE_H + +namespace Eigen { + +namespace internal { +template struct add_const_on_value_type_if_arithmetic +{ + typedef typename conditional::value, T, typename add_const_on_value_type::type>::type type; +}; +} + +/** \brief Base class providing read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * + * \note #ReadOnlyAccessors Constant indicating read-only access + * + * This class defines the \c operator() \c const function and friends, which can be used to read specific + * entries of a matrix or array. + * + * \sa DenseCoeffsBase, DenseCoeffsBase, + * \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public EigenBase +{ + public: + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::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::Flags&LvalueBit), + const Scalar&, + typename internal::conditional::value, Scalar, const Scalar>::type + >::type CoeffReturnType; + + typedef typename internal::add_const_on_value_type_if_arithmetic< + typename internal::packet_traits::type + >::type PacketReturnType; + + typedef EigenBase Base; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::RowsAtCompileTime) == 1 ? 0 + : int(Derived::ColsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::ColsAtCompileTime) == 1 ? 0 + : int(Derived::RowsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? inner + : outer; + } + + /** Short version: don't use this function, use + * \link operator()(Index,Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) const \endlink. + * + * \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeff(row,col); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { + return coeff(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns the coefficient at given the given row and column. + * + * \sa operator()(Index,Index), operator[](Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return coeff(row, col); + } + + /** Short version: don't use this function, use + * \link operator[](Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameter \a index is in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) const \endlink. + * + * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + coeff(Index index) const + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).coeff(index); + } + + + /** \returns the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + operator[](Index index) const + { + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + eigen_assert(index >= 0 && index < size()); + return coeff(index); + } + + /** \returns the coefficient at given index. + * + * This is synonymous to operator[](Index) const. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + operator()(Index index) const + { + eigen_assert(index >= 0 && index < size()); + return coeff(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + x() const { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + y() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } + + /** equivalent to operator[](2). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + z() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } + + /** equivalent to operator[](3). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + w() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } + + /** \internal + * \returns the packet of coefficients starting at the given row and column. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const + { + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); + return internal::evaluator(derived()).template packet(row,col); + } + + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(Index outer, Index inner) const + { + return packet(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \internal + * \returns the packet of coefficients starting at the given index. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit and the LinearAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).template packet(index); + } + + protected: + // explanation: DenseBase is doing "using ..." on the methods from DenseCoeffsBase. + // 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. + void coeffRef(); + void coeffRefByOuterInner(); + void writePacket(); + void writePacketByOuterInner(); + void copyCoeff(); + void copyCoeffByOuterInner(); + void copyPacket(); + void copyPacketByOuterInner(); + void stride(); + void innerStride(); + void outerStride(); + void rowStride(); + void colStride(); +}; + +/** \brief Base class providing read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * + * \note #WriteAccessors Constant indicating read/write access + * + * This class defines the non-const \c operator() function and friends, which can be used to write specific + * entries of a matrix or array. This class inherits DenseCoeffsBase which + * defines the const variant for reading specific entries. + * + * \sa DenseCoeffsBase, \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + using Base::coeff; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::operator[]; + using Base::operator(); + using Base::x; + using Base::y; + using Base::z; + using Base::w; + + /** Short version: don't use this function, use + * \link operator()(Index,Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) \endlink. + * + * \sa operator()(Index,Index), coeff(Index, Index) const, coeffRef(Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeffRef(row,col); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + coeffRefByOuterInner(Index outer, Index inner) + { + return coeffRef(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns a reference to the coefficient at given the given row and column. + * + * \sa operator[](Index) + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator()(Index row, Index col) + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return coeffRef(row, col); + } + + + /** Short version: don't use this function, use + * \link operator[](Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) \endlink. + * + * \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index) + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + coeffRef(Index index) + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator[](Index index) + { + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + eigen_assert(index >= 0 && index < size()); + return coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This is synonymous to operator[](Index). + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator()(Index index) + { + eigen_assert(index >= 0 && index < size()); + return coeffRef(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + x() { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + y() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } + + /** equivalent to operator[](2). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + z() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } + + /** equivalent to operator[](3). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + w() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } +}; + +/** \brief Base class providing direct read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * + * \note #DirectAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read-only using + * \c operator() . + * + * \sa \blank \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + EIGEN_CONSTEXPR inline Index stride() const + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rowStride() const + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index colStride() const + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +/** \brief Base class providing direct read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * + * \note #DirectWriteAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read/write using + * \c operator(). + * + * \sa \blank \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase + : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + EIGEN_CONSTEXPR inline Index stride() const EIGEN_NOEXCEPT + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rowStride() const EIGEN_NOEXCEPT + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index colStride() const EIGEN_NOEXCEPT + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +namespace internal { + +template +struct first_aligned_impl +{ + static EIGEN_CONSTEXPR inline Index run(const Derived&) EIGEN_NOEXCEPT + { return 0; } +}; + +template +struct first_aligned_impl +{ + static inline Index run(const Derived& m) + { + return internal::first_aligned(m.data(), m.size()); + } +}; + +/** \internal \returns the index of the first element of the array stored by \a m that is properly aligned with respect to \a Alignment for vectorization. + * + * \tparam Alignment requested alignment in Bytes. + * + * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more + * documentation. + */ +template +static inline Index first_aligned(const DenseBase& m) +{ + enum { ReturnZero = (int(evaluator::Alignment) >= Alignment) || !(Derived::Flags & DirectAccessBit) }; + return first_aligned_impl::run(m.derived()); +} + +template +static inline Index first_default_aligned(const DenseBase& m) +{ + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type DefaultPacketType; + return internal::first_aligned::alignment),Derived>(m); +} + +template::ret> +struct inner_stride_at_compile_time +{ + enum { ret = traits::InnerStrideAtCompileTime }; +}; + +template +struct inner_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +template::ret> +struct outer_stride_at_compile_time +{ + enum { ret = traits::OuterStrideAtCompileTime }; +}; + +template +struct outer_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DENSECOEFFSBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/DenseStorage.h b/lib/eigen-3.4.0/Eigen/src/Core/DenseStorage.h new file mode 100644 index 0000000..08ef6c5 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/DenseStorage.h @@ -0,0 +1,652 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2010-2013 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIXSTORAGE_H +#define EIGEN_MATRIXSTORAGE_H + +#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN; +#else + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) +#endif + +namespace Eigen { + +namespace internal { + +struct constructor_without_unaligned_array_assert {}; + +template +EIGEN_DEVICE_FUNC +void check_static_allocation_size() +{ + // if EIGEN_STACK_ALLOCATION_LIMIT is defined to 0, then no limit + #if EIGEN_STACK_ALLOCATION_LIMIT + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + #endif +} + +/** \internal + * Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned: + * to 16 bytes boundary if the total size is a multiple of 16 bytes. + */ +template ::value > +struct plain_array +{ + T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) +#elif EIGEN_GNUC_AT_LEAST(4,7) + // GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned. + // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900 + // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined: + template + EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) { return array; } + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0 \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); +#else + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((internal::UIntPtr(array) & (sizemask)) == 0 \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); +#endif + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + T array[1]; + EIGEN_DEVICE_FUNC plain_array() {} + EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {} +}; + +struct plain_array_helper { + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void copy(const plain_array& src, const Eigen::Index size, + plain_array& dst) { + smart_copy(src.array, src.array + size, dst.array); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void swap(plain_array& a, const Eigen::Index a_size, + plain_array& b, const Eigen::Index b_size) { + if (a_size < b_size) { + std::swap_ranges(b.array, b.array + a_size, a.array); + smart_move(b.array + a_size, b.array + b_size, a.array + a_size); + } else if (a_size > b_size) { + std::swap_ranges(a.array, a.array + b_size, b.array); + smart_move(a.array + b_size, a.array + a_size, b.array + b_size); + } else { + std::swap_ranges(a.array, a.array + a_size, b.array); + } + } +}; + +} // end namespace internal + +/** \internal + * + * \class DenseStorage + * \ingroup Core_Module + * + * \brief Stores the data of a matrix + * + * This class stores the data of fixed-size, dynamic-size or mixed matrices + * in a way as compact as possible. + * + * \sa Matrix + */ +template class DenseStorage; + +// purely fixed-size matrix +template class DenseStorage +{ + internal::plain_array m_data; + public: + EIGEN_DEVICE_FUNC DenseStorage() { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } + EIGEN_DEVICE_FUNC + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()) {} +#if !EIGEN_HAS_CXX11 || defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) + EIGEN_DEVICE_FUNC + DenseStorage(const DenseStorage& other) : m_data(other.m_data) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } +#else + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) = default; +#endif +#if !EIGEN_HAS_CXX11 + EIGEN_DEVICE_FUNC + DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) m_data = other.m_data; + return *this; + } +#else + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) = default; +#endif +#if EIGEN_HAS_RVALUE_REFERENCES +#if !EIGEN_HAS_CXX11 + EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + { + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + if (this != &other) + m_data = std::move(other.m_data); + return *this; + } +#else + EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&&) = default; + EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&&) = default; +#endif +#endif + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols==_Cols); + EIGEN_UNUSED_VARIABLE(size); + EIGEN_UNUSED_VARIABLE(rows); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data, other.m_data); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// null matrix +template class DenseStorage +{ + public: + EIGEN_DEVICE_FUNC DenseStorage() {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; } + EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return 0; } + EIGEN_DEVICE_FUNC T *data() { return 0; } +}; + +// more specializations for null matrices; these are necessary to resolve ambiguities +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + +// dynamic-size matrix with fixed-size storage +template class DenseStorage +{ + internal::plain_array m_data; + Index m_rows; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_rows = other.m_rows; + m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * m_cols, other.m_data, other.m_rows * other.m_cols); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows() const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols() const {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed width +template class DenseStorage +{ + internal::plain_array m_data; + Index m_rows; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows) + { + internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data); + } + + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_rows = other.m_rows; + internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * _Cols, other.m_data, other.m_rows * _Cols); + numext::swap(m_rows, other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) const EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed height +template class DenseStorage +{ + internal::plain_array m_data; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data); + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols) : m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + internal::plain_array_helper::swap(m_data, _Rows * m_cols, other.m_data, _Rows * other.m_cols); + numext::swap(m_cols, other.m_cols); + } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) const EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// purely dynamic matrix. +template class DenseStorage +{ + T *m_data; + Index m_rows; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*other.m_cols)) + , m_rows(other.m_rows) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*m_cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_rows = 0; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); + numext::swap(m_cols, other.m_cols); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + void conservativeResize(Index size, Index rows, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); + m_rows = rows; + m_cols = cols; + } + EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols) + { + if(size != m_rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_rows = rows; + m_cols = cols; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +// matrix with dynamic width and fixed height (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols >=0); + EIGEN_UNUSED_VARIABLE(rows); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(_Rows*other.m_cols)) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_cols*_Rows) + internal::smart_copy(other.m_data, other.m_data+_Rows*m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_cols, other.m_cols); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); + m_cols = cols; + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols) + { + if(size != _Rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_cols = cols; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +// matrix with dynamic height and fixed width (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + Index m_rows; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols == _Cols); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*_Cols)) + , m_rows(other.m_rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*_Cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*_Cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) + { + other.m_data = nullptr; + other.m_rows = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) {return _Cols;} + void conservativeResize(Index size, Index rows, Index) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); + m_rows = rows; + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index) + { + if(size != m_rows*_Cols) + { + internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_rows = rows; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +} // end namespace Eigen + +#endif // EIGEN_MATRIX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Diagonal.h b/lib/eigen-3.4.0/Eigen/src/Core/Diagonal.h new file mode 100644 index 0000000..3112d2c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Diagonal.h @@ -0,0 +1,258 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2009 Benoit Jacob +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONAL_H +#define EIGEN_DIAGONAL_H + +namespace Eigen { + +/** \class Diagonal + * \ingroup Core_Module + * + * \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix + * + * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal + * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. + * A positive value means a superdiagonal, a negative value means a subdiagonal. + * You can also use DynamicIndex so the index can be set at runtime. + * + * The matrix is not required to be square. + * + * This class represents an expression of the main diagonal, or any sub/super diagonal + * of a square matrix. It is the return type of MatrixBase::diagonal() and MatrixBase::diagonal(Index) and most of the + * time this is the only way it is used. + * + * \sa MatrixBase::diagonal(), MatrixBase::diagonal(Index) + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + typedef typename MatrixType::StorageKind StorageKind; + enum { + RowsAtCompileTime = (int(DiagIndex) == DynamicIndex || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic + : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), + MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), + ColsAtCompileTime = 1, + MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic + : DiagIndex == DynamicIndex ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, + MatrixType::MaxColsAtCompileTime) + : (EIGEN_PLAIN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), + MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), + MaxColsAtCompileTime = 1, + MaskLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = (unsigned int)_MatrixTypeNested::Flags & (RowMajorBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, // FIXME DirectAccessBit should not be handled by expressions + MatrixTypeOuterStride = outer_stride_at_compile_time::ret, + InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1, + OuterStrideAtCompileTime = 0 + }; +}; +} + +template class Diagonal + : public internal::dense_xpr_base< Diagonal >::type +{ + public: + + enum { DiagIndex = _DiagIndex }; + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) + + EIGEN_DEVICE_FUNC + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) + { + eigen_assert( a_index <= m_matrix.cols() && -a_index <= m_matrix.rows() ); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + + EIGEN_DEVICE_FUNC + inline Index rows() const + { + return m_index.value()<0 ? numext::mini(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini(m_matrix.rows(),m_matrix.cols()-m_index.value()); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return 1; } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { + return m_matrix.outerStride() + 1; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return 0; } + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index row, Index) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index row, Index) const + { + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline CoeffReturnType coeff(Index row, Index) const + { + return m_matrix.coeff(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index idx) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index idx) const + { + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline CoeffReturnType coeff(Index idx) const + { + return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const typename internal::remove_all::type& + nestedExpression() const + { + return m_matrix; + } + + EIGEN_DEVICE_FUNC + inline Index index() const + { + return m_index.value(); + } + + protected: + typename internal::ref_selector::non_const_type m_matrix; + const internal::variable_if_dynamicindex m_index; + + private: + // some compilers may fail to optimize std::max etc in case of compile-time constants... + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index absDiagIndex() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : 0; } + // trigger a compile-time error if someone try to call packet + template typename MatrixType::PacketReturnType packet(Index) const; + template typename MatrixType::PacketReturnType packet(Index,Index) const; +}; + +/** \returns an expression of the main diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * Example: \include MatrixBase_diagonal.cpp + * Output: \verbinclude MatrixBase_diagonal.out + * + * \sa class Diagonal */ +template +EIGEN_DEVICE_FUNC inline typename MatrixBase::DiagonalReturnType +MatrixBase::diagonal() +{ + return DiagonalReturnType(derived()); +} + +/** This is the const version of diagonal(). */ +template +EIGEN_DEVICE_FUNC inline typename MatrixBase::ConstDiagonalReturnType +MatrixBase::diagonal() const +{ + return ConstDiagonalReturnType(derived()); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_int.cpp + * Output: \verbinclude MatrixBase_diagonal_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +EIGEN_DEVICE_FUNC inline typename MatrixBase::DiagonalDynamicIndexReturnType +MatrixBase::diagonal(Index index) +{ + return DiagonalDynamicIndexReturnType(derived(), index); +} + +/** This is the const version of diagonal(Index). */ +template +EIGEN_DEVICE_FUNC inline typename MatrixBase::ConstDiagonalDynamicIndexReturnType +MatrixBase::diagonal(Index index) const +{ + return ConstDiagonalDynamicIndexReturnType(derived(), index); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_template_int.cpp + * Output: \verbinclude MatrixBase_diagonal_template_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +template +EIGEN_DEVICE_FUNC +inline typename MatrixBase::template DiagonalIndexReturnType::Type +MatrixBase::diagonal() +{ + return typename DiagonalIndexReturnType::Type(derived()); +} + +/** This is the const version of diagonal(). */ +template +template +EIGEN_DEVICE_FUNC +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +MatrixBase::diagonal() const +{ + return typename ConstDiagonalIndexReturnType::Type(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_DIAGONAL_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/DiagonalMatrix.h b/lib/eigen-3.4.0/Eigen/src/Core/DiagonalMatrix.h new file mode 100644 index 0000000..542685c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/DiagonalMatrix.h @@ -0,0 +1,391 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONALMATRIX_H +#define EIGEN_DIAGONALMATRIX_H + +namespace Eigen { + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +class DiagonalBase : public EigenBase +{ + public: + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::RealScalar RealScalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + IsVectorAtCompileTime = 0, + Flags = NoPreferredStorageOrderBit + }; + + typedef Matrix DenseMatrixType; + typedef DenseMatrixType DenseType; + typedef DiagonalMatrix PlainObject; + + EIGEN_DEVICE_FUNC + inline const Derived& derived() const { return *static_cast(this); } + EIGEN_DEVICE_FUNC + inline Derived& derived() { return *static_cast(this); } + + EIGEN_DEVICE_FUNC + DenseMatrixType toDenseMatrix() const { return derived(); } + + EIGEN_DEVICE_FUNC + inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + EIGEN_DEVICE_FUNC + inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + + EIGEN_DEVICE_FUNC + inline Index rows() const { return diagonal().size(); } + EIGEN_DEVICE_FUNC + inline Index cols() const { return diagonal().size(); } + + template + EIGEN_DEVICE_FUNC + const Product + operator*(const MatrixBase &matrix) const + { + return Product(derived(),matrix.derived()); + } + + typedef DiagonalWrapper, const DiagonalVectorType> > InverseReturnType; + EIGEN_DEVICE_FUNC + inline const InverseReturnType + inverse() const + { + return InverseReturnType(diagonal().cwiseInverse()); + } + + EIGEN_DEVICE_FUNC + inline const DiagonalWrapper + operator*(const Scalar& scalar) const + { + return DiagonalWrapper(diagonal() * scalar); + } + EIGEN_DEVICE_FUNC + friend inline const DiagonalWrapper + operator*(const Scalar& scalar, const DiagonalBase& other) + { + return DiagonalWrapper(scalar * other.diagonal()); + } + + template + EIGEN_DEVICE_FUNC + #ifdef EIGEN_PARSED_BY_DOXYGEN + inline unspecified_expression_type + #else + inline const DiagonalWrapper + #endif + operator+(const DiagonalBase& other) const + { + return (diagonal() + other.diagonal()).asDiagonal(); + } + + template + EIGEN_DEVICE_FUNC + #ifdef EIGEN_PARSED_BY_DOXYGEN + inline unspecified_expression_type + #else + inline const DiagonalWrapper + #endif + operator-(const DiagonalBase& other) const + { + return (diagonal() - other.diagonal()).asDiagonal(); + } +}; + +#endif + +/** \class DiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a diagonal matrix with its storage + * + * \param _Scalar the type of coefficients + * \param SizeAtCompileTime the dimension of the matrix, or Dynamic + * \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults + * to SizeAtCompileTime. Most of the time, you do not need to specify it. + * + * \sa class DiagonalWrapper + */ + +namespace internal { +template +struct traits > + : traits > +{ + typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; + typedef DiagonalShape StorageKind; + enum { + Flags = LvalueBit | NoPreferredStorageOrderBit + }; +}; +} +template +class DiagonalMatrix + : public DiagonalBase > +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef const DiagonalMatrix& Nested; + typedef _Scalar Scalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + #endif + + protected: + + DiagonalVectorType m_diagonal; + + public: + + /** const version of diagonal(). */ + EIGEN_DEVICE_FUNC + inline const DiagonalVectorType& diagonal() const { return m_diagonal; } + /** \returns a reference to the stored vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC + inline DiagonalVectorType& diagonal() { return m_diagonal; } + + /** Default constructor without initialization */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix() {} + + /** Constructs a diagonal matrix with given dimension */ + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} + + /** 2D constructor. */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} + + /** 3D constructor. */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} + + #if EIGEN_HAS_CXX11 + /** \brief Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. \cpp11 + * + * There exists C++98 anologue constructors for fixed-size diagonal matrices having 2 or 3 coefficients. + * + * \warning To construct a diagonal matrix of fixed size, the number of values passed to this + * constructor must match the fixed dimension of \c *this. + * + * \sa DiagonalMatrix(const Scalar&, const Scalar&) + * \sa DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + DiagonalMatrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const ArgTypes&... args) + : m_diagonal(a0, a1, a2, args...) {} + + /** \brief Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer + * lists \cpp11 + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE DiagonalMatrix(const std::initializer_list>& list) + : m_diagonal(list) {} + #endif // EIGEN_HAS_CXX11 + + /** Copy constructor. */ + template + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const DiagonalBase& other) : m_diagonal(other.diagonal()) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** copy constructor. prevent a default copy constructor from hiding the other templated constructor */ + inline DiagonalMatrix(const DiagonalMatrix& other) : m_diagonal(other.diagonal()) {} + #endif + + /** generic constructor from expression of the diagonal coefficients */ + template + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(const MatrixBase& other) : m_diagonal(other) + {} + + /** Copy operator. */ + template + EIGEN_DEVICE_FUNC + DiagonalMatrix& operator=(const DiagonalBase& other) + { + m_diagonal = other.diagonal(); + return *this; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_DEVICE_FUNC + DiagonalMatrix& operator=(const DiagonalMatrix& other) + { + m_diagonal = other.diagonal(); + return *this; + } + #endif + + /** Resizes to given size. */ + EIGEN_DEVICE_FUNC + inline void resize(Index size) { m_diagonal.resize(size); } + /** Sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC + inline void setZero() { m_diagonal.setZero(); } + /** Resizes and sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC + inline void setZero(Index size) { m_diagonal.setZero(size); } + /** Sets this matrix to be the identity matrix of the current size. */ + EIGEN_DEVICE_FUNC + inline void setIdentity() { m_diagonal.setOnes(); } + /** Sets this matrix to be the identity matrix of the given size. */ + EIGEN_DEVICE_FUNC + inline void setIdentity(Index size) { m_diagonal.setOnes(size); } +}; + +/** \class DiagonalWrapper + * \ingroup Core_Module + * + * \brief Expression of a diagonal matrix + * + * \param _DiagonalVectorType the type of the vector of diagonal coefficients + * + * This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients, + * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal() + * and most of the time this is the only way that it is used. + * + * \sa class DiagonalMatrix, class DiagonalBase, MatrixBase::asDiagonal() + */ + +namespace internal { +template +struct traits > +{ + typedef _DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::StorageIndex StorageIndex; + typedef DiagonalShape StorageKind; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + Flags = (traits::Flags & LvalueBit) | NoPreferredStorageOrderBit + }; +}; +} + +template +class DiagonalWrapper + : public DiagonalBase >, internal::no_assignment_operator +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef _DiagonalVectorType DiagonalVectorType; + typedef DiagonalWrapper Nested; + #endif + + /** Constructor from expression of diagonal coefficients to wrap. */ + EIGEN_DEVICE_FUNC + explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} + + /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + EIGEN_DEVICE_FUNC + const DiagonalVectorType& diagonal() const { return m_diagonal; } + + protected: + typename DiagonalVectorType::Nested m_diagonal; +}; + +/** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients + * + * \only_for_vectors + * + * Example: \include MatrixBase_asDiagonal.cpp + * Output: \verbinclude MatrixBase_asDiagonal.out + * + * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal() + **/ +template +EIGEN_DEVICE_FUNC inline const DiagonalWrapper +MatrixBase::asDiagonal() const +{ + return DiagonalWrapper(derived()); +} + +/** \returns true if *this is approximately equal to a diagonal matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isDiagonal.cpp + * Output: \verbinclude MatrixBase_isDiagonal.out + * + * \sa asDiagonal() + */ +template +bool MatrixBase::isDiagonal(const RealScalar& prec) const +{ + if(cols() != rows()) return false; + RealScalar maxAbsOnDiagonal = static_cast(-1); + for(Index j = 0; j < cols(); ++j) + { + RealScalar absOnDiagonal = numext::abs(coeff(j,j)); + if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; + } + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < j; ++i) + { + if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false; + if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false; + } + return true; +} + +namespace internal { + +template<> struct storage_kind_to_shape { typedef DiagonalShape Shape; }; + +struct Diagonal2Dense {}; + +template<> struct AssignmentKind { typedef Diagonal2Dense Kind; }; + +// Diagonal matrix to Dense assignment +template< typename DstXprType, typename SrcXprType, typename Functor> +struct Assignment +{ + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + dst.setZero(); + dst.diagonal() = src.diagonal(); + } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { dst.diagonal() += src.diagonal(); } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { dst.diagonal() -= src.diagonal(); } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DIAGONALMATRIX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/DiagonalProduct.h b/lib/eigen-3.4.0/Eigen/src/Core/DiagonalProduct.h new file mode 100644 index 0000000..7911d1c --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/DiagonalProduct.h @@ -0,0 +1,28 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONALPRODUCT_H +#define EIGEN_DIAGONALPRODUCT_H + +namespace Eigen { + +/** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. + */ +template +template +EIGEN_DEVICE_FUNC inline const Product +MatrixBase::operator*(const DiagonalBase &a_diagonal) const +{ + return Product(derived(),a_diagonal.derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_DIAGONALPRODUCT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Dot.h b/lib/eigen-3.4.0/Eigen/src/Core/Dot.h new file mode 100644 index 0000000..5c3441b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Dot.h @@ -0,0 +1,318 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008, 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DOT_H +#define EIGEN_DOT_H + +namespace Eigen { + +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. +template +struct dot_nocheck +{ + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.template binaryExpr(b).sum(); + } +}; + +template +struct dot_nocheck +{ + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.transpose().template binaryExpr(b).sum(); + } +}; + +} // end namespace internal + +/** \fn MatrixBase::dot + * \returns the dot product of *this with other. + * + * \only_for_vectors + * + * \note If the scalar type is complex numbers, then this function returns the hermitian + * (sesquilinear) dot product, conjugate-linear in the first variable and linear in the + * second variable. + * + * \sa squaredNorm(), norm() + */ +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE +typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType +MatrixBase::dot(const MatrixBase& other) const +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) +#if !(defined(EIGEN_NO_STATIC_ASSERT) && defined(EIGEN_NO_DEBUG)) + typedef internal::scalar_conj_product_op func; + EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar); +#endif + + eigen_assert(size() == other.size()); + + return internal::dot_nocheck::run(*this, other); +} + +//---------- implementation of L2 norm and related functions ---------- + +/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the squared Frobenius norm. + * In both cases, it consists in the sum of the square of all the matrix entries. + * For vectors, this is also equals to the dot product of \c *this with itself. + * + * \sa dot(), norm(), lpNorm() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const +{ + return numext::real((*this).cwiseAbs2().sum()); +} + +/** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm. + * In both cases, it consists in the square root of the sum of the square of all the matrix entries. + * For vectors, this is also equals to the square root of the dot product of \c *this with itself. + * + * \sa lpNorm(), dot(), squaredNorm() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::norm() const +{ + return numext::sqrt(squaredNorm()); +} + +/** \returns an expression of the quotient of \c *this by its own norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \only_for_vectors + * + * \sa norm(), normalize() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject +MatrixBase::normalized() const +{ + typedef typename internal::nested_eval::type _Nested; + _Nested n(derived()); + RealScalar z = n.squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + return n / numext::sqrt(z); + else + return n; +} + +/** Normalizes the vector, i.e. divides it by its own norm. + * + * \only_for_vectors + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa norm(), normalized() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::normalize() +{ + RealScalar z = squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + derived() /= numext::sqrt(z); +} + +/** \returns an expression of the quotient of \c *this by its own norm while avoiding underflow and overflow. + * + * \only_for_vectors + * + * This method is analogue to the normalized() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \sa stableNorm(), stableNormalize(), normalized() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject +MatrixBase::stableNormalized() const +{ + typedef typename internal::nested_eval::type _Nested; + _Nested n(derived()); + RealScalar w = n.cwiseAbs().maxCoeff(); + RealScalar z = (n/w).squaredNorm(); + if(z>RealScalar(0)) + return n / (numext::sqrt(z)*w); + else + return n; +} + +/** Normalizes the vector while avoid underflow and overflow + * + * \only_for_vectors + * + * This method is analogue to the normalize() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa stableNorm(), stableNormalized(), normalize() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::stableNormalize() +{ + RealScalar w = cwiseAbs().maxCoeff(); + RealScalar z = (derived()/w).squaredNorm(); + if(z>RealScalar(0)) + derived() /= numext::sqrt(z)*w; +} + +//---------- implementation of other norms ---------- + +namespace internal { + +template +struct lpNorm_selector +{ + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) + { + EIGEN_USING_STD(pow) + return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); + } +}; + +template +struct lpNorm_selector +{ + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.cwiseAbs().sum(); + } +}; + +template +struct lpNorm_selector +{ + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.norm(); + } +}; + +template +struct lpNorm_selector +{ + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) + { + if(Derived::SizeAtCompileTime==0 || (Derived::SizeAtCompileTime==Dynamic && m.size()==0)) + return RealScalar(0); + return m.cwiseAbs().maxCoeff(); + } +}; + +} // end namespace internal + +/** \returns the \b coefficient-wise \f$ \ell^p \f$ norm of \c *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values + * of the coefficients of \c *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 \c *this. + * + * In all cases, if \c *this is empty, then the value 0 is returned. + * + * \note For matrices, this function does not compute the operator-norm. That is, if \c *this is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and \f$\infty\f$-norm matrix operator norms using \link TutorialReductionsVisitorsBroadcastingReductionsNorm partial reductions \endlink. + * + * \sa norm() + */ +template +template +#ifndef EIGEN_PARSED_BY_DOXYGEN +EIGEN_DEVICE_FUNC inline typename NumTraits::Scalar>::Real +#else +EIGEN_DEVICE_FUNC MatrixBase::RealScalar +#endif +MatrixBase::lpNorm() const +{ + return internal::lpNorm_selector::run(*this); +} + +//---------- implementation of isOrthogonal / isUnitary ---------- + +/** \returns true if *this is approximately orthogonal to \a other, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isOrthogonal.cpp + * Output: \verbinclude MatrixBase_isOrthogonal.out + */ +template +template +bool MatrixBase::isOrthogonal +(const MatrixBase& other, const RealScalar& prec) const +{ + typename internal::nested_eval::type nested(derived()); + typename internal::nested_eval::type otherNested(other.derived()); + return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); +} + +/** \returns true if *this is approximately an unitary matrix, + * within the precision given by \a prec. In the case where the \a Scalar + * type is real numbers, a unitary matrix is an orthogonal matrix, whence the name. + * + * \note This can be used to check whether a family of vectors forms an orthonormal basis. + * Indeed, \c m.isUnitary() returns true if and only if the columns (equivalently, the rows) of m form an + * orthonormal basis. + * + * Example: \include MatrixBase_isUnitary.cpp + * Output: \verbinclude MatrixBase_isUnitary.out + */ +template +bool MatrixBase::isUnitary(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index i = 0; i < cols(); ++i) + { + if(!internal::isApprox(self.col(i).squaredNorm(), static_cast(1), prec)) + return false; + for(Index j = 0; j < i; ++j) + if(!internal::isMuchSmallerThan(self.col(i).dot(self.col(j)), static_cast(1), prec)) + return false; + } + return true; +} + +} // end namespace Eigen + +#endif // EIGEN_DOT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/EigenBase.h b/lib/eigen-3.4.0/Eigen/src/Core/EigenBase.h new file mode 100644 index 0000000..6b3c7d3 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/EigenBase.h @@ -0,0 +1,160 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_EIGENBASE_H +#define EIGEN_EIGENBASE_H + +namespace Eigen { + +/** \class EigenBase + * \ingroup Core_Module + * + * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). + * + * In other words, an EigenBase object is an object that can be copied into a MatrixBase. + * + * Besides MatrixBase-derived classes, this also includes special matrix classes such as diagonal matrices, etc. + * + * Notice that this class is trivial, it is only used to disambiguate overloaded functions. + * + * \sa \blank \ref TopicClassHierarchy + */ +template struct EigenBase +{ +// typedef typename internal::plain_matrix_type::type PlainObject; + + /** \brief The interface type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \sa StorageIndex, \ref TopicPreprocessorDirectives. + * DEPRECATED: Since Eigen 3.3, its usage is deprecated. Use Eigen::Index instead. + * Deprecation is not marked with a doxygen comment because there are too many existing usages to add the deprecation attribute. + */ + typedef Eigen::Index Index; + + // FIXME is it needed? + typedef typename internal::traits::StorageKind StorageKind; + + /** \returns a reference to the derived object */ + EIGEN_DEVICE_FUNC + Derived& derived() { return *static_cast(this); } + /** \returns a const reference to the derived object */ + EIGEN_DEVICE_FUNC + const Derived& derived() const { return *static_cast(this); } + + EIGEN_DEVICE_FUNC + inline Derived& const_cast_derived() const + { return *static_cast(const_cast(this)); } + EIGEN_DEVICE_FUNC + inline const Derived& const_derived() const + { return *static_cast(this); } + + /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return derived().rows(); } + /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return derived().cols(); } + /** \returns the number of coefficients, which is rows()*cols(). + * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index size() const EIGEN_NOEXCEPT { return rows() * cols(); } + + /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const + { derived().evalTo(dst); } + + /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void addTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst += res; + } + + /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void subTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst -= res; + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = dst * this->derived(); + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = this->derived() * dst; + } + +}; + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** \brief Copies the generic expression \a other into *this. + * + * \details The expression must provide a (templated) evalTo(Derived& dst) const + * function which does the actual job. In practice, this allows any user to write + * its own special matrix without having to modify MatrixBase + * + * \returns a reference to *this. + */ +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator=(const EigenBase &other) +{ + call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator+=(const EigenBase &other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator-=(const EigenBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_EIGENBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ForceAlignedAccess.h b/lib/eigen-3.4.0/Eigen/src/Core/ForceAlignedAccess.h new file mode 100644 index 0000000..817a43a --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ForceAlignedAccess.h @@ -0,0 +1,150 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_FORCEALIGNEDACCESS_H +#define EIGEN_FORCEALIGNEDACCESS_H + +namespace Eigen { + +/** \class ForceAlignedAccess + * \ingroup Core_Module + * + * \brief Enforce aligned packet loads and stores regardless of what is requested + * + * \param ExpressionType the type of the object of which we are forcing aligned packet access + * + * This class is the return type of MatrixBase::forceAlignedAccess() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::forceAlignedAccess() + */ + +namespace internal { +template +struct traits > : public traits +{}; +} + +template class ForceAlignedAccess + : public internal::dense_xpr_base< ForceAlignedAccess >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) + + EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + protected: + const ExpressionType& m_expression; + + private: + ForceAlignedAccess& operator=(const ForceAlignedAccess&); +}; + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(),class ForceAlignedAccess + */ +template +inline const ForceAlignedAccess +MatrixBase::forceAlignedAccess() const +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(), class ForceAlignedAccess + */ +template +inline ForceAlignedAccess +MatrixBase::forceAlignedAccess() +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::add_const_on_value_type,Derived&>::type>::type +MatrixBase::forceAlignedAccessIf() const +{ + return derived(); // FIXME This should not work but apparently is never used +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::conditional,Derived&>::type +MatrixBase::forceAlignedAccessIf() +{ + return derived(); // FIXME This should not work but apparently is never used +} + +} // end namespace Eigen + +#endif // EIGEN_FORCEALIGNEDACCESS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Fuzzy.h b/lib/eigen-3.4.0/Eigen/src/Core/Fuzzy.h new file mode 100644 index 0000000..43aa49b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Fuzzy.h @@ -0,0 +1,155 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_FUZZY_H +#define EIGEN_FUZZY_H + +namespace Eigen { + +namespace internal +{ + +template::IsInteger> +struct isApprox_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) + { + typename internal::nested_eval::type nested(x); + typename internal::nested_eval::type otherNested(y); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * numext::mini(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + } +}; + +template +struct isApprox_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) + { + return x.matrix() == y.matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_object_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) + { + return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum(); + } +}; + +template +struct isMuchSmallerThan_object_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_scalar_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) + { + return x.cwiseAbs2().sum() <= numext::abs2(prec * y); + } +}; + +template +struct isMuchSmallerThan_scalar_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +} // end namespace internal + + +/** \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 using the Hilbert-Schmidt norm (aka Frobenius norm + * L2 norm). + * + * \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 internal::isMuchSmallerThan(const + * RealScalar&, RealScalar) instead. + * + * \sa internal::isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +EIGEN_DEVICE_FUNC bool DenseBase::isApprox( + const DenseBase& other, + const RealScalar& prec +) const +{ + return internal::isApprox_selector::run(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 using the Hilbert-Schmidt norm. For this reason, + * the value of the reference scalar \a other should come from the Hilbert-Schmidt norm + * of a reference matrix of same dimensions. + * + * \sa isApprox(), isMuchSmallerThan(const DenseBase&, RealScalar) const + */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( + const typename NumTraits::Real& other, + const RealScalar& prec +) const +{ + return internal::isMuchSmallerThan_scalar_selector::run(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 using the Hilbert-Schmidt norm. + * + * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( + const DenseBase& other, + const RealScalar& prec +) const +{ + return internal::isMuchSmallerThan_object_selector::run(derived(), other.derived(), prec); +} + +} // end namespace Eigen + +#endif // EIGEN_FUZZY_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/GeneralProduct.h b/lib/eigen-3.4.0/Eigen/src/Core/GeneralProduct.h new file mode 100644 index 0000000..6906aa7 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/GeneralProduct.h @@ -0,0 +1,465 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GENERAL_PRODUCT_H +#define EIGEN_GENERAL_PRODUCT_H + +namespace Eigen { + +enum { + Large = 2, + Small = 3 +}; + +// Define the threshold value to fallback from the generic matrix-matrix product +// implementation (heavy) to the lightweight coeff-based product one. +// See generic_product_impl +// in products/GeneralMatrixMatrix.h for more details. +// TODO This threshold should also be used in the compile-time selector below. +#ifndef EIGEN_GEMM_TO_COEFFBASED_THRESHOLD +// This default value has been obtained on a Haswell architecture. +#define EIGEN_GEMM_TO_COEFFBASED_THRESHOLD 20 +#endif + +namespace internal { + +template struct product_type_selector; + +template struct product_size_category +{ + enum { + #ifndef EIGEN_GPU_COMPILE_PHASE + is_large = MaxSize == Dynamic || + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD || + (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD), + #else + is_large = 0, + #endif + value = is_large ? Large + : Size == 1 ? 1 + : Small + }; +}; + +template struct product_type +{ + typedef typename remove_all::type _Lhs; + typedef typename remove_all::type _Rhs; + enum { + MaxRows = traits<_Lhs>::MaxRowsAtCompileTime, + Rows = traits<_Lhs>::RowsAtCompileTime, + MaxCols = traits<_Rhs>::MaxColsAtCompileTime, + Cols = traits<_Rhs>::ColsAtCompileTime, + MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::MaxColsAtCompileTime, + traits<_Rhs>::MaxRowsAtCompileTime), + Depth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::ColsAtCompileTime, + traits<_Rhs>::RowsAtCompileTime) + }; + + // the splitting into different lines of code here, introducing the _select enums and the typedef below, + // is to work around an internal compiler error with gcc 4.1 and 4.2. +private: + enum { + rows_select = product_size_category::value, + cols_select = product_size_category::value, + depth_select = product_size_category::value + }; + typedef product_type_selector selector; + +public: + enum { + value = selector::ret, + ret = selector::ret + }; +#ifdef EIGEN_DEBUG_PRODUCT + static void debug() + { + EIGEN_DEBUG_VAR(Rows); + EIGEN_DEBUG_VAR(Cols); + EIGEN_DEBUG_VAR(Depth); + EIGEN_DEBUG_VAR(rows_select); + EIGEN_DEBUG_VAR(cols_select); + EIGEN_DEBUG_VAR(depth_select); + EIGEN_DEBUG_VAR(value); + } +#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 struct product_type_selector { enum { ret = OuterProduct }; }; +template struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, N, 1> { enum { ret = LazyCoeffBasedProductMode }; }; +template 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 { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { 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 { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemvProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; + +} // end namespace internal + +/*********************************************************************** +* Implementation of Inner Vector Vector Product +***********************************************************************/ + +// FIXME : maybe the "inner product" could return a Scalar +// instead of a 1x1 matrix ?? +// Pro: more natural for the user +// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix +// product ends up to a row-vector times col-vector product... To tackle this use +// case, we could have a specialization for Block with: operator=(Scalar x); + +/*********************************************************************** +* Implementation of Outer Vector Vector Product +***********************************************************************/ + +/*********************************************************************** +* Implementation of General Matrix Vector Product +***********************************************************************/ + +/* According to the shape/flags of the matrix we have to distinghish 3 different cases: + * 1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine + * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine + * 3 - all other cases are handled using a simple loop along the outer-storage direction. + * 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 +struct gemv_dense_selector; + +} // end namespace internal + +namespace internal { + +template struct gemv_static_vector_if; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } +}; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { return 0; } +}; + +template +struct gemv_static_vector_if +{ + enum { + ForceAlignment = internal::packet_traits::Vectorizable, + PacketSize = internal::packet_traits::size + }; + #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { + return ForceAlignment + ? reinterpret_cast((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) + : m_data.array; + } + #endif +}; + +// The vector is on the left => transposition +template +struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + Transpose destT(dest); + enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; + gemv_dense_selector + ::run(rhs.transpose(), lhs.transpose(), destT, alpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + typedef typename Dest::RealScalar RealScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + + typedef Map, EIGEN_PLAIN_ENUM_MIN(AlignedMax,internal::packet_traits::size)> MappedDest; + + ActualLhsType actualLhs = LhsBlasTraits::extract(lhs); + ActualRhsType actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); + + // make sure Dest is a compile-time vector type (bug 1166) + typedef typename conditional::type ActualDest; + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1), + ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), + MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime!=0) + }; + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + RhsScalar compatibleAlpha = get_factor::run(actualAlpha); + + if(!MightCannotUseDest) + { + // shortcut if we are sure to be able to use dest directly, + // this ease the compiler to generate cleaner and more optimzized code for most common cases + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + dest.data(), 1, + compatibleAlpha); + } + else + { + gemv_static_vector_if static_dest; + + const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); + const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = dest.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + if(!alphaIsCompatible) + { + MappedDest(actualDestPtr, dest.size()).setZero(); + compatibleAlpha = RhsScalar(1); + } + else + MappedDest(actualDestPtr, dest.size()) = dest; + } + + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + actualDestPtr, 1, + compatibleAlpha); + + if (!evalToDest) + { + if(!alphaIsCompatible) + dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); + else + dest = MappedDest(actualDestPtr, dest.size()); + } + } + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + typedef typename internal::remove_all::type ActualRhsTypeCleaned; + + typename add_const::type actualLhs = LhsBlasTraits::extract(lhs); + typename add_const::type actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime==0 + }; + + gemv_static_vector_if static_rhs; + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = actualRhs.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + Map(actualRhsPtr, actualRhs.size()) = actualRhs; + } + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhsPtr, 1), + dest.data(), dest.col(0).innerStride(), //NOTE if dest is not a vector at compile-time, then dest.innerStride() might be wrong. (bug 1166) + actualAlpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp + typename nested_eval::type actual_rhs(rhs); + const Index size = rhs.rows(); + for(Index k=0; k struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + typename nested_eval::type actual_rhs(rhs); + const Index rows = dest.rows(); + for(Index i=0; i +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product +MatrixBase::operator*(const MatrixBase &other) const +{ + // A note regarding the function declaration: In MSVC, this function will sometimes + // 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 { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + 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 + internal::product_type::debug(); +#endif + + return Product(derived(), other.derived()); +} + +/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. + * + * The returned product will behave like any other expressions: the coefficients of the product will be + * computed once at a time as requested. This might be useful in some extremely rare cases when only + * a small and no coherent fraction of the result's coefficients have to be computed. + * + * \warning This version of the matrix product can be much much slower. So use it only if you know + * what you are doing and that you measured a true speed improvement. + * + * \sa operator*(const MatrixBase&) + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product +MatrixBase::lazyProduct(const MatrixBase &other) const +{ + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) + + return Product(derived(), other.derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/GenericPacketMath.h b/lib/eigen-3.4.0/Eigen/src/Core/GenericPacketMath.h new file mode 100644 index 0000000..cf677a1 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/GenericPacketMath.h @@ -0,0 +1,1040 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GENERIC_PACKET_MATH_H +#define EIGEN_GENERIC_PACKET_MATH_H + +namespace Eigen { + +namespace internal { + +/** \internal + * \file GenericPacketMath.h + * + * Default implementation for types not supported by the vectorization. + * In practice these functions are provided to make easier the writing + * of generic vectorized code. + */ + +#ifndef EIGEN_DEBUG_ALIGNED_LOAD +#define EIGEN_DEBUG_ALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_LOAD +#define EIGEN_DEBUG_UNALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_ALIGNED_STORE +#define EIGEN_DEBUG_ALIGNED_STORE +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_STORE +#define EIGEN_DEBUG_UNALIGNED_STORE +#endif + +struct default_packet_traits +{ + enum { + HasHalfPacket = 0, + + HasAdd = 1, + HasSub = 1, + HasShift = 1, + HasMul = 1, + HasNegate = 1, + HasAbs = 1, + HasArg = 0, + HasAbs2 = 1, + HasAbsDiff = 0, + HasMin = 1, + HasMax = 1, + HasConj = 1, + HasSetLinear = 1, + HasBlend = 0, + // This flag is used to indicate whether packet comparison is supported. + // pcmp_eq, pcmp_lt and pcmp_le should be defined for it to be true. + HasCmp = 0, + + HasDiv = 0, + HasSqrt = 0, + HasRsqrt = 0, + HasExp = 0, + HasExpm1 = 0, + HasLog = 0, + HasLog1p = 0, + HasLog10 = 0, + HasPow = 0, + + HasSin = 0, + HasCos = 0, + HasTan = 0, + HasASin = 0, + HasACos = 0, + HasATan = 0, + HasSinh = 0, + HasCosh = 0, + HasTanh = 0, + HasLGamma = 0, + HasDiGamma = 0, + HasZeta = 0, + HasPolygamma = 0, + HasErf = 0, + HasErfc = 0, + HasNdtri = 0, + HasBessel = 0, + HasIGamma = 0, + HasIGammaDerA = 0, + HasGammaSampleDerAlpha = 0, + HasIGammac = 0, + HasBetaInc = 0, + + HasRound = 0, + HasRint = 0, + HasFloor = 0, + HasCeil = 0, + HasSign = 0 + }; +}; + +template struct packet_traits : default_packet_traits +{ + typedef T type; + typedef T half; + enum { + Vectorizable = 0, + size = 1, + AlignedOnScalar = 0, + HasHalfPacket = 0 + }; + enum { + HasAdd = 0, + HasSub = 0, + HasMul = 0, + HasNegate = 0, + HasAbs = 0, + HasAbs2 = 0, + HasMin = 0, + HasMax = 0, + HasConj = 0, + HasSetLinear = 0 + }; +}; + +template struct packet_traits : packet_traits { }; + +template struct unpacket_traits +{ + typedef T type; + typedef T half; + enum + { + size = 1, + alignment = 1, + vectorizable = false, + masked_load_available=false, + masked_store_available=false + }; +}; + +template struct unpacket_traits : unpacket_traits { }; + +template struct type_casting_traits { + enum { + VectorizedCast = 0, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + +/** \internal Wrapper to ensure that multiple packet types can map to the same + same underlying vector type. */ +template +struct eigen_packet_wrapper +{ + EIGEN_ALWAYS_INLINE operator T&() { return m_val; } + EIGEN_ALWAYS_INLINE operator const T&() const { return m_val; } + EIGEN_ALWAYS_INLINE eigen_packet_wrapper() {} + EIGEN_ALWAYS_INLINE eigen_packet_wrapper(const T &v) : m_val(v) {} + EIGEN_ALWAYS_INLINE eigen_packet_wrapper& operator=(const T &v) { + m_val = v; + return *this; + } + + T m_val; +}; + + +/** \internal A convenience utility for determining if the type is a scalar. + * This is used to enable some generic packet implementations. + */ +template +struct is_scalar { + typedef typename unpacket_traits::type Scalar; + enum { + value = internal::is_same::value + }; +}; + +/** \internal \returns static_cast(a) (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/, + const SrcPacket& /*e*/, const SrcPacket& /*f*/, const SrcPacket& /*g*/, const SrcPacket& /*h*/) { + return static_cast(a); +} + +/** \internal \returns reinterpret_cast(a) */ +template +EIGEN_DEVICE_FUNC inline Target +preinterpret(const Packet& a); /* { return reinterpret_cast(a); } */ + +/** \internal \returns a + b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +padd(const Packet& a, const Packet& b) { return a+b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +padd(const bool& a, const bool& b) { return a || b; } + +/** \internal \returns a - b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +psub(const Packet& a, const Packet& b) { return a-b; } + +/** \internal \returns -a (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pnegate(const Packet& a) { return -a; } + +template<> EIGEN_DEVICE_FUNC inline bool +pnegate(const bool& a) { return !a; } + +/** \internal \returns conj(a) (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pconj(const Packet& a) { return numext::conj(a); } + +/** \internal \returns a * b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmul(const Packet& a, const Packet& b) { return a*b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +pmul(const bool& a, const bool& b) { return a && b; } + +/** \internal \returns a / b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pdiv(const Packet& a, const Packet& b) { return a/b; } + +// In the generic case, memset to all one bits. +template +struct ptrue_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/){ + Packet b; + memset(static_cast(&b), 0xff, sizeof(Packet)); + return b; + } +}; + +// For non-trivial scalars, set to Scalar(1) (i.e. a non-zero value). +// Although this is technically not a valid bitmask, the scalar path for pselect +// uses a comparison to zero, so this should still work in most cases. We don't +// have another option, since the scalar type requires initialization. +template +struct ptrue_impl::value && NumTraits::RequireInitialization>::type > { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/){ + return T(1); + } +}; + +/** \internal \returns one bits. */ +template EIGEN_DEVICE_FUNC inline Packet +ptrue(const Packet& a) { + return ptrue_impl::run(a); +} + +// In the general case, memset to zero. +template +struct pzero_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/) { + Packet b; + memset(static_cast(&b), 0x00, sizeof(Packet)); + return b; + } +}; + +// For scalars, explicitly set to Scalar(0), since the underlying representation +// for zero may not consist of all-zero bits. +template +struct pzero_impl::value>::type> { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/) { + return T(0); + } +}; + +/** \internal \returns packet of zeros */ +template EIGEN_DEVICE_FUNC inline Packet +pzero(const Packet& a) { + return pzero_impl::run(a); +} + +/** \internal \returns a <= b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_le(const Packet& a, const Packet& b) { return a<=b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt(const Packet& a, const Packet& b) { return a EIGEN_DEVICE_FUNC inline Packet +pcmp_eq(const Packet& a, const Packet& b) { return a==b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b or a==NaN or b==NaN as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt_or_nan(const Packet& a, const Packet& b) { return a>=b ? pzero(a) : ptrue(a); } + +template +struct bit_and { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a & b; + } +}; + +template +struct bit_or { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a | b; + } +}; + +template +struct bit_xor { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a ^ b; + } +}; + +template +struct bit_not { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a) const { + return ~a; + } +}; + +// Use operators &, |, ^, ~. +template +struct operator_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { return bit_and()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { return bit_or()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { return bit_xor()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { return bit_not()(a); } +}; + +// Apply binary operations byte-by-byte +template +struct bytewise_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { + return binary(a, b, bit_and()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { + return binary(a, b, bit_or()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { + return binary(a, b, bit_xor()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { + return unary(a,bit_not()); + } + + private: + template + EIGEN_DEVICE_FUNC static inline T unary(const T& a, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++); + } + return c; + } + + template + EIGEN_DEVICE_FUNC static inline T binary(const T& a, const T& b, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + const unsigned char* b_ptr = reinterpret_cast(&b); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++, *b_ptr++); + } + return c; + } +}; + +// In the general case, use byte-by-byte manipulation. +template +struct bitwise_helper : public bytewise_bitwise_helper {}; + +// For integers or non-trivial scalars, use binary operators. +template +struct bitwise_helper::value && (NumTraits::IsInteger || NumTraits::RequireInitialization)>::type + > : public operator_bitwise_helper {}; + +/** \internal \returns the bitwise and of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pand(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_and(a, b); +} + +/** \internal \returns the bitwise or of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +por(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_or(a, b); +} + +/** \internal \returns the bitwise xor of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pxor(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_xor(a, b); +} + +/** \internal \returns the bitwise not of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pnot(const Packet& a) { + return bitwise_helper::bitwise_not(a); +} + +/** \internal \returns the bitwise and of \a a and not \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pandnot(const Packet& a, const Packet& b) { return pand(a, pnot(b)); } + +// In the general case, use bitwise select. +template +struct pselect_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return por(pand(a,mask),pandnot(b,mask)); + } +}; + +// For scalars, use ternary select. +template +struct pselect_impl::value>::type > { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return numext::equal_strict(mask, Packet(0)) ? b : a; + } +}; + +/** \internal \returns \a or \b for each field in packet according to \mask */ +template EIGEN_DEVICE_FUNC inline Packet +pselect(const Packet& mask, const Packet& a, const Packet& b) { + return pselect_impl::run(mask, a, b); +} + +template<> EIGEN_DEVICE_FUNC inline bool pselect( + const bool& cond, const bool& a, const bool& b) { + return cond ? a : b; +} + +/** \internal \returns the min or of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, the result is implementation defined. */ +template +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + return op(a,b); + } +}; + +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, NaN is returned. */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), b), + a); + } +}; + +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If both \a a and \a b are NaN, NaN is returned. + Equivalent to std::fmin(a, b). */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), a), + b); + } +}; + + +#ifndef SYCL_DEVICE_ONLY +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) Func +#else +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) \ +[](const Type& a, const Type& b) { \ + return Func(a, b);} +#endif + +/** \internal \returns the min of \a a and \a b (coeff-wise). + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmin(const Packet& a, const Packet& b) { return numext::mini(a,b); } + +/** \internal \returns the min of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet, (pmin))); +} + +/** \internal \returns the max of \a a and \a b (coeff-wise) + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmax(const Packet& a, const Packet& b) { return numext::maxi(a, b); } + +/** \internal \returns the max of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmax(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet,(pmax))); +} + +/** \internal \returns the absolute value of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pabs(const Packet& a) { return numext::abs(a); } +template<> EIGEN_DEVICE_FUNC inline unsigned int +pabs(const unsigned int& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long +pabs(const unsigned long& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long long +pabs(const unsigned long long& a) { return a; } + +/** \internal \returns the addsub value of \a a,b */ +template EIGEN_DEVICE_FUNC inline Packet +paddsub(const Packet& a, const Packet& b) { + return pselect(peven_mask(a), padd(a, b), psub(a, b)); + } + +/** \internal \returns the phase angle of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +parg(const Packet& a) { using numext::arg; return arg(a); } + + +/** \internal \returns \a a logically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +parithmetic_shift_right(const int& a) { return a >> N; } +template EIGEN_DEVICE_FUNC inline long int +parithmetic_shift_right(const long int& a) { return a >> N; } + +/** \internal \returns \a a arithmetically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_right(const int& a) { return static_cast(static_cast(a) >> N); } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_right(const long int& a) { return static_cast(static_cast(a) >> N); } + +/** \internal \returns \a a shifted by N bits to the left */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_left(const int& a) { return a << N; } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_left(const long int& a) { return a << N; } + +/** \internal \returns the significant and exponent of the underlying floating point numbers + * See https://en.cppreference.com/w/cpp/numeric/math/frexp + */ +template +EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { + int exp; + EIGEN_USING_STD(frexp); + Packet result = static_cast(frexp(a, &exp)); + exponent = static_cast(exp); + return result; +} + +/** \internal \returns a * 2^((int)exponent) + * See https://en.cppreference.com/w/cpp/numeric/math/ldexp + */ +template EIGEN_DEVICE_FUNC inline Packet +pldexp(const Packet &a, const Packet &exponent) { + EIGEN_USING_STD(ldexp) + return static_cast(ldexp(a, static_cast(exponent))); +} + +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pabsdiff(const Packet& a, const Packet& b) { return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b)); } + +/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ +template EIGEN_DEVICE_FUNC inline Packet +pload(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet version of \a *from, (un-aligned load) */ +template EIGEN_DEVICE_FUNC inline Packet +ploadu(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet version of \a *from, (un-aligned masked load) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template EIGEN_DEVICE_FUNC inline +typename enable_if::masked_load_available, Packet>::type +ploadu(const typename unpacket_traits::type* from, typename unpacket_traits::mask_t umask); + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */ +template EIGEN_DEVICE_FUNC inline Packet +pset1(const typename unpacket_traits::type& a) { return a; } + +/** \internal \returns a packet with constant coefficients set from bits */ +template EIGEN_DEVICE_FUNC inline Packet +pset1frombits(BitsType a); + +/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */ +template EIGEN_DEVICE_FUNC inline Packet +pload1(const typename unpacket_traits::type *a) { return pset1(*a); } + +/** \internal \returns a packet with elements of \a *from duplicated. + * For instance, for a packet of 8 elements, 4 scalars will be read from \a *from and + * duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]} + * Currently, this function is only used for scalar * complex products. + */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +ploaddup(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with elements of \a *from quadrupled. + * For instance, for a packet of 8 elements, 2 scalars will be read from \a *from and + * replicated to form: {from[0],from[0],from[0],from[0],from[1],from[1],from[1],from[1]} + * Currently, this function is only used in matrix products. + * For packet-size smaller or equal to 4, this function is equivalent to pload1 + */ +template EIGEN_DEVICE_FUNC inline Packet +ploadquad(const typename unpacket_traits::type* from) +{ return pload1(from); } + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * a2 = pload1(a+2); + * a3 = pload1(a+3); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast2 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast4(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1, Packet& a2, Packet& a3) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); + a2 = pload1(a+2); + a3 = pload1(a+3); +} + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast4 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast2(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); +} + +/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +plset(const typename unpacket_traits::type& a) { return a; } + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (x, 0, x, 0), + where x is the value of all 1-bits. */ +template EIGEN_DEVICE_FUNC inline Packet +peven_mask(const Packet& /*a*/) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + for(size_t i = 0; i < n; ++i) { + memset(elements+i, ((i & 1) == 0 ? 0xff : 0), sizeof(Scalar)); + } + return ploadu(elements); +} + + +/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ +template EIGEN_DEVICE_FUNC inline void pstore(Scalar* to, const Packet& from) +{ (*to) = from; } + +/** \internal copy the packet \a from to \a *to, (un-aligned store) */ +template EIGEN_DEVICE_FUNC inline void pstoreu(Scalar* to, const Packet& from) +{ (*to) = from; } + +/** \internal copy the packet \a from to \a *to, (un-aligned store with a mask) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template +EIGEN_DEVICE_FUNC inline +typename enable_if::masked_store_available, void>::type +pstoreu(Scalar* to, const Packet& from, typename unpacket_traits::mask_t umask); + + template EIGEN_DEVICE_FUNC inline Packet pgather(const Scalar* from, Index /*stride*/) + { return ploadu(from); } + + template EIGEN_DEVICE_FUNC inline void pscatter(Scalar* to, const Packet& from, Index /*stride*/) + { pstore(to, from); } + +/** \internal tries to do cache prefetching of \a addr */ +template EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr) +{ +#if defined(EIGEN_HIP_DEVICE_COMPILE) + // do nothing +#elif defined(EIGEN_CUDA_ARCH) +#if defined(__LP64__) || EIGEN_OS_WIN64 + // 64-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr)); +#else + // 32-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=r"(addr) : "r"(addr)); +#endif +#elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC) + __builtin_prefetch(addr); +#endif +} + +/** \internal \returns the reversed elements of \a a*/ +template EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a) +{ return a; } + +/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ +template EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a) +{ + return Packet(numext::imag(a),numext::real(a)); +} + +/************************** +* Special math functions +***************************/ + +/** \internal \returns the sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psin(const Packet& a) { EIGEN_USING_STD(sin); return sin(a); } + +/** \internal \returns the cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcos(const Packet& a) { EIGEN_USING_STD(cos); return cos(a); } + +/** \internal \returns the tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptan(const Packet& a) { EIGEN_USING_STD(tan); return tan(a); } + +/** \internal \returns the arc sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pasin(const Packet& a) { EIGEN_USING_STD(asin); return asin(a); } + +/** \internal \returns the arc cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pacos(const Packet& a) { EIGEN_USING_STD(acos); return acos(a); } + +/** \internal \returns the arc tangent of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet patan(const Packet& a) { EIGEN_USING_STD(atan); return atan(a); } + +/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psinh(const Packet& a) { EIGEN_USING_STD(sinh); return sinh(a); } + +/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcosh(const Packet& a) { EIGEN_USING_STD(cosh); return cosh(a); } + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptanh(const Packet& a) { EIGEN_USING_STD(tanh); return tanh(a); } + +/** \internal \returns the exp of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexp(const Packet& a) { EIGEN_USING_STD(exp); return exp(a); } + +/** \internal \returns the expm1 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexpm1(const Packet& a) { return numext::expm1(a); } + +/** \internal \returns the log of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog(const Packet& a) { EIGEN_USING_STD(log); return log(a); } + +/** \internal \returns the log1p of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog1p(const Packet& a) { return numext::log1p(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog2(const Packet& a) { + typedef typename internal::unpacket_traits::type Scalar; + return pmul(pset1(Scalar(EIGEN_LOG2E)), plog(a)); +} + +/** \internal \returns the square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psqrt(const Packet& a) { return numext::sqrt(a); } + +/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet prsqrt(const Packet& a) { + typedef typename internal::unpacket_traits::type Scalar; + return pdiv(pset1(Scalar(1)), psqrt(a)); +} + +/** \internal \returns the rounded value of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pround(const Packet& a) { using numext::round; return round(a); } + +/** \internal \returns the floor of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pfloor(const Packet& a) { using numext::floor; return floor(a); } + +/** \internal \returns the rounded value of \a a (coeff-wise) with current + * rounding mode */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet print(const Packet& a) { using numext::rint; return rint(a); } + +/** \internal \returns the ceil of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); } + +/** \internal \returns the first element of a packet */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +pfirst(const Packet& a) +{ return a; } + +/** \internal \returns the sum of the elements of upper and lower half of \a a if \a a is larger than 4. + * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7} + * For packet-size smaller or equal to 4, this boils down to a noop. + */ +template +EIGEN_DEVICE_FUNC inline typename conditional<(unpacket_traits::size%8)==0,typename unpacket_traits::half,Packet>::type +predux_half_dowto4(const Packet& a) +{ return a; } + +// Slow generic implementation of Packet reduction. +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux_helper(const Packet& a, Op op) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + pstoreu(elements, a); + for(size_t k = n / 2; k > 0; k /= 2) { + for(size_t i = 0; i < k; ++i) { + elements[i] = op(elements[i], elements[i + k]); + } + } + return elements[0]; +} + +/** \internal \returns the sum of the elements of \a a*/ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux(const Packet& a) +{ + return a; +} + +/** \internal \returns the product of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_mul( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmul))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +#undef EIGEN_BINARY_OP_NAN_PROPAGATION + +/** \internal \returns true if all coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +// not needed yet +// template EIGEN_DEVICE_FUNC inline bool predux_all(const Packet& a) +// { return bool(a); } + +/** \internal \returns true if any coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +template EIGEN_DEVICE_FUNC inline bool predux_any(const Packet& a) +{ + // Dirty but generic implementation where "true" is assumed to be non 0 and all the sames. + // It is expected that "true" is either: + // - Scalar(1) + // - bits full of ones (NaN for floats), + // - or first bit equals to 1 (1 for ints, smallest denormal for floats). + // For all these cases, taking the sum is just fine, and this boils down to a no-op for scalars. + typedef typename unpacket_traits::type Scalar; + return numext::not_equal_strict(predux(a), Scalar(0)); +} + +/*************************************************************************** +* The following functions might not have to be overwritten for vectorized types +***************************************************************************/ + +/** \internal copy a packet with constant coefficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ +// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type) +template +inline void pstore1(typename unpacket_traits::type* to, const typename unpacket_traits::type& a) +{ + pstore(to, pset1(a)); +} + +/** \internal \returns a * b + c (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmadd(const Packet& a, + const Packet& b, + const Packet& c) +{ return padd(pmul(a, b),c); } + +/** \internal \returns a packet version of \a *from. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt(const typename unpacket_traits::type* from) +{ + if(Alignment >= unpacket_traits::alignment) + return pload(from); + else + return ploadu(from); +} + +/** \internal copy the packet \a from to \a *to. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& from) +{ + if(Alignment >= unpacket_traits::alignment) + pstore(to, from); + else + pstoreu(to, from); +} + +/** \internal \returns a packet version of \a *from. + * Unlike ploadt, ploadt_ro takes advantage of the read-only memory path on the + * hardware if available to speedup the loading of data that won't be modified + * by the current computation. + */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits::type* from) +{ + return ploadt(from); +} + +/*************************************************************************** +* Fast complex products (GCC generates a function call which is very slow) +***************************************************************************/ + +// Eigen+CUDA does not support complexes. +#if !defined(EIGEN_GPUCC) + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } + +#endif + + +/*************************************************************************** + * PacketBlock, that is a collection of N packets where the number of words + * in the packet is a multiple of N. +***************************************************************************/ +template ::size> struct PacketBlock { + Packet packet[N]; +}; + +template EIGEN_DEVICE_FUNC inline void +ptranspose(PacketBlock& /*kernel*/) { + // Nothing to do in the scalar case, i.e. a 1x1 matrix. +} + +/*************************************************************************** + * Selector, i.e. vector of N boolean values used to select (i.e. blend) + * words from 2 packets. +***************************************************************************/ +template struct Selector { + bool select[N]; +}; + +template EIGEN_DEVICE_FUNC inline Packet +pblend(const Selector::size>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) { + return ifPacket.select[0] ? thenPacket : elsePacket; +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_GENERIC_PACKET_MATH_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/GlobalFunctions.h b/lib/eigen-3.4.0/Eigen/src/Core/GlobalFunctions.h new file mode 100644 index 0000000..629af94 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/GlobalFunctions.h @@ -0,0 +1,194 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2016 Gael Guennebaud +// Copyright (C) 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GLOBAL_FUNCTIONS_H +#define EIGEN_GLOBAL_FUNCTIONS_H + +#ifdef EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + /** \returns an expression of the coefficient-wise DOC_OP of \a x + + DOC_DETAILS + + \sa Math functions, class CwiseUnaryOp + */ \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + NAME(const Eigen::ArrayBase& x); + +#else + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + (NAME)(const Eigen::ArrayBase& x) { \ + return Eigen::CwiseUnaryOp, const Derived>(x.derived()); \ + } + +#endif // EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ + \ + template \ + struct NAME##_retval > \ + { \ + typedef const Eigen::CwiseUnaryOp, const Derived> type; \ + }; \ + template \ + struct NAME##_impl > \ + { \ + static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ + { \ + return typename NAME##_retval >::type(x.derived()); \ + } \ + }; + +namespace Eigen +{ + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op,real part,\sa ArrayBase::real) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op,imaginary part,\sa ArrayBase::imag) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op,complex conjugate,\sa ArrayBase::conjugate) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(inverse,scalar_inverse_op,inverse,\sa ArrayBase::inverse) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op,sine,\sa ArrayBase::sin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op,cosine,\sa ArrayBase::cos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op,tangent,\sa ArrayBase::tan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atan,scalar_atan_op,arc-tangent,\sa ArrayBase::atan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op,arc-sine,\sa ArrayBase::asin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op,arc-consine,\sa ArrayBase::acos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh) +#if EIGEN_HAS_CXX11_MATH + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asinh,scalar_asinh_op,inverse hyperbolic sine,\sa ArrayBase::asinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acosh,scalar_acosh_op,inverse hyperbolic cosine,\sa ArrayBase::acosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atanh,scalar_atanh_op,inverse hyperbolic tangent,\sa ArrayBase::atanh) +#endif + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(logistic,scalar_logistic_op,logistic function,\sa ArrayBase::logistic) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op,complement error function,\sa ArrayBase::erfc) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ndtri,scalar_ndtri_op,inverse normal distribution function,\sa ArrayBase::ndtri) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op,exponential,\sa ArrayBase::exp) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(expm1,scalar_expm1_op,exponential of a value minus 1,\sa ArrayBase::expm1) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op,natural logarithm,\sa Eigen::log10 DOXCOMMA ArrayBase::log) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa ArrayBase::log1p) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op,base 10 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log10) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log2,scalar_log2_op,base 2 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op,absolute value,\sa ArrayBase::abs DOXCOMMA MatrixBase::cwiseAbs) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs2,scalar_abs2_op,squared absolute value,\sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(arg,scalar_arg_op,complex argument,\sa ArrayBase::arg DOXCOMMA MatrixBase::cwiseArg) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op,square root,\sa ArrayBase::sqrt DOXCOMMA MatrixBase::cwiseSqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rsqrt,scalar_rsqrt_op,reciprocal square root,\sa ArrayBase::rsqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(square,scalar_square_op,square (power 2),\sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cube,scalar_cube_op,cube (power 3),\sa Eigen::pow DOXCOMMA ArrayBase::cube) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rint,scalar_rint_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op,nearest integer not greater than the giben value,\sa Eigen::ceil DOXCOMMA ArrayBase::floor) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op,nearest integer not less than the giben value,\sa Eigen::floor DOXCOMMA ArrayBase::ceil) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op,not-a-number test,\sa Eigen::isinf DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isnan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op,infinite value test,\sa Eigen::isnan DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isinf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op,finite value test,\sa Eigen::isinf DOXCOMMA Eigen::isnan DOXCOMMA ArrayBase::isfinite) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sign,scalar_sign_op,sign (or 0),\sa ArrayBase::sign) + + /** \returns an expression of the coefficient-wise power of \a x to the given constant \a exponent. + * + * \tparam ScalarExponent is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression (\c Derived::Scalar). + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Derived,Constant > + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent); +#else + template + EIGEN_DEVICE_FUNC inline + EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE( + const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg::type,pow)) + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent) + { + typedef typename internal::promote_scalar_arg::type PromotedExponent; + return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedExponent,pow)(x.derived(), + typename internal::plain_constant_type::type(x.derived().rows(), x.derived().cols(), internal::scalar_constant_op(exponent))); + } +#endif + + /** \returns an expression of the coefficient-wise power of \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power. + * + * Example: \include Cwise_array_power_array.cpp + * Output: \verbinclude Cwise_array_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ + template + inline const Eigen::CwiseBinaryOp, const Derived, const ExponentDerived> + pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents) + { + return Eigen::CwiseBinaryOp, const Derived, const ExponentDerived>( + x.derived(), + exponents.derived() + ); + } + + /** \returns an expression of the coefficient-wise power of the scalar \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power between a scalar and an array of exponents. + * + * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar). + * + * Example: \include Cwise_scalar_power_array.cpp + * Output: \verbinclude Cwise_scalar_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Constant,Derived> + pow(const Scalar& x,const Eigen::ArrayBase& x); +#else + template + EIGEN_DEVICE_FUNC inline + EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE( + const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg::type,Derived,pow)) + pow(const Scalar& x, const Eigen::ArrayBase& exponents) { + typedef typename internal::promote_scalar_arg::type PromotedScalar; + return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedScalar,Derived,pow)( + typename internal::plain_constant_type::type(exponents.derived().rows(), exponents.derived().cols(), internal::scalar_constant_op(x)), exponents.derived()); + } +#endif + + + 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(abs2,scalar_abs2_op) + } +} + +// TODO: cleanly disable those functions that are not supported on Array (numext::real_ref, internal::random, internal::isApprox...) + +#endif // EIGEN_GLOBAL_FUNCTIONS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/IO.h b/lib/eigen-3.4.0/Eigen/src/Core/IO.h new file mode 100644 index 0000000..e81c315 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/IO.h @@ -0,0 +1,258 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_IO_H +#define EIGEN_IO_H + +namespace Eigen { + +enum { DontAlignCols = 1 }; +enum { StreamPrecision = -1, + FullPrecision = -2 }; + +namespace internal { +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt); +} + +/** \class IOFormat + * \ingroup Core_Module + * + * \brief Stores a set of parameters controlling the way matrices are printed + * + * List of available parameters: + * - \b precision number of digits for floating point values, or one of the special constants \c StreamPrecision and \c FullPrecision. + * The default is the special value \c StreamPrecision which means to use the + * stream's own precision setting, as set for instance using \c cout.precision(3). The other special value + * \c FullPrecision means that the number of digits will be computed to match the full precision of each floating-point + * type. + * - \b flags an OR-ed combination of flags, the default value is 0, the only currently available flag is \c DontAlignCols which + * allows to disable the alignment of columns, resulting in faster code. + * - \b coeffSeparator string printed between two coefficients of the same row + * - \b rowSeparator string printed between two rows + * - \b rowPrefix string printed at the beginning of each row + * - \b rowSuffix string printed at the end of each row + * - \b matPrefix string printed at the beginning of the matrix + * - \b matSuffix string printed at the end of the matrix + * - \b fill character printed to fill the empty space in aligned columns + * + * Example: \include IOFormat.cpp + * Output: \verbinclude IOFormat.out + * + * \sa DenseBase::format(), class WithFormat + */ +struct IOFormat +{ + /** Default constructor, see class IOFormat for the meaning of the parameters */ + IOFormat(int _precision = StreamPrecision, int _flags = 0, + const std::string& _coeffSeparator = " ", + const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", + const std::string& _matPrefix="", const std::string& _matSuffix="", const char _fill=' ') + : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), + rowSpacer(""), coeffSeparator(_coeffSeparator), fill(_fill), precision(_precision), flags(_flags) + { + // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline + // don't add rowSpacer if columns are not to be aligned + if((flags & DontAlignCols)) + return; + int i = int(matSuffix.length())-1; + while (i>=0 && matSuffix[i]!='\n') + { + rowSpacer += ' '; + i--; + } + } + std::string matPrefix, matSuffix; + std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; + std::string coeffSeparator; + char fill; + int precision; + int flags; +}; + +/** \class WithFormat + * \ingroup Core_Module + * + * \brief Pseudo expression providing matrix output with given format + * + * \tparam ExpressionType the type of the object on which IO stream operations are performed + * + * This class represents an expression with stream operators controlled by a given IOFormat. + * It is the return type of DenseBase::format() + * and most of the time this is the only way it is used. + * + * See class IOFormat for some examples. + * + * \sa DenseBase::format(), class IOFormat + */ +template +class WithFormat +{ + public: + + WithFormat(const ExpressionType& matrix, const IOFormat& format) + : m_matrix(matrix), m_format(format) + {} + + friend std::ostream & operator << (std::ostream & s, const WithFormat& wf) + { + return internal::print_matrix(s, wf.m_matrix.eval(), wf.m_format); + } + + protected: + typename ExpressionType::Nested m_matrix; + IOFormat m_format; +}; + +namespace internal { + +// NOTE: This helper is kept for backward compatibility with previous code specializing +// this internal::significant_decimals_impl structure. In the future we should directly +// call digits10() which has been introduced in July 2016 in 3.3. +template +struct significant_decimals_impl +{ + static inline int run() + { + return NumTraits::digits10(); + } +}; + +/** \internal + * print the matrix \a _m to the output stream \a s using the output format \a fmt */ +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt) +{ + using internal::is_same; + using internal::conditional; + + if(_m.size() == 0) + { + s << fmt.matPrefix << fmt.matSuffix; + return s; + } + + typename Derived::Nested m = _m; + typedef typename Derived::Scalar Scalar; + typedef typename + conditional< + is_same::value || + is_same::value || + is_same::value || + is_same::value, + int, + typename conditional< + is_same >::value || + is_same >::value || + is_same >::value || + is_same >::value, + std::complex, + const Scalar& + >::type + >::type PrintType; + + Index width = 0; + + std::streamsize explicit_precision; + if(fmt.precision == StreamPrecision) + { + explicit_precision = 0; + } + else if(fmt.precision == FullPrecision) + { + if (NumTraits::IsInteger) + { + explicit_precision = 0; + } + else + { + explicit_precision = significant_decimals_impl::run(); + } + } + else + { + explicit_precision = fmt.precision; + } + + std::streamsize old_precision = 0; + if(explicit_precision) old_precision = s.precision(explicit_precision); + + bool align_cols = !(fmt.flags & DontAlignCols); + if(align_cols) + { + // compute the largest width + for(Index j = 0; j < m.cols(); ++j) + for(Index i = 0; i < m.rows(); ++i) + { + std::stringstream sstr; + sstr.copyfmt(s); + sstr << static_cast(m.coeff(i,j)); + width = std::max(width, Index(sstr.str().length())); + } + } + std::streamsize old_width = s.width(); + char old_fill_character = s.fill(); + s << fmt.matPrefix; + for(Index i = 0; i < m.rows(); ++i) + { + if (i) + s << fmt.rowSpacer; + s << fmt.rowPrefix; + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, 0)); + for(Index j = 1; j < m.cols(); ++j) + { + s << fmt.coeffSeparator; + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, j)); + } + s << fmt.rowSuffix; + if( i < m.rows() - 1) + s << fmt.rowSeparator; + } + s << fmt.matSuffix; + if(explicit_precision) s.precision(old_precision); + if(width) { + s.fill(old_fill_character); + s.width(old_width); + } + return s; +} + +} // end namespace internal + +/** \relates DenseBase + * + * Outputs the matrix, to the given stream. + * + * If you wish to print the matrix with a format different than the default, use DenseBase::format(). + * + * It is also possible to change the default format by defining EIGEN_DEFAULT_IO_FORMAT before including Eigen headers. + * If not defined, this will automatically be defined to Eigen::IOFormat(), that is the Eigen::IOFormat with default parameters. + * + * \sa DenseBase::format() + */ +template +std::ostream & operator << +(std::ostream & s, + const DenseBase & m) +{ + return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT); +} + +} // end namespace Eigen + +#endif // EIGEN_IO_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/IndexedView.h b/lib/eigen-3.4.0/Eigen/src/Core/IndexedView.h new file mode 100644 index 0000000..0847625 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/IndexedView.h @@ -0,0 +1,237 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INDEXED_VIEW_H +#define EIGEN_INDEXED_VIEW_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : traits +{ + enum { + RowsAtCompileTime = int(array_size::value), + ColsAtCompileTime = int(array_size::value), + MaxRowsAtCompileTime = RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : Dynamic, + MaxColsAtCompileTime = ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : Dynamic, + + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : XprTypeIsRowMajor, + + RowIncr = int(get_compile_time_incr::value), + ColIncr = int(get_compile_time_incr::value), + InnerIncr = IsRowMajor ? ColIncr : RowIncr, + OuterIncr = IsRowMajor ? RowIncr : ColIncr, + + HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), + XprInnerStride = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time::ret) : int(outer_stride_at_compile_time::ret), + XprOuterstride = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time::ret) : int(inner_stride_at_compile_time::ret), + + InnerSize = XprTypeIsRowMajor ? ColsAtCompileTime : RowsAtCompileTime, + IsBlockAlike = InnerIncr==1 && OuterIncr==1, + IsInnerPannel = HasSameStorageOrderAsXprType && is_same,typename conditional::type>::value, + + InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic ? Dynamic : XprInnerStride * InnerIncr, + OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic ? Dynamic : XprOuterstride * OuterIncr, + + ReturnAsScalar = is_same::value && is_same::value, + ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike, + ReturnAsIndexedView = (!ReturnAsScalar) && (!ReturnAsBlock), + + // FIXME we deal with compile-time strides if and only if we have DirectAccessBit flag, + // but this is too strict regarding negative strides... + DirectAccessMask = (int(InnerIncr)!=UndefinedIncr && int(OuterIncr)!=UndefinedIncr && InnerIncr>=0 && OuterIncr>=0) ? DirectAccessBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + Flags = (traits::Flags & (HereditaryBits | DirectAccessMask )) | FlagsLvalueBit | FlagsRowMajorBit | FlagsLinearAccessBit + }; + + typedef Block BlockType; +}; + +} + +template +class IndexedViewImpl; + + +/** \class IndexedView + * \ingroup Core_Module + * + * \brief Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices + * + * \tparam XprType the type of the expression in which we are taking the intersections of sub-rows and sub-columns + * \tparam RowIndices the type of the object defining the sequence of row indices + * \tparam ColIndices the type of the object defining the sequence of column indices + * + * This class represents an expression of a sub-matrix (or sub-vector) defined as the intersection + * of sub-sets of rows and columns, that are themself defined by generic sequences of row indices \f$ \{r_0,r_1,..r_{m-1}\} \f$ + * and column indices \f$ \{c_0,c_1,..c_{n-1} \}\f$. Let \f$ A \f$ be the nested matrix, then the resulting matrix \f$ B \f$ has \c m + * rows and \c n columns, and its entries are given by: \f$ B(i,j) = A(r_i,c_j) \f$. + * + * The \c RowIndices and \c ColIndices types must be compatible with the following API: + * \code + * operator[](Index) const; + * Index size() const; + * \endcode + * + * Typical supported types thus include: + * - std::vector + * - std::valarray + * - std::array + * - Plain C arrays: int[N] + * - Eigen::ArrayXi + * - decltype(ArrayXi::LinSpaced(...)) + * - Any view/expressions of the previous types + * - Eigen::ArithmeticSequence + * - Eigen::internal::AllRange (helper for Eigen::all) + * - Eigen::internal::SingleRange (helper for single index) + * - etc. + * + * In typical usages of %Eigen, this class should never be used directly. It is the return type of + * DenseBase::operator()(const RowIndices&, const ColIndices&). + * + * \sa class Block + */ +template +class IndexedView : public IndexedViewImpl::StorageKind> +{ +public: + typedef typename IndexedViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(IndexedView) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(IndexedView) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + template + IndexedView(XprType& xpr, const T0& rowIndices, const T1& colIndices) + : m_xpr(xpr), m_rowIndices(rowIndices), m_colIndices(colIndices) + {} + + /** \returns number of rows */ + Index rows() const { return internal::size(m_rowIndices); } + + /** \returns number of columns */ + Index cols() const { return internal::size(m_colIndices); } + + /** \returns the nested expression */ + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + typename internal::remove_reference::type& + nestedExpression() { return m_xpr; } + + /** \returns a const reference to the object storing/generating the row indices */ + const RowIndices& rowIndices() const { return m_rowIndices; } + + /** \returns a const reference to the object storing/generating the column indices */ + const ColIndices& colIndices() const { return m_colIndices; } + +protected: + MatrixTypeNested m_xpr; + RowIndices m_rowIndices; + ColIndices m_colIndices; +}; + + +// Generic API dispatcher +template +class IndexedViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +namespace internal { + + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef IndexedView XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of row/col index */, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1) ? LinearAccessBit : 0, + + FlagsRowMajorBit = traits::FlagsRowMajorBit, + + Flags = (evaluator::Flags & (HereditaryBits & ~RowMajorBit /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit | FlagsRowMajorBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar& coeffRef(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeff( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INDEXED_VIEW_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Inverse.h b/lib/eigen-3.4.0/Eigen/src/Core/Inverse.h new file mode 100644 index 0000000..c514438 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Inverse.h @@ -0,0 +1,117 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014-2019 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INVERSE_H +#define EIGEN_INVERSE_H + +namespace Eigen { + +template class InverseImpl; + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename XprType::PlainObject PlainObject; + typedef traits BaseTraits; + enum { + Flags = BaseTraits::Flags & RowMajorBit + }; +}; + +} // end namespace internal + +/** \class Inverse + * + * \brief Expression of the inverse of another expression + * + * \tparam XprType the type of the expression we are taking the inverse + * + * This class represents an abstract expression of A.inverse() + * and most of the time this is the only way it is used. + * + */ +template +class Inverse : public InverseImpl::StorageKind> +{ +public: + typedef typename XprType::StorageIndex StorageIndex; + typedef typename XprType::Scalar Scalar; + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type XprTypeNestedCleaned; + typedef typename internal::ref_selector::type Nested; + typedef typename internal::remove_all::type NestedExpression; + + explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) + : m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + + EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } + +protected: + XprTypeNested m_xpr; +}; + +// Generic API dispatcher +template +class InverseImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; + typedef typename XprType::Scalar Scalar; +private: + + Scalar coeff(Index row, Index col) const; + Scalar coeff(Index i) const; +}; + +namespace internal { + +/** \internal + * \brief Default evaluator for Inverse expression. + * + * This default evaluator for Inverse expression simply evaluate the inverse into a temporary + * by a call to internal::call_assignment_no_alias. + * Therefore, inverse implementers only have to specialize Assignment, ...> for + * there own nested expression. + * + * \sa class Inverse + */ +template +struct unary_evaluator > + : public evaluator::PlainObject> +{ + typedef Inverse InverseType; + typedef typename InverseType::PlainObject PlainObject; + typedef evaluator Base; + + enum { Flags = Base::Flags | EvalBeforeNestingBit }; + + unary_evaluator(const InverseType& inv_xpr) + : m_result(inv_xpr.rows(), inv_xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + internal::call_assignment_no_alias(m_result, inv_xpr); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INVERSE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Map.h b/lib/eigen-3.4.0/Eigen/src/Core/Map.h new file mode 100644 index 0000000..218cc15 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Map.h @@ -0,0 +1,171 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MAP_H +#define EIGEN_MAP_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : public traits +{ + typedef traits TraitsBase; + enum { + PlainObjectTypeInnerSize = ((traits::Flags&RowMajorBit)==RowMajorBit) + ? PlainObjectType::ColsAtCompileTime + : PlainObjectType::RowsAtCompileTime, + + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? (InnerStrideAtCompileTime==Dynamic || PlainObjectTypeInnerSize==Dynamic + ? Dynamic + : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize)) + : int(StrideType::OuterStrideAtCompileTime), + Alignment = int(MapOptions)&int(AlignedMask), + Flags0 = TraitsBase::Flags & (~NestByRefBit), + Flags = is_lvalue::value ? int(Flags0) : (int(Flags0) & ~LvalueBit) + }; +private: + enum { Options }; // Expressions don't have Options +}; +} + +/** \class Map + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing array of data. + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam MapOptions specifies the pointer alignment in bytes. It can be: \c #Aligned128, \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout + * of an ordinary, contiguous array. This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class represents a matrix or vector expression mapping an existing array of data. + * It can be used to let Eigen interface without any overhead with non-Eigen data structures, + * such as plain C arrays or structures from other libraries. By default, it assumes that the + * data is laid out contiguously in memory. You can however override this by explicitly specifying + * inner and outer strides. + * + * Here's an example of simply mapping a contiguous array as a \ref TopicStorageOrders "column-major" matrix: + * \include Map_simple.cpp + * Output: \verbinclude Map_simple.out + * + * If you need to map non-contiguous arrays, you can do so by specifying strides: + * + * Here's an example of mapping an array as a vector, specifying an inner stride, that is, the pointer + * increment between two consecutive coefficients. Here, we're specifying the inner stride as a compile-time + * fixed value. + * \include Map_inner_stride.cpp + * Output: \verbinclude Map_inner_stride.out + * + * Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping + * as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns. + * Here, we're specifying the outer stride as a runtime parameter. Note that here \c OuterStride<> is + * a short version of \c OuterStride because the default template parameter of OuterStride + * is \c Dynamic + * \include Map_outer_stride.cpp + * Output: \verbinclude Map_outer_stride.out + * + * For more details and for an example of specifying both an inner and an outer stride, see class Stride. + * + * \b Tip: to change the array of data mapped by a Map object, you can use the C++ + * placement new syntax: + * + * Example: \include Map_placement_new.cpp + * Output: \verbinclude Map_placement_new.out + * + * This class is the return type of PlainObjectBase::Map() but can also be used directly. + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ +template class Map + : public MapBase > +{ + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Map) + + typedef typename Base::PointerType PointerType; + typedef PointerType PointerArgType; + EIGEN_DEVICE_FUNC + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : internal::traits::OuterStrideAtCompileTime != Dynamic ? Index(internal::traits::OuterStrideAtCompileTime) + : IsVectorAtCompileTime ? (this->size() * innerStride()) + : int(Flags)&RowMajorBit ? (this->cols() * innerStride()) + : (this->rows() * innerStride()); + } + + /** Constructor in the fixed-size case. + * + * \param dataPtr pointer to the array to map + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size vector case. + * + * \param dataPtr pointer to the array to map + * \param size the size of the vector expression + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size matrix case. + * + * \param dataPtr pointer to the array to map + * \param rows the number of rows of the matrix expression + * \param cols the number of columns of the matrix expression + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) + + protected: + StrideType m_stride; +}; + + +} // end namespace Eigen + +#endif // EIGEN_MAP_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/MapBase.h b/lib/eigen-3.4.0/Eigen/src/Core/MapBase.h new file mode 100644 index 0000000..d856447 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/MapBase.h @@ -0,0 +1,310 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MAPBASE_H +#define EIGEN_MAPBASE_H + +#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \ + EIGEN_STATIC_ASSERT((int(internal::evaluator::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ + YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) + +namespace Eigen { + +/** \ingroup Core_Module + * + * \brief Base class for dense Map and Block expression with direct access + * + * This base class provides the const low-level accessors (e.g. coeff, coeffRef) of dense + * Map and Block objects with direct access. + * Typical users do not have to directly deal with this class. + * + * This class can be extended by through the macro plugin \c EIGEN_MAPBASE_PLUGIN. + * See \link TopicCustomizing_Plugins customizing Eigen \endlink for details. + * + * The \c Derived class has to provide the following two methods describing the memory layout: + * \code Index innerStride() const; \endcode + * \code Index outerStride() const; \endcode + * + * \sa class Map, class Block + */ +template class MapBase + : public internal::dense_xpr_base::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + enum { + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + InnerStrideAtCompileTime = internal::traits::InnerStrideAtCompileTime, + SizeAtCompileTime = Base::SizeAtCompileTime + }; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef typename internal::conditional< + bool(internal::is_lvalue::value), + Scalar *, + const Scalar *>::type + PointerType; + + using Base::derived; +// using Base::RowsAtCompileTime; +// using Base::ColsAtCompileTime; +// using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + using Base::IsRowMajor; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + // bug 217 - compile error on ICC 11.1 + using Base::operator=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + + /** \copydoc DenseBase::rows() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_rows.value(); } + /** \copydoc DenseBase::cols() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_cols.value(); } + + /** Returns a pointer to the first coefficient of the matrix or vector. + * + * \note When addressing this data, make sure to honor the strides returned by innerStride() and outerStride(). + * + * \sa innerStride(), outerStride() + */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_data; } + + /** \copydoc PlainObjectBase::coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeff(Index rowId, Index colId) const + { + return m_data[colId * colStride() + rowId * rowStride()]; + } + + /** \copydoc PlainObjectBase::coeff(Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeff(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return m_data[index * innerStride()]; + } + + /** \copydoc PlainObjectBase::coeffRef(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return this->m_data[colId * colStride() + rowId * rowStride()]; + } + + /** \copydoc PlainObjectBase::coeffRef(Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + /** \internal */ + template + inline PacketScalar packet(Index rowId, Index colId) const + { + return internal::ploadt + (m_data + (colId * colStride() + rowId * rowStride())); + } + + /** \internal */ + template + inline PacketScalar packet(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return internal::ploadt(m_data + index * innerStride()); + } + + /** \internal Constructor for fixed size matrices or vectors */ + EIGEN_DEVICE_FUNC + explicit inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) + { + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + checkSanity(); + } + + /** \internal Constructor for dynamically sized vectors */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index vecSize) + : m_data(dataPtr), + m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)), + m_cols(ColsAtCompileTime == Dynamic ? vecSize : Index(ColsAtCompileTime)) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + eigen_assert(vecSize >= 0); + eigen_assert(dataPtr == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == vecSize); + checkSanity(); + } + + /** \internal Constructor for dynamically sized matrices */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index rows, Index cols) + : m_data(dataPtr), m_rows(rows), m_cols(cols) + { + eigen_assert( (dataPtr == 0) + || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); + checkSanity(); + } + + #ifdef EIGEN_MAPBASE_PLUGIN + #include EIGEN_MAPBASE_PLUGIN + #endif + + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) + + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if<(internal::traits::Alignment>0),void*>::type = 0) const + { +#if EIGEN_MAX_ALIGN_BYTES>0 + // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value: + const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime); + EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride); + eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) + || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"); +#endif + } + + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if::Alignment==0,void*>::type = 0) const + {} + + PointerType m_data; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + +/** \ingroup Core_Module + * + * \brief Base class for non-const dense Map and Block expression with direct access + * + * This base class provides the non-const low-level accessors (e.g. coeff and coeffRef) of + * dense Map and Block objects with direct access. + * It inherits MapBase which defines the const variant for reading specific entries. + * + * \sa class Map, class Block + */ +template class MapBase + : public MapBase +{ + typedef MapBase ReadOnlyMapBase; + public: + + typedef MapBase Base; + + typedef typename Base::Scalar Scalar; + typedef typename Base::PacketScalar PacketScalar; + typedef typename Base::StorageIndex StorageIndex; + typedef typename Base::PointerType PointerType; + + using Base::derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return this->m_data; } + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) + { + return this->m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& val) + { + internal::pstoret + (this->m_data + (col * colStride() + row * rowStride()), val); + } + + template + inline void writePacket(Index index, const PacketScalar& val) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + internal::pstoret + (this->m_data + index * innerStride(), val); + } + + EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {} + + EIGEN_DEVICE_FUNC + Derived& operator=(const MapBase& other) + { + ReadOnlyMapBase::Base::operator=(other); + return derived(); + } + + // In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base, + // see bugs 821 and 920. + using ReadOnlyMapBase::Base::operator=; + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) +}; + +#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS + +} // end namespace Eigen + +#endif // EIGEN_MAPBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/MathFunctions.h b/lib/eigen-3.4.0/Eigen/src/Core/MathFunctions.h new file mode 100644 index 0000000..61b78f4 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/MathFunctions.h @@ -0,0 +1,2057 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONS_H +#define EIGEN_MATHFUNCTIONS_H + +// TODO this should better be moved to NumTraits +// Source: WolframAlpha +#define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L +#define EIGEN_LOG2E 1.442695040888963407359924681001892137426645954152985934135449406931109219L +#define EIGEN_LN2 0.693147180559945309417232121458176568075500134360255254120680009493393621L + +namespace Eigen { + +// On WINCE, std::abs is defined for int only, so let's defined our own overloads: +// This issue has been confirmed with MSVC 2008 only, but the issue might exist for more recent versions too. +#if EIGEN_OS_WINCE && EIGEN_COMP_MSVC && EIGEN_COMP_MSVC<=1500 +long abs(long x) { return (labs(x)); } +double abs(double x) { return (fabs(x)); } +float abs(float x) { return (fabsf(x)); } +long double abs(long double x) { return (fabsl(x)); } +#endif + +namespace internal { + +/** \internal \class global_math_functions_filtering_base + * + * What it does: + * Defines a typedef 'type' as follows: + * - if type T has a member typedef Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl, then + * global_math_functions_filtering_base::type is a typedef for it. + * - otherwise, global_math_functions_filtering_base::type is a typedef for T. + * + * How it's used: + * 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. + * So we must make sure to use sin_impl > and not sin_impl, 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 + * the typename dummy by an integer template parameter, it doesn't work anymore! + */ + +template +struct global_math_functions_filtering_base +{ + typedef T type; +}; + +template struct always_void { typedef void type; }; + +template +struct global_math_functions_filtering_base + ::type + > +{ + typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type; +}; + +#define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl::type> +#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval::type>::type + +/**************************************************************************** +* Implementation of real * +****************************************************************************/ + +template::IsComplex> +struct real_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x; + } +}; + +template +struct real_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + using std::real; + return real(x); + } +}; + +template struct real_impl : real_default_impl {}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct real_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.real(); + } +}; +#endif + +template +struct real_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of imag * +****************************************************************************/ + +template::IsComplex> +struct imag_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar&) + { + return RealScalar(0); + } +}; + +template +struct imag_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + using std::imag; + return imag(x); + } +}; + +template struct imag_impl : imag_default_impl {}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct imag_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.imag(); + } +}; +#endif + +template +struct imag_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of real_ref * +****************************************************************************/ + +template +struct real_ref_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[0]; + } + EIGEN_DEVICE_FUNC + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[0]; + } +}; + +template +struct real_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +/**************************************************************************** +* Implementation of imag_ref * +****************************************************************************/ + +template +struct imag_ref_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[1]; + } + EIGEN_DEVICE_FUNC + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[1]; + } +}; + +template +struct imag_ref_default_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Scalar run(Scalar&) + { + return Scalar(0); + } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline const Scalar run(const Scalar&) + { + return Scalar(0); + } +}; + +template +struct imag_ref_impl : imag_ref_default_impl::IsComplex> {}; + +template +struct imag_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +/**************************************************************************** +* Implementation of conj * +****************************************************************************/ + +template::IsComplex> +struct conj_default_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + return x; + } +}; + +template +struct conj_default_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + using std::conj; + return conj(x); + } +}; + +template::IsComplex> +struct conj_impl : conj_default_impl {}; + +template +struct conj_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of abs2 * +****************************************************************************/ + +template +struct abs2_impl_default +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x*x; + } +}; + +template +struct abs2_impl_default // IsComplex +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x.real()*x.real() + x.imag()*x.imag(); + } +}; + +template +struct abs2_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return abs2_impl_default::IsComplex>::run(x); + } +}; + +template +struct abs2_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of sqrt/rsqrt * +****************************************************************************/ + +template +struct sqrt_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE Scalar run(const Scalar& x) + { + EIGEN_USING_STD(sqrt); + return sqrt(x); + } +}; + +// Complex sqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& a_x); + +// Custom implementation is faster than `std::sqrt`, works on +// GPU, and correctly handles special cases (unlike MSVC). +template +struct sqrt_impl > +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) + { + return complex_sqrt(x); + } +}; + +template +struct sqrt_retval +{ + typedef Scalar type; +}; + +// Default implementation relies on numext::sqrt, at bottom of file. +template +struct rsqrt_impl; + +// Complex rsqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& a_x); + +template +struct rsqrt_impl > +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) + { + return complex_rsqrt(x); + } +}; + +template +struct rsqrt_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of norm1 * +****************************************************************************/ + +template +struct norm1_default_impl; + +template +struct norm1_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + EIGEN_USING_STD(abs); + return abs(x.real()) + abs(x.imag()); + } +}; + +template +struct norm1_default_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD(abs); + return abs(x); + } +}; + +template +struct norm1_impl : norm1_default_impl::IsComplex> {}; + +template +struct norm1_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of hypot * +****************************************************************************/ + +template struct hypot_impl; + +template +struct hypot_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of cast * +****************************************************************************/ + +template +struct cast_impl +{ + EIGEN_DEVICE_FUNC + static inline NewType run(const OldType& x) + { + return static_cast(x); + } +}; + +// Casting from S -> Complex leads to an implicit conversion from S to T, +// generating warnings on clang. Here we explicitly cast the real component. +template +struct cast_impl::IsComplex && NumTraits::IsComplex + >::type> +{ + EIGEN_DEVICE_FUNC + static inline NewType run(const OldType& x) + { + typedef typename NumTraits::Real NewReal; + return static_cast(static_cast(x)); + } +}; + +// here, for once, we're plainly returning NewType: we don't want cast to do weird things. + +template +EIGEN_DEVICE_FUNC +inline NewType cast(const OldType& x) +{ + return cast_impl::run(x); +} + +/**************************************************************************** +* Implementation of round * +****************************************************************************/ + +template +struct round_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(round); +#endif + return Scalar(round(x)); + } +}; + +#if !EIGEN_HAS_CXX11_MATH +#if EIGEN_HAS_C99_MATH +// Use ::roundf for float. +template<> +struct round_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::roundf(x); + } +}; +#else +template +struct round_using_floor_ceil_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + // Without C99 round/roundf, resort to floor/ceil. + EIGEN_USING_STD(floor); + EIGEN_USING_STD(ceil); + // If not enough precision to resolve a decimal at all, return the input. + // Otherwise, adding 0.5 can trigger an increment by 1. + const Scalar limit = Scalar(1ull << (NumTraits::digits() - 1)); + if (x >= limit || x <= -limit) { + return x; + } + return (x > Scalar(0)) ? Scalar(floor(x + Scalar(0.5))) : Scalar(ceil(x - Scalar(0.5))); + } +}; + +template<> +struct round_impl : round_using_floor_ceil_impl {}; + +template<> +struct round_impl : round_using_floor_ceil_impl {}; +#endif // EIGEN_HAS_C99_MATH +#endif // !EIGEN_HAS_CXX11_MATH + +template +struct round_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of rint * +****************************************************************************/ + +template +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(rint); +#endif + return rint(x); + } +}; + +#if !EIGEN_HAS_CXX11_MATH +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline double run(const double& x) + { + return ::rint(x); + } +}; +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::rintf(x); + } +}; +#endif + +template +struct rint_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of arg * +****************************************************************************/ + +// Visual Studio 2017 has a bug where arg(float) returns 0 for negative inputs. +// This seems to be fixed in VS 2019. +#if EIGEN_HAS_CXX11_MATH && (!EIGEN_COMP_MSVC || EIGEN_COMP_MSVC >= 1920) +// std::arg is only defined for types of std::complex, or integer types or float/double/long double +template::IsComplex || is_integral::value + || is_same::value || is_same::value + || is_same::value > +struct arg_default_impl; + +template +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + #if defined(EIGEN_HIP_DEVICE_COMPILE) + // HIP does not seem to have a native device side implementation for the math routine "arg" + using std::arg; + #else + EIGEN_USING_STD(arg); + #endif + return static_cast(arg(x)); + } +}; + +// Must be non-complex floating-point type (e.g. half/bfloat16). +template +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < Scalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); + } +}; +#else +template::IsComplex> +struct arg_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < RealScalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); + } +}; + +template +struct arg_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + EIGEN_USING_STD(arg); + return arg(x); + } +}; +#endif +template struct arg_impl : arg_default_impl {}; + +template +struct arg_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of expm1 * +****************************************************************************/ + +// This implementation is based on GSL Math's expm1. +namespace std_fallback { + // fallback expm1 implementation in case there is no expm1(Scalar) function in namespace of Scalar, + // or that there is no suitable std::expm1 function available. Implementation + // attributed to Kahan. See: http://www.plunk.org/~hatch/rightway.php. + template + EIGEN_DEVICE_FUNC inline Scalar expm1(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + + EIGEN_USING_STD(exp); + Scalar u = exp(x); + if (numext::equal_strict(u, Scalar(1))) { + return x; + } + Scalar um1 = u - RealScalar(1); + if (numext::equal_strict(um1, Scalar(-1))) { + return RealScalar(-1); + } + + EIGEN_USING_STD(log); + Scalar logu = log(u); + return numext::equal_strict(u, logu) ? u : (u - RealScalar(1)) * x / logu; + } +} + +template +struct expm1_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + #if EIGEN_HAS_CXX11_MATH + using std::expm1; + #else + using std_fallback::expm1; + #endif + return expm1(x); + } +}; + +template +struct expm1_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of log * +****************************************************************************/ + +// Complex log defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z); + +template +struct log_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD(log); + return static_cast(log(x)); + } +}; + +template +struct log_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run(const std::complex& z) + { + return complex_log(z); + } +}; + +/**************************************************************************** +* Implementation of log1p * +****************************************************************************/ + +namespace std_fallback { + // fallback log1p implementation in case there is no log1p(Scalar) function in namespace of Scalar, + // or that there is no suitable std::log1p function available + template + EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + EIGEN_USING_STD(log); + Scalar x1p = RealScalar(1) + x; + Scalar log_1p = log_impl::run(x1p); + const bool is_small = numext::equal_strict(x1p, Scalar(1)); + const bool is_inf = numext::equal_strict(x1p, log_1p); + return (is_small || is_inf) ? x : x * (log_1p / (x1p - RealScalar(1))); + } +} + +template +struct log1p_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + #if EIGEN_HAS_CXX11_MATH + using std::log1p; + #else + using std_fallback::log1p; + #endif + return log1p(x); + } +}; + +// Specialization for complex types that are not supported by std::log1p. +template +struct log1p_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + return std_fallback::log1p(x); + } +}; + +template +struct log1p_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of pow * +****************************************************************************/ + +template::IsInteger&&NumTraits::IsInteger> +struct pow_impl +{ + //typedef Scalar retval; + typedef typename ScalarBinaryOpTraits >::ReturnType result_type; + static EIGEN_DEVICE_FUNC inline result_type run(const ScalarX& x, const ScalarY& y) + { + EIGEN_USING_STD(pow); + return pow(x, y); + } +}; + +template +struct pow_impl +{ + typedef ScalarX result_type; + static EIGEN_DEVICE_FUNC inline ScalarX run(ScalarX x, ScalarY y) + { + ScalarX res(1); + eigen_assert(!NumTraits::IsSigned || y >= 0); + if(y & 1) res *= x; + y >>= 1; + while(y) + { + x *= x; + if(y&1) res *= x; + y >>= 1; + } + return res; + } +}; + +/**************************************************************************** +* Implementation of random * +****************************************************************************/ + +template +struct random_default_impl {}; + +template +struct random_impl : random_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template +struct random_retval +{ + typedef Scalar type; +}; + +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y); +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(); + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return x + (y-x) * Scalar(std::rand()) / Scalar(RAND_MAX); + } + static inline Scalar run() + { + return run(Scalar(NumTraits::IsSigned ? -1 : 0), Scalar(1)); + } +}; + +enum { + meta_floor_log2_terminate, + meta_floor_log2_move_up, + meta_floor_log2_move_down, + meta_floor_log2_bogus +}; + +template struct meta_floor_log2_selector +{ + enum { middle = (lower + upper) / 2, + value = (upper <= lower + 1) ? int(meta_floor_log2_terminate) + : (n < (1 << middle)) ? int(meta_floor_log2_move_down) + : (n==0) ? int(meta_floor_log2_bogus) + : int(meta_floor_log2_move_up) + }; +}; + +template::value> +struct meta_floor_log2 {}; + +template +struct meta_floor_log2 +{ + enum { value = meta_floor_log2::middle>::value }; +}; + +template +struct meta_floor_log2 +{ + enum { value = meta_floor_log2::middle, upper>::value }; +}; + +template +struct meta_floor_log2 +{ + enum { value = (n >= ((unsigned int)(1) << (lower+1))) ? lower+1 : lower }; +}; + +template +struct meta_floor_log2 +{ + // no value, error at compile time +}; + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + if (y <= x) + return x; + // ScalarU is the unsigned counterpart of Scalar, possibly Scalar itself. + typedef typename make_unsigned::type ScalarU; + // ScalarX is the widest of ScalarU and unsigned int. + // We'll deal only with ScalarX and unsigned int below thus avoiding signed + // types and arithmetic and signed overflows (which are undefined behavior). + typedef typename conditional<(ScalarU(-1) > unsigned(-1)), ScalarU, unsigned>::type ScalarX; + // The following difference doesn't overflow, provided our integer types are two's + // complement and have the same number of padding bits in signed and unsigned variants. + // This is the case in most modern implementations of C++. + ScalarX range = ScalarX(y) - ScalarX(x); + ScalarX offset = 0; + ScalarX divisor = 1; + ScalarX multiplier = 1; + const unsigned rand_max = RAND_MAX; + if (range <= rand_max) divisor = (rand_max + 1) / (range + 1); + else multiplier = 1 + range / (rand_max + 1); + // Rejection sampling. + do { + offset = (unsigned(std::rand()) * multiplier) / divisor; + } while (offset > range); + return Scalar(ScalarX(x) + offset); + } + + static inline Scalar run() + { +#ifdef EIGEN_MAKING_DOCS + return run(Scalar(NumTraits::IsSigned ? -10 : 0), Scalar(10)); +#else + enum { rand_bits = meta_floor_log2<(unsigned int)(RAND_MAX)+1>::value, + scalar_bits = sizeof(Scalar) * CHAR_BIT, + shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)), + offset = NumTraits::IsSigned ? (1 << (EIGEN_PLAIN_ENUM_MIN(rand_bits,scalar_bits)-1)) : 0 + }; + return Scalar((std::rand() >> shift) - offset); +#endif + } +}; + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return Scalar(random(x.real(), y.real()), + random(x.imag(), y.imag())); + } + static inline Scalar run() + { + typedef typename NumTraits::Real RealScalar; + return Scalar(random(), random()); + } +}; + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(x, y); +} + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random() +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); +} + +// Implementation of is* functions + +// std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang. +#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG) +#define EIGEN_USE_STD_FPCLASSIFY 1 +#else +#define EIGEN_USE_STD_FPCLASSIFY 0 +#endif + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isnan_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isinf_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isfinite_impl(const T&) { return true; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isfinite_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isfinite)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isfinite; + return isfinite EIGEN_NOT_A_MACRO (x); + #else + return x<=NumTraits::highest() && x>=NumTraits::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isinf_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isinf)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isinf; + return isinf EIGEN_NOT_A_MACRO (x); + #else + return x>NumTraits::highest() || x::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isnan_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isnan)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isnan; + return isnan EIGEN_NOT_A_MACRO (x); + #else + return x != x; + #endif +} + +#if (!EIGEN_USE_STD_FPCLASSIFY) + +#if EIGEN_COMP_MSVC + +template EIGEN_DEVICE_FUNC bool isinf_msvc_helper(T x) +{ + return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; +} + +//MSVC defines a _isnan builtin function, but for double only +EIGEN_DEVICE_FUNC inline bool isnan_impl(const long double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const float& x) { return _isnan(x)!=0; } + +EIGEN_DEVICE_FUNC inline bool isinf_impl(const long double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const float& x) { return isinf_msvc_helper(x); } + +#elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC) + +#if EIGEN_GNUC_AT_LEAST(5,0) + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only"))) +#else + // NOTE the inline qualifier and noinline attribute are both needed: the former is to avoid linking issue (duplicate symbol), + // while the second prevent too aggressive optimizations in fast-math mode: + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((noinline,optimize("no-finite-math-only"))) +#endif + +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const long double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const float& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const double& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const float& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const long double& x) { return __builtin_isinf(x); } + +#undef EIGEN_TMP_NOOPT_ATTRIB + +#endif + +#endif + +// The following overload are defined at the end of this file +template EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x); + +template T generic_fast_tanh_float(const T& a_x); +} // end namespace internal + +/**************************************************************************** +* Generic math functions * +****************************************************************************/ + +namespace numext { + +#if (!defined(EIGEN_GPUCC) || defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC)) +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + EIGEN_USING_STD(min) + return min EIGEN_NOT_A_MACRO (x,y); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + EIGEN_USING_STD(max) + return max EIGEN_NOT_A_MACRO (x,y); +} +#else +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + return y < x ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float mini(const float& x, const float& y) +{ + return fminf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double mini(const double& x, const double& y) +{ + return fmin(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double mini(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fminl" on HIP yet + return (x < y) ? x : y; +#else + return fminl(x, y); +#endif +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + return x < y ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float maxi(const float& x, const float& y) +{ + return fmaxf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double maxi(const double& x, const double& y) +{ + return fmax(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double maxi(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fmaxl" on HIP yet + return (x > y) ? x : y; +#else + return fmaxl(x, y); +#endif +} +#endif + +#if defined(SYCL_DEVICE_ONLY) + + +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) +#define SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) +#define SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(NAME, FUNC, RET_TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_double) + +#define SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ +template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE& x) { \ + return cl::sycl::FUNC(x); \ + } + +#define SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, TYPE, TYPE) + +#define SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \ + template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE1& x, const ARG_TYPE2& y) { \ + return cl::sycl::FUNC(x, y); \ + } + +#define SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ + SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE, ARG_TYPE) + +#define SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, TYPE, TYPE) + +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(mini, min) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(mini, fmin) +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(maxi, max) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(maxi, fmax) + +#endif + + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) +{ + return internal::real_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(arg, Scalar) arg(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(arg, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) +{ + return internal::imag_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); +} + +EIGEN_DEVICE_FUNC +inline bool abs2(bool x) { return x; } + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T absdiff(const T& x, const T& y) +{ + return x > y ? x - y : y - x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float absdiff(const float& x, const float& y) +{ + return fabsf(x - y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double absdiff(const double& x, const double& y) +{ + return fabs(x - y); +} + +#if !defined(EIGEN_GPUCC) +// HIP and CUDA do not support long double. +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double absdiff(const long double& x, const long double& y) { + return fabsl(x - y); +} +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); +} + +#if defined(SYCL_DEVICE_ONLY) + SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(hypot, hypot) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(log1p, Scalar) log1p(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(log1p, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log1p, log1p) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log1p(const float &x) { return ::log1pf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log1p(const double &x) { return ::log1p(x); } +#endif + +template +EIGEN_DEVICE_FUNC +inline typename internal::pow_impl::result_type pow(const ScalarX& x, const ScalarY& y) +{ + return internal::pow_impl::run(x, y); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(pow, pow) +#endif + +template EIGEN_DEVICE_FUNC bool (isnan) (const T &x) { return internal::isnan_impl(x); } +template EIGEN_DEVICE_FUNC bool (isinf) (const T &x) { return internal::isinf_impl(x); } +template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isnan, isnan, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isinf, isinf, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isfinite, isfinite, bool) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(rint, Scalar) rint(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(rint, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(round, round) +#endif + +template +EIGEN_DEVICE_FUNC +T (floor)(const T& x) +{ + EIGEN_USING_STD(floor) + return floor(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(floor, floor) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float floor(const float &x) { return ::floorf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double floor(const double &x) { return ::floor(x); } +#endif + +template +EIGEN_DEVICE_FUNC +T (ceil)(const T& x) +{ + EIGEN_USING_STD(ceil); + return ceil(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(ceil, ceil) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float ceil(const float &x) { return ::ceilf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double ceil(const double &x) { return ::ceil(x); } +#endif + + +/** Log base 2 for 32 bits positive integers. + * Conveniently returns 0 for x==0. */ +inline int log2(int x) +{ + eigen_assert(x>=0); + unsigned int v(x); + static const int table[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + return table[(v * 0x07C4ACDDU) >> 27]; +} + +/** \returns the square root of \a x. + * + * It is essentially equivalent to + * \code using std::sqrt; return sqrt(x); \endcode + * but slightly faster for float/double and some compilers (e.g., gcc), thanks to + * specializations when SSE is enabled. + * + * It's usage is justified in performance critical functions, like norm/normalize. + */ +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); +} + +// Boolean specialization, avoids implicit float to bool conversion (-Wimplicit-conversion-floating-point-to-bool). +template<> +EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC +bool sqrt(const bool &x) { return x; } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sqrt, sqrt) +#endif + +/** \returns the reciprocal square root of \a x. **/ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T rsqrt(const T& x) +{ + return internal::rsqrt_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T log(const T &x) { + return internal::log_impl::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log, log) +#endif + + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log(const float &x) { return ::logf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log(const double &x) { return ::log(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex,typename NumTraits::Real>::type +abs(const T &x) { + EIGEN_USING_STD(abs); + return abs(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex),typename NumTraits::Real>::type +abs(const T &x) { + return x; +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(abs, abs) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(abs, fabs) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const float &x) { return ::fabsf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const double &x) { return ::fabs(x); } + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const std::complex& x) { + return ::hypotf(x.real(), x.imag()); +} + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const std::complex& x) { + return ::hypot(x.real(), x.imag()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T exp(const T &x) { + EIGEN_USING_STD(exp); + return exp(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(exp, exp) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float exp(const float &x) { return ::expf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double exp(const double &x) { return ::exp(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + float com = ::expf(x.real()); + float res_real = com * ::cosf(x.imag()); + float res_imag = com * ::sinf(x.imag()); + return std::complex(res_real, res_imag); +} + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + double com = ::exp(x.real()); + double res_real = com * ::cos(x.imag()); + double res_imag = com * ::sin(x.imag()); + return std::complex(res_real, res_imag); +} +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(expm1, Scalar) expm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(expm1, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(expm1, expm1) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float expm1(const float &x) { return ::expm1f(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double expm1(const double &x) { return ::expm1(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cos(const T &x) { + EIGEN_USING_STD(cos); + return cos(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cos,cos) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cos(const float &x) { return ::cosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cos(const double &x) { return ::cos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sin(const T &x) { + EIGEN_USING_STD(sin); + return sin(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sin, sin) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sin(const float &x) { return ::sinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sin(const double &x) { return ::sin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tan(const T &x) { + EIGEN_USING_STD(tan); + return tan(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tan, tan) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tan(const float &x) { return ::tanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tan(const double &x) { return ::tan(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acos(const T &x) { + EIGEN_USING_STD(acos); + return acos(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acosh(const T &x) { + EIGEN_USING_STD(acosh); + return static_cast(acosh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acos, acos) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acosh, acosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float acos(const float &x) { return ::acosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double acos(const double &x) { return ::acos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asin(const T &x) { + EIGEN_USING_STD(asin); + return asin(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asinh(const T &x) { + EIGEN_USING_STD(asinh); + return static_cast(asinh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asin, asin) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asinh, asinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float asin(const float &x) { return ::asinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double asin(const double &x) { return ::asin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atan(const T &x) { + EIGEN_USING_STD(atan); + return static_cast(atan(x)); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atanh(const T &x) { + EIGEN_USING_STD(atanh); + return static_cast(atanh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atan, atan) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atanh, atanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float atan(const float &x) { return ::atanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double atan(const double &x) { return ::atan(x); } +#endif + + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cosh(const T &x) { + EIGEN_USING_STD(cosh); + return static_cast(cosh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cosh, cosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cosh(const float &x) { return ::coshf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cosh(const double &x) { return ::cosh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sinh(const T &x) { + EIGEN_USING_STD(sinh); + return static_cast(sinh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sinh, sinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sinh(const float &x) { return ::sinhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sinh(const double &x) { return ::sinh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tanh(const T &x) { + EIGEN_USING_STD(tanh); + return tanh(x); +} + +#if (!defined(EIGEN_GPUCC)) && EIGEN_FAST_MATH && !defined(SYCL_DEVICE_ONLY) +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(float x) { return internal::generic_fast_tanh_float(x); } +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tanh, tanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(const float &x) { return ::tanhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tanh(const double &x) { return ::tanh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T fmod(const T& a, const T& b) { + EIGEN_USING_STD(fmod); + return fmod(a, b); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(fmod, fmod) +#endif + +#if defined(EIGEN_GPUCC) +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float fmod(const float& a, const float& b) { + return ::fmodf(a, b); +} + +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double fmod(const double& a, const double& b) { + return ::fmod(a, b); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_BINARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE +#undef SYCL_SPECIALIZE_GEN_UNARY_FUNC +#undef SYCL_SPECIALIZE_UNARY_FUNC +#undef SYCL_SPECIALIZE_GEN1_BINARY_FUNC +#undef SYCL_SPECIALIZE_GEN2_BINARY_FUNC +#undef SYCL_SPECIALIZE_BINARY_FUNC +#endif + +} // end namespace numext + +namespace internal { + +template +EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x) +{ + return (numext::isfinite)(numext::real(x)) && (numext::isfinite)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x) +{ + return (numext::isnan)(numext::real(x)) || (numext::isnan)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x) +{ + return ((numext::isinf)(numext::real(x)) || (numext::isinf)(numext::imag(x))) && (!(numext::isnan)(x)); +} + +/**************************************************************************** +* Implementation of fuzzy comparisons * +****************************************************************************/ + +template +struct scalar_fuzzy_default_impl {}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return numext::abs(x) <= numext::abs(y) * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return numext::abs(x - y) <= numext::mini(numext::abs(x), numext::abs(y)) * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return x <= y || isApprox(x, y, prec); + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const Scalar&, const RealScalar&) + { + return x == Scalar(0); + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x == y; + } + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x <= y; + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return numext::abs2(x) <= numext::abs2(y) * prec * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return numext::abs2(x - y) <= numext::mini(numext::abs2(x), numext::abs2(y)) * prec * prec; + } +}; + +template +struct scalar_fuzzy_impl : scalar_fuzzy_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template EIGEN_DEVICE_FUNC +inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::template isMuchSmallerThan(x, y, precision); +} + +template EIGEN_DEVICE_FUNC +inline bool isApprox(const Scalar& x, const Scalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApprox(x, y, precision); +} + +template EIGEN_DEVICE_FUNC +inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApproxOrLessThan(x, y, precision); +} + +/****************************************** +*** The special case of the bool type *** +******************************************/ + +template<> struct random_impl +{ + static inline bool run() + { + return random(0,1)==0 ? false : true; + } + + static inline bool run(const bool& a, const bool& b) + { + return random(a, b)==0 ? false : true; + } +}; + +template<> struct scalar_fuzzy_impl +{ + typedef bool RealScalar; + + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) + { + return !x; + } + + EIGEN_DEVICE_FUNC + static inline bool isApprox(bool x, bool y, bool) + { + return x == y; + } + + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) + { + return (!x) || y; + } + +}; + +} // end namespace internal + +// Default implementations that rely on other numext implementations +namespace internal { + +// Specialization for complex types that are not supported by std::expm1. +template +struct expm1_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + RealScalar xr = x.real(); + RealScalar xi = x.imag(); + // expm1(z) = exp(z) - 1 + // = exp(x + i * y) - 1 + // = exp(x) * (cos(y) + i * sin(y)) - 1 + // = exp(x) * cos(y) - 1 + i * exp(x) * sin(y) + // Imag(expm1(z)) = exp(x) * sin(y) + // Real(expm1(z)) = exp(x) * cos(y) - 1 + // = exp(x) * cos(y) - 1. + // = expm1(x) + exp(x) * (cos(y) - 1) + // = expm1(x) + exp(x) * (2 * sin(y / 2) ** 2) + RealScalar erm1 = numext::expm1(xr); + RealScalar er = erm1 + RealScalar(1.); + RealScalar sin2 = numext::sin(xi / RealScalar(2.)); + sin2 = sin2 * sin2; + RealScalar s = numext::sin(xi); + RealScalar real_part = erm1 - RealScalar(2.) * er * sin2; + return std::complex(real_part, er * s); + } +}; + +template +struct rsqrt_impl { + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE T run(const T& x) { + return T(1)/numext::sqrt(x); + } +}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct conj_impl, true> +{ + EIGEN_DEVICE_FUNC + static inline std::complex run(const std::complex& x) + { + return std::complex(numext::real(x), -numext::imag(x)); + } +}; +#endif + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/MathFunctionsImpl.h b/lib/eigen-3.4.0/Eigen/src/Core/MathFunctionsImpl.h new file mode 100644 index 0000000..4eaaaa7 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/MathFunctionsImpl.h @@ -0,0 +1,200 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Pedro Gonnet (pedro.gonnet@gmail.com) +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONSIMPL_H +#define EIGEN_MATHFUNCTIONSIMPL_H + +namespace Eigen { + +namespace internal { + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) + Doesn't do anything fancy, just a 13/6-degree rational interpolant which + is accurate up to a couple of ulps in the (approximate) range [-8, 8], + outside of which tanh(x) = +/-1 in single precision. The input is clamped + to the range [-c, c]. The value c is chosen as the smallest value where + the approximation evaluates to exactly 1. In the reange [-0.0004, 0.0004] + the approxmation tanh(x) ~= x is used for better accuracy as x tends to zero. + + This implementation works on both scalars and packets. +*/ +template +T generic_fast_tanh_float(const T& a_x) +{ + // Clamp the inputs to the range [-c, c] +#ifdef EIGEN_VECTORIZE_FMA + const T plus_clamp = pset1(7.99881172180175781f); + const T minus_clamp = pset1(-7.99881172180175781f); +#else + const T plus_clamp = pset1(7.90531110763549805f); + const T minus_clamp = pset1(-7.90531110763549805f); +#endif + const T tiny = pset1(0.0004f); + const T x = pmax(pmin(a_x, plus_clamp), minus_clamp); + const T tiny_mask = pcmp_lt(pabs(a_x), tiny); + // The monomial coefficients of the numerator polynomial (odd). + const T alpha_1 = pset1(4.89352455891786e-03f); + const T alpha_3 = pset1(6.37261928875436e-04f); + const T alpha_5 = pset1(1.48572235717979e-05f); + const T alpha_7 = pset1(5.12229709037114e-08f); + const T alpha_9 = pset1(-8.60467152213735e-11f); + const T alpha_11 = pset1(2.00018790482477e-13f); + const T alpha_13 = pset1(-2.76076847742355e-16f); + + // The monomial coefficients of the denominator polynomial (even). + const T beta_0 = pset1(4.89352518554385e-03f); + const T beta_2 = pset1(2.26843463243900e-03f); + const T beta_4 = pset1(1.18534705686654e-04f); + const T beta_6 = pset1(1.19825839466702e-06f); + + // Since the polynomials are odd/even, we need x^2. + const T x2 = pmul(x, x); + + // Evaluate the numerator polynomial p. + T p = pmadd(x2, alpha_13, alpha_11); + p = pmadd(x2, p, alpha_9); + p = pmadd(x2, p, alpha_7); + p = pmadd(x2, p, alpha_5); + p = pmadd(x2, p, alpha_3); + p = pmadd(x2, p, alpha_1); + p = pmul(x, p); + + // Evaluate the denominator polynomial q. + T q = pmadd(x2, beta_6, beta_4); + q = pmadd(x2, q, beta_2); + q = pmadd(x2, q, beta_0); + + // Divide the numerator by the denominator. + return pselect(tiny_mask, x, pdiv(p, q)); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) +{ + // IEEE IEC 6059 special cases. + if ((numext::isinf)(x) || (numext::isinf)(y)) + return NumTraits::infinity(); + if ((numext::isnan)(x) || (numext::isnan)(y)) + return NumTraits::quiet_NaN(); + + EIGEN_USING_STD(sqrt); + RealScalar p, qp; + p = numext::maxi(x,y); + if(p==RealScalar(0)) return RealScalar(0); + qp = numext::mini(y,x) / p; + return p * sqrt(RealScalar(1) + qp*qp); +} + +template +struct hypot_impl +{ + typedef typename NumTraits::Real RealScalar; + static EIGEN_DEVICE_FUNC + inline RealScalar run(const Scalar& x, const Scalar& y) + { + EIGEN_USING_STD(abs); + return positive_real_hypot(abs(x), abs(y)); + } +}; + +// Generic complex sqrt implementation that correctly handles corner cases +// according to https://en.cppreference.com/w/cpp/numeric/complex/sqrt +template +EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& z) { + // Computes the principal sqrt of the input. + // + // For a complex square root of the number x + i*y. We want to find real + // numbers u and v such that + // (u + i*v)^2 = x + i*y <=> + // u^2 - v^2 + i*2*u*v = x + i*v. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x + // 2*u*v = y. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + sqrt(x^2 + y^2))) + // v = y / (2 * u) + // and for x < 0, + // v = sign(y) * sqrt(0.5 * (-x + sqrt(x^2 + y^2))) + // u = y / (2 * v) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w, v = sign(y) * w + // if x > 0: u = w, v = y / (2 * w) + // if x < 0: u = |y| / (2 * w), v = sign(y) * w + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + numext::hypot(x, y))); + + return + (numext::isinf)(y) ? std::complex(NumTraits::infinity(), y) + : x == zero ? std::complex(w, y < zero ? -w : w) + : x > zero ? std::complex(w, y / (2 * w)) + : std::complex(numext::abs(y) / (2 * w), y < zero ? -w : w ); +} + +// Generic complex rsqrt implementation. +template +EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& z) { + // Computes the principal reciprocal sqrt of the input. + // + // For a complex reciprocal square root of the number z = x + i*y. We want to + // find real numbers u and v such that + // (u + i*v)^2 = 1 / (x + i*y) <=> + // u^2 - v^2 + i*2*u*v = x/|z|^2 - i*v/|z|^2. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x/|z|^2 + // 2*u*v = y/|z|^2. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + |z|)) / |z| + // v = -y / (2 * u * |z|) + // and for x < 0, + // v = -sign(y) * sqrt(0.5 * (-x + |z|)) / |z| + // u = -y / (2 * v * |z|) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w / |z|, v = -sign(y) * w / |z| + // if x > 0: u = w / |z|, v = -y / (2 * w * |z|) + // if x < 0: u = |y| / (2 * w * |z|), v = -sign(y) * w / |z| + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + + const T abs_z = numext::hypot(x, y); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + abs_z)); + const T woz = w / abs_z; + // Corner cases consistent with 1/sqrt(z) on gcc/clang. + return + abs_z == zero ? std::complex(NumTraits::infinity(), NumTraits::quiet_NaN()) + : ((numext::isinf)(x) || (numext::isinf)(y)) ? std::complex(zero, zero) + : x == zero ? std::complex(woz, y < zero ? woz : -woz) + : x > zero ? std::complex(woz, -y / (2 * w * abs_z)) + : std::complex(numext::abs(y) / (2 * w * abs_z), y < zero ? woz : -woz ); +} + +template +EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z) { + // Computes complex log. + T a = numext::abs(z); + EIGEN_USING_STD(atan2); + T b = atan2(z.imag(), z.real()); + return std::complex(numext::log(a), b); +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONSIMPL_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Matrix.h b/lib/eigen-3.4.0/Eigen/src/Core/Matrix.h new file mode 100644 index 0000000..f0e59a9 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Matrix.h @@ -0,0 +1,565 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIX_H +#define EIGEN_MATRIX_H + +namespace Eigen { + +namespace internal { +template +struct traits > +{ +private: + enum { size = internal::size_at_compile_time<_Rows,_Cols>::ret }; + typedef typename find_best_packet<_Scalar,size>::type PacketScalar; + enum { + row_major_bit = _Options&RowMajor ? RowMajorBit : 0, + is_dynamic_size_storage = _MaxRows==Dynamic || _MaxCols==Dynamic, + max_size = is_dynamic_size_storage ? Dynamic : _MaxRows*_MaxCols, + default_alignment = compute_default_alignment<_Scalar,max_size>::value, + actual_alignment = ((_Options&DontAlign)==0) ? default_alignment : 0, + required_alignment = unpacket_traits::alignment, + packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0 + }; + +public: + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + typedef MatrixXpr XprKind; + enum { + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _MaxRows, + MaxColsAtCompileTime = _MaxCols, + Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, + Options = _Options, + InnerStrideAtCompileTime = 1, + OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime, + + // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase + EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit, + Alignment = actual_alignment + }; +}; +} + +/** \class Matrix + * \ingroup Core_Module + * + * \brief The matrix class, also used for vectors and row-vectors + * + * The %Matrix class is the work-horse for all \em dense (\ref dense "note") matrices and vectors within Eigen. + * Vectors are matrices with one column, and row-vectors are matrices with one row. + * + * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note"). + * + * The first three template parameters are required: + * \tparam _Scalar Numeric type, e.g. float, double, int or std::complex. + * User defined scalar types are supported as well (see \ref user_defined_scalars "here"). + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * + * The remaining template parameters are optional -- in most cases you don't have to worry about them. + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \b #AutoAlign or \b #DontAlign. + * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required + * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. + * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note"). + * \tparam _MaxCols Maximum number of columns. Defaults to \a _Cols (\ref maxrows "note"). + * + * Eigen provides a number of typedefs covering the usual cases. Here are some examples: + * + * \li \c Matrix2d is a 2x2 square matrix of doubles (\c Matrix) + * \li \c Vector4f is a vector of 4 floats (\c Matrix) + * \li \c RowVector3i is a row-vector of 3 ints (\c Matrix) + * + * \li \c MatrixXf is a dynamic-size matrix of floats (\c Matrix) + * \li \c VectorXf is a dynamic-size vector of floats (\c Matrix) + * + * \li \c Matrix2Xf is a partially fixed-size (dynamic-size) matrix of floats (\c Matrix) + * \li \c MatrixX3d is a partially dynamic-size (fixed-size) matrix of double (\c Matrix) + * + * See \link matrixtypedefs this page \endlink for a complete list of predefined \em %Matrix and \em Vector typedefs. + * + * You can access elements of vectors and matrices using normal subscripting: + * + * \code + * Eigen::VectorXd v(10); + * v[0] = 0.1; + * v[1] = 0.2; + * v(0) = 0.3; + * v(1) = 0.4; + * + * Eigen::MatrixXi m(10, 10); + * m(0, 1) = 1; + * m(0, 2) = 2; + * m(0, 3) = 3; + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. + * + * Some notes: + * + *
+ *
\anchor dense Dense versus sparse:
+ *
This %Matrix class handles dense, not sparse matrices and vectors. For sparse matrices and vectors, see the Sparse module. + * + * Dense matrices and vectors are plain usual arrays of coefficients. All the coefficients are stored, in an ordinary contiguous array. + * This is unlike Sparse matrices and vectors where the coefficients are stored as a list of nonzero coefficients.
+ * + *
\anchor fixedsize Fixed-size versus dynamic-size:
+ *
Fixed-size means that the numbers of rows and columns are known are compile-time. In this case, Eigen allocates the array + * of coefficients as a fixed-size array, as a class member. This makes sense for very small matrices, typically up to 4x4, sometimes up + * to 16x16. Larger matrices should be declared as dynamic-size even if one happens to know their size at compile-time. + * + * Dynamic-size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime + * variables, and the array of coefficients is allocated dynamically on the heap. + * + * Note that \em dense matrices, be they Fixed-size or Dynamic-size, do not expand dynamically in the sense of a std::map. + * If you want this behavior, see the Sparse module.
+ * + *
\anchor maxrows _MaxRows and _MaxCols:
+ *
In most cases, one just leaves these parameters to the default values. + * These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases + * when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot + * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case _MaxRows and _MaxCols + * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic.
+ *
+ * + * ABI and storage layout + * + * The table below summarizes the ABI of some possible Matrix instances which is fixed thorough the lifetime of Eigen 3. + * + * + * + * + * + * + *
Matrix typeEquivalent C structure
\code Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index rows, cols; + * }; + * \endcode
\code + * Matrix + * Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index size; + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[Rows*Cols]; // with (size_t(data)%A(Rows*Cols*sizeof(T)))==0 + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[MaxRows*MaxCols]; // with (size_t(data)%A(MaxRows*MaxCols*sizeof(T)))==0 + * Eigen::Index rows, cols; + * }; + * \endcode
+ * Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two + * smaller to EIGEN_MAX_STATIC_ALIGN_BYTES. + * + * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, + * \ref TopicStorageOrders + */ + +template +class Matrix + : public PlainObjectBase > +{ + public: + + /** \brief Base class typedef. + * \sa PlainObjectBase + */ + typedef PlainObjectBase Base; + + enum { Options = _Options }; + + EIGEN_DENSE_PUBLIC_INTERFACE(Matrix) + + typedef typename Base::PlainObject PlainObject; + + using Base::base; + using Base::coeffRef; + + /** + * \brief Assigns matrices to each other. + * + * \note This is a special case of the templated operator=. Its purpose is + * to prevent a default operator= from hiding the templated operator=. + * + * \callgraph + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other) + { + return Base::_set(other); + } + + /** \internal + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase& other) + { + return Base::_set(other); + } + + /* Here, doxygen failed to copy the brief information when using \copydoc */ + + /** + * \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue& func) + { + return Base::operator=(func); + } + + /** \brief Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + + // FIXME is it still needed + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) + { + Base::_check_template_params(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + Base::operator=(std::move(other)); + return *this; + } +#endif + +#if EIGEN_HAS_CXX11 + /** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&... args) + * + * Example: \include Matrix_variadic_ctor_cxx11.cpp + * Output: \verbinclude Matrix_variadic_ctor_cxx11.out + * + * \sa Matrix(const std::initializer_list>&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 + * + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Matrix_initializer_list_23_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_23_cxx11.out + * + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column vector, implicit transposition from a single row is allowed. + * Therefore VectorXd{{1,2,3,4,5}} is legal and the more verbose syntax + * RowVectorXd{{1},{2},{3},{4},{5}} can be avoided: + * + * Example: \include Matrix_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes, + * and implicit transposition is allowed for compile-time vectors only. + * + * \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE Matrix(const std::initializer_list>& list) : Base(list) {} +#endif // end EIGEN_HAS_CXX11 + +#ifndef EIGEN_PARSED_BY_DOXYGEN + + // This constructor is for both 1x1 matrices and dynamic vectors + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(const T& x) + { + Base::_check_template_params(); + Base::template _init1(x); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const T0& x, const T1& y) + { + Base::_check_template_params(); + Base::template _init2(x, y); + } + + +#else + /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC + explicit Matrix(const Scalar *data); + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * This is useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance, + * calling Matrix(1) will call the initialization constructor: Matrix(const Scalar&). + * For fixed-size \c 1x1 matrices it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim); + /** \brief Constructs an initialized 1x1 matrix with the given coefficient + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ + Matrix(const Scalar& x); + /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size matrices. For fixed-size matrices, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance, + * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y). + * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_DEVICE_FUNC + Matrix(Index rows, Index cols); + + /** \brief Constructs an initialized 2D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ + Matrix(const Scalar& x, const Scalar& y); + #endif // end EIGEN_PARSED_BY_DOXYGEN + + /** \brief Constructs an initialized 3D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + } + /** \brief Constructs an initialized 4D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + m_storage.data()[3] = w; + } + + + /** \brief Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other) + { } + + /** \brief Copy constructor for generic expressions. + * \sa MatrixBase::operator=(const EigenBase&) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const EigenBase &other) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } + + /////////// Geometry module /////////// + + template + EIGEN_DEVICE_FUNC + explicit Matrix(const RotationBase& r); + template + EIGEN_DEVICE_FUNC + Matrix& operator=(const RotationBase& r); + + // allow to extend Matrix outside Eigen + #ifdef EIGEN_MATRIX_PLUGIN + #include EIGEN_MATRIX_PLUGIN + #endif + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; +}; + +/** \defgroup matrixtypedefs Global matrix typedefs + * + * \ingroup Core_Module + * + * %Eigen defines several typedef shortcuts for most common matrix and vector types. + * + * The general patterns are the following: + * + * \c MatrixSizeType where \c Size can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, + * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd + * for complex double. + * + * For example, \c Matrix3d is a fixed-size 3x3 matrix type of doubles, and \c MatrixXf is a dynamic-size matrix of floats. + * + * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is + * a fixed-size vector of 4 complex floats. + * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `MatrixSize` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size. + * - `MatrixXSize` and `MatrixSizeX` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices. + * - `VectorSize` and `RowVectorSize` for column and row vectors. + * + * With \cpp11, you can also use fully generic column and row vector types: `Vector` and `RowVector`. + * + * \sa class Matrix + */ + +#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Vector##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##Size##X##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##X##Size##TypeSuffix; + +#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS + +#if EIGEN_HAS_CXX11 + +#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Vector##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using RowVector##SizeSuffix = Matrix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##Size##X = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##X##Size = Matrix; + +EIGEN_MAKE_TYPEDEFS(2, 2) +EIGEN_MAKE_TYPEDEFS(3, 3) +EIGEN_MAKE_TYPEDEFS(4, 4) +EIGEN_MAKE_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_FIXED_TYPEDEFS(2) +EIGEN_MAKE_FIXED_TYPEDEFS(3) +EIGEN_MAKE_FIXED_TYPEDEFS(4) + +/** \ingroup matrixtypedefs + * \brief \cpp11 */ +template +using Vector = Matrix; + +/** \ingroup matrixtypedefs + * \brief \cpp11 */ +template +using RowVector = Matrix; + +#undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS + +#endif // EIGEN_HAS_CXX11 + +} // end namespace Eigen + +#endif // EIGEN_MATRIX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/MatrixBase.h b/lib/eigen-3.4.0/Eigen/src/Core/MatrixBase.h new file mode 100644 index 0000000..45c3a59 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/MatrixBase.h @@ -0,0 +1,547 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIXBASE_H +#define EIGEN_MATRIXBASE_H + +namespace Eigen { + +/** \class MatrixBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and expressions + * + * This class is the base that is inherited by all matrix, vector, and related expression + * types. Most of the Eigen API is contained in this class, and its base classes. Other important + * classes for the Eigen API are Matrix, and VectorwiseOp. + * + * Note that some methods are defined in other modules such as the \ref LU_Module LU module + * for all functions related to matrix inversions. + * + * \tparam Derived is the derived type, e.g. a matrix type, or an expression, etc. + * + * When writing a function taking Eigen objects as argument, if you want your function + * to take as argument any matrix, vector, or expression, just let it take a + * MatrixBase argument. As an example, here is a function printFirstRow which, given + * a matrix, vector, or expression \a x, prints the first row of \a x. + * + * \code + template + void printFirstRow(const Eigen::MatrixBase& x) + { + cout << x.row(0) << endl; + } + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. + * + * \sa \blank \ref TopicClassHierarchy + */ +template class MatrixBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + typedef MatrixBase StorageBaseType; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + using Base::operator-; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType; + typedef typename Base::RowXpr RowXpr; + typedef typename Base::ColXpr ColXpr; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** type of the equivalent square matrix */ + typedef Matrix SquareMatrixType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** \returns the size of the main diagonal, which is min(rows(),cols()). + * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC + inline Index diagonalSize() const { return (numext::mini)(rows(),cols()); } + + typedef typename Base::PlainObject PlainObject; + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; + /** \internal the return type of MatrixBase::adjoint() */ + typedef typename internal::conditional::IsComplex, + CwiseUnaryOp, ConstTransposeReturnType>, + ConstTransposeReturnType + >::type AdjointReturnType; + /** \internal Return type of eigenvalues() */ + typedef Matrix, internal::traits::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; + /** \internal the return type of identity */ + typedef CwiseNullaryOp,PlainObject> IdentityReturnType; + /** \internal the return type of unit vectors */ + typedef Block, SquareMatrixType>, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime> BasisReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# ifdef EIGEN_MATRIXBASE_PLUGIN +# include EIGEN_MATRIXBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const MatrixBase& other); + + // We cannot inherit here via Base::operator= since it is causing + // trouble with MSVC. + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const EigenBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const ReturnByValue& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const MatrixBase& other); + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const MatrixBase& other); + + template + EIGEN_DEVICE_FUNC + const Product + operator*(const MatrixBase &other) const; + + template + EIGEN_DEVICE_FUNC + const Product + lazyProduct(const MatrixBase &other) const; + + template + Derived& operator*=(const EigenBase& other); + + template + void applyOnTheLeft(const EigenBase& other); + + template + void applyOnTheRight(const EigenBase& other); + + template + EIGEN_DEVICE_FUNC + const Product + operator*(const DiagonalBase &diagonal) const; + + template + EIGEN_DEVICE_FUNC + typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType + dot(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC RealScalar squaredNorm() const; + EIGEN_DEVICE_FUNC RealScalar norm() const; + RealScalar stableNorm() const; + RealScalar blueNorm() const; + RealScalar hypotNorm() const; + EIGEN_DEVICE_FUNC const PlainObject normalized() const; + EIGEN_DEVICE_FUNC const PlainObject stableNormalized() const; + EIGEN_DEVICE_FUNC void normalize(); + EIGEN_DEVICE_FUNC void stableNormalize(); + + EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const; + EIGEN_DEVICE_FUNC void adjointInPlace(); + + typedef Diagonal DiagonalReturnType; + EIGEN_DEVICE_FUNC + DiagonalReturnType diagonal(); + + typedef typename internal::add_const >::type ConstDiagonalReturnType; + EIGEN_DEVICE_FUNC + ConstDiagonalReturnType diagonal() const; + + template struct DiagonalIndexReturnType { typedef Diagonal Type; }; + template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; + + template + EIGEN_DEVICE_FUNC + typename DiagonalIndexReturnType::Type diagonal(); + + template + EIGEN_DEVICE_FUNC + typename ConstDiagonalIndexReturnType::Type diagonal() const; + + typedef Diagonal DiagonalDynamicIndexReturnType; + typedef typename internal::add_const >::type ConstDiagonalDynamicIndexReturnType; + + EIGEN_DEVICE_FUNC + DiagonalDynamicIndexReturnType diagonal(Index index); + EIGEN_DEVICE_FUNC + ConstDiagonalDynamicIndexReturnType diagonal(Index index) const; + + template struct TriangularViewReturnType { typedef TriangularView Type; }; + template struct ConstTriangularViewReturnType { typedef const TriangularView Type; }; + + template + EIGEN_DEVICE_FUNC + typename TriangularViewReturnType::Type triangularView(); + template + EIGEN_DEVICE_FUNC + typename ConstTriangularViewReturnType::Type triangularView() const; + + template struct SelfAdjointViewReturnType { typedef SelfAdjointView Type; }; + template struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView Type; }; + + template + EIGEN_DEVICE_FUNC + typename SelfAdjointViewReturnType::Type selfadjointView(); + template + EIGEN_DEVICE_FUNC + typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; + + const SparseView sparseView(const Scalar& m_reference = Scalar(0), + const typename NumTraits::Real& m_epsilon = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(); + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index size, Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitX(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitY(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitW(); + + EIGEN_DEVICE_FUNC + const DiagonalWrapper asDiagonal() const; + const PermutationWrapper asPermutation() const; + + EIGEN_DEVICE_FUNC + Derived& setIdentity(); + EIGEN_DEVICE_FUNC + Derived& setIdentity(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setUnit(Index i); + EIGEN_DEVICE_FUNC Derived& setUnit(Index newSize, Index i); + + bool isIdentity(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isDiagonal(const RealScalar& prec = NumTraits::dummy_precision()) const; + + bool isUpperTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isLowerTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + + template + bool isOrthogonal(const MatrixBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isUnitary(const RealScalar& prec = NumTraits::dummy_precision()) const; + + /** \returns true if each coefficients of \c *this and \a other are all exactly equal. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator!= */ + template + EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase& other) const + { return cwiseEqual(other).all(); } + + /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator== */ + template + EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase& other) const + { return cwiseNotEqual(other).any(); } + + NoAlias EIGEN_DEVICE_FUNC noalias(); + + // TODO forceAlignedAccess is temporarily disabled + // Need to find a nicer workaround. + inline const Derived& forceAlignedAccess() const { return derived(); } + inline Derived& forceAlignedAccess() { return derived(); } + template inline const Derived& forceAlignedAccessIf() const { return derived(); } + template inline Derived& forceAlignedAccessIf() { return derived(); } + + EIGEN_DEVICE_FUNC Scalar trace() const; + + template EIGEN_DEVICE_FUNC RealScalar lpNorm() const; + + EIGEN_DEVICE_FUNC MatrixBase& matrix() { return *this; } + EIGEN_DEVICE_FUNC const MatrixBase& matrix() const { return *this; } + + /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper array() { return ArrayWrapper(derived()); } + /** \returns a const \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArrayWrapper array() const { return ArrayWrapper(derived()); } + +/////////// LU module /////////// + + inline const FullPivLU fullPivLu() const; + inline const PartialPivLU partialPivLu() const; + + inline const PartialPivLU lu() const; + + EIGEN_DEVICE_FUNC + inline const Inverse inverse() const; + + template + inline void computeInverseAndDetWithCheck( + ResultType& inverse, + typename ResultType::Scalar& determinant, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + + template + inline void computeInverseWithCheck( + ResultType& inverse, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + + EIGEN_DEVICE_FUNC + Scalar determinant() const; + +/////////// Cholesky module /////////// + + inline const LLT llt() const; + inline const LDLT ldlt() const; + +/////////// QR module /////////// + + inline const HouseholderQR householderQr() const; + inline const ColPivHouseholderQR colPivHouseholderQr() const; + inline const FullPivHouseholderQR fullPivHouseholderQr() const; + inline const CompleteOrthogonalDecomposition completeOrthogonalDecomposition() const; + +/////////// Eigenvalues module /////////// + + inline EigenvaluesReturnType eigenvalues() const; + inline RealScalar operatorNorm() const; + +/////////// SVD module /////////// + + inline JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; + inline BDCSVD bdcSvd(unsigned int computationOptions = 0) const; + +/////////// Geometry module /////////// + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /// \internal helper struct to form the return type of the cross product + template struct cross_product_return_type { + typedef typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; + typedef Matrix type; + }; + #endif // EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC +#ifndef EIGEN_PARSED_BY_DOXYGEN + inline typename cross_product_return_type::type +#else + inline PlainObject +#endif + cross(const MatrixBase& other) const; + + template + EIGEN_DEVICE_FUNC + inline PlainObject cross3(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC + inline PlainObject unitOrthogonal(void) const; + + EIGEN_DEVICE_FUNC + inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; + + // put this as separate enum value to work around possible GCC 4.3 bug (?) + enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1&&RowsAtCompileTime==1 ? ((internal::traits::Flags&RowMajorBit)==RowMajorBit ? Horizontal : Vertical) + : ColsAtCompileTime==1 ? Vertical : Horizontal }; + typedef Homogeneous HomogeneousReturnType; + EIGEN_DEVICE_FUNC + inline HomogeneousReturnType homogeneous() const; + + enum { + SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 + }; + typedef Block::ColsAtCompileTime==1 ? SizeMinusOne : 1, + internal::traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; + typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType; + EIGEN_DEVICE_FUNC + inline const HNormalizedReturnType hnormalized() const; + +////////// Householder module /////////// + + EIGEN_DEVICE_FUNC + void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); + template + EIGEN_DEVICE_FUNC + void makeHouseholder(EssentialPart& essential, + Scalar& tau, RealScalar& beta) const; + template + EIGEN_DEVICE_FUNC + void applyHouseholderOnTheLeft(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + template + EIGEN_DEVICE_FUNC + void applyHouseholderOnTheRight(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + +///////// Jacobi module ///////// + + template + EIGEN_DEVICE_FUNC + void applyOnTheLeft(Index p, Index q, const JacobiRotation& j); + template + EIGEN_DEVICE_FUNC + void applyOnTheRight(Index p, Index q, const JacobiRotation& j); + +///////// SparseCore module ///////// + + template + EIGEN_STRONG_INLINE const typename SparseMatrixBase::template CwiseProductDenseReturnType::Type + cwiseProduct(const SparseMatrixBase &other) const + { + return other.cwiseProduct(derived()); + } + +///////// MatrixFunctions module ///////// + + typedef typename internal::stem_function::type StemFunction; +#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name() const; +#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name(Argument) const; + + EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential) + /** \brief Helper function for the unsupported MatrixFunctions module.*/ + const MatrixFunctionReturnValue matrixFunction(StemFunction f) const; + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine) +#if EIGEN_HAS_CXX11_MATH + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, atanh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, acosh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, asinh, inverse hyperbolic sine) +#endif + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine) + EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root) + EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm) + EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue, pow, power to \c p, const RealScalar& p) + EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex& p) + + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MatrixBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MatrixBase) + + private: + EIGEN_DEVICE_FUNC explicit MatrixBase(int); + EIGEN_DEVICE_FUNC MatrixBase(int,int); + template EIGEN_DEVICE_FUNC explicit MatrixBase(const MatrixBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} + // mixing arrays and matrices is not legal + template Derived& operator-=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} +}; + + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** replaces \c *this by \c *this * \a other. + * + * \returns a reference to \c *this + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline Derived& +MatrixBase::operator*=(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=(). + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline void MatrixBase::applyOnTheRight(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); +} + +/** replaces \c *this by \a other * \c *this. + * + * Example: \include MatrixBase_applyOnTheLeft.cpp + * Output: \verbinclude MatrixBase_applyOnTheLeft.out + */ +template +template +inline void MatrixBase::applyOnTheLeft(const EigenBase &other) +{ + other.derived().applyThisOnTheLeft(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_MATRIXBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/NestByValue.h b/lib/eigen-3.4.0/Eigen/src/Core/NestByValue.h new file mode 100644 index 0000000..b427576 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/NestByValue.h @@ -0,0 +1,85 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NESTBYVALUE_H +#define EIGEN_NESTBYVALUE_H + +namespace Eigen { + +namespace internal { +template +struct traits > : public traits +{ + enum { + Flags = traits::Flags & ~NestByRefBit + }; +}; +} + +/** \class NestByValue + * \ingroup Core_Module + * + * \brief Expression which must be nested by value + * + * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value + * + * This class is the return type of MatrixBase::nestByValue() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::nestByValue() + */ +template class NestByValue + : public internal::dense_xpr_base< NestByValue >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) + + EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } + + protected: + const ExpressionType m_expression; +}; + +/** \returns an expression of the temporary version of *this. + */ +template +EIGEN_DEVICE_FUNC inline const NestByValue +DenseBase::nestByValue() const +{ + return NestByValue(derived()); +} + +namespace internal { + +// Evaluator of Solve -> eval into a temporary +template +struct evaluator > + : public evaluator +{ + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue& xpr) + : Base(xpr.nestedExpression()) + {} +}; +} + +} // end namespace Eigen + +#endif // EIGEN_NESTBYVALUE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/NoAlias.h b/lib/eigen-3.4.0/Eigen/src/Core/NoAlias.h new file mode 100644 index 0000000..570283d --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/NoAlias.h @@ -0,0 +1,109 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NOALIAS_H +#define EIGEN_NOALIAS_H + +namespace Eigen { + +/** \class NoAlias + * \ingroup Core_Module + * + * \brief Pseudo expression providing an operator = assuming no aliasing + * + * \tparam ExpressionType the type of the object on which to do the lazy assignment + * + * This class represents an expression with special assignment operators + * assuming no aliasing between the target expression and the source expression. + * More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. + * It is the return type of MatrixBase::noalias() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::noalias() + */ +template class StorageBase> +class NoAlias +{ + public: + typedef typename ExpressionType::Scalar Scalar; + + EIGEN_DEVICE_FUNC + explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); + return m_expression; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); + return m_expression; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); + return m_expression; + } + + EIGEN_DEVICE_FUNC + ExpressionType& expression() const + { + return m_expression; + } + + protected: + ExpressionType& m_expression; +}; + +/** \returns a pseudo expression of \c *this with an operator= assuming + * no aliasing between \c *this and the source expression. + * + * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. + * Currently, even though several expressions may alias, only product + * expressions have this flag. Therefore, noalias() is only useful when + * the source expression contains a matrix product. + * + * Here are some examples where noalias is useful: + * \code + * D.noalias() = A * B; + * D.noalias() += A.transpose() * B; + * D.noalias() -= 2 * A * B.adjoint(); + * \endcode + * + * On the other hand the following example will lead to a \b wrong result: + * \code + * A.noalias() = A * B; + * \endcode + * because the result matrix A is also an operand of the matrix product. Therefore, + * there is no alternative than evaluating A * B in a temporary, that is the default + * behavior when you write: + * \code + * A = A * B; + * \endcode + * + * \sa class NoAlias + */ +template +NoAlias EIGEN_DEVICE_FUNC MatrixBase::noalias() +{ + return NoAlias(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_NOALIAS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/NumTraits.h b/lib/eigen-3.4.0/Eigen/src/Core/NumTraits.h new file mode 100644 index 0000000..72eac5a --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/NumTraits.h @@ -0,0 +1,335 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NUMTRAITS_H +#define EIGEN_NUMTRAITS_H + +namespace Eigen { + +namespace internal { + +// default implementation of digits10(), based on numeric_limits if specialized, +// 0 for integer types, and log10(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits10_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits10; } +}; + +template +struct default_digits10_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log10; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log10(NumTraits::epsilon()))); + } +}; + +template +struct default_digits10_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + + +// default implementation of digits(), based on numeric_limits if specialized, +// 0 for integer types, and log2(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits; } +}; + +template +struct default_digits_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log(NumTraits::epsilon())/log(static_cast(2)))); + } +}; + +template +struct default_digits_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + +} // end namespace internal + +namespace numext { +/** \internal bit-wise cast without changing the underlying bit representation. */ + +// TODO: Replace by std::bit_cast (available in C++20) +template +EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Tgt bit_cast(const Src& src) { +#if EIGEN_HAS_TYPE_TRAITS + // The behaviour of memcpy is not specified for non-trivially copyable types + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value, THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value && std::is_default_constructible::value, + THIS_TYPE_IS_NOT_SUPPORTED); +#endif + + EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED); + Tgt tgt; + EIGEN_USING_STD(memcpy) + memcpy(&tgt, &src, sizeof(Tgt)); + return tgt; +} +} // namespace numext + +/** \class NumTraits + * \ingroup Core_Module + * + * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. + * + * \tparam T the numeric type at hand + * + * This class stores enums, typedefs and static methods giving information about a numeric type. + * + * The provided data consists of: + * \li A typedef \c Real, giving the "real part" type of \a T. If \a T is already real, + * then \c Real is just a typedef to \a T. If \a T is \c std::complex then \c Real + * is a typedef to \a U. + * \li A typedef \c 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 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 \c Literal giving the type to use for numeric literals such as "2" or "0.5". For instance, for \c std::complex, Literal is defined as \c U. + * Of course, this type must be fully compatible with \a T. In doubt, just use \a T here. + * \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 + * this means, just use \a T here. + * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex + * type, and to 0 otherwise. + * \li An enum value \a IsInteger. It is equal to \c 1 if \a T is an integer type such as \c int, + * and to \c 0 otherwise. + * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed + * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. + * Stay vague here. No need to do architecture-specific stuff. If you don't know what this means, just use \c Eigen::HugeCost. + * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. + * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must + * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. + * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), + * it returns a \a Real instead of a \a T. + * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default + * value by the fuzzy comparison operators. + * \li highest() and lowest() functions returning the highest and lowest possible values respectively. + * \li digits() function returning the number of radix digits (non-sign digits for integers, mantissa for floating-point). This is + * the analogue of std::numeric_limits::digits + * which is used as the default implementation if specialized. + * \li digits10() function returning the number of decimal digits that can be represented without change. This is + * the analogue of std::numeric_limits::digits10 + * which is used as the default implementation if specialized. + * \li min_exponent() and max_exponent() functions returning the highest and lowest possible values, respectively, + * such that the radix raised to the power exponent-1 is a normalized floating-point number. These are equivalent to + * std::numeric_limits::min_exponent/ + * std::numeric_limits::max_exponent. + * \li infinity() function returning a representation of positive infinity, if available. + * \li quiet_NaN function returning a non-signaling "not-a-number", if available. + */ + +template struct GenericNumTraits +{ + enum { + IsInteger = std::numeric_limits::is_integer, + IsSigned = std::numeric_limits::is_signed, + IsComplex = 0, + RequireInitialization = internal::is_arithmetic::value ? 0 : 1, + ReadCost = 1, + AddCost = 1, + MulCost = 1 + }; + + typedef T Real; + typedef typename internal::conditional< + IsInteger, + typename internal::conditional::type, + T + >::type NonInteger; + typedef T Nested; + typedef T Literal; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real epsilon() + { + return numext::numeric_limits::epsilon(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() + { + return internal::default_digits10_impl::run(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits() + { + return internal::default_digits_impl::run(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int min_exponent() + { + return numext::numeric_limits::min_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int max_exponent() + { + return numext::numeric_limits::max_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real dummy_precision() + { + // make sure to override this for floating-point types + return Real(0); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T highest() { + return (numext::numeric_limits::max)(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T lowest() { + return IsInteger ? (numext::numeric_limits::min)() + : static_cast(-(numext::numeric_limits::max)()); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T infinity() { + return numext::numeric_limits::infinity(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T quiet_NaN() { + return numext::numeric_limits::quiet_NaN(); + } +}; + +template struct NumTraits : GenericNumTraits +{}; + +template<> struct NumTraits + : GenericNumTraits +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline float dummy_precision() { return 1e-5f; } +}; + +template<> struct NumTraits : GenericNumTraits +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline double dummy_precision() { return 1e-12; } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + EIGEN_CONSTEXPR + static inline long double dummy_precision() { return 1e-15l; } +}; + +template struct NumTraits > + : GenericNumTraits > +{ + typedef _Real Real; + typedef typename NumTraits<_Real>::Literal Literal; + enum { + IsComplex = 1, + RequireInitialization = NumTraits<_Real>::RequireInitialization, + ReadCost = 2 * NumTraits<_Real>::ReadCost, + AddCost = 2 * NumTraits::AddCost, + MulCost = 4 * NumTraits::MulCost + 2 * NumTraits::AddCost + }; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real dummy_precision() { return NumTraits::dummy_precision(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } +}; + +template +struct NumTraits > +{ + typedef Array ArrayType; + typedef typename NumTraits::Real RealScalar; + typedef Array Real; + typedef typename NumTraits::NonInteger NonIntegerScalar; + typedef Array NonInteger; + typedef ArrayType & Nested; + typedef typename NumTraits::Literal Literal; + + enum { + IsComplex = NumTraits::IsComplex, + IsInteger = NumTraits::IsInteger, + IsSigned = NumTraits::IsSigned, + RequireInitialization = 1, + ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::ReadCost), + AddCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::AddCost), + MulCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::MulCost) + }; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline RealScalar epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline RealScalar dummy_precision() { return NumTraits::dummy_precision(); } + + EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + enum { + RequireInitialization = 1, + ReadCost = HugeCost, + AddCost = HugeCost, + MulCost = HugeCost + }; + + EIGEN_CONSTEXPR + static inline int digits10() { return 0; } + +private: + static inline std::string epsilon(); + static inline std::string dummy_precision(); + static inline std::string lowest(); + static inline std::string highest(); + static inline std::string infinity(); + static inline std::string quiet_NaN(); +}; + +// Empty specialization for void to allow template specialization based on NumTraits::Real with T==void and SFINAE. +template<> struct NumTraits {}; + +template<> struct NumTraits : GenericNumTraits {}; + +} // end namespace Eigen + +#endif // EIGEN_NUMTRAITS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/PartialReduxEvaluator.h b/lib/eigen-3.4.0/Eigen/src/Core/PartialReduxEvaluator.h new file mode 100644 index 0000000..29abf35 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/PartialReduxEvaluator.h @@ -0,0 +1,232 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011-2018 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARTIALREDUX_H +#define EIGEN_PARTIALREDUX_H + +namespace Eigen { + +namespace internal { + + +/*************************************************************************** +* +* This file provides evaluators for partial reductions. +* There are two modes: +* +* - scalar path: simply calls the respective function on the column or row. +* -> nothing special here, all the tricky part is handled by the return +* types of VectorwiseOp's members. They embed the functor calling the +* respective DenseBase's member function. +* +* - vectorized path: implements a packet-wise reductions followed by +* some (optional) processing of the outcome, e.g., division by n for mean. +* +* For the vectorized path let's observe that the packet-size and outer-unrolling +* are both decided by the assignement logic. So all we have to do is to decide +* on the inner unrolling. +* +* For the unrolling, we can reuse "internal::redux_vec_unroller" from Redux.h, +* but be need to be careful to specify correct increment. +* +***************************************************************************/ + + +/* logic deciding a strategy for unrolling of vectorized paths */ +template +struct packetwise_redux_traits +{ + enum { + OuterSize = int(Evaluator::IsRowMajor) ? Evaluator::RowsAtCompileTime : Evaluator::ColsAtCompileTime, + Cost = OuterSize == Dynamic ? HugeCost + : OuterSize * Evaluator::CoeffReadCost + (OuterSize-1) * functor_traits::Cost, + Unrolling = Cost <= EIGEN_UNROLLING_LIMIT ? CompleteUnrolling : NoUnrolling + }; + +}; + +/* Value to be returned when size==0 , by default let's return 0 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const Func& ) { return pset1(0); } + +/* For products the default is 1 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const scalar_product_op& ) { return pset1(1); } + +/* Perform the actual reduction */ +template::Unrolling +> +struct packetwise_redux_impl; + +/* Perform the actual reduction with unrolling */ +template +struct packetwise_redux_impl +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + PacketType run(const Evaluator &eval, const Func& func, Index /*size*/) + { + return redux_vec_unroller::OuterSize>::template run(eval,func); + } +}; + +/* Add a specialization of redux_vec_unroller for size==0 at compiletime. + * This specialization is not required for general reductions, which is + * why it is defined here. + */ +template +struct redux_vec_unroller +{ + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &, const Func& f) + { + return packetwise_redux_empty_value(f); + } +}; + +/* Perform the actual reduction for dynamic sizes */ +template +struct packetwise_redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + template + EIGEN_DEVICE_FUNC + static PacketType run(const Evaluator &eval, const Func& func, Index size) + { + if(size==0) + return packetwise_redux_empty_value(func); + + const Index size4 = (size-1)&(~3); + PacketType p = eval.template packetByOuterInner(0,0); + Index i = 1; + // This loop is optimized for instruction pipelining: + // - each iteration generates two independent instructions + // - thanks to branch prediction and out-of-order execution we have independent instructions across loops + for(; i(i+0,0),eval.template packetByOuterInner(i+1,0)), + func.packetOp(eval.template packetByOuterInner(i+2,0),eval.template packetByOuterInner(i+3,0)))); + for(; i(i,0)); + return p; + } +}; + +template< typename ArgType, typename MemberOp, int Direction> +struct evaluator > + : evaluator_base > +{ + typedef PartialReduxExpr XprType; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::add_const_on_value_type::type ConstArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + typedef typename ArgType::Scalar InputScalar; + typedef typename XprType::Scalar Scalar; + enum { + TraversalSize = Direction==int(Vertical) ? int(ArgType::RowsAtCompileTime) : int(ArgType::ColsAtCompileTime) + }; + typedef typename MemberOp::template Cost CostOpType; + enum { + CoeffReadCost = TraversalSize==Dynamic ? HugeCost + : TraversalSize==0 ? 1 + : int(TraversalSize) * int(evaluator::CoeffReadCost) + int(CostOpType::value), + + _ArgFlags = evaluator::Flags, + + _Vectorizable = bool(int(_ArgFlags)&PacketAccessBit) + && bool(MemberOp::Vectorizable) + && (Direction==int(Vertical) ? bool(_ArgFlags&RowMajorBit) : (_ArgFlags&RowMajorBit)==0) + && (TraversalSize!=0), + + Flags = (traits::Flags&RowMajorBit) + | (evaluator::Flags&(HereditaryBits&(~RowMajorBit))) + | (_Vectorizable ? PacketAccessBit : 0) + | LinearAccessBit, + + Alignment = 0 // FIXME this will need to be improved once PartialReduxExpr is vectorized + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType xpr) + : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(TraversalSize==Dynamic ? HugeCost : (TraversalSize==0 ? 1 : int(CostOpType::value))); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index i, Index j) const + { + return coeff(Direction==Vertical ? j : i); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index index) const + { + return m_functor(m_arg.template subVector(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packet(Index i, Index j) const + { + return packet(Direction==Vertical ? j : i); + } + + template + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC + PacketType packet(Index idx) const + { + enum { PacketSize = internal::unpacket_traits::size }; + typedef Block PanelType; + + PanelType panel(m_arg, + Direction==Vertical ? 0 : idx, + Direction==Vertical ? idx : 0, + Direction==Vertical ? m_arg.rows() : Index(PacketSize), + Direction==Vertical ? Index(PacketSize) : m_arg.cols()); + + // FIXME + // See bug 1612, currently if PacketSize==1 (i.e. complex with 128bits registers) then the storage-order of panel get reversed + // and methods like packetByOuterInner do not make sense anymore in this context. + // So let's just by pass "vectorization" in this case: + if(PacketSize==1) + return internal::pset1(coeff(idx)); + + typedef typename internal::redux_evaluator PanelEvaluator; + PanelEvaluator panel_eval(panel); + typedef typename MemberOp::BinaryOp BinaryOp; + PacketType p = internal::packetwise_redux_impl::template run(panel_eval,m_functor.binaryFunc(),m_arg.outerSize()); + return p; + } + +protected: + ConstArgTypeNested m_arg; + const MemberOp m_functor; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PARTIALREDUX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/PermutationMatrix.h b/lib/eigen-3.4.0/Eigen/src/Core/PermutationMatrix.h new file mode 100644 index 0000000..69401bf --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/PermutationMatrix.h @@ -0,0 +1,605 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009-2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PERMUTATIONMATRIX_H +#define EIGEN_PERMUTATIONMATRIX_H + +namespace Eigen { + +namespace internal { + +enum PermPermProduct_t {PermPermProduct}; + +} // end namespace internal + +/** \class PermutationBase + * \ingroup Core_Module + * + * \brief Base class for permutations + * + * \tparam Derived the derived class + * + * This class is the base class for all expressions representing a permutation matrix, + * internally stored as a vector of integers. + * The convention followed here is that if \f$ \sigma \f$ is a permutation, the corresponding permutation matrix + * \f$ P_\sigma \f$ is such that if \f$ (e_1,\ldots,e_p) \f$ is the canonical basis, we have: + * \f[ P_\sigma(e_i) = e_{\sigma(i)}. \f] + * This convention ensures that for any two permutations \f$ \sigma, \tau \f$, we have: + * \f[ P_{\sigma\circ\tau} = P_\sigma P_\tau. \f] + * + * Permutation matrices are square and invertible. + * + * Notice that in addition to the member functions and operators listed here, there also are non-member + * operator* to multiply any kind of permutation object with any kind of matrix expression (MatrixBase) + * on either side. + * + * \sa class PermutationMatrix, class PermutationWrapper + */ +template +class PermutationBase : public EigenBase +{ + typedef internal::traits Traits; + typedef EigenBase Base; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + enum { + Flags = Traits::Flags, + RowsAtCompileTime = Traits::RowsAtCompileTime, + ColsAtCompileTime = Traits::ColsAtCompileTime, + MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + }; + typedef typename Traits::StorageIndex StorageIndex; + typedef Matrix + DenseMatrixType; + typedef PermutationMatrix + PlainPermutationType; + typedef PlainPermutationType PlainObject; + using Base::derived; + typedef Inverse InverseReturnType; + typedef void Scalar; + #endif + + /** Copies the other permutation into *this */ + template + Derived& operator=(const PermutationBase& other) + { + indices() = other.indices(); + return derived(); + } + + /** Assignment from the Transpositions \a tr */ + template + Derived& operator=(const TranspositionsBase& tr) + { + setIdentity(tr.size()); + for(Index k=size()-1; k>=0; --k) + applyTranspositionOnTheRight(k,tr.coeff(k)); + return derived(); + } + + /** \returns the number of rows */ + inline EIGEN_DEVICE_FUNC Index rows() const { return Index(indices().size()); } + + /** \returns the number of columns */ + inline EIGEN_DEVICE_FUNC Index cols() const { return Index(indices().size()); } + + /** \returns the size of a side of the respective square matrix, i.e., the number of indices */ + inline EIGEN_DEVICE_FUNC Index size() const { return Index(indices().size()); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (Index i=0; i=0 && j>=0 && i=0 && j>=0 && i + void assignTranspose(const PermutationBase& other) + { + for (Index i=0; i + void assignProduct(const Lhs& lhs, const Rhs& rhs) + { + eigen_assert(lhs.cols() == rhs.rows()); + for (Index i=0; i + inline PlainPermutationType operator*(const PermutationBase& other) const + { return PlainPermutationType(internal::PermPermProduct, derived(), other.derived()); } + + /** \returns the product of a permutation with another inverse permutation. + * + * \note \blank \note_try_to_help_rvo + */ + template + inline PlainPermutationType operator*(const InverseImpl& other) const + { return PlainPermutationType(internal::PermPermProduct, *this, other.eval()); } + + /** \returns the product of an inverse permutation with another permutation. + * + * \note \blank \note_try_to_help_rvo + */ + template friend + inline PlainPermutationType operator*(const InverseImpl& other, const PermutationBase& perm) + { return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); } + + /** \returns the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation. + * + * This function is O(\c n) procedure allocating a buffer of \c n booleans. + */ + Index determinant() const + { + Index res = 1; + Index n = size(); + Matrix mask(n); + mask.fill(false); + Index r = 0; + while(r < n) + { + // search for the next seed + while(r=n) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + mask.coeffRef(k0) = true; + for(Index k=indices().coeff(k0); k!=k0; k=indices().coeff(k)) + { + mask.coeffRef(k) = true; + res = -res; + } + } + return res; + } + + protected: + +}; + +namespace internal { +template +struct traits > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Matrix<_StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; +}; +} + +/** \class PermutationMatrix + * \ingroup Core_Module + * + * \brief Permutation matrix + * + * \tparam SizeAtCompileTime the number of rows/cols, or Dynamic + * \tparam MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. + * \tparam _StorageIndex the integer type of the indices + * + * This class represents a permutation matrix, internally stored as a vector of integers. + * + * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix + */ +template +class PermutationMatrix : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + typedef const PermutationMatrix& Nested; + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + typedef typename Traits::StorageIndex StorageIndex; + #endif + + inline PermutationMatrix() + {} + + /** Constructs an uninitialized permutation matrix of given size. + */ + explicit inline PermutationMatrix(Index size) : m_indices(size) + { + eigen_internal_assert(size <= NumTraits::highest()); + } + + /** Copy constructor. */ + template + inline PermutationMatrix(const PermutationBase& other) + : m_indices(other.indices()) {} + + /** Generic constructor from expression of the indices. The indices + * array has the meaning that the permutations sends each integer i to indices[i]. + * + * \warning It is your responsibility to check that the indices array that you passes actually + * describes a permutation, i.e., each value between 0 and n-1 occurs exactly once, where n is the + * array's size. + */ + template + explicit inline PermutationMatrix(const MatrixBase& indices) : m_indices(indices) + {} + + /** Convert the Transpositions \a tr to a permutation matrix */ + template + explicit PermutationMatrix(const TranspositionsBase& tr) + : m_indices(tr.size()) + { + *this = tr; + } + + /** Copies the other permutation into *this */ + template + PermutationMatrix& operator=(const PermutationBase& other) + { + m_indices = other.indices(); + return *this; + } + + /** Assignment from the Transpositions \a tr */ + template + PermutationMatrix& operator=(const TranspositionsBase& tr) + { + return Base::operator=(tr.derived()); + } + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + + /**** multiplication helpers to hopefully get RVO ****/ + +#ifndef EIGEN_PARSED_BY_DOXYGEN + template + PermutationMatrix(const InverseImpl& other) + : m_indices(other.derived().nestedExpression().size()) + { + eigen_internal_assert(m_indices.size() <= NumTraits::highest()); + StorageIndex end = StorageIndex(m_indices.size()); + for (StorageIndex i=0; i + PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs) + : m_indices(lhs.indices().size()) + { + Base::assignProduct(lhs,rhs); + } +#endif + + protected: + + IndicesType m_indices; +}; + + +namespace internal { +template +struct traits,_PacketAccess> > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Map, _PacketAccess> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; +}; +} + +template +class Map,_PacketAccess> + : public PermutationBase,_PacketAccess> > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + typedef typename IndicesType::Scalar StorageIndex; + #endif + + inline Map(const StorageIndex* indicesPtr) + : m_indices(indicesPtr) + {} + + inline Map(const StorageIndex* indicesPtr, Index size) + : m_indices(indicesPtr,size) + {} + + /** Copies the other permutation into *this */ + template + Map& operator=(const PermutationBase& other) + { return Base::operator=(other.derived()); } + + /** Assignment from the Transpositions \a tr */ + template + Map& operator=(const TranspositionsBase& tr) + { return Base::operator=(tr.derived()); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + Map& operator=(const Map& other) + { + m_indices = other.m_indices; + return *this; + } + #endif + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + protected: + + IndicesType m_indices; +}; + +template class TranspositionsWrapper; +namespace internal { +template +struct traits > +{ + typedef PermutationStorage StorageKind; + typedef void Scalar; + typedef typename _IndicesType::Scalar StorageIndex; + typedef _IndicesType IndicesType; + enum { + RowsAtCompileTime = _IndicesType::SizeAtCompileTime, + ColsAtCompileTime = _IndicesType::SizeAtCompileTime, + MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + Flags = 0 + }; +}; +} + +/** \class PermutationWrapper + * \ingroup Core_Module + * + * \brief Class to view a vector of integers as a permutation matrix + * + * \tparam _IndicesType the type of the vector of integer (can be any compatible expression) + * + * This class allows to view any vector expression of integers as a permutation matrix. + * + * \sa class PermutationBase, class PermutationMatrix + */ +template +class PermutationWrapper : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + #endif + + inline PermutationWrapper(const IndicesType& indices) + : m_indices(indices) + {} + + /** const version of indices(). */ + const typename internal::remove_all::type& + indices() const { return m_indices; } + + protected: + + typename IndicesType::Nested m_indices; +}; + + +/** \returns the matrix with the permutation applied to the columns. + */ +template +EIGEN_DEVICE_FUNC +const Product +operator*(const MatrixBase &matrix, + const PermutationBase& permutation) +{ + return Product + (matrix.derived(), permutation.derived()); +} + +/** \returns the matrix with the permutation applied to the rows. + */ +template +EIGEN_DEVICE_FUNC +const Product +operator*(const PermutationBase &permutation, + const MatrixBase& matrix) +{ + return Product + (permutation.derived(), matrix.derived()); +} + + +template +class InverseImpl + : public EigenBase > +{ + typedef typename PermutationType::PlainPermutationType PlainPermutationType; + typedef internal::traits PermTraits; + protected: + InverseImpl() {} + public: + typedef Inverse InverseType; + using EigenBase >::derived; + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename PermutationType::DenseMatrixType DenseMatrixType; + enum { + RowsAtCompileTime = PermTraits::RowsAtCompileTime, + ColsAtCompileTime = PermTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime + }; + #endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (Index i=0; i friend + const Product + operator*(const MatrixBase& matrix, const InverseType& trPerm) + { + return Product(matrix.derived(), trPerm.derived()); + } + + /** \returns the matrix with the inverse permutation applied to the rows. + */ + template + const Product + operator*(const MatrixBase& matrix) const + { + return Product(derived(), matrix.derived()); + } +}; + +template +const PermutationWrapper MatrixBase::asPermutation() const +{ + return derived(); +} + +namespace internal { + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PERMUTATIONMATRIX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/PlainObjectBase.h b/lib/eigen-3.4.0/Eigen/src/Core/PlainObjectBase.h new file mode 100644 index 0000000..e2ddbd1 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/PlainObjectBase.h @@ -0,0 +1,1128 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSESTORAGEBASE_H +#define EIGEN_DENSESTORAGEBASE_H + +#if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO) +# define EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(Index i=0;i::quiet_NaN(); +#else +# undef EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED +#endif + +namespace Eigen { + +namespace internal { + +template struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index, Index) + { + } +}; + +template<> struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols) + { + // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 + // we assume Index is signed + Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed + bool error = (rows == 0 || cols == 0) ? false + : (rows > max_index / cols); + if (error) + throw_std_bad_alloc(); + } +}; + +template +struct conservative_resize_like_impl; + +template struct matrix_swap_impl; + +} // end namespace internal + +#ifdef EIGEN_PARSED_BY_DOXYGEN +namespace doxygen { + +// This is a workaround to doxygen not being able to understand the inheritance logic +// when it is hidden by the dense_xpr_base helper struct. +// Moreover, doxygen fails to include members that are not documented in the declaration body of +// MatrixBase if we inherits MatrixBase >, +// this is why we simply inherits MatrixBase, though this does not make sense. + +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template struct dense_xpr_base_dispatcher; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public MatrixBase {}; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public ArrayBase {}; + +} // namespace doxygen + +/** \class PlainObjectBase + * \ingroup Core_Module + * \brief %Dense storage base class for matrices and arrays. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * + * \tparam Derived is the derived type, e.g., a Matrix or Array + * + * \sa \ref TopicClassHierarchy + */ +template +class PlainObjectBase : public doxygen::dense_xpr_base_dispatcher +#else +template +class PlainObjectBase : public internal::dense_xpr_base::type +#endif +{ + public: + enum { Options = internal::traits::Options }; + typedef typename internal::dense_xpr_base::type Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef Derived DenseType; + + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + typedef Eigen::Map MapType; + typedef const Eigen::Map ConstMapType; + typedef Eigen::Map AlignedMapType; + typedef const Eigen::Map ConstAlignedMapType; + template struct StridedMapType { typedef Eigen::Map type; }; + template struct StridedConstMapType { typedef Eigen::Map type; }; + template struct StridedAlignedMapType { typedef Eigen::Map type; }; + template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; + + protected: + DenseStorage m_storage; + + public: + enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits::Alignment>0) }; + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + + EIGEN_DEVICE_FUNC + Base& base() { return *static_cast(this); } + EIGEN_DEVICE_FUNC + const Base& base() const { return *static_cast(this); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_storage.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_storage.cols(); } + + /** This is an overloaded version of DenseCoeffsBase::coeff(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeff(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const + { + return m_storage.data()[index]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index,Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId) + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) + { + return m_storage.data()[index]; + } + + /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const + { + return m_storage.data()[index]; + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const + { + return internal::ploadt + (m_storage.data() + (Flags & RowMajorBit + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows())); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return internal::ploadt(m_storage.data() + index); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + internal::pstoret + (m_storage.data() + (Flags & RowMajorBit + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows()), val); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) + { + internal::pstoret(m_storage.data() + index, val); + } + + /** \returns a const pointer to the data array of this matrix */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar *data() const + { return m_storage.data(); } + + /** \returns a pointer to the data array of this matrix */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar *data() + { return m_storage.data(); } + + /** Resizes \c *this to a \a rows x \a cols matrix. + * + * This method is intended for dynamic-size matrices, although it is legal to call it on any + * matrix as long as fixed dimensions are left unchanged. If you only want to change the number + * of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t). + * + * If the current number of coefficients of \c *this exactly matches the + * product \a rows * \a cols, then no memory allocation is performed and + * the current values are left unchanged. In all other cases, including + * shrinking, the data is reallocated and all previous values are lost. + * + * Example: \include Matrix_resize_int_int.cpp + * Output: \verbinclude Matrix_resize_int_int.out + * + * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void resize(Index rows, Index cols) + { + eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime) + && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime) + && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."); + internal::check_rows_cols_for_overflow::run(rows, cols); + #ifdef EIGEN_INITIALIZE_COEFFS + Index size = rows*cols; + bool size_changed = size != this->size(); + m_storage.resize(size, rows, cols); + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + #else + m_storage.resize(rows*cols, rows, cols); + #endif + } + + /** Resizes \c *this to a vector of length \a size + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * Example: \include Matrix_resize_int.cpp + * Output: \verbinclude Matrix_resize_int.out + * + * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + EIGEN_DEVICE_FUNC + inline void resize(Index size) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) + eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0); + #ifdef EIGEN_INITIALIZE_COEFFS + bool size_changed = size != this->size(); + #endif + if(RowsAtCompileTime == 1) + m_storage.resize(size, 1, size); + else + m_storage.resize(size, size, 1); + #ifdef EIGEN_INITIALIZE_COEFFS + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + #endif + } + + /** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_NoChange_int.cpp + * Output: \verbinclude Matrix_resize_NoChange_int.out + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + inline void resize(NoChange_t, Index cols) + { + resize(rows(), cols); + } + + /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_int_NoChange.cpp + * Output: \verbinclude Matrix_resize_int_NoChange.out + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + inline void resize(Index rows, NoChange_t) + { + resize(rows, cols()); + } + + /** Resizes \c *this to have the same dimensions as \a other. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) + { + const OtherDerived& other = _other.derived(); + internal::check_rows_cols_for_overflow::run(other.rows(), other.cols()); + const Index othersize = other.rows()*other.cols(); + if(RowsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(1, othersize); + } + else if(ColsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(othersize, 1); + } + else resize(other.rows(), other.cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) + { + internal::conservative_resize_like_impl::run(*this, rows, cols); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of columns unchanged. + * + * In case the matrix is growing, new rows will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows, cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of rows unchanged. + * + * In case the matrix is growing, new columns will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows(), cols); + } + + /** Resizes the vector to \a size while retaining old values. + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * When values are appended, they will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index size) + { + internal::conservative_resize_like_impl::run(*this, size); + } + + /** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will copied from \c other. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase& other) + { + internal::conservative_resize_like_impl::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_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other) + { + return _set(other); + } + + /** \sa MatrixBase::lazyAssign() */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase& other) + { + _resize_to_match(other); + return Base::lazyAssign(other.derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue& func) + { + resize(func.rows(), func.cols()); + return Base::operator=(func); + } + + // Prevent user from trying to instantiate PlainObjectBase objects + // by making all its constructor protected. See bug 1074. + protected: + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() + { +// _check_template_params(); +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ? + /** \internal */ + EIGEN_DEVICE_FUNC + explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert) + : m_storage(internal::constructor_without_unaligned_array_assert()) + { +// _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } +#endif + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT + : m_storage( std::move(other.m_storage) ) + { + } + + EIGEN_DEVICE_FUNC + PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT + { + _check_template_params(); + m_storage = std::move(other.m_storage); + return *this; + } +#endif + + /** Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other) + : Base(), m_storage(other.m_storage) { } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) + : m_storage(size, rows, cols) + { +// _check_template_params(); +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + + #if EIGEN_HAS_CXX11 + /** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients. \cpp11 + * + * \only_for_vectors + * + * This constructor is for 1D array or vectors with more than 4 coefficients. + * There exists C++98 analogue constructors for fixed-size array/vector having 1, 2, 3, or 4 coefficients. + * + * \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this + * constructor must match the the fixed number of rows (resp. columns) of \c *this. + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : m_storage() + { + _check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4); + m_storage.data()[0] = a0; + m_storage.data()[1] = a1; + m_storage.data()[2] = a2; + m_storage.data()[3] = a3; + Index i = 4; + auto x = {(m_storage.data()[i++] = args, 0)...}; + static_cast(x); + } + + /** \brief Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer + * lists \cpp11 + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE PlainObjectBase(const std::initializer_list>& list) + : m_storage() + { + _check_template_params(); + + size_t list_size = 0; + if (list.begin() != list.end()) { + list_size = list.begin()->size(); + } + + // This is to allow syntax like VectorXi {{1, 2, 3, 4}} + if (ColsAtCompileTime == 1 && list.size() == 1) { + eigen_assert(list_size == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + resize(list_size, ColsAtCompileTime); + std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data()); + } else { + eigen_assert(list.size() == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + eigen_assert(list_size == static_cast(ColsAtCompileTime) || ColsAtCompileTime == Dynamic); + resize(list.size(), list_size); + + Index row_index = 0; + for (const std::initializer_list& row : list) { + eigen_assert(list_size == row.size()); + Index col_index = 0; + for (const Scalar& e : row) { + coeffRef(row_index, col_index) = e; + ++col_index; + } + ++row_index; + } + } + } + #endif // end EIGEN_HAS_CXX11 + + /** \sa PlainObjectBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase &other) + : m_storage() + { + _check_template_params(); + resizeLike(other); + _set_noalias(other); + } + + /** \sa PlainObjectBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) + : m_storage() + { + _check_template_params(); + resizeLike(other); + *this = other.derived(); + } + /** \brief Copy constructor with in-place evaluation */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue& other) + { + _check_template_params(); + // FIXME this does not automatically transpose vectors if necessary + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + public: + + /** \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) + { + _resize_to_match(other); + Base::operator=(other.derived()); + return this->derived(); + } + + /** \name Map + * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, + * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned + * \a data pointers. + * + * Here is an example using strides: + * \include Matrix_Map_stride.cpp + * Output: \verbinclude Matrix_Map_stride.out + * + * \see class Map + */ + //@{ + static inline ConstMapType Map(const Scalar* data) + { return ConstMapType(data); } + static inline MapType Map(Scalar* data) + { return MapType(data); } + static inline ConstMapType Map(const Scalar* data, Index size) + { return ConstMapType(data, size); } + static inline MapType Map(Scalar* data, Index size) + { return MapType(data, size); } + static inline ConstMapType Map(const Scalar* data, Index rows, Index cols) + { return ConstMapType(data, rows, cols); } + static inline MapType Map(Scalar* data, Index rows, Index cols) + { return MapType(data, rows, cols); } + + static inline ConstAlignedMapType MapAligned(const Scalar* data) + { return ConstAlignedMapType(data); } + static inline AlignedMapType MapAligned(Scalar* data) + { return AlignedMapType(data); } + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size) + { return ConstAlignedMapType(data, size); } + static inline AlignedMapType MapAligned(Scalar* data, Index size) + { return AlignedMapType(data, size); } + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) + { return ConstAlignedMapType(data, rows, cols); } + static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) + { return AlignedMapType(data, rows, cols); } + + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, const Stride& stride) + { return typename StridedConstMapType >::type(data, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, const Stride& stride) + { return typename StridedMapType >::type(data, stride); } + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstMapType >::type(data, size, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, Index size, const Stride& stride) + { return typename StridedMapType >::type(data, size, stride); } + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstMapType >::type(data, rows, cols, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedMapType >::type(data, rows, cols, stride); } + + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, stride); } + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, size, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index size, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, size, stride); } + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, rows, cols, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, rows, cols, stride); } + //@} + + using Base::setConstant; + EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(NoChange_t, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, NoChange_t, const Scalar& val); + + using Base::setZero; + EIGEN_DEVICE_FUNC Derived& setZero(Index size); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, NoChange_t); + + using Base::setOnes; + EIGEN_DEVICE_FUNC Derived& setOnes(Index size); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, NoChange_t); + + using Base::setRandom; + Derived& setRandom(Index size); + Derived& setRandom(Index rows, Index cols); + Derived& setRandom(NoChange_t, Index cols); + Derived& setRandom(Index rows, NoChange_t); + + #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN + #include EIGEN_PLAINOBJECTBASE_PLUGIN + #endif + + protected: + /** \internal Resizes *this in preparation for assigning \a other to it. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase& other) + { + #ifdef EIGEN_NO_AUTOMATIC_RESIZING + 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"); + EIGEN_ONLY_USED_FOR_DEBUG(other); + #else + resizeLike(other); + #endif + } + + /** + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + * + * \sa operator=(const MatrixBase&), _set_noalias() + * + * \internal + */ + // aliasing is dealt once in internal::call_assignment + // so at this stage we have to assume aliasing... and resising has to be done later. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& _set(const DenseBase& other) + { + internal::call_assignment(this->derived(), other.derived()); + return this->derived(); + } + + /** \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. + * + * \sa operator=(const MatrixBase&), _set() + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase& other) + { + // I don't think we need this resize call since the lazyAssign will anyways resize + // and lazyAssign will be called by the assign selector. + //_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. + internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op()); + return this->derived(); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) + { + const bool t0_is_integer_alike = internal::is_valid_index_type::value; + const bool t1_is_integer_alike = internal::is_valid_index_type::value; + EIGEN_STATIC_ASSERT(t0_is_integer_alike && + t1_is_integer_alike, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(rows,cols); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==2,T1>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array, + // then the argument is meant to be the size of the object. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(Index size, typename internal::enable_if< (Base::SizeAtCompileTime!=1 || !internal::is_convertible::value) + && ((!internal::is_same::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0) + { + // NOTE MSVC 2008 complains if we directly put bool(NumTraits::IsInteger) as the EIGEN_STATIC_ASSERT argument. + const bool is_integer_alike = internal::is_valid_index_type::value; + EIGEN_UNUSED_VARIABLE(is_integer_alike); + EIGEN_STATIC_ASSERT(is_integer_alike, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(size); + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitly converted) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if::value,T>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = val0; + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==1 + && internal::is_convertible::value,T*>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = Scalar(val0); + } + + // Initialize a fixed size matrix from a pointer to raw data + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar* data){ + this->_set_noalias(ConstMapType(data)); + } + + // Initialize an arbitrary matrix from a dense expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const DenseBase& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from an object convertible to the Derived type. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Derived& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from a generic Eigen expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const EigenBase& other){ + this->derived() = other; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const ReturnByValue& other) + { + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const RotationBase& r) + { + this->derived() = r; + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, + typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T>::type* = 0) + { + Base::setConstant(val0); + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T*>::type* = 0) + { + Base::setConstant(val0); + } + + template + friend struct internal::matrix_swap_impl; + + public: + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal + * \brief Override DenseBase::swap() since for dynamic-sized matrices + * of same type it is enough to swap the data pointers. + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase & other) + { + enum { SwapPointers = internal::is_same::value && Base::SizeAtCompileTime==Dynamic }; + internal::matrix_swap_impl::run(this->derived(), other.derived()); + } + + /** \internal + * \brief const version forwarded to DenseBase::swap + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase const & other) + { Base::swap(other.derived()); } + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void _check_template_params() + { + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (int(Options)&RowMajor)==RowMajor) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (int(Options)&RowMajor)==0) + && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) + && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) + && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) + && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0)) + && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic) + && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic) + && (Options & (DontAlign|RowMajor)) == Options), + INVALID_MATRIX_TEMPLATE_PARAMETERS) + } + + enum { IsPlainObjectBase = 1 }; +#endif + public: + // These apparently need to be down here for nvcc+icc to prevent duplicate + // Map symbol. + template friend class Eigen::Map; + friend class Eigen::Map; + friend class Eigen::Map; +#if EIGEN_MAX_ALIGN_BYTES>0 + // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice. + friend class Eigen::Map; + friend class Eigen::Map; +#endif +}; + +namespace internal { + +template +struct conservative_resize_like_impl +{ + #if EIGEN_HAS_TYPE_TRAITS + static const bool IsRelocatable = std::is_trivially_copyable::value; + #else + static const bool IsRelocatable = !NumTraits::RequireInitialization; + #endif + static void run(DenseBase& _this, Index rows, Index cols) + { + if (_this.rows() == rows && _this.cols() == cols) return; + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + + if ( IsRelocatable + && (( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == rows) )) // column-major and we change only the number of columns + { + internal::check_rows_cols_for_overflow::run(rows, cols); + _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); + } + else + { + // The storage order does not allow us to use reallocation. + Derived tmp(rows,cols); + const Index common_rows = numext::mini(rows, _this.rows()); + const Index common_cols = numext::mini(cols, _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + // Note: Here is space for improvement. Basically, for conservativeResize(Index,Index), + // neither RowsAtCompileTime or ColsAtCompileTime must be Dynamic. If only one of the + // dimensions is dynamic, one could use either conservativeResize(Index rows, NoChange_t) or + // conservativeResize(NoChange_t, Index cols). For these methods new static asserts like + // EIGEN_STATIC_ASSERT_DYNAMIC_ROWS and EIGEN_STATIC_ASSERT_DYNAMIC_COLS would be good. + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) + + if ( IsRelocatable && + (( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == other.rows()) )) // column-major and we change only the number of columns + { + const Index new_rows = other.rows() - _this.rows(); + const Index new_cols = other.cols() - _this.cols(); + _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols()); + if (new_rows>0) + _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows); + else if (new_cols>0) + _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols); + } + else + { + // The storage order does not allow us to use reallocation. + Derived tmp(other); + const Index common_rows = numext::mini(tmp.rows(), _this.rows()); + const Index common_cols = numext::mini(tmp.cols(), _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } +}; + +// Here, the specialization for vectors inherits from the general matrix case +// to allow calling .conservativeResize(rows,cols) on vectors. +template +struct conservative_resize_like_impl + : conservative_resize_like_impl +{ + typedef conservative_resize_like_impl Base; + using Base::run; + using Base::IsRelocatable; + + static void run(DenseBase& _this, Index size) + { + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; + const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1; + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + const Index num_new_elements = other.size() - _this.size(); + + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows(); + const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1; + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); + + if (num_new_elements > 0) + _this.tail(num_new_elements) = other.tail(num_new_elements); + } +}; + +template +struct matrix_swap_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(MatrixTypeA& a, MatrixTypeB& b) + { + a.base().swap(b); + } +}; + +template +struct matrix_swap_impl +{ + EIGEN_DEVICE_FUNC + static inline void run(MatrixTypeA& a, MatrixTypeB& b) + { + static_cast(a).m_storage.swap(static_cast(b).m_storage); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DENSESTORAGEBASE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Product.h b/lib/eigen-3.4.0/Eigen/src/Core/Product.h new file mode 100644 index 0000000..70a6c10 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Product.h @@ -0,0 +1,191 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PRODUCT_H +#define EIGEN_PRODUCT_H + +namespace Eigen { + +template class ProductImpl; + +namespace internal { + +template +struct traits > +{ + typedef typename remove_all::type LhsCleaned; + typedef typename remove_all::type RhsCleaned; + typedef traits LhsTraits; + typedef traits RhsTraits; + + typedef MatrixXpr XprKind; + + typedef typename ScalarBinaryOpTraits::Scalar, typename traits::Scalar>::ReturnType Scalar; + typedef typename product_promote_storage_type::ret>::ret StorageKind; + typedef typename promote_index_type::type StorageIndex; + + enum { + RowsAtCompileTime = LhsTraits::RowsAtCompileTime, + ColsAtCompileTime = RhsTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, + + // FIXME: only needed by GeneralMatrixMatrixTriangular + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), + + // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. + Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ( ((LhsTraits::Flags&NoPreferredStorageOrderBit) && (RhsTraits::Flags&RowMajorBit)) + || ((RhsTraits::Flags&NoPreferredStorageOrderBit) && (LhsTraits::Flags&RowMajorBit)) ) ? RowMajorBit + : NoPreferredStorageOrderBit + }; +}; + +} // end namespace internal + +/** \class Product + * \ingroup Core_Module + * + * \brief Expression of the product of two arbitrary matrices or vectors + * + * \tparam _Lhs the type of the left-hand side expression + * \tparam _Rhs the type of the right-hand side expression + * + * This class represents an expression of the product of two arbitrary matrices. + * + * The other template parameters are: + * \tparam Option can be DefaultProduct, AliasFreeProduct, or LazyProduct + * + */ +template +class Product : public ProductImpl<_Lhs,_Rhs,Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits<_Rhs>::StorageKind, + internal::product_type<_Lhs,_Rhs>::ret>::ret> +{ + public: + + typedef _Lhs Lhs; + typedef _Rhs Rhs; + + typedef typename ProductImpl< + Lhs, Rhs, Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + internal::product_type::ret>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Product) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) + { + eigen_assert(lhs.cols() == rhs.rows() + && "invalid matrix product" + && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const LhsNestedCleaned& lhs() const { return m_lhs; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const RhsNestedCleaned& rhs() const { return m_rhs; } + + protected: + + LhsNested m_lhs; + RhsNested m_rhs; +}; + +namespace internal { + +template::ret> +class dense_product_base + : public internal::dense_xpr_base >::type +{}; + +/** Conversion to scalar for inner-products */ +template +class dense_product_base + : public internal::dense_xpr_base >::type +{ + typedef Product ProductXpr; + typedef typename internal::dense_xpr_base::type Base; +public: + using Base::derived; + typedef typename Base::Scalar Scalar; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator const Scalar() const + { + return internal::evaluator(derived()).coeff(0,0); + } +}; + +} // namespace internal + +// Generic API dispatcher +template +class ProductImpl : public internal::generic_xpr_base, MatrixXpr, StorageKind>::type +{ + public: + typedef typename internal::generic_xpr_base, MatrixXpr, StorageKind>::type Base; +}; + +template +class ProductImpl + : public internal::dense_product_base +{ + typedef Product Derived; + + public: + + typedef typename internal::dense_product_base Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + protected: + enum { + IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) && + (ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic), + EnableCoeff = IsOneByOne || Option==LazyProduct + }; + + public: + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(row,col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index i) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(i); + } + + +}; + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ProductEvaluators.h b/lib/eigen-3.4.0/Eigen/src/Core/ProductEvaluators.h new file mode 100644 index 0000000..8cf294b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ProductEvaluators.h @@ -0,0 +1,1179 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2011 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_PRODUCTEVALUATORS_H +#define EIGEN_PRODUCTEVALUATORS_H + +namespace Eigen { + +namespace internal { + +/** \internal + * Evaluator of a product expression. + * Since products require special treatments to handle all possible cases, + * we simply defer the evaluation logic to a product_evaluator class + * which offers more partial specialization possibilities. + * + * \sa class product_evaluator + */ +template +struct evaluator > + : public product_evaluator > +{ + typedef Product XprType; + typedef product_evaluator Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B" +// TODO we should apply that rule only if that's really helpful +template +struct evaluator_assume_aliasing, + const CwiseNullaryOp, Plain1>, + const Product > > +{ + static const bool value = true; +}; +template +struct evaluator, + const CwiseNullaryOp, Plain1>, + const Product > > + : public evaluator > +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp, Plain1>, + const Product > XprType; + typedef evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) + {} +}; + + +template +struct evaluator, DiagIndex> > + : public evaluator, DiagIndex> > +{ + typedef Diagonal, DiagIndex> XprType; + typedef evaluator, DiagIndex> > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(Diagonal, DiagIndex>( + Product(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()), + xpr.index() )) + {} +}; + + +// Helper class to perform a matrix product with the destination at hand. +// Depending on the sizes of the factors, there are different evaluation strategies +// as controlled by internal::product_type. +template< typename Lhs, typename Rhs, + typename LhsShape = typename evaluator_traits::Shape, + typename RhsShape = typename evaluator_traits::Shape, + int ProductType = internal::product_type::value> +struct generic_product_impl; + +template +struct evaluator_assume_aliasing > { + static const bool value = true; +}; + +// This is the default evaluator implementation for products: +// It creates a temporary and call generic_product_impl +template +struct product_evaluator, ProductTag, LhsShape, RhsShape> + : public evaluator::PlainObject> +{ + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + +// FIXME shall we handle nested_eval here?, +// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in permutation_matrix_product, transposition_matrix_product, etc.) +// typedef typename internal::nested_eval::type LhsNested; +// typedef typename internal::nested_eval::type RhsNested; +// typedef typename internal::remove_all::type LhsNestedCleaned; +// typedef typename internal::remove_all::type RhsNestedCleaned; +// +// const LhsNested lhs(xpr.lhs()); +// const RhsNested rhs(xpr.rhs()); +// +// generic_product_impl::evalTo(m_result, lhs, rhs); + + generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); + } + +protected: + PlainObject m_result; +}; + +// The following three shortcuts are enabled only if the scalar types match exactly. +// TODO: we could enable them for different scalar types when the product is not vectorized. + +// Dense = Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + // FIXME shall we handle nested_eval here? + generic_product_impl::evalTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense += Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::add_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::addTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense -= Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::sub_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::subTo(dst, src.lhs(), src.rhs()); + } +}; + + +// Dense ?= scalar * Product +// TODO we should apply that rule if that's really helpful +// for instance, this is not good for inner products +template< typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis, typename Plain> +struct Assignment, const CwiseNullaryOp,Plain>, + const Product >, AssignFunc, Dense2Dense> +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp,Plain>, + const Product > SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const AssignFunc& func) + { + call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs())*src.rhs().rhs(), func); + } +}; + +//---------------------------------------- +// Catch "Dense ?= xpr + Product<>" expression to save one temporary +// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct assignment_from_xpr_op_product +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/) + { + call_assignment_no_alias(dst, src.lhs(), Func1()); + call_assignment_no_alias(dst, src.rhs(), Func2()); + } +}; + +#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2) \ + template< typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, typename SrcScalar, typename OtherScalar,typename ProdScalar> \ + struct Assignment, const OtherXpr, \ + const Product >, internal::ASSIGN_OP, Dense2Dense> \ + : assignment_from_xpr_op_product, internal::ASSIGN_OP, internal::ASSIGN_OP2 > \ + {} + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_sum_op,sub_assign_op); + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_difference_op,add_assign_op); + +//---------------------------------------- + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.coeffRef(0,0) -= (lhs.transpose().cwiseProduct(rhs)).sum(); } +}; + + +/*********************************************************************** +* Implementation of outer dense * dense vector product +***********************************************************************/ + +// Column major result +template +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&) +{ + evaluator rhsEval(rhs); + ei_declare_local_nested_eval(Lhs,lhs,Rhs::SizeAtCompileTime,actual_lhs); + // FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dst.cols(); + for (Index j=0; j +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&) +{ + evaluator lhsEval(lhs); + ei_declare_local_nested_eval(Rhs,rhs,Lhs::SizeAtCompileTime,actual_rhs); + // FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dst.rows(); + for (Index i=0; i +struct generic_product_impl +{ + template struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {}; + typedef typename Product::Scalar Scalar; + + // TODO it would be nice to be able to exploit our *_assign_op functors for that purpose + struct set { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; + struct add { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; + struct sub { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; + struct adds { + Scalar m_scale; + explicit adds(const Scalar& s) : m_scale(s) {} + template void EIGEN_DEVICE_FUNC operator()(const Dst& dst, const Src& src) const { + dst.const_cast_derived() += m_scale * src; + } + }; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major()); + } + +}; + + +// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo +template +struct generic_product_impl_base +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.setZero(); scaleAndAddTo(dst, lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst,lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst, lhs, rhs, Scalar(-1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { Derived::scaleAndAddTo(dst,lhs,rhs,alpha); } + +}; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename nested_eval::type LhsNested; + typedef typename nested_eval::type RhsNested; + typedef typename Product::Scalar Scalar; + enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; + typedef typename internal::remove_all::type>::type MatrixType; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + // Fallback to inner product if both the lhs and rhs is a runtime vector. + if (lhs.rows() == 1 && rhs.cols() == 1) { + dst.coeffRef(0,0) += alpha * lhs.row(0).conjugate().dot(rhs.col(0)); + return; + } + LhsNested actual_lhs(lhs); + RhsNested actual_rhs(rhs); + internal::gemv_dense_selector::HasUsableDirectAccess) + >::run(actual_lhs, actual_rhs, dst, alpha); + } +}; + +template +struct generic_product_impl +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // Same as: dst.noalias() = lhs.lazyProduct(rhs); + // but easier on the compiler side + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() += lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() -= lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op()); + } + + // This is a special evaluation path called from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h + // This variant tries to extract scalar multiples from both the LHS and RHS and factor them out. For instance: + // dst {,+,-}= (s1*A)*(B*s2) + // will be rewritten as: + // dst {,+,-}= (s1*s2) * (A.lazyProduct(B)) + // There are at least four benefits of doing so: + // 1 - huge performance gain for heap-allocated matrix types as it save costly allocations. + // 2 - it is faster than simply by-passing the heap allocation through stack allocation. + // 3 - it makes this fallback consistent with the heavy GEMM routine. + // 4 - it fully by-passes huge stack allocation attempts when multiplying huge fixed-size matrices. + // (see https://stackoverflow.com/questions/54738495) + // For small fixed sizes matrices, howver, the gains are less obvious, it is sometimes x2 faster, but sometimes x3 slower, + // and the behavior depends also a lot on the compiler... This is why this re-writting strategy is currently + // enabled only when falling back from the main GEMM. + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func &func) + { + enum { + HasScalarFactor = blas_traits::HasScalarFactor || blas_traits::HasScalarFactor, + ConjLhs = blas_traits::NeedToConjugate, + ConjRhs = blas_traits::NeedToConjugate + }; + // FIXME: in c++11 this should be auto, and extractScalarFactor should also return auto + // this is important for real*complex_mat + Scalar actualAlpha = combine_scalar_factors(lhs, rhs); + + eval_dynamic_impl(dst, + blas_traits::extract(lhs).template conjugateIf(), + blas_traits::extract(rhs).template conjugateIf(), + func, + actualAlpha, + typename conditional::type()); + } + +protected: + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s /* == 1 */, false_type) + { + EIGEN_UNUSED_VARIABLE(s); + eigen_internal_assert(s==Scalar(1)); + call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s, true_type) + { + call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func); + } +}; + +// This specialization enforces the use of a coefficient-based evaluation strategy +template +struct generic_product_impl + : generic_product_impl {}; + +// Case 2: Evaluate coeff by coeff +// +// This is mostly taken from CoeffBasedProduct.h +// The main difference is that we add an extra argument to the etor_product_*_impl::run() function +// for the inner dimension of the product, because evaluator object do not know their size. + +template +struct etor_product_coeff_impl; + +template +struct etor_product_packet_impl; + +template +struct product_evaluator, ProductTag, DenseShape, DenseShape> + : evaluator_base > +{ + typedef Product XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_lhs(xpr.lhs()), + m_rhs(xpr.rhs()), + m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that! + m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable them when not needed, + // or perhaps declare them on the fly on the packet method... We have experiment to check what's best. + m_innerDim(xpr.lhs().cols()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::AddCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); +#if 0 + std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n"; + std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n"; + std::cerr << "LhsAlignment= " << LhsAlignment << "\n"; + std::cerr << "RhsAlignment= " << RhsAlignment << "\n"; + std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n"; + std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n"; + std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n"; + std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n"; + std::cerr << "Alignment= " << Alignment << "\n"; + std::cerr << "Flags= " << Flags << "\n"; +#endif + } + + // Everything below here is taken from CoeffBasedProduct.h + + typedef typename internal::nested_eval::type LhsNested; + typedef typename internal::nested_eval::type RhsNested; + + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + typedef evaluator LhsEtorType; + typedef evaluator RhsEtorType; + + enum { + RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime, + ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime, + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime), + MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime + }; + + typedef typename find_best_packet::type LhsVecPacketType; + typedef typename find_best_packet::type RhsVecPacketType; + + enum { + + LhsCoeffReadCost = LhsEtorType::CoeffReadCost, + RhsCoeffReadCost = RhsEtorType::CoeffReadCost, + CoeffReadCost = InnerSize==0 ? NumTraits::ReadCost + : InnerSize == Dynamic ? HugeCost + : InnerSize * (NumTraits::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) + + (InnerSize - 1) * NumTraits::AddCost, + + Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT, + + LhsFlags = LhsEtorType::Flags, + RhsFlags = RhsEtorType::Flags, + + LhsRowMajor = LhsFlags & RowMajorBit, + RhsRowMajor = RhsFlags & RowMajorBit, + + LhsVecPacketSize = unpacket_traits::size, + RhsVecPacketSize = unpacket_traits::size, + + // Here, we don't care about alignment larger than the usable packet size. + LhsAlignment = EIGEN_PLAIN_ENUM_MIN(LhsEtorType::Alignment,LhsVecPacketSize*int(sizeof(typename LhsNestedCleaned::Scalar))), + RhsAlignment = EIGEN_PLAIN_ENUM_MIN(RhsEtorType::Alignment,RhsVecPacketSize*int(sizeof(typename RhsNestedCleaned::Scalar))), + + SameType = is_same::value, + + CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime!=1), + CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime!=1), + + EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : (bool(RhsRowMajor) && !CanVectorizeLhs), + + Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) + | (EvalToRowMajor ? RowMajorBit : 0) + // TODO enable vectorization for mixed types + | (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) + | (XprType::IsVectorAtCompileTime ? LinearAccessBit : 0), + + LhsOuterStrideBytes = int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)), + RhsOuterStrideBytes = int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)), + + Alignment = bool(CanVectorizeLhs) ? (LhsOuterStrideBytes<=0 || (int(LhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,LhsAlignment))!=0 ? 0 : LhsAlignment) + : bool(CanVectorizeRhs) ? (RhsOuterStrideBytes<=0 || (int(RhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,RhsAlignment))!=0 ? 0 : RhsAlignment) + : 0, + + /* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside + * of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner + * loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect + * the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI. + */ + CanVectorizeInner = SameType + && LhsRowMajor + && (!RhsRowMajor) + && (int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) + && (int(InnerSize) % packet_traits::size == 0) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + { + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + /* Allow index-based non-packet access. It is impossible though to allow index-based packed access, + * which is why we don't set the LinearAccessBit. + * TODO: this seems possible when the result is a vector + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index row, Index col) const + { + PacketType res; + typedef etor_product_packet_impl PacketImpl; + PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res); + return res; + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return packet(row,col); + } + +protected: + typename internal::add_const_on_value_type::type m_lhs; + typename internal::add_const_on_value_type::type m_rhs; + + LhsEtorType m_lhsImpl; + RhsEtorType m_rhsImpl; + + // TODO: Get rid of m_innerDim if known at compile time + Index m_innerDim; +}; + +template +struct product_evaluator, LazyCoeffBasedProductMode, DenseShape, DenseShape> + : product_evaluator, CoeffBasedProductMode, DenseShape, DenseShape> +{ + typedef Product XprType; + typedef Product BaseProduct; + typedef product_evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : Base(BaseProduct(xpr.lhs(),xpr.rhs())) + {} +}; + +/**************************************** +*** Coeff based product, Packet path *** +****************************************/ + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(pset1(lhs.coeff(row, Index(UnrollingIndex-1))), rhs.template packet(Index(UnrollingIndex-1), col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(lhs.template packet(row, Index(UnrollingIndex-1)), pset1(rhs.coeff(Index(UnrollingIndex-1), col)), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(pset1(lhs.coeff(row, Index(0))),rhs.template packet(Index(0), col)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(lhs.template packet(row, Index(0)), pset1(rhs.coeff(Index(0), col))); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(pset1(lhs.coeff(row, i)), rhs.template packet(i, col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(lhs.template packet(row, i), pset1(rhs.coeff(i, col)), res); + } +}; + + +/*************************************************************************** +* Triangular products +***************************************************************************/ +template +struct triangular_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl + ::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* SelfAdjoint products +***************************************************************************/ +template +struct selfadjoint_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC + void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* Diagonal products +***************************************************************************/ + +template +struct diagonal_product_evaluator_base + : evaluator_base +{ + typedef typename ScalarBinaryOpTraits::ReturnType Scalar; +public: + enum { + CoeffReadCost = int(NumTraits::MulCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost), + + MatrixFlags = evaluator::Flags, + DiagFlags = evaluator::Flags, + + _StorageOrder = (Derived::MaxRowsAtCompileTime==1 && Derived::MaxColsAtCompileTime!=1) ? RowMajor + : (Derived::MaxColsAtCompileTime==1 && Derived::MaxRowsAtCompileTime!=1) ? ColMajor + : MatrixFlags & RowMajorBit ? RowMajor : ColMajor, + _SameStorageOrder = _StorageOrder == (MatrixFlags & RowMajorBit ? RowMajor : ColMajor), + + _ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft) + ||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)), + _SameTypes = is_same::value, + // FIXME currently we need same types, but in the future the next rule should be the one + //_Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagFlags)&PacketAccessBit))), + _Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) + && _SameTypes + && (_SameStorageOrder || (MatrixFlags&LinearAccessBit)==LinearAccessBit) + && (_ScalarAccessOnDiag || (bool(int(DiagFlags)&PacketAccessBit))), + _LinearAccessMask = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0, + Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixFlags)) | (_Vectorizable ? PacketAccessBit : 0), + Alignment = evaluator::Alignment, + + AsScalarProduct = (DiagonalType::SizeAtCompileTime==1) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::RowsAtCompileTime==1 && ProductOrder==OnTheLeft) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==1 && ProductOrder==OnTheRight) + }; + + EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag) + : m_diagImpl(diag), m_matImpl(mat) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const + { + if(AsScalarProduct) + return m_diagImpl.coeff(0) * m_matImpl.coeff(idx); + else + return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx); + } + +protected: + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const + { + return internal::pmul(m_matImpl.template packet(row, col), + internal::pset1(m_diagImpl.coeff(id))); + } + + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const + { + enum { + InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, + DiagonalPacketLoadMode = EIGEN_PLAIN_ENUM_MIN(LoadMode,((InnerSize%16) == 0) ? int(Aligned16) : int(evaluator::Alignment)) // FIXME hardcoded 16!! + }; + return internal::pmul(m_matImpl.template packet(row, col), + m_diagImpl.template packet(id)); + } + + evaluator m_diagImpl; + evaluator m_matImpl; +}; + +// diagonal * dense +template +struct product_evaluator, ProductTag, DiagonalShape, DenseShape> + : diagonal_product_evaluator_base, OnTheLeft> +{ + typedef diagonal_product_evaluator_base, OnTheLeft> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef typename Lhs::DiagonalVectorType DiagonalType; + + + enum { StorageOrder = Base::_StorageOrder }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.rhs(), xpr.lhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + // FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case. + // See also similar calls below. + return this->template packet_impl(row,col, row, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +// dense * diagonal +template +struct product_evaluator, ProductTag, DenseShape, DiagonalShape> + : diagonal_product_evaluator_base, OnTheRight> +{ + typedef diagonal_product_evaluator_base, OnTheRight> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + + enum { StorageOrder = Base::_StorageOrder }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.lhs(), xpr.rhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + return this->template packet_impl(row,col, col, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +/*************************************************************************** +* Products with permutation matrices +***************************************************************************/ + +/** \internal + * \class permutation_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + * This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h + */ +template +struct permutation_matrix_product; + +template +struct permutation_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr) + { + MatrixType mat(xpr); + const Index n = Side==OnTheLeft ? mat.rows() : mat.cols(); + // FIXME we need an is_same for expression that is not sensitive to constness. For instance + // is_same_xpr, Block >::value should be true. + //if(is_same::value && extract_data(dst) == extract_data(mat)) + if(is_same_dense(dst, mat)) + { + // apply the permutation inplace + Matrix mask(perm.size()); + mask.fill(false); + Index r = 0; + while(r < perm.size()) + { + // search for the next seed + while(r=perm.size()) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + Index kPrev = k0; + mask.coeffRef(k0) = true; + for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k)) + { + Block(dst, k) + .swap(Block + (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); + + mask.coeffRef(k) = true; + kPrev = k; + } + } + } + else + { + for(Index i = 0; i < n; ++i) + { + Block + (dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i) + + = + + Block + (mat, ((Side==OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i); + } + } + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, rhs, lhs); + } +}; + +template +struct generic_product_impl, Rhs, PermutationShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Inverse& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, PermutationShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Inverse& rhs) + { + permutation_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + + +/*************************************************************************** +* Products with transpositions matrices +***************************************************************************/ + +// FIXME could we unify Transpositions and Permutation into a single "shape"?? + +/** \internal + * \class transposition_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + */ +template +struct transposition_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr, const ExpressionType& xpr) + { + MatrixType mat(xpr); + typedef typename TranspositionType::StorageIndex StorageIndex; + const Index size = tr.size(); + StorageIndex j = 0; + + if(!is_same_dense(dst,mat)) + dst = mat; + + for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, rhs, lhs); + } +}; + + +template +struct generic_product_impl, Rhs, TranspositionsShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Transpose& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, TranspositionsShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Transpose& rhs) + { + transposition_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_EVALUATORS_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Random.h b/lib/eigen-3.4.0/Eigen/src/Core/Random.h new file mode 100644 index 0000000..dab2ac8 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Random.h @@ -0,0 +1,218 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RANDOM_H +#define EIGEN_RANDOM_H + +namespace Eigen { + +namespace internal { + +template struct scalar_random_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op) + inline const Scalar operator() () const { return random(); } +}; + +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false, IsRepeatable = false }; }; + +} // end namespace internal + +/** \returns a random matrix expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * \not_reentrant + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used + * instead. + * + * + * Example: \include MatrixBase_random_int_int.cpp + * Output: \verbinclude MatrixBase_random_int_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * See DenseBase::NullaryExpr(Index, const CustomNullaryOp&) for an example using C++11 random generators. + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index), DenseBase::Random() + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random(Index rows, Index cols) +{ + return NullaryExpr(rows, cols, internal::scalar_random_op()); +} + +/** \returns a random vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * \not_reentrant + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Random() should be used + * instead. + * + * Example: \include MatrixBase_random_int.cpp + * Output: \verbinclude MatrixBase_random_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary vector whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random() + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random(Index size) +{ + return NullaryExpr(size, internal::scalar_random_op()); +} + +/** \returns a fixed-size random matrix or vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_random.cpp + * Output: \verbinclude MatrixBase_random.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random(Index) + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random() +{ + return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op()); +} + +/** Sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * Example: \include MatrixBase_setRandom.cpp + * Output: \verbinclude MatrixBase_setRandom.out + * + * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index) + */ +template +EIGEN_DEVICE_FUNC inline Derived& DenseBase::setRandom() +{ + return *this = Random(rows(), cols()); +} + +/** Resizes to the given \a newSize, and sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \only_for_vectors + * \not_reentrant + * + * Example: \include Matrix_setRandom_int.cpp + * Output: \verbinclude Matrix_setRandom_int.out + * + * \sa DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index newSize) +{ + resize(newSize); + return setRandom(); +} + +/** Resizes to the given size, and sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setRandom_int_int.cpp + * Output: \verbinclude Matrix_setRandom_int_int.out + * + * \sa DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, Index cols) +{ + resize(rows, cols); + return setRandom(); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(NoChange_t, Index cols) +{ + return setRandom(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, NoChange_t) +{ + return setRandom(rows, cols()); +} + +} // end namespace Eigen + +#endif // EIGEN_RANDOM_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Redux.h b/lib/eigen-3.4.0/Eigen/src/Core/Redux.h new file mode 100644 index 0000000..b6790d1 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Redux.h @@ -0,0 +1,515 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REDUX_H +#define EIGEN_REDUX_H + +namespace Eigen { + +namespace internal { + +// TODO +// * implement other kind of vectorization +// * factorize code + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for vectorization and unrolling +***************************************************************************/ + +template +struct redux_traits +{ +public: + typedef typename find_best_packet::type PacketType; + enum { + PacketSize = unpacket_traits::size, + InnerMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxColsAtCompileTime + : Evaluator::MaxRowsAtCompileTime, + OuterMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxRowsAtCompileTime + : Evaluator::MaxColsAtCompileTime, + SliceVectorizedWork = int(InnerMaxSize)==Dynamic ? Dynamic + : int(OuterMaxSize)==Dynamic ? (int(InnerMaxSize)>=int(PacketSize) ? Dynamic : 0) + : (int(InnerMaxSize)/int(PacketSize)) * int(OuterMaxSize) + }; + + enum { + MightVectorize = (int(Evaluator::Flags)&ActualPacketAccessBit) + && (functor_traits::PacketAccess), + MayLinearVectorize = bool(MightVectorize) && (int(Evaluator::Flags)&LinearAccessBit), + MaySliceVectorize = bool(MightVectorize) && (int(SliceVectorizedWork)==Dynamic || int(SliceVectorizedWork)>=3) + }; + +public: + enum { + Traversal = int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(DefaultTraversal) + }; + +public: + enum { + Cost = Evaluator::SizeAtCompileTime == Dynamic ? HugeCost + : int(Evaluator::SizeAtCompileTime) * int(Evaluator::CoeffReadCost) + (Evaluator::SizeAtCompileTime-1) * functor_traits::Cost, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize)) + }; + +public: + enum { + Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "Xpr: " << typeid(typename Evaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + EIGEN_DEBUG_VAR(Evaluator::Flags) + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(OuterMaxSize) + EIGEN_DEBUG_VAR(SliceVectorizedWork) + EIGEN_DEBUG_VAR(PacketSize) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(UnrollingLimit) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : unrollers +***************************************************************************/ + +/*** no vectorization ***/ + +template +struct redux_novec_unroller +{ + enum { + HalfLength = Length/2 + }; + + typedef typename Evaluator::Scalar Scalar; + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func& func) + { + return func(redux_novec_unroller::run(eval,func), + redux_novec_unroller::run(eval,func)); + } +}; + +template +struct redux_novec_unroller +{ + enum { + outer = Start / Evaluator::InnerSizeAtCompileTime, + inner = Start % Evaluator::InnerSizeAtCompileTime + }; + + typedef typename Evaluator::Scalar Scalar; + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func&) + { + return eval.coeffByOuterInner(outer, inner); + } +}; + +// This is actually dead code and will never be called. It is required +// to prevent false warnings regarding failed inlining though +// for 0 length run() will never be called at all. +template +struct redux_novec_unroller +{ + typedef typename Evaluator::Scalar Scalar; + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); } +}; + +/*** vectorization ***/ + +template +struct redux_vec_unroller +{ + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func& func) + { + enum { + PacketSize = unpacket_traits::size, + HalfLength = Length/2 + }; + + return func.packetOp( + redux_vec_unroller::template run(eval,func), + redux_vec_unroller::template run(eval,func) ); + } +}; + +template +struct redux_vec_unroller +{ + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func&) + { + enum { + PacketSize = unpacket_traits::size, + index = Start * PacketSize, + outer = index / int(Evaluator::InnerSizeAtCompileTime), + inner = index % int(Evaluator::InnerSizeAtCompileTime), + alignment = Evaluator::Alignment + }; + return eval.template packetByOuterInner(outer, inner); + } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +template::Traversal, + int Unrolling = redux_traits::Unrolling +> +struct redux_impl; + +template +struct redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) + { + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + Scalar res; + res = eval.coeffByOuterInner(0, 0); + for(Index i = 1; i < xpr.innerSize(); ++i) + res = func(res, eval.coeffByOuterInner(0, i)); + for(Index i = 1; i < xpr.outerSize(); ++i) + for(Index j = 0; j < xpr.innerSize(); ++j) + res = func(res, eval.coeffByOuterInner(i, j)); + return res; + } +}; + +template +struct redux_impl + : redux_novec_unroller +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& /*xpr*/) + { + return Base::run(eval,func); + } +}; + +template +struct redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + template + static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) + { + const Index size = xpr.size(); + + const Index packetSize = redux_traits::PacketSize; + const int packetAlignment = unpacket_traits::alignment; + enum { + alignment0 = (bool(Evaluator::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(packetAlignment) : int(Unaligned), + alignment = EIGEN_PLAIN_ENUM_MAX(alignment0, Evaluator::Alignment) + }; + const Index alignedStart = internal::first_default_aligned(xpr); + const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize); + const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize); + const Index alignedEnd2 = alignedStart + alignedSize2; + const Index alignedEnd = alignedStart + alignedSize; + Scalar res; + if(alignedSize) + { + PacketScalar packet_res0 = eval.template packet(alignedStart); + if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop + { + PacketScalar packet_res1 = eval.template packet(alignedStart+packetSize); + for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize) + { + packet_res0 = func.packetOp(packet_res0, eval.template packet(index)); + packet_res1 = func.packetOp(packet_res1, eval.template packet(index+packetSize)); + } + + packet_res0 = func.packetOp(packet_res0,packet_res1); + if(alignedEnd>alignedEnd2) + packet_res0 = func.packetOp(packet_res0, eval.template packet(alignedEnd2)); + } + res = func.predux(packet_res0); + + for(Index index = 0; index < alignedStart; ++index) + res = func(res,eval.coeff(index)); + + for(Index index = alignedEnd; index < size; ++index) + res = func(res,eval.coeff(index)); + } + else // too small to vectorize anything. + // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize. + { + res = eval.coeff(0); + for(Index index = 1; index < size; ++index) + res = func(res,eval.coeff(index)); + } + + return res; + } +}; + +// NOTE: for SliceVectorizedTraversal we simply bypass unrolling +template +struct redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketType; + + template + EIGEN_DEVICE_FUNC static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) + { + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + const Index innerSize = xpr.innerSize(); + const Index outerSize = xpr.outerSize(); + enum { + packetSize = redux_traits::PacketSize + }; + const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize; + Scalar res; + if(packetedInnerSize) + { + PacketType packet_res = eval.template packet(0,0); + for(Index j=0; j(j,i)); + + res = func.predux(packet_res); + for(Index j=0; j::run(eval, func, xpr); + } + + return res; + } +}; + +template +struct redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + + typedef typename redux_traits::PacketType PacketType; + enum { + PacketSize = redux_traits::PacketSize, + Size = Evaluator::SizeAtCompileTime, + VectorizedSize = (int(Size) / int(PacketSize)) * int(PacketSize) + }; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType &xpr) + { + EIGEN_ONLY_USED_FOR_DEBUG(xpr) + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + if (VectorizedSize > 0) { + Scalar res = func.predux(redux_vec_unroller::template run(eval,func)); + if (VectorizedSize != Size) + res = func(res,redux_novec_unroller::run(eval,func)); + return res; + } + else { + return redux_novec_unroller::run(eval,func); + } + } +}; + +// evaluator adaptor +template +class redux_evaluator : public internal::evaluator<_XprType> +{ + typedef internal::evaluator<_XprType> Base; +public: + typedef _XprType XprType; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit redux_evaluator(const XprType &xpr) : Base(xpr) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + typedef typename XprType::PacketScalar PacketScalar; + + enum { + MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = XprType::MaxColsAtCompileTime, + // TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime from the evaluator + Flags = Base::Flags & ~DirectAccessBit, + IsRowMajor = XprType::IsRowMajor, + SizeAtCompileTime = XprType::SizeAtCompileTime, + InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packetByOuterInner(Index outer, Index inner) const + { return Base::template packet(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + +}; + +} // end namespace internal + +/*************************************************************************** +* Part 4 : public API +***************************************************************************/ + + +/** \returns the result of a full redux operation on the whole matrix or vector using \a func + * + * The template parameter \a BinaryOp is the type of the functor \a func which must be + * an associative operator. Both current C++98 and C++11 functor styles are handled. + * + * \warning the matrix must be not empty, otherwise an assertion is triggered. + * + * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise() + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::redux(const Func& func) const +{ + eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix"); + + typedef typename internal::redux_evaluator ThisEvaluator; + ThisEvaluator thisEval(derived()); + + // The initial expression is passed to the reducer as an additional argument instead of + // passing it as a member of redux_evaluator to help + return internal::redux_impl::run(thisEval, func, derived()); +} + +/** \returns the minimum of all coefficients of \c *this. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is minimum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::minCoeff() const +{ + return derived().redux(Eigen::internal::scalar_min_op()); +} + +/** \returns the maximum of all coefficients of \c *this. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is maximum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::maxCoeff() const +{ + return derived().redux(Eigen::internal::scalar_max_op()); +} + +/** \returns the sum of all coefficients of \c *this + * + * If \c *this is empty, then the value 0 is returned. + * + * \sa trace(), prod(), mean() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::sum() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(0); + return derived().redux(Eigen::internal::scalar_sum_op()); +} + +/** \returns the mean of all coefficients of *this +* +* \sa trace(), prod(), sum() +*/ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::mean() const +{ +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + return Scalar(derived().redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif +} + +/** \returns the product of all coefficients of *this + * + * Example: \include MatrixBase_prod.cpp + * Output: \verbinclude MatrixBase_prod.out + * + * \sa sum(), mean(), trace() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::prod() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(1); + return derived().redux(Eigen::internal::scalar_product_op()); +} + +/** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal. + * + * \c *this can be any matrix, not necessarily square. + * + * \sa diagonal(), sum() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar +MatrixBase::trace() const +{ + return derived().diagonal().sum(); +} + +} // end namespace Eigen + +#endif // EIGEN_REDUX_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Ref.h b/lib/eigen-3.4.0/Eigen/src/Core/Ref.h new file mode 100644 index 0000000..c2a37ea --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Ref.h @@ -0,0 +1,381 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REF_H +#define EIGEN_REF_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : public traits > +{ + typedef _PlainObjectType PlainObjectType; + typedef _StrideType StrideType; + enum { + Options = _Options, + Flags = traits >::Flags | NestByRefBit, + Alignment = traits >::Alignment + }; + + template struct match { + enum { + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime, + HasDirectAccess = internal::has_direct_access::ret, + StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), + InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) + || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) + || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), + OuterStrideMatch = IsVectorAtCompileTime + || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), + // NOTE, this indirection of evaluator::Alignment is needed + // to workaround a very strange bug in MSVC related to the instantiation + // of has_*ary_operator in evaluator. + // This line is surprisingly very sensitive. For instance, simply adding parenthesis + // as "DerivedAlignment = (int(evaluator::Alignment))," will make MSVC fail... + DerivedAlignment = int(evaluator::Alignment), + AlignmentMatch = (int(traits::Alignment)==int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should be replaced by the required alignment + ScalarTypeMatch = internal::is_same::value, + MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch + }; + typedef typename internal::conditional::type type; + }; + +}; + +template +struct traits > : public traits {}; + +} + +template class RefBase + : public MapBase +{ + typedef typename internal::traits::PlainObjectType PlainObjectType; + typedef typename internal::traits::StrideType StrideType; + +public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + EIGEN_DEVICE_FUNC RefBase() + : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), + // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: + m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, + StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) + {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) + +protected: + + typedef Stride StrideBase; + + // Resolves inner stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner) { + return inner == 0 ? 1 : inner; + } + + // Resolves outer stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) { + return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer; + } + + // Returns true if construction is valid, false if there is a stride mismatch, + // and fails if there is a size mismatch. + template + EIGEN_DEVICE_FUNC bool construct(Expression& expr) + { + // Check matrix sizes. If this is a compile-time vector, we do allow + // implicitly transposing. + EIGEN_STATIC_ASSERT( + EIGEN_PREDICATE_SAME_MATRIX_SIZE(PlainObjectType, Expression) + // If it is a vector, the transpose sizes might match. + || ( PlainObjectType::IsVectorAtCompileTime + && ((int(PlainObjectType::RowsAtCompileTime)==Eigen::Dynamic + || int(Expression::ColsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::RowsAtCompileTime)==int(Expression::ColsAtCompileTime)) + && (int(PlainObjectType::ColsAtCompileTime)==Eigen::Dynamic + || int(Expression::RowsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::ColsAtCompileTime)==int(Expression::RowsAtCompileTime)))), + YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES + ) + + // Determine runtime rows and columns. + Index rows = expr.rows(); + Index cols = expr.cols(); + if(PlainObjectType::RowsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + rows = 1; + cols = expr.size(); + } + else if(PlainObjectType::ColsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + rows = expr.size(); + cols = 1; + } + // Verify that the sizes are valid. + eigen_assert( + (PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows)); + eigen_assert( + (PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols)); + + + // If this is a vector, we might be transposing, which means that stride should swap. + const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows()); + // If the storage format differs, we also need to swap the stride. + const bool row_major = ((PlainObjectType::Flags)&RowMajorBit) != 0; + const bool expr_row_major = (Expression::Flags&RowMajorBit) != 0; + const bool storage_differs = (row_major != expr_row_major); + + const bool swap_stride = (transpose != storage_differs); + + // Determine expr's actual strides, resolving any defaults if zero. + const Index expr_inner_actual = resolveInnerStride(expr.innerStride()); + const Index expr_outer_actual = resolveOuterStride(expr_inner_actual, + expr.outerStride(), + expr.rows(), + expr.cols(), + Expression::IsVectorAtCompileTime != 0, + expr_row_major); + + // If this is a column-major row vector or row-major column vector, the inner-stride + // is arbitrary, so set it to either the compile-time inner stride or 1. + const bool row_vector = (rows == 1); + const bool col_vector = (cols == 1); + const Index inner_stride = + ( (!row_major && row_vector) || (row_major && col_vector) ) ? + ( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1) + : swap_stride ? expr_outer_actual : expr_inner_actual; + + // If this is a column-major column vector or row-major row vector, the outer-stride + // is arbitrary, so set it to either the compile-time outer stride or vector size. + const Index outer_stride = + ( (!row_major && col_vector) || (row_major && row_vector) ) ? + ( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride) + : swap_stride ? expr_inner_actual : expr_outer_actual; + + // Check if given inner/outer strides are compatible with compile-time strides. + const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic) + || (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride); + if (!inner_valid) { + return false; + } + + const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic) + || (resolveOuterStride( + inner_stride, + Index(StrideType::OuterStrideAtCompileTime), + rows, cols, PlainObjectType::IsVectorAtCompileTime != 0, + row_major) + == outer_stride); + if (!outer_valid) { + return false; + } + + ::new (static_cast(this)) Base(expr.data(), rows, cols); + ::new (&m_stride) StrideBase( + (StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride, + (StrideType::InnerStrideAtCompileTime == 0) ? 0 : inner_stride ); + return true; + } + + StrideBase m_stride; +}; + +/** \class Ref + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing expression + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam Options specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), + * but accepts a variable outer stride (leading dimension). + * This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class provides a way to write non-template functions taking Eigen objects as parameters while limiting the number of copies. + * A Ref<> object can represent either a const expression or a l-value: + * \code + * // in-out argument: + * void foo1(Ref x); + * + * // read-only const argument: + * void foo2(const Ref& x); + * \endcode + * + * In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. + * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. + * Likewise, a Ref can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with + * the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension) + * can be greater than the number of rows. + * + * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. + * Here are some examples: + * \code + * MatrixXf A; + * VectorXf a; + * foo1(a.head()); // OK + * foo1(A.col()); // OK + * foo1(A.row()); // Compilation error because here innerstride!=1 + * foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object + * foo2(A.row().transpose()); // The row is copied into a contiguous temporary + * foo2(2*a); // The expression is evaluated into a temporary + * foo2(A.col().segment(2,4)); // No temporary + * \endcode + * + * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters. + * Here is an example accepting an innerstride!=1: + * \code + * // in-out argument: + * void foo3(Ref > x); + * foo3(A.row()); // OK + * \endcode + * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more + * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a + * template function, e.g.: + * \code + * // in the .h: + * void foo(const Ref& A); + * void foo(const Ref >& A); + * + * // in the .cpp: + * template void foo_impl(const TypeOfA& A) { + * ... // crazy code goes here + * } + * void foo(const Ref& A) { foo_impl(A); } + * void foo(const Ref >& A) { foo_impl(A); } + * \endcode + * + * See also the following stackoverflow questions for further references: + * - Correct usage of the Eigen::Ref<> class + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ +template class Ref + : public RefBase > +{ + private: + typedef internal::traits Traits; + template + EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0); + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC inline Ref(PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + { + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + // Construction must pass since we will not create temprary storage in the non-const case. + const bool success = Base::construct(expr.derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); + } + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + #else + /** Implicit constructor from any dense expression */ + template + inline Ref(DenseBase& expr) + #endif + { + EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + // Construction must pass since we will not create temporary storage in the non-const case. + const bool success = Base::construct(expr.const_cast_derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) + +}; + +// this is the const ref version +template class Ref + : public RefBase > +{ + typedef internal::traits Traits; + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::ScalarTypeMatch),Derived>::type* = 0) + { +// std::cout << match_helper::HasDirectAccess << "," << match_helper::OuterStrideMatch << "," << match_helper::InnerStrideMatch << "\n"; +// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; +// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; + construct(expr.derived(), typename Traits::template match::type()); + } + + EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) { + // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy + } + + template + EIGEN_DEVICE_FUNC inline Ref(const RefBase& other) { + construct(other.derived(), typename Traits::template match::type()); + } + + protected: + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr,internal::true_type) + { + // Check if we can use the underlying expr's storage directly, otherwise call the copy version. + if (!Base::construct(expr)) { + construct(expr, internal::false_type()); + } + } + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) + { + internal::call_assignment_no_alias(m_object,expr,internal::assign_op()); + Base::construct(m_object); + } + + protected: + TPlainObjectType m_object; +}; + +} // end namespace Eigen + +#endif // EIGEN_REF_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Replicate.h b/lib/eigen-3.4.0/Eigen/src/Core/Replicate.h new file mode 100644 index 0000000..ab5be7e --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Replicate.h @@ -0,0 +1,142 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REPLICATE_H +#define EIGEN_REPLICATE_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic + ? Dynamic + : RowFactor * MatrixType::RowsAtCompileTime, + ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic + ? Dynamic + : ColFactor * MatrixType::ColsAtCompileTime, + //FIXME we don't propagate the max sizes !!! + MaxRowsAtCompileTime = RowsAtCompileTime, + MaxColsAtCompileTime = ColsAtCompileTime, + IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 + : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 + : (MatrixType::Flags & RowMajorBit) ? 1 : 0, + + // FIXME enable DirectAccess with negative strides? + Flags = IsRowMajor ? RowMajorBit : 0 + }; +}; +} + +/** + * \class Replicate + * \ingroup Core_Module + * + * \brief Expression of the multiple replication of a matrix or vector + * + * \tparam MatrixType the type of the object we are replicating + * \tparam RowFactor number of repetitions at compile time along the vertical direction, can be Dynamic. + * \tparam ColFactor number of repetitions at compile time along the horizontal direction, can be Dynamic. + * + * This class represents an expression of the multiple replication of a matrix or vector. + * It is the return type of DenseBase::replicate() and most of the time + * this is the only way it is used. + * + * \sa DenseBase::replicate() + */ +template class Replicate + : public internal::dense_xpr_base< Replicate >::type +{ + typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; + typedef typename internal::traits::_MatrixTypeNested _MatrixTypeNested; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) + typedef typename internal::remove_all::type NestedExpression; + + template + EIGEN_DEVICE_FUNC + inline explicit Replicate(const OriginalMatrixType& matrix) + : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic); + } + + template + EIGEN_DEVICE_FUNC + inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) + : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } + + EIGEN_DEVICE_FUNC + const _MatrixTypeNested& nestedExpression() const + { + return m_matrix; + } + + protected: + MatrixTypeNested m_matrix; + const internal::variable_if_dynamic m_rowFactor; + const internal::variable_if_dynamic m_colFactor; +}; + +/** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate.cpp + * Output: \verbinclude MatrixBase_replicate.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(Index,Index), class Replicate + */ +template +template +EIGEN_DEVICE_FUNC const Replicate +DenseBase::replicate() const +{ + return Replicate(derived()); +} + +/** + * \return an expression of the replication of each column (or row) of \c *this + * + * Example: \include DirectionWise_replicate_int.cpp + * Output: \verbinclude DirectionWise_replicate_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ +template +EIGEN_DEVICE_FUNC const typename VectorwiseOp::ReplicateReturnType +VectorwiseOp::replicate(Index factor) const +{ + return typename VectorwiseOp::ReplicateReturnType + (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1); +} + +} // end namespace Eigen + +#endif // EIGEN_REPLICATE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Reshaped.h b/lib/eigen-3.4.0/Eigen/src/Core/Reshaped.h new file mode 100644 index 0000000..52de73b --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Reshaped.h @@ -0,0 +1,454 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2017 Gael Guennebaud +// Copyright (C) 2014 yoco +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RESHAPED_H +#define EIGEN_RESHAPED_H + +namespace Eigen { + +/** \class Reshaped + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size reshape + * + * \tparam XprType the type of the expression in which we are taking a reshape + * \tparam Rows the number of rows of the reshape we are taking at compile time (optional) + * \tparam Cols the number of columns of the reshape we are taking at compile time (optional) + * \tparam Order can be ColMajor or RowMajor, default is ColMajor. + * + * This class represents an expression of either a fixed-size or dynamic-size reshape. + * It is the return type of DenseBase::reshaped(NRowsType,NColsType) and + * most of the time this is the only way it is used. + * + * However, in C++98, if you want to directly maniputate reshaped expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. In C++11, it is advised to use the \em auto + * keyword for such use cases. + * + * Here is an example illustrating the dynamic case: + * \include class_Reshaped.cpp + * Output: \verbinclude class_Reshaped.out + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedReshaped.cpp + * Output: \verbinclude class_FixedReshaped.out + * + * \sa DenseBase::reshaped(NRowsType,NColsType) + */ + +namespace internal { + +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = Rows, + ColsAtCompileTime = Cols, + MaxRowsAtCompileTime = Rows, + MaxColsAtCompileTime = Cols, + XpxStorageOrder = ((int(traits::Flags) & RowMajorBit) == RowMajorBit) ? RowMajor : ColMajor, + ReshapedStorageOrder = (RowsAtCompileTime == 1 && ColsAtCompileTime != 1) ? RowMajor + : (ColsAtCompileTime == 1 && RowsAtCompileTime != 1) ? ColMajor + : XpxStorageOrder, + HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder), + InnerSize = (ReshapedStorageOrder==int(RowMajor)) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(inner_stride_at_compile_time::ret) + : Dynamic, + OuterStrideAtCompileTime = Dynamic, + + HasDirectAccess = internal::has_direct_access::ret + && (Order==int(XpxStorageOrder)) + && ((evaluator::Flags&LinearAccessBit)==LinearAccessBit), + + MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) + && (InnerStrideAtCompileTime == 1) + ? PacketAccessBit : 0, + //MaskAlignedBit = ((OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = (ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | MaskPacketAccessBit), + + Flags = (Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit | FlagsDirectAccessBit) + }; +}; + +template class ReshapedImpl_dense; + +} // end namespace internal + +template class ReshapedImpl; + +template class Reshaped + : public ReshapedImpl::StorageKind> +{ + typedef ReshapedImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Reshaped) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reshaped) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr) + : Impl(xpr) + { + EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) + eigen_assert(Rows * Cols == xpr.rows() * xpr.cols()); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr, + Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==reshapeRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==reshapeCols)); + eigen_assert(reshapeRows * reshapeCols == xpr.rows() * xpr.cols()); + } +}; + +// The generic default implementation for dense reshape simply forward to the internal::ReshapedImpl_dense +// that must be specialized for direct and non-direct access... +template +class ReshapedImpl + : public internal::ReshapedImpl_dense >::HasDirectAccess> +{ + typedef internal::ReshapedImpl_dense >::HasDirectAccess> Impl; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl) + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr) : Impl(xpr) {} + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr, Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Reshaped in the general case. */ +template +class ReshapedImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Reshaped ReshapedType; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + class InnerIterator; + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : m_xpr(xpr), m_rows(Rows), m_cols(Cols) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : m_xpr(xpr), m_rows(nRows), m_cols(nCols) + {} + + EIGEN_DEVICE_FUNC Index rows() const { return m_rows; } + EIGEN_DEVICE_FUNC Index cols() const { return m_cols; } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; + #endif + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + typename internal::remove_reference::type& + nestedExpression() { return m_xpr; } + + protected: + + MatrixTypeNested m_xpr; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + + +/** \internal Internal implementation of dense Reshaped in the direct access case. */ +template +class ReshapedImpl_dense + : public MapBase > +{ + typedef Reshaped ReshapedType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : Base(xpr.data()), m_xpr(xpr) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : Base(xpr.data(), nRows, nCols), + m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC + XprType& nestedExpression() { return m_xpr; } + + /** \sa MapBase::innerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const + { + return m_xpr.innerStride(); + } + + /** \sa MapBase::outerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const + { + return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows(); + } + + protected: + + XprTypeNested m_xpr; +}; + +// Evaluators +template struct reshaped_evaluator; + +template +struct evaluator > + : reshaped_evaluator >::HasDirectAccess> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + HasDirectAccess = traits::HasDirectAccess, + +// RowsAtCompileTime = traits::RowsAtCompileTime, +// ColsAtCompileTime = traits::ColsAtCompileTime, +// MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, +// MaxColsAtCompileTime = traits::MaxColsAtCompileTime, +// +// InnerStrideAtCompileTime = traits::HasSameStorageOrderAsXprType +// ? int(inner_stride_at_compile_time::ret) +// : Dynamic, +// OuterStrideAtCompileTime = Dynamic, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1 || HasDirectAccess) ? LinearAccessBit : 0, + FlagsRowMajorBit = (traits::ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = evaluator::Flags & (HereditaryBits & ~RowMajorBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit | FlagsDirectAccessBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment = evaluator::Alignment + }; + typedef reshaped_evaluator reshaped_evaluator_type; + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : reshaped_evaluator_type(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +template +struct reshaped_evaluator + : evaluator_base > +{ + typedef Reshaped XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of index computations */, + + Flags = (evaluator::Flags & (HereditaryBits /*| LinearAccessBit | DirectAccessBit*/)), + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + typedef std::pair RowCol; + + inline RowCol index_remap(Index rowId, Index colId) const + { + if(Order==ColMajor) + { + const Index nth_elem_idx = colId * m_xpr.rows() + rowId; + return RowCol(nth_elem_idx % m_xpr.nestedExpression().rows(), + nth_elem_idx / m_xpr.nestedExpression().rows()); + } + else + { + const Index nth_elem_idx = colId + rowId * m_xpr.cols(); + return RowCol(nth_elem_idx / m_xpr.nestedExpression().cols(), + nth_elem_idx % m_xpr.nestedExpression().cols()); + } + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeff(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const CoeffReturnType coeff(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeff(row_col.first, row_col.second); + } +#if 0 + EIGEN_DEVICE_FUNC + template + inline PacketScalar packet(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.template packet(row_col.first, row_col.second); + + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + const RowCol row_col = index_remap(rowId, colId); + m_argImpl.const_cast_derived().template writePacket + (row_col.first, row_col.second, val); + } + + template + EIGEN_DEVICE_FUNC + inline PacketScalar packet(Index index) const + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second); + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index index, const PacketScalar& val) + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second, val); + } +#endif +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +template +struct reshaped_evaluator +: mapbase_evaluator, + typename Reshaped::PlainObject> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) + : mapbase_evaluator(xpr) + { + // TODO: for the 3.4 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(xpr.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_RESHAPED_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/ReturnByValue.h b/lib/eigen-3.4.0/Eigen/src/Core/ReturnByValue.h new file mode 100644 index 0000000..4dad13e --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/ReturnByValue.h @@ -0,0 +1,119 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// Copyright (C) 2009-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RETURNBYVALUE_H +#define EIGEN_RETURNBYVALUE_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : public traits::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 = (traits::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 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 ?? + * Answer: EvalBeforeNestingBit should be deprecated since we have the evaluators + */ +template +struct nested_eval, n, PlainObject> +{ + typedef typename traits::ReturnType type; +}; + +} // end namespace internal + +/** \class ReturnByValue + * \ingroup Core_Module + * + */ +template class ReturnByValue + : public internal::dense_xpr_base< ReturnByValue >::type, internal::no_assignment_operator +{ + public: + typedef typename internal::traits::ReturnType ReturnType; + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) + + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const + { static_cast(this)->evalTo(dst); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return static_cast(this)->rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return static_cast(this)->cols(); } + +#ifndef EIGEN_PARSED_BY_DOXYGEN +#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT + class Unusable{ + Unusable(const Unusable&) {} + Unusable& operator=(const Unusable&) {return *this;} + }; + const Unusable& coeff(Index) const { return *reinterpret_cast(this); } + const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } + Unusable& coeffRef(Index) { return *reinterpret_cast(this); } + Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } +#undef Unusable +#endif +}; + +template +template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator=(const ReturnByValue& other) +{ + other.evalTo(derived()); + return derived(); +} + +namespace internal { + +// Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that +// when a ReturnByValue expression is assigned, the evaluator is not constructed. +// TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world + +template +struct evaluator > + : public evaluator::ReturnType> +{ + typedef ReturnByValue XprType; + typedef typename internal::traits::ReturnType PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + xpr.evalTo(m_result); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_RETURNBYVALUE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Reverse.h b/lib/eigen-3.4.0/Eigen/src/Core/Reverse.h new file mode 100644 index 0000000..28cdd76 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Reverse.h @@ -0,0 +1,217 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2009 Ricard Marxer +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REVERSE_H +#define EIGEN_REVERSE_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + Flags = _MatrixTypeNested::Flags & (RowMajorBit | LvalueBit) + }; +}; + +template struct reverse_packet_cond +{ + static inline PacketType run(const PacketType& x) { return preverse(x); } +}; + +template struct reverse_packet_cond +{ + static inline PacketType run(const PacketType& x) { return x; } +}; + +} // end namespace internal + +/** \class Reverse + * \ingroup Core_Module + * + * \brief Expression of the reverse of a vector or matrix + * + * \tparam MatrixType the type of the object of which we are taking the reverse + * \tparam Direction defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections + * + * This class represents an expression of the reverse of a vector. + * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::reverse(), VectorwiseOp::reverse() + */ +template class Reverse + : public internal::dense_xpr_base< Reverse >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) + typedef typename internal::remove_all::type NestedExpression; + using Base::IsRowMajor; + + protected: + enum { + PacketSize = internal::packet_traits::size, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1, + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor) + }; + typedef internal::reverse_packet_cond reverse_packet; + public: + + EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } + + EIGEN_DEVICE_FUNC inline Index innerStride() const + { + return -m_matrix.innerStride(); + } + + EIGEN_DEVICE_FUNC const typename internal::remove_all::type& + nestedExpression() const + { + return m_matrix; + } + + protected: + typename MatrixType::Nested m_matrix; +}; + +/** \returns an expression of the reverse of *this. + * + * Example: \include MatrixBase_reverse.cpp + * Output: \verbinclude MatrixBase_reverse.out + * + */ +template +EIGEN_DEVICE_FUNC inline typename DenseBase::ReverseReturnType +DenseBase::reverse() +{ + return ReverseReturnType(derived()); +} + + +//reverse const overload moved DenseBase.h due to a CUDA compiler bug + +/** This is the "in place" version of reverse: it reverses \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * - it allows future optimizations (cache friendliness, etc.) + * + * \sa VectorwiseOp::reverseInPlace(), reverse() */ +template +EIGEN_DEVICE_FUNC inline void DenseBase::reverseInPlace() +{ + if(cols()>rows()) + { + Index half = cols()/2; + leftCols(half).swap(rightCols(half).reverse()); + if((cols()%2)==1) + { + Index half2 = rows()/2; + col(half).head(half2).swap(col(half).tail(half2).reverse()); + } + } + else + { + Index half = rows()/2; + topRows(half).swap(bottomRows(half).reverse()); + if((rows()%2)==1) + { + Index half2 = cols()/2; + row(half).head(half2).swap(row(half).tail(half2).reverse()); + } + } +} + +namespace internal { + +template +struct vectorwise_reverse_inplace_impl; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + const int HalfAtCompileTime = ExpressionType::RowsAtCompileTime==Dynamic?Dynamic:ExpressionType::RowsAtCompileTime/2; + Index half = xpr.rows()/2; + xpr.topRows(fix(half)) + .swap(xpr.bottomRows(fix(half)).colwise().reverse()); + } +}; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + const int HalfAtCompileTime = ExpressionType::ColsAtCompileTime==Dynamic?Dynamic:ExpressionType::ColsAtCompileTime/2; + Index half = xpr.cols()/2; + xpr.leftCols(fix(half)) + .swap(xpr.rightCols(fix(half)).rowwise().reverse()); + } +}; + +} // end namespace internal + +/** This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * + * \sa DenseBase::reverseInPlace(), reverse() */ +template +EIGEN_DEVICE_FUNC void VectorwiseOp::reverseInPlace() +{ + internal::vectorwise_reverse_inplace_impl::run(m_matrix); +} + +} // end namespace Eigen + +#endif // EIGEN_REVERSE_H diff --git a/lib/eigen-3.4.0/Eigen/src/Core/Select.h b/lib/eigen-3.4.0/Eigen/src/Core/Select.h new file mode 100644 index 0000000..7c86bf8 --- /dev/null +++ b/lib/eigen-3.4.0/Eigen/src/Core/Select.h @@ -0,0 +1,164 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SELECT_H +#define EIGEN_SELECT_H + +namespace Eigen { + +/** \class Select + * \ingroup Core_Module + * + * \brief Expression of a coefficient wise version of the C++ ternary operator ?: + * + * \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix + * \param ThenMatrixType the type of the \em then expression + * \param ElseMatrixType the type of the \em else expression + * + * This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. + * It is the return type of DenseBase::select() and most of the time this is the only way it is used. + * + * \sa DenseBase::select(const DenseBase&, const DenseBase&) const + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename traits::Scalar Scalar; + typedef Dense StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ConditionMatrixType::Nested ConditionMatrixNested; + typedef typename ThenMatrixType::Nested ThenMatrixNested; + typedef typename ElseMatrixType::Nested ElseMatrixNested; + enum { + RowsAtCompileTime = ConditionMatrixType::RowsAtCompileTime, + ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime, + Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & RowMajorBit + }; +}; +} + +template +class Select : public internal::dense_xpr_base< Select >::type, + internal::no_assignment_operator +{ + public: + + typedef typename internal::dense_xpr_base" << endl; + cerr << "available actions:" << endl; + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + cerr << " " << (*it)->invokation_name() << endl; + } + cerr << "the input files should each contain an output of benchmark-blocking-sizes" << endl; + exit(1); +} + +int main(int argc, char* argv[]) +{ + cout.precision(default_precision); + cerr.precision(default_precision); + + vector> available_actions; + available_actions.emplace_back(new partition_action_t); + available_actions.emplace_back(new evaluate_defaults_action_t); + + vector input_filenames; + + action_t* action = nullptr; + + if (argc < 2) { + show_usage_and_exit(argc, argv, available_actions); + } + for (int i = 1; i < argc; i++) { + bool arg_handled = false; + // Step 1. Try to match action invocation names. + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + if (!strcmp(argv[i], (*it)->invokation_name())) { + if (!action) { + action = it->get(); + arg_handled = true; + break; + } else { + cerr << "can't specify more than one action!" << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + } + if (arg_handled) { + continue; + } + // Step 2. Try to match option names. + if (argv[i][0] == '-') { + if (!strcmp(argv[i], "--only-cubic-sizes")) { + only_cubic_sizes = true; + arg_handled = true; + } + if (!strcmp(argv[i], "--dump-tables")) { + dump_tables = true; + arg_handled = true; + } + if (!arg_handled) { + cerr << "Unrecognized option: " << argv[i] << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + if (arg_handled) { + continue; + } + // Step 3. Default to interpreting args as input filenames. + input_filenames.emplace_back(argv[i]); + } + + if (dump_tables && only_cubic_sizes) { + cerr << "Incompatible options: --only-cubic-sizes and --dump-tables." << endl; + show_usage_and_exit(argc, argv, available_actions); + } + + if (!action) { + show_usage_and_exit(argc, argv, available_actions); + } + + action->run(input_filenames); +} diff --git a/lib/eigen-3.4.0/bench/basicbench.cxxlist b/lib/eigen-3.4.0/bench/basicbench.cxxlist new file mode 100644 index 0000000..a8ab34e --- /dev/null +++ b/lib/eigen-3.4.0/bench/basicbench.cxxlist @@ -0,0 +1,28 @@ +#!/bin/bash + +# CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG" +# CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG -finline-limit=20000" + +# CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG -finline-limit=20000" + +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000" +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" + +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000" +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" + +# CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-genx" +# CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-use" + +#CLIST[((g++))]="/opt/intel/Compiler/11.1/072/bin/intel64/icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -lrt" +CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -lrt" +CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -lrt" +CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -lrt" diff --git a/lib/eigen-3.4.0/bench/basicbenchmark.cpp b/lib/eigen-3.4.0/bench/basicbenchmark.cpp new file mode 100644 index 0000000..a26ea85 --- /dev/null +++ b/lib/eigen-3.4.0/bench/basicbenchmark.cpp @@ -0,0 +1,35 @@ + +#include +#include "BenchUtil.h" +#include "basicbenchmark.h" + +int main(int argc, char *argv[]) +{ + DISABLE_SSE_EXCEPTIONS(); + + // this is the list of matrix type and size we want to bench: + // ((suffix) (matrix size) (number of iterations)) + #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000)) +// #define MODES ((Xd)(20)(10000)) + + #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \ + << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \ + << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << " / " + + std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl; + + const int tries = 10; + + #define _RUN_BENCH(R,ARG,EL) \ + std::cout << ARG( \ + BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\ + BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \ + << " "; + + BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); + std::cout << endl; + BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); + std::cout << endl; + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/basicbenchmark.h b/lib/eigen-3.4.0/bench/basicbenchmark.h new file mode 100644 index 0000000..8059375 --- /dev/null +++ b/lib/eigen-3.4.0/bench/basicbenchmark.h @@ -0,0 +1,63 @@ + +#ifndef EIGEN_BENCH_BASICBENCH_H +#define EIGEN_BENCH_BASICBENCH_H + +enum {LazyEval, EarlyEval, OmpEval}; + +template +void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) __attribute__((noinline)); + +template +void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) +{ + for(int a = 0; a < iterations; a++) + { + if (Mode==LazyEval) + { + asm("#begin_bench_loop LazyEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = (I + 0.00005 * (m + m.lazyProduct(m))).eval(); + } + else if (Mode==OmpEval) + { + asm("#begin_bench_loop OmpEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = (I + 0.00005 * (m + m.lazyProduct(m))).eval(); + } + else + { + asm("#begin_bench_loop EarlyEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = I + 0.00005 * (m + m * m); + } + asm("#end_bench_loop"); + } +} + +template +double benchBasic(const MatrixType& mat, int size, int tries) __attribute__((noinline)); + +template +double benchBasic(const MatrixType& mat, int iterations, int tries) +{ + const int rows = mat.rows(); + const int cols = mat.cols(); + + MatrixType I(rows,cols); + MatrixType m(rows,cols); + + initMatrix_identity(I); + + Eigen::BenchTimer timer; + for(uint t=0; t(I, m, iterations); + timer.stop(); + cerr << m; + } + return timer.value(); +}; + +#endif // EIGEN_BENCH_BASICBENCH_H diff --git a/lib/eigen-3.4.0/bench/benchBlasGemm.cpp b/lib/eigen-3.4.0/bench/benchBlasGemm.cpp new file mode 100644 index 0000000..cb086a5 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchBlasGemm.cpp @@ -0,0 +1,219 @@ +// g++ -O3 -DNDEBUG -I.. -L /usr/lib64/atlas/ benchBlasGemm.cpp -o benchBlasGemm -lrt -lcblas +// possible options: +// -DEIGEN_DONT_VECTORIZE +// -msse2 + +// #define EIGEN_DEFAULT_TO_ROW_MAJOR +#define _FLOAT + +#include + +#include +#include "BenchTimer.h" + +// include the BLAS headers +extern "C" { +#include +} +#include + +#ifdef _FLOAT +typedef float Scalar; +#define CBLAS_GEMM cblas_sgemm +#else +typedef double Scalar; +#define CBLAS_GEMM cblas_dgemm +#endif + + +typedef Eigen::Matrix MyMatrix; +void bench_eigengemm(MyMatrix& mc, const MyMatrix& ma, const MyMatrix& mb, int nbloops); +void check_product(int M, int N, int K); +void check_product(void); + +int main(int argc, char *argv[]) +{ + // disable SSE exceptions + #ifdef __GNUC__ + { + int aux; + asm( + "stmxcsr %[aux] \n\t" + "orl $32832, %[aux] \n\t" + "ldmxcsr %[aux] \n\t" + : : [aux] "m" (aux)); + } + #endif + + int nbtries=1, nbloops=1, M, N, K; + + if (argc==2) + { + if (std::string(argv[1])=="check") + check_product(); + else + M = N = K = atoi(argv[1]); + } + else if ((argc==3) && (std::string(argv[1])=="auto")) + { + M = N = K = atoi(argv[2]); + nbloops = 1000000000/(M*M*M); + if (nbloops<1) + nbloops = 1; + nbtries = 6; + } + else if (argc==4) + { + M = N = K = atoi(argv[1]); + nbloops = atoi(argv[2]); + nbtries = atoi(argv[3]); + } + else if (argc==6) + { + M = atoi(argv[1]); + N = atoi(argv[2]); + K = atoi(argv[3]); + nbloops = atoi(argv[4]); + nbtries = atoi(argv[5]); + } + else + { + std::cout << "Usage: " << argv[0] << " size \n"; + std::cout << "Usage: " << argv[0] << " auto size\n"; + std::cout << "Usage: " << argv[0] << " size nbloops nbtries\n"; + std::cout << "Usage: " << argv[0] << " M N K nbloops nbtries\n"; + std::cout << "Usage: " << argv[0] << " check\n"; + std::cout << "Options:\n"; + std::cout << " size unique size of the 2 matrices (integer)\n"; + std::cout << " auto automatically set the number of repetitions and tries\n"; + std::cout << " nbloops number of times the GEMM routines is executed\n"; + std::cout << " nbtries number of times the loop is benched (return the best try)\n"; + std::cout << " M N K sizes of the matrices: MxN = MxK * KxN (integers)\n"; + std::cout << " check check eigen product using cblas as a reference\n"; + exit(1); + } + + double nbmad = double(M) * double(N) * double(K) * double(nbloops); + + if (!(std::string(argv[1])=="auto")) + std::cout << M << " x " << N << " x " << K << "\n"; + + Scalar alpha, beta; + MyMatrix ma(M,K), mb(K,N), mc(M,N); + ma = MyMatrix::Random(M,K); + mb = MyMatrix::Random(K,N); + mc = MyMatrix::Random(M,N); + + Eigen::BenchTimer timer; + + // we simply compute c += a*b, so: + alpha = 1; + beta = 1; + + // bench cblas + // ROWS_A, COLS_B, COLS_A, 1.0, A, COLS_A, B, COLS_B, 0.0, C, COLS_B); + if (!(std::string(argv[1])=="auto")) + { + timer.reset(); + for (uint k=0 ; k(1,64); + N = internal::random(1,768); + K = internal::random(1,768); + M = (0 + M) * 1; + std::cout << M << " x " << N << " x " << K << "\n"; + check_product(M, N, K); + } +} + diff --git a/lib/eigen-3.4.0/bench/benchCholesky.cpp b/lib/eigen-3.4.0/bench/benchCholesky.cpp new file mode 100644 index 0000000..0dc94e5 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchCholesky.cpp @@ -0,0 +1,141 @@ +// g++ -DNDEBUG -O3 -I.. benchCholesky.cpp -o benchCholesky && ./benchCholesky +// options: +// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 +// -DEIGEN_DONT_VECTORIZE +// -msse2 +// -DREPEAT=100 +// -DTRIES=10 +// -DSCALAR=double + +#include + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +#ifndef TRIES +#define TRIES 10 +#endif + +typedef float Scalar; + +template +__attribute__ ((noinline)) void benchLLT(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + + double cost = 0; + for (int j=0; j SquareMatrixType; + + MatrixType a = MatrixType::Random(rows,cols); + SquareMatrixType covMat = a * a.adjoint(); + + BenchTimer timerNoSqrt, timerSqrt; + + Scalar acc = 0; + int r = internal::random(0,covMat.rows()-1); + int c = internal::random(0,covMat.cols()-1); + for (int t=0; t cholnosqrt(covMat); + acc += cholnosqrt.matrixL().coeff(r,c); + } + timerNoSqrt.stop(); + } + + for (int t=0; t chol(covMat); + acc += chol.matrixL().coeff(r,c); + } + timerSqrt.stop(); + } + + if (MatrixType::RowsAtCompileTime==Dynamic) + std::cout << "dyn "; + else + std::cout << "fixed "; + std::cout << covMat.rows() << " \t" + << (timerNoSqrt.best()) / repeats << "s " + << "(" << 1e-9 * cost*repeats/timerNoSqrt.best() << " GFLOPS)\t" + << (timerSqrt.best()) / repeats << "s " + << "(" << 1e-9 * cost*repeats/timerSqrt.best() << " GFLOPS)\n"; + + + #ifdef BENCH_GSL + if (MatrixType::RowsAtCompileTime==Dynamic) + { + timerSqrt.reset(); + + gsl_matrix* gslCovMat = gsl_matrix_alloc(covMat.rows(),covMat.cols()); + gsl_matrix* gslCopy = gsl_matrix_alloc(covMat.rows(),covMat.cols()); + + eiToGsl(covMat, &gslCovMat); + for (int t=0; t0; ++i) + benchLLT(Matrix(dynsizes[i],dynsizes[i])); + + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + return 0; +} + diff --git a/lib/eigen-3.4.0/bench/benchEigenSolver.cpp b/lib/eigen-3.4.0/bench/benchEigenSolver.cpp new file mode 100644 index 0000000..dd78c7e --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchEigenSolver.cpp @@ -0,0 +1,212 @@ + +// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver +// options: +// -DBENCH_GMM +// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 +// -DEIGEN_DONT_VECTORIZE +// -msse2 +// -DREPEAT=100 +// -DTRIES=10 +// -DSCALAR=double + +#include + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 1000 +#endif + +#ifndef TRIES +#define TRIES 4 +#endif + +#ifndef SCALAR +#define SCALAR float +#endif + +typedef SCALAR Scalar; + +template +__attribute__ ((noinline)) void benchEigenSolver(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + + int stdRepeats = std::max(1,int((REPEAT*1000)/(rows*rows*sqrt(rows)))); + int saRepeats = stdRepeats * 4; + + typedef typename MatrixType::Scalar Scalar; + typedef Matrix SquareMatrixType; + + MatrixType a = MatrixType::Random(rows,cols); + SquareMatrixType covMat = a * a.adjoint(); + + BenchTimer timerSa, timerStd; + + Scalar acc = 0; + int r = internal::random(0,covMat.rows()-1); + int c = internal::random(0,covMat.cols()-1); + { + SelfAdjointEigenSolver ei(covMat); + for (int t=0; t ei(covMat); + for (int t=0; t gmmCovMat(covMat.rows(),covMat.cols()); + gmm::dense_matrix eigvect(covMat.rows(),covMat.cols()); + std::vector eigval(covMat.rows()); + eiToGmm(covMat, gmmCovMat); + for (int t=0; t0; ++i) + benchEigenSolver(Matrix(dynsizes[i],dynsizes[i])); + + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + return 0; +} + diff --git a/lib/eigen-3.4.0/bench/benchFFT.cpp b/lib/eigen-3.4.0/bench/benchFFT.cpp new file mode 100644 index 0000000..3eb1a1a --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchFFT.cpp @@ -0,0 +1,115 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Mark Borgerding mark a borgerding net +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include +#include +#include +#include + +#include + +using namespace Eigen; +using namespace std; + + +template +string nameof(); + +template <> string nameof() {return "float";} +template <> string nameof() {return "double";} +template <> string nameof() {return "long double";} + +#ifndef TYPE +#define TYPE float +#endif + +#ifndef NFFT +#define NFFT 1024 +#endif +#ifndef NDATA +#define NDATA 1000000 +#endif + +using namespace Eigen; + +template +void bench(int nfft,bool fwd,bool unscaled=false, bool halfspec=false) +{ + typedef typename NumTraits::Real Scalar; + typedef typename std::complex Complex; + int nits = NDATA/nfft; + vector inbuf(nfft); + vector outbuf(nfft); + FFT< Scalar > fft; + + if (unscaled) { + fft.SetFlag(fft.Unscaled); + cout << "unscaled "; + } + if (halfspec) { + fft.SetFlag(fft.HalfSpectrum); + cout << "halfspec "; + } + + + std::fill(inbuf.begin(),inbuf.end(),0); + fft.fwd( outbuf , inbuf); + + BenchTimer timer; + timer.reset(); + for (int k=0;k<8;++k) { + timer.start(); + if (fwd) + for(int i = 0; i < nits; i++) + fft.fwd( outbuf , inbuf); + else + for(int i = 0; i < nits; i++) + fft.inv(inbuf,outbuf); + timer.stop(); + } + + cout << nameof() << " "; + double mflops = 5.*nfft*log2((double)nfft) / (1e6 * timer.value() / (double)nits ); + if ( NumTraits::IsComplex ) { + cout << "complex"; + }else{ + cout << "real "; + mflops /= 2; + } + + + if (fwd) + cout << " fwd"; + else + cout << " inv"; + + cout << " NFFT=" << nfft << " " << (double(1e-6*nfft*nits)/timer.value()) << " MS/s " << mflops << "MFLOPS\n"; +} + +int main(int argc,char ** argv) +{ + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + bench(NFFT,false,true); + bench(NFFT,false,true,true); + + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + return 0; +} diff --git a/lib/eigen-3.4.0/bench/benchGeometry.cpp b/lib/eigen-3.4.0/bench/benchGeometry.cpp new file mode 100644 index 0000000..6e16c03 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchGeometry.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include + +using namespace Eigen; +using namespace std; + +#ifndef REPEAT +#define REPEAT 1000000 +#endif + +enum func_opt +{ + TV, + TMATV, + TMATVMAT, +}; + + +template +struct func; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1 * a2; + } +}; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1.matrix() * a2; + } +}; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return res(a1.matrix() * a2.matrix()); + } +}; + +template +struct test_transform +{ + static void run() + { + arg1 a1; + a1.setIdentity(); + arg2 a2; + a2.setIdentity(); + + BenchTimer timer; + timer.reset(); + for (int k=0; k<10; ++k) + { + timer.start(); + for (int k=0; k Trans;\ + typedef Matrix Vec;\ + typedef func Func;\ + test_transform< Func, Trans, Vec >::run();\ + } + +#define run_trans( op, scalar, mode, option ) \ + std::cout << #scalar << "\t " << #mode << "\t " << #option << " "; \ + {\ + typedef Transform Trans;\ + typedef func Func;\ + test_transform< Func, Trans, Trans >::run();\ + } + +int main(int argc, char* argv[]) +{ + cout << "vec = trans * vec" << endl; + run_vec(TV, float, Isometry, AutoAlign, 3); + run_vec(TV, float, Isometry, DontAlign, 3); + run_vec(TV, float, Isometry, AutoAlign, 4); + run_vec(TV, float, Isometry, DontAlign, 4); + run_vec(TV, float, Projective, AutoAlign, 4); + run_vec(TV, float, Projective, DontAlign, 4); + run_vec(TV, double, Isometry, AutoAlign, 3); + run_vec(TV, double, Isometry, DontAlign, 3); + run_vec(TV, double, Isometry, AutoAlign, 4); + run_vec(TV, double, Isometry, DontAlign, 4); + run_vec(TV, double, Projective, AutoAlign, 4); + run_vec(TV, double, Projective, DontAlign, 4); + + cout << "vec = trans.matrix() * vec" << endl; + run_vec(TMATV, float, Isometry, AutoAlign, 4); + run_vec(TMATV, float, Isometry, DontAlign, 4); + run_vec(TMATV, double, Isometry, AutoAlign, 4); + run_vec(TMATV, double, Isometry, DontAlign, 4); + + cout << "trans = trans1 * trans" << endl; + run_trans(TV, float, Isometry, AutoAlign); + run_trans(TV, float, Isometry, DontAlign); + run_trans(TV, double, Isometry, AutoAlign); + run_trans(TV, double, Isometry, DontAlign); + run_trans(TV, float, Projective, AutoAlign); + run_trans(TV, float, Projective, DontAlign); + run_trans(TV, double, Projective, AutoAlign); + run_trans(TV, double, Projective, DontAlign); + + cout << "trans = trans1.matrix() * trans.matrix()" << endl; + run_trans(TMATVMAT, float, Isometry, AutoAlign); + run_trans(TMATVMAT, float, Isometry, DontAlign); + run_trans(TMATVMAT, double, Isometry, AutoAlign); + run_trans(TMATVMAT, double, Isometry, DontAlign); +} + diff --git a/lib/eigen-3.4.0/bench/benchVecAdd.cpp b/lib/eigen-3.4.0/bench/benchVecAdd.cpp new file mode 100644 index 0000000..ce8e1e9 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchVecAdd.cpp @@ -0,0 +1,135 @@ + +#include +#include +#include +using namespace Eigen; + +#ifndef SIZE +#define SIZE 50 +#endif + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +typedef float Scalar; + +__attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size); +__attribute__ ((noinline)) void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c); +__attribute__ ((noinline)) void benchVec(VectorXf& a, VectorXf& b, VectorXf& c); + +int main(int argc, char* argv[]) +{ + int size = SIZE * 8; + int size2 = size * size; + Scalar* a = internal::aligned_new(size2); + Scalar* b = internal::aligned_new(size2+4)+1; + Scalar* c = internal::aligned_new(size2); + + for (int i=0; i2 ; --innersize) + { + if (size2%innersize==0) + { + int outersize = size2/innersize; + MatrixXf ma = Map(a, innersize, outersize ); + MatrixXf mb = Map(b, innersize, outersize ); + MatrixXf mc = Map(c, innersize, outersize ); + timer.reset(); + for (int k=0; k<3; ++k) + { + timer.start(); + benchVec(ma, mb, mc); + timer.stop(); + } + std::cout << innersize << " x " << outersize << " " << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; + } + } + + VectorXf va = Map(a, size2); + VectorXf vb = Map(b, size2); + VectorXf vc = Map(c, size2); + timer.reset(); + for (int k=0; k<3; ++k) + { + timer.start(); + benchVec(va, vb, vc); + timer.stop(); + } + std::cout << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; + + return 0; +} + +void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c) +{ + for (int k=0; k::type PacketScalar; + const int PacketSize = internal::packet_traits::size; + PacketScalar a0, a1, a2, a3, b0, b1, b2, b3; + for (int k=0; k +// -DSCALARA=double or -DSCALARB=double +// -DHAVE_BLAS +// -DDECOUPLED +// + +#include +#include +#include + + +using namespace std; +using namespace Eigen; + +#ifndef SCALAR +// #define SCALAR std::complex +#define SCALAR float +#endif + +#ifndef SCALARA +#define SCALARA SCALAR +#endif + +#ifndef SCALARB +#define SCALARB SCALAR +#endif + +#ifdef ROWMAJ_A +const int opt_A = RowMajor; +#else +const int opt_A = ColMajor; +#endif + +#ifdef ROWMAJ_B +const int opt_B = RowMajor; +#else +const int opt_B = ColMajor; +#endif + +typedef SCALAR Scalar; +typedef NumTraits::Real RealScalar; +typedef Matrix A; +typedef Matrix B; +typedef Matrix C; +typedef Matrix M; + +#ifdef HAVE_BLAS + +extern "C" { + #include +} + +static float fone = 1; +static float fzero = 0; +static double done = 1; +static double szero = 0; +static std::complex cfone = 1; +static std::complex cfzero = 0; +static std::complex cdone = 1; +static std::complex cdzero = 0; +static char notrans = 'N'; +static char trans = 'T'; +static char nonunit = 'N'; +static char lower = 'L'; +static char right = 'R'; +static int intone = 1; + +#ifdef ROWMAJ_A +const char transA = trans; +#else +const char transA = notrans; +#endif + +#ifdef ROWMAJ_B +const char transB = trans; +#else +const char transB = notrans; +#endif + +template +void blas_gemm(const A& a, const B& b, MatrixXf& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); + + sgemm_(&transA,&transB,&M,&N,&K,&fone, + const_cast(a.data()),&lda, + const_cast(b.data()),&ldb,&fone, + c.data(),&ldc); +} + +template +void blas_gemm(const A& a, const B& b, MatrixXd& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); + + dgemm_(&transA,&transB,&M,&N,&K,&done, + const_cast(a.data()),&lda, + const_cast(b.data()),&ldb,&done, + c.data(),&ldc); +} + +template +void blas_gemm(const A& a, const B& b, MatrixXcf& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); + + cgemm_(&transA,&transB,&M,&N,&K,(float*)&cfone, + const_cast((const float*)a.data()),&lda, + const_cast((const float*)b.data()),&ldb,(float*)&cfone, + (float*)c.data(),&ldc); +} + +template +void blas_gemm(const A& a, const B& b, MatrixXcd& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); + + zgemm_(&transA,&transB,&M,&N,&K,(double*)&cdone, + const_cast((const double*)a.data()),&lda, + const_cast((const double*)b.data()),&ldb,(double*)&cdone, + (double*)c.data(),&ldc); +} + + + +#endif + +void matlab_cplx_cplx(const M& ar, const M& ai, const M& br, const M& bi, M& cr, M& ci) +{ + cr.noalias() += ar * br; + cr.noalias() -= ai * bi; + ci.noalias() += ar * bi; + ci.noalias() += ai * br; + // [cr ci] += [ar ai] * br + [-ai ar] * bi +} + +void matlab_real_cplx(const M& a, const M& br, const M& bi, M& cr, M& ci) +{ + cr.noalias() += a * br; + ci.noalias() += a * bi; +} + +void matlab_cplx_real(const M& ar, const M& ai, const M& b, M& cr, M& ci) +{ + cr.noalias() += ar * b; + ci.noalias() += ai * b; +} + + + +template +EIGEN_DONT_INLINE void gemm(const A& a, const B& b, C& c) +{ + c.noalias() += a * b; +} + +int main(int argc, char ** argv) +{ + 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 internal::gebp_traits Traits; + std::cout << "Register blocking = " << Traits::mr << " x " << Traits::nr << "\n"; + + int rep = 1; // number of repetitions per try + int tries = 2; // number of tries, we keep the best + + int s = 2048; + int m = s; + int n = s; + int p = s; + int cache_size1=-1, cache_size2=l2, cache_size3 = 0; + + bool need_help = false; + for (int i=1; i -c -t -p \n"; + std::cout << " : size\n"; + std::cout << " : rows columns depth\n"; + return 1; + } + +#if EIGEN_VERSION_AT_LEAST(3,2,90) + if(cache_size1>0) + setCpuCacheSizes(cache_size1,cache_size2,cache_size3); +#endif + + A a(m,p); a.setRandom(); + B b(p,n); b.setRandom(); + C c(m,n); c.setOnes(); + C rc = c; + + std::cout << "Matrix sizes = " << m << "x" << p << " * " << p << "x" << n << "\n"; + std::ptrdiff_t mc(m), nc(n), kc(p); + internal::computeProductBlockingSizes(kc, mc, nc); + std::cout << "blocking size (mc x kc) = " << mc << " x " << kc << " x " << nc << "\n"; + + C r = c; + + // check the parallel product is correct + #if defined EIGEN_HAS_OPENMP + Eigen::initParallel(); + int procs = omp_get_max_threads(); + if(procs>1) + { + #ifdef HAVE_BLAS + blas_gemm(a,b,r); + #else + omp_set_num_threads(1); + r.noalias() += a * b; + omp_set_num_threads(procs); + #endif + c.noalias() += a * b; + if(!r.isApprox(c)) std::cerr << "Warning, your parallel product is crap!\n\n"; + } + #elif defined HAVE_BLAS + blas_gemm(a,b,r); + c.noalias() += a * b; + if(!r.isApprox(c)) { + std::cout << (r - c).norm()/r.norm() << "\n"; + std::cerr << "Warning, your product is crap!\n\n"; + } + #else + if(1.*m*n*p<2000.*2000*2000) + { + gemm(a,b,c); + r.noalias() += a.cast() .lazyProduct( b.cast() ); + if(!r.isApprox(c)) { + std::cout << (r - c).norm()/r.norm() << "\n"; + std::cerr << "Warning, your product is crap!\n\n"; + } + } + #endif + + #ifdef HAVE_BLAS + BenchTimer tblas; + c = rc; + BENCH(tblas, tries, rep, blas_gemm(a,b,c)); + std::cout << "blas cpu " << tblas.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(CPU_TIMER) << "s)\n"; + std::cout << "blas real " << tblas.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(REAL_TIMER) << "s)\n"; + #endif + + // warm start + if(b.norm()+a.norm()==123.554) std::cout << "\n"; + + BenchTimer tmt; + c = rc; + BENCH(tmt, tries, rep, gemm(a,b,c)); + std::cout << "eigen cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; + std::cout << "eigen real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; + + #ifdef EIGEN_HAS_OPENMP + if(procs>1) + { + BenchTimer tmono; + omp_set_num_threads(1); + Eigen::setNbThreads(1); + c = rc; + BENCH(tmono, tries, rep, gemm(a,b,c)); + std::cout << "eigen mono cpu " << tmono.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(CPU_TIMER) << "s)\n"; + std::cout << "eigen mono real " << tmono.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(REAL_TIMER) << "s)\n"; + std::cout << "mt speed up x" << tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER) << " => " << (100.0*tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER))/procs << "%\n"; + } + #endif + + if(1.*m*n*p<30*30*30) + { + BenchTimer tmt; + c = rc; + BENCH(tmt, tries, rep, c.noalias()+=a.lazyProduct(b)); + std::cout << "lazy cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; + std::cout << "lazy real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; + } + + #ifdef DECOUPLED + if((NumTraits::IsComplex) && (NumTraits::IsComplex)) + { + M ar(m,p); ar.setRandom(); + M ai(m,p); ai.setRandom(); + M br(p,n); br.setRandom(); + M bi(p,n); bi.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_cplx_cplx(ar,ai,br,bi,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + if((!NumTraits::IsComplex) && (NumTraits::IsComplex)) + { + M a(m,p); a.setRandom(); + M br(p,n); br.setRandom(); + M bi(p,n); bi.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_real_cplx(a,br,bi,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + if((NumTraits::IsComplex) && (!NumTraits::IsComplex)) + { + M ar(m,p); ar.setRandom(); + M ai(m,p); ai.setRandom(); + M b(p,n); b.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_cplx_real(ar,ai,b,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + #endif + + return 0; +} + diff --git a/lib/eigen-3.4.0/bench/bench_move_semantics.cpp b/lib/eigen-3.4.0/bench/bench_move_semantics.cpp new file mode 100644 index 0000000..323d804 --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_move_semantics.cpp @@ -0,0 +1,57 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2020 Sebastien Boisvert +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "BenchTimer.h" +#include "../test/MovableScalar.h" + +#include + +#include +#include + +template +void copy_matrix(MatrixType& m) +{ + MatrixType tmp(m); + m = tmp; +} + +template +void move_matrix(MatrixType&& m) +{ + MatrixType tmp(std::move(m)); + m = std::move(tmp); +} + +template +void bench(const std::string& label) +{ + using MatrixType = Eigen::Matrix,1,10>; + Eigen::BenchTimer t; + + int tries = 10; + int rep = 1000000; + + MatrixType data = MatrixType::Random().eval(); + MatrixType dest; + + BENCH(t, tries, rep, copy_matrix(data)); + std::cout << label << " copy semantics: " << 1e3*t.best(Eigen::CPU_TIMER) << " ms" << std::endl; + + BENCH(t, tries, rep, move_matrix(std::move(data))); + std::cout << label << " move semantics: " << 1e3*t.best(Eigen::CPU_TIMER) << " ms" << std::endl; +} + +int main() +{ + bench("float"); + bench("double"); + return 0; +} + diff --git a/lib/eigen-3.4.0/bench/bench_multi_compilers.sh b/lib/eigen-3.4.0/bench/bench_multi_compilers.sh new file mode 100755 index 0000000..27e91f1 --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_multi_compilers.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if (($# < 2)); then + echo "Usage: $0 compilerlist.txt benchfile.cpp" +else + +compilerlist=$1 +benchfile=$2 + +g=0 +source $compilerlist + +# for each compiler, compile benchfile and run the benchmark +for (( i=0 ; i /dev/null + echo "" + else + echo "compiler not found: $compiler" + fi +done + +fi diff --git a/lib/eigen-3.4.0/bench/bench_norm.cpp b/lib/eigen-3.4.0/bench/bench_norm.cpp new file mode 100644 index 0000000..592f25d --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_norm.cpp @@ -0,0 +1,360 @@ +#include +#include +#include +#include "BenchTimer.h" +using namespace Eigen; +using namespace std; + +template +EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v) +{ + return v.norm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v) +{ + return v.stableNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar hypotNorm(T& v) +{ + return v.hypotNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar blueNorm(T& v) +{ + return v.blueNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar lapackNorm(T& v) +{ + typedef typename T::Scalar Scalar; + int n = v.size(); + Scalar scale = 0; + Scalar ssq = 1; + for (int i=0;i= ax) + { + ssq += numext::abs2(ax/scale); + } + else + { + ssq = Scalar(1) + ssq * numext::abs2(scale/ax); + scale = ax; + } + } + return scale * std::sqrt(ssq); +} + +template +EIGEN_DONT_INLINE typename T::Scalar twopassNorm(T& v) +{ + typedef typename T::Scalar Scalar; + Scalar s = v.array().abs().maxCoeff(); + return s*(v/s).norm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar bl2passNorm(T& v) +{ + return v.stableNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar divacNorm(T& v) +{ + int n =v.size() / 2; + for (int i=0;i0) + { + for (int i=0;i +EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v) +{ + #ifndef EIGEN_VECTORIZE + return v.blueNorm(); + #else + typedef typename T::Scalar Scalar; + + static int nmax = 0; + static Scalar b1, b2, s1m, s2m, overfl, rbig, relerr; + int n; + + if(nmax <= 0) + { + int nbig, ibeta, it, iemin, iemax, iexp; + Scalar abig, eps; + + nbig = NumTraits::highest(); // largest integer + ibeta = std::numeric_limits::radix; // NumTraits::Base; // base for floating-point numbers + it = NumTraits::digits(); // NumTraits::Mantissa; // number of base-beta digits in mantissa + iemin = NumTraits::min_exponent(); // minimum exponent + iemax = NumTraits::max_exponent(); // maximum exponent + rbig = NumTraits::highest(); // largest floating-point number + + // Check the basic machine-dependent constants. + if(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5) + || (it<=4 && ibeta <= 3 ) || it<2) + { + eigen_assert(false && "the algorithm cannot be guaranteed on this computer"); + } + iexp = -((1-iemin)/2); + b1 = std::pow(ibeta, iexp); // lower boundary of midrange + iexp = (iemax + 1 - it)/2; + b2 = std::pow(ibeta,iexp); // upper boundary of midrange + + iexp = (2-iemin)/2; + s1m = std::pow(ibeta,iexp); // scaling factor for lower range + iexp = - ((iemax+it)/2); + s2m = std::pow(ibeta,iexp); // scaling factor for upper range + + overfl = rbig*s2m; // overflow boundary for abig + eps = std::pow(ibeta, 1-it); + relerr = std::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 internal::packet_traits::type Packet; + const int ps = internal::packet_traits::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(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 = internal::predux(pabig); + Scalar asml = internal::predux(pasml); + Scalar amed = internal::predux(pamed); + if(abig > Scalar(0)) + { + abig = std::sqrt(abig); + if(abig > overfl) + { + eigen_assert(false && "overflow"); + return rbig; + } + if(amed > Scalar(0)) + { + abig = abig/s2m; + amed = std::sqrt(amed); + } + else + { + return abig/s2m; + } + + } + else if(asml > Scalar(0)) + { + if (amed > Scalar(0)) + { + abig = std::sqrt(amed); + amed = std::sqrt(asml) / s1m; + } + else + { + return std::sqrt(asml)/s1m; + } + } + else + { + return std::sqrt(amed); + } + asml = std::min(abig, amed); + abig = std::max(abig, amed); + if(asml <= abig*relerr) + return abig; + else + return abig * std::sqrt(Scalar(1) + numext::abs2(asml/abig)); + #endif +} + +#define BENCH_PERF(NRM) { \ + float af = 0; double ad = 0; std::complex ac = 0; \ + Eigen::BenchTimer tf, td, tcf; tf.reset(); td.reset(); tcf.reset();\ + for (int k=0; k()); + double yd = based * std::abs(internal::random()); + VectorXf vf = VectorXf::Ones(s) * yf; + VectorXd vd = VectorXd::Ones(s) * yd; + + std::cout << "reference\t" << std::sqrt(double(s))*yf << "\t" << std::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"; + std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\n"; + std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\n"; + std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\n"; + std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\n"; +} + +void check_accuracy_var(int ef0, int ef1, int ed0, int ed1, int s) +{ + VectorXf vf(s); + VectorXd vd(s); + for (int i=0; i()) * std::pow(double(10), internal::random(ef0,ef1)); + vd[i] = std::abs(internal::random()) * std::pow(double(10), internal::random(ed0,ed1)); + } + + //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()) << "\t" << sqsumNorm(vd.cast()) << "\n"; + std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\t" << hypotNorm(vf.cast()) << "\t" << hypotNorm(vd.cast()) << "\n"; + std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; + std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; + std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\t" << lapackNorm(vf.cast()) << "\t" << lapackNorm(vd.cast()) << "\n"; + std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\t" << twopassNorm(vf.cast()) << "\t" << twopassNorm(vd.cast()) << "\n"; +// std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\t" << bl2passNorm(vf.cast()) << "\t" << bl2passNorm(vd.cast()) << "\n"; +} + +int main(int argc, char** argv) +{ + int tries = 10; + int iters = 100000; + double y = 1.1345743233455785456788e12 * internal::random(); + VectorXf v = VectorXf::Ones(1024) * y; + +// return 0; + int s = 10000; + double basef_ok = 1.1345743233455785456788e15; + double based_ok = 1.1345743233455785456788e95; + + double basef_under = 1.1345743233455785456788e-27; + double based_under = 1.1345743233455785456788e-303; + + double basef_over = 1.1345743233455785456788e+27; + double based_over = 1.1345743233455785456788e+302; + + std::cout.precision(20); + + std::cerr << "\nNo under/overflow:\n"; + check_accuracy(basef_ok, based_ok, s); + + std::cerr << "\nUnderflow:\n"; + check_accuracy(basef_under, based_under, s); + + std::cerr << "\nOverflow:\n"; + check_accuracy(basef_over, based_over, s); + + std::cerr << "\nVarying (over):\n"; + for (int k=0; k<1; ++k) + { + check_accuracy_var(20,27,190,302,s); + std::cout << "\n"; + } + + std::cerr << "\nVarying (under):\n"; + for (int k=0; k<1; ++k) + { + check_accuracy_var(-27,20,-302,-190,s); + std::cout << "\n"; + } + + y = 1; + std::cout.precision(4); + int s1 = 1024*1024*32; + std::cerr << "Performance (out of cache, " << s1 << "):\n"; + { + int iters = 1; + VectorXf vf = VectorXf::Random(s1) * y; + VectorXd vd = VectorXd::Random(s1) * y; + VectorXcf vcf = VectorXcf::Random(s1) * y; + BENCH_PERF(sqsumNorm); + BENCH_PERF(stableNorm); + BENCH_PERF(blueNorm); + BENCH_PERF(pblueNorm); + BENCH_PERF(lapackNorm); + BENCH_PERF(hypotNorm); + BENCH_PERF(twopassNorm); + BENCH_PERF(bl2passNorm); + } + + std::cerr << "\nPerformance (in cache, " << 512 << "):\n"; + { + int iters = 100000; + VectorXf vf = VectorXf::Random(512) * y; + VectorXd vd = VectorXd::Random(512) * y; + VectorXcf vcf = VectorXcf::Random(512) * y; + BENCH_PERF(sqsumNorm); + BENCH_PERF(stableNorm); + BENCH_PERF(blueNorm); + BENCH_PERF(pblueNorm); + BENCH_PERF(lapackNorm); + BENCH_PERF(hypotNorm); + BENCH_PERF(twopassNorm); + BENCH_PERF(bl2passNorm); + } +} diff --git a/lib/eigen-3.4.0/bench/bench_reverse.cpp b/lib/eigen-3.4.0/bench/bench_reverse.cpp new file mode 100644 index 0000000..1e69ca1 --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_reverse.cpp @@ -0,0 +1,84 @@ + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 100000 +#endif + +#ifndef TRIES +#define TRIES 20 +#endif + +typedef double Scalar; + +template +__attribute__ ((noinline)) void bench_reverse(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + int size = m.size(); + + int repeats = (REPEAT*1000)/size; + MatrixType a = MatrixType::Random(rows,cols); + MatrixType b = MatrixType::Random(rows,cols); + + BenchTimer timerB, timerH, timerV; + + Scalar acc = 0; + int r = internal::random(0,rows-1); + int c = internal::random(0,cols-1); + for (int t=0; t0; ++i) + { + bench_reverse(Matrix(dynsizes[i],dynsizes[i])); + bench_reverse(Matrix(dynsizes[i]*dynsizes[i])); + } +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); + return 0; +} + diff --git a/lib/eigen-3.4.0/bench/bench_sum.cpp b/lib/eigen-3.4.0/bench/bench_sum.cpp new file mode 100644 index 0000000..a3d925e --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_sum.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace Eigen; +using namespace std; + +int main() +{ + typedef Matrix Vec; + Vec v(SIZE); + v.setZero(); + v[0] = 1; + v[1] = 2; + for(int i = 0; i < 1000000; i++) + { + v.coeffRef(0) += v.sum() * SCALAR(1e-20); + } + cout << v.sum() << endl; +} diff --git a/lib/eigen-3.4.0/bench/bench_unrolling b/lib/eigen-3.4.0/bench/bench_unrolling new file mode 100755 index 0000000..8264438 --- /dev/null +++ b/lib/eigen-3.4.0/bench/bench_unrolling @@ -0,0 +1,12 @@ +#!/bin/bash + +# gcc : CXX="g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000" +# icc : CXX="icpc -fast -no-inline-max-size -fno-exceptions" +CXX=${CXX-g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000} # default value + +for ((i=1; i<16; ++i)); do + echo "Matrix size: $i x $i :" + $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=400 -o benchmark && time ./benchmark >/dev/null + $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null + echo " " +done diff --git a/lib/eigen-3.4.0/bench/benchmark-blocking-sizes.cpp b/lib/eigen-3.4.0/bench/benchmark-blocking-sizes.cpp new file mode 100644 index 0000000..827be28 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmark-blocking-sizes.cpp @@ -0,0 +1,677 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include +#include +#include +#include +#include +#include + +bool eigen_use_specific_block_size; +int eigen_block_size_k, eigen_block_size_m, eigen_block_size_n; +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZES eigen_use_specific_block_size +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_K eigen_block_size_k +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_M eigen_block_size_m +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_N eigen_block_size_n +#include + +#include + +using namespace Eigen; +using namespace std; + +static BenchTimer timer; + +// how many times we repeat each measurement. +// measurements are randomly shuffled - we're not doing +// all N identical measurements in a row. +const int measurement_repetitions = 3; + +// Timings below this value are too short to be accurate, +// we'll repeat measurements with more iterations until +// we get a timing above that threshold. +const float min_accurate_time = 1e-2f; + +// See --min-working-set-size command line parameter. +size_t min_working_set_size = 0; + +float max_clock_speed = 0.0f; + +// range of sizes that we will benchmark (in all 3 K,M,N dimensions) +const size_t maxsize = 2048; +const size_t minsize = 16; + +typedef MatrixXf MatrixType; +typedef MatrixType::Scalar Scalar; +typedef internal::packet_traits::type Packet; + +static_assert((maxsize & (maxsize - 1)) == 0, "maxsize must be a power of two"); +static_assert((minsize & (minsize - 1)) == 0, "minsize must be a power of two"); +static_assert(maxsize > minsize, "maxsize must be larger than minsize"); +static_assert(maxsize < (minsize << 16), "maxsize must be less than (minsize<<16)"); + +// just a helper to store a triple of K,M,N sizes for matrix product +struct size_triple_t +{ + size_t k, m, n; + size_triple_t() : k(0), m(0), n(0) {} + size_triple_t(size_t _k, size_t _m, size_t _n) : k(_k), m(_m), n(_n) {} + size_triple_t(const size_triple_t& o) : k(o.k), m(o.m), n(o.n) {} + size_triple_t(uint16_t compact) + { + k = 1 << ((compact & 0xf00) >> 8); + m = 1 << ((compact & 0x0f0) >> 4); + n = 1 << ((compact & 0x00f) >> 0); + } +}; + +uint8_t log2_pot(size_t x) { + size_t l = 0; + while (x >>= 1) l++; + return l; +} + +// Convert between size tripes and a compact form fitting in 12 bits +// where each size, which must be a POT, is encoded as its log2, on 4 bits +// so the largest representable size is 2^15 == 32k ... big enough. +uint16_t compact_size_triple(size_t k, size_t m, size_t n) +{ + return (log2_pot(k) << 8) | (log2_pot(m) << 4) | log2_pot(n); +} + +uint16_t compact_size_triple(const size_triple_t& t) +{ + return compact_size_triple(t.k, t.m, t.n); +} + +// A single benchmark. Initially only contains benchmark params. +// Then call run(), which stores the result in the gflops field. +struct benchmark_t +{ + uint16_t compact_product_size; + uint16_t compact_block_size; + bool use_default_block_size; + float gflops; + benchmark_t() + : compact_product_size(0) + , compact_block_size(0) + , use_default_block_size(false) + , gflops(0) + { + } + benchmark_t(size_t pk, size_t pm, size_t pn, + size_t bk, size_t bm, size_t bn) + : compact_product_size(compact_size_triple(pk, pm, pn)) + , compact_block_size(compact_size_triple(bk, bm, bn)) + , use_default_block_size(false) + , gflops(0) + {} + benchmark_t(size_t pk, size_t pm, size_t pn) + : compact_product_size(compact_size_triple(pk, pm, pn)) + , compact_block_size(0) + , use_default_block_size(true) + , gflops(0) + {} + + void run(); +}; + +ostream& operator<<(ostream& s, const benchmark_t& b) +{ + s << hex << b.compact_product_size << dec; + if (b.use_default_block_size) { + size_triple_t t(b.compact_product_size); + Index k = t.k, m = t.m, n = t.n; + internal::computeProductBlockingSizes(k, m, n); + s << " default(" << k << ", " << m << ", " << n << ")"; + } else { + s << " " << hex << b.compact_block_size << dec; + } + s << " " << b.gflops; + return s; +} + +// We sort first by increasing benchmark parameters, +// then by decreasing performance. +bool operator<(const benchmark_t& b1, const benchmark_t& b2) +{ + return b1.compact_product_size < b2.compact_product_size || + (b1.compact_product_size == b2.compact_product_size && ( + (b1.compact_block_size < b2.compact_block_size || ( + b1.compact_block_size == b2.compact_block_size && + b1.gflops > b2.gflops)))); +} + +void benchmark_t::run() +{ + size_triple_t productsizes(compact_product_size); + + if (use_default_block_size) { + eigen_use_specific_block_size = false; + } else { + // feed eigen with our custom blocking params + eigen_use_specific_block_size = true; + size_triple_t blocksizes(compact_block_size); + eigen_block_size_k = blocksizes.k; + eigen_block_size_m = blocksizes.m; + eigen_block_size_n = blocksizes.n; + } + + // set up the matrix pool + + const size_t combined_three_matrices_sizes = + sizeof(Scalar) * + (productsizes.k * productsizes.m + + productsizes.k * productsizes.n + + productsizes.m * productsizes.n); + + // 64 M is large enough that nobody has a cache bigger than that, + // while still being small enough that everybody has this much RAM, + // so conveniently we don't need to special-case platforms here. + const size_t unlikely_large_cache_size = 64 << 20; + + const size_t working_set_size = + min_working_set_size ? min_working_set_size : unlikely_large_cache_size; + + const size_t matrix_pool_size = + 1 + working_set_size / combined_three_matrices_sizes; + + MatrixType *lhs = new MatrixType[matrix_pool_size]; + MatrixType *rhs = new MatrixType[matrix_pool_size]; + MatrixType *dst = new MatrixType[matrix_pool_size]; + + for (size_t i = 0; i < matrix_pool_size; i++) { + lhs[i] = MatrixType::Zero(productsizes.m, productsizes.k); + rhs[i] = MatrixType::Zero(productsizes.k, productsizes.n); + dst[i] = MatrixType::Zero(productsizes.m, productsizes.n); + } + + // main benchmark loop + + int iters_at_a_time = 1; + float time_per_iter = 0.0f; + size_t matrix_index = 0; + while (true) { + + double starttime = timer.getCpuTime(); + for (int i = 0; i < iters_at_a_time; i++) { + dst[matrix_index].noalias() = lhs[matrix_index] * rhs[matrix_index]; + matrix_index++; + if (matrix_index == matrix_pool_size) { + matrix_index = 0; + } + } + double endtime = timer.getCpuTime(); + + const float timing = float(endtime - starttime); + + if (timing >= min_accurate_time) { + time_per_iter = timing / iters_at_a_time; + break; + } + + iters_at_a_time *= 2; + } + + delete[] lhs; + delete[] rhs; + delete[] dst; + + gflops = 2e-9 * productsizes.k * productsizes.m * productsizes.n / time_per_iter; +} + +void print_cpuinfo() +{ +#ifdef __linux__ + cout << "contents of /proc/cpuinfo:" << endl; + string line; + ifstream cpuinfo("/proc/cpuinfo"); + if (cpuinfo.is_open()) { + while (getline(cpuinfo, line)) { + cout << line << endl; + } + cpuinfo.close(); + } + cout << endl; +#elif defined __APPLE__ + cout << "output of sysctl hw:" << endl; + system("sysctl hw"); + cout << endl; +#endif +} + +template +string type_name() +{ + return "unknown"; +} + +template<> +string type_name() +{ + return "float"; +} + +template<> +string type_name() +{ + return "double"; +} + +struct action_t +{ + virtual const char* invokation_name() const { abort(); return nullptr; } + virtual void run() const { abort(); } + virtual ~action_t() {} +}; + +void show_usage_and_exit(int /*argc*/, char* argv[], + const vector>& available_actions) +{ + cerr << "usage: " << argv[0] << " [options...]" << endl << endl; + cerr << "available actions:" << endl << endl; + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + cerr << " " << (*it)->invokation_name() << endl; + } + cerr << endl; + cerr << "options:" << endl << endl; + cerr << " --min-working-set-size=N:" << endl; + cerr << " Set the minimum working set size to N bytes." << endl; + cerr << " This is rounded up as needed to a multiple of matrix size." << endl; + cerr << " A larger working set lowers the chance of a warm cache." << endl; + cerr << " The default value 0 means use a large enough working" << endl; + cerr << " set to likely outsize caches." << endl; + cerr << " A value of 1 (that is, 1 byte) would mean don't do anything to" << endl; + cerr << " avoid warm caches." << endl; + exit(1); +} + +float measure_clock_speed() +{ + cerr << "Measuring clock speed... \r" << flush; + + vector all_gflops; + for (int i = 0; i < 8; i++) { + benchmark_t b(1024, 1024, 1024); + b.run(); + all_gflops.push_back(b.gflops); + } + + sort(all_gflops.begin(), all_gflops.end()); + float stable_estimate = all_gflops[2] + all_gflops[3] + all_gflops[4] + all_gflops[5]; + + // multiply by an arbitrary constant to discourage trying doing anything with the + // returned values besides just comparing them with each other. + float result = stable_estimate * 123.456f; + + return result; +} + +struct human_duration_t +{ + int seconds; + human_duration_t(int s) : seconds(s) {} +}; + +ostream& operator<<(ostream& s, const human_duration_t& d) +{ + int remainder = d.seconds; + if (remainder > 3600) { + int hours = remainder / 3600; + s << hours << " h "; + remainder -= hours * 3600; + } + if (remainder > 60) { + int minutes = remainder / 60; + s << minutes << " min "; + remainder -= minutes * 60; + } + if (d.seconds < 600) { + s << remainder << " s"; + } + return s; +} + +const char session_filename[] = "/data/local/tmp/benchmark-blocking-sizes-session.data"; + +void serialize_benchmarks(const char* filename, const vector& benchmarks, size_t first_benchmark_to_run) +{ + FILE* file = fopen(filename, "w"); + if (!file) { + cerr << "Could not open file " << filename << " for writing." << endl; + cerr << "Do you have write permissions on the current working directory?" << endl; + exit(1); + } + size_t benchmarks_vector_size = benchmarks.size(); + fwrite(&max_clock_speed, sizeof(max_clock_speed), 1, file); + fwrite(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file); + fwrite(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file); + fwrite(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file); + fclose(file); +} + +bool deserialize_benchmarks(const char* filename, vector& benchmarks, size_t& first_benchmark_to_run) +{ + FILE* file = fopen(filename, "r"); + if (!file) { + return false; + } + if (1 != fread(&max_clock_speed, sizeof(max_clock_speed), 1, file)) { + return false; + } + size_t benchmarks_vector_size = 0; + if (1 != fread(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file)) { + return false; + } + if (1 != fread(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file)) { + return false; + } + benchmarks.resize(benchmarks_vector_size); + if (benchmarks.size() != fread(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file)) { + return false; + } + unlink(filename); + return true; +} + +void try_run_some_benchmarks( + vector& benchmarks, + double time_start, + size_t& first_benchmark_to_run) +{ + if (first_benchmark_to_run == benchmarks.size()) { + return; + } + + double time_last_progress_update = 0; + double time_last_clock_speed_measurement = 0; + double time_now = 0; + + size_t benchmark_index = first_benchmark_to_run; + + while (true) { + float ratio_done = float(benchmark_index) / benchmarks.size(); + time_now = timer.getRealTime(); + + // We check clock speed every minute and at the end. + if (benchmark_index == benchmarks.size() || + time_now > time_last_clock_speed_measurement + 60.0f) + { + time_last_clock_speed_measurement = time_now; + + // Ensure that clock speed is as expected + float current_clock_speed = measure_clock_speed(); + + // The tolerance needs to be smaller than the relative difference between + // clock speeds that a device could operate under. + // It seems unlikely that a device would be throttling clock speeds by + // amounts smaller than 2%. + // With a value of 1%, I was getting within noise on a Sandy Bridge. + const float clock_speed_tolerance = 0.02f; + + if (current_clock_speed > (1 + clock_speed_tolerance) * max_clock_speed) { + // Clock speed is now higher than we previously measured. + // Either our initial measurement was inaccurate, which won't happen + // too many times as we are keeping the best clock speed value and + // and allowing some tolerance; or something really weird happened, + // which invalidates all benchmark results collected so far. + // Either way, we better restart all over again now. + if (benchmark_index) { + cerr << "Restarting at " << 100.0f * ratio_done + << " % because clock speed increased. " << endl; + } + max_clock_speed = current_clock_speed; + first_benchmark_to_run = 0; + return; + } + + bool rerun_last_tests = false; + + if (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { + cerr << "Measurements completed so far: " + << 100.0f * ratio_done + << " % " << endl; + cerr << "Clock speed seems to be only " + << current_clock_speed/max_clock_speed + << " times what it used to be." << endl; + + unsigned int seconds_to_sleep_if_lower_clock_speed = 1; + + while (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { + if (seconds_to_sleep_if_lower_clock_speed > 32) { + cerr << "Sleeping longer probably won't make a difference." << endl; + cerr << "Serializing benchmarks to " << session_filename << endl; + serialize_benchmarks(session_filename, benchmarks, first_benchmark_to_run); + cerr << "Now restart this benchmark, and it should pick up where we left." << endl; + exit(2); + } + rerun_last_tests = true; + cerr << "Sleeping " + << seconds_to_sleep_if_lower_clock_speed + << " s... \r" << endl; + sleep(seconds_to_sleep_if_lower_clock_speed); + current_clock_speed = measure_clock_speed(); + seconds_to_sleep_if_lower_clock_speed *= 2; + } + } + + if (rerun_last_tests) { + cerr << "Redoing the last " + << 100.0f * float(benchmark_index - first_benchmark_to_run) / benchmarks.size() + << " % because clock speed had been low. " << endl; + return; + } + + // nothing wrong with the clock speed so far, so there won't be a need to rerun + // benchmarks run so far in case we later encounter a lower clock speed. + first_benchmark_to_run = benchmark_index; + } + + if (benchmark_index == benchmarks.size()) { + // We're done! + first_benchmark_to_run = benchmarks.size(); + // Erase progress info + cerr << " " << endl; + return; + } + + // Display progress info on stderr + if (time_now > time_last_progress_update + 1.0f) { + time_last_progress_update = time_now; + cerr << "Measurements... " << 100.0f * ratio_done + << " %, ETA " + << human_duration_t(float(time_now - time_start) * (1.0f - ratio_done) / ratio_done) + << " \r" << flush; + } + + // This is where we actually run a benchmark! + benchmarks[benchmark_index].run(); + benchmark_index++; + } +} + +void run_benchmarks(vector& benchmarks) +{ + size_t first_benchmark_to_run; + vector deserialized_benchmarks; + bool use_deserialized_benchmarks = false; + if (deserialize_benchmarks(session_filename, deserialized_benchmarks, first_benchmark_to_run)) { + cerr << "Found serialized session with " + << 100.0f * first_benchmark_to_run / deserialized_benchmarks.size() + << " % already done" << endl; + if (deserialized_benchmarks.size() == benchmarks.size() && + first_benchmark_to_run > 0 && + first_benchmark_to_run < benchmarks.size()) + { + use_deserialized_benchmarks = true; + } + } + + if (use_deserialized_benchmarks) { + benchmarks = deserialized_benchmarks; + } else { + // not using deserialized benchmarks, starting from scratch + first_benchmark_to_run = 0; + + // Randomly shuffling benchmarks allows us to get accurate enough progress info, + // as now the cheap/expensive benchmarks are randomly mixed so they average out. + // It also means that if data is corrupted for some time span, the odds are that + // not all repetitions of a given benchmark will be corrupted. + random_shuffle(benchmarks.begin(), benchmarks.end()); + } + + for (int i = 0; i < 4; i++) { + max_clock_speed = max(max_clock_speed, measure_clock_speed()); + } + + double time_start = 0.0; + while (first_benchmark_to_run < benchmarks.size()) { + if (first_benchmark_to_run == 0) { + time_start = timer.getRealTime(); + } + try_run_some_benchmarks(benchmarks, + time_start, + first_benchmark_to_run); + } + + // Sort timings by increasing benchmark parameters, and decreasing gflops. + // The latter is very important. It means that we can ignore all but the first + // benchmark with given parameters. + sort(benchmarks.begin(), benchmarks.end()); + + // Collect best (i.e. now first) results for each parameter values. + vector best_benchmarks; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + if (best_benchmarks.empty() || + best_benchmarks.back().compact_product_size != it->compact_product_size || + best_benchmarks.back().compact_block_size != it->compact_block_size) + { + best_benchmarks.push_back(*it); + } + } + + // keep and return only the best benchmarks + benchmarks = best_benchmarks; +} + +struct measure_all_pot_sizes_action_t : action_t +{ + virtual const char* invokation_name() const { return "all-pot-sizes"; } + virtual void run() const + { + vector benchmarks; + for (int repetition = 0; repetition < measurement_repetitions; repetition++) { + for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { + for (size_t msize = minsize; msize <= maxsize; msize *= 2) { + for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { + for (size_t kblock = minsize; kblock <= ksize; kblock *= 2) { + for (size_t mblock = minsize; mblock <= msize; mblock *= 2) { + for (size_t nblock = minsize; nblock <= nsize; nblock *= 2) { + benchmarks.emplace_back(ksize, msize, nsize, kblock, mblock, nblock); + } + } + } + } + } + } + } + + run_benchmarks(benchmarks); + + cout << "BEGIN MEASUREMENTS ALL POT SIZES" << endl; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + cout << *it << endl; + } + } +}; + +struct measure_default_sizes_action_t : action_t +{ + virtual const char* invokation_name() const { return "default-sizes"; } + virtual void run() const + { + vector benchmarks; + for (int repetition = 0; repetition < measurement_repetitions; repetition++) { + for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { + for (size_t msize = minsize; msize <= maxsize; msize *= 2) { + for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { + benchmarks.emplace_back(ksize, msize, nsize); + } + } + } + } + + run_benchmarks(benchmarks); + + cout << "BEGIN MEASUREMENTS DEFAULT SIZES" << endl; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + cout << *it << endl; + } + } +}; + +int main(int argc, char* argv[]) +{ + double time_start = timer.getRealTime(); + cout.precision(4); + cerr.precision(4); + + vector> available_actions; + available_actions.emplace_back(new measure_all_pot_sizes_action_t); + available_actions.emplace_back(new measure_default_sizes_action_t); + + auto action = available_actions.end(); + + if (argc <= 1) { + show_usage_and_exit(argc, argv, available_actions); + } + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + if (!strcmp(argv[1], (*it)->invokation_name())) { + action = it; + break; + } + } + + if (action == available_actions.end()) { + show_usage_and_exit(argc, argv, available_actions); + } + + for (int i = 2; i < argc; i++) { + if (argv[i] == strstr(argv[i], "--min-working-set-size=")) { + const char* equals_sign = strchr(argv[i], '='); + min_working_set_size = strtoul(equals_sign+1, nullptr, 10); + } else { + cerr << "unrecognized option: " << argv[i] << endl << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + + print_cpuinfo(); + + cout << "benchmark parameters:" << endl; + cout << "pointer size: " << 8*sizeof(void*) << " bits" << endl; + cout << "scalar type: " << type_name() << endl; + cout << "packet size: " << internal::packet_traits::size << endl; + cout << "minsize = " << minsize << endl; + cout << "maxsize = " << maxsize << endl; + cout << "measurement_repetitions = " << measurement_repetitions << endl; + cout << "min_accurate_time = " << min_accurate_time << endl; + cout << "min_working_set_size = " << min_working_set_size; + if (min_working_set_size == 0) { + cout << " (try to outsize caches)"; + } + cout << endl << endl; + + (*action)->run(); + + double time_end = timer.getRealTime(); + cerr << "Finished in " << human_duration_t(time_end - time_start) << endl; +} diff --git a/lib/eigen-3.4.0/bench/benchmark.cpp b/lib/eigen-3.4.0/bench/benchmark.cpp new file mode 100644 index 0000000..c721b90 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmark.cpp @@ -0,0 +1,39 @@ +// g++ -O3 -DNDEBUG -DMATSIZE= benchmark.cpp -o benchmark && time ./benchmark + +#include + +#include + +#ifndef MATSIZE +#define MATSIZE 3 +#endif + +using namespace std; +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 40000000 +#endif + +#ifndef SCALAR +#define SCALAR double +#endif + +int main(int argc, char *argv[]) +{ + Matrix I = Matrix::Ones(); + Matrix m; + for(int i = 0; i < MATSIZE; i++) + for(int j = 0; j < MATSIZE; j++) + { + m(i,j) = (i+MATSIZE*j); + } + asm("#begin"); + for(int a = 0; a < REPEAT; a++) + { + m = Matrix::Ones() + 0.00005 * (m + (m*m)); + } + asm("#end"); + cout << m << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/bench/benchmarkSlice.cpp b/lib/eigen-3.4.0/bench/benchmarkSlice.cpp new file mode 100644 index 0000000..c5b89c5 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmarkSlice.cpp @@ -0,0 +1,38 @@ +// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX + +#include + +#include + +using namespace std; +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +#ifndef SCALAR +#define SCALAR float +#endif + +int main(int argc, char *argv[]) +{ + typedef Matrix Mat; + Mat m(100, 100); + m.setRandom(); + + for(int a = 0; a < REPEAT; a++) + { + int r, c, nr, nc; + r = Eigen::internal::random(0,10); + c = Eigen::internal::random(0,10); + nr = Eigen::internal::random(50,80); + nc = Eigen::internal::random(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); + m.block(r,c,nr,nc) /= SCALAR(10); + } + cout << m[0] << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/bench/benchmarkX.cpp b/lib/eigen-3.4.0/bench/benchmarkX.cpp new file mode 100644 index 0000000..8e4b60c --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmarkX.cpp @@ -0,0 +1,36 @@ +// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b + +#include + +#include + +using namespace std; +using namespace Eigen; + +#ifndef MATTYPE +#define MATTYPE MatrixXLd +#endif + +#ifndef MATSIZE +#define MATSIZE 400 +#endif + +#ifndef REPEAT +#define REPEAT 100 +#endif + +int main(int argc, char *argv[]) +{ + MATTYPE I = MATTYPE::Ones(MATSIZE,MATSIZE); + MATTYPE m(MATSIZE,MATSIZE); + for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++) + { + m(i,j) = (i+j+1)/(MATSIZE*MATSIZE); + } + for(int a = 0; a < REPEAT; a++) + { + m = I + 0.0001 * (m + m*m); + } + cout << m(0,0) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/bench/benchmarkXcwise.cpp b/lib/eigen-3.4.0/bench/benchmarkXcwise.cpp new file mode 100644 index 0000000..6243743 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmarkXcwise.cpp @@ -0,0 +1,35 @@ +// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX + +#include +#include + +using namespace std; +using namespace Eigen; + +#ifndef VECTYPE +#define VECTYPE VectorXLd +#endif + +#ifndef VECSIZE +#define VECSIZE 1000000 +#endif + +#ifndef REPEAT +#define REPEAT 1000 +#endif + +int main(int argc, char *argv[]) +{ + VECTYPE I = VECTYPE::Ones(VECSIZE); + VECTYPE m(VECSIZE,1); + for(int i = 0; i < VECSIZE; i++) + { + m[i] = 0.1 * i/VECSIZE; + } + for(int a = 0; a < REPEAT; a++) + { + m = VECTYPE::Ones(VECSIZE) + 0.00005 * (m.cwise().square() + m/4); + } + cout << m[0] << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/bench/benchmark_suite b/lib/eigen-3.4.0/bench/benchmark_suite new file mode 100755 index 0000000..3f21d36 --- /dev/null +++ b/lib/eigen-3.4.0/bench/benchmark_suite @@ -0,0 +1,18 @@ +#!/bin/bash +CXX=${CXX-g++} # default value unless caller has defined CXX +echo "Fixed size 3x3, column-major, -DNDEBUG" +$CXX -O3 -I .. -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, column-major, with asserts" +$CXX -O3 -I .. benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, row-major, -DNDEBUG" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, row-major, with asserts" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Dynamic size 20x20, column-major, -DNDEBUG" +$CXX -O3 -I .. -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, column-major, with asserts" +$CXX -O3 -I .. benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, row-major, -DNDEBUG" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, row-major, with asserts" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null diff --git a/lib/eigen-3.4.0/bench/btl/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/CMakeLists.txt new file mode 100644 index 0000000..42094e8 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/CMakeLists.txt @@ -0,0 +1,107 @@ +project(BTL) + +cmake_minimum_required(VERSION 2.6.2) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${Eigen_SOURCE_DIR}/cmake) +include(MacroOptionalAddSubdirectory) + +option(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER}) +if(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) + set(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_CXX_FLAGS}") + set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_Fortran_FLAGS}") + if(BTL_NOVEC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") + endif(BTL_NOVEC) +endif(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) + +if(MSVC) + set(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG") +# set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG") + if(BTL_NOVEC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") + endif(BTL_NOVEC) +endif(MSVC) + +if(IS_ICPC) + set(CMAKE_CXX_FLAGS "-fast ${CMAKE_CXX_FLAGS}") + set(CMAKE_Fortran_FLAGS "-fast ${CMAKE_Fortran_FLAGS}") +endif() + +include_directories( + ${PROJECT_SOURCE_DIR}/actions + ${PROJECT_SOURCE_DIR}/generic_bench + ${PROJECT_SOURCE_DIR}/generic_bench/utils + ${PROJECT_SOURCE_DIR}/libs/STL) + +# find_package(MKL) +# if (MKL_FOUND) +# add_definitions(-DHAVE_MKL) +# set(DEFAULT_LIBRARIES ${MKL_LIBRARIES}) +# endif () + +find_library(EIGEN_BTL_RT_LIBRARY rt) +# if we cannot find it easily, then we don't need it! +if(NOT EIGEN_BTL_RT_LIBRARY) + set(EIGEN_BTL_RT_LIBRARY "") +endif() + +macro(BTL_ADD_BENCH targetname) + + foreach(_current_var ${ARGN}) + set(_last_var ${_current_var}) + endforeach() + + set(_sources ${ARGN}) + list(LENGTH _sources _argn_length) + + list(REMOVE_ITEM _sources ON OFF TRUE FALSE) + + list(LENGTH _sources _src_length) + + if (${_argn_length} EQUAL ${_src_length}) + set(_last_var ON) + endif () + + option(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var}) + + if(BUILD_${targetname}) + add_executable(${targetname} ${_sources}) + add_test(${targetname} "${targetname}") + target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} ${EIGEN_BTL_RT_LIBRARY}) + endif(BUILD_${targetname}) + +endmacro(BTL_ADD_BENCH) + +macro(btl_add_target_property target prop value) + + if(BUILD_${target}) + get_target_property(previous ${target} ${prop}) + if(NOT previous) + set(previous "") + endif() + set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") + endif() + +endmacro() + +enable_testing() + +add_subdirectory(libs/eigen3) +add_subdirectory(libs/eigen2) +add_subdirectory(libs/tensors) +add_subdirectory(libs/BLAS) +add_subdirectory(libs/ublas) +add_subdirectory(libs/gmm) +add_subdirectory(libs/mtl4) +add_subdirectory(libs/blitz) +add_subdirectory(libs/tvmet) +add_subdirectory(libs/STL) +add_subdirectory(libs/blaze) + +add_subdirectory(data) + + diff --git a/lib/eigen-3.4.0/bench/btl/COPYING b/lib/eigen-3.4.0/bench/btl/COPYING new file mode 100644 index 0000000..486449c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; 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. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/lib/eigen-3.4.0/bench/btl/README b/lib/eigen-3.4.0/bench/btl/README new file mode 100644 index 0000000..ebed889 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/README @@ -0,0 +1,154 @@ +Bench Template Library + +**************************************** +Introduction : + +The aim of this project is to compare the performance +of available numerical libraries. The code is designed +as generic and modular as possible. Thus, adding new +numerical libraries or new numerical tests should +require minimal effort. + + +***************************************** + +Installation : + +BTL uses cmake / ctest: + +1 - create a build directory: + + $ mkdir build + $ cd build + +2 - configure: + + $ ccmake .. + +3 - run the bench using ctest: + + $ ctest -V + +You can run the benchmarks only on libraries matching a given regular expression: + ctest -V -R +For instance: + ctest -V -R eigen2 + +You can also select a given set of actions defining the environment variable BTL_CONFIG this way: + BTL_CONFIG="-a action1{:action2}*" ctest -V +An example: + BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata" ctest -V -R eigen2 + +Finally, if bench results already exist (the bench*.dat files) then they merges by keeping the best for each matrix size. If you want to overwrite the previous ones you can simply add the "--overwrite" option: + BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata --overwrite" ctest -V -R eigen2 + +4 : Analyze the result. different data files (.dat) are produced in each libs directories. + If gnuplot is available, choose a directory name in the data directory to store the results and type: + $ cd data + $ mkdir my_directory + $ cp ../libs/*/*.dat my_directory + Build the data utilities in this (data) directory + make + Then you can look the raw data, + go_mean my_directory + or smooth the data first : + smooth_all.sh my_directory + go_mean my_directory_smooth + + +************************************************* + +Files and directories : + + generic_bench : all the bench sources common to all libraries + + actions : sources for different action wrappers (axpy, matrix-matrix product) to be tested. + + libs/* : bench sources specific to each tested libraries. + + machine_dep : directory used to store machine specific Makefile.in + + data : directory used to store gnuplot scripts and data analysis utilities + +************************************************** + +Principles : the code modularity is achieved by defining two concepts : + + ****** Action concept : This is a class defining which kind + of test must be performed (e.g. a matrix_vector_product). + An Action should define the following methods : + + *** Ctor using the size of the problem (matrix or vector size) as an argument + Action action(size); + *** initialize : this method initialize the calculation (e.g. initialize the matrices and vectors arguments) + action.initialize(); + *** calculate : this method actually launch the calculation to be benchmarked + action.calculate; + *** nb_op_base() : this method returns the complexity of the calculate method (allowing the mflops evaluation) + *** name() : this method returns the name of the action (std::string) + + ****** Interface concept : This is a class or namespace defining how to use a given library and + its specific containers (matrix and vector). Up to now an interface should following types + + *** real_type : kind of float to be used (float or double) + *** stl_vector : must correspond to std::vector + *** stl_matrix : must correspond to std::vector + *** gene_vector : the vector type for this interface --> e.g. (real_type *) for the C_interface + *** gene_matrix : the matrix type for this interface --> e.g. (gene_vector *) for the C_interface + + + the following common methods + + *** free_matrix(gene_matrix & A, int N) dealocation of a N sized gene_matrix A + *** free_vector(gene_vector & B) dealocation of a N sized gene_vector B + *** matrix_from_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an stl_matrix A_stl into a gene_matrix A. + The allocation of A is done in this function. + *** vector_to_stl(gene_vector & B, stl_vector & B_stl) copy the content of an stl_vector B_stl into a gene_vector B. + The allocation of B is done in this function. + *** matrix_to_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an gene_matrix A into an stl_matrix A_stl. + The size of A_STL must corresponds to the size of A. + *** vector_to_stl(gene_vector & A, stl_vector & A_stl) copy the content of an gene_vector A into an stl_vector A_stl. + The size of B_STL must corresponds to the size of B. + *** copy_matrix(gene_matrix & source, gene_matrix & cible, int N) : copy the content of source in cible. Both source + and cible must be sized NxN. + *** copy_vector(gene_vector & source, gene_vector & cible, int N) : copy the content of source in cible. Both source + and cible must be sized N. + + and the following method corresponding to the action one wants to be benchmarked : + + *** matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N) + *** matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N) + *** ata_product(const gene_matrix & A, gene_matrix & X, int N) + *** aat_product(const gene_matrix & A, gene_matrix & X, int N) + *** axpy(real coef, const gene_vector & X, gene_vector & Y, int N) + + The bench algorithm (generic_bench/bench.hh) is templated with an action itself templated with + an interface. A typical main.cpp source stored in a given library directory libs/A_LIB + looks like : + + bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + this function will produce XY data file containing measured mflops as a function of the size for 50 + sizes between 10 and 10000. + + This algorithm can be adapted by providing a given Perf_Analyzer object which determines how the time + measurements must be done. For example, the X86_Perf_Analyzer use the asm rdtsc function and provides + a very fast and accurate (but less portable) timing method. The default is the Portable_Perf_Analyzer + so + + bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + is equivalent to + + bench< Portable_Perf_Analyzer,AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + If your system supports it we suggest to use a mixed implementation (X86_perf_Analyzer+Portable_Perf_Analyzer). + replace + bench(size_min,size_max,nb_point); + with + bench(size_min,size_max,nb_point); + in generic/bench.hh + +. + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_aat_product.hh b/lib/eigen-3.4.0/bench/btl/actions/action_aat_product.hh new file mode 100644 index 0000000..aa5b35c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_aat_product.hh @@ -0,0 +1,145 @@ +//===================================================== +// File : action_aat_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AAT_PRODUCT +#define ACTION_AAT_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_aat_product { + +public : + + // Ctor + + Action_aat_product( int size ):_size(size) + { + MESSAGE("Action_aat_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_aat_product( const Action_aat_product & ) + { + INFOS("illegal call to Action_aat_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_aat_product( void ){ + + MESSAGE("Action_aat_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "aat_"+Interface::name(); + } + + double nb_op_base( void ){ + return double(_size)*double(_size)*double(_size); + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + + Interface::aat_product(A,X,_size); + + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::aat_product(A_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_ata_product.hh b/lib/eigen-3.4.0/bench/btl/actions/action_ata_product.hh new file mode 100644 index 0000000..04364fe --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_ata_product.hh @@ -0,0 +1,145 @@ +//===================================================== +// File : action_ata_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ATA_PRODUCT +#define ACTION_ATA_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_ata_product { + +public : + + // Ctor + + Action_ata_product( int size ):_size(size) + { + MESSAGE("Action_ata_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_ata_product( const Action_ata_product & ) + { + INFOS("illegal call to Action_ata_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_ata_product( void ){ + + MESSAGE("Action_ata_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "ata_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size*_size; + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + + Interface::ata_product(A,X,_size); + + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::ata_product(A_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_atv_product.hh b/lib/eigen-3.4.0/bench/btl/actions/action_atv_product.hh new file mode 100644 index 0000000..a823451 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_atv_product.hh @@ -0,0 +1,134 @@ +//===================================================== +// File : action_atv_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ATV_PRODUCT +#define ACTION_ATV_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_atv_product { + +public : + + Action_atv_product( int size ) : _size(size) + { + MESSAGE("Action_atv_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_atv_product( const Action_atv_product & ) + { + INFOS("illegal call to Action_atv_product Copy Ctor"); + exit(1); + } + + ~Action_atv_product( void ) + { + MESSAGE("Action_atv_product Dtor"); + + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + static inline std::string name() { return "atv_" + Interface::name(); } + + double nb_op_base( void ) { return 2.0*_size*_size; } + + inline void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("begin atv"); + Interface::atv_product(A,B,X,_size); + BTL_ASM_COMMENT("end atv"); + } + + void check_result( void ) + { + if (_size>128) return; + Interface::vector_to_stl(X,resu_stl); + + STL_interface::atv_product(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_axpby.hh b/lib/eigen-3.4.0/bench/btl/actions/action_axpby.hh new file mode 100644 index 0000000..dadd0cc --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_axpby.hh @@ -0,0 +1,127 @@ +//===================================================== +// File : action_axpby.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AXPBY +#define ACTION_AXPBY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_axpby { + +public : + + // Ctor + Action_axpby( int size ):_alpha(0.5),_beta(0.95),_size(size) + { + MESSAGE("Action_axpby Ctor"); + + // STL vector initialization + init_vector(X_stl,_size); + init_vector(Y_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(Y_ref,Y_stl); + + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(Y,Y_stl); + } + + // invalidate copy ctor + Action_axpby( const Action_axpby & ) + { + INFOS("illegal call to Action_axpby Copy Ctor"); + exit(1); + } + + // Dtor + ~Action_axpby( void ){ + MESSAGE("Action_axpby Dtor"); + + // deallocation + Interface::free_vector(X_ref); + Interface::free_vector(Y_ref); + + Interface::free_vector(X); + Interface::free_vector(Y); + } + + // action name + static inline std::string name( void ) + { + return "axpby_"+Interface::name(); + } + + double nb_op_base( void ){ + return 3.0*_size; + } + + inline void initialize( void ){ + Interface::copy_vector(X_ref,X,_size); + Interface::copy_vector(Y_ref,Y,_size); + } + + inline void calculate( void ) { + BTL_ASM_COMMENT("mybegin axpby"); + Interface::axpby(_alpha,X,_beta,Y,_size); + BTL_ASM_COMMENT("myend axpby"); + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(Y,resu_stl); + + STL_interface::axpby(_alpha,X_stl,_beta,Y_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(Y_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(2); + } + } + +private : + + typename Interface::stl_vector X_stl; + typename Interface::stl_vector Y_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_vector X_ref; + typename Interface::gene_vector Y_ref; + + typename Interface::gene_vector X; + typename Interface::gene_vector Y; + + typename Interface::real_type _alpha; + typename Interface::real_type _beta; + + int _size; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_axpy.hh b/lib/eigen-3.4.0/bench/btl/actions/action_axpy.hh new file mode 100644 index 0000000..261be4c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_axpy.hh @@ -0,0 +1,139 @@ +//===================================================== +// File : action_axpy.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AXPY +#define ACTION_AXPY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_axpy { + +public : + + // Ctor + + Action_axpy( int size ):_coef(1.0),_size(size) + { + MESSAGE("Action_axpy Ctor"); + + // STL vector initialization + + init_vector(X_stl,_size); + init_vector(Y_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(Y_ref,Y_stl); + + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(Y,Y_stl); + + + } + + // invalidate copy ctor + + Action_axpy( const Action_axpy & ) + { + INFOS("illegal call to Action_axpy Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_axpy( void ){ + + MESSAGE("Action_axpy Dtor"); + + // deallocation + + Interface::free_vector(X_ref); + Interface::free_vector(Y_ref); + + Interface::free_vector(X); + Interface::free_vector(Y); + } + + // action name + + static inline std::string name( void ) + { + return "axpy_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size; + } + + inline void initialize( void ){ + Interface::copy_vector(X_ref,X,_size); + Interface::copy_vector(Y_ref,Y,_size); + } + + inline void calculate( void ) { + BTL_ASM_COMMENT("mybegin axpy"); + Interface::axpy(_coef,X,Y,_size); + BTL_ASM_COMMENT("myend axpy"); + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::vector_to_stl(Y,resu_stl); + + STL_interface::axpy(_coef,X_stl,Y_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(Y_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_vector X_stl; + typename Interface::stl_vector Y_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_vector X_ref; + typename Interface::gene_vector Y_ref; + + typename Interface::gene_vector X; + typename Interface::gene_vector Y; + + typename Interface::real_type _coef; + + int _size; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_cholesky.hh b/lib/eigen-3.4.0/bench/btl/actions/action_cholesky.hh new file mode 100644 index 0000000..5f66d11 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_cholesky.hh @@ -0,0 +1,128 @@ +//===================================================== +// File : action_cholesky.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_CHOLESKY +#define ACTION_CHOLESKY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_cholesky { + +public : + + // Ctor + + Action_cholesky( int size ):_size(size) + { + MESSAGE("Action_cholesky Ctor"); + + // STL mat/vec initialization + init_matrix_symm(X_stl,_size); + init_matrix(C_stl,_size); + + // make sure X is invertible + for (int i=0; i<_size; ++i) + X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100; + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size; ++j) + { + double r = std::max(_size - j -1,0); + _cost += 2*(r*j+r+j); + } + } + + // invalidate copy ctor + + Action_cholesky( const Action_cholesky & ) + { + INFOS("illegal call to Action_cholesky Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_cholesky( void ){ + + MESSAGE("Action_cholesky Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "cholesky_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::cholesky(X,C,_size); + } + + void check_result( void ){ + // calculation check +// STL_interface::cholesky(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_ger.hh b/lib/eigen-3.4.0/bench/btl/actions/action_ger.hh new file mode 100644 index 0000000..dc766ef --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_ger.hh @@ -0,0 +1,128 @@ + +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_GER +#define ACTION_GER +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_ger { + +public : + + // Ctor + BTL_DONT_INLINE Action_ger( int size ):_size(size) + { + MESSAGE("Action_ger Ctor"); + + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_ger( const Action_ger & ) + { + INFOS("illegal call to Action_ger Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_ger( void ){ + MESSAGE("Action_ger Dtor"); + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + + } + + // action name + static inline std::string name( void ) + { + return "ger_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin ger"); + Interface::ger(A,B,X,_size); + BTL_ASM_COMMENT("end ger"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::ger(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-3){ + INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + int _size; +}; + + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_hessenberg.hh b/lib/eigen-3.4.0/bench/btl/actions/action_hessenberg.hh new file mode 100644 index 0000000..2100ebd --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_hessenberg.hh @@ -0,0 +1,233 @@ +//===================================================== +// File : action_hessenberg.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_HESSENBERG +#define ACTION_HESSENBERG +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_hessenberg { + +public : + + // Ctor + + Action_hessenberg( int size ):_size(size) + { + MESSAGE("Action_hessenberg Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + init_matrix(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size-2; ++j) + { + double r = std::max(0,_size-j-1); + double b = std::max(0,_size-j-2); + _cost += 6 + 3*b + r*r*4 + r*_size*4; + } + } + + // invalidate copy ctor + + Action_hessenberg( const Action_hessenberg & ) + { + INFOS("illegal call to Action_hessenberg Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_hessenberg( void ){ + + MESSAGE("Action_hessenberg Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "hessenberg_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::hessenberg(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::hessenberg(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +template +class Action_tridiagonalization { + +public : + + // Ctor + + Action_tridiagonalization( int size ):_size(size) + { + MESSAGE("Action_tridiagonalization Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + for(int i=0; i<_size; ++i) + { + for(int j=0; j(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size-2; ++j) + { + double r = std::max(0,_size-j-1); + double b = std::max(0,_size-j-2); + _cost += 6. + 3.*b + r*r*8.; + } + } + + // invalidate copy ctor + + Action_tridiagonalization( const Action_tridiagonalization & ) + { + INFOS("illegal call to Action_tridiagonalization Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_tridiagonalization( void ){ + + MESSAGE("Action_tridiagonalization Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) { return "tridiagonalization_"+Interface::name(); } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::tridiagonalization(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::tridiagonalization(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_lu_decomp.hh b/lib/eigen-3.4.0/bench/btl/actions/action_lu_decomp.hh new file mode 100644 index 0000000..2448e82 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_lu_decomp.hh @@ -0,0 +1,124 @@ +//===================================================== +// File : action_lu_decomp.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_LU_DECOMP +#define ACTION_LU_DECOMP +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_lu_decomp { + +public : + + // Ctor + + Action_lu_decomp( int size ):_size(size) + { + MESSAGE("Action_lu_decomp Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + init_matrix(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 2.0*size*size*size/3.0 + size*size; + } + + // invalidate copy ctor + + Action_lu_decomp( const Action_lu_decomp & ) + { + INFOS("illegal call to Action_lu_decomp Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_lu_decomp( void ){ + + MESSAGE("Action_lu_decomp Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "complete_lu_decomp_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::lu_decomp(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::lu_decomp(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_lu_solve.hh b/lib/eigen-3.4.0/bench/btl/actions/action_lu_solve.hh new file mode 100644 index 0000000..5a81e63 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_lu_solve.hh @@ -0,0 +1,136 @@ +//===================================================== +// File : action_lu_solve.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_LU_SOLVE +#define ACTION_LU_SOLVE +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_lu_solve +{ + +public : + + static inline std::string name( void ) + { + return "lu_solve_"+Interface::name(); + } + + static double nb_op_base(int size){ + return 2.0*size*size*size/3.0; // questionable but not really important + } + + + static double calculate( int nb_calc, int size ) { + + // STL matrix and vector initialization + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + + init_matrix(A_stl,size); + init_vector(B_stl,size); + init_vector(X_stl,size); + + // generic matrix and vector initialization + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + typename Interface::gene_matrix LU; + + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X,X_stl); + Interface::matrix_from_stl(LU,A_stl); + + // local variable : + + typename Interface::Pivot_Vector pivot; // pivot vector + Interface::new_Pivot_Vector(pivot,size); + + // timer utilities + + Portable_Timer chronos; + + // time measurement + + chronos.start(); + + for (int ii=0;ii::matrix_vector_product(A_stl,X_stl,B_new_stl,size); + + typename Interface::real_type error= + STL_interface::norm_diff(B_stl,B_new_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + STL_interface::display_vector(B_stl); + STL_interface::display_vector(B_new_stl); + exit(0); + } + + // deallocation and return time + + Interface::free_matrix(A,size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_Pivot_Vector(pivot); + + return time; + } + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product.hh b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product.hh new file mode 100644 index 0000000..f65ee05 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product.hh @@ -0,0 +1,150 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_MATRIX_PRODUCT +#define ACTION_MATRIX_MATRIX_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_matrix_matrix_product { + +public : + + // Ctor + + Action_matrix_matrix_product( int size ):_size(size) + { + MESSAGE("Action_matrix_matrix_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(B_ref,B_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(B,B_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_matrix_matrix_product( const Action_matrix_matrix_product & ) + { + INFOS("illegal call to Action_matrix_matrix_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_matrix_matrix_product( void ){ + + MESSAGE("Action_matrix_matrix_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(B,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(B_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "matrix_matrix_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size*_size; + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(B_ref,B,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + Interface::matrix_matrix_product(A,B,X,_size); + } + + void check_result( void ){ + + // calculation check + if (_size<200) + { + Interface::matrix_to_stl(X,resu_stl); + STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,_size); + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + } + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product_bis.hh b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product_bis.hh new file mode 100644 index 0000000..29c10a6 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_matrix_product_bis.hh @@ -0,0 +1,152 @@ +//===================================================== +// File : action_matrix_matrix_product_bis.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_MATRIX_PRODUCT_BIS +#define ACTION_MATRIX_MATRIX_PRODUCT_BIS +#include "utilities.h" +#include "STL_interface.hh" +#include "STL_timer.hh" +#include +#include "init_function.hh" +#include "init_vector.hh" +#include "init_matrix.hh" + +using namespace std; + +template +class Action_matrix_matrix_product_bis { + +public : + + static inline std::string name( void ) + { + return "matrix_matrix_"+Interface::name(); + } + + static double nb_op_base(int size){ + return 2.0*size*size*size; + } + + static double calculate( int nb_calc, int size ) { + + // STL matrix and vector initialization + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + + init_matrix(A_stl,size); + init_matrix(B_stl,size); + init_matrix(X_stl,size); + + // generic matrix and vector initialization + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(B_ref,B_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(B,B_stl); + Interface::matrix_from_stl(X,X_stl); + + + // STL_timer utilities + + STL_timer chronos; + + // Baseline evaluation + + chronos.start_baseline(nb_calc); + + do { + + Interface::copy_matrix(A_ref,A,size); + Interface::copy_matrix(B_ref,B,size); + Interface::copy_matrix(X_ref,X,size); + + + // Interface::matrix_matrix_product(A,B,X,size); This line must be commented !!!! + } + while(chronos.check()); + + chronos.report(true); + + // Time measurement + + chronos.start(nb_calc); + + do { + + Interface::copy_matrix(A_ref,A,size); + Interface::copy_matrix(B_ref,B,size); + Interface::copy_matrix(X_ref,X,size); + + Interface::matrix_matrix_product(A,B,X,size); // here it is not commented !!!! + } + while(chronos.check()); + + chronos.report(true); + + double time=chronos.calculated_time/2000.0; + + // calculation check + + typename Interface::stl_matrix resu_stl(size); + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + // deallocation and return time + + Interface::free_matrix(A,size); + Interface::free_matrix(B,size); + Interface::free_matrix(X,size); + + Interface::free_matrix(A_ref,size); + Interface::free_matrix(B_ref,size); + Interface::free_matrix(X_ref,size); + + return time; + } + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_matrix_vector_product.hh b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_vector_product.hh new file mode 100644 index 0000000..8bab79d --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_matrix_vector_product.hh @@ -0,0 +1,153 @@ +//===================================================== +// File : action_matrix_vector_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_VECTOR_PRODUCT +#define ACTION_MATRIX_VECTOR_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_matrix_vector_product { + +public : + + // Ctor + + BTL_DONT_INLINE Action_matrix_vector_product( int size ):_size(size) + { + MESSAGE("Action_matrix_vector_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_matrix_vector_product( const Action_matrix_vector_product & ) + { + INFOS("illegal call to Action_matrix_vector_product Copy Ctor"); + exit(1); + } + + // Dtor + + BTL_DONT_INLINE ~Action_matrix_vector_product( void ){ + + MESSAGE("Action_matrix_vector_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + + } + + // action name + + static inline std::string name( void ) + { + return "matrix_vector_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin matrix_vector_product"); + Interface::matrix_vector_product(A,B,X,_size); + BTL_ASM_COMMENT("end matrix_vector_product"); + } + + BTL_DONT_INLINE void check_result( void ){ + + // calculation check + + Interface::vector_to_stl(X,resu_stl); + + STL_interface::matrix_vector_product(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_partial_lu.hh b/lib/eigen-3.4.0/bench/btl/actions/action_partial_lu.hh new file mode 100644 index 0000000..770ea1d --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_partial_lu.hh @@ -0,0 +1,125 @@ +//===================================================== +// File : action_lu_decomp.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_PARTIAL_LU +#define ACTION_PARTIAL_LU +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_partial_lu { + +public : + + // Ctor + + Action_partial_lu( int size ):_size(size) + { + MESSAGE("Action_partial_lu Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + init_matrix(C_stl,_size); + + // make sure X is invertible + for (int i=0; i<_size; ++i) + X_stl[i][i] = X_stl[i][i] * 1e2 + 1; + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 2.0*size*size*size/3.0 + size*size; + } + + // invalidate copy ctor + + Action_partial_lu( const Action_partial_lu & ) + { + INFOS("illegal call to Action_partial_lu Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_partial_lu( void ){ + + MESSAGE("Action_partial_lu Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "partial_lu_decomp_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::partial_lu_decomp(X,C,_size); + } + + void check_result( void ){ + // calculation check +// Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::lu_decomp(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_rot.hh b/lib/eigen-3.4.0/bench/btl/actions/action_rot.hh new file mode 100644 index 0000000..df822a6 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_rot.hh @@ -0,0 +1,116 @@ + +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ROT +#define ACTION_ROT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_rot { + +public : + + // Ctor + BTL_DONT_INLINE Action_rot( int size ):_size(size) + { + MESSAGE("Action_rot Ctor"); + + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_vector(A_stl,_size); + init_vector(B_stl,_size); + + // generic matrix and vector initialization + Interface::vector_from_stl(A_ref,A_stl); + Interface::vector_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + } + + // invalidate copy ctor + Action_rot( const Action_rot & ) + { + INFOS("illegal call to Action_rot Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_rot( void ){ + MESSAGE("Action_rot Dtor"); + Interface::free_vector(A); + Interface::free_vector(B); + Interface::free_vector(A_ref); + Interface::free_vector(B_ref); + } + + // action name + static inline std::string name( void ) + { + return "rot_" + Interface::name(); + } + + double nb_op_base( void ){ + return 6.0*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_vector(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin rot"); + Interface::rot(A,B,0.5,0.6,_size); + BTL_ASM_COMMENT("end rot"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check +// Interface::vector_to_stl(X,resu_stl); + +// STL_interface::rot(A_stl,B_stl,X_stl,_size); + +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); + +// if (error>1.e-3){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_vector A_stl; + typename Interface::stl_vector B_stl; + + typename Interface::gene_vector A_ref; + typename Interface::gene_vector B_ref; + + typename Interface::gene_vector A; + typename Interface::gene_vector B; + + int _size; +}; + + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_symv.hh b/lib/eigen-3.4.0/bench/btl/actions/action_symv.hh new file mode 100644 index 0000000..a32b9df --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_symv.hh @@ -0,0 +1,139 @@ +//===================================================== +// File : action_symv.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_SYMV +#define ACTION_SYMV +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_symv { + +public : + + // Ctor + + BTL_DONT_INLINE Action_symv( int size ):_size(size) + { + MESSAGE("Action_symv Ctor"); + + // STL matrix and vector initialization + init_matrix_symm(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_symv( const Action_symv & ) + { + INFOS("illegal call to Action_symv Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_symv( void ){ + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + // action name + + static inline std::string name( void ) + { + return "symv_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin symv"); + Interface::symv(A,B,X,_size); + BTL_ASM_COMMENT("end symv"); + } + + BTL_DONT_INLINE void check_result( void ){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::symv(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_syr2.hh b/lib/eigen-3.4.0/bench/btl/actions/action_syr2.hh new file mode 100644 index 0000000..7c6712b --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_syr2.hh @@ -0,0 +1,133 @@ +//===================================================== +// File : action_syr2.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_SYR2 +#define ACTION_SYR2 +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_syr2 { + +public : + + // Ctor + + BTL_DONT_INLINE Action_syr2( int size ):_size(size) + { + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_syr2( const Action_syr2 & ) + { + INFOS("illegal call to Action_syr2 Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_syr2( void ){ + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + // action name + + static inline std::string name( void ) + { + return "syr2_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin syr2"); + Interface::syr2(A,B,X,_size); + BTL_ASM_COMMENT("end syr2"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::syr2(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-3){ + INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_trisolve.hh b/lib/eigen-3.4.0/bench/btl/actions/action_trisolve.hh new file mode 100644 index 0000000..d6f0b47 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_trisolve.hh @@ -0,0 +1,137 @@ +//===================================================== +// File : action_trisolve.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRISOLVE +#define ACTION_TRISOLVE +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trisolve { + +public : + + // Ctor + + Action_trisolve( int size ):_size(size) + { + MESSAGE("Action_trisolve Ctor"); + + // STL vector initialization + init_matrix(L_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + for (int j=0; j<_size; ++j) + { + for (int i=0; i(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(L,L_stl); + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(B,B_stl); + + _cost = 0; + for (int j=0; j<_size; ++j) + { + _cost += 2*j + 1; + } + } + + // invalidate copy ctor + + Action_trisolve( const Action_trisolve & ) + { + INFOS("illegal call to Action_trisolve Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_trisolve( void ){ + + MESSAGE("Action_trisolve Dtor"); + + // deallocation + Interface::free_matrix(L,_size); + Interface::free_vector(B); + Interface::free_vector(X); + } + + // action name + + static inline std::string name( void ) + { + return "trisolve_vector_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + //Interface::copy_vector(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::trisolve_lower(L,B,X,_size); + } + + void check_result(){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::trisolve_lower(L_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-4){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(2); + } //else INFOS("CALCULATION OK...residual=" << error); + + } + +private : + + typename Interface::stl_matrix L_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix L; + typename Interface::gene_vector X; + typename Interface::gene_vector B; + + int _size; + double _cost; +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_trisolve_matrix.hh b/lib/eigen-3.4.0/bench/btl/actions/action_trisolve_matrix.hh new file mode 100644 index 0000000..0fc2bb9 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_trisolve_matrix.hh @@ -0,0 +1,165 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRISOLVE_MATRIX_PRODUCT +#define ACTION_TRISOLVE_MATRIX_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trisolve_matrix { + +public : + + // Ctor + + Action_trisolve_matrix( int size ):_size(size) + { + MESSAGE("Action_trisolve_matrix Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + for (int j=0; j<_size; ++j) + { + for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// // exit(1); +// } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + int _size; + double _cost; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/action_trmm.hh b/lib/eigen-3.4.0/bench/btl/actions/action_trmm.hh new file mode 100644 index 0000000..8f78138 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/action_trmm.hh @@ -0,0 +1,165 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRMM +#define ACTION_TRMM +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trmm { + +public : + + // Ctor + + Action_trmm( int size ):_size(size) + { + MESSAGE("Action_trmm Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + for (int j=0; j<_size; ++j) + { + for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// // exit(1); +// } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + int _size; + double _cost; + +}; + + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/actions/basic_actions.hh b/lib/eigen-3.4.0/bench/btl/actions/basic_actions.hh new file mode 100644 index 0000000..62442f0 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/actions/basic_actions.hh @@ -0,0 +1,21 @@ + +#include "action_axpy.hh" +#include "action_axpby.hh" + +#include "action_matrix_vector_product.hh" +#include "action_atv_product.hh" + +#include "action_matrix_matrix_product.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" + +#include "action_trisolve.hh" +#include "action_trmm.hh" +#include "action_symv.hh" +// #include "action_symm.hh" +#include "action_syr2.hh" +#include "action_ger.hh" +#include "action_rot.hh" + +// #include "action_lu_solve.hh" + diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindACML.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindACML.cmake new file mode 100644 index 0000000..daeeb53 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindACML.cmake @@ -0,0 +1,51 @@ + +if (ACML_LIBRARIES) + set(ACML_FIND_QUIETLY TRUE) +endif () + +find_library(ACML_LIBRARIES + NAMES + acml_mp acml_mv + PATHS + $ENV{ACMLDIR}/lib + $ENV{ACML_DIR}/lib + ${LIB_INSTALL_DIR} +) + +find_file(ACML_LIBRARIES + NAMES + libacml_mp.so + PATHS + /usr/lib + /usr/lib64 + $ENV{ACMLDIR}/lib + ${LIB_INSTALL_DIR} +) + +if(NOT ACML_LIBRARIES) + message(STATUS "Multi-threaded library not found, looking for single-threaded") + find_library(ACML_LIBRARIES + NAMES + acml acml_mv + PATHS + $ENV{ACMLDIR}/lib + $ENV{ACML_DIR}/lib + ${LIB_INSTALL_DIR} + ) + find_file(ACML_LIBRARIES + libacml.so libacml_mv.so + PATHS + /usr/lib + /usr/lib64 + $ENV{ACMLDIR}/lib + ${LIB_INSTALL_DIR} + ) +endif() + + + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES) + +mark_as_advanced(ACML_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindATLAS.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindATLAS.cmake new file mode 100644 index 0000000..572a4c0 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindATLAS.cmake @@ -0,0 +1,31 @@ + +if (ATLAS_LIBRARIES) + set(ATLAS_FIND_QUIETLY TRUE) +endif () + +find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_LIB satlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +find_file(ATLAS_LAPACK NAMES liblapack_atlas.so.3 liblapack.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_LAPACK NAMES lapack_atlas lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS) + + set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_LIB}) + + # search the default lapack lib link to it + find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64) + find_library(ATLAS_REFERENCE_LAPACK NAMES lapack) +# if(ATLAS_REFERENCE_LAPACK) +# set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK}) +# endif() + +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES) + +mark_as_advanced(ATLAS_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindBLAZE.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindBLAZE.cmake new file mode 100644 index 0000000..18a878f --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindBLAZE.cmake @@ -0,0 +1,31 @@ +# - Try to find eigen2 headers +# Once done this will define +# +# BLAZE_FOUND - system has blaze lib +# BLAZE_INCLUDE_DIR - the blaze include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (BLAZE_INCLUDE_DIR) + + # in cache already + set(BLAZE_FOUND TRUE) + +else () + +find_path(BLAZE_INCLUDE_DIR NAMES blaze/Blaze.h + PATHS + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BLAZE DEFAULT_MSG BLAZE_INCLUDE_DIR) + +mark_as_advanced(BLAZE_INCLUDE_DIR) + +endif() + diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindBlitz.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindBlitz.cmake new file mode 100644 index 0000000..7ab375f --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindBlitz.cmake @@ -0,0 +1,40 @@ +# - Try to find blitz lib +# Once done this will define +# +# BLITZ_FOUND - system has blitz lib +# BLITZ_INCLUDES - the blitz include directory +# BLITZ_LIBRARIES - The libraries needed to use blitz + +# Copyright (c) 2006, Montel Laurent, +# Copyright (c) 2007, Allen Winter, +# Copyright (C) 2008 Gael Guennebaud +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +# include(FindLibraryWithDebug) + +if (BLITZ_INCLUDES AND BLITZ_LIBRARIES) + set(Blitz_FIND_QUIETLY TRUE) +endif () + +find_path(BLITZ_INCLUDES + NAMES + blitz/array.h + PATH_SUFFIXES blitz* + PATHS + $ENV{BLITZDIR}/include + ${INCLUDE_INSTALL_DIR} +) + +find_library(BLITZ_LIBRARIES + blitz + PATHS + $ENV{BLITZDIR}/lib + ${LIB_INSTALL_DIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Blitz DEFAULT_MSG + BLITZ_INCLUDES BLITZ_LIBRARIES) + +mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindCBLAS.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindCBLAS.cmake new file mode 100644 index 0000000..43a90f7 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindCBLAS.cmake @@ -0,0 +1,35 @@ +# include(FindLibraryWithDebug) + +if (CBLAS_INCLUDES AND CBLAS_LIBRARIES) + set(CBLAS_FIND_QUIETLY TRUE) +endif () + +find_path(CBLAS_INCLUDES + NAMES + cblas.h + PATHS + $ENV{CBLASDIR}/include + ${INCLUDE_INSTALL_DIR} +) + +find_library(CBLAS_LIBRARIES + cblas + PATHS + $ENV{CBLASDIR}/lib + ${LIB_INSTALL_DIR} +) + +find_file(CBLAS_LIBRARIES + libcblas.so.3 + PATHS + /usr/lib + /usr/lib64 + $ENV{CBLASDIR}/lib + ${LIB_INSTALL_DIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CBLAS DEFAULT_MSG + CBLAS_INCLUDES CBLAS_LIBRARIES) + +mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindGMM.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindGMM.cmake new file mode 100644 index 0000000..ff45e6a --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindGMM.cmake @@ -0,0 +1,17 @@ +if (GMM_INCLUDE_DIR) + # in cache already + set(GMM_FOUND TRUE) +else () + +find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h + PATHS + ${INCLUDE_INSTALL_DIR} + ${GMM_INCLUDE_PATH} + ) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR ) + +mark_as_advanced(GMM_INCLUDE_DIR) + +endif() diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindMKL.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindMKL.cmake new file mode 100644 index 0000000..23e7727 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindMKL.cmake @@ -0,0 +1,65 @@ + +if (MKL_LIBRARIES) + set(MKL_FIND_QUIETLY TRUE) +endif () + +if(CMAKE_MINOR_VERSION GREATER 4) + +if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") + +find_library(MKL_LIBRARIES + mkl_core + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/em64t + /opt/intel/Compiler/*/*/mkl/lib/em64t + ${LIB_INSTALL_DIR} +) + +find_library(MKL_GUIDE + guide + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/em64t + /opt/intel/Compiler/*/*/mkl/lib/em64t + /opt/intel/Compiler/*/*/lib/intel64 + ${LIB_INSTALL_DIR} +) + +if(MKL_LIBRARIES AND MKL_GUIDE) + set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread) +endif() + +else() + +find_library(MKL_LIBRARIES + mkl_core + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/32 + /opt/intel/Compiler/*/*/mkl/lib/32 + ${LIB_INSTALL_DIR} +) + +find_library(MKL_GUIDE + guide + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/32 + /opt/intel/Compiler/*/*/mkl/lib/32 + /opt/intel/Compiler/*/*/lib/intel32 + ${LIB_INSTALL_DIR} +) + +if(MKL_LIBRARIES AND MKL_GUIDE) + set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread) +endif() + +endif() + +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES) + +mark_as_advanced(MKL_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindMTL4.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindMTL4.cmake new file mode 100644 index 0000000..1bafc93 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindMTL4.cmake @@ -0,0 +1,31 @@ +# - Try to find eigen2 headers +# Once done this will define +# +# MTL4_FOUND - system has eigen2 lib +# MTL4_INCLUDE_DIR - the eigen2 include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (MTL4_INCLUDE_DIR) + + # in cache already + set(MTL4_FOUND TRUE) + +else () + +find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp + PATHS + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR) + +mark_as_advanced(MTL4_INCLUDE_DIR) + +endif() + diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindOPENBLAS.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindOPENBLAS.cmake new file mode 100644 index 0000000..5c07623 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindOPENBLAS.cmake @@ -0,0 +1,17 @@ + +if (OPENBLAS_LIBRARIES) + set(OPENBLAS_FIND_QUIETLY TRUE) +endif () + +find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) +find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) + +if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX) + set(OPENBLAS_LIBRARIES ${OPENBLAS_LIBRARIES} "-lpthread -lgfortran") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OPENBLAS DEFAULT_MSG + OPENBLAS_LIBRARIES) + +mark_as_advanced(OPENBLAS_LIBRARIES) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindPackageHandleStandardArgs.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 0000000..05d7e65 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,60 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) +# +# This macro is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED and QUIET argument to find_package() and +# it also sets the _FOUND variable. +# The package is found if all variables listed are TRUE. +# Example: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# +# If it is found, the location is reported using the VAR1 argument, so +# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. +# If the second argument is DEFAULT_MSG, the message in the failure case will +# be "Could NOT find LibXml2", if you don't like this message you can specify +# your own custom failure message there. + +macro(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) + + if("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + if (${_NAME}_FIND_REQUIRED) + set(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") + else (${_NAME}_FIND_REQUIRED) + set(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") + endif (${_NAME}_FIND_REQUIRED) + else("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + set(_FAIL_MESSAGE "${_FAIL_MSG}") + endif("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + + string(TOUPPER ${_NAME} _NAME_UPPER) + + set(${_NAME_UPPER}_FOUND TRUE) + if(NOT ${_VAR1}) + set(${_NAME_UPPER}_FOUND FALSE) + endif(NOT ${_VAR1}) + + foreach(_CURRENT_VAR ${ARGN}) + if(NOT ${_CURRENT_VAR}) + set(${_NAME_UPPER}_FOUND FALSE) + endif(NOT ${_CURRENT_VAR}) + endforeach(_CURRENT_VAR) + + if (${_NAME_UPPER}_FOUND) + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "Found ${_NAME}: ${${_VAR1}}") + endif (NOT ${_NAME}_FIND_QUIETLY) + else (${_NAME_UPPER}_FOUND) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_FAIL_MESSAGE}") + else (${_NAME}_FIND_REQUIRED) + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_FAIL_MESSAGE}") + endif (NOT ${_NAME}_FIND_QUIETLY) + endif (${_NAME}_FIND_REQUIRED) + endif (${_NAME_UPPER}_FOUND) +endmacro(FIND_PACKAGE_HANDLE_STANDARD_ARGS) diff --git a/lib/eigen-3.4.0/bench/btl/cmake/FindTvmet.cmake b/lib/eigen-3.4.0/bench/btl/cmake/FindTvmet.cmake new file mode 100644 index 0000000..8ccae27 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/FindTvmet.cmake @@ -0,0 +1,32 @@ +# - Try to find tvmet headers +# Once done this will define +# +# TVMET_FOUND - system has tvmet lib +# TVMET_INCLUDE_DIR - the tvmet include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (TVMET_INCLUDE_DIR) + + # in cache already + set(TVMET_FOUND TRUE) + +else () + +find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h + PATHS + ${TVMETDIR}/ + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR) + +mark_as_advanced(TVMET_INCLUDE_DIR) + +endif() + diff --git a/lib/eigen-3.4.0/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake b/lib/eigen-3.4.0/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake new file mode 100644 index 0000000..8d46fce --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake @@ -0,0 +1,31 @@ +# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines add_subdirectory() with an option() +# MACRO_OPTIONAL_ADD_SUBDIRECTORY( ) +# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of add_subdirectory(), +# this will have two effects +# 1 - CMake will not complain if the directory doesn't exist +# This makes sense if you want to distribute just one of the subdirs +# in a source package, e.g. just one of the subdirs in kdeextragear. +# 2 - If the directory exists, it will offer an option to skip the +# subdirectory. +# This is useful if you want to compile only a subset of all +# directories. + +# Copyright (c) 2007, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +macro (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) + get_filename_component(_fullPath ${_dir} ABSOLUTE) + if(EXISTS ${_fullPath}) + if(${ARGC} EQUAL 2) + option(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1}) + else(${ARGC} EQUAL 2) + option(BUILD_${_dir} "Build directory ${_dir}" TRUE) + endif(${ARGC} EQUAL 2) + if(BUILD_${_dir}) + add_subdirectory(${_dir}) + endif(BUILD_${_dir}) + endif(EXISTS ${_fullPath}) +endmacro (MACRO_OPTIONAL_ADD_SUBDIRECTORY) diff --git a/lib/eigen-3.4.0/bench/btl/data/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/data/CMakeLists.txt new file mode 100644 index 0000000..580c1ce --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/CMakeLists.txt @@ -0,0 +1,32 @@ + +add_custom_target(copy_scripts) + +set(script_files go_mean mk_mean_script.sh mk_new_gnuplot.sh + perlib_plot_settings.txt action_settings.txt gnuplot_common_settings.hh ) + +foreach(script_file ${script_files}) +add_custom_command( + TARGET copy_scripts + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${script_file} ${CMAKE_CURRENT_BINARY_DIR}/ + ARGS +) +endforeach(script_file) + +add_custom_command( + TARGET copy_scripts + POST_BUILD + COMMAND ${CMAKE_CXX_COMPILER} --version | head -n 1 > ${CMAKE_CURRENT_BINARY_DIR}/compiler_version.txt + ARGS +) +add_custom_command( + TARGET copy_scripts + POST_BUILD + COMMAND echo "${Eigen_SOURCE_DIR}" > ${CMAKE_CURRENT_BINARY_DIR}/eigen_root_dir.txt + ARGS +) + +add_executable(smooth smooth.cxx) +add_executable(regularize regularize.cxx) +add_executable(main mean.cxx) +add_dependencies(main copy_scripts) diff --git a/lib/eigen-3.4.0/bench/btl/data/action_settings.txt b/lib/eigen-3.4.0/bench/btl/data/action_settings.txt new file mode 100644 index 0000000..39d2b5d --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/action_settings.txt @@ -0,0 +1,19 @@ +aat ; "{/*1.5 A x A^T}" ; "matrix size" ; 4:5000 +ata ; "{/*1.5 A^T x A}" ; "matrix size" ; 4:5000 +atv ; "{/*1.5 matrix^T x vector}" ; "matrix size" ; 4:5000 +axpby ; "{/*1.5 Y = alpha X + beta Y}" ; "vector size" ; 5:1000000 +axpy ; "{/*1.5 Y += alpha X}" ; "vector size" ; 5:1000000 +matrix_matrix ; "{/*1.5 matrix matrix product}" ; "matrix size" ; 4:5000 +matrix_vector ; "{/*1.5 matrix vector product}" ; "matrix size" ; 4:5000 +trmm ; "{/*1.5 triangular matrix matrix product}" ; "matrix size" ; 4:5000 +trisolve_vector ; "{/*1.5 triangular solver - vector (X = inv(L) X)}" ; "size" ; 4:5000 +trisolve_matrix ; "{/*1.5 triangular solver - matrix (M = inv(L) M)}" ; "size" ; 4:5000 +cholesky ; "{/*1.5 Cholesky decomposition}" ; "matrix size" ; 4:5000 +complete_lu_decomp ; "{/*1.5 Complete LU decomposition}" ; "matrix size" ; 4:5000 +partial_lu_decomp ; "{/*1.5 Partial LU decomposition}" ; "matrix size" ; 4:5000 +tridiagonalization ; "{/*1.5 Tridiagonalization}" ; "matrix size" ; 4:5000 +hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000 +symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000 +syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000 +ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000 +rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000 diff --git a/lib/eigen-3.4.0/bench/btl/data/gnuplot_common_settings.hh b/lib/eigen-3.4.0/bench/btl/data/gnuplot_common_settings.hh new file mode 100644 index 0000000..6f677df --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/gnuplot_common_settings.hh @@ -0,0 +1,87 @@ +set noclip points +set clip one +set noclip two +set bar 1.000000 +set border 31 lt -1 lw 1.000 +set xdata +set ydata +set zdata +set x2data +set y2data +set boxwidth +set dummy x,y +set format x "%g" +set format y "%g" +set format x2 "%g" +set format y2 "%g" +set format z "%g" +set angles radians +set nogrid +set key title "" +set key left top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 +set nolabel +set noarrow +# set nolinestyle # deprecated +set nologscale +set logscale x 10 +set offsets 0, 0, 0, 0 +set pointsize 1 +set encoding default +set nopolar +set noparametric +set view 60, 30, 1, 1 +set samples 100, 100 +set isosamples 10, 10 +set surface +set nocontour +set clabel '%8.3g' +set mapping cartesian +set nohidden3d +set cntrparam order 4 +set cntrparam linear +set cntrparam levels auto 5 +set cntrparam points 5 +set size ratio 0 1,1 +set origin 0,0 +# set data style lines +# set function style lines +set xzeroaxis lt -2 lw 1.000 +set x2zeroaxis lt -2 lw 1.000 +set yzeroaxis lt -2 lw 1.000 +set y2zeroaxis lt -2 lw 1.000 +set tics in +set ticslevel 0.5 +set tics scale 1, 0.5 +set mxtics default +set mytics default +set mx2tics default +set my2tics default +set xtics border mirror norotate autofreq +set ytics border mirror norotate autofreq +set ztics border nomirror norotate autofreq +set nox2tics +set noy2tics +set timestamp "" bottom norotate offset 0,0 +set rrange [ * : * ] noreverse nowriteback # (currently [-0:10] ) +set trange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set urange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set vrange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set xlabel "matrix size" offset 0,0 +set x2label "" offset 0,0 +set timefmt "%d/%m/%y\n%H:%M" +set xrange [ 10 : 1000 ] noreverse nowriteback +set x2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set ylabel "MFLOPS" offset 0,0 +set y2label "" offset 0,0 +set yrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set y2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zlabel "" offset 0,0 +set zrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zero 1e-08 +set lmargin -1 +set bmargin -1 +set rmargin -1 +set tmargin -1 +set locale "C" +set xrange [4:1024] + diff --git a/lib/eigen-3.4.0/bench/btl/data/go_mean b/lib/eigen-3.4.0/bench/btl/data/go_mean new file mode 100755 index 0000000..d014269 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/go_mean @@ -0,0 +1,58 @@ +#!/bin/bash + +if [ $# < 1 ]; then + echo "Usage: $0 working_directory [tiny|large [prefix]]" +else + +mkdir -p $1 +##cp ../libs/*/*.dat $1 + +mode=large +if [ $# > 2 ]; then + mode=$2 +fi +if [ $# > 3 ]; then + prefix=$3 +fi + +EIGENDIR=`cat eigen_root_dir.txt` + +webpagefilename=$1/index.html +meanstatsfilename=$1/mean.html + +echo '' > $meanstatsfilename +echo '' > $webpagefilename +echo '

Configuration' >> $webpagefilename +echo '

    '\ + '
  • ' `cat /proc/cpuinfo | grep "model name" | head -n 1`\ + ' (' `uname -m` ')
  • '\ + '
  • compiler: ' `cat compiler_version.txt` '
  • '\ + '
  • eigen3: ' `git ls-remote --refs -q $EIGENDIR HEAD | cut -f 1` '
  • '\ + '
' \ + '

' >> $webpagefilename + +source mk_mean_script.sh axpy $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh axpby $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh matrix_vector $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh atv $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh matrix_matrix $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh aat $1 11 100 300 1000 $mode $prefix +# source mk_mean_script.sh ata $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trmm $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trisolve_vector $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trisolve_matrix $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh cholesky $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh partial_lu_decomp $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh tridiagonalization $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh hessenberg $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh symv $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh syr2 $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh ger $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh rot $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh complete_lu_decomp $1 11 100 300 1000 $mode $prefix + +fi + +## compile the web page ## + +#echo `cat footer.html` >> $webpagefilename \ No newline at end of file diff --git a/lib/eigen-3.4.0/bench/btl/data/mean.cxx b/lib/eigen-3.4.0/bench/btl/data/mean.cxx new file mode 100644 index 0000000..c567ef3 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/mean.cxx @@ -0,0 +1,182 @@ +//===================================================== +// File : mean.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include "bench_parameter.hh" +#include "utils/xy_file.hh" +#include + +using namespace std; + +double mean_calc(const vector & tab_sizes, const vector & tab_mflops, const int size_min, const int size_max); + +class Lib_Mean{ + +public: + Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){ + MESSAGE("Lib_mean Default Ctor"); + MESSAGE("!!! should not be used"); + exit(0); + } + Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){ + MESSAGE("Lib_mean Ctor"); + } + Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){ + MESSAGE("Lib_mean Copy Ctor"); + } + ~Lib_Mean( void ){ + MESSAGE("Lib_mean Dtor"); + } + + double _mean_in_cache; + double _mean_out_of_cache; + string _lib_name; + + bool operator < ( const Lib_Mean &right) const + { + //return ( this->_mean_out_of_cache > right._mean_out_of_cache) ; + return ( this->_mean_in_cache > right._mean_in_cache) ; + } + +}; + + +int main( int argc , char *argv[] ) +{ + + if (argc<6){ + INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2..."); + exit(0); + } + INFOS(argc); + + int min_in_cache=atoi(argv[2]); + int max_in_cache=atoi(argv[3]); + int min_out_of_cache=atoi(argv[4]); + int max_out_of_cache=atoi(argv[5]); + + + multiset s_lib_mean ; + + for (int i=6;i tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache); + moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache); + + Lib_Mean cur_lib_mean(filename,mic,moc); + + s_lib_mean.insert(cur_lib_mean); + + } + + } + + + cout << "" << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + + multiset::iterator is = s_lib_mean.begin(); + Lib_Mean best(*is); + + + for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){ + + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + + } + + cout << "
" << argv[1] << " in cache
mean perf
Mflops
in cache
% best
out of cache
mean perf
Mflops
out of cache
% best
details comments
" << is->_lib_name << " " << is->_mean_in_cache << " " << 100*(is->_mean_in_cache/best._mean_in_cache) << " " << is->_mean_out_of_cache << " " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " " << + "_lib_name<<"_"<snippet/" + "_lib_name<<"_flags\">flags " << + "_lib_name<<"_comments\">click here
" << endl ; + + ofstream output_file ("../order_lib",ios::out) ; + + for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){ + output_file << is->_lib_name << endl ; + } + + output_file.close(); + +} + +double mean_calc(const vector & tab_sizes, const vector & tab_mflops, const int size_min, const int size_max){ + + int size=tab_sizes.size(); + int nb_sample=0; + double mean=0.0; + + for (int i=0;i=size_min)&&(tab_sizes[i]<=size_max)){ + + nb_sample++; + mean+=tab_mflops[i]; + + } + + + } + + if (nb_sample==0){ + INFOS("no data for mean calculation"); + return 0.0; + } + + return mean/nb_sample; +} + + + + diff --git a/lib/eigen-3.4.0/bench/btl/data/mk_gnuplot_script.sh b/lib/eigen-3.4.0/bench/btl/data/mk_gnuplot_script.sh new file mode 100644 index 0000000..2ca7b5c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/mk_gnuplot_script.sh @@ -0,0 +1,68 @@ +#! /bin/bash +WHAT=$1 +DIR=$2 +echo $WHAT script generation +cat $WHAT.hh > $WHAT.gnuplot + +DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT` + +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + LAST=$FILE +done + +echo LAST=$LAST + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + +#echo set term postscript color >> $WHAT.gnuplot +#echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot +echo set term pbm small color >> $WHAT.gnuplot +echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + +echo set term jpeg large >> $WHAT.gnuplot +echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + + +gnuplot -persist < $WHAT.gnuplot + +rm $WHAT.gnuplot + + + + diff --git a/lib/eigen-3.4.0/bench/btl/data/mk_mean_script.sh b/lib/eigen-3.4.0/bench/btl/data/mk_mean_script.sh new file mode 100644 index 0000000..b10df02 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/mk_mean_script.sh @@ -0,0 +1,52 @@ +#! /bin/bash +WHAT=$1 +DIR=$2 +MINIC=$3 +MAXIC=$4 +MINOC=$5 +MAXOC=$6 +prefix=$8 + +meanstatsfilename=$2/mean.html + +WORK_DIR=tmp +mkdir $WORK_DIR + +DATA_FILE=`find $DIR -name "*.dat" | grep _${WHAT}` + +if [ -n "$DATA_FILE" ]; then + + echo "" + echo "$1..." + for FILE in $DATA_FILE + do + ##echo hello world + ##echo "mk_mean_script1" ${FILE} + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + + ##echo "mk_mean_script1" ${TITLE} + cp $FILE ${WORK_DIR}/${TITLE} + + done + + cd $WORK_DIR + ../main $1 $3 $4 $5 $6 * >> ../$meanstatsfilename + ../mk_new_gnuplot.sh $1 $2 $7 + rm -f *.gnuplot + cd .. + + echo '
' >> $meanstatsfilename + + webpagefilename=$2/index.html + # echo '

'${WHAT}'

' >> $webpagefilename + echo '
'${WHAT}'
' >> $webpagefilename + +fi + +rm -R $WORK_DIR + + + + + + diff --git a/lib/eigen-3.4.0/bench/btl/data/mk_new_gnuplot.sh b/lib/eigen-3.4.0/bench/btl/data/mk_new_gnuplot.sh new file mode 100755 index 0000000..fad3b23 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/mk_new_gnuplot.sh @@ -0,0 +1,54 @@ +#!/bin/bash +WHAT=$1 +DIR=$2 + +cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot + +echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot +echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot +echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot + +if [ $# > 3 ]; then + if [ "$3" == "tiny" ]; then + echo "set xrange [2:16]" >> $WHAT.gnuplot + echo "set nologscale" >> $WHAT.gnuplot + fi +fi + + + +DATA_FILE=`cat ../order_lib` +echo set term postscript color rounded enhanced >> $WHAT.gnuplot +echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot + +# echo set term svg color rounded enhanced >> $WHAT.gnuplot +# echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot +# echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot + +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + LAST=$FILE +done + +for FILE in $DATA_FILE +do + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + + echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >> $WHAT.gnuplot + if [ $FILE != $LAST ] + then + echo ", \\" >> $WHAT.gnuplot + fi +done +echo " " >> $WHAT.gnuplot + +gnuplot -persist < $WHAT.gnuplot + +rm $WHAT.gnuplot + +ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf +convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten ../${DIR}/$WHAT.png + +# pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100 -f plot-svg aat.ps aat2.svg diff --git a/lib/eigen-3.4.0/bench/btl/data/perlib_plot_settings.txt b/lib/eigen-3.4.0/bench/btl/data/perlib_plot_settings.txt new file mode 100644 index 0000000..f023cfe --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/perlib_plot_settings.txt @@ -0,0 +1,16 @@ +eigen3 ; with lines lw 4 lt 1 lc rgbcolor "black" +eigen2 ; with lines lw 3 lt 1 lc rgbcolor "#999999" +EigenBLAS ; with lines lw 3 lt 3 lc rgbcolor "#999999" +eigen3_novec ; with lines lw 2 lt 1 lc rgbcolor "#999999" +eigen3_nogccvec ; with lines lw 2 lt 2 lc rgbcolor "#991010" +INTEL_MKL ; with lines lw 3 lt 1 lc rgbcolor "#ff0000" +ATLAS ; with lines lw 3 lt 1 lc rgbcolor "#008000" +gmm ; with lines lw 3 lt 1 lc rgbcolor "#0000ff" +ublas ; with lines lw 3 lt 1 lc rgbcolor "#00b7ff" +mtl4 ; with lines lw 3 lt 1 lc rgbcolor "#d18847" +blitz ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff" +F77 ; with lines lw 3 lt 3 lc rgbcolor "#e6e64c" +OPENBLAS ; with lines lw 3 lt 1 lc rgbcolor "#C05600" +C ; with lines lw 3 lt 3 lc rgbcolor "#e6bd96" +ACML ; with lines lw 2 lt 3 lc rgbcolor "#e6e64c" +blaze ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff" diff --git a/lib/eigen-3.4.0/bench/btl/data/regularize.cxx b/lib/eigen-3.4.0/bench/btl/data/regularize.cxx new file mode 100644 index 0000000..eea2b8b --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/regularize.cxx @@ -0,0 +1,131 @@ +//===================================================== +// File : regularize.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include "bench_parameter.hh" +#include + +using namespace std; + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void regularize_curve(const string & filename, + const vector & tab_mflops, + const vector & tab_sizes, + int start_cut_size, int stop_cut_size); +///////////////////////////////////////////////////////////////////////////////////////////////// + +int main( int argc , char *argv[] ) +{ + + // input data + + if (argc<4){ + INFOS("!!! Error ... usage : main filename start_cut_size stop_cut_size regularize_filename"); + exit(0); + } + INFOS(argc); + + int start_cut_size=atoi(argv[2]); + int stop_cut_size=atoi(argv[3]); + + string filename=argv[1]; + string regularize_filename=argv[4]; + + INFOS(filename); + INFOS("start_cut_size="< tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + // regularizeing + + regularize_curve(regularize_filename,tab_mflops,tab_sizes,start_cut_size,stop_cut_size); + + +} + +////////////////////////////////////////////////////////////////////////////////////// + +void regularize_curve(const string & filename, + const vector & tab_mflops, + const vector & tab_sizes, + int start_cut_size, int stop_cut_size) +{ + int size=tab_mflops.size(); + ofstream output_file (filename.c_str(),ios::out) ; + + int i=0; + + while(tab_sizes[i] & tab_sizes, vector & tab_mflops){ + + ifstream input_file (filename.c_str(),ios::in) ; + + if (!input_file){ + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); +} + diff --git a/lib/eigen-3.4.0/bench/btl/data/smooth.cxx b/lib/eigen-3.4.0/bench/btl/data/smooth.cxx new file mode 100644 index 0000000..e5270cc --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/smooth.cxx @@ -0,0 +1,198 @@ +//===================================================== +// File : smooth.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include +#include "bench_parameter.hh" +#include + +using namespace std; + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void write_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width); +void centered_smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width); + +///////////////////////////////////////////////////////////////////////////////////////////////// + +int main( int argc , char *argv[] ) +{ + + // input data + + if (argc<3){ + INFOS("!!! Error ... usage : main filename window_half_width smooth_filename"); + exit(0); + } + INFOS(argc); + + int window_half_width=atoi(argv[2]); + + string filename=argv[1]; + string smooth_filename=argv[3]; + + INFOS(filename); + INFOS("window_half_width="< tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + // smoothing + + vector smooth_tab_mflops; + + //smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width); + centered_smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width); + + // output result + + write_xy_file(smooth_filename,tab_sizes,smooth_tab_mflops); + + +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +template +double weighted_mean(const VECTOR & data) +{ + + double mean=0.0; + + for (int i=0 ; i & tab_mflops, vector & smooth_tab_mflops,int window_half_width){ + + int window_width=2*window_half_width+1; + + int size=tab_mflops.size(); + + vector sample(window_width); + + for (int i=0 ; i < size ; i++){ + + for ( int j=0 ; j < window_width ; j++ ){ + + int shifted_index=i+j-window_half_width; + if (shifted_index<0) shifted_index=0; + if (shifted_index>size-1) shifted_index=size-1; + sample[j]=tab_mflops[shifted_index]; + + } + + smooth_tab_mflops.push_back(weighted_mean(sample)); + + } + +} + +void centered_smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width){ + + int max_window_width=2*window_half_width+1; + + int size=tab_mflops.size(); + + + for (int i=0 ; i < size ; i++){ + + deque sample; + + + sample.push_back(tab_mflops[i]); + + for ( int j=1 ; j <= window_half_width ; j++ ){ + + int before=i-j; + int after=i+j; + + if ((before>=0)&&(after & tab_sizes, vector & tab_mflops){ + + ofstream output_file (filename.c_str(),ios::out) ; + + for (int i=0 ; i < tab_sizes.size() ; i++) + { + output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ; + } + + output_file.close(); + +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops){ + + ifstream input_file (filename.c_str(),ios::in) ; + + if (!input_file){ + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); +} + diff --git a/lib/eigen-3.4.0/bench/btl/data/smooth_all.sh b/lib/eigen-3.4.0/bench/btl/data/smooth_all.sh new file mode 100755 index 0000000..3e5bfdf --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/data/smooth_all.sh @@ -0,0 +1,68 @@ +#! /bin/bash +ORIG_DIR=$1 +SMOOTH_DIR=${ORIG_DIR}_smooth +mkdir ${SMOOTH_DIR} + +AXPY_FILE=`find ${ORIG_DIR} -name "*.dat" | grep axpy` +for FILE in ${AXPY_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp + ./regularize ${SMOOTH_DIR}/${BASE}_tmp 2500 15000 ${SMOOTH_DIR}/${BASE} + rm -f ${SMOOTH_DIR}/${BASE}_tmp +done + + +MATRIX_VECTOR_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_vector` +for FILE in ${MATRIX_VECTOR_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp + ./regularize ${SMOOTH_DIR}/${BASE}_tmp 50 180 ${SMOOTH_DIR}/${BASE} + rm -f ${SMOOTH_DIR}/${BASE}_tmp +done + +MATRIX_MATRIX_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_matrix` +for FILE in ${MATRIX_MATRIX_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + +AAT_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _aat` +for FILE in ${AAT_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + + +ATA_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _ata` +for FILE in ${ATA_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + +### no smoothing for tinyvector and matrices libs + +TINY_BLITZ_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tiny_blitz` +for FILE in ${TINY_BLITZ_FILE} +do + echo $FILE + BASE=${FILE##*/} + cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE} +done + +TVMET_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tvmet` +for FILE in ${TVMET_FILE} +do + echo $FILE + BASE=${FILE##*/} + cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE} +done diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/bench.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/bench.hh new file mode 100644 index 0000000..0732940 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/bench.hh @@ -0,0 +1,168 @@ +//===================================================== +// File : bench.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_HH +#define BENCH_HH + +#include "btl.hh" +#include "bench_parameter.hh" +#include +#include "utilities.h" +#include "size_lin_log.hh" +#include "xy_file.hh" +#include +#include +#include "timers/portable_perf_analyzer.hh" +// #include "timers/mixed_perf_analyzer.hh" +// #include "timers/x86_perf_analyzer.hh" +// #include "timers/STL_perf_analyzer.hh" +#ifdef HAVE_MKL +extern "C" void cblas_saxpy(const int, const float, const float*, const int, float *, const int); +#endif +using namespace std; + +template class Perf_Analyzer, class Action> +BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ) +{ + if (BtlConfig::skipAction(Action::name())) + return; + + string filename="bench_"+Action::name()+".dat"; + + INFOS("starting " < tab_mflops(nb_point); + std::vector tab_sizes(nb_point); + + // matrices and vector size calculations + size_lin_log(nb_point,size_min,size_max,tab_sizes); + + std::vector oldSizes; + std::vector oldFlops; + bool hasOldResults = read_xy_file(filename, oldSizes, oldFlops, true); + int oldi = oldSizes.size() - 1; + + // loop on matrix size + Perf_Analyzer perf_action; + for (int i=nb_point-1;i>=0;i--) + { + //INFOS("size=" <=0 && oldSizes[oldi]>tab_sizes[i]) + --oldi; + if (oldi>=0 && oldSizes[oldi]==tab_sizes[i]) + { + if (oldFlops[oldi] "; + else + std::cout << "\t < "; + std::cout << oldFlops[oldi]; + } + --oldi; + } + std::cout << " MFlops (" << nb_point-i << "/" << nb_point << ")" << std::endl; + } + + if (!BtlConfig::Instance.overwriteResults) + { + if (hasOldResults) + { + // merge the two data + std::vector newSizes; + std::vector newFlops; + unsigned int i=0; + unsigned int j=0; + while (i +BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ){ + + // if the rdtsc is not available : + bench(size_min,size_max,nb_point); + // if the rdtsc is available : +// bench(size_min,size_max,nb_point); + + + // Only for small problem size. Otherwise it will be too long +// bench(size_min,size_max,nb_point); +// bench(size_min,size_max,nb_point); + +} + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/bench_parameter.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/bench_parameter.hh new file mode 100644 index 0000000..2b01149 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/bench_parameter.hh @@ -0,0 +1,53 @@ +//===================================================== +// File : bench_parameter.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_PARAMETER_HH +#define BENCH_PARAMETER_HH + +// minimal time for each measurement +#define REAL_TYPE float +// minimal time for each measurement +#define MIN_TIME 0.2 +// nb of point on bench curves +#define NB_POINT 100 +// min vector size for axpy bench +#define MIN_AXPY 5 +// max vector size for axpy bench +#define MAX_AXPY 3000000 +// min matrix size for matrix vector product bench +#define MIN_MV 5 +// max matrix size for matrix vector product bench +#define MAX_MV 5000 +// min matrix size for matrix matrix product bench +#define MIN_MM 5 +// max matrix size for matrix matrix product bench +#define MAX_MM MAX_MV +// min matrix size for LU bench +#define MIN_LU 5 +// max matrix size for LU bench +#define MAX_LU 3000 +// max size for tiny vector and matrix +#define TINY_MV_MAX_SIZE 16 +// default nb_sample for x86 timer +#define DEFAULT_NB_SAMPLE 1000 + +// how many times we run a single bench (keep the best perf) +#define DEFAULT_NB_TRIES 3 + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/btl.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/btl.hh new file mode 100644 index 0000000..706b00f --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/btl.hh @@ -0,0 +1,242 @@ +//===================================================== +// File : btl.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BTL_HH +#define BTL_HH + +#include "bench_parameter.hh" +#include +#include +#include +#include +#include "utilities.h" + +#if (defined __GNUC__) +#define BTL_ALWAYS_INLINE __attribute__((always_inline)) inline +#else +#define BTL_ALWAYS_INLINE inline +#endif + +#if (defined __GNUC__) +#define BTL_DONT_INLINE __attribute__((noinline)) +#else +#define BTL_DONT_INLINE +#endif + +#if (defined __GNUC__) +#define BTL_ASM_COMMENT(X) asm("#" X) +#else +#define BTL_ASM_COMMENT(X) +#endif + +#ifdef __SSE__ +#include "xmmintrin.h" +// This enables flush to zero (FTZ) and denormals are zero (DAZ) modes: +#define BTL_DISABLE_SSE_EXCEPTIONS() { _mm_setcsr(_mm_getcsr() | 0x8040); } +#else +#define BTL_DISABLE_SSE_EXCEPTIONS() +#endif + +/** Enhanced std::string +*/ +class BtlString : public std::string +{ +public: + BtlString() : std::string() {} + BtlString(const BtlString& str) : std::string(static_cast(str)) {} + BtlString(const std::string& str) : std::string(str) {} + BtlString(const char* str) : std::string(str) {} + + operator const char* () const { return c_str(); } + + void trim( bool left = true, bool right = true ) + { + int lspaces, rspaces, len = length(), i; + lspaces = rspaces = 0; + + if ( left ) + for (i=0; i=0 && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); rspaces++,i--); + + *this = substr(lspaces, len-lspaces-rspaces); + } + + std::vector split( const BtlString& delims = "\t\n ") const + { + std::vector ret; + unsigned int numSplits = 0; + size_t start, pos; + start = 0; + do + { + pos = find_first_of(delims, start); + if (pos == start) + { + ret.push_back(""); + start = pos + 1; + } + else if (pos == npos) + ret.push_back( substr(start) ); + else + { + ret.push_back( substr(start, pos - start) ); + start = pos + 1; + } + //start = find_first_not_of(delims, start); + ++numSplits; + } while (pos != npos); + return ret; + } + + bool endsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(this->size()-str.size(),str.size()) == str; + } + bool contains(const BtlString& str) const + { + return this->find(str)size(); + } + bool beginsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(0,str.size()) == str; + } + + BtlString toLowerCase( void ) + { + std::transform(begin(), end(), begin(), static_cast(::tolower) ); + return *this; + } + BtlString toUpperCase( void ) + { + std::transform(begin(), end(), begin(), static_cast(::toupper) ); + return *this; + } + + /** Case insensitive comparison. + */ + bool isEquiv(const BtlString& str) const + { + BtlString str0 = *this; + str0.toLowerCase(); + BtlString str1 = str; + str1.toLowerCase(); + return str0 == str1; + } + + /** Decompose the current string as a path and a file. + For instance: "dir1/dir2/file.ext" leads to path="dir1/dir2/" and filename="file.ext" + */ + void decomposePathAndFile(BtlString& path, BtlString& filename) const + { + std::vector elements = this->split("/\\"); + path = ""; + filename = elements.back(); + elements.pop_back(); + if (this->at(0)=='/') + path = "/"; + for (unsigned int i=0 ; i config = BtlString(_config).split(" \t\n"); + for (unsigned int i = 0; i m_selectedActionNames; +}; + +#define BTL_MAIN \ + BtlConfig BtlConfig::Instance + +#endif // BTL_HH diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_function.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_function.hh new file mode 100644 index 0000000..e467cb6 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_function.hh @@ -0,0 +1,54 @@ +//===================================================== +// File : init_function.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_FUNCTION_HH +#define INIT_FUNCTION_HH + +double simple_function(int index) +{ + return index; +} + +double simple_function(int index_i, int index_j) +{ + return index_i+index_j; +} + +double pseudo_random(int /*index*/) +{ + return std::rand()/double(RAND_MAX); +} + +double pseudo_random(int /*index_i*/, int /*index_j*/) +{ + return std::rand()/double(RAND_MAX); +} + + +double null_function(int /*index*/) +{ + return 0.0; +} + +double null_function(int /*index_i*/, int /*index_j*/) +{ + return 0.0; +} + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_matrix.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_matrix.hh new file mode 100644 index 0000000..6382d30 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/init/init_matrix.hh @@ -0,0 +1,64 @@ +//===================================================== +// File : init_matrix.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_MATRIX_HH +#define INIT_MATRIX_HH + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for setting element +// value_type defined +template +BTL_DONT_INLINE void init_row(Vector & X, int size, int row){ + + X.resize(size); + + for (unsigned int j=0;j +BTL_DONT_INLINE void init_matrix(Vector & A, int size){ + A.resize(size); + for (unsigned int row=0; row(A[row],size,row); + } +} + +template +BTL_DONT_INLINE void init_matrix_symm(Matrix& A, int size){ + A.resize(size); + for (unsigned int row=0; row +// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_VECTOR_HH +#define INIT_VECTOR_HH + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for setting element +// value_type defined +template +void init_vector(Vector & X, int size){ + + X.resize(size); + + for (unsigned int i=0;i +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_STATIC_HH +#define BENCH_STATIC_HH + +#include "btl.hh" +#include "bench_parameter.hh" +#include +#include "utilities.h" +#include "xy_file.hh" +#include "static/static_size_generator.hh" +#include "timers/portable_perf_analyzer.hh" +// #include "timers/mixed_perf_analyzer.hh" +// #include "timers/x86_perf_analyzer.hh" + +using namespace std; + + +template class Perf_Analyzer, template class Action, template class Interface> +BTL_DONT_INLINE void bench_static(void) +{ + if (BtlConfig::skipAction(Action >::name())) + return; + + string filename = "bench_" + Action >::name() + ".dat"; + + INFOS("starting " << filename); + + const int max_size = TINY_MV_MAX_SIZE; + + std::vector tab_mflops; + std::vector tab_sizes; + + static_size_generator::go(tab_sizes,tab_mflops); + + dump_xy_file(tab_sizes,tab_mflops,filename); +} + +// default Perf Analyzer +template class Action, template class Interface> +BTL_DONT_INLINE void bench_static(void) +{ + bench_static(); + //bench_static(); + //bench_static(); +} + +#endif + + + + + + + + + + + + + + + diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/static/intel_bench_fixed_size.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/static/intel_bench_fixed_size.hh new file mode 100644 index 0000000..b4edcbc --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/static/intel_bench_fixed_size.hh @@ -0,0 +1,66 @@ +//===================================================== +// File : intel_bench_fixed_size.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar déc 3 18:59:37 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _BENCH_FIXED_SIZE_HH_ +#define _BENCH_FIXED_SIZE_HH_ + +#include "utilities.h" +#include "function_time.hh" + +template +double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long long & nb_init) +{ + + Action action(size); + + double time_baseline=time_init(nb_init,action); + + while (time_baseline < MIN_TIME) { + + //INFOS("nb_init="< > > perf_action; + tab_mflops.push_back(perf_action.eval_mflops(SIZE)); + std::cout << tab_mflops.back() << " MFlops" << std::endl; + static_size_generator::go(tab_sizes,tab_mflops); + }; +}; + +//recursion end + +template class Perf_Analyzer, template class Action, template class Interface> +struct static_size_generator<1,Perf_Analyzer,Action,Interface>{ + static void go(vector & tab_sizes, vector & tab_mflops) + { + tab_sizes.push_back(1); + Perf_Analyzer > > perf_action; + tab_mflops.push_back(perf_action.eval_mflops(1)); + }; +}; + +#endif + + + + diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/timers/STL_perf_analyzer.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/STL_perf_analyzer.hh new file mode 100644 index 0000000..c9f894b --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/STL_perf_analyzer.hh @@ -0,0 +1,82 @@ +//===================================================== +// File : STL_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar déc 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _STL_PERF_ANALYSER_HH +#define _STL_PERF_ANALYSER_HH + +#include "STL_timer.hh" +#include "bench_parameter.hh" + +template +class STL_Perf_Analyzer{ +public: + STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() + { + MESSAGE("STL_Perf_Analyzer Ctor"); + }; + STL_Perf_Analyzer( const STL_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~STL_Perf_Analyzer( void ){ + MESSAGE("STL_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + ACTION action(size); + + _chronos.start_baseline(_nb_sample); + + do { + + action.initialize(); + } while (_chronos.check()); + + double baseline_time=_chronos.get_time(); + + _chronos.start(_nb_sample); + do { + action.initialize(); + action.calculate(); + } while (_chronos.check()); + + double calculate_time=_chronos.get_time(); + + double corrected_time=calculate_time-baseline_time; + + // cout << size <<" "< +// Copyright (C) EDF R&D, mar déc 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// STL Timer Class. Adapted (L.P.) from the timer class by Musser et Al +// described int the Book : STL Tutorial and reference guide. +// Define a timer class for analyzing algorithm performance. +#include +#include +#include +#include +#include +using namespace std; + +class STL_Timer { +public: + STL_Timer(){ baseline = false; }; // Default constructor + // Start a series of r trials: + void start(unsigned int r){ + reps = r; + count = 0; + iterations.clear(); + iterations.reserve(reps); + initial = time(0); + }; + // Start a series of r trials to determine baseline time: + void start_baseline(unsigned int r) + { + baseline = true; + start(r); + } + // Returns true if the trials have been completed, else false + bool check() + { + ++count; + final = time(0); + if (initial < final) { + iterations.push_back(count); + initial = final; + count = 0; + } + return (iterations.size() < reps); + }; + // Returns the results for external use + double get_time( void ) + { + sort(iterations.begin(), iterations.end()); + return 1.0/iterations[reps/2]; + }; +private: + unsigned int reps; // Number of trials + // For storing loop iterations of a trial + vector iterations; + // For saving initial and final times of a trial + time_t initial, final; + // For counting loop iterations of a trial + unsigned long count; + // true if this is a baseline computation, false otherwise + bool baseline; + // For recording the baseline time + double baseline_time; +}; + diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh new file mode 100644 index 0000000..e190236 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh @@ -0,0 +1,73 @@ +//===================================================== +// File : mixed_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar déc 3 18:59:36 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _MIXED_PERF_ANALYSER_HH +#define _MIXED_PERF_ANALYSER_HH + +#include "x86_perf_analyzer.hh" +#include "portable_perf_analyzer.hh" + +// choose portable perf analyzer for long calculations and x86 analyser for short ones + + +template +class Mixed_Perf_Analyzer{ + +public: + Mixed_Perf_Analyzer( void ):_x86pa(),_ppa(),_use_ppa(true) + { + MESSAGE("Mixed_Perf_Analyzer Ctor"); + }; + Mixed_Perf_Analyzer( const Mixed_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Mixed_Perf_Analyzer( void ){ + MESSAGE("Mixed_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + double result=0.0; + if (_use_ppa){ + result=_ppa.eval_mflops(size); + if (_ppa.get_nb_calc()>DEFAULT_NB_SAMPLE){_use_ppa=false;} + } + else{ + result=_x86pa.eval_mflops(size); + } + + return result; + } + +private: + + Portable_Perf_Analyzer _ppa; + X86_Perf_Analyzer _x86pa; + bool _use_ppa; + +}; + +#endif + + + + diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_perf_analyzer.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_perf_analyzer.hh new file mode 100644 index 0000000..5e579fb --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/portable_perf_analyzer.hh @@ -0,0 +1,103 @@ +//===================================================== +// File : portable_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _PORTABLE_PERF_ANALYZER_HH +#define _PORTABLE_PERF_ANALYZER_HH + +#include "utilities.h" +#include "timers/portable_timer.hh" + +template +class Portable_Perf_Analyzer{ +public: + Portable_Perf_Analyzer( ):_nb_calc(0), m_time_action(0), _chronos(){ + MESSAGE("Portable_Perf_Analyzer Ctor"); + }; + Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Portable_Perf_Analyzer(){ + MESSAGE("Portable_Perf_Analyzer Dtor"); + }; + + BTL_DONT_INLINE double eval_mflops(int size) + { + Action action(size); + +// action.initialize(); +// time_action = time_calculate(action); + while (m_time_action < MIN_TIME) + { + if(_nb_calc==0) _nb_calc = 1; + else _nb_calc *= 2; + action.initialize(); + m_time_action = time_calculate(action); + } + + // optimize + for (int i=1; i +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _PORTABLE_PERF_ANALYZER_HH +#define _PORTABLE_PERF_ANALYZER_HH + +#include "utilities.h" +#include "timers/portable_timer.hh" + +template +class Portable_Perf_Analyzer{ +public: + Portable_Perf_Analyzer( void ):_nb_calc(1),_nb_init(1),_chronos(){ + MESSAGE("Portable_Perf_Analyzer Ctor"); + }; + Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Portable_Perf_Analyzer( void ){ + MESSAGE("Portable_Perf_Analyzer Dtor"); + }; + + + + inline double eval_mflops(int size) + { + + Action action(size); + +// double time_baseline = time_init(action); +// while (time_baseline < MIN_TIME_INIT) +// { +// _nb_init *= 2; +// time_baseline = time_init(action); +// } +// +// // optimize +// for (int i=1; i +#include + + +class Portable_Timer +{ + public: + + Portable_Timer() + { + } + + void start() + { + m_start_time = double(mach_absolute_time())*1e-9;; + + } + + void stop() + { + m_stop_time = double(mach_absolute_time())*1e-9;; + + } + + double elapsed() + { + return user_time(); + } + + double user_time() + { + return m_stop_time - m_start_time; + } + + +private: + + double m_stop_time, m_start_time; + +}; // Portable_Timer (Apple) + +#else + +#include +#include +#include +#include + +class Portable_Timer +{ + public: + + Portable_Timer() + { + m_clkid = BtlConfig::Instance.realclock ? CLOCK_REALTIME : CLOCK_PROCESS_CPUTIME_ID; + } + + Portable_Timer(int clkid) : m_clkid(clkid) + {} + + void start() + { + timespec ts; + clock_gettime(m_clkid, &ts); + m_start_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); + + } + + void stop() + { + timespec ts; + clock_gettime(m_clkid, &ts); + m_stop_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); + + } + + double elapsed() + { + return user_time(); + } + + double user_time() + { + return m_stop_time - m_start_time; + } + + +private: + + int m_clkid; + double m_stop_time, m_start_time; + +}; // Portable_Timer (Linux) + +#endif + +#endif // PORTABLE_TIMER_HPP diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/timers/x86_perf_analyzer.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/x86_perf_analyzer.hh new file mode 100644 index 0000000..37ea21d --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/timers/x86_perf_analyzer.hh @@ -0,0 +1,108 @@ +//===================================================== +// File : x86_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _X86_PERF_ANALYSER_HH +#define _X86_PERF_ANALYSER_HH + +#include "x86_timer.hh" +#include "bench_parameter.hh" + +template +class X86_Perf_Analyzer{ +public: + X86_Perf_Analyzer( unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() + { + MESSAGE("X86_Perf_Analyzer Ctor"); + _chronos.find_frequency(); + }; + X86_Perf_Analyzer( const X86_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~X86_Perf_Analyzer( void ){ + MESSAGE("X86_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + ACTION action(size); + + int nb_loop=5; + double calculate_time=0.0; + double baseline_time=0.0; + + for (int j=0 ; j < nb_loop ; j++){ + + _chronos.clear(); + + for(int i=0 ; i < _nb_sample ; i++) + { + _chronos.start(); + action.initialize(); + action.calculate(); + _chronos.stop(); + _chronos.add_get_click(); + } + + calculate_time += double(_chronos.get_shortest_clicks())/_chronos.frequency(); + + if (j==0) action.check_result(); + + _chronos.clear(); + + for(int i=0 ; i < _nb_sample ; i++) + { + _chronos.start(); + action.initialize(); + _chronos.stop(); + _chronos.add_get_click(); + + } + + baseline_time+=double(_chronos.get_shortest_clicks())/_chronos.frequency(); + + } + + double corrected_time = (calculate_time-baseline_time)/double(nb_loop); + + +// INFOS("_nb_sample="<<_nb_sample); +// INFOS("baseline_time="< +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _X86_TIMER_HH +#define _X86_TIMER_HH + +#include +#include +#include +#include +//#include "system_time.h" +#define u32 unsigned int +#include +#include "utilities.h" +#include +#include +#include +#include + +// frequence de la becanne en Hz +//#define FREQUENCY 648000000 +//#define FREQUENCY 1400000000 +#define FREQUENCY 1695000000 + +using namespace std; + + +class X86_Timer { + +public : + + X86_Timer( void ):_frequency(FREQUENCY),_nb_sample(0) + { + MESSAGE("X86_Timer Default Ctor"); + } + + inline void start( void ){ + + rdtsc(_click_start.n32[0],_click_start.n32[1]); + + } + + + inline void stop( void ){ + + rdtsc(_click_stop.n32[0],_click_stop.n32[1]); + + } + + + inline double frequency( void ){ + return _frequency; + } + + double get_elapsed_time_in_second( void ){ + + return (_click_stop.n64-_click_start.n64)/double(FREQUENCY); + + + } + + unsigned long long get_click( void ){ + + return (_click_stop.n64-_click_start.n64); + + } + + inline void find_frequency( void ){ + + time_t initial, final; + int dummy=2; + + initial = time(0); + start(); + do { + dummy+=2; + } + while(time(0)==initial); + // On est au debut d'un cycle d'une seconde !!! + initial = time(0); + start(); + do { + dummy+=2; + } + while(time(0)==initial); + final=time(0); + stop(); + // INFOS("fine grained time : "<< get_elapsed_time_in_second()); + // INFOS("coarse grained time : "<< final-initial); + _frequency=_frequency*get_elapsed_time_in_second()/double(final-initial); + /// INFOS("CPU frequency : "<< _frequency); + + } + + void add_get_click( void ){ + + _nb_sample++; + _counted_clicks[get_click()]++; + fill_history_clicks(); + + } + + void dump_statistics(string filemane){ + + ofstream outfile (filemane.c_str(),ios::out) ; + + std::map::iterator itr; + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + outfile << (*itr).first << " " << (*itr).second << endl ; + } + + outfile.close(); + + } + + void dump_history(string filemane){ + + ofstream outfile (filemane.c_str(),ios::out) ; + + + + for(int i=0 ; i<_history_mean_clicks.size() ; i++) + { + outfile << i << " " + << _history_mean_clicks[i] << " " + << _history_shortest_clicks[i] << " " + << _history_most_occured_clicks[i] << endl ; + } + + outfile.close(); + + } + + + + double get_mean_clicks( void ){ + + std::map::iterator itr; + + unsigned long long mean_clicks=0; + + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + + mean_clicks+=(*itr).second*(*itr).first; + } + + return mean_clicks/double(_nb_sample); + + } + + double get_shortest_clicks( void ){ + + return double((*_counted_clicks.begin()).first); + + } + + void fill_history_clicks( void ){ + + _history_mean_clicks.push_back(get_mean_clicks()); + _history_shortest_clicks.push_back(get_shortest_clicks()); + _history_most_occured_clicks.push_back(get_most_occured_clicks()); + + } + + + double get_most_occured_clicks( void ){ + + unsigned long long moc=0; + unsigned long long max_occurence=0; + + std::map::iterator itr; + + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + + if (max_occurence<=(*itr).second){ + max_occurence=(*itr).second; + moc=(*itr).first; + } + } + + return double(moc); + + } + + void clear( void ) + { + _counted_clicks.clear(); + + _history_mean_clicks.clear(); + _history_shortest_clicks.clear(); + _history_most_occured_clicks.clear(); + + _nb_sample=0; + } + + + +private : + + union + { + unsigned long int n32[2] ; + unsigned long long n64 ; + } _click_start; + + union + { + unsigned long int n32[2] ; + unsigned long long n64 ; + } _click_stop; + + double _frequency ; + + map _counted_clicks; + + vector _history_mean_clicks; + vector _history_shortest_clicks; + vector _history_most_occured_clicks; + + unsigned long long _nb_sample; + + + +}; + + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/generic_bench/utils/size_lin_log.hh b/lib/eigen-3.4.0/bench/btl/generic_bench/utils/size_lin_log.hh new file mode 100644 index 0000000..bbc9f54 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/generic_bench/utils/size_lin_log.hh @@ -0,0 +1,70 @@ +//===================================================== +// File : size_lin_log.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar déc 3 18:59:37 CET 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef SIZE_LIN_LOG +#define SIZE_LIN_LOG + +#include "size_log.hh" + +template +void size_lin_log(const int nb_point, const int /*size_min*/, const int size_max, Vector & X) +{ + int ten=10; + int nine=9; + + X.resize(nb_point); + + if (nb_point>ten){ + + for (int i=0;i +void size_log(const int nb_point, const int size_min, const int size_max, Vector & X) +{ + X.resize(nb_point); + + float ls_min=log(float(size_min)); + float ls_max=log(float(size_max)); + + float ls=0.0; + + float delta_ls=(ls_max-ls_min)/(float(nb_point-1)); + + int size=0; + + for (int i=0;i +//# include ok for gcc3.01 +# include + +/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ + +# define HEREWEARE cout< +// Copyright (C) EDF R&D, lun sep 30 14:23:20 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef XY_FILE_HH +#define XY_FILE_HH +#include +#include +#include +#include +using namespace std; + +bool read_xy_file(const std::string & filename, std::vector & tab_sizes, + std::vector & tab_mflops, bool quiet = false) +{ + + std::ifstream input_file (filename.c_str(),std::ios::in); + + if (!input_file){ + if (!quiet) { + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); + return true; +} + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for setting element +// the vector element must have the << operator define + +using namespace std; + +template +void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){ + + ofstream outfile (filename.c_str(),ios::out) ; + int size=X.size(); + + for (int i=0;i BLASFUNC(cdotu) (int *, float *, int *, float *, int *); +std::complex BLASFUNC(cdotc) (int *, float *, int *, float *, int *); +std::complex BLASFUNC(zdotu) (int *, double *, int *, double *, int *); +std::complex BLASFUNC(zdotc) (int *, double *, int *, double *, int *); +double BLASFUNC(xdotu) (int *, double *, int *, double *, int *); +double BLASFUNC(xdotc) (int *, double *, int *, double *, int *); +#endif + +int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*); +int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*); +int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*); +int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*); + +int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *); +int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(caxpy) (int *, float *, float *, int *, float *, int *); +int BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(caxpyc)(int *, float *, float *, int *, float *, int *); +int BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *); +int BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *); + +int BLASFUNC(scopy) (int *, float *, int *, float *, int *); +int BLASFUNC(dcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(qcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(ccopy) (int *, float *, int *, float *, int *); +int BLASFUNC(zcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(xcopy) (int *, double *, int *, double *, int *); + +int BLASFUNC(sswap) (int *, float *, int *, float *, int *); +int BLASFUNC(dswap) (int *, double *, int *, double *, int *); +int BLASFUNC(qswap) (int *, double *, int *, double *, int *); +int BLASFUNC(cswap) (int *, float *, int *, float *, int *); +int BLASFUNC(zswap) (int *, double *, int *, double *, int *); +int BLASFUNC(xswap) (int *, double *, int *, double *, int *); + +float BLASFUNC(sasum) (int *, float *, int *); +float BLASFUNC(scasum)(int *, float *, int *); +double BLASFUNC(dasum) (int *, double *, int *); +double BLASFUNC(qasum) (int *, double *, int *); +double BLASFUNC(dzasum)(int *, double *, int *); +double BLASFUNC(qxasum)(int *, double *, int *); + +int BLASFUNC(isamax)(int *, float *, int *); +int BLASFUNC(idamax)(int *, double *, int *); +int BLASFUNC(iqamax)(int *, double *, int *); +int BLASFUNC(icamax)(int *, float *, int *); +int BLASFUNC(izamax)(int *, double *, int *); +int BLASFUNC(ixamax)(int *, double *, int *); + +int BLASFUNC(ismax) (int *, float *, int *); +int BLASFUNC(idmax) (int *, double *, int *); +int BLASFUNC(iqmax) (int *, double *, int *); +int BLASFUNC(icmax) (int *, float *, int *); +int BLASFUNC(izmax) (int *, double *, int *); +int BLASFUNC(ixmax) (int *, double *, int *); + +int BLASFUNC(isamin)(int *, float *, int *); +int BLASFUNC(idamin)(int *, double *, int *); +int BLASFUNC(iqamin)(int *, double *, int *); +int BLASFUNC(icamin)(int *, float *, int *); +int BLASFUNC(izamin)(int *, double *, int *); +int BLASFUNC(ixamin)(int *, double *, int *); + +int BLASFUNC(ismin)(int *, float *, int *); +int BLASFUNC(idmin)(int *, double *, int *); +int BLASFUNC(iqmin)(int *, double *, int *); +int BLASFUNC(icmin)(int *, float *, int *); +int BLASFUNC(izmin)(int *, double *, int *); +int BLASFUNC(ixmin)(int *, double *, int *); + +float BLASFUNC(samax) (int *, float *, int *); +double BLASFUNC(damax) (int *, double *, int *); +double BLASFUNC(qamax) (int *, double *, int *); +float BLASFUNC(scamax)(int *, float *, int *); +double BLASFUNC(dzamax)(int *, double *, int *); +double BLASFUNC(qxamax)(int *, double *, int *); + +float BLASFUNC(samin) (int *, float *, int *); +double BLASFUNC(damin) (int *, double *, int *); +double BLASFUNC(qamin) (int *, double *, int *); +float BLASFUNC(scamin)(int *, float *, int *); +double BLASFUNC(dzamin)(int *, double *, int *); +double BLASFUNC(qxamin)(int *, double *, int *); + +float BLASFUNC(smax) (int *, float *, int *); +double BLASFUNC(dmax) (int *, double *, int *); +double BLASFUNC(qmax) (int *, double *, int *); +float BLASFUNC(scmax) (int *, float *, int *); +double BLASFUNC(dzmax) (int *, double *, int *); +double BLASFUNC(qxmax) (int *, double *, int *); + +float BLASFUNC(smin) (int *, float *, int *); +double BLASFUNC(dmin) (int *, double *, int *); +double BLASFUNC(qmin) (int *, double *, int *); +float BLASFUNC(scmin) (int *, float *, int *); +double BLASFUNC(dzmin) (int *, double *, int *); +double BLASFUNC(qxmin) (int *, double *, int *); + +int BLASFUNC(sscal) (int *, float *, float *, int *); +int BLASFUNC(dscal) (int *, double *, double *, int *); +int BLASFUNC(qscal) (int *, double *, double *, int *); +int BLASFUNC(cscal) (int *, float *, float *, int *); +int BLASFUNC(zscal) (int *, double *, double *, int *); +int BLASFUNC(xscal) (int *, double *, double *, int *); +int BLASFUNC(csscal)(int *, float *, float *, int *); +int BLASFUNC(zdscal)(int *, double *, double *, int *); +int BLASFUNC(xqscal)(int *, double *, double *, int *); + +float BLASFUNC(snrm2) (int *, float *, int *); +float BLASFUNC(scnrm2)(int *, float *, int *); + +double BLASFUNC(dnrm2) (int *, double *, int *); +double BLASFUNC(qnrm2) (int *, double *, int *); +double BLASFUNC(dznrm2)(int *, double *, int *); +double BLASFUNC(qxnrm2)(int *, double *, int *); + +int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *); +int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *); +int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *); + +int BLASFUNC(srotg) (float *, float *, float *, float *); +int BLASFUNC(drotg) (double *, double *, double *, double *); +int BLASFUNC(qrotg) (double *, double *, double *, double *); +int BLASFUNC(crotg) (float *, float *, float *, float *); +int BLASFUNC(zrotg) (double *, double *, double *, double *); +int BLASFUNC(xrotg) (double *, double *, double *, double *); + +int BLASFUNC(srotmg)(float *, float *, float *, float *, float *); +int BLASFUNC(drotmg)(double *, double *, double *, double *, double *); + +int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *); +int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *); +int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *); + +/* Level 2 routines */ + +int BLASFUNC(sger)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(dger)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(qger)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); + +int BLASFUNC(sgemv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(cgemv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(strsv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(ctrsv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); + +int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *); + +int BLASFUNC(strmv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(ctrmv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); + +int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *); + +int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); + +int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); + +int BLASFUNC(ssymv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csymv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(sspmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(dspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(qspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(cspmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(zspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(xspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssyr) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(dsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(qsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(csyr) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(xsyr) (char *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(ssyr2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(dsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(qsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(csyr2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(zsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(xsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); + +int BLASFUNC(sspr) (char *, int *, float *, float *, int *, + float *); +int BLASFUNC(dspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(qspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(cspr) (char *, int *, float *, float *, int *, + float *); +int BLASFUNC(zspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(xspr) (char *, int *, double *, double *, int *, + double *); + +int BLASFUNC(sspr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(dspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(qspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(cspr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(zspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(xspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); + +int BLASFUNC(cher) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zher) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(xher) (char *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *); +int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *); +int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *); + +int BLASFUNC(cher2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(zher2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(xher2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); + +int BLASFUNC(chpr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(zhpr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(xhpr2) (char *, int *, double *, + double *, int *, double *, int *, double *); + +int BLASFUNC(chemv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chpmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhpmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhpmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); + +int BLASFUNC(snorm)(char *, int *, int *, float *, int *); +int BLASFUNC(dnorm)(char *, int *, int *, double *, int *); +int BLASFUNC(cnorm)(char *, int *, int *, float *, int *); +int BLASFUNC(znorm)(char *, int *, int *, double *, int *); + +int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +/* Level 3 routines */ + +int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); + +int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); + +int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *, + float *, float *, int *); +int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *, + double *, double *, int *); +int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *, + float *, float *, int *); +int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *, + double *, double *, int *); + +int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); + +int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); + +int BLASFUNC(ssymm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csymm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssyrk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(csyrk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); + +int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(csyr2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); + +int BLASFUNC(chemm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(cherk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); + +int BLASFUNC(cher2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); + +int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(sgema)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(dgema)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); +int BLASFUNC(cgema)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(zgema)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); + +int BLASFUNC(sgems)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(dgems)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); +int BLASFUNC(cgems)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(zgems)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); + +int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); + +int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); + +int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); +int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); +int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); + +int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); + +int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *); + +int BLASFUNC(spotf2)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); + +int BLASFUNC(spotrf)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); + +int BLASFUNC(slauu2)(char *, int *, float *, int *, int *); +int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(clauu2)(char *, int *, float *, int *, int *); +int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); + +int BLASFUNC(slauum)(char *, int *, float *, int *, int *); +int BLASFUNC(dlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(qlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(clauum)(char *, int *, float *, int *, int *); +int BLASFUNC(zlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(xlauum)(char *, int *, double *, int *, int *); + +int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); + +int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); + +int BLASFUNC(spotri)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotri)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotri)(char *, int *, double *, int *, int *); + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface.hh new file mode 100644 index 0000000..6510546 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface.hh @@ -0,0 +1,83 @@ +//===================================================== +// File : blas_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef blas_PRODUIT_MATRICE_VECTEUR_HH +#define blas_PRODUIT_MATRICE_VECTEUR_HH + +#include +#include +extern "C" +{ +#include "blas.h" + + // Cholesky Factorization +// void spotrf_(const char* uplo, const int* n, float *a, const int* ld, int* info); +// void dpotrf_(const char* uplo, const int* n, double *a, const int* ld, int* info); + void ssytrd_(char *uplo, const int *n, float *a, const int *lda, float *d, float *e, float *tau, float *work, int *lwork, int *info ); + void dsytrd_(char *uplo, const int *n, double *a, const int *lda, double *d, double *e, double *tau, double *work, int *lwork, int *info ); + void sgehrd_( const int *n, int *ilo, int *ihi, float *a, const int *lda, float *tau, float *work, int *lwork, int *info ); + void dgehrd_( const int *n, int *ilo, int *ihi, double *a, const int *lda, double *tau, double *work, int *lwork, int *info ); + + // LU row pivoting +// void dgetrf_( int *m, int *n, double *a, int *lda, int *ipiv, int *info ); +// void sgetrf_(const int* m, const int* n, float *a, const int* ld, int* ipivot, int* info); + // LU full pivoting + void sgetc2_(const int* n, float *a, const int *lda, int *ipiv, int *jpiv, int*info ); + void dgetc2_(const int* n, double *a, const int *lda, int *ipiv, int *jpiv, int*info ); +#ifdef HAS_LAPACK +#endif +} + +#define MAKE_STRING2(S) #S +#define MAKE_STRING(S) MAKE_STRING2(S) + +#define CAT2(A,B) A##B +#define CAT(A,B) CAT2(A,B) + + +template class blas_interface; + + +static char notrans = 'N'; +static char trans = 'T'; +static char nonunit = 'N'; +static char lower = 'L'; +static char right = 'R'; +static char left = 'L'; +static int intone = 1; + + + +#define SCALAR float +#define SCALAR_PREFIX s +#include "blas_interface_impl.hh" +#undef SCALAR +#undef SCALAR_PREFIX + + +#define SCALAR double +#define SCALAR_PREFIX d +#include "blas_interface_impl.hh" +#undef SCALAR +#undef SCALAR_PREFIX + +#endif + + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface_impl.hh b/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface_impl.hh new file mode 100644 index 0000000..9e0a649 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/BLAS/blas_interface_impl.hh @@ -0,0 +1,147 @@ + +#define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_) + +template<> class blas_interface : public c_interface_base +{ + +public : + + static SCALAR fone; + static SCALAR fzero; + + static inline std::string name() + { + return MAKE_STRING(CBLASNAME); + } + + static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(gemv)(¬rans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(symv)(&lower, &N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(syr2)(&lower,&N,&fone,B,&intone,X,&intone,A,&N); + } + + static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ + BLAS_FUNC(ger)(&N,&N,&fone,X,&intone,Y,&intone,A,&N); + } + + static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){ + BLAS_FUNC(rot)(&N,A,&intone,B,&intone,&c,&s); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(gemv)(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ + BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); + } + + static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ + BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); + } + + static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){ + BLAS_FUNC(syrk)(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N); + } + + static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){ + BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N); + } + + static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){ + BLAS_FUNC(axpy)(&N,&coef,X,&intone,Y,&intone); + } + + static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){ + BLAS_FUNC(scal)(&N,&b,Y,&intone); + BLAS_FUNC(axpy)(&N,&a,X,&intone,Y,&intone); + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + char uplo = 'L'; + int info = 0; + BLAS_FUNC(potrf)(&uplo, &N, C, &N, &info); + if(info!=0) std::cerr << "potrf_ error " << info << "\n"; + } + + static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + int info = 0; + int * ipiv = (int*)alloca(sizeof(int)*N); + BLAS_FUNC(getrf)(&N, &N, C, &N, ipiv, &info); + if(info!=0) std::cerr << "getrf_ error " << info << "\n"; + } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ + BLAS_FUNC(copy)(&N, B, &intone, X, &intone); + BLAS_FUNC(trsv)(&lower, ¬rans, &nonunit, &N, L, &N, X, &intone); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){ + BLAS_FUNC(copy)(&N, B, &intone, X, &intone); + BLAS_FUNC(trsm)(&right, &lower, ¬rans, &nonunit, &N, &N, &fone, L, &N, X, &N); + } + + static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & /*X*/, int N){ + BLAS_FUNC(trmm)(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N); + } + + #ifdef HAS_LAPACK + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + int info = 0; + int * ipiv = (int*)alloca(sizeof(int)*N); + int * jpiv = (int*)alloca(sizeof(int)*N); + BLAS_FUNC(getc2)(&N, C, &N, ipiv, jpiv, &info); + } + + + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ + { + int N2 = N*N; + int inc = 1; + BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); + } + int info = 0; + int ilo = 1; + int ihi = N; + int bsize = 64; + int worksize = N*bsize; + SCALAR* d = new SCALAR[N+worksize]; + BLAS_FUNC(gehrd)(&N, &ilo, &ihi, C, &N, d, d+N, &worksize, &info); + delete[] d; + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ + { + int N2 = N*N; + int inc = 1; + BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); + } + char uplo = 'U'; + int info = 0; + int bsize = 64; + int worksize = N*bsize; + SCALAR* d = new SCALAR[3*N+worksize]; + BLAS_FUNC(sytrd)(&uplo, &N, C, &N, d, d+N, d+2*N, d+3*N, &worksize, &info); + delete[] d; + } + + #endif // HAS_LAPACK + +}; + +SCALAR blas_interface::fone = SCALAR(1); +SCALAR blas_interface::fzero = SCALAR(0); diff --git a/lib/eigen-3.4.0/bench/btl/libs/BLAS/c_interface_base.h b/lib/eigen-3.4.0/bench/btl/libs/BLAS/c_interface_base.h new file mode 100644 index 0000000..de61380 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/BLAS/c_interface_base.h @@ -0,0 +1,73 @@ + +#ifndef BTL_C_INTERFACE_BASE_H +#define BTL_C_INTERFACE_BASE_H + +#include "utilities.h" +#include + +template class c_interface_base +{ + +public: + + typedef real real_type; + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef real* gene_matrix; + typedef real* gene_vector; + + static void free_matrix(gene_matrix & A, int /*N*/){ + delete[] A; + } + + static void free_vector(gene_vector & B){ + delete[] B; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + int N = A_stl.size(); + A = new real[N*N]; + for (int j=0;j +// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blas_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +#include "action_cholesky.hh" +#include "action_lu_decomp.hh" +#include "action_partial_lu.hh" +#include "action_trisolve_matrix.hh" + +#ifdef HAS_LAPACK +#include "action_hessenberg.hh" +#endif + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + + #ifdef HAS_LAPACK +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + #endif + + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/STL/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/STL/CMakeLists.txt new file mode 100644 index 0000000..4cfc2dc --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/STL/CMakeLists.txt @@ -0,0 +1,2 @@ + +btl_add_bench(btl_STL main.cpp OFF) diff --git a/lib/eigen-3.4.0/bench/btl/libs/STL/STL_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/STL/STL_interface.hh new file mode 100644 index 0000000..16658c4 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/STL/STL_interface.hh @@ -0,0 +1,244 @@ +//===================================================== +// File : STL_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:24 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef STL_INTERFACE_HH +#define STL_INTERFACE_HH +#include +#include +#include "utilities.h" + +using namespace std; + +template +class STL_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef stl_matrix gene_matrix; + + typedef stl_vector gene_vector; + + static inline std::string name( void ) + { + return "STL"; + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/){} + + static void free_vector(gene_vector & /*B*/){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A = A_stl; + } + + static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ + B = B_stl; + } + + static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ + B_stl = B ; + } + + + static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){ + A_stl = A ; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + for (int i=0;i=j) + { + for (int k=0;k > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/blaze/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/blaze/CMakeLists.txt new file mode 100644 index 0000000..e99a085 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blaze/CMakeLists.txt @@ -0,0 +1,13 @@ + +find_package(BLAZE) +find_package(Boost COMPONENTS system) +if (BLAZE_FOUND AND Boost_FOUND) + include_directories(${BLAZE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) + btl_add_bench(btl_blaze main.cpp) + # Note: The newest blaze version requires C++14. + # Ideally, we should set this depending on the version of Blaze we found + set_property(TARGET btl_blaze PROPERTY CXX_STANDARD 14) + if(BUILD_btl_blaze) + target_link_libraries(btl_blaze ${Boost_LIBRARIES}) + endif() +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/blaze/blaze_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/blaze/blaze_interface.hh new file mode 100644 index 0000000..7b418f6 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blaze/blaze_interface.hh @@ -0,0 +1,141 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLAZE_INTERFACE_HH +#define BLAZE_INTERFACE_HH + +#include +#include +#include +// using namespace blaze; + +#include + +template +class blaze_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef blaze::DynamicMatrix gene_matrix; + typedef blaze::DynamicVector gene_vector; + + static inline std::string name() { return "blaze"; } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (int j=0; j ipvt(N); +// lu_factor(R, ipvt); +// } + +// static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ +// X = lower_trisolve(L, B); +// } + + static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ + cible = source; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + cible = source; + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/blaze/main.cpp b/lib/eigen-3.4.0/bench/btl/libs/blaze/main.cpp new file mode 100644 index 0000000..ccae0cb --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blaze/main.cpp @@ -0,0 +1,40 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blaze_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/blitz/CMakeLists.txt new file mode 100644 index 0000000..e203c81 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/CMakeLists.txt @@ -0,0 +1,17 @@ + +find_package(Blitz) + +if (BLITZ_FOUND) + include_directories(${BLITZ_INCLUDES}) + + btl_add_bench(btl_blitz btl_blitz.cpp) + if (BUILD_btl_blitz) + target_link_libraries(btl_blitz ${BLITZ_LIBRARIES}) + endif () + + btl_add_bench(btl_tiny_blitz btl_tiny_blitz.cpp OFF) + if (BUILD_btl_tiny_blitz) + target_link_libraries(btl_tiny_blitz ${BLITZ_LIBRARIES}) + endif () + +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_LU_solve_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_interface.hh new file mode 100644 index 0000000..a67c47c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/blitz_interface.hh @@ -0,0 +1,147 @@ +//===================================================== +// File : blitz_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_INTERFACE_HH +#define BLITZ_INTERFACE_HH + +#include +#include +#include +#include +#include +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef blitz::Array gene_matrix; + typedef blitz::Array gene_vector; +// typedef blitz::Matrix gene_matrix; +// typedef blitz::Vector gene_vector; + + static inline std::string name() { return "blitz"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(),A_stl.size()); + for (int j=0; j(source); +// for (int i=0;i(source); + cible = source; + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_blitz.cpp b/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_blitz.cpp new file mode 100644 index 0000000..16d2b59 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_blitz.cpp @@ -0,0 +1,51 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blitz_interface.hh" +#include "blitz_LU_solve_interface.hh" +#include "bench.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_tiny_blitz.cpp b/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_tiny_blitz.cpp new file mode 100644 index 0000000..9fddde7 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/btl_tiny_blitz.cpp @@ -0,0 +1,38 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "tiny_blitz_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" + +BTL_MAIN; + +int main() +{ + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/blitz/tiny_blitz_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/blitz/tiny_blitz_interface.hh new file mode 100644 index 0000000..6b26db7 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/blitz/tiny_blitz_interface.hh @@ -0,0 +1,106 @@ +//===================================================== +// File : tiny_blitz_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef TINY_BLITZ_INTERFACE_HH +#define TINY_BLITZ_INTERFACE_HH + +#include "blitz/array.h" +#include "blitz/tiny.h" +#include "blitz/tinymat.h" +#include "blitz/tinyvec.h" +#include + +#include + +BZ_USING_NAMESPACE(blitz) + +template +class tiny_blitz_interface +{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef TinyVector gene_vector; + typedef TinyMatrix gene_matrix; + + static inline std::string name() { return "tiny_blitz"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + for (int j=0; j +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" +#include "action_cholesky.hh" +#include "action_trisolve.hh" + +BTL_MAIN; + +int main() +{ + + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen2/eigen2_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/eigen2/eigen2_interface.hh new file mode 100644 index 0000000..1deabda --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen2/eigen2_interface.hh @@ -0,0 +1,168 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef EIGEN2_INTERFACE_HH +#define EIGEN2_INTERFACE_HH +// #include +#include +#include +#include +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class eigen2_interface +{ + +public : + + enum {IsFixedSize = (SIZE!=Dynamic)}; + + typedef real real_type; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Matrix gene_matrix; + typedef Eigen::Matrix gene_vector; + + static inline std::string name( void ) + { + #if defined(EIGEN_VECTORIZE_SSE) + if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; + #elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; + #else + if (SIZE==Dynamic) return "eigen2_novec"; else return "tiny_eigen2_novec"; + #endif + } + + static void free_matrix(gene_matrix & A, int N) {} + + static void free_vector(gene_vector & B) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (int j=0; j().solveTriangular(B); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){ + X = L.template marked().solveTriangular(B); + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ + C = X.llt().matrixL(); +// C = X; +// Cholesky::computeInPlace(C); +// Cholesky::computeInPlaceBlock(C); + } + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + C = X.lu().matrixLU(); +// C = X.inverse(); + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ + C = Tridiagonalization(X).packedMatrix(); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ + C = HessenbergDecomposition(X).packedMatrix(); + } + + + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_adv.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_adv.cpp new file mode 100644 index 0000000..fe33689 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_adv.cpp @@ -0,0 +1,44 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "action_trisolve.hh" +#include "action_trisolve_matrix.hh" +#include "action_cholesky.hh" +#include "action_hessenberg.hh" +#include "action_lu_decomp.hh" +// #include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_linear.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_linear.cpp new file mode 100644 index 0000000..c17d16c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_linear.cpp @@ -0,0 +1,34 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_matmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_matmat.cpp new file mode 100644 index 0000000..cd9dc9c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_matmat.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_vecmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_vecmat.cpp new file mode 100644 index 0000000..8b66cd2 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen2/main_vecmat.cpp @@ -0,0 +1,36 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/eigen3/CMakeLists.txt new file mode 100644 index 0000000..06a72b4 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/CMakeLists.txt @@ -0,0 +1,65 @@ + + +if((NOT EIGEN3_INCLUDE_DIR) AND Eigen_SOURCE_DIR) + # unless EIGEN3_INCLUDE_DIR is defined, let's use current Eigen version + set(EIGEN3_INCLUDE_DIR ${Eigen_SOURCE_DIR}) + set(EIGEN3_FOUND TRUE) +else() + find_package(Eigen3) +endif() + +if (EIGEN3_FOUND) + + include_directories(${EIGEN3_INCLUDE_DIR}) + btl_add_bench(btl_eigen3_linear main_linear.cpp) + btl_add_bench(btl_eigen3_vecmat main_vecmat.cpp) + btl_add_bench(btl_eigen3_matmat main_matmat.cpp) + btl_add_bench(btl_eigen3_adv main_adv.cpp ) + + btl_add_target_property(btl_eigen3_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_adv COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + + option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) + if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) + btl_add_bench(btl_eigen3_nogccvec_linear main_linear.cpp) + btl_add_bench(btl_eigen3_nogccvec_vecmat main_vecmat.cpp) + btl_add_bench(btl_eigen3_nogccvec_matmat main_matmat.cpp) + btl_add_bench(btl_eigen3_nogccvec_adv main_adv.cpp ) + + btl_add_target_property(btl_eigen3_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_adv COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + endif() + + + if(NOT BTL_NOVEC) + btl_add_bench(btl_eigen3_novec_linear main_linear.cpp OFF) + btl_add_bench(btl_eigen3_novec_vecmat main_vecmat.cpp OFF) + btl_add_bench(btl_eigen3_novec_matmat main_matmat.cpp OFF) + btl_add_bench(btl_eigen3_novec_adv main_adv.cpp OFF) + btl_add_target_property(btl_eigen3_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_adv COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + +# if(BUILD_btl_eigen3_adv) +# target_link_libraries(btl_eigen3_adv ${MKL_LIBRARIES}) +# endif() + + endif() + + btl_add_bench(btl_tiny_eigen3 btl_tiny_eigen3.cpp OFF) + + if(NOT BTL_NOVEC) + btl_add_bench(btl_tiny_eigen3_novec btl_tiny_eigen3.cpp OFF) + btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DBTL_PREFIX=eigen3_tiny") + + if(BUILD_btl_tiny_eigen3_novec) + btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_tiny_novec") + endif() + endif() + +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp new file mode 100644 index 0000000..d1515be --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp @@ -0,0 +1,46 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" +#include "action_cholesky.hh" +#include "action_trisolve.hh" + +BTL_MAIN; + +int main() +{ + + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/eigen3_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/eigen3/eigen3_interface.hh new file mode 100644 index 0000000..2e302d0 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/eigen3_interface.hh @@ -0,0 +1,242 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef EIGEN3_INTERFACE_HH +#define EIGEN3_INTERFACE_HH + +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class eigen3_interface +{ + +public : + + enum {IsFixedSize = (SIZE!=Dynamic)}; + + typedef real real_type; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Matrix gene_matrix; + typedef Eigen::Matrix gene_vector; + + static inline std::string name( void ) + { + return EIGEN_MAKESTRING(BTL_PREFIX); + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} + + static void free_vector(gene_vector & /*B*/) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (unsigned int j=0; j().setZero(); + X.template selfadjointView().rankUpdate(A.transpose()); + } + + static inline void aat_product(const gene_matrix & A, gene_matrix & X, int /*N*/){ + X.template triangularView().setZero(); + X.template selfadjointView().rankUpdate(A); + } + + static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = A*B; + } + + static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = (A.template selfadjointView() * B); +// internal::product_selfadjoint_vector(N,A.data(),N, B.data(), 1, X.data(), 1); + } + + template static void triassign(Dest& dst, const Src& src) + { + typedef typename Dest::Scalar Scalar; + typedef typename internal::packet_traits::type Packet; + const int PacketSize = sizeof(Packet)/sizeof(Scalar); + int size = dst.cols(); + for(int j=0; j(j, index, src); + else + dst.template copyPacket(index, j, src); + } + + // do the non-vectorizable part of the assignment + for (int index = alignedEnd; index(N,A.data(),N, X.data(), 1, Y.data(), 1, -1); + for(int j=0; j(c,s)); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = (A.transpose()*B); + } + + static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ + Y += coef * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ + Y = a*X + b*Y; + } + + static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ + cible = source; + } + + static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ + cible = source; + } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int /*N*/){ + X = L.template triangularView().solve(B); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ + X = L.template triangularView().solve(B); + } + + static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ + X.noalias() = L.template triangularView() * B; + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = X; + internal::llt_inplace::blocked(C); + //C = X.llt().matrixL(); +// C = X; +// Cholesky::computeInPlace(C); +// Cholesky::computeInPlaceBlock(C); + } + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = X.fullPivLu().matrixLU(); + } + + static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + Matrix piv(N); + DenseIndex nb; + C = X; + 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::CoeffVectorType aux(N-1); + C = X; + internal::tridiagonalization_inplace(C, aux); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = HessenbergDecomposition(X).packedMatrix(); + } + + + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_adv.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_adv.cpp new file mode 100644 index 0000000..9586535 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_adv.cpp @@ -0,0 +1,44 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "action_trisolve.hh" +#include "action_trisolve_matrix.hh" +#include "action_cholesky.hh" +#include "action_hessenberg.hh" +#include "action_lu_decomp.hh" +#include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_linear.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_linear.cpp new file mode 100644 index 0000000..e8538b7 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_linear.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_matmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_matmat.cpp new file mode 100644 index 0000000..052810a --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_matmat.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_vecmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_vecmat.cpp new file mode 100644 index 0000000..0dda444 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/eigen3/main_vecmat.cpp @@ -0,0 +1,36 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/gmm/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/gmm/CMakeLists.txt new file mode 100644 index 0000000..0bcb046 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/gmm/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(GMM) +if (GMM_FOUND) + include_directories(${GMM_INCLUDES}) + btl_add_bench(btl_gmm main.cpp) +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_LU_solve_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_interface.hh new file mode 100644 index 0000000..3ea303c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/gmm/gmm_interface.hh @@ -0,0 +1,144 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef GMM_INTERFACE_HH +#define GMM_INTERFACE_HH + +#include +#include + +using namespace gmm; + +template +class gmm_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef gmm::dense_matrix gene_matrix; + typedef stl_vector gene_vector; + + static inline std::string name( void ) + { + return "gmm"; + } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(),A_stl.size()); + + for (int j=0; j ipvt(N); + gmm::lu_factor(R, ipvt); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & R, int N){ + gmm::copy(X,R); + gmm::Hessenberg_reduction(R,X,false); + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & R, int N){ + gmm::copy(X,R); + gmm::Householder_tridiagonalization(R,X,false); + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/gmm/main.cpp b/lib/eigen-3.4.0/bench/btl/libs/gmm/main.cpp new file mode 100644 index 0000000..1f0c051 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/gmm/main.cpp @@ -0,0 +1,51 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "gmm_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" +#include "action_hessenberg.hh" +#include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/mtl4/.kdbgrc.main b/lib/eigen-3.4.0/bench/btl/libs/mtl4/.kdbgrc.main new file mode 100644 index 0000000..fed082f --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/mtl4/.kdbgrc.main @@ -0,0 +1,12 @@ +[General] +DebuggerCmdStr= +DriverName=GDB +FileVersion=1 +OptionsSelected= +ProgramArgs= +TTYLevel=7 +WorkingDirectory= + +[Memory] +ColumnWidths=80,0 +NumExprs=0 diff --git a/lib/eigen-3.4.0/bench/btl/libs/mtl4/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/mtl4/CMakeLists.txt new file mode 100644 index 0000000..132a501 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/mtl4/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(MTL4) +if (MTL4_FOUND) + include_directories(${MTL4_INCLUDE_DIR}) + btl_add_bench(btl_mtl4 main.cpp) +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/mtl4/main.cpp b/lib/eigen-3.4.0/bench/btl/libs/mtl4/main.cpp new file mode 100644 index 0000000..96fcfb9 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/mtl4/main.cpp @@ -0,0 +1,46 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "mtl4_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" +#include "action_cholesky.hh" +// #include "action_lu_decomp.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_interface.hh new file mode 100644 index 0000000..3795ac6 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/mtl4/mtl4_interface.hh @@ -0,0 +1,144 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef MTL4_INTERFACE_HH +#define MTL4_INTERFACE_HH + +#include +#include +// #include +#include + +using namespace mtl; + +template +class mtl4_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef mtl::dense2D > gene_matrix; + typedef mtl::dense_vector gene_vector; + + static inline std::string name() { return "mtl4"; } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.change_dim(A_stl[0].size(), A_stl.size()); + + for (int j=0; j C(N,N); +// C = B; +// X = (A*C); + } + + static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ + X = (trans(A)*trans(B)); + } + +// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){ +// X = (trans(A)*A); +// } + + static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){ + X = (A*trans(A)); + } + + static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = (A*B); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = (trans(A)*B); + } + + static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ + Y += coef * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){ + Y = a*X + b*Y; + } + +// static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ +// C = X; +// recursive_cholesky(C); +// } + +// static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){ +// R = X; +// std::vector ipvt(N); +// lu_factor(R, ipvt); +// } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ + X = lower_trisolve(L, B); + } + + static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ + cible = source; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + cible = source; + } + +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/tensors/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/tensors/CMakeLists.txt new file mode 100644 index 0000000..e10a736 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tensors/CMakeLists.txt @@ -0,0 +1,44 @@ + + +if((NOT TENSOR_INCLUDE_DIR) AND Eigen_SOURCE_DIR) + # unless TENSOR_INCLUDE_DIR is defined, let's use current Eigen version + set(TENSOR_INCLUDE_DIR ${Eigen_SOURCE_DIR}) + set(TENSOR_FOUND TRUE) +else() + find_package(Tensor) +endif() + +if (TENSOR_FOUND) + + include_directories(${TENSOR_INCLUDE_DIR}) + btl_add_bench(btl_tensor_linear main_linear.cpp) + btl_add_bench(btl_tensor_vecmat main_vecmat.cpp) + btl_add_bench(btl_tensor_matmat main_matmat.cpp) + + btl_add_target_property(btl_tensor_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + btl_add_target_property(btl_tensor_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + btl_add_target_property(btl_tensor_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + + option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) + if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) + btl_add_bench(btl_tensor_nogccvec_linear main_linear.cpp) + btl_add_bench(btl_tensor_nogccvec_vecmat main_vecmat.cpp) + btl_add_bench(btl_tensor_nogccvec_matmat main_matmat.cpp) + + btl_add_target_property(btl_tensor_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + btl_add_target_property(btl_tensor_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + btl_add_target_property(btl_tensor_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + endif() + + + if(NOT BTL_NOVEC) + btl_add_bench(btl_tensor_novec_linear main_linear.cpp OFF) + btl_add_bench(btl_tensor_novec_vecmat main_vecmat.cpp OFF) + btl_add_bench(btl_tensor_novec_matmat main_matmat.cpp OFF) + btl_add_target_property(btl_tensor_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + btl_add_target_property(btl_tensor_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + btl_add_target_property(btl_tensor_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + + endif() + +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/tensors/main_linear.cpp b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_linear.cpp new file mode 100644 index 0000000..e257f1e --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_linear.cpp @@ -0,0 +1,23 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Benoit Steiner +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/btl/libs/tensors/main_matmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_matmat.cpp new file mode 100644 index 0000000..675fcfc --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_matmat.cpp @@ -0,0 +1,21 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/btl/libs/tensors/main_vecmat.cpp b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_vecmat.cpp new file mode 100644 index 0000000..1af00c8 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tensors/main_vecmat.cpp @@ -0,0 +1,21 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/btl/libs/tensors/tensor_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/tensors/tensor_interface.hh new file mode 100644 index 0000000..97b8e0f --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tensors/tensor_interface.hh @@ -0,0 +1,105 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#ifndef TENSOR_INTERFACE_HH +#define TENSOR_INTERFACE_HH + +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class tensor_interface +{ +public : + typedef real real_type; + typedef typename Eigen::Tensor::Index Index; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Tensor gene_matrix; + typedef Eigen::Tensor gene_vector; + + + static inline std::string name( void ) + { + return EIGEN_MAKESTRING(BTL_PREFIX); + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} + + static void free_vector(gene_vector & /*B*/) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(Eigen::array(A_stl[0].size(), A_stl.size())); + + for (unsigned int j=0; j(i,j)) = A_stl[j][i]; + } + } + } + + static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){ + B.resize(B_stl.size()); + + for (unsigned int i=0; i(i,j)); + } + } + } + + static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){ + typedef typename Eigen::Tensor::DimensionPair DimPair; + const Eigen::array dims(DimPair(1, 0)); + X/*.noalias()*/ = A.contract(B, dims); + } + + static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + typedef typename Eigen::Tensor::DimensionPair DimPair; + const Eigen::array dims(DimPair(1, 0)); + X/*.noalias()*/ = A.contract(B, dims); + } + + static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ + Y += X.constant(coef) * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ + Y = X.constant(a)*X + Y.constant(b)*Y; + } + + static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ + cible = source; + } + + static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ + cible = source; + } +}; + +#endif diff --git a/lib/eigen-3.4.0/bench/btl/libs/tvmet/CMakeLists.txt b/lib/eigen-3.4.0/bench/btl/libs/tvmet/CMakeLists.txt new file mode 100644 index 0000000..e737697 --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tvmet/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(Tvmet) +if (TVMET_FOUND) + include_directories(${TVMET_INCLUDE_DIR}) + btl_add_bench(btl_tvmet main.cpp OFF) +endif () diff --git a/lib/eigen-3.4.0/bench/btl/libs/tvmet/main.cpp b/lib/eigen-3.4.0/bench/btl/libs/tvmet/main.cpp new file mode 100644 index 0000000..633215c --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tvmet/main.cpp @@ -0,0 +1,40 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "tvmet_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_atv_product.hh" +#include "action_axpy.hh" + +BTL_MAIN; + +int main() +{ + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/tvmet/tvmet_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/tvmet/tvmet_interface.hh new file mode 100644 index 0000000..b441ada --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/tvmet/tvmet_interface.hh @@ -0,0 +1,104 @@ +//===================================================== +// File : tvmet_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef TVMET_INTERFACE_HH +#define TVMET_INTERFACE_HH + +#include +#include +#include + +#include + +using namespace tvmet; + +template +class tvmet_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Vector gene_vector; + typedef Matrix gene_matrix; + + static inline std::string name() { return "tiny_tvmet"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + for (int j=0; j +// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "ublas_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/lib/eigen-3.4.0/bench/btl/libs/ublas/ublas_interface.hh b/lib/eigen-3.4.0/bench/btl/libs/ublas/ublas_interface.hh new file mode 100644 index 0000000..f59b7cf --- /dev/null +++ b/lib/eigen-3.4.0/bench/btl/libs/ublas/ublas_interface.hh @@ -0,0 +1,141 @@ +//===================================================== +// File : ublas_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 +//===================================================== +// +// This program is free software; 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. +// +// This program 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 General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef UBLAS_INTERFACE_HH +#define UBLAS_INTERFACE_HH + +#include +#include +#include +#include + +using namespace boost::numeric; + +template +class ublas_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef typename boost::numeric::ublas::matrix gene_matrix; + typedef typename boost::numeric::ublas::vector gene_vector; + + static inline std::string name( void ) { return "ublas"; } + + static void free_matrix(gene_matrix & A, int N) {} + + static void free_vector(gene_vector & B) {} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl.size(),A_stl[0].size()); + for (int j=0; j +#include "../Eigen/Core" + +using namespace Eigen; +using namespace std; + +#define DUMP_CPUID(CODE) {\ + int abcd[4]; \ + abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;\ + EIGEN_CPUID(abcd, CODE, 0); \ + std::cout << "The code " << CODE << " gives " \ + << (int*)(abcd[0]) << " " << (int*)(abcd[1]) << " " \ + << (int*)(abcd[2]) << " " << (int*)(abcd[3]) << " " << std::endl; \ + } + +int main() +{ + cout << "Eigen's L1 = " << internal::queryL1CacheSize() << endl; + cout << "Eigen's L2/L3 = " << internal::queryTopLevelCacheSize() << endl; + int l1, l2, l3; + internal::queryCacheSizes(l1, l2, l3); + cout << "Eigen's L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + + #ifdef EIGEN_CPUID + + int abcd[4]; + int string[8]; + char* string_char = (char*)(string); + + // vendor ID + EIGEN_CPUID(abcd,0x0,0); + string[0] = abcd[1]; + string[1] = abcd[3]; + string[2] = abcd[2]; + string[3] = 0; + cout << endl; + cout << "vendor id = " << string_char << endl; + cout << endl; + int max_funcs = abcd[0]; + + internal::queryCacheSizes_intel_codes(l1, l2, l3); + cout << "Eigen's intel codes L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + if(max_funcs>=4) + { + internal::queryCacheSizes_intel_direct(l1, l2, l3); + cout << "Eigen's intel direct L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + } + internal::queryCacheSizes_amd(l1, l2, l3); + cout << "Eigen's amd L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + cout << endl; + + // dump Intel direct method + if(max_funcs>=4) + { + l1 = l2 = l3 = 0; + int cache_id = 0; + int cache_type = 0; + do { + abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0; + EIGEN_CPUID(abcd,0x4,cache_id); + cache_type = (abcd[0] & 0x0F) >> 0; + int cache_level = (abcd[0] & 0xE0) >> 5; // A[7:5] + int ways = (abcd[1] & 0xFFC00000) >> 22; // B[31:22] + int partitions = (abcd[1] & 0x003FF000) >> 12; // B[21:12] + int line_size = (abcd[1] & 0x00000FFF) >> 0; // B[11:0] + int sets = (abcd[2]); // C[31:0] + int cache_size = (ways+1) * (partitions+1) * (line_size+1) * (sets+1); + + cout << "cache[" << cache_id << "].type = " << cache_type << "\n"; + cout << "cache[" << cache_id << "].level = " << cache_level << "\n"; + cout << "cache[" << cache_id << "].ways = " << ways << "\n"; + cout << "cache[" << cache_id << "].partitions = " << partitions << "\n"; + cout << "cache[" << cache_id << "].line_size = " << line_size << "\n"; + cout << "cache[" << cache_id << "].sets = " << sets << "\n"; + cout << "cache[" << cache_id << "].size = " << cache_size << "\n"; + + cache_id++; + } while(cache_type>0 && cache_id<16); + } + + // dump everything + std::cout << endl <<"Raw dump:" << endl; + for(int i=0; i +#include "BenchTimer.h" +#include +#include +#include +#include +#include +using namespace Eigen; + +std::map > results; +std::vector labels; +std::vector sizes; + +template +EIGEN_DONT_INLINE +void compute_norm_equation(Solver &solver, const MatrixType &A) { + if(A.rows()!=A.cols()) + solver.compute(A.transpose()*A); + else + solver.compute(A); +} + +template +EIGEN_DONT_INLINE +void compute(Solver &solver, const MatrixType &A) { + solver.compute(A); +} + +template +void bench(int id, int rows, int size = Size) +{ + typedef Matrix Mat; + typedef Matrix MatDyn; + typedef Matrix MatSquare; + Mat A(rows,size); + A.setRandom(); + if(rows==size) + A = A*A.adjoint(); + BenchTimer t_llt, t_ldlt, t_lu, t_fplu, t_qr, t_cpqr, t_cod, t_fpqr, t_jsvd, t_bdcsvd; + + int svd_opt = ComputeThinU|ComputeThinV; + + int tries = 5; + int rep = 1000/size; + if(rep==0) rep = 1; +// rep = rep*rep; + + LLT llt(size); + LDLT ldlt(size); + PartialPivLU lu(size); + FullPivLU fplu(size,size); + HouseholderQR qr(A.rows(),A.cols()); + ColPivHouseholderQR cpqr(A.rows(),A.cols()); + CompleteOrthogonalDecomposition cod(A.rows(),A.cols()); + FullPivHouseholderQR fpqr(A.rows(),A.cols()); + JacobiSVD jsvd(A.rows(),A.cols()); + BDCSVD bdcsvd(A.rows(),A.cols()); + + BENCH(t_llt, tries, rep, compute_norm_equation(llt,A)); + BENCH(t_ldlt, tries, rep, compute_norm_equation(ldlt,A)); + BENCH(t_lu, tries, rep, compute_norm_equation(lu,A)); + if(size<=1000) + BENCH(t_fplu, tries, rep, compute_norm_equation(fplu,A)); + BENCH(t_qr, tries, rep, compute(qr,A)); + BENCH(t_cpqr, tries, rep, compute(cpqr,A)); + BENCH(t_cod, tries, rep, compute(cod,A)); + if(size*rows<=10000000) + BENCH(t_fpqr, tries, rep, compute(fpqr,A)); + if(size<500) // JacobiSVD is really too slow for too large matrices + BENCH(t_jsvd, tries, rep, jsvd.compute(A,svd_opt)); +// if(size*rows<=20000000) + BENCH(t_bdcsvd, tries, rep, bdcsvd.compute(A,svd_opt)); + + results["LLT"][id] = t_llt.best(); + results["LDLT"][id] = t_ldlt.best(); + results["PartialPivLU"][id] = t_lu.best(); + results["FullPivLU"][id] = t_fplu.best(); + results["HouseholderQR"][id] = t_qr.best(); + results["ColPivHouseholderQR"][id] = t_cpqr.best(); + results["CompleteOrthogonalDecomposition"][id] = t_cod.best(); + results["FullPivHouseholderQR"][id] = t_fpqr.best(); + results["JacobiSVD"][id] = t_jsvd.best(); + results["BDCSVD"][id] = t_bdcsvd.best(); +} + + +int main() +{ + labels.push_back("LLT"); + labels.push_back("LDLT"); + labels.push_back("PartialPivLU"); + labels.push_back("FullPivLU"); + labels.push_back("HouseholderQR"); + labels.push_back("ColPivHouseholderQR"); + labels.push_back("CompleteOrthogonalDecomposition"); + labels.push_back("FullPivHouseholderQR"); + labels.push_back("JacobiSVD"); + labels.push_back("BDCSVD"); + + for(int i=0; i(k,sizes[k](0),sizes[k](1)); + } + + cout.width(32); + cout << "solver/size"; + cout << " "; + for(int k=0; k=1e6) cout << "-"; + else cout << r(k); + cout << " "; + } + cout << endl; + } + + // HTML output + cout << "" << endl; + cout << "" << endl; + for(int k=0; k" << sizes[k](0) << "x" << sizes[k](1) << ""; + cout << "" << endl; + for(int i=0; i"; + ArrayXf r = (results[labels[i]]*100000.f).floor()/100.f; + for(int k=0; k=1e6) cout << ""; + else + { + cout << ""; + } + } + cout << "" << endl; + } + cout << "
solver/size
" << labels[i] << "-" << r(k); + if(i>0) + cout << " (x" << numext::round(10.f*results[labels[i]](k)/results["LLT"](k))/10.f << ")"; + if(i<4 && sizes[k](0)!=sizes[k](1)) + cout << " *"; + cout << "
" << endl; + +// cout << "LLT (ms) " << (results["LLT"]*1000.).format(fmt) << "\n"; +// cout << "LDLT (%) " << (results["LDLT"]/results["LLT"]).format(fmt) << "\n"; +// cout << "PartialPivLU (%) " << (results["PartialPivLU"]/results["LLT"]).format(fmt) << "\n"; +// cout << "FullPivLU (%) " << (results["FullPivLU"]/results["LLT"]).format(fmt) << "\n"; +// cout << "HouseholderQR (%) " << (results["HouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "ColPivHouseholderQR (%) " << (results["ColPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "CompleteOrthogonalDecomposition (%) " << (results["CompleteOrthogonalDecomposition"]/results["LLT"]).format(fmt) << "\n"; +// cout << "FullPivHouseholderQR (%) " << (results["FullPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "JacobiSVD (%) " << (results["JacobiSVD"]/results["LLT"]).format(fmt) << "\n"; +// cout << "BDCSVD (%) " << (results["BDCSVD"]/results["LLT"]).format(fmt) << "\n"; +} diff --git a/lib/eigen-3.4.0/bench/eig33.cpp b/lib/eigen-3.4.0/bench/eig33.cpp new file mode 100644 index 0000000..f003d8a --- /dev/null +++ b/lib/eigen-3.4.0/bench/eig33.cpp @@ -0,0 +1,195 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// The computeRoots function included in this is based on materials +// covered by the following copyright and license: +// +// Geometric Tools, LLC +// Copyright (c) 1998-2010 +// Distributed under the Boost Software License, Version 1.0. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include +#include + +using namespace Eigen; +using namespace std; + +template +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 = std::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 + // real-valued, because the matrix is symmetric. + Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(0,1)*m(0,2)*m(1,2) - m(0,0)*m(1,2)*m(1,2) - m(1,1)*m(0,2)*m(0,2) - m(2,2)*m(0,1)*m(0,1); + Scalar c1 = m(0,0)*m(1,1) - m(0,1)*m(0,1) + m(0,0)*m(2,2) - m(0,2)*m(0,2) + m(1,1)*m(2,2) - m(1,2)*m(1,2); + Scalar c2 = m(0,0) + m(1,1) + m(2,2); + + // Construct the parameters used in classifying the roots of the equation + // and in solving the equation for the roots in closed form. + Scalar c2_over_3 = c2*s_inv3; + Scalar a_over_3 = (c1 - c2*c2_over_3)*s_inv3; + if (a_over_3 > Scalar(0)) + a_over_3 = Scalar(0); + + Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1)); + + Scalar q = half_b*half_b + a_over_3*a_over_3*a_over_3; + if (q > Scalar(0)) + q = Scalar(0); + + // Compute the eigenvalues by solving for the roots of the polynomial. + Scalar rho = std::sqrt(-a_over_3); + Scalar theta = std::atan2(std::sqrt(-q),half_b)*s_inv3; + Scalar cos_theta = std::cos(theta); + Scalar sin_theta = std::sin(theta); + roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta; + roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); + roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); +} + +template +void eigen33(const Matrix& mat, Matrix& evecs, Vector& evals) +{ + typedef typename Matrix::Scalar Scalar; + // Scale the matrix so its entries are in [-1,1]. The scaling is applied + // only when at least one matrix entry has magnitude larger than 1. + + Scalar shift = mat.trace()/3; + Matrix scaledMat = mat; + scaledMat.diagonal().array() -= shift; + Scalar scale = scaledMat.cwiseAbs()/*.template triangularView()*/.maxCoeff(); + scale = std::max(scale,Scalar(1)); + scaledMat/=scale; + + // Compute the eigenvalues +// scaledMat.setZero(); + computeRoots(scaledMat,evals); + + // compute the eigen vectors + // **here we assume 3 different eigenvalues** + + // "optimized version" which appears to be slower with gcc! +// Vector base; +// Scalar alpha, beta; +// base << scaledMat(1,0) * scaledMat(2,1), +// scaledMat(1,0) * scaledMat(2,0), +// -scaledMat(1,0) * scaledMat(1,0); +// for(int k=0; k<2; ++k) +// { +// alpha = scaledMat(0,0) - evals(k); +// beta = scaledMat(1,1) - evals(k); +// evecs.col(k) = (base + Vector(-beta*scaledMat(2,0), -alpha*scaledMat(2,1), alpha*beta)).normalized(); +// } +// evecs.col(2) = evecs.col(0).cross(evecs.col(1)).normalized(); + +// // naive version +// Matrix tmp; +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(0); +// evecs.col(0) = tmp.row(0).cross(tmp.row(1)).normalized(); +// +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(1); +// evecs.col(1) = tmp.row(0).cross(tmp.row(1)).normalized(); +// +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(2); +// evecs.col(2) = tmp.row(0).cross(tmp.row(1)).normalized(); + + // a more stable version: + if((evals(2)-evals(0))<=Eigen::NumTraits::epsilon()) + { + evecs.setIdentity(); + } + else + { + Matrix tmp; + tmp = scaledMat; + tmp.diagonal ().array () -= evals (2); + evecs.col (2) = tmp.row (0).cross (tmp.row (1)).normalized (); + + tmp = scaledMat; + tmp.diagonal ().array () -= evals (1); + evecs.col(1) = tmp.row (0).cross(tmp.row (1)); + Scalar n1 = evecs.col(1).norm(); + if(n1<=Eigen::NumTraits::epsilon()) + evecs.col(1) = evecs.col(2).unitOrthogonal(); + else + evecs.col(1) /= n1; + + // make sure that evecs[1] is orthogonal to evecs[2] + evecs.col(1) = evecs.col(2).cross(evecs.col(1).cross(evecs.col(2))).normalized(); + evecs.col(0) = evecs.col(2).cross(evecs.col(1)); + } + + // Rescale back to the original size. + evals *= scale; + evals.array()+=shift; +} + +int main() +{ + BenchTimer t; + int tries = 10; + int rep = 400000; + typedef Matrix3d Mat; + typedef Vector3d Vec; + Mat A = Mat::Random(3,3); + A = A.adjoint() * A; +// Mat Q = A.householderQr().householderQ(); +// A = Q * Vec(2.2424567,2.2424566,7.454353).asDiagonal() * Q.transpose(); + + SelfAdjointEigenSolver eig(A); + BENCH(t, tries, rep, eig.compute(A)); + std::cout << "Eigen iterative: " << t.best() << "s\n"; + + BENCH(t, tries, rep, eig.computeDirect(A)); + std::cout << "Eigen direct : " << t.best() << "s\n"; + + Mat evecs; + Vec evals; + BENCH(t, tries, rep, eigen33(A,evecs,evals)); + std::cout << "Direct: " << t.best() << "s\n\n"; + +// std::cerr << "Eigenvalue/eigenvector diffs:\n"; +// std::cerr << (evals - eig.eigenvalues()).transpose() << "\n"; +// for(int k=0;k<3;++k) +// if(evecs.col(k).dot(eig.eigenvectors().col(k))<0) +// evecs.col(k) = -evecs.col(k); +// std::cerr << evecs - eig.eigenvectors() << "\n\n"; +} diff --git a/lib/eigen-3.4.0/bench/geometry.cpp b/lib/eigen-3.4.0/bench/geometry.cpp new file mode 100644 index 0000000..b187a51 --- /dev/null +++ b/lib/eigen-3.4.0/bench/geometry.cpp @@ -0,0 +1,126 @@ + +#include +#include +#include + +using namespace std; +using namespace Eigen; + +#ifndef SCALAR +#define SCALAR float +#endif + +#ifndef SIZE +#define SIZE 8 +#endif + +typedef SCALAR Scalar; +typedef NumTraits::Real RealScalar; +typedef Matrix A; +typedef Matrix B; +typedef Matrix C; +typedef Matrix M; + +template +EIGEN_DONT_INLINE void transform(const Transformation& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin"); + data = t * data; + EIGEN_ASM_COMMENT("end"); +} + +template +EIGEN_DONT_INLINE void transform(const Quaternion& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin quat"); + for(int i=0;i struct ToRotationMatrixWrapper +{ + enum {Dim = T::Dim}; + typedef typename T::Scalar Scalar; + ToRotationMatrixWrapper(const T& o) : object(o) {} + T object; +}; + +template +EIGEN_DONT_INLINE void transform(const ToRotationMatrixWrapper& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin quat via mat"); + data = t.object.toRotationMatrix() * data; + EIGEN_ASM_COMMENT("end quat via mat"); +} + +template +EIGEN_DONT_INLINE void transform(const Transform& t, Data& data) +{ + data = (t * data.colwise().homogeneous()).template block(0,0); +} + +template struct get_dim { enum { Dim = T::Dim }; }; +template +struct get_dim > { enum { Dim = R }; }; + +template +struct bench_impl +{ + static EIGEN_DONT_INLINE void run(const Transformation& t) + { + Matrix::Dim,N> data; + data.setRandom(); + bench_impl::run(t); + BenchTimer timer; + BENCH(timer,10,100000,transform(t,data)); + cout.width(9); + cout << timer.best() << " "; + } +}; + + +template +struct bench_impl +{ + static EIGEN_DONT_INLINE void run(const Transformation&) {} +}; + +template +EIGEN_DONT_INLINE void bench(const std::string& msg, const Transformation& t) +{ + cout << msg << " "; + bench_impl::run(t); + std::cout << "\n"; +} + +int main(int argc, char ** argv) +{ + Matrix mat34; mat34.setRandom(); + Transform iso3(mat34); + Transform aff3(mat34); + Transform caff3(mat34); + Transform proj3(mat34); + Quaternion quat;quat.setIdentity(); + ToRotationMatrixWrapper > quatmat(quat); + Matrix mat33; mat33.setRandom(); + + cout.precision(4); + std::cout + << "N "; + for(int i=0;i Also optimized the blocking parameters to take
into account the number of threads used for a computation. +6782dde63499c # generalized gemv +6799f98650d0a # ensured that contractions that can be reduced to a matrix vector product +#6840918c51e60 # merge tensor +684e972b55ec4 # change prefetching in gebp +#68598604576d1 # merge index conversion +68963eb0f6fe6 # clean blocking size computation +689db05f2d01e # rotating kernel for ARM only +#6901b7e12847d # result_of +69226275b250a # fix prefetching change for ARM +692692136350b # prefetching +693a8ad8887bf # blocking size strategy +693bcf9bb5c1f # avoid redundant pack_rhs +6987550107028 # dynamic loop swapping +69858740ce4c6 # rm dynamic loop swapping,
adjust lhs's micro panel height to fully exploit L1 cache +698cd3bbffa73 # blocking heuristic:
block on the rhs in L1 if the lhs fit in L1. +701488c15615a # organize a little our default cache sizes,
and use a saner default L1 outside of x86 (10% faster on Nexus 5) +701e56aabf205 # Refactor computeProductBlockingSizes to make room
for the possibility of using lookup tables +701ca5c12587b # Polish lookup tables generation +7013589a9c115 # actual_panel_rows computation should always be resilient
to parameters not consistent with the known L1 cache size, see comment +70102babb9c0f # Provide a empirical lookup table for blocking sizes measured on a Nexus 5.
Only for float, only for Android on ARM 32bit for now. +7088481dc21ea # Bug 986: add support for coefficient-based
product with 0 depth. +709d7f51feb07 # Bug 992: don't select a 3p GEMM path with non-SIMD scalar types. +759f9303cc7c5 # 3.3-alpha1 +765aba1eda71e # help clang inlining +770fe630c9873 # Improve numerical accuracy in LLT and triangular solve
by using true scalar divisions (instead of x * (1/y)) +#8741d23430628 # Improved the matrix multiplication blocking in the case
where mr is not a power of 2 (e.g on Haswell CPUs) +878f629fe95c8 # Made the index type a template parameter to evaluateProductBlockingSizes.
Use numext::mini and numext::maxi instead of
std::min/std::max to compute blocking sizes. +8975d51a7f12c # Don't optimize the processing of the last rows of
a matrix matrix product in cases that violate
the assumptions made by the optimized code path. +8986136f4fdd4 # Remove the rotating kernel. +898e68e165a23 # Bug 256: enable vectorization with unaligned loads/stores. +91466e99ab6a1 # Relax mixing-type constraints for binary coeff-wise operators +91776236cdea4 # merge +917101ea26f5e # Include the cost of stores in unrolling +921672076db5d # Fix perf regression introduced in changeset e56aabf205 +9210fa9e4a15c # Fix perf regression in dgemm introduced by changeset 5d51a7f12c +936f6b3cf8de9 # 3.3-beta2 +944504a4404f1 # Optimize expression matching 'd?=a-b*c' as 'd?=a; d?=b*c;' +95877e27fbeee # 3.3-rc1 +959779774f98c # Bug 1311: fix alignment logic in some cases
of (scalar*small).lazyProduct(small) +9729f9d8d2f62 # Disabled part of the matrix matrix peeling code
that's incompatible with 512 bit registers +979eeac81b8c0 # 3.3.0 +989c927af60ed # Fix a performance regression in (mat*mat)*vec
for which mat*mat was evaluated multiple times. +994fe696022ec # Operators += and -= do not resize! +99466f65ccc36 # Ease compiler generating clean and efficient code in mat*vec +9946a5fe86098 # Complete rewrite of column-major-matrix * vector product
to deliver higher performance of modern CPU. +99591003f3b86 # Improve performance of row-major-dense-matrix * vector products
for recent CPUs. +997eb621413c1 # Revert vec/y to vec*(1/y) in row-major TRSM +10444bbc320468 # Bug 1435: fix aliasing issue in exressions like: A = C - B*A; +1073624df50945 # Adds missing EIGEN_STRONG_INLINE to support MSVC
properly inlining small vector calculations +1094d428a199ab # Bug 1562: optimize evaluation of small products
of the form s*A*B by rewriting them as: s*(A.lazyProduct(B))
to save a costly temporary.
Measured speedup from 2x to 5x. +1096de9e31a06d # Introduce the macro ei_declare_local_nested_eval to
help allocating on the stack local temporaries via alloca,
and let outer-products makes a good use of it. +11087b91c11207 # Bug 1578: Improve prefetching in matrix multiplication on MIPS. +1153aa110e681b # PR 526: Speed up multiplication of small, dynamically sized matrices +11544ad359237a # Vectorize row-by-row gebp loop iterations on 16 packets as well +1157a476054879 # Bug 1624: improve matrix-matrix product on ARM 64, 20% speedup +1160a4159dba08 # do not read buffers out of bounds +1163c53eececb0 # Implement AVX512 vectorization of std::complex +11644e7746fe22 # Bug 1636: fix gemm performance issue with gcc>=6 and no FMA +1164956678a4ef # Bug 1515: disable gebp's 3pX4 micro kernel
for MSVC<=19.14 because of register spilling. +1165426bce7529 # fix EIGEN_GEBP_2PX4_SPILLING_WORKAROUND
for non vectorized type, and non x86/64 target +11660d90637838 # enable spilling workaround on architectures with SSE/AVX +1166f159cf3d75 # Artificially increase l1-blocking size for AVX512.
+10% speedup with current kernels. +11686dd93f7e3b # Make code compile again for older compilers. +1175dbfcceabf5 # Bug: 1633: refactor gebp kernel and optimize for neon +117670e133333d # Bug 1661: fix regression in GEBP and AVX512 +11760f028f61cb # GEBP: cleanup logic to choose between
a 4 packets of 1 packet (=e118ce86fd+fix) +1180de77bf5d6c # gebp: Add new ½ and ¼ packet rows per (peeling) round on the lhs diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemm.cpp b/lib/eigen-3.4.0/bench/perf_monitoring/gemm.cpp new file mode 100644 index 0000000..804139d --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemm.cpp @@ -0,0 +1,12 @@ +#include "gemm_common.h" + +EIGEN_DONT_INLINE +void gemm(const Mat &A, const Mat &B, Mat &C) +{ + C.noalias() += A * B; +} + +int main(int argc, char **argv) +{ + return main_gemm(argc, argv, gemm); +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemm_common.h b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_common.h new file mode 100644 index 0000000..30dbc0d --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_common.h @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include "eigen_src/Eigen/Core" +#include "../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +typedef Matrix Mat; + +template +EIGEN_DONT_INLINE +double bench(long m, long n, long k, const Func& f) +{ + Mat A(m,k); + Mat B(k,n); + Mat C(m,n); + A.setRandom(); + B.setRandom(); + C.setZero(); + + BenchTimer t; + + double up = 1e8*4/sizeof(Scalar); + double tm0 = 4, tm1 = 10; + if(NumTraits::IsComplex) + { + up /= 4; + tm0 = 2; + tm1 = 4; + } + + double flops = 2. * m * n * k; + long rep = std::max(1., std::min(100., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, f(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +template +int main_gemm(int argc, char **argv, const Func& f) +{ + std::vector results; + + std::string filename = std::string("gemm_settings.txt"); + if(argc>1) + filename = std::string(argv[1]); + std::ifstream settings(filename); + long m, n, k; + while(settings >> m >> n >> k) + { + //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; + results.push_back( bench(m, n, k, f) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemm_settings.txt b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_settings.txt new file mode 100644 index 0000000..5c43e1c --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_settings.txt @@ -0,0 +1,15 @@ +8 8 8 +9 9 9 +24 24 24 +239 239 239 +240 240 240 +2400 24 24 +24 2400 24 +24 24 2400 +24 2400 2400 +2400 24 2400 +2400 2400 24 +2400 2400 64 +4800 23 160 +23 4800 160 +2400 2400 2400 diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemm_square_settings.txt b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_square_settings.txt new file mode 100644 index 0000000..98474d1 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemm_square_settings.txt @@ -0,0 +1,11 @@ +8 8 8 +9 9 9 +12 12 12 +15 15 15 +16 16 16 +24 24 24 +102 102 102 +239 239 239 +240 240 240 +2400 2400 2400 +2463 2463 2463 diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemv.cpp b/lib/eigen-3.4.0/bench/perf_monitoring/gemv.cpp new file mode 100644 index 0000000..82e5ab9 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemv.cpp @@ -0,0 +1,12 @@ +#include "gemv_common.h" + +EIGEN_DONT_INLINE +void gemv(const Mat &A, const Vec &B, Vec &C) +{ + C.noalias() += A * B; +} + +int main(int argc, char **argv) +{ + return main_gemv(argc, argv, gemv); +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemv_common.h b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_common.h new file mode 100644 index 0000000..cc32577 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_common.h @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include +#include "eigen_src/Eigen/Core" +#include "../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +typedef Matrix Mat; +typedef Matrix Vec; + +template +EIGEN_DONT_INLINE +double bench(long m, long n, Func &f) +{ + Mat A(m,n); + Vec B(n); + Vec C(m); + A.setRandom(); + B.setRandom(); + C.setRandom(); + + BenchTimer t; + + double up = 1e8/sizeof(Scalar); + double tm0 = 4, tm1 = 10; + if(NumTraits::IsComplex) + { + up /= 4; + tm0 = 2; + tm1 = 4; + } + + double flops = 2. * m * n; + long rep = std::max(1., std::min(100., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, f(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +template +int main_gemv(int argc, char **argv, Func& f) +{ + std::vector results; + + std::string filename = std::string("gemv_settings.txt"); + if(argc>1) + filename = std::string(argv[1]); + std::ifstream settings(filename); + long m, n; + while(settings >> m >> n) + { + //std::cerr << " Testing " << m << " " << n << std::endl; + results.push_back( bench(m, n, f) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemv_settings.txt b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_settings.txt new file mode 100644 index 0000000..21a5ee0 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_settings.txt @@ -0,0 +1,11 @@ +8 8 +9 9 +24 24 +239 239 +240 240 +2400 24 +24 2400 +24 240 +2400 2400 +4800 23 +23 4800 diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemv_square_settings.txt b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_square_settings.txt new file mode 100644 index 0000000..5165759 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemv_square_settings.txt @@ -0,0 +1,13 @@ +8 8 +9 9 +12 12 +15 15 +16 16 +24 24 +53 53 +74 74 +102 102 +239 239 +240 240 +2400 2400 +2463 2463 diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/gemvt.cpp b/lib/eigen-3.4.0/bench/perf_monitoring/gemvt.cpp new file mode 100644 index 0000000..fe94576 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/gemvt.cpp @@ -0,0 +1,12 @@ +#include "gemv_common.h" + +EIGEN_DONT_INLINE +void gemv(const Mat &A, Vec &B, const Vec &C) +{ + B.noalias() += A.transpose() * C; +} + +int main(int argc, char **argv) +{ + return main_gemv(argc, argv, gemv); +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm.cpp b/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm.cpp new file mode 100644 index 0000000..7733060 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include "../../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +template +EIGEN_DONT_INLINE +void lazy_gemm(const MatA &A, const MatB &B, MatC &C) +{ +// escape((void*)A.data()); +// escape((void*)B.data()); + C.noalias() += A.lazyProduct(B); +// escape((void*)C.data()); +} + +template +EIGEN_DONT_INLINE +double bench() +{ + typedef Matrix MatA; + typedef Matrix MatB; + typedef Matrix MatC; + + MatA A(m,k); + MatB B(k,n); + MatC C(m,n); + A.setRandom(); + B.setRandom(); + C.setZero(); + + BenchTimer t; + + double up = 1e7*4/sizeof(Scalar); + double tm0 = 10, tm1 = 20; + + double flops = 2. * m * n * k; + long rep = std::max(10., std::min(10000., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, lazy_gemm(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +template +double bench_t(int t) +{ + if(t) + return bench(); + else + return bench(); +} + +EIGEN_DONT_INLINE +double bench_mnk(int m, int n, int k, int t) +{ + int id = m*10000 + n*100 + k; + switch(id) { + case 10101 : return bench_t< 1, 1, 1>(t); break; + case 20202 : return bench_t< 2, 2, 2>(t); break; + case 30303 : return bench_t< 3, 3, 3>(t); break; + case 40404 : return bench_t< 4, 4, 4>(t); break; + case 50505 : return bench_t< 5, 5, 5>(t); break; + case 60606 : return bench_t< 6, 6, 6>(t); break; + case 70707 : return bench_t< 7, 7, 7>(t); break; + case 80808 : return bench_t< 8, 8, 8>(t); break; + case 90909 : return bench_t< 9, 9, 9>(t); break; + case 101010 : return bench_t<10,10,10>(t); break; + case 111111 : return bench_t<11,11,11>(t); break; + case 121212 : return bench_t<12,12,12>(t); break; + } + return 0; +} + +int main(int argc, char **argv) +{ + std::vector results; + + std::string filename = std::string("lazy_gemm_settings.txt"); + if(argc>1) + filename = std::string(argv[1]); + std::ifstream settings(filename); + long m, n, k, t; + while(settings >> m >> n >> k >> t) + { + //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; + results.push_back( bench_mnk(m, n, k, t) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm_settings.txt b/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm_settings.txt new file mode 100644 index 0000000..407d5d4 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/lazy_gemm_settings.txt @@ -0,0 +1,15 @@ +1 1 1 0 +2 2 2 0 +3 3 3 0 +4 4 4 0 +4 4 4 1 +5 5 5 0 +6 6 6 0 +7 7 7 0 +7 7 7 1 +8 8 8 0 +9 9 9 0 +10 10 10 0 +11 11 11 0 +12 12 12 0 +12 12 12 1 diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/llt.cpp b/lib/eigen-3.4.0/bench/perf_monitoring/llt.cpp new file mode 100644 index 0000000..d55b7d8 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/llt.cpp @@ -0,0 +1,15 @@ +#include "gemm_common.h" +#include + +EIGEN_DONT_INLINE +void llt(const Mat &A, const Mat &B, Mat &C) +{ + C = A; + C.diagonal().array() += 1000; + Eigen::internal::llt_inplace::blocked(C); +} + +int main(int argc, char **argv) +{ + return main_gemm(argc, argv, llt); +} diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/make_plot.sh b/lib/eigen-3.4.0/bench/perf_monitoring/make_plot.sh new file mode 100755 index 0000000..65aaf66 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/make_plot.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# base name of the bench +# it reads $1.out +# and generates $1.pdf +WHAT=$1 +bench=$2 +settings_file=$3 + +header="rev " +while read line +do + if [ ! -z '$line' ]; then + header="$header \"$line\"" + fi +done < $settings_file + +echo $header > $WHAT.out.header +cat $WHAT.out >> $WHAT.out.header + + +echo "set title '$WHAT'" > $WHAT.gnuplot +echo "set key autotitle columnhead outside " >> $WHAT.gnuplot +echo "set xtics rotate 1" >> $WHAT.gnuplot + +echo "set term pdf color rounded enhanced fontscale 0.35 size 7in,5in" >> $WHAT.gnuplot +echo set output "'"$WHAT.pdf"'" >> $WHAT.gnuplot + +col=`cat $settings_file | wc -l` +echo "plot for [col=2:$col+1] '$WHAT.out.header' using 0:col:xticlabels(1) with lines" >> $WHAT.gnuplot +echo " " >> $WHAT.gnuplot + +gnuplot -persist < $WHAT.gnuplot + +# generate a png file (thumbnail) +convert -colors 256 -background white -density 300 -resize 300 -quality 0 $WHAT.pdf -background white -flatten $WHAT.png + +# clean +rm $WHAT.out.header $WHAT.gnuplot + + +# generate html/svg graph + +echo " " > $WHAT.html +cat resources/chart_header.html > $WHAT.html +echo 'var customSettings = {"TITLE":"","SUBTITLE":"","XLABEL":"","YLABEL":""};' >> $WHAT.html +# 'data' is an array of datasets (i.e. curves), each of which is an object of the form +# { +# key: , +# color: , +# values: [{ +# r: , +# v: +# }] +# } +echo 'var data = [' >> $WHAT.html + +col=2 +while read line +do + if [ ! -z '$line' ]; then + header="$header \"$line\"" + echo '{"key":"'$line'","values":[' >> $WHAT.html + i=0 + while read line2 + do + if [ ! -z "$line2" ]; then + val=`echo $line2 | cut -s -f $col -d ' '` + if [ -n "$val" ]; then # skip build failures + echo '{"r":'$i',"v":'$val'},' >> $WHAT.html + fi + fi + ((i++)) + done < $WHAT.out + echo ']},' >> $WHAT.html + fi + ((col++)) +done < $settings_file +echo '];' >> $WHAT.html + +echo 'var changesets = [' >> $WHAT.html +while read line2 +do + if [ ! -z '$line2' ]; then + echo '"'`echo $line2 | cut -f 1 -d ' '`'",' >> $WHAT.html + fi +done < $WHAT.out +echo '];' >> $WHAT.html + +echo 'var changesets_details = [' >> $WHAT.html +while read line2 +do + if [ ! -z '$line2' ]; then + num=`echo "$line2" | cut -f 1 -d ' '` + comment=`grep ":$num" changesets.txt | cut -f 2 -d '#'` + echo '"'"$comment"'",' >> $WHAT.html + fi +done < $WHAT.out +echo '];' >> $WHAT.html + +echo 'var changesets_count = [' >> $WHAT.html +i=0 +while read line2 +do + if [ ! -z '$line2' ]; then + echo $i ',' >> $WHAT.html + fi + ((i++)) +done < $WHAT.out +echo '];' >> $WHAT.html + +cat resources/chart_footer.html >> $WHAT.html diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_footer.html b/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_footer.html new file mode 100644 index 0000000..a96cdb8 --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_footer.html @@ -0,0 +1,41 @@ + /* setup the chart and its options */ + var chart = nv.models.lineChart() + .color(d3.scale.category10().range()) + .margin({left: 75, bottom: 100}) + .forceX([0]).forceY([0]); + + chart.x(function(datum){ return datum.r; }) + .xAxis.options({ + axisLabel: customSettings.XLABEL || 'Changeset', + tickFormat: d3.format('.0f') + }); + chart.xAxis + .tickValues(changesets_count) + .tickFormat(function(d){return changesets[d]}) + .rotateLabels(-90); + + chart.y(function(datum){ return datum.v; }) + .yAxis.options({ + axisLabel: customSettings.YLABEL || 'GFlops'/*, + tickFormat: function(val){ return d3.format('.0f')(val) + ' GFlops'; }*/ + }); + + chart.tooltip.headerFormatter(function(d) { return changesets[d] + + '

' + + changesets_details[d] + "

"; }); + + //chart.useInteractiveGuideline(true); + d3.select('#chart').datum(data).call(chart); + var plot = d3.select('#chart > g'); + + /* setup the title */ + plot.append('text') + .style('font-size', '24px') + .attr('text-anchor', 'middle').attr('x', '50%').attr('y', '20px') + .text(customSettings.TITLE || ''); + + /* ensure the chart is responsive */ + nv.utils.windowResize(chart.update); + + + diff --git a/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_header.html b/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_header.html new file mode 100644 index 0000000..27eb02e --- /dev/null +++ b/lib/eigen-3.4.0/bench/perf_monitoring/resources/chart_header.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + +$treeview +$search +$mathjax + + + + + + + + +
Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+
$projectname +  $projectnumber +
+
$projectbrief
+
+
$projectbrief
+
$searchbox
+
+ + + diff --git a/lib/eigen-3.4.0/doc/eigendoxy_layout.xml.in b/lib/eigen-3.4.0/doc/eigendoxy_layout.xml.in new file mode 100644 index 0000000..c14b621 --- /dev/null +++ b/lib/eigen-3.4.0/doc/eigendoxy_layout.xml.in @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/eigen-3.4.0/doc/eigendoxy_tabs.css b/lib/eigen-3.4.0/doc/eigendoxy_tabs.css new file mode 100644 index 0000000..2192056 --- /dev/null +++ b/lib/eigen-3.4.0/doc/eigendoxy_tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.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; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.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; +} + +.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/lib/eigen-3.4.0/doc/examples/.krazy b/lib/eigen-3.4.0/doc/examples/.krazy new file mode 100644 index 0000000..00b9940 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/.krazy @@ -0,0 +1,2 @@ +EXCLUDE copyright +EXCLUDE license diff --git a/lib/eigen-3.4.0/doc/examples/CMakeLists.txt b/lib/eigen-3.4.0/doc/examples/CMakeLists.txt new file mode 100644 index 0000000..a2c9d05 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/CMakeLists.txt @@ -0,0 +1,20 @@ +file(GLOB examples_SRCS "*.cpp") + +foreach(example_src ${examples_SRCS}) + get_filename_component(example ${example_src} NAME_WE) + add_executable(${example} ${example_src}) + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + endif() + add_custom_command( + TARGET ${example} + POST_BUILD + COMMAND ${example} + ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out + ) + add_dependencies(all_examples ${example}) +endforeach() + +if(EIGEN_COMPILER_SUPPORT_CPP11) +ei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11") +endif() \ No newline at end of file diff --git a/lib/eigen-3.4.0/doc/examples/CustomizingEigen_Inheritance.cpp b/lib/eigen-3.4.0/doc/examples/CustomizingEigen_Inheritance.cpp new file mode 100644 index 0000000..48df64e --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/CustomizingEigen_Inheritance.cpp @@ -0,0 +1,30 @@ +#include +#include + +class MyVectorType : public Eigen::VectorXd +{ +public: + MyVectorType(void):Eigen::VectorXd() {} + + // This constructor allows you to construct MyVectorType from Eigen expressions + template + MyVectorType(const Eigen::MatrixBase& other) + : Eigen::VectorXd(other) + { } + + // This method allows you to assign Eigen expressions to MyVectorType + template + MyVectorType& operator=(const Eigen::MatrixBase & other) + { + this->Eigen::VectorXd::operator=(other); + return *this; + } +}; + +int main() +{ + MyVectorType v = MyVectorType::Ones(4); + v(2) += 10; + v = 2 * v; + std::cout << v.transpose() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Cwise_erf.cpp b/lib/eigen-3.4.0/doc/examples/Cwise_erf.cpp new file mode 100644 index 0000000..e7cd2c1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Cwise_erf.cpp @@ -0,0 +1,9 @@ +#include +#include +#include +using namespace Eigen; +int main() +{ + Array4d v(-0.5,2,0,-7); + std::cout << v.erf() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Cwise_erfc.cpp b/lib/eigen-3.4.0/doc/examples/Cwise_erfc.cpp new file mode 100644 index 0000000..d8bb04c --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Cwise_erfc.cpp @@ -0,0 +1,9 @@ +#include +#include +#include +using namespace Eigen; +int main() +{ + Array4d v(-0.5,2,0,-7); + std::cout << v.erfc() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Cwise_lgamma.cpp b/lib/eigen-3.4.0/doc/examples/Cwise_lgamma.cpp new file mode 100644 index 0000000..6bfaccb --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Cwise_lgamma.cpp @@ -0,0 +1,9 @@ +#include +#include +#include +using namespace Eigen; +int main() +{ + Array4d v(0.5,10,0,-1); + std::cout << v.lgamma() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/DenseBase_middleCols_int.cpp b/lib/eigen-3.4.0/doc/examples/DenseBase_middleCols_int.cpp new file mode 100644 index 0000000..0ebd955 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/DenseBase_middleCols_int.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main(void) +{ + int const N = 5; + MatrixXi A(N,N); + A.setRandom(); + cout << "A =\n" << A << '\n' << endl; + cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/DenseBase_middleRows_int.cpp b/lib/eigen-3.4.0/doc/examples/DenseBase_middleRows_int.cpp new file mode 100644 index 0000000..a6fe9e8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/DenseBase_middleRows_int.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main(void) +{ + int const N = 5; + MatrixXi A(N,N); + A.setRandom(); + cout << "A =\n" << A << '\n' << endl; + cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleCols.cpp b/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleCols.cpp new file mode 100644 index 0000000..6191d79 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleCols.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main(void) +{ + int const N = 5; + MatrixXi A(N,N); + A.setRandom(); + cout << "A =\n" << A << '\n' << endl; + cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleRows.cpp b/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleRows.cpp new file mode 100644 index 0000000..7e8b657 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/DenseBase_template_int_middleRows.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main(void) +{ + int const N = 5; + MatrixXi A(N,N); + A.setRandom(); + cout << "A =\n" << A << '\n' << endl; + cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/QuickStart_example.cpp b/lib/eigen-3.4.0/doc/examples/QuickStart_example.cpp new file mode 100644 index 0000000..7238c0c --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/QuickStart_example.cpp @@ -0,0 +1,14 @@ +#include +#include + +using Eigen::MatrixXd; + +int main() +{ + MatrixXd m(2,2); + m(0,0) = 3; + m(1,0) = 2.5; + m(0,1) = -1; + m(1,1) = m(1,0) + m(0,1); + std::cout << m << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp b/lib/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp new file mode 100644 index 0000000..ff6746e --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + MatrixXd m = MatrixXd::Random(3,3); + m = (m + MatrixXd::Constant(3,3,1.2)) * 50; + cout << "m =" << endl << m << endl; + VectorXd v(3); + v << 1, 2, 3; + cout << "m * v =" << endl << m * v << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/QuickStart_example2_fixed.cpp b/lib/eigen-3.4.0/doc/examples/QuickStart_example2_fixed.cpp new file mode 100644 index 0000000..d911752 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/QuickStart_example2_fixed.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + Matrix3d m = Matrix3d::Random(); + m = (m + Matrix3d::Constant(1.2)) * 50; + cout << "m =" << endl << m << endl; + Vector3d v(1,2,3); + + cout << "m * v =" << endl << m * v << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TemplateKeyword_flexible.cpp b/lib/eigen-3.4.0/doc/examples/TemplateKeyword_flexible.cpp new file mode 100644 index 0000000..9d85292 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TemplateKeyword_flexible.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace Eigen; + +template +void copyUpperTriangularPart(MatrixBase& dst, const MatrixBase& src) +{ + /* Note the 'template' keywords in the following line! */ + dst.template triangularView() = src.template triangularView(); +} + +int main() +{ + MatrixXi m1 = MatrixXi::Ones(5,5); + MatrixXi m2 = MatrixXi::Random(4,4); + std::cout << "m2 before copy:" << std::endl; + std::cout << m2 << std::endl << std::endl; + copyUpperTriangularPart(m2, m1.topLeftCorner(4,4)); + std::cout << "m2 after copy:" << std::endl; + std::cout << m2 << std::endl << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TemplateKeyword_simple.cpp b/lib/eigen-3.4.0/doc/examples/TemplateKeyword_simple.cpp new file mode 100644 index 0000000..6998c17 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TemplateKeyword_simple.cpp @@ -0,0 +1,20 @@ +#include +#include + +using namespace Eigen; + +void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src) +{ + dst.triangularView() = src.triangularView(); +} + +int main() +{ + MatrixXf m1 = MatrixXf::Ones(4,4); + MatrixXf m2 = MatrixXf::Random(4,4); + std::cout << "m2 before copy:" << std::endl; + std::cout << m2 << std::endl << std::endl; + copyUpperTriangularPart(m2, m1); + std::cout << "m2 after copy:" << std::endl; + std::cout << m2 << std::endl << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialInplaceLU.cpp b/lib/eigen-3.4.0/doc/examples/TutorialInplaceLU.cpp new file mode 100644 index 0000000..cb9c59b --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialInplaceLU.cpp @@ -0,0 +1,61 @@ +#include +struct init { + init() { std::cout << "[" << "init" << "]" << std::endl; } +}; +init init_obj; +// [init] +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + MatrixXd A(2,2); + A << 2, -1, 1, 3; + cout << "Here is the input matrix A before decomposition:\n" << A << endl; +cout << "[init]" << endl; + +cout << "[declaration]" << endl; + PartialPivLU > lu(A); + cout << "Here is the input matrix A after decomposition:\n" << A << endl; +cout << "[declaration]" << endl; + +cout << "[matrixLU]" << endl; + cout << "Here is the matrix storing the L and U factors:\n" << lu.matrixLU() << endl; +cout << "[matrixLU]" << endl; + +cout << "[solve]" << endl; + MatrixXd A0(2,2); A0 << 2, -1, 1, 3; + VectorXd b(2); b << 1, 2; + VectorXd x = lu.solve(b); + cout << "Residual: " << (A0 * x - b).norm() << endl; +cout << "[solve]" << endl; + +cout << "[modifyA]" << endl; + A << 3, 4, -2, 1; + x = lu.solve(b); + cout << "Residual: " << (A0 * x - b).norm() << endl; +cout << "[modifyA]" << endl; + +cout << "[recompute]" << endl; + A0 = A; // save A + lu.compute(A); + x = lu.solve(b); + cout << "Residual: " << (A0 * x - b).norm() << endl; +cout << "[recompute]" << endl; + +cout << "[recompute_bis0]" << endl; + MatrixXd A1(2,2); + A1 << 5,-2,3,4; + lu.compute(A1); + cout << "Here is the input matrix A1 after decomposition:\n" << A1 << endl; +cout << "[recompute_bis0]" << endl; + +cout << "[recompute_bis1]" << endl; + x = lu.solve(b); + cout << "Residual: " << (A1 * x - b).norm() << endl; +cout << "[recompute_bis1]" << endl; + +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgComputeTwice.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgComputeTwice.cpp new file mode 100644 index 0000000..06ba646 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgComputeTwice.cpp @@ -0,0 +1,23 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix2f A, b; + LLT llt; + A << 2, -1, -1, 3; + b << 1, 2, 3, 1; + cout << "Here is the matrix A:\n" << A << endl; + cout << "Here is the right hand side b:\n" << b << endl; + cout << "Computing LLT decomposition..." << endl; + llt.compute(A); + cout << "The solution is:\n" << llt.solve(b) << endl; + A(1,1)++; + cout << "The matrix A is now:\n" << A << endl; + cout << "Computing LLT decomposition..." << endl; + llt.compute(A); + cout << "The solution is now:\n" << llt.solve(b) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExComputeSolveError.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExComputeSolveError.cpp new file mode 100644 index 0000000..f362fb7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExComputeSolveError.cpp @@ -0,0 +1,14 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + MatrixXd A = MatrixXd::Random(100,100); + MatrixXd b = MatrixXd::Random(100,50); + MatrixXd x = A.fullPivLu().solve(b); + double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm + cout << "The relative error is:\n" << relative_error << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp new file mode 100644 index 0000000..3a99a94 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix3f A; + Vector3f b; + A << 1,2,3, 4,5,6, 7,8,10; + b << 3, 3, 4; + cout << "Here is the matrix A:\n" << A << endl; + cout << "Here is the vector b:\n" << b << endl; + Vector3f x = A.colPivHouseholderQr().solve(b); + cout << "The solution is:\n" << x << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveLDLT.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveLDLT.cpp new file mode 100644 index 0000000..f8beacd --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgExSolveLDLT.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix2f A, b; + A << 2, -1, -1, 3; + b << 1, 2, 3, 1; + cout << "Here is the matrix A:\n" << A << endl; + cout << "Here is the right hand side b:\n" << b << endl; + Matrix2f x = A.ldlt().solve(b); + cout << "The solution is:\n" << x << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgInverseDeterminant.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgInverseDeterminant.cpp new file mode 100644 index 0000000..14dde5b --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgInverseDeterminant.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix3f A; + A << 1, 2, 1, + 2, 1, 0, + -1, 1, 2; + cout << "Here is the matrix A:\n" << A << endl; + cout << "The determinant of A is " << A.determinant() << endl; + cout << "The inverse of A is:\n" << A.inverse() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgRankRevealing.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgRankRevealing.cpp new file mode 100644 index 0000000..c516507 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgRankRevealing.cpp @@ -0,0 +1,20 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix3f A; + A << 1, 2, 5, + 2, 1, 4, + 3, 0, 3; + cout << "Here is the matrix A:\n" << A << endl; + FullPivLU lu_decomp(A); + cout << "The rank of A is " << lu_decomp.rank() << endl; + cout << "Here is a matrix whose columns form a basis of the null-space of A:\n" + << lu_decomp.kernel() << endl; + cout << "Here is a matrix whose columns form a basis of the column-space of A:\n" + << lu_decomp.image(A) << endl; // yes, have to pass the original A +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp new file mode 100644 index 0000000..f109f04 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp @@ -0,0 +1,15 @@ +#include +#include + +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.bdcSvd(ComputeThinU | ComputeThinV).solve(b) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp new file mode 100644 index 0000000..8d1d1ed --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix2f A; + A << 1, 2, 2, 3; + cout << "Here is the matrix A:\n" << A << endl; + SelfAdjointEigenSolver eigensolver(A); + if (eigensolver.info() != Success) abort(); + cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl; + cout << "Here's a matrix whose columns are eigenvectors of A \n" + << "corresponding to these eigenvalues:\n" + << eigensolver.eigenvectors() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSetThreshold.cpp b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSetThreshold.cpp new file mode 100644 index 0000000..3956b13 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/TutorialLinAlgSetThreshold.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix2d A; + A << 2, 1, + 2, 0.9999999999; + FullPivLU lu(A); + cout << "By default, the rank of A is found to be " << lu.rank() << endl; + lu.setThreshold(1e-5); + cout << "With threshold 1e-5, the rank of A is found to be " << lu.rank() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_accessors.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_accessors.cpp new file mode 100644 index 0000000..dc720ff --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_accessors.cpp @@ -0,0 +1,24 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + ArrayXXf m(2,2); + + // assign some values coefficient by coefficient + m(0,0) = 1.0; m(0,1) = 2.0; + m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0); + + // print values to standard output + cout << m << endl << endl; + + // using the comma-initializer is also allowed + m << 1.0,2.0, + 3.0,4.0; + + // print values to standard output + cout << m << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_addition.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_addition.cpp new file mode 100644 index 0000000..480ffb0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_addition.cpp @@ -0,0 +1,23 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + ArrayXXf a(3,3); + ArrayXXf b(3,3); + a << 1,2,3, + 4,5,6, + 7,8,9; + b << 1,2,3, + 1,2,3, + 1,2,3; + + // Adding two arrays + cout << "a + b = " << endl << a + b << endl << endl; + + // Subtracting a scalar from an array + cout << "a - 2 = " << endl << a - 2 << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_cwise_other.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_cwise_other.cpp new file mode 100644 index 0000000..d9046c6 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_cwise_other.cpp @@ -0,0 +1,19 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + ArrayXf a = ArrayXf::Random(5); + a *= 2; + cout << "a =" << endl + << a << endl; + cout << "a.abs() =" << endl + << a.abs() << endl; + cout << "a.abs().sqrt() =" << endl + << a.abs().sqrt() << endl; + cout << "a.min(a.abs().sqrt()) =" << endl + << a.min(a.abs().sqrt()) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp new file mode 100644 index 0000000..371f070 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + MatrixXf m(2,2); + MatrixXf n(2,2); + MatrixXf result(2,2); + + m << 1,2, + 3,4; + n << 5,6, + 7,8; + + result = (m.array() + 4).matrix() * m; + cout << "-- Combination 1: --" << endl << result << endl << endl; + result = (m.array() * n.array()).matrix() * m; + cout << "-- Combination 2: --" << endl << result << endl << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp new file mode 100644 index 0000000..1014275 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp @@ -0,0 +1,26 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + MatrixXf m(2,2); + MatrixXf n(2,2); + MatrixXf result(2,2); + + m << 1,2, + 3,4; + n << 5,6, + 7,8; + + result = m * n; + cout << "-- Matrix m*n: --" << endl << result << endl << endl; + result = m.array() * n.array(); + cout << "-- Array m*n: --" << endl << result << endl << endl; + result = m.cwiseProduct(n); + cout << "-- With cwiseProduct: --" << endl << result << endl << endl; + result = m.array() + 4; + cout << "-- Array m + 4: --" << endl << result << endl << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_mult.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_mult.cpp new file mode 100644 index 0000000..6cb439f --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_mult.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + ArrayXXf a(2,2); + ArrayXXf b(2,2); + a << 1,2, + 3,4; + b << 5,6, + 7,8; + cout << "a * b = " << endl << a * b << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_block_assignment.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_block_assignment.cpp new file mode 100644 index 0000000..0b87313 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_block_assignment.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + 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 2x3 block:" << endl << a << endl << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_colrow.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_colrow.cpp new file mode 100644 index 0000000..2e7eb00 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_colrow.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace std; + +int main() +{ + Eigen::MatrixXf m(3,3); + m << 1,2,3, + 4,5,6, + 7,8,9; + 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/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp new file mode 100644 index 0000000..3a31507 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_corner.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace std; + +int main() +{ + Eigen::Matrix4f m; + m << 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10,11,12, + 13,14,15,16; + cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl; + cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << endl; + m.topLeftCorner(1,3) = m.bottomRightCorner(3,1).transpose(); + cout << "After assignment, m = " << endl << m << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_print_block.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_print_block.cpp new file mode 100644 index 0000000..edea4ae --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_print_block.cpp @@ -0,0 +1,20 @@ +#include +#include + +using namespace std; + +int main() +{ + Eigen::MatrixXf m(4,4); + m << 1, 2, 3, 4, + 5, 6, 7, 8, + 9,10,11,12, + 13,14,15,16; + cout << "Block in the middle" << endl; + cout << m.block<2,2>(1,1) << endl << endl; + for (int i = 1; i <= 3; ++i) + { + cout << "Block of size " << i << "x" << i << endl; + cout << m.block(0,0,i,i) << endl << endl; + } +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_vector.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_vector.cpp new file mode 100644 index 0000000..4a0b023 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_vector.cpp @@ -0,0 +1,14 @@ +#include +#include + +using namespace std; + +int main() +{ + Eigen::ArrayXf v(6); + v << 1, 2, 3, 4, 5, 6; + cout << "v.head(3) =" << endl << v.head(3) << endl << endl; + cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl; + v.segment(1,4) *= 2; + cout << "after 'v.segment(1,4) *= 2', v =" << endl << v << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_PartialLU_solve.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_PartialLU_solve.cpp new file mode 100644 index 0000000..a560879 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_PartialLU_solve.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Matrix3f A; + Vector3f b; + A << 1,2,3, 4,5,6, 7,8,10; + b << 3, 3, 4; + cout << "Here is the matrix A:" << endl << A << endl; + cout << "Here is the vector b:" << endl << b << endl; + Vector3f x = A.lu().solve(b); + cout << "The solution is:" << endl << x << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp new file mode 100644 index 0000000..334b4d8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp @@ -0,0 +1,24 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Eigen::MatrixXf m(2,4); + Eigen::VectorXf v(2); + + m << 1, 23, 6, 9, + 3, 11, 7, 2; + + v << 2, + 3; + + MatrixXf::Index index; + // find nearest neighbour + (m.colwise() - v).colwise().squaredNorm().minCoeff(&index); + + cout << "Nearest neighbour is column " << index << ":" << endl; + cout << m.col(index) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp new file mode 100644 index 0000000..e6c87c6 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace std; +int main() +{ + Eigen::MatrixXf mat(2,4); + Eigen::VectorXf v(2); + + mat << 1, 2, 6, 9, + 3, 1, 7, 2; + + v << 0, + 1; + + //add v to each column of m + mat.colwise() += v; + + std::cout << "Broadcasting result: " << std::endl; + std::cout << mat << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp new file mode 100644 index 0000000..d87c96a --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp @@ -0,0 +1,20 @@ +#include +#include + +using namespace std; +int main() +{ + Eigen::MatrixXf mat(2,4); + Eigen::VectorXf v(4); + + mat << 1, 2, 6, 9, + 3, 1, 7, 2; + + v << 0,1,2,3; + + //add v to each row of m + mat.rowwise() += v.transpose(); + + std::cout << "Broadcasting result: " << std::endl; + std::cout << mat << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp new file mode 100644 index 0000000..df68256 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp @@ -0,0 +1,13 @@ +#include +#include + +using namespace std; +int main() +{ + Eigen::MatrixXf mat(2,4); + mat << 1, 2, 6, 9, + 3, 1, 7, 2; + + std::cout << "Column's maximum: " << std::endl + << mat.colwise().maxCoeff() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp new file mode 100644 index 0000000..049c747 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp @@ -0,0 +1,20 @@ +#include +#include + +using namespace std; +using namespace Eigen; +int main() +{ + MatrixXf mat(2,4); + mat << 1, 2, 6, 9, + 3, 1, 7, 2; + + MatrixXf::Index maxIndex; + float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex); + + std::cout << "Maximum sum at position " << maxIndex << std::endl; + + std::cout << "The corresponding vector is: " << std::endl; + std::cout << mat.col( maxIndex ) << std::endl; + std::cout << "And its sum is is: " << maxNorm << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp new file mode 100644 index 0000000..0cca37f --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + ArrayXXf a(2,2); + + a << 1,2, + 3,4; + + cout << "(a > 0).all() = " << (a > 0).all() << endl; + cout << "(a > 0).any() = " << (a > 0).any() << endl; + cout << "(a > 0).count() = " << (a > 0).count() << endl; + cout << endl; + cout << "(a > 2).all() = " << (a > 2).all() << endl; + cout << "(a > 2).any() = " << (a > 2).any() << endl; + cout << "(a > 2).count() = " << (a > 2).count() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp new file mode 100644 index 0000000..740439f --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp @@ -0,0 +1,28 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + VectorXf v(2); + MatrixXf m(2,2), n(2,2); + + v << -1, + 2; + + m << 1,-2, + -3,4; + + cout << "v.squaredNorm() = " << v.squaredNorm() << endl; + cout << "v.norm() = " << v.norm() << endl; + cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << endl; + cout << "v.lpNorm() = " << v.lpNorm() << endl; + + cout << endl; + cout << "m.squaredNorm() = " << m.squaredNorm() << endl; + cout << "m.norm() = " << m.norm() << endl; + cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << endl; + cout << "m.lpNorm() = " << m.lpNorm() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp new file mode 100644 index 0000000..62e28fc --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace Eigen; +using namespace std; + +int main() +{ + MatrixXf m(2,2); + m << 1,-2, + -3,4; + + cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff() + << " == " << m.colwise().lpNorm<1>().maxCoeff() << endl; + + cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff() + << " == " << m.rowwise().lpNorm<1>().maxCoeff() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp new file mode 100644 index 0000000..80427c9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp @@ -0,0 +1,13 @@ +#include +#include + +using namespace std; +int main() +{ + Eigen::MatrixXf mat(2,4); + mat << 1, 2, 6, 9, + 3, 1, 7, 2; + + std::cout << "Row's maximum: " << std::endl + << mat.rowwise().maxCoeff() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp new file mode 100644 index 0000000..b54e9aa --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp @@ -0,0 +1,26 @@ +#include +#include + +using namespace std; +using namespace Eigen; + +int main() +{ + Eigen::MatrixXf m(2,2); + + m << 1, 2, + 3, 4; + + //get location of maximum + MatrixXf::Index maxRow, maxCol; + float max = m.maxCoeff(&maxRow, &maxCol); + + //get location of minimum + MatrixXf::Index minRow, minCol; + float min = m.minCoeff(&minRow, &minCol); + + cout << "Max: " << max << ", at: " << + maxRow << "," << maxCol << endl; + cout << "Min: " << min << ", at: " << + minRow << "," << minCol << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/Tutorial_simple_example_dynamic_size.cpp b/lib/eigen-3.4.0/doc/examples/Tutorial_simple_example_dynamic_size.cpp new file mode 100644 index 0000000..defcb1e --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/Tutorial_simple_example_dynamic_size.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + for (int size=1; size<=4; ++size) + { + MatrixXi m(size,size+1); // a (size)x(size+1)-matrix of int's + for (int j=0; j +#include + +using namespace Eigen; + +int main() +{ + Matrix3f m3; + m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; + Matrix4f m4 = Matrix4f::Identity(); + Vector4i v4(1, 2, 3, 4); + + std::cout << "m3\n" << m3 << "\nm4:\n" + << m4 << "\nv4:\n" << v4 << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_Block.cpp b/lib/eigen-3.4.0/doc/examples/class_Block.cpp new file mode 100644 index 0000000..ace719a --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_Block.cpp @@ -0,0 +1,27 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::Block +topLeftCorner(MatrixBase& m, int rows, int cols) +{ + return Eigen::Block(m.derived(), 0, 0, rows, cols); +} + +template +const Eigen::Block +topLeftCorner(const MatrixBase& m, int rows, int cols) +{ + return Eigen::Block(m.derived(), 0, 0, rows, cols); +} + +int main(int, char**) +{ + Matrix4d m = Matrix4d::Identity(); + cout << topLeftCorner(4*m, 2, 3) << endl; // calls the const version + topLeftCorner(m, 2, 3) *= 5; // calls the non-const version + cout << "Now the matrix m is:" << endl << m << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_CwiseBinaryOp.cpp b/lib/eigen-3.4.0/doc/examples/class_CwiseBinaryOp.cpp new file mode 100644 index 0000000..682af46 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_CwiseBinaryOp.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace Eigen; +using namespace std; + +// define a custom template binary functor +template struct MakeComplexOp { + EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp) + typedef complex result_type; + complex operator()(const Scalar& a, const Scalar& b) const { return complex(a,b); } +}; + +int main(int, char**) +{ + Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random(); + cout << m1.binaryExpr(m2, MakeComplexOp()) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp.cpp b/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp.cpp new file mode 100644 index 0000000..a5fcc15 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp.cpp @@ -0,0 +1,19 @@ +#include +#include +using namespace Eigen; +using namespace std; + +// define a custom template unary functor +template +struct CwiseClampOp { + CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {} + const Scalar operator()(const Scalar& x) const { return xm_sup ? m_sup : x); } + Scalar m_inf, m_sup; +}; + +int main(int, char**) +{ + Matrix4d m1 = Matrix4d::Random(); + cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp(-0.5,0.5)) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp b/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp new file mode 100644 index 0000000..36706d8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp @@ -0,0 +1,20 @@ +#include +#include +using namespace Eigen; +using namespace std; + +// define function to be applied coefficient-wise +double ramp(double x) +{ + if (x > 0) + return x; + else + return 0; +} + +int main(int, char**) +{ + Matrix4d m1 = Matrix4d::Random(); + cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(ptr_fun(ramp)) << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_FixedBlock.cpp b/lib/eigen-3.4.0/doc/examples/class_FixedBlock.cpp new file mode 100644 index 0000000..9978b32 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_FixedBlock.cpp @@ -0,0 +1,27 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::Block +topLeft2x2Corner(MatrixBase& m) +{ + return Eigen::Block(m.derived(), 0, 0); +} + +template +const Eigen::Block +topLeft2x2Corner(const MatrixBase& m) +{ + return Eigen::Block(m.derived(), 0, 0); +} + +int main(int, char**) +{ + Matrix3d m = Matrix3d::Identity(); + cout << topLeft2x2Corner(4*m) << endl; // calls the const version + topLeft2x2Corner(m) *= 2; // calls the non-const version + cout << "Now the matrix m is:" << endl << m << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_FixedReshaped.cpp b/lib/eigen-3.4.0/doc/examples/class_FixedReshaped.cpp new file mode 100644 index 0000000..b6d4085 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_FixedReshaped.cpp @@ -0,0 +1,22 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::Reshaped +reshape_helper(MatrixBase& m) +{ + return Eigen::Reshaped(m.derived()); +} + +int main(int, char**) +{ + MatrixXd m(2, 4); + m << 1, 2, 3, 4, + 5, 6, 7, 8; + MatrixXd n = reshape_helper(m); + cout << "matrix m is:" << endl << m << endl; + cout << "matrix n is:" << endl << n << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_FixedVectorBlock.cpp b/lib/eigen-3.4.0/doc/examples/class_FixedVectorBlock.cpp new file mode 100644 index 0000000..c88c9fb --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_FixedVectorBlock.cpp @@ -0,0 +1,27 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::VectorBlock +firstTwo(MatrixBase& v) +{ + return Eigen::VectorBlock(v.derived(), 0); +} + +template +const Eigen::VectorBlock +firstTwo(const MatrixBase& v) +{ + return Eigen::VectorBlock(v.derived(), 0); +} + +int main(int, char**) +{ + Matrix v; v << 1,2,3,4,5,6; + cout << firstTwo(4*v) << endl; // calls the const version + firstTwo(v) *= 2; // calls the non-const version + cout << "Now the vector v is:" << endl << v << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_Reshaped.cpp b/lib/eigen-3.4.0/doc/examples/class_Reshaped.cpp new file mode 100644 index 0000000..18fb454 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_Reshaped.cpp @@ -0,0 +1,23 @@ +#include +#include +using namespace std; +using namespace Eigen; + +template +const Reshaped +reshape_helper(const MatrixBase& m, int rows, int cols) +{ + return Reshaped(m.derived(), rows, cols); +} + +int main(int, char**) +{ + MatrixXd m(3, 4); + m << 1, 4, 7, 10, + 2, 5, 8, 11, + 3, 6, 9, 12; + cout << m << endl; + Ref n = reshape_helper(m, 2, 6); + cout << "Matrix m is:" << endl << m << endl; + cout << "Matrix n is:" << endl << n << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/class_VectorBlock.cpp b/lib/eigen-3.4.0/doc/examples/class_VectorBlock.cpp new file mode 100644 index 0000000..dc213df --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/class_VectorBlock.cpp @@ -0,0 +1,27 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::VectorBlock +segmentFromRange(MatrixBase& v, int start, int end) +{ + return Eigen::VectorBlock(v.derived(), start, end-start); +} + +template +const Eigen::VectorBlock +segmentFromRange(const MatrixBase& v, int start, int end) +{ + return Eigen::VectorBlock(v.derived(), start, end-start); +} + +int main(int, char**) +{ + Matrix v; v << 1,2,3,4,5,6; + cout << segmentFromRange(2*v, 2, 4) << endl; // calls the const version + segmentFromRange(v, 1, 3) *= 5; // calls the non-const version + cout << "Now the vector v is:" << endl << v << endl; + return 0; +} diff --git a/lib/eigen-3.4.0/doc/examples/function_taking_eigenbase.cpp b/lib/eigen-3.4.0/doc/examples/function_taking_eigenbase.cpp new file mode 100644 index 0000000..49d94b3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/function_taking_eigenbase.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace Eigen; + +template +void print_size(const EigenBase& b) +{ + std::cout << "size (rows, cols): " << b.size() << " (" << b.rows() + << ", " << b.cols() << ")" << std::endl; +} + +int main() +{ + Vector3f v; + print_size(v); + // v.asDiagonal() returns a 3x3 diagonal matrix pseudo-expression + print_size(v.asDiagonal()); +} diff --git a/lib/eigen-3.4.0/doc/examples/function_taking_ref.cpp b/lib/eigen-3.4.0/doc/examples/function_taking_ref.cpp new file mode 100644 index 0000000..162a202 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/function_taking_ref.cpp @@ -0,0 +1,19 @@ +#include +#include +using namespace Eigen; +using namespace std; + +float inv_cond(const Ref& a) +{ + const VectorXf sing_vals = a.jacobiSvd().singularValues(); + return sing_vals(sing_vals.size()-1) / sing_vals(0); +} + +int main() +{ + Matrix4f m = Matrix4f::Random(); + cout << "matrix m:" << endl << m << endl << endl; + cout << "inv_cond(m): " << inv_cond(m) << endl; + cout << "inv_cond(m(1:3,1:3)): " << inv_cond(m.topLeftCorner(3,3)) << endl; + cout << "inv_cond(m+I): " << inv_cond(m+Matrix4f::Identity()) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp new file mode 100644 index 0000000..92e6aaa --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp @@ -0,0 +1,11 @@ +/* +This program is presented in several fragments in the doc page. +Every fragment is in its own file; this file simply combines them. +*/ + +#include "make_circulant.cpp.preamble" +#include "make_circulant.cpp.traits" +#include "make_circulant.cpp.expression" +#include "make_circulant.cpp.evaluator" +#include "make_circulant.cpp.entry" +#include "make_circulant.cpp.main" diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.entry b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.entry new file mode 100644 index 0000000..f9d2eb8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.entry @@ -0,0 +1,5 @@ +template +Circulant makeCirculant(const Eigen::MatrixBase& arg) +{ + return Circulant(arg.derived()); +} diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.evaluator b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.evaluator new file mode 100644 index 0000000..2ba79e7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.evaluator @@ -0,0 +1,32 @@ +namespace Eigen { + namespace internal { + template + struct evaluator > + : evaluator_base > + { + typedef Circulant XprType; + typedef typename nested_eval::type ArgTypeNested; + typedef typename remove_all::type ArgTypeNestedCleaned; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = Eigen::ColMajor + }; + + evaluator(const XprType& xpr) + : m_argImpl(xpr.m_arg), m_rows(xpr.rows()) + { } + + CoeffReturnType coeff(Index row, Index col) const + { + Index index = row - col; + if (index < 0) index += m_rows; + return m_argImpl.coeff(index); + } + + evaluator m_argImpl; + const Index m_rows; + }; + } +} diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.expression b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.expression new file mode 100644 index 0000000..380cd44 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.expression @@ -0,0 +1,20 @@ +template +class Circulant : public Eigen::MatrixBase > +{ +public: + Circulant(const ArgType& arg) + : m_arg(arg) + { + EIGEN_STATIC_ASSERT(ArgType::ColsAtCompileTime == 1, + YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX); + } + + typedef typename Eigen::internal::ref_selector::type Nested; + + typedef Eigen::Index Index; + Index rows() const { return m_arg.rows(); } + Index cols() const { return m_arg.rows(); } + + typedef typename Eigen::internal::ref_selector::type ArgTypeNested; + ArgTypeNested m_arg; +}; diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.main b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.main new file mode 100644 index 0000000..877f97f --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.main @@ -0,0 +1,8 @@ +int main() +{ + Eigen::VectorXd vec(4); + vec << 1, 2, 4, 8; + Eigen::MatrixXd mat; + mat = makeCirculant(vec); + std::cout << mat << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.preamble b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.preamble new file mode 100644 index 0000000..e575cce --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.preamble @@ -0,0 +1,4 @@ +#include +#include + +template class Circulant; diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.traits b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.traits new file mode 100644 index 0000000..4e04535 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant.cpp.traits @@ -0,0 +1,19 @@ +namespace Eigen { + namespace internal { + template + struct traits > + { + typedef Eigen::Dense StorageKind; + typedef Eigen::MatrixXpr XprKind; + typedef typename ArgType::StorageIndex StorageIndex; + typedef typename ArgType::Scalar Scalar; + enum { + Flags = Eigen::ColMajor, + RowsAtCompileTime = ArgType::RowsAtCompileTime, + ColsAtCompileTime = ArgType::RowsAtCompileTime, + MaxRowsAtCompileTime = ArgType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = ArgType::MaxRowsAtCompileTime + }; + }; + } +} diff --git a/lib/eigen-3.4.0/doc/examples/make_circulant2.cpp b/lib/eigen-3.4.0/doc/examples/make_circulant2.cpp new file mode 100644 index 0000000..95d3dd3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/make_circulant2.cpp @@ -0,0 +1,52 @@ +#include +#include + +using namespace Eigen; + +// [circulant_func] +template +class circulant_functor { + const ArgType &m_vec; +public: + circulant_functor(const ArgType& arg) : m_vec(arg) {} + + const typename ArgType::Scalar& operator() (Index row, Index col) const { + Index index = row - col; + if (index < 0) index += m_vec.size(); + return m_vec(index); + } +}; +// [circulant_func] + +// [square] +template +struct circulant_helper { + typedef Matrix MatrixType; +}; +// [square] + +// [makeCirculant] +template +CwiseNullaryOp, typename circulant_helper::MatrixType> +makeCirculant(const Eigen::MatrixBase& arg) +{ + typedef typename circulant_helper::MatrixType MatrixType; + return MatrixType::NullaryExpr(arg.size(), arg.size(), circulant_functor(arg.derived())); +} +// [makeCirculant] + +// [main] +int main() +{ + Eigen::VectorXd vec(4); + vec << 1, 2, 4, 8; + Eigen::MatrixXd mat; + mat = makeCirculant(vec); + std::cout << mat << std::endl; +} +// [main] diff --git a/lib/eigen-3.4.0/doc/examples/matrixfree_cg.cpp b/lib/eigen-3.4.0/doc/examples/matrixfree_cg.cpp new file mode 100644 index 0000000..7469938 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/matrixfree_cg.cpp @@ -0,0 +1,129 @@ +#include +#include +#include +#include +#include + +class MatrixReplacement; +using Eigen::SparseMatrix; + +namespace Eigen { +namespace internal { + // MatrixReplacement looks-like a SparseMatrix, so let's inherits its traits: + template<> + struct traits : public Eigen::internal::traits > + {}; +} +} + +// Example of a matrix-free wrapper from a user type to Eigen's compatible type +// For the sake of simplicity, this example simply wrap a Eigen::SparseMatrix. +class MatrixReplacement : public Eigen::EigenBase { +public: + // Required typedefs, constants, and method: + typedef double Scalar; + typedef double RealScalar; + typedef int StorageIndex; + enum { + ColsAtCompileTime = Eigen::Dynamic, + MaxColsAtCompileTime = Eigen::Dynamic, + IsRowMajor = false + }; + + Index rows() const { return mp_mat->rows(); } + Index cols() const { return mp_mat->cols(); } + + template + Eigen::Product operator*(const Eigen::MatrixBase& x) const { + return Eigen::Product(*this, x.derived()); + } + + // Custom API: + MatrixReplacement() : mp_mat(0) {} + + void attachMyMatrix(const SparseMatrix &mat) { + mp_mat = &mat; + } + const SparseMatrix my_matrix() const { return *mp_mat; } + +private: + const SparseMatrix *mp_mat; +}; + + +// Implementation of MatrixReplacement * Eigen::DenseVector though a specialization of internal::generic_product_impl: +namespace Eigen { +namespace internal { + + template + struct generic_product_impl // GEMV stands for matrix-vector + : generic_product_impl_base > + { + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const MatrixReplacement& lhs, const Rhs& rhs, const Scalar& alpha) + { + // This method should implement "dst += alpha * lhs * rhs" inplace, + // however, for iterative solvers, alpha is always equal to 1, so let's not bother about it. + assert(alpha==Scalar(1) && "scaling is not implemented"); + EIGEN_ONLY_USED_FOR_DEBUG(alpha); + + // Here we could simply call dst.noalias() += lhs.my_matrix() * rhs, + // but let's do something fancier (and less efficient): + for(Index i=0; i S = Eigen::MatrixXd::Random(n,n).sparseView(0.5,1); + S = S.transpose()*S; + + MatrixReplacement A; + A.attachMyMatrix(S); + + Eigen::VectorXd b(n), x; + b.setRandom(); + + // Solve Ax = b using various iterative solver with matrix-free version: + { + Eigen::ConjugateGradient cg; + cg.compute(A); + x = cg.solve(b); + std::cout << "CG: #iterations: " << cg.iterations() << ", estimated error: " << cg.error() << std::endl; + } + + { + Eigen::BiCGSTAB bicg; + bicg.compute(A); + x = bicg.solve(b); + std::cout << "BiCGSTAB: #iterations: " << bicg.iterations() << ", estimated error: " << bicg.error() << std::endl; + } + + { + Eigen::GMRES gmres; + gmres.compute(A); + x = gmres.solve(b); + std::cout << "GMRES: #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl; + } + + { + Eigen::DGMRES gmres; + gmres.compute(A); + x = gmres.solve(b); + std::cout << "DGMRES: #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl; + } + + { + Eigen::MINRES minres; + minres.compute(A); + x = minres.solve(b); + std::cout << "MINRES: #iterations: " << minres.iterations() << ", estimated error: " << minres.error() << std::endl; + } +} diff --git a/lib/eigen-3.4.0/doc/examples/nullary_indexing.cpp b/lib/eigen-3.4.0/doc/examples/nullary_indexing.cpp new file mode 100644 index 0000000..b74db5f --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/nullary_indexing.cpp @@ -0,0 +1,66 @@ +#include +#include + +using namespace Eigen; + +// [functor] +template +class indexing_functor { + const ArgType &m_arg; + const RowIndexType &m_rowIndices; + const ColIndexType &m_colIndices; +public: + typedef Matrix MatrixType; + + indexing_functor(const ArgType& arg, const RowIndexType& row_indices, const ColIndexType& col_indices) + : m_arg(arg), m_rowIndices(row_indices), m_colIndices(col_indices) + {} + + const typename ArgType::Scalar& operator() (Index row, Index col) const { + return m_arg(m_rowIndices[row], m_colIndices[col]); + } +}; +// [functor] + +// [function] +template +CwiseNullaryOp, typename indexing_functor::MatrixType> +mat_indexing(const Eigen::MatrixBase& arg, const RowIndexType& row_indices, const ColIndexType& col_indices) +{ + typedef indexing_functor Func; + typedef typename Func::MatrixType MatrixType; + return MatrixType::NullaryExpr(row_indices.size(), col_indices.size(), Func(arg.derived(), row_indices, col_indices)); +} +// [function] + + +int main() +{ + std::cout << "[main1]\n"; + Eigen::MatrixXi A = Eigen::MatrixXi::Random(4,4); + Array3i ri(1,2,1); + ArrayXi ci(6); ci << 3,2,1,0,0,2; + Eigen::MatrixXi B = mat_indexing(A, ri, ci); + std::cout << "A =" << std::endl; + std::cout << A << std::endl << std::endl; + std::cout << "A([" << ri.transpose() << "], [" << ci.transpose() << "]) =" << std::endl; + std::cout << B << std::endl; + std::cout << "[main1]\n"; + + std::cout << "[main2]\n"; + B = mat_indexing(A, ri+1, ci); + std::cout << "A(ri+1,ci) =" << std::endl; + std::cout << B << std::endl << std::endl; +#if EIGEN_COMP_CXXVER >= 11 + B = mat_indexing(A, ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)); + std::cout << "A(ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)) =" << std::endl; + std::cout << B << std::endl << std::endl; +#endif + std::cout << "[main2]\n"; +} + diff --git a/lib/eigen-3.4.0/doc/examples/tut_arithmetic_add_sub.cpp b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_add_sub.cpp new file mode 100644 index 0000000..e97477b --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_add_sub.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + Matrix2d a; + a << 1, 2, + 3, 4; + MatrixXd b(2,2); + b << 2, 3, + 1, 4; + std::cout << "a + b =\n" << a + b << std::endl; + std::cout << "a - b =\n" << a - b << std::endl; + std::cout << "Doing a += b;" << std::endl; + a += b; + std::cout << "Now a =\n" << a << std::endl; + Vector3d v(1,2,3); + Vector3d w(1,0,0); + std::cout << "-v + w - v =\n" << -v + w - v << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_arithmetic_dot_cross.cpp b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_dot_cross.cpp new file mode 100644 index 0000000..631c9a5 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_dot_cross.cpp @@ -0,0 +1,15 @@ +#include +#include + +using namespace Eigen; +using namespace std; +int main() +{ + Vector3d v(1,2,3); + Vector3d w(0,1,2); + + cout << "Dot product: " << v.dot(w) << endl; + double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar + cout << "Dot product via a matrix product: " << dp << endl; + cout << "Cross product:\n" << v.cross(w) << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_arithmetic_matrix_mul.cpp b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_matrix_mul.cpp new file mode 100644 index 0000000..f213902 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_matrix_mul.cpp @@ -0,0 +1,19 @@ +#include +#include + +using namespace Eigen; +int main() +{ + Matrix2d mat; + mat << 1, 2, + 3, 4; + Vector2d u(-1,1), v(2,0); + std::cout << "Here is mat*mat:\n" << mat*mat << std::endl; + std::cout << "Here is mat*u:\n" << mat*u << std::endl; + std::cout << "Here is u^T*mat:\n" << u.transpose()*mat << std::endl; + std::cout << "Here is u^T*v:\n" << u.transpose()*v << std::endl; + std::cout << "Here is u*v^T:\n" << u*v.transpose() << std::endl; + std::cout << "Let's multiply mat by itself" << std::endl; + mat = mat*mat; + std::cout << "Now mat is mat:\n" << mat << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp new file mode 100644 index 0000000..5632fb5 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; +int main() +{ + Eigen::Matrix2d mat; + mat << 1, 2, + 3, 4; + cout << "Here is mat.sum(): " << mat.sum() << endl; + cout << "Here is mat.prod(): " << mat.prod() << endl; + cout << "Here is mat.mean(): " << mat.mean() << endl; + cout << "Here is mat.minCoeff(): " << mat.minCoeff() << endl; + cout << "Here is mat.maxCoeff(): " << mat.maxCoeff() << endl; + cout << "Here is mat.trace(): " << mat.trace() << endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_arithmetic_scalar_mul_div.cpp b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_scalar_mul_div.cpp new file mode 100644 index 0000000..d5f65b5 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_arithmetic_scalar_mul_div.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + Matrix2d a; + a << 1, 2, + 3, 4; + Vector3d v(1,2,3); + std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl; + std::cout << "0.1 * v =\n" << 0.1 * v << std::endl; + std::cout << "Doing v *= 2;" << std::endl; + v *= 2; + std::cout << "Now v =\n" << v << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_matrix_coefficient_accessors.cpp b/lib/eigen-3.4.0/doc/examples/tut_matrix_coefficient_accessors.cpp new file mode 100644 index 0000000..c2da171 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_matrix_coefficient_accessors.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + MatrixXd m(2,2); + m(0,0) = 3; + m(1,0) = 2.5; + m(0,1) = -1; + m(1,1) = m(1,0) + m(0,1); + std::cout << "Here is the matrix m:\n" << m << std::endl; + VectorXd v(2); + v(0) = 4; + v(1) = v(0) - 1; + std::cout << "Here is the vector v:\n" << v << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_matrix_resize.cpp b/lib/eigen-3.4.0/doc/examples/tut_matrix_resize.cpp new file mode 100644 index 0000000..0392c3a --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_matrix_resize.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + MatrixXd m(2,5); + m.resize(4,3); + std::cout << "The matrix m is of size " + << m.rows() << "x" << m.cols() << std::endl; + std::cout << "It has " << m.size() << " coefficients" << std::endl; + VectorXd v(2); + v.resize(5); + std::cout << "The vector v is of size " << v.size() << std::endl; + std::cout << "As a matrix, v is of size " + << v.rows() << "x" << v.cols() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/examples/tut_matrix_resize_fixed_size.cpp b/lib/eigen-3.4.0/doc/examples/tut_matrix_resize_fixed_size.cpp new file mode 100644 index 0000000..dcbdfa7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/examples/tut_matrix_resize_fixed_size.cpp @@ -0,0 +1,12 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + Matrix4d m; + m.resize(4,4); // no operation + std::cout << "The matrix m is of size " + << m.rows() << "x" << m.cols() << std::endl; +} diff --git a/lib/eigen-3.4.0/doc/ftv2node.png b/lib/eigen-3.4.0/doc/ftv2node.png new file mode 100644 index 0000000000000000000000000000000000000000..63c605bb4c3d941c921a4b6cfa74951e946bcb48 GIT binary patch literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%QnH>djv*C{Z|`mdau^P8_z}#X h?B8GEpdi4(BFDx$je&7RrDQEg&ePS;Wt~$(69Dh@6T1Ka literal 0 HcmV?d00001 diff --git a/lib/eigen-3.4.0/doc/ftv2pnode.png b/lib/eigen-3.4.0/doc/ftv2pnode.png new file mode 100644 index 0000000000000000000000000000000000000000..c6ee22f937a07d1dbfc27c669d11f8ed13e2f152 GIT binary patch literal 229 zcmV^P)R?RzRoKvklcaQ%HF6%rK2&ZgO(-ihJ_C zzrKgp4jgO( fd_(yg|3PpEQb#9`a?Pz_00000NkvXXu0mjftR`5K literal 0 HcmV?d00001 diff --git a/lib/eigen-3.4.0/doc/snippets/.krazy b/lib/eigen-3.4.0/doc/snippets/.krazy new file mode 100644 index 0000000..00b9940 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/.krazy @@ -0,0 +1,2 @@ +EXCLUDE copyright +EXCLUDE license diff --git a/lib/eigen-3.4.0/doc/snippets/AngleAxis_mimic_euler.cpp b/lib/eigen-3.4.0/doc/snippets/AngleAxis_mimic_euler.cpp new file mode 100644 index 0000000..456de7f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/AngleAxis_mimic_euler.cpp @@ -0,0 +1,5 @@ +Matrix3f m; +m = AngleAxisf(0.25*M_PI, Vector3f::UnitX()) + * AngleAxisf(0.5*M_PI, Vector3f::UnitY()) + * AngleAxisf(0.33*M_PI, Vector3f::UnitZ()); +cout << m << endl << "is unitary: " << m.isUnitary() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_23_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_23_cxx11.cpp new file mode 100644 index 0000000..2c2166e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_23_cxx11.cpp @@ -0,0 +1,5 @@ +ArrayXXi a { + {1, 2, 3}, + {3, 4, 5} +}; +cout << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_vector_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_vector_cxx11.cpp new file mode 100644 index 0000000..a668d84 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Array_initializer_list_vector_cxx11.cpp @@ -0,0 +1,2 @@ +Array v {{1, 2, 3, 4, 5}}; +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Array_variadic_ctor_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Array_variadic_ctor_cxx11.cpp new file mode 100644 index 0000000..0e4ec44 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Array_variadic_ctor_cxx11.cpp @@ -0,0 +1,3 @@ +Array a(1, 2, 3, 4, 5, 6); +Array b {1, 2, 3}; +cout << a << "\n\n" << b << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_simple.cpp b/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_simple.cpp new file mode 100644 index 0000000..8c8829f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_simple.cpp @@ -0,0 +1,11 @@ + int n = 10000; + VectorXd x(n), b(n); + SparseMatrix A(n,n); + /* ... fill A and b ... */ + BiCGSTAB > solver; + solver.compute(A); + x = solver.solve(b); + std::cout << "#iterations: " << solver.iterations() << std::endl; + std::cout << "estimated error: " << solver.error() << std::endl; + /* ... update b ... */ + x = solver.solve(b); // solve again diff --git a/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_step_by_step.cpp b/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_step_by_step.cpp new file mode 100644 index 0000000..6c95d5a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/BiCGSTAB_step_by_step.cpp @@ -0,0 +1,14 @@ + int n = 10000; + VectorXd x(n), b(n); + SparseMatrix A(n,n); + /* ... fill A and b ... */ + BiCGSTAB > solver(A); + // start from a random solution + x = VectorXd::Random(n); + solver.setMaxIterations(1); + int i = 0; + do { + x = solver.solveWithGuess(b,x); + std::cout << i << " : " << solver.error() << std::endl; + ++i; + } while (solver.info()!=Success && i<100); diff --git a/lib/eigen-3.4.0/doc/snippets/CMakeLists.txt b/lib/eigen-3.4.0/doc/snippets/CMakeLists.txt new file mode 100644 index 0000000..65f195a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/CMakeLists.txt @@ -0,0 +1,36 @@ +file(GLOB snippets_SRCS "*.cpp") + +add_custom_target(all_snippets) + +foreach(snippet_src ${snippets_SRCS}) + get_filename_component(snippet ${snippet_src} NAME_WE) + set(compile_snippet_target compile_${snippet}) + set(compile_snippet_src ${compile_snippet_target}.cpp) + if((NOT ${snippet_src} MATCHES "cxx11") OR EIGEN_COMPILER_SUPPORT_CPP11) + file(READ ${snippet_src} snippet_source_code) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) + add_executable(${compile_snippet_target} + ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + endif() + if(${snippet_src} MATCHES "cxx11") + set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11") + endif() + if(${snippet_src} MATCHES "deprecated") + set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-DEIGEN_NO_DEPRECATED_WARNING") + endif() + add_custom_command( + TARGET ${compile_snippet_target} + POST_BUILD + COMMAND ${compile_snippet_target} + ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out + ) + add_dependencies(all_snippets ${compile_snippet_target}) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src} + PROPERTIES OBJECT_DEPENDS ${snippet_src}) + else() + message("skip snippet ${snippet_src} because compiler does not support C++11") + endif() +endforeach() diff --git a/lib/eigen-3.4.0/doc/snippets/ColPivHouseholderQR_solve.cpp b/lib/eigen-3.4.0/doc/snippets/ColPivHouseholderQR_solve.cpp new file mode 100644 index 0000000..b7b204a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ColPivHouseholderQR_solve.cpp @@ -0,0 +1,8 @@ +Matrix3f m = Matrix3f::Random(); +Matrix3f y = Matrix3f::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the matrix y:" << endl << y << endl; +Matrix3f x; +x = m.colPivHouseholderQr().solve(y); +assert(y.isApprox(m*x)); +cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_compute.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_compute.cpp new file mode 100644 index 0000000..11d6bd3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_compute.cpp @@ -0,0 +1,16 @@ +MatrixXcf A = MatrixXcf::Random(4,4); +cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; + +ComplexEigenSolver ces; +ces.compute(A); +cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl; +cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl; + +complex lambda = ces.eigenvalues()[0]; +cout << "Consider the first eigenvalue, lambda = " << lambda << endl; +VectorXcf v = ces.eigenvectors().col(0); +cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; +cout << "... and A * v = " << endl << A * v << endl << endl; + +cout << "Finally, V * D * V^(-1) = " << endl + << ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvalues.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvalues.cpp new file mode 100644 index 0000000..5509bd8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvalues.cpp @@ -0,0 +1,4 @@ +MatrixXcf ones = MatrixXcf::Ones(3,3); +ComplexEigenSolver ces(ones, /* computeEigenvectors = */ false); +cout << "The eigenvalues of the 3x3 matrix of ones are:" + << endl << ces.eigenvalues() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvectors.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvectors.cpp new file mode 100644 index 0000000..adeed9a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexEigenSolver_eigenvectors.cpp @@ -0,0 +1,4 @@ +MatrixXcf ones = MatrixXcf::Ones(3,3); +ComplexEigenSolver ces(ones); +cout << "The first eigenvector of the 3x3 matrix of ones is:" + << endl << ces.eigenvectors().col(0) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexSchur_compute.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_compute.cpp new file mode 100644 index 0000000..3a51701 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_compute.cpp @@ -0,0 +1,6 @@ +MatrixXcf A = MatrixXcf::Random(4,4); +ComplexSchur schur(4); +schur.compute(A); +cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; +schur.compute(A.inverse()); +cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixT.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixT.cpp new file mode 100644 index 0000000..8380571 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixT.cpp @@ -0,0 +1,4 @@ +MatrixXcf A = MatrixXcf::Random(4,4); +cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; +ComplexSchur schurOfA(A, false); // false means do not compute U +cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixU.cpp b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixU.cpp new file mode 100644 index 0000000..ba3d9c2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/ComplexSchur_matrixU.cpp @@ -0,0 +1,4 @@ +MatrixXcf A = MatrixXcf::Random(4,4); +cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; +ComplexSchur schurOfA(A); +cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_abs.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_abs.cpp new file mode 100644 index 0000000..0aeec3a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_abs.cpp @@ -0,0 +1,2 @@ +Array3d v(1,-2,-3); +cout << v.abs() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_abs2.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_abs2.cpp new file mode 100644 index 0000000..2c4f9b3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_abs2.cpp @@ -0,0 +1,2 @@ +Array3d v(1,-2,-3); +cout << v.abs2() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_acos.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_acos.cpp new file mode 100644 index 0000000..34432cb --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_acos.cpp @@ -0,0 +1,2 @@ +Array3d v(0, sqrt(2.)/2, 1); +cout << v.acos() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_arg.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_arg.cpp new file mode 100644 index 0000000..3f45133 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_arg.cpp @@ -0,0 +1,3 @@ +ArrayXcf v = ArrayXcf::Random(3); +cout << v << endl << endl; +cout << arg(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_array_power_array.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_array_power_array.cpp new file mode 100644 index 0000000..432a76e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_array_power_array.cpp @@ -0,0 +1,4 @@ +Array x(8,25,3), + e(1./3.,0.5,2.); +cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow +cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_asin.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_asin.cpp new file mode 100644 index 0000000..8dad838 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_asin.cpp @@ -0,0 +1,2 @@ +Array3d v(0, sqrt(2.)/2, 1); +cout << v.asin() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_atan.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_atan.cpp new file mode 100644 index 0000000..4468447 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_atan.cpp @@ -0,0 +1,2 @@ +ArrayXd v = ArrayXd::LinSpaced(5,0,1); +cout << v.atan() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_boolean_and.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_boolean_and.cpp new file mode 100644 index 0000000..df6b60d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_boolean_and.cpp @@ -0,0 +1,2 @@ +Array3d v(-1,2,1), w(-3,2,3); +cout << ((vw) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_greater_equal.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_greater_equal.cpp new file mode 100644 index 0000000..6a08f89 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_greater_equal.cpp @@ -0,0 +1,2 @@ +Array3d v(1,2,3), w(3,2,1); +cout << (v>=w) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_inverse.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_inverse.cpp new file mode 100644 index 0000000..3967a7e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_inverse.cpp @@ -0,0 +1,2 @@ +Array3d v(2,3,4); +cout << v.inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_isFinite.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_isFinite.cpp new file mode 100644 index 0000000..1da55fd --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_isFinite.cpp @@ -0,0 +1,5 @@ +Array3d v(1,2,3); +v(1) *= 0.0/0.0; +v(2) /= 0.0; +cout << v << endl << endl; +cout << isfinite(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_isInf.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_isInf.cpp new file mode 100644 index 0000000..be79308 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_isInf.cpp @@ -0,0 +1,5 @@ +Array3d v(1,2,3); +v(1) *= 0.0/0.0; +v(2) /= 0.0; +cout << v << endl << endl; +cout << isinf(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_isNaN.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_isNaN.cpp new file mode 100644 index 0000000..7b2a930 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_isNaN.cpp @@ -0,0 +1,5 @@ +Array3d v(1,2,3); +v(1) *= 0.0/0.0; +v(2) /= 0.0; +cout << v << endl << endl; +cout << isnan(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_less.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_less.cpp new file mode 100644 index 0000000..cafd3b6 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_less.cpp @@ -0,0 +1,2 @@ +Array3d v(1,2,3), w(3,2,1); +cout << (v e(2,-3,1./3.); +cout << "10^[" << e << "] = " << pow(10,e) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_sign.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_sign.cpp new file mode 100644 index 0000000..49920e4 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_sign.cpp @@ -0,0 +1,2 @@ +Array3d v(-3,5,0); +cout << v.sign() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_sin.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_sin.cpp new file mode 100644 index 0000000..46fa908 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_sin.cpp @@ -0,0 +1,2 @@ +Array3d v(M_PI, M_PI/2, M_PI/3); +cout << v.sin() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_sinh.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_sinh.cpp new file mode 100644 index 0000000..fac9b19 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_sinh.cpp @@ -0,0 +1,2 @@ +ArrayXd v = ArrayXd::LinSpaced(5,0,1); +cout << sinh(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_slash_equal.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_slash_equal.cpp new file mode 100644 index 0000000..2efd32d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_slash_equal.cpp @@ -0,0 +1,3 @@ +Array3d v(3,2,4), w(5,4,2); +v /= w; +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_sqrt.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_sqrt.cpp new file mode 100644 index 0000000..97bafe8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_sqrt.cpp @@ -0,0 +1,2 @@ +Array3d v(1,2,4); +cout << v.sqrt() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_square.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_square.cpp new file mode 100644 index 0000000..f704c5e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_square.cpp @@ -0,0 +1,2 @@ +Array3d v(2,3,4); +cout << v.square() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_tan.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_tan.cpp new file mode 100644 index 0000000..b758ef0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_tan.cpp @@ -0,0 +1,2 @@ +Array3d v(M_PI, M_PI/2, M_PI/3); +cout << v.tan() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_tanh.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_tanh.cpp new file mode 100644 index 0000000..30cd045 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_tanh.cpp @@ -0,0 +1,2 @@ +ArrayXd v = ArrayXd::LinSpaced(5,0,1); +cout << tanh(v) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Cwise_times_equal.cpp b/lib/eigen-3.4.0/doc/snippets/Cwise_times_equal.cpp new file mode 100644 index 0000000..147556c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Cwise_times_equal.cpp @@ -0,0 +1,3 @@ +Array3d v(1,2,3), w(2,3,0); +v *= w; +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced.cpp b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced.cpp new file mode 100644 index 0000000..8e54b17 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced.cpp @@ -0,0 +1,2 @@ +cout << VectorXi::LinSpaced(4,7,10).transpose() << endl; +cout << VectorXd::LinSpaced(5,0.0,1.0).transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpacedInt.cpp b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpacedInt.cpp new file mode 100644 index 0000000..0d7ae06 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpacedInt.cpp @@ -0,0 +1,8 @@ +cout << "Even spacing inputs:" << endl; +cout << VectorXi::LinSpaced(8,1,4).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,8).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,15).transpose() << endl; +cout << "Uneven spacing inputs:" << endl; +cout << VectorXi::LinSpaced(8,1,7).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,9).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,16).transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced_seq_deprecated.cpp b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced_seq_deprecated.cpp new file mode 100644 index 0000000..f55c508 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DenseBase_LinSpaced_seq_deprecated.cpp @@ -0,0 +1,2 @@ +cout << VectorXi::LinSpaced(Sequential,4,7,10).transpose() << endl; +cout << VectorXd::LinSpaced(Sequential,5,0.0,1.0).transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DenseBase_setLinSpaced.cpp b/lib/eigen-3.4.0/doc/snippets/DenseBase_setLinSpaced.cpp new file mode 100644 index 0000000..46054f2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DenseBase_setLinSpaced.cpp @@ -0,0 +1,3 @@ +VectorXf v; +v.setLinSpaced(5,0.5f,1.5f); +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DirectionWise_hnormalized.cpp b/lib/eigen-3.4.0/doc/snippets/DirectionWise_hnormalized.cpp new file mode 100644 index 0000000..2451f6e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DirectionWise_hnormalized.cpp @@ -0,0 +1,6 @@ +Matrix4Xd M = Matrix4Xd::Random(4,5); +Projective3d P(Matrix4d::Random()); +cout << "The matrix M is:" << endl << M << endl << endl; +cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl; +cout << "P*M:" << endl << P*M << endl << endl; +cout << "(P*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate.cpp b/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate.cpp new file mode 100644 index 0000000..d92d4a3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate.cpp @@ -0,0 +1,4 @@ +MatrixXi m = MatrixXi::Random(2,3); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "m.colwise().replicate<3>() = ..." << endl; +cout << m.colwise().replicate<3>() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate_int.cpp b/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate_int.cpp new file mode 100644 index 0000000..f9b1b53 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/DirectionWise_replicate_int.cpp @@ -0,0 +1,4 @@ +Vector3i v = Vector3i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "v.rowwise().replicate(5) = ..." << endl; +cout << v.rowwise().replicate(5) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp b/lib/eigen-3.4.0/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp new file mode 100644 index 0000000..c1d9fa8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp @@ -0,0 +1,16 @@ +MatrixXd A = MatrixXd::Random(6,6); +cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; + +EigenSolver es(A); +cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; +cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; + +complex lambda = es.eigenvalues()[0]; +cout << "Consider the first eigenvalue, lambda = " << lambda << endl; +VectorXcd v = es.eigenvectors().col(0); +cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; +cout << "... and A * v = " << endl << A.cast >() * v << endl << endl; + +MatrixXcd D = es.eigenvalues().asDiagonal(); +MatrixXcd V = es.eigenvectors(); +cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/EigenSolver_compute.cpp b/lib/eigen-3.4.0/doc/snippets/EigenSolver_compute.cpp new file mode 100644 index 0000000..a5c96e9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/EigenSolver_compute.cpp @@ -0,0 +1,6 @@ +EigenSolver es; +MatrixXf A = MatrixXf::Random(4,4); +es.compute(A, /* computeEigenvectors = */ false); +cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; +es.compute(A + MatrixXf::Identity(4,4), false); // re-use es to compute eigenvalues of A+I +cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvalues.cpp b/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvalues.cpp new file mode 100644 index 0000000..ed28869 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvalues.cpp @@ -0,0 +1,4 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +EigenSolver es(ones, false); +cout << "The eigenvalues of the 3x3 matrix of ones are:" + << endl << es.eigenvalues() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvectors.cpp b/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvectors.cpp new file mode 100644 index 0000000..8355f76 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/EigenSolver_eigenvectors.cpp @@ -0,0 +1,4 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +EigenSolver es(ones); +cout << "The first eigenvector of the 3x3 matrix of ones is:" + << endl << es.eigenvectors().col(0) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/EigenSolver_pseudoEigenvectors.cpp b/lib/eigen-3.4.0/doc/snippets/EigenSolver_pseudoEigenvectors.cpp new file mode 100644 index 0000000..85e2569 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/EigenSolver_pseudoEigenvectors.cpp @@ -0,0 +1,9 @@ +MatrixXd A = MatrixXd::Random(6,6); +cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; + +EigenSolver es(A); +MatrixXd D = es.pseudoEigenvalueMatrix(); +MatrixXd V = es.pseudoEigenvectors(); +cout << "The pseudo-eigenvalue matrix D is:" << endl << D << endl; +cout << "The pseudo-eigenvector matrix V is:" << endl << V << endl; +cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/FullPivHouseholderQR_solve.cpp b/lib/eigen-3.4.0/doc/snippets/FullPivHouseholderQR_solve.cpp new file mode 100644 index 0000000..23bc074 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/FullPivHouseholderQR_solve.cpp @@ -0,0 +1,8 @@ +Matrix3f m = Matrix3f::Random(); +Matrix3f y = Matrix3f::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the matrix y:" << endl << y << endl; +Matrix3f x; +x = m.fullPivHouseholderQr().solve(y); +assert(y.isApprox(m*x)); +cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/FullPivLU_image.cpp b/lib/eigen-3.4.0/doc/snippets/FullPivLU_image.cpp new file mode 100644 index 0000000..817bc1e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/FullPivLU_image.cpp @@ -0,0 +1,9 @@ +Matrix3d m; +m << 1,1,0, + 1,3,2, + 0,1,1; +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Notice that the middle column is the sum of the two others, so the " + << "columns are linearly dependent." << endl; +cout << "Here is a matrix whose columns have the same span but are linearly independent:" + << endl << m.fullPivLu().image(m) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/FullPivLU_kernel.cpp b/lib/eigen-3.4.0/doc/snippets/FullPivLU_kernel.cpp new file mode 100644 index 0000000..7086e01 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/FullPivLU_kernel.cpp @@ -0,0 +1,7 @@ +MatrixXf m = MatrixXf::Random(3,5); +cout << "Here is the matrix m:" << endl << m << endl; +MatrixXf ker = m.fullPivLu().kernel(); +cout << "Here is a matrix whose columns form a basis of the kernel of m:" + << endl << ker << endl; +cout << "By definition of the kernel, m*ker is zero:" + << endl << m*ker << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/FullPivLU_solve.cpp b/lib/eigen-3.4.0/doc/snippets/FullPivLU_solve.cpp new file mode 100644 index 0000000..c1f8823 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/FullPivLU_solve.cpp @@ -0,0 +1,11 @@ +Matrix m = Matrix::Random(); +Matrix2f y = Matrix2f::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the matrix y:" << endl << y << endl; +Matrix x = m.fullPivLu().solve(y); +if((m*x).isApprox(y)) +{ + cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; +} +else + cout << "The equation mx=y does not have any solution." << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/GeneralizedEigenSolver.cpp b/lib/eigen-3.4.0/doc/snippets/GeneralizedEigenSolver.cpp new file mode 100644 index 0000000..2acda45 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/GeneralizedEigenSolver.cpp @@ -0,0 +1,7 @@ +GeneralizedEigenSolver ges; +MatrixXf A = MatrixXf::Random(4,4); +MatrixXf B = MatrixXf::Random(4,4); +ges.compute(A, B); +cout << "The (complex) numerators of the generalzied eigenvalues are: " << ges.alphas().transpose() << endl; +cout << "The (real) denominatore of the generalzied eigenvalues are: " << ges.betas().transpose() << endl; +cout << "The (complex) generalzied eigenvalues are (alphas./beta): " << ges.eigenvalues().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_compute.cpp b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_compute.cpp new file mode 100644 index 0000000..50e3783 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_compute.cpp @@ -0,0 +1,6 @@ +MatrixXcf A = MatrixXcf::Random(4,4); +HessenbergDecomposition hd(4); +hd.compute(A); +cout << "The matrix H in the decomposition of A is:" << endl << hd.matrixH() << endl; +hd.compute(2*A); // re-use hd to compute and store decomposition of 2A +cout << "The matrix H in the decomposition of 2A is:" << endl << hd.matrixH() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_matrixH.cpp b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_matrixH.cpp new file mode 100644 index 0000000..af01366 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_matrixH.cpp @@ -0,0 +1,8 @@ +Matrix4f A = MatrixXf::Random(4,4); +cout << "Here is a random 4x4 matrix:" << endl << A << endl; +HessenbergDecomposition hessOfA(A); +MatrixXf H = hessOfA.matrixH(); +cout << "The Hessenberg matrix H is:" << endl << H << endl; +MatrixXf Q = hessOfA.matrixQ(); +cout << "The orthogonal matrix Q is:" << endl << Q << endl; +cout << "Q H Q^T is:" << endl << Q * H * Q.transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_packedMatrix.cpp b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_packedMatrix.cpp new file mode 100644 index 0000000..4fa5957 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HessenbergDecomposition_packedMatrix.cpp @@ -0,0 +1,9 @@ +Matrix4d A = Matrix4d::Random(4,4); +cout << "Here is a random 4x4 matrix:" << endl << A << endl; +HessenbergDecomposition hessOfA(A); +Matrix4d pm = hessOfA.packedMatrix(); +cout << "The packed matrix M is:" << endl << pm << endl; +cout << "The upper Hessenberg part corresponds to the matrix H, which is:" + << endl << hessOfA.matrixH() << endl; +Vector3d hc = hessOfA.householderCoefficients(); +cout << "The vector of Householder coefficients is:" << endl << hc << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/HouseholderQR_householderQ.cpp b/lib/eigen-3.4.0/doc/snippets/HouseholderQR_householderQ.cpp new file mode 100644 index 0000000..e859ce5 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HouseholderQR_householderQ.cpp @@ -0,0 +1,7 @@ +MatrixXf A(MatrixXf::Random(5,3)), thinQ(MatrixXf::Identity(5,3)), Q; +A.setRandom(); +HouseholderQR qr(A); +Q = qr.householderQ(); +thinQ = qr.householderQ() * thinQ; +std::cout << "The complete unitary matrix Q is:\n" << Q << "\n\n"; +std::cout << "The thin matrix Q is:\n" << thinQ << "\n\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/HouseholderQR_solve.cpp b/lib/eigen-3.4.0/doc/snippets/HouseholderQR_solve.cpp new file mode 100644 index 0000000..8cce6ce --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HouseholderQR_solve.cpp @@ -0,0 +1,9 @@ +typedef Matrix Matrix3x3; +Matrix3x3 m = Matrix3x3::Random(); +Matrix3f y = Matrix3f::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the matrix y:" << endl << y << endl; +Matrix3f x; +x = m.householderQr().solve(y); +assert(y.isApprox(m*x)); +cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/HouseholderSequence_HouseholderSequence.cpp b/lib/eigen-3.4.0/doc/snippets/HouseholderSequence_HouseholderSequence.cpp new file mode 100644 index 0000000..2632b83 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/HouseholderSequence_HouseholderSequence.cpp @@ -0,0 +1,31 @@ +Matrix3d v = Matrix3d::Random(); +cout << "The matrix v is:" << endl; +cout << v << endl; + +Vector3d v0(1, v(1,0), v(2,0)); +cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl; +Vector3d v1(0, 1, v(2,1)); +cout << "The second Householder vector is: v_1 = " << v1.transpose() << endl; +Vector3d v2(0, 0, 1); +cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl; + +Vector3d h = Vector3d::Random(); +cout << "The Householder coefficients are: h = " << h.transpose() << endl; + +Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint(); +cout << "The first Householder reflection is represented by H_0 = " << endl; +cout << H0 << endl; +Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint(); +cout << "The second Householder reflection is represented by H_1 = " << endl; +cout << H1 << endl; +Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint(); +cout << "The third Householder reflection is represented by H_2 = " << endl; +cout << H2 << endl; +cout << "Their product is H_0 H_1 H_2 = " << endl; +cout << H0 * H1 * H2 << endl; + +HouseholderSequence hhSeq(v, h); +Matrix3d hhSeqAsMatrix(hhSeq); +cout << "If we construct a HouseholderSequence from v and h" << endl; +cout << "and convert it to a matrix, we get:" << endl; +cout << hhSeqAsMatrix << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/IOFormat.cpp b/lib/eigen-3.4.0/doc/snippets/IOFormat.cpp new file mode 100644 index 0000000..735f5dd --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/IOFormat.cpp @@ -0,0 +1,14 @@ +std::string sep = "\n----------------------------------------\n"; +Matrix3d m1; +m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9; + +IOFormat CommaInitFmt(StreamPrecision, DontAlignCols, ", ", ", ", "", "", " << ", ";"); +IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]"); +IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]"); +IOFormat HeavyFmt(FullPrecision, 0, ", ", ";\n", "[", "]", "[", "]"); + +std::cout << m1 << sep; +std::cout << m1.format(CommaInitFmt) << sep; +std::cout << m1.format(CleanFmt) << sep; +std::cout << m1.format(OctaveFmt) << sep; +std::cout << m1.format(HeavyFmt) << sep; diff --git a/lib/eigen-3.4.0/doc/snippets/JacobiSVD_basic.cpp b/lib/eigen-3.4.0/doc/snippets/JacobiSVD_basic.cpp new file mode 100644 index 0000000..ab24b9b --- /dev/null +++ b/lib/eigen-3.4.0/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 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/lib/eigen-3.4.0/doc/snippets/Jacobi_makeGivens.cpp b/lib/eigen-3.4.0/doc/snippets/Jacobi_makeGivens.cpp new file mode 100644 index 0000000..6f8ec05 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Jacobi_makeGivens.cpp @@ -0,0 +1,6 @@ +Vector2f v = Vector2f::Random(); +JacobiRotation G; +G.makeGivens(v.x(), v.y()); +cout << "Here is the vector v:" << endl << v << endl; +v.applyOnTheLeft(0, 1, G.adjoint()); +cout << "Here is the vector J' * v:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Jacobi_makeJacobi.cpp b/lib/eigen-3.4.0/doc/snippets/Jacobi_makeJacobi.cpp new file mode 100644 index 0000000..a86e80a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Jacobi_makeJacobi.cpp @@ -0,0 +1,8 @@ +Matrix2f m = Matrix2f::Random(); +m = (m + m.adjoint()).eval(); +JacobiRotation J; +J.makeJacobi(m, 0, 1); +cout << "Here is the matrix m:" << endl << m << endl; +m.applyOnTheLeft(0, 1, J.adjoint()); +m.applyOnTheRight(0, 1, J); +cout << "Here is the matrix J' * m * J:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/LLT_example.cpp b/lib/eigen-3.4.0/doc/snippets/LLT_example.cpp new file mode 100644 index 0000000..46fb407 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/LLT_example.cpp @@ -0,0 +1,12 @@ +MatrixXd A(3,3); +A << 4,-1,2, -1,6,0, 2,0,5; +cout << "The matrix A is" << endl << A << endl; + +LLT lltOfA(A); // compute the Cholesky decomposition of A +MatrixXd L = lltOfA.matrixL(); // retrieve factor L in the decomposition +// The previous two lines can also be written as "L = A.llt().matrixL()" + +cout << "The Cholesky factor L is" << endl << L << endl; +cout << "To check this, let us compute L * L.transpose()" << endl; +cout << L * L.transpose() << endl; +cout << "This should equal the matrix A" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/LLT_solve.cpp b/lib/eigen-3.4.0/doc/snippets/LLT_solve.cpp new file mode 100644 index 0000000..7095d2c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/LLT_solve.cpp @@ -0,0 +1,8 @@ +typedef Matrix DataMatrix; +// let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise) +DataMatrix samples = DataMatrix::Random(12,2); +VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1; +// and let's solve samples * [x y]^T = elevations in least square sense: +Matrix xy + = (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations)); +cout << xy << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/LeastSquaresNormalEquations.cpp b/lib/eigen-3.4.0/doc/snippets/LeastSquaresNormalEquations.cpp new file mode 100644 index 0000000..997cf17 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/LeastSquaresNormalEquations.cpp @@ -0,0 +1,4 @@ +MatrixXf A = MatrixXf::Random(3, 2); +VectorXf b = VectorXf::Random(3); +cout << "The solution using normal equations is:\n" + << (A.transpose() * A).ldlt().solve(A.transpose() * b) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/LeastSquaresQR.cpp b/lib/eigen-3.4.0/doc/snippets/LeastSquaresQR.cpp new file mode 100644 index 0000000..6c97045 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/LeastSquaresQR.cpp @@ -0,0 +1,4 @@ +MatrixXf A = MatrixXf::Random(3, 2); +VectorXf b = VectorXf::Random(3); +cout << "The solution using the QR decomposition is:\n" + << A.colPivHouseholderQr().solve(b) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Map_general_stride.cpp b/lib/eigen-3.4.0/doc/snippets/Map_general_stride.cpp new file mode 100644 index 0000000..0657e7f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Map_general_stride.cpp @@ -0,0 +1,5 @@ +int array[24]; +for(int i = 0; i < 24; ++i) array[i] = i; +cout << Map > + (array, 3, 3, Stride(8, 2)) + << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Map_inner_stride.cpp b/lib/eigen-3.4.0/doc/snippets/Map_inner_stride.cpp new file mode 100644 index 0000000..d95ae9b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Map_inner_stride.cpp @@ -0,0 +1,5 @@ +int array[12]; +for(int i = 0; i < 12; ++i) array[i] = i; +cout << Map > + (array, 6) // the inner stride has already been passed as template parameter + << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Map_outer_stride.cpp b/lib/eigen-3.4.0/doc/snippets/Map_outer_stride.cpp new file mode 100644 index 0000000..2f6f052 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Map_outer_stride.cpp @@ -0,0 +1,3 @@ +int array[12]; +for(int i = 0; i < 12; ++i) array[i] = i; +cout << Map >(array, 3, 3, OuterStride<>(4)) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Map_placement_new.cpp b/lib/eigen-3.4.0/doc/snippets/Map_placement_new.cpp new file mode 100644 index 0000000..83b83a8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Map_placement_new.cpp @@ -0,0 +1,5 @@ +int data[] = {1,2,3,4,5,6,7,8,9}; +Map v(data,4); +cout << "The mapped vector v is: " << v << "\n"; +new (&v) Map(data+4,5); +cout << "Now v is: " << v << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Map_simple.cpp b/lib/eigen-3.4.0/doc/snippets/Map_simple.cpp new file mode 100644 index 0000000..423bb52 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Map_simple.cpp @@ -0,0 +1,3 @@ +int array[9]; +for(int i = 0; i < 9; ++i) array[i] = i; +cout << Map(array) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_adjoint.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_adjoint.cpp new file mode 100644 index 0000000..4680d59 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_adjoint.cpp @@ -0,0 +1,3 @@ +Matrix2cf m = Matrix2cf::Random(); +cout << "Here is the 2x2 complex matrix m:" << endl << m << endl; +cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_all.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_all.cpp new file mode 100644 index 0000000..46f26f1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_all.cpp @@ -0,0 +1,7 @@ +Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones()); +Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs(); +// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax: +cout << "Is (" << p0.transpose() << ") inside the box: " + << ((boxMin.array()p0.array()).all()) << endl; +cout << "Is (" << p1.transpose() << ") inside the box: " + << ((boxMin.array()p1.array()).all()) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheLeft.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheLeft.cpp new file mode 100644 index 0000000..6398c87 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheLeft.cpp @@ -0,0 +1,7 @@ +Matrix3f A = Matrix3f::Random(3,3), B; +B << 0,1,0, + 0,0,1, + 1,0,0; +cout << "At start, A = " << endl << A << endl; +A.applyOnTheLeft(B); +cout << "After applyOnTheLeft, A = " << endl << A << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheRight.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheRight.cpp new file mode 100644 index 0000000..e4b71b2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_applyOnTheRight.cpp @@ -0,0 +1,9 @@ +Matrix3f A = Matrix3f::Random(3,3), B; +B << 0,1,0, + 0,0,1, + 1,0,0; +cout << "At start, A = " << endl << A << endl; +A *= B; +cout << "After A *= B, A = " << endl << A << endl; +A.applyOnTheRight(B); // equivalent to A *= B +cout << "After applyOnTheRight, A = " << endl << A << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_array.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_array.cpp new file mode 100644 index 0000000..f215086 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_array.cpp @@ -0,0 +1,4 @@ +Vector3d v(1,2,3); +v.array() += 3; +v.array() -= 2; +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_array_const.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_array_const.cpp new file mode 100644 index 0000000..cd3b26a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_array_const.cpp @@ -0,0 +1,4 @@ +Vector3d v(-1,2,-3); +cout << "the absolute values:" << endl << v.array().abs() << endl; +cout << "the absolute values plus one:" << endl << v.array().abs()+1 << endl; +cout << "sum of the squares: " << v.array().square().sum() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_asDiagonal.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_asDiagonal.cpp new file mode 100644 index 0000000..b01082d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_asDiagonal.cpp @@ -0,0 +1 @@ +cout << Matrix3i(Vector3i(2,5,6).asDiagonal()) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int.cpp new file mode 100644 index 0000000..f99b6d4 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int.cpp @@ -0,0 +1,5 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.block<2,2>(1,1):" << endl << m.block<2,2>(1,1) << endl; +m.block<2,2>(1,1).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int_int_int.cpp new file mode 100644 index 0000000..7238cbb --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_block_int_int_int_int.cpp @@ -0,0 +1,5 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.block(1, 1, 2, 2):" << endl << m.block(1, 1, 2, 2) << endl; +m.block(1, 1, 2, 2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp new file mode 100644 index 0000000..ebae95e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomLeftCorner(2, 2):" << endl; +cout << m.bottomLeftCorner(2, 2) << endl; +m.bottomLeftCorner(2, 2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp new file mode 100644 index 0000000..bf05093 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomRightCorner(2, 2):" << endl; +cout << m.bottomRightCorner(2, 2) << endl; +m.bottomRightCorner(2, 2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRows_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRows_int.cpp new file mode 100644 index 0000000..47ca92e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_bottomRows_int.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.bottomRows(2):" << endl; +cout << a.bottomRows(2) << endl; +a.bottomRows(2).setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cast.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cast.cpp new file mode 100644 index 0000000..016880b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cast.cpp @@ -0,0 +1,3 @@ +Matrix2d md = Matrix2d::Identity() * 0.45; +Matrix2f mf = Matrix2f::Identity(); +cout << md + mf.cast() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_col.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_col.cpp new file mode 100644 index 0000000..87c91b1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_col.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Identity(); +m.col(1) = Vector3d(4,5,6); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise.cpp new file mode 100644 index 0000000..a048bef --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; +cout << "Here is the maximum absolute value of each column:" + << endl << m.cwiseAbs().colwise().maxCoeff() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise_iterator_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise_iterator_cxx11.cpp new file mode 100644 index 0000000..116063f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_colwise_iterator_cxx11.cpp @@ -0,0 +1,12 @@ +Matrix3i m = Matrix3i::Random(); +cout << "Here is the initial matrix m:" << endl << m << endl; +int i = -1; +for(auto c: m.colwise()) { + c *= i; + ++i; +} +cout << "Here is the matrix m after the for-range-loop:" << endl << m << endl; +auto cols = m.colwise(); +auto it = std::find_if(cols.cbegin(), cols.cend(), + [](Matrix3i::ConstColXpr x) { return x.squaredNorm() == 0; }); +cout << "The first empty column is: " << distance(cols.cbegin(),it) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp new file mode 100644 index 0000000..a7b084f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp @@ -0,0 +1,13 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +Matrix3d inverse; +bool invertible; +double determinant; +m.computeInverseAndDetWithCheck(inverse,determinant,invertible); +cout << "Its determinant is " << determinant << endl; +if(invertible) { + cout << "It is invertible, and its inverse is:" << endl << inverse << endl; +} +else { + cout << "It is not invertible." << endl; +} diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseWithCheck.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseWithCheck.cpp new file mode 100644 index 0000000..873a9f8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_computeInverseWithCheck.cpp @@ -0,0 +1,11 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +Matrix3d inverse; +bool invertible; +m.computeInverseWithCheck(inverse,invertible); +if(invertible) { + cout << "It is invertible, and its inverse is:" << endl << inverse << endl; +} +else { + cout << "It is not invertible." << endl; +} diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs.cpp new file mode 100644 index 0000000..28a3160 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs.cpp @@ -0,0 +1,4 @@ +MatrixXd m(2,3); +m << 2, -4, 6, + -5, 1, 0; +cout << m.cwiseAbs() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs2.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs2.cpp new file mode 100644 index 0000000..889a2e2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseAbs2.cpp @@ -0,0 +1,4 @@ +MatrixXd m(2,3); +m << 2, -4, 6, + -5, 1, 0; +cout << m.cwiseAbs2() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseArg.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseArg.cpp new file mode 100644 index 0000000..e0857cf --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseArg.cpp @@ -0,0 +1,3 @@ +MatrixXcf v = MatrixXcf::Random(2, 3); +cout << v << endl << endl; +cout << v.cwiseArg() << endl; \ No newline at end of file diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseEqual.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseEqual.cpp new file mode 100644 index 0000000..469af64 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseEqual.cpp @@ -0,0 +1,7 @@ +MatrixXi m(2,2); +m << 1, 0, + 1, 1; +cout << "Comparing m with identity matrix:" << endl; +cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl; +Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count(); +cout << "Number of coefficients that are equal: " << count << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseInverse.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseInverse.cpp new file mode 100644 index 0000000..23e08f7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseInverse.cpp @@ -0,0 +1,4 @@ +MatrixXd m(2,3); +m << 2, 0.5, 1, + 3, 0.25, 1; +cout << m.cwiseInverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMax.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMax.cpp new file mode 100644 index 0000000..3c95681 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMax.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwiseMax(w) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMin.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMin.cpp new file mode 100644 index 0000000..82fc761 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseMin.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwiseMin(w) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseNotEqual.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseNotEqual.cpp new file mode 100644 index 0000000..7f0a105 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseNotEqual.cpp @@ -0,0 +1,7 @@ +MatrixXi m(2,2); +m << 1, 0, + 1, 1; +cout << "Comparing m with identity matrix:" << endl; +cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl; +Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count(); +cout << "Number of coefficients that are not equal: " << count << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseProduct.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseProduct.cpp new file mode 100644 index 0000000..1db3a11 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseProduct.cpp @@ -0,0 +1,4 @@ +Matrix3i a = Matrix3i::Random(), b = Matrix3i::Random(); +Matrix3i c = a.cwiseProduct(b); +cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl; + diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseQuotient.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseQuotient.cpp new file mode 100644 index 0000000..9691212 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseQuotient.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwiseQuotient(w) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSign.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSign.cpp new file mode 100644 index 0000000..efd7179 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSign.cpp @@ -0,0 +1,4 @@ +MatrixXd m(2,3); +m << 2, -4, 6, + -5, 1, 0; +cout << m.cwiseSign() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSqrt.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSqrt.cpp new file mode 100644 index 0000000..4bfd75d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_cwiseSqrt.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,4); +cout << v.cwiseSqrt() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal.cpp new file mode 100644 index 0000000..cd63413 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal.cpp @@ -0,0 +1,4 @@ +Matrix3i m = Matrix3i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here are the coefficients on the main diagonal of m:" << endl + << m.diagonal() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_int.cpp new file mode 100644 index 0000000..7b66abf --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_int.cpp @@ -0,0 +1,5 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl + << m.diagonal(1).transpose() << endl + << m.diagonal(-2).transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_template_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_template_int.cpp new file mode 100644 index 0000000..0e73d1c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_diagonal_template_int.cpp @@ -0,0 +1,5 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl + << m.diagonal<1>().transpose() << endl + << m.diagonal<-2>().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_eigenvalues.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_eigenvalues.cpp new file mode 100644 index 0000000..039f887 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_eigenvalues.cpp @@ -0,0 +1,3 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +VectorXcd eivals = ones.eigenvalues(); +cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_end_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_end_int.cpp new file mode 100644 index 0000000..03c54a9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_end_int.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.tail(2):" << endl << v.tail(2) << endl; +v.tail(2).setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_eval.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_eval.cpp new file mode 100644 index 0000000..1df3aa0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_eval.cpp @@ -0,0 +1,12 @@ +Matrix2f M = Matrix2f::Random(); +Matrix2f m; +m = M; +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Now we want to copy a column into a row." << endl; +cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl; +m.col(1) = m.row(0); +cout << m << endl << "which is wrong!" << endl; +cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl; +m = M; +m.col(1) = m.row(0).eval(); +cout << m << endl << "which is right." << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_fixedBlock_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_fixedBlock_int_int.cpp new file mode 100644 index 0000000..3201127 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_fixedBlock_int_int.cpp @@ -0,0 +1,5 @@ +Matrix4d m = Vector4d(1,2,3,4).asDiagonal(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.fixed<2, 2>(2, 2):" << endl << m.block<2, 2>(2, 2) << endl; +m.block<2, 2>(2, 0) = m.block<2, 2>(2, 2); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_hnormalized.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_hnormalized.cpp new file mode 100644 index 0000000..b714adc --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_hnormalized.cpp @@ -0,0 +1,6 @@ +Vector4d v = Vector4d::Random(); +Projective3d P(Matrix4d::Random()); +cout << "v = " << v.transpose() << "]^T" << endl; +cout << "v.hnormalized() = " << v.hnormalized().transpose() << "]^T" << endl; +cout << "P*v = " << (P*v).transpose() << "]^T" << endl; +cout << "(P*v).hnormalized() = " << (P*v).hnormalized().transpose() << "]^T" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_homogeneous.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_homogeneous.cpp new file mode 100644 index 0000000..2631960 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_homogeneous.cpp @@ -0,0 +1,6 @@ +Vector3d v = Vector3d::Random(), w; +Projective3d P(Matrix4d::Random()); +cout << "v = [" << v.transpose() << "]^T" << endl; +cout << "h.homogeneous() = [" << v.homogeneous().transpose() << "]^T" << endl; +cout << "(P * v.homogeneous()) = [" << (P * v.homogeneous()).transpose() << "]^T" << endl; +cout << "(P * v.homogeneous()).hnormalized() = [" << (P * v.homogeneous()).eval().hnormalized().transpose() << "]^T" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity.cpp new file mode 100644 index 0000000..b5c1e59 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity.cpp @@ -0,0 +1 @@ +cout << Matrix::Identity() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity_int_int.cpp new file mode 100644 index 0000000..918649d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_identity_int_int.cpp @@ -0,0 +1 @@ +cout << MatrixXd::Identity(4, 3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_inverse.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_inverse.cpp new file mode 100644 index 0000000..a56142e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_inverse.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Its inverse is:" << endl << m.inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isDiagonal.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isDiagonal.cpp new file mode 100644 index 0000000..5b1d599 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isDiagonal.cpp @@ -0,0 +1,6 @@ +Matrix3d m = 10000 * Matrix3d::Identity(); +m(0,2) = 1; +cout << "Here's the matrix m:" << endl << m << endl; +cout << "m.isDiagonal() returns: " << m.isDiagonal() << endl; +cout << "m.isDiagonal(1e-3) returns: " << m.isDiagonal(1e-3) << endl; + diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isIdentity.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isIdentity.cpp new file mode 100644 index 0000000..17b756c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isIdentity.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Identity(); +m(0,2) = 1e-4; +cout << "Here's the matrix m:" << endl << m << endl; +cout << "m.isIdentity() returns: " << m.isIdentity() << endl; +cout << "m.isIdentity(1e-3) returns: " << m.isIdentity(1e-3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOnes.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOnes.cpp new file mode 100644 index 0000000..f82f628 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOnes.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Ones(); +m(0,2) += 1e-4; +cout << "Here's the matrix m:" << endl << m << endl; +cout << "m.isOnes() returns: " << m.isOnes() << endl; +cout << "m.isOnes(1e-3) returns: " << m.isOnes(1e-3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOrthogonal.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOrthogonal.cpp new file mode 100644 index 0000000..b22af06 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isOrthogonal.cpp @@ -0,0 +1,6 @@ +Vector3d v(1,0,0); +Vector3d w(1e-4,0,1); +cout << "Here's the vector v:" << endl << v << endl; +cout << "Here's the vector w:" << endl << w << endl; +cout << "v.isOrthogonal(w) returns: " << v.isOrthogonal(w) << endl; +cout << "v.isOrthogonal(w,1e-3) returns: " << v.isOrthogonal(w,1e-3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isUnitary.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isUnitary.cpp new file mode 100644 index 0000000..3877da3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isUnitary.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Identity(); +m(0,2) = 1e-4; +cout << "Here's the matrix m:" << endl << m << endl; +cout << "m.isUnitary() returns: " << m.isUnitary() << endl; +cout << "m.isUnitary(1e-3) returns: " << m.isUnitary(1e-3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_isZero.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isZero.cpp new file mode 100644 index 0000000..c2cfe22 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_isZero.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Zero(); +m(0,2) = 1e-4; +cout << "Here's the matrix m:" << endl << m << endl; +cout << "m.isZero() returns: " << m.isZero() << endl; +cout << "m.isZero(1e-3) returns: " << m.isZero(1e-3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_leftCols_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_leftCols_int.cpp new file mode 100644 index 0000000..6ea984e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_leftCols_int.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.leftCols(2):" << endl; +cout << a.leftCols(2) << endl; +a.leftCols(2).setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_noalias.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_noalias.cpp new file mode 100644 index 0000000..3b54a79 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_noalias.cpp @@ -0,0 +1,3 @@ +Matrix2d a, b, c; a << 1,2,3,4; b << 5,6,7,8; +c.noalias() = a * b; // this computes the product directly to c +cout << c << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones.cpp new file mode 100644 index 0000000..02c767c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones.cpp @@ -0,0 +1,2 @@ +cout << Matrix2d::Ones() << endl; +cout << 6 * RowVector4i::Ones() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int.cpp new file mode 100644 index 0000000..2ef188e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int.cpp @@ -0,0 +1,2 @@ +cout << 6 * RowVectorXi::Ones(4) << endl; +cout << VectorXf::Ones(2) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int_int.cpp new file mode 100644 index 0000000..60f5a31 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_ones_int_int.cpp @@ -0,0 +1 @@ +cout << MatrixXi::Ones(2,3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_operatorNorm.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_operatorNorm.cpp new file mode 100644 index 0000000..355246f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_operatorNorm.cpp @@ -0,0 +1,3 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +cout << "The operator norm of the 3x3 matrix of ones is " + << ones.operatorNorm() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_prod.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_prod.cpp new file mode 100644 index 0000000..d2f27bd --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_prod.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the product of all the coefficients:" << endl << m.prod() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_random.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random.cpp new file mode 100644 index 0000000..65fc524 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random.cpp @@ -0,0 +1 @@ +cout << 100 * Matrix2i::Random() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int.cpp new file mode 100644 index 0000000..f161d03 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int.cpp @@ -0,0 +1 @@ +cout << VectorXi::Random(2) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int_int.cpp new file mode 100644 index 0000000..3f0f7dd --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_random_int_int.cpp @@ -0,0 +1 @@ +cout << MatrixXi::Random(2,3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate.cpp new file mode 100644 index 0000000..3ce52bc --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate.cpp @@ -0,0 +1,4 @@ +MatrixXi m = MatrixXi::Random(2,3); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "m.replicate<3,2>() = ..." << endl; +cout << m.replicate<3,2>() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate_int_int.cpp new file mode 100644 index 0000000..b1dbc70 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_replicate_int_int.cpp @@ -0,0 +1,4 @@ +Vector3i v = Vector3i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "v.replicate(2,5) = ..." << endl; +cout << v.replicate(2,5) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_auto.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_auto.cpp new file mode 100644 index 0000000..59f9d3f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_auto.cpp @@ -0,0 +1,4 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped(2, AutoSize):" << endl << m.reshaped(2, AutoSize) << endl; +cout << "Here is m.reshaped(AutoSize, fix<8>):" << endl << m.reshaped(AutoSize, fix<8>) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_fixed.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_fixed.cpp new file mode 100644 index 0000000..3e9e2cf --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_fixed.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped(fix<2>,fix<8>):" << endl << m.reshaped(fix<2>,fix<8>) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_int_int.cpp new file mode 100644 index 0000000..af4ca59 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_int_int.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_to_vector.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_to_vector.cpp new file mode 100644 index 0000000..37f65f7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reshaped_to_vector.cpp @@ -0,0 +1,4 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped().transpose():" << endl << m.reshaped().transpose() << endl; +cout << "Here is m.reshaped().transpose(): " << endl << m.reshaped().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_reverse.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reverse.cpp new file mode 100644 index 0000000..f545a28 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_reverse.cpp @@ -0,0 +1,8 @@ +MatrixXi m = MatrixXi::Random(3,4); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the reverse of m:" << endl << m.reverse() << endl; +cout << "Here is the coefficient (1,0) in the reverse of m:" << endl + << m.reverse()(1,0) << endl; +cout << "Let us overwrite this coefficient with the value 4." << endl; +m.reverse()(1,0) = 4; +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_rightCols_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_rightCols_int.cpp new file mode 100644 index 0000000..cb51340 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_rightCols_int.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.rightCols(2):" << endl; +cout << a.rightCols(2) << endl; +a.rightCols(2).setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_row.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_row.cpp new file mode 100644 index 0000000..b15e626 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_row.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Identity(); +m.row(1) = Vector3d(4,5,6); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_rowwise.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_rowwise.cpp new file mode 100644 index 0000000..ae93964 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_rowwise.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; +cout << "Here is the maximum absolute value of each row:" + << endl << m.cwiseAbs().rowwise().maxCoeff() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_segment_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_segment_int_int.cpp new file mode 100644 index 0000000..70cd6d2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_segment_int_int.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.segment(1, 2):" << endl << v.segment(1, 2) << endl; +v.segment(1, 2).setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_select.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_select.cpp new file mode 100644 index 0000000..ae5477f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_select.cpp @@ -0,0 +1,6 @@ +MatrixXi m(3, 3); +m << 1, 2, 3, + 4, 5, 6, + 7, 8, 9; +m = (m.array() >= 5).select(-m, m); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_selfadjointView.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_selfadjointView.cpp new file mode 100644 index 0000000..4bd3c7e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_selfadjointView.cpp @@ -0,0 +1,6 @@ +Matrix3i m = Matrix3i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the symmetric matrix extracted from the upper part of m:" << endl + << Matrix3i(m.selfadjointView()) << endl; +cout << "Here is the symmetric matrix extracted from the lower part of m:" << endl + << Matrix3i(m.selfadjointView()) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_set.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_set.cpp new file mode 100644 index 0000000..50ecf5f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_set.cpp @@ -0,0 +1,13 @@ +Matrix3i m1; +m1 << 1, 2, 3, + 4, 5, 6, + 7, 8, 9; +cout << m1 << endl << endl; +Matrix3i m2 = Matrix3i::Identity(); +m2.block(0,0, 2,2) << 10, 11, 12, 13; +cout << m2 << endl << endl; +Vector2i v1; +v1 << 14, 15; +m2 << v1.transpose(), 16, + v1, m1.block(1,1,2,2); +cout << m2 << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_setIdentity.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setIdentity.cpp new file mode 100644 index 0000000..4fd0aa2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setIdentity.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Zero(); +m.block<3,3>(1,0).setIdentity(); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_setOnes.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setOnes.cpp new file mode 100644 index 0000000..4cef9c1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setOnes.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Random(); +m.row(1).setOnes(); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_setRandom.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setRandom.cpp new file mode 100644 index 0000000..e2c257d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setRandom.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Zero(); +m.col(1).setRandom(); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_setZero.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setZero.cpp new file mode 100644 index 0000000..9b5b958 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_setZero.cpp @@ -0,0 +1,3 @@ +Matrix4i m = Matrix4i::Random(); +m.row(1).setZero(); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_start_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_start_int.cpp new file mode 100644 index 0000000..c261d2b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_start_int.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.head(2):" << endl << v.head(2) << endl; +v.head(2).setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_bottomRows.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_bottomRows.cpp new file mode 100644 index 0000000..f9ea892 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_bottomRows.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.bottomRows<2>():" << endl; +cout << a.bottomRows<2>() << endl; +a.bottomRows<2>().setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_end.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_end.cpp new file mode 100644 index 0000000..f5ccb00 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_end.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.tail(2):" << endl << v.tail<2>() << endl; +v.tail<2>().setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp new file mode 100644 index 0000000..4dced03 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp @@ -0,0 +1,5 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the block:" << endl << m.block<2, Dynamic>(1, 1, 2, 3) << endl; +m.block<2, Dynamic>(1, 1, 2, 3).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp new file mode 100644 index 0000000..847892a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomLeftCorner<2,2>():" << endl; +cout << m.bottomLeftCorner<2,2>() << endl; +m.bottomLeftCorner<2,2>().setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp new file mode 100644 index 0000000..a1edcc8 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomLeftCorner<2,Dynamic>(2,2):" << endl; +cout << m.bottomLeftCorner<2,Dynamic>(2,2) << endl; +m.bottomLeftCorner<2,Dynamic>(2,2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp new file mode 100644 index 0000000..abacb01 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomRightCorner<2,2>():" << endl; +cout << m.bottomRightCorner<2,2>() << endl; +m.bottomRightCorner<2,2>().setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp new file mode 100644 index 0000000..a65508f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.bottomRightCorner<2,Dynamic>(2,2):" << endl; +cout << m.bottomRightCorner<2,Dynamic>(2,2) << endl; +m.bottomRightCorner<2,Dynamic>(2,2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp new file mode 100644 index 0000000..1899d90 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topLeftCorner<2,2>():" << endl; +cout << m.topLeftCorner<2,2>() << endl; +m.topLeftCorner<2,2>().setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp new file mode 100644 index 0000000..fac761f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topLeftCorner<2,Dynamic>(2,2):" << endl; +cout << m.topLeftCorner<2,Dynamic>(2,2) << endl; +m.topLeftCorner<2,Dynamic>(2,2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp new file mode 100644 index 0000000..c3a1771 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topRightCorner<2,2>():" << endl; +cout << m.topRightCorner<2,2>() << endl; +m.topRightCorner<2,2>().setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp new file mode 100644 index 0000000..a17acc0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topRightCorner<2,Dynamic>(2,2):" << endl; +cout << m.topRightCorner<2,Dynamic>(2,2) << endl; +m.topRightCorner<2,Dynamic>(2,2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_leftCols.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_leftCols.cpp new file mode 100644 index 0000000..1c425d9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_leftCols.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.leftCols<2>():" << endl; +cout << a.leftCols<2>() << endl; +a.leftCols<2>().setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_rightCols.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_rightCols.cpp new file mode 100644 index 0000000..fc8c0d9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_rightCols.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.rightCols<2>():" << endl; +cout << a.rightCols<2>() << endl; +a.rightCols<2>().setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_segment.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_segment.cpp new file mode 100644 index 0000000..e448b40 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_segment.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.segment<2>(1):" << endl << v.segment<2>(1) << endl; +v.segment<2>(2).setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_start.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_start.cpp new file mode 100644 index 0000000..d336b37 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_start.cpp @@ -0,0 +1,5 @@ +RowVector4i v = RowVector4i::Random(); +cout << "Here is the vector v:" << endl << v << endl; +cout << "Here is v.head(2):" << endl << v.head<2>() << endl; +v.head<2>().setZero(); +cout << "Now the vector v is:" << endl << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_topRows.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_topRows.cpp new file mode 100644 index 0000000..0110251 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_template_int_topRows.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.topRows<2>():" << endl; +cout << a.topRows<2>() << endl; +a.topRows<2>().setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp new file mode 100644 index 0000000..e52cb3b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topLeftCorner(2, 2):" << endl; +cout << m.topLeftCorner(2, 2) << endl; +m.topLeftCorner(2, 2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRightCorner_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRightCorner_int_int.cpp new file mode 100644 index 0000000..811fa56 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRightCorner_int_int.cpp @@ -0,0 +1,6 @@ +Matrix4i m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.topRightCorner(2, 2):" << endl; +cout << m.topRightCorner(2, 2) << endl; +m.topRightCorner(2, 2).setZero(); +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRows_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRows_int.cpp new file mode 100644 index 0000000..f2d75f1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_topRows_int.cpp @@ -0,0 +1,6 @@ +Array44i a = Array44i::Random(); +cout << "Here is the array a:" << endl << a << endl; +cout << "Here is a.topRows(2):" << endl; +cout << a.topRows(2) << endl; +a.topRows(2).setZero(); +cout << "Now the array a is:" << endl << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_transpose.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_transpose.cpp new file mode 100644 index 0000000..88eea83 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_transpose.cpp @@ -0,0 +1,8 @@ +Matrix2i m = Matrix2i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the transpose of m:" << endl << m.transpose() << endl; +cout << "Here is the coefficient (1,0) in the transpose of m:" << endl + << m.transpose()(1,0) << endl; +cout << "Let us overwrite this coefficient with the value 0." << endl; +m.transpose()(1,0) = 0; +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_triangularView.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_triangularView.cpp new file mode 100644 index 0000000..03aa303 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_triangularView.cpp @@ -0,0 +1,9 @@ +Matrix3i m = Matrix3i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the upper-triangular matrix extracted from m:" << endl + << Matrix3i(m.triangularView()) << endl; +cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl + << Matrix3i(m.triangularView()) << endl; +cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl + << Matrix3i(m.triangularView()) << endl; +// FIXME need to implement output for triangularViews (Bug 885) diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero.cpp new file mode 100644 index 0000000..6064936 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero.cpp @@ -0,0 +1,2 @@ +cout << Matrix2d::Zero() << endl; +cout << RowVector4i::Zero() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int.cpp new file mode 100644 index 0000000..370a9ba --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int.cpp @@ -0,0 +1,2 @@ +cout << RowVectorXi::Zero(4) << endl; +cout << VectorXf::Zero(2) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int_int.cpp new file mode 100644 index 0000000..4099c5d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/MatrixBase_zero_int_int.cpp @@ -0,0 +1 @@ +cout << MatrixXi::Zero(2,3) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_Map_stride.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_Map_stride.cpp new file mode 100644 index 0000000..ae42a12 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_Map_stride.cpp @@ -0,0 +1,7 @@ +Matrix4i A; +A << 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16; + +std::cout << Matrix2i::Map(&A(1,1),Stride<8,2>()) << std::endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_23_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_23_cxx11.cpp new file mode 100644 index 0000000..60280ab --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_23_cxx11.cpp @@ -0,0 +1,5 @@ +MatrixXd m { + {1, 2, 3}, + {4, 5, 6} +}; +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_vector_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_vector_cxx11.cpp new file mode 100644 index 0000000..325257c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_initializer_list_vector_cxx11.cpp @@ -0,0 +1,2 @@ +VectorXi v {{1, 2}}; +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_resize_NoChange_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_NoChange_int.cpp new file mode 100644 index 0000000..acdf18c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_NoChange_int.cpp @@ -0,0 +1,3 @@ +MatrixXd m(3,4); +m.resize(NoChange, 5); +cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int.cpp new file mode 100644 index 0000000..044c789 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int.cpp @@ -0,0 +1,6 @@ +VectorXd v(10); +v.resize(3); +RowVector3d w; +w.resize(3); // this is legal, but has no effect +cout << "v: " << v.rows() << " rows, " << v.cols() << " cols" << endl; +cout << "w: " << w.rows() << " rows, " << w.cols() << " cols" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_NoChange.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_NoChange.cpp new file mode 100644 index 0000000..5c37c90 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_NoChange.cpp @@ -0,0 +1,3 @@ +MatrixXd m(3,4); +m.resize(5, NoChange); +cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_int.cpp new file mode 100644 index 0000000..bfd4741 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_resize_int_int.cpp @@ -0,0 +1,9 @@ +MatrixXd m(2,3); +m << 1,2,3,4,5,6; +cout << "here's the 2x3 matrix m:" << endl << m << endl; +cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl; +m.resize(3,2); +cout << "here's the 3x2 matrix m:" << endl << m << endl; +cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl; +m.resize(2,2); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int.cpp new file mode 100644 index 0000000..ff5a86c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int.cpp @@ -0,0 +1,3 @@ +VectorXf v; +v.setConstant(3, 5); +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int_int.cpp new file mode 100644 index 0000000..32b950c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setConstant_int_int.cpp @@ -0,0 +1,3 @@ +MatrixXf m; +m.setConstant(3, 3, 5); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setIdentity_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setIdentity_int_int.cpp new file mode 100644 index 0000000..a659671 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setIdentity_int_int.cpp @@ -0,0 +1,3 @@ +MatrixXf m; +m.setIdentity(3, 3); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int.cpp new file mode 100644 index 0000000..752cb35 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int.cpp @@ -0,0 +1,3 @@ +VectorXf v; +v.setOnes(3); +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int_int.cpp new file mode 100644 index 0000000..1ffb66b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setOnes_int_int.cpp @@ -0,0 +1,3 @@ +MatrixXf m; +m.setOnes(3, 3); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int.cpp new file mode 100644 index 0000000..e160dd7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int.cpp @@ -0,0 +1,3 @@ +VectorXf v; +v.setRandom(3); +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int_int.cpp new file mode 100644 index 0000000..80cda11 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setRandom_int_int.cpp @@ -0,0 +1,3 @@ +MatrixXf m; +m.setRandom(3, 3); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int.cpp new file mode 100644 index 0000000..0fb16c1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int.cpp @@ -0,0 +1,3 @@ +VectorXf v; +v.setZero(3); +cout << v << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int_int.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int_int.cpp new file mode 100644 index 0000000..ad883b9 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_setZero_int_int.cpp @@ -0,0 +1,3 @@ +MatrixXf m; +m.setZero(3, 3); +cout << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Matrix_variadic_ctor_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Matrix_variadic_ctor_cxx11.cpp new file mode 100644 index 0000000..06d33f5 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Matrix_variadic_ctor_cxx11.cpp @@ -0,0 +1,3 @@ +Matrix a(1, 2, 3, 4, 5, 6); +Matrix b {1, 2, 3}; +cout << a << "\n\n" << b << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialPivLU_solve.cpp b/lib/eigen-3.4.0/doc/snippets/PartialPivLU_solve.cpp new file mode 100644 index 0000000..fa3570a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialPivLU_solve.cpp @@ -0,0 +1,7 @@ +MatrixXd A = MatrixXd::Random(3,3); +MatrixXd B = MatrixXd::Random(3,2); +cout << "Here is the invertible matrix A:" << endl << A << endl; +cout << "Here is the matrix B:" << endl << B << endl; +MatrixXd X = A.lu().solve(B); +cout << "Here is the (unique) solution X to the equation AX=B:" << endl << X << endl; +cout << "Relative error: " << (A*X-B).norm() / B.norm() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_count.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_count.cpp new file mode 100644 index 0000000..1c3b3a2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_count.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +Matrix res = (m.array() >= 0.5).rowwise().count(); +cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl; +cout << res << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_maxCoeff.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_maxCoeff.cpp new file mode 100644 index 0000000..e8fd382 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_maxCoeff.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_minCoeff.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_minCoeff.cpp new file mode 100644 index 0000000..d717bc0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_minCoeff.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_norm.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_norm.cpp new file mode 100644 index 0000000..dbcf290 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_norm.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_prod.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_prod.cpp new file mode 100644 index 0000000..aacf09c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_prod.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the product of each row:" << endl << m.rowwise().prod() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_squaredNorm.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_squaredNorm.cpp new file mode 100644 index 0000000..9f3293e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_squaredNorm.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the square norm of each row:" << endl << m.rowwise().squaredNorm() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/PartialRedux_sum.cpp b/lib/eigen-3.4.0/doc/snippets/PartialRedux_sum.cpp new file mode 100644 index 0000000..ec82d3e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/PartialRedux_sum.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/RealQZ_compute.cpp b/lib/eigen-3.4.0/doc/snippets/RealQZ_compute.cpp new file mode 100644 index 0000000..a18da42 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/RealQZ_compute.cpp @@ -0,0 +1,17 @@ +MatrixXf A = MatrixXf::Random(4,4); +MatrixXf B = MatrixXf::Random(4,4); +RealQZ qz(4); // preallocate space for 4x4 matrices +qz.compute(A,B); // A = Q S Z, B = Q T Z + +// print original matrices and result of decomposition +cout << "A:\n" << A << "\n" << "B:\n" << B << "\n"; +cout << "S:\n" << qz.matrixS() << "\n" << "T:\n" << qz.matrixT() << "\n"; +cout << "Q:\n" << qz.matrixQ() << "\n" << "Z:\n" << qz.matrixZ() << "\n"; + +// verify precision +cout << "\nErrors:" + << "\n|A-QSZ|: " << (A-qz.matrixQ()*qz.matrixS()*qz.matrixZ()).norm() + << ", |B-QTZ|: " << (B-qz.matrixQ()*qz.matrixT()*qz.matrixZ()).norm() + << "\n|QQ* - I|: " << (qz.matrixQ()*qz.matrixQ().adjoint() - MatrixXf::Identity(4,4)).norm() + << ", |ZZ* - I|: " << (qz.matrixZ()*qz.matrixZ().adjoint() - MatrixXf::Identity(4,4)).norm() + << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/RealSchur_RealSchur_MatrixType.cpp b/lib/eigen-3.4.0/doc/snippets/RealSchur_RealSchur_MatrixType.cpp new file mode 100644 index 0000000..a5530dc --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/RealSchur_RealSchur_MatrixType.cpp @@ -0,0 +1,10 @@ +MatrixXd A = MatrixXd::Random(6,6); +cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; + +RealSchur schur(A); +cout << "The orthogonal matrix U is:" << endl << schur.matrixU() << endl; +cout << "The quasi-triangular matrix T is:" << endl << schur.matrixT() << endl << endl; + +MatrixXd U = schur.matrixU(); +MatrixXd T = schur.matrixT(); +cout << "U * T * U^T = " << endl << U * T * U.transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/RealSchur_compute.cpp b/lib/eigen-3.4.0/doc/snippets/RealSchur_compute.cpp new file mode 100644 index 0000000..20c2611 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/RealSchur_compute.cpp @@ -0,0 +1,6 @@ +MatrixXf A = MatrixXf::Random(4,4); +RealSchur schur(4); +schur.compute(A, /* computeU = */ false); +cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; +schur.compute(A.inverse(), /* computeU = */ false); +cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp new file mode 100644 index 0000000..73a7f62 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp @@ -0,0 +1,7 @@ +SelfAdjointEigenSolver es; +Matrix4f X = Matrix4f::Random(4,4); +Matrix4f A = X + X.transpose(); +es.compute(A); +cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; +es.compute(A + Matrix4f::Identity(4,4)); // re-use es to compute eigenvalues of A+I +cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp new file mode 100644 index 0000000..3599b17 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp @@ -0,0 +1,17 @@ +MatrixXd X = MatrixXd::Random(5,5); +MatrixXd A = X + X.transpose(); +cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl; + +SelfAdjointEigenSolver es(A); +cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; +cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; + +double lambda = es.eigenvalues()[0]; +cout << "Consider the first eigenvalue, lambda = " << lambda << endl; +VectorXd v = es.eigenvectors().col(0); +cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; +cout << "... and A * v = " << endl << A * v << endl << endl; + +MatrixXd D = es.eigenvalues().asDiagonal(); +MatrixXd V = es.eigenvectors(); +cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp new file mode 100644 index 0000000..bbb821e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp @@ -0,0 +1,16 @@ +MatrixXd X = MatrixXd::Random(5,5); +MatrixXd A = X + X.transpose(); +cout << "Here is a random symmetric matrix, A:" << endl << A << endl; +X = MatrixXd::Random(5,5); +MatrixXd B = X * X.transpose(); +cout << "and a random postive-definite matrix, B:" << endl << B << endl << endl; + +GeneralizedSelfAdjointEigenSolver es(A,B); +cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; +cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; + +double lambda = es.eigenvalues()[0]; +cout << "Consider the first eigenvalue, lambda = " << lambda << endl; +VectorXd v = es.eigenvectors().col(0); +cout << "If v is the corresponding eigenvector, then A * v = " << endl << A * v << endl; +cout << "... and lambda * B * v = " << endl << lambda * B * v << endl << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp new file mode 100644 index 0000000..2975cc3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp @@ -0,0 +1,7 @@ +SelfAdjointEigenSolver es(4); +MatrixXf X = MatrixXf::Random(4,4); +MatrixXf A = X + X.transpose(); +es.compute(A); +cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; +es.compute(A + MatrixXf::Identity(4,4)); // re-use es to compute eigenvalues of A+I +cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp new file mode 100644 index 0000000..07c92a1 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp @@ -0,0 +1,9 @@ +MatrixXd X = MatrixXd::Random(5,5); +MatrixXd A = X * X.transpose(); +X = MatrixXd::Random(5,5); +MatrixXd B = X * X.transpose(); + +GeneralizedSelfAdjointEigenSolver es(A,B,EigenvaluesOnly); +cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; +es.compute(B,A,false); +cout << "The eigenvalues of the pencil (B,A) are:" << endl << es.eigenvalues() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp new file mode 100644 index 0000000..0ff33c6 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp @@ -0,0 +1,4 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +SelfAdjointEigenSolver es(ones); +cout << "The eigenvalues of the 3x3 matrix of ones are:" + << endl << es.eigenvalues() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp new file mode 100644 index 0000000..94b0d6e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp @@ -0,0 +1,4 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +SelfAdjointEigenSolver es(ones); +cout << "The first eigenvector of the 3x3 matrix of ones is:" + << endl << es.eigenvectors().col(0) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp new file mode 100644 index 0000000..114c65f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp @@ -0,0 +1,9 @@ +MatrixXd X = MatrixXd::Random(4,4); +MatrixXd A = X * X.transpose(); +cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; + +SelfAdjointEigenSolver es(A); +cout << "The inverse square root of A is: " << endl; +cout << es.operatorInverseSqrt() << endl; +cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl; +cout << es.operatorSqrt().inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp new file mode 100644 index 0000000..eeacca7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp @@ -0,0 +1,8 @@ +MatrixXd X = MatrixXd::Random(4,4); +MatrixXd A = X * X.transpose(); +cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; + +SelfAdjointEigenSolver es(A); +MatrixXd sqrtA = es.operatorSqrt(); +cout << "The square root of A is: " << endl << sqrtA << endl; +cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_eigenvalues.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_eigenvalues.cpp new file mode 100644 index 0000000..be19867 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_eigenvalues.cpp @@ -0,0 +1,3 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +VectorXd eivals = ones.selfadjointView().eigenvalues(); +cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_operatorNorm.cpp b/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_operatorNorm.cpp new file mode 100644 index 0000000..f380f55 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SelfAdjointView_operatorNorm.cpp @@ -0,0 +1,3 @@ +MatrixXd ones = MatrixXd::Ones(3,3); +cout << "The operator norm of the 3x3 matrix of ones is " + << ones.selfadjointView().operatorNorm() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Slicing_arrayexpr.cpp b/lib/eigen-3.4.0/doc/snippets/Slicing_arrayexpr.cpp new file mode 100644 index 0000000..2df8180 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Slicing_arrayexpr.cpp @@ -0,0 +1,4 @@ +ArrayXi ind(5); ind<<4,2,5,5,3; +MatrixXi A = MatrixXi::Random(4,6); +cout << "Initial matrix A:\n" << A << "\n\n"; +cout << "A(all,ind-1):\n" << A(all,ind-1) << "\n\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Slicing_custom_padding_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Slicing_custom_padding_cxx11.cpp new file mode 100644 index 0000000..24db98b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Slicing_custom_padding_cxx11.cpp @@ -0,0 +1,12 @@ +struct pad { + Index size() const { return out_size; } + Index operator[] (Index i) const { return std::max(0,i-(out_size-in_size)); } + Index in_size, out_size; +}; + +Matrix3i A; +A.reshaped() = VectorXi::LinSpaced(9,1,9); +cout << "Initial matrix A:\n" << A << "\n\n"; +MatrixXi B(5,5); +B = A(pad{3,5}, pad{3,5}); +cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Slicing_rawarray_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Slicing_rawarray_cxx11.cpp new file mode 100644 index 0000000..1087131 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Slicing_rawarray_cxx11.cpp @@ -0,0 +1,5 @@ +#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE +MatrixXi A = MatrixXi::Random(4,6); +cout << "Initial matrix A:\n" << A << "\n\n"; +cout << "A(all,{4,2,5,5,3}):\n" << A(all,{4,2,5,5,3}) << "\n\n"; +#endif diff --git a/lib/eigen-3.4.0/doc/snippets/Slicing_stdvector_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Slicing_stdvector_cxx11.cpp new file mode 100644 index 0000000..555f662 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Slicing_stdvector_cxx11.cpp @@ -0,0 +1,4 @@ +std::vector ind{4,2,5,5,3}; +MatrixXi A = MatrixXi::Random(4,6); +cout << "Initial matrix A:\n" << A << "\n\n"; +cout << "A(all,ind):\n" << A(all,ind) << "\n\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/SparseMatrix_coeffs.cpp b/lib/eigen-3.4.0/doc/snippets/SparseMatrix_coeffs.cpp new file mode 100644 index 0000000..f71a69b --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/SparseMatrix_coeffs.cpp @@ -0,0 +1,9 @@ +SparseMatrix A(3,3); +A.insert(1,2) = 0; +A.insert(0,1) = 1; +A.insert(2,0) = 2; +A.makeCompressed(); +cout << "The matrix A is:" << endl << MatrixXd(A) << endl; +cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl; +A.coeffs() += 10; +cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block.cpp new file mode 100644 index 0000000..03282f4 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block.cpp @@ -0,0 +1,7 @@ +MatrixXi mat(3,3); +mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; +cout << "Here is the matrix mat:\n" << mat << endl; + +// This assignment shows the aliasing problem +mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2); +cout << "After the assignment, mat = \n" << mat << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block_correct.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block_correct.cpp new file mode 100644 index 0000000..6fee580 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block_correct.cpp @@ -0,0 +1,7 @@ +MatrixXi mat(3,3); +mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; +cout << "Here is the matrix mat:\n" << mat << endl; + +// The eval() solves the aliasing problem +mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval(); +cout << "After the assignment, mat = \n" << mat << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_cwise.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_cwise.cpp new file mode 100644 index 0000000..7049f6c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_cwise.cpp @@ -0,0 +1,20 @@ +MatrixXf mat(2,2); +mat << 1, 2, 4, 7; +cout << "Here is the matrix mat:\n" << mat << endl << endl; + +mat = 2 * mat; +cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl; + + +mat = mat - MatrixXf::Identity(2,2); +cout << "After the subtraction, it becomes\n" << mat << endl << endl; + + +ArrayXXf arr = mat; +arr = arr.square(); +cout << "After squaring, it becomes\n" << arr << endl << endl; + +// Combining all operations in one statement: +mat << 1, 2, 4, 7; +mat = (2 * mat - MatrixXf::Identity(2,2)).array().square(); +cout << "Doing everything at once yields\n" << mat << endl << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult1.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult1.cpp new file mode 100644 index 0000000..cd7e900 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult1.cpp @@ -0,0 +1,4 @@ +MatrixXf matA(2,2); +matA << 2, 0, 0, 2; +matA = matA * matA; +cout << matA; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult2.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult2.cpp new file mode 100644 index 0000000..a3ff568 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult2.cpp @@ -0,0 +1,10 @@ +MatrixXf matA(2,2), matB(2,2); +matA << 2, 0, 0, 2; + +// Simple but not quite as efficient +matB = matA * matA; +cout << matB << endl << endl; + +// More complicated but also more efficient +matB.noalias() = matA * matA; +cout << matB; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult3.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult3.cpp new file mode 100644 index 0000000..1d12a6c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult3.cpp @@ -0,0 +1,4 @@ +MatrixXf matA(2,2); +matA << 2, 0, 0, 2; +matA.noalias() = matA * matA; +cout << matA; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult4.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult4.cpp new file mode 100644 index 0000000..01c1c6d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult4.cpp @@ -0,0 +1,5 @@ +MatrixXf A(2,2), B(3,2); +B << 2, 0, 0, 3, 1, 1; +A << 2, 0, 0, -2; +A = (B * A).cwiseAbs(); +cout << A; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult5.cpp b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult5.cpp new file mode 100644 index 0000000..1a36def --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicAliasing_mult5.cpp @@ -0,0 +1,5 @@ +MatrixXf A(2,2), B(3,2); +B << 2, 0, 0, 3, 1, 1; +A << 2, 0, 0, -2; +A = (B * A).eval().cwiseAbs(); +cout << A; diff --git a/lib/eigen-3.4.0/doc/snippets/TopicStorageOrders_example.cpp b/lib/eigen-3.4.0/doc/snippets/TopicStorageOrders_example.cpp new file mode 100644 index 0000000..0623ef0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/TopicStorageOrders_example.cpp @@ -0,0 +1,18 @@ +Matrix Acolmajor; +Acolmajor << 8, 2, 2, 9, + 9, 1, 4, 4, + 3, 5, 4, 5; +cout << "The matrix A:" << endl; +cout << Acolmajor << endl << endl; + +cout << "In memory (column-major):" << endl; +for (int i = 0; i < Acolmajor.size(); i++) + cout << *(Acolmajor.data() + i) << " "; +cout << endl << endl; + +Matrix Arowmajor = Acolmajor; +cout << "In memory (row-major):" << endl; +for (int i = 0; i < Arowmajor.size(); i++) + cout << *(Arowmajor.data() + i) << " "; +cout << endl; + diff --git a/lib/eigen-3.4.0/doc/snippets/Triangular_solve.cpp b/lib/eigen-3.4.0/doc/snippets/Triangular_solve.cpp new file mode 100644 index 0000000..5484424 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Triangular_solve.cpp @@ -0,0 +1,11 @@ +Matrix3d m = Matrix3d::Zero(); +m.triangularView().setOnes(); +cout << "Here is the matrix m:\n" << m << endl; +Matrix3d n = Matrix3d::Ones(); +n.triangularView() *= 2; +cout << "Here is the matrix n:\n" << n << endl; +cout << "And now here is m.inverse()*n, taking advantage of the fact that" + " m is upper-triangular:\n" + << m.triangularView().solve(n) << endl; +cout << "And this is n*m.inverse():\n" + << m.triangularView().solve(n); diff --git a/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp new file mode 100644 index 0000000..a260124 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp @@ -0,0 +1,9 @@ +MatrixXd X = MatrixXd::Random(5,5); +MatrixXd A = X + X.transpose(); +cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; +Tridiagonalization triOfA(A); +MatrixXd Q = triOfA.matrixQ(); +cout << "The orthogonal matrix Q is:" << endl << Q << endl; +MatrixXd T = triOfA.matrixT(); +cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; +cout << "Q * T * Q^T = " << endl << Q * T * Q.transpose() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_compute.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_compute.cpp new file mode 100644 index 0000000..0062a99 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_compute.cpp @@ -0,0 +1,9 @@ +Tridiagonalization tri; +MatrixXf X = MatrixXf::Random(4,4); +MatrixXf A = X + X.transpose(); +tri.compute(A); +cout << "The matrix T in the tridiagonal decomposition of A is: " << endl; +cout << tri.matrixT() << endl; +tri.compute(2*A); // re-use tri to compute eigenvalues of 2A +cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl; +cout << tri.matrixT() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_decomposeInPlace.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_decomposeInPlace.cpp new file mode 100644 index 0000000..3cdce67 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_decomposeInPlace.cpp @@ -0,0 +1,11 @@ +MatrixXd X = MatrixXd::Random(5,5); +MatrixXd A = X + X.transpose(); +cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; + +VectorXd diag(5); +VectorXd subdiag(4); +VectorXd hcoeffs(4); // Scratch space for householder reflector. +internal::tridiagonalization_inplace(A, diag, subdiag, hcoeffs, 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/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_diagonal.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_diagonal.cpp new file mode 100644 index 0000000..6eec821 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_diagonal.cpp @@ -0,0 +1,13 @@ +MatrixXcd X = MatrixXcd::Random(4,4); +MatrixXcd A = X + X.adjoint(); +cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl; + +Tridiagonalization triOfA(A); +MatrixXd T = triOfA.matrixT(); +cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; + +cout << "We can also extract the diagonals of T directly ..." << endl; +VectorXd diag = triOfA.diagonal(); +cout << "The diagonal is:" << endl << diag << endl; +VectorXd subdiag = triOfA.subDiagonal(); +cout << "The subdiagonal is:" << endl << subdiag << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_householderCoefficients.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_householderCoefficients.cpp new file mode 100644 index 0000000..e5d8728 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_householderCoefficients.cpp @@ -0,0 +1,6 @@ +Matrix4d X = Matrix4d::Random(4,4); +Matrix4d A = X + X.transpose(); +cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; +Tridiagonalization triOfA(A); +Vector3d hc = triOfA.householderCoefficients(); +cout << "The vector of Householder coefficients is:" << endl << hc << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_packedMatrix.cpp b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_packedMatrix.cpp new file mode 100644 index 0000000..0f55d0c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tridiagonalization_packedMatrix.cpp @@ -0,0 +1,8 @@ +Matrix4d X = Matrix4d::Random(4,4); +Matrix4d A = X + X.transpose(); +cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; +Tridiagonalization triOfA(A); +Matrix4d pm = triOfA.packedMatrix(); +cout << "The packed matrix M is:" << endl << pm << endl; +cout << "The diagonal and subdiagonal corresponds to the matrix T, which is:" + << endl << triOfA.matrixT() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp new file mode 100644 index 0000000..96e40ac --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp @@ -0,0 +1,5 @@ +MatrixXf matA(2, 2); +matA << 1, 2, 3, 4; +MatrixXf matB(4, 4); +matB << matA, matA/10, matA/10, matA; +std::cout << matB << std::endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp new file mode 100644 index 0000000..50cff4c --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp @@ -0,0 +1,4 @@ +MatrixXf mat = MatrixXf::Random(2, 3); +std::cout << mat << std::endl << std::endl; +mat = (MatrixXf(2,2) << 0, 1, 1, 0).finished() * mat; +std::cout << mat << std::endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp new file mode 100644 index 0000000..55a2153 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp @@ -0,0 +1,11 @@ +RowVectorXd vec1(3); +vec1 << 1, 2, 3; +std::cout << "vec1 = " << vec1 << std::endl; + +RowVectorXd vec2(4); +vec2 << 1, 4, 9, 16; +std::cout << "vec2 = " << vec2 << std::endl; + +RowVectorXd joined(7); +joined << vec1, vec2; +std::cout << "joined = " << joined << std::endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp new file mode 100644 index 0000000..c6a73ab --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp @@ -0,0 +1,7 @@ +ArrayXXf table(10, 4); +table.col(0) = ArrayXf::LinSpaced(10, 0, 90); +table.col(1) = M_PI / 180 * table.col(0); +table.col(2) = table.col(1).sin(); +table.col(3) = table.col(1).cos(); +std::cout << " Degrees Radians Sine Cosine\n"; +std::cout << table << std::endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp new file mode 100644 index 0000000..cb74576 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp @@ -0,0 +1,20 @@ +const int size = 6; +MatrixXd mat1(size, size); +mat1.topLeftCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); +mat1.topRightCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); +mat1.bottomLeftCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); +mat1.bottomRightCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); +std::cout << mat1 << std::endl << std::endl; + +MatrixXd mat2(size, size); +mat2.topLeftCorner(size/2, size/2).setZero(); +mat2.topRightCorner(size/2, size/2).setIdentity(); +mat2.bottomLeftCorner(size/2, size/2).setIdentity(); +mat2.bottomRightCorner(size/2, size/2).setZero(); +std::cout << mat2 << std::endl << std::endl; + +MatrixXd mat3(size, size); +mat3 << MatrixXd::Zero(size/2, size/2), MatrixXd::Identity(size/2, size/2), + MatrixXd::Identity(size/2, size/2), MatrixXd::Zero(size/2, size/2); +std::cout << mat3 << std::endl; + diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp new file mode 100644 index 0000000..76a36a3 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp @@ -0,0 +1,13 @@ +std::cout << "A fixed-size array:\n"; +Array33f a1 = Array33f::Zero(); +std::cout << a1 << "\n\n"; + + +std::cout << "A one-dimensional dynamic-size array:\n"; +ArrayXf a2 = ArrayXf::Zero(3); +std::cout << a2 << "\n\n"; + + +std::cout << "A two-dimensional dynamic-size array:\n"; +ArrayXXf a3 = ArrayXXf::Zero(3, 4); +std::cout << a3 << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_rowmajor.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_rowmajor.cpp new file mode 100644 index 0000000..fd45ace --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_rowmajor.cpp @@ -0,0 +1,7 @@ +int array[8]; +for(int i = 0; i < 8; ++i) array[i] = i; +cout << "Column-major:\n" << Map >(array) << endl; +cout << "Row-major:\n" << Map >(array) << endl; +cout << "Row-major using stride:\n" << + Map, Unaligned, Stride<1,4> >(array) << endl; + diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_using.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_using.cpp new file mode 100644 index 0000000..e5e499f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_Map_using.cpp @@ -0,0 +1,21 @@ +typedef Matrix MatrixType; +typedef Map MapType; +typedef Map MapTypeConst; // a read-only map +const int n_dims = 5; + +MatrixType m1(n_dims), m2(n_dims); +m1.setRandom(); +m2.setRandom(); +float *p = &m2(0); // get the address storing the data for m2 +MapType m2map(p,m2.size()); // m2map shares data with m2 +MapTypeConst m2mapconst(p,m2.size()); // a read-only accessor for m2 + +cout << "m1: " << m1 << endl; +cout << "m2: " << m2 << endl; +cout << "Squared euclidean distance: " << (m1-m2).squaredNorm() << endl; +cout << "Squared euclidean distance, using map: " << + (m1-m2map).squaredNorm() << endl; +m2map(3) = 7; // this will change m2, since they share the same array +cout << "Updated m2: " << m2 << endl; +cout << "m2 coefficient 2, constant accessor: " << m2mapconst(2) << endl; +/* m2mapconst(2) = 5; */ // this yields a compile-time error diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Mat.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Mat.cpp new file mode 100644 index 0000000..737afec --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Mat.cpp @@ -0,0 +1,6 @@ +MatrixXf M1(2,6); // Column-major storage +M1 << 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12; + +Map M2(M1.data(), 6,2); +cout << "M2:" << endl << M2 << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Vec.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Vec.cpp new file mode 100644 index 0000000..32980a7 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_ReshapeMat2Vec.cpp @@ -0,0 +1,11 @@ +MatrixXf M1(3,3); // Column-major storage +M1 << 1, 2, 3, + 4, 5, 6, + 7, 8, 9; + +Map v1(M1.data(), M1.size()); +cout << "v1:" << endl << v1 << endl; + +Matrix M2(M1); +Map v2(M2.data(), M2.size()); +cout << "v2:" << endl << v2 << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingCol.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingCol.cpp new file mode 100644 index 0000000..695d130 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingCol.cpp @@ -0,0 +1,11 @@ +MatrixXf M1 = MatrixXf::Random(3,8); +cout << "Column major input:" << endl << M1 << "\n"; +Map > M2(M1.data(), M1.rows(), (M1.cols()+2)/3, OuterStride<>(M1.outerStride()*3)); +cout << "1 column over 3:" << endl << M2 << "\n"; + +typedef Matrix RowMajorMatrixXf; +RowMajorMatrixXf M3(M1); +cout << "Row major input:" << endl << M3 << "\n"; +Map > M4(M3.data(), M3.rows(), (M3.cols()+2)/3, + Stride(M3.outerStride(),3)); +cout << "1 column over 3:" << endl << M4 << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingVec.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingVec.cpp new file mode 100644 index 0000000..9b82246 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_SlicingVec.cpp @@ -0,0 +1,4 @@ +RowVectorXf v = RowVectorXf::LinSpaced(20,0,19); +cout << "Input:" << endl << v << endl; +Map > v2(v.data(), v.size()/2); +cout << "Even:" << v2 << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01.cpp new file mode 100644 index 0000000..47ba31d --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01.cpp @@ -0,0 +1,5 @@ +Matrix3f m; +m << 1, 2, 3, + 4, 5, 6, + 7, 8, 9; +std::cout << m; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01b.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01b.cpp new file mode 100644 index 0000000..2adb2e2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_01b.cpp @@ -0,0 +1,5 @@ +Matrix3f m; +m.row(0) << 1, 2, 3; +m.block(1,0,2,2) << 4, 5, 7, 8; +m.col(2).tail(2) << 6, 9; +std::cout << m; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_02.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_02.cpp new file mode 100644 index 0000000..c960d6a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_commainit_02.cpp @@ -0,0 +1,7 @@ +int rows=5, cols=5; +MatrixXf m(rows,cols); +m << (Matrix3f() << 1, 2, 3, 4, 5, 6, 7, 8, 9).finished(), + MatrixXf::Zero(3,cols-3), + MatrixXf::Zero(rows-3,3), + MatrixXf::Identity(rows-3,cols-3); +cout << m; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp new file mode 100644 index 0000000..e72e715 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp @@ -0,0 +1,4 @@ +VectorXi v = VectorXi::Random(4); +cout << "Here is the vector v:\n"; +for(auto x : v) cout << x << " "; +cout << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp new file mode 100644 index 0000000..4a12d26 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp @@ -0,0 +1,5 @@ +Matrix2i A = Matrix2i::Random(); +cout << "Here are the coeffs of the 2x2 matrix A:\n"; +for(auto x : A.reshaped()) + cout << x << " "; +cout << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_1.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_1.cpp new file mode 100644 index 0000000..e520e8e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_1.cpp @@ -0,0 +1,5 @@ +MatrixXi m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; +m.resize(2,8); +cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp new file mode 100644 index 0000000..50dc454 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp @@ -0,0 +1,6 @@ +Matrix m = Matrix4i::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; +cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; +m.resize(2,8); +cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_matrix_inverse.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_matrix_inverse.cpp new file mode 100644 index 0000000..fff3244 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_matrix_inverse.cpp @@ -0,0 +1,6 @@ +Matrix3f A; +Vector3f b; +A << 1,2,3, 4,5,6, 7,8,10; +b << 3, 3, 4; +Vector3f x = A.inverse() * b; +cout << "The solution is:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_multiple_rhs.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_multiple_rhs.cpp new file mode 100644 index 0000000..5411a44 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_multiple_rhs.cpp @@ -0,0 +1,10 @@ +Matrix3f A(3,3); +A << 1,2,3, 4,5,6, 7,8,10; +Matrix B; +B << 3,1, 3,1, 4,1; +Matrix X; +X = A.fullPivLu().solve(B); +cout << "The solution with right-hand side (3,3,4) is:" << endl; +cout << X.col(0) << endl; +cout << "The solution with right-hand side (1,1,1) is:" << endl; +cout << X.col(1) << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_reuse_decomposition.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_reuse_decomposition.cpp new file mode 100644 index 0000000..3ca0645 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_reuse_decomposition.cpp @@ -0,0 +1,13 @@ +Matrix3f A(3,3); +A << 1,2,3, 4,5,6, 7,8,10; +PartialPivLU luOfA(A); // compute LU decomposition of A +Vector3f b; +b << 3,3,4; +Vector3f x; +x = luOfA.solve(b); +cout << "The solution with right-hand side (3,3,4) is:" << endl; +cout << x << endl; +b << 1,1,1; +x = luOfA.solve(b); +cout << "The solution with right-hand side (1,1,1) is:" << endl; +cout << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_singular.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_singular.cpp new file mode 100644 index 0000000..abff1ef --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_singular.cpp @@ -0,0 +1,9 @@ +Matrix3f A; +Vector3f b; +A << 1,2,3, 4,5,6, 7,8,9; +b << 3, 3, 4; +cout << "Here is the matrix A:" << endl << A << endl; +cout << "Here is the vector b:" << endl << b << endl; +Vector3f x; +x = A.lu().solve(b); +cout << "The solution is:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular.cpp new file mode 100644 index 0000000..9d13f22 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular.cpp @@ -0,0 +1,8 @@ +Matrix3f A; +Vector3f b; +A << 1,2,3, 0,5,6, 0,0,10; +b << 3, 3, 4; +cout << "Here is the matrix A:" << endl << A << endl; +cout << "Here is the vector b:" << endl << b << endl; +Vector3f x = A.triangularView().solve(b); +cout << "The solution is:" << endl << x << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular_inplace.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular_inplace.cpp new file mode 100644 index 0000000..16ae633 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_solve_triangular_inplace.cpp @@ -0,0 +1,6 @@ +Matrix3f A; +Vector3f b; +A << 1,2,3, 0,5,6, 0,0,10; +b << 3, 3, 4; +A.triangularView().solveInPlace(b); +cout << "The solution is:" << endl << b << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort.cpp new file mode 100644 index 0000000..cde2a6f --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort.cpp @@ -0,0 +1,4 @@ +Array4i v = Array4i::Random().abs(); +cout << "Here is the initial vector v:\n" << v.transpose() << "\n"; +std::sort(v.begin(), v.end()); +cout << "Here is the sorted vector v:\n" << v.transpose() << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp b/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp new file mode 100644 index 0000000..0364160 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp @@ -0,0 +1,5 @@ +ArrayXXi A = ArrayXXi::Random(4,4).abs(); +cout << "Here is the initial matrix A:\n" << A << "\n"; +for(auto row : A.rowwise()) + std::sort(row.begin(), row.end()); +cout << "Here is the sorted matrix A:\n" << A << "\n"; diff --git a/lib/eigen-3.4.0/doc/snippets/VectorwiseOp_homogeneous.cpp b/lib/eigen-3.4.0/doc/snippets/VectorwiseOp_homogeneous.cpp new file mode 100644 index 0000000..67cf573 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/VectorwiseOp_homogeneous.cpp @@ -0,0 +1,6 @@ +Matrix3Xd M = Matrix3Xd::Random(3,5); +Projective3d P(Matrix4d::Random()); +cout << "The matrix M is:" << endl << M << endl << endl; +cout << "M.colwise().homogeneous():" << endl << M.colwise().homogeneous() << endl << endl; +cout << "P * M.colwise().homogeneous():" << endl << P * M.colwise().homogeneous() << endl << endl; +cout << "P * M.colwise().homogeneous().hnormalized(): " << endl << (P * M.colwise().homogeneous()).colwise().hnormalized() << endl << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/Vectorwise_reverse.cpp b/lib/eigen-3.4.0/doc/snippets/Vectorwise_reverse.cpp new file mode 100644 index 0000000..2f6a350 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/Vectorwise_reverse.cpp @@ -0,0 +1,10 @@ +MatrixXi m = MatrixXi::Random(3,4); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the rowwise reverse of m:" << endl << m.rowwise().reverse() << endl; +cout << "Here is the colwise reverse of m:" << endl << m.colwise().reverse() << endl; + +cout << "Here is the coefficient (1,0) in the rowise reverse of m:" << endl +<< m.rowwise().reverse()(1,0) << endl; +cout << "Let us overwrite this coefficient with the value 4." << endl; +//m.colwise().reverse()(1,0) = 4; +cout << "Now the matrix m is:" << endl << m << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/class_FullPivLU.cpp b/lib/eigen-3.4.0/doc/snippets/class_FullPivLU.cpp new file mode 100644 index 0000000..fce7fac --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/class_FullPivLU.cpp @@ -0,0 +1,16 @@ +typedef Matrix Matrix5x3; +typedef Matrix Matrix5x5; +Matrix5x3 m = Matrix5x3::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +Eigen::FullPivLU lu(m); +cout << "Here is, up to permutations, its LU decomposition matrix:" + << endl << lu.matrixLU() << endl; +cout << "Here is the L part:" << endl; +Matrix5x5 l = Matrix5x5::Identity(); +l.block<5,3>(0,0).triangularView() = lu.matrixLU(); +cout << l << endl; +cout << "Here is the U part:" << endl; +Matrix5x3 u = lu.matrixLU().triangularView(); +cout << u << endl; +cout << "Let us now reconstruct the original matrix m:" << endl; +cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/compile_snippet.cpp.in b/lib/eigen-3.4.0/doc/snippets/compile_snippet.cpp.in new file mode 100644 index 0000000..c11457a --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/compile_snippet.cpp.in @@ -0,0 +1,23 @@ +static bool eigen_did_assert = false; +#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;} + +#include +#include + +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif + + +using namespace Eigen; +using namespace std; + +int main(int, char**) +{ + cout.precision(3); +// intentionally remove indentation of snippet +{ +${snippet_source_code} +} + return 0; +} diff --git a/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_redux_minmax.cpp b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_redux_minmax.cpp new file mode 100644 index 0000000..f4ae7f4 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_redux_minmax.cpp @@ -0,0 +1,12 @@ + Matrix3f m = Matrix3f::Random(); + std::ptrdiff_t i, j; + float minOfM = m.minCoeff(&i,&j); + cout << "Here is the matrix m:\n" << m << endl; + cout << "Its minimum coefficient (" << minOfM + << ") is at position (" << i << "," << j << ")\n\n"; + + RowVector4i v = RowVector4i::Random(); + int maxOfV = v.maxCoeff(&i); + cout << "Here is the vector v: " << v << endl; + cout << "Its maximum coefficient (" << maxOfV + << ") is at position " << i << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_aliasing.cpp b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_aliasing.cpp new file mode 100644 index 0000000..f82e6f2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_aliasing.cpp @@ -0,0 +1,5 @@ +Matrix2i a; a << 1, 2, 3, 4; +cout << "Here is the matrix a:\n" << a << endl; + +a = a.transpose(); // !!! do NOT do this !!! +cout << "and the result of the aliasing effect:\n" << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_conjugate.cpp b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_conjugate.cpp new file mode 100644 index 0000000..88496b2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_conjugate.cpp @@ -0,0 +1,12 @@ +MatrixXcf a = MatrixXcf::Random(2,2); +cout << "Here is the matrix a\n" << a << endl; + +cout << "Here is the matrix a^T\n" << a.transpose() << endl; + + +cout << "Here is the conjugate of a\n" << a.conjugate() << endl; + + +cout << "Here is the matrix a^*\n" << a.adjoint() << endl; + + diff --git a/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_inplace.cpp b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_inplace.cpp new file mode 100644 index 0000000..5c81c9e --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/tut_arithmetic_transpose_inplace.cpp @@ -0,0 +1,6 @@ +MatrixXf a(2,3); a << 1, 2, 3, 4, 5, 6; +cout << "Here is the initial matrix a:\n" << a << endl; + + +a.transposeInPlace(); +cout << "and after being transposed:\n" << a << endl; diff --git a/lib/eigen-3.4.0/doc/snippets/tut_matrix_assignment_resizing.cpp b/lib/eigen-3.4.0/doc/snippets/tut_matrix_assignment_resizing.cpp new file mode 100644 index 0000000..cf18998 --- /dev/null +++ b/lib/eigen-3.4.0/doc/snippets/tut_matrix_assignment_resizing.cpp @@ -0,0 +1,5 @@ +MatrixXf a(2,2); +std::cout << "a is of size " << a.rows() << "x" << a.cols() << std::endl; +MatrixXf b(3,3); +a = b; +std::cout << "a is now of size " << a.rows() << "x" << a.cols() << std::endl; diff --git a/lib/eigen-3.4.0/doc/special_examples/CMakeLists.txt b/lib/eigen-3.4.0/doc/special_examples/CMakeLists.txt new file mode 100644 index 0000000..5b00e8b --- /dev/null +++ b/lib/eigen-3.4.0/doc/special_examples/CMakeLists.txt @@ -0,0 +1,34 @@ +if(NOT EIGEN_TEST_NOQT) + find_package(Qt4) + if(QT4_FOUND) + include(${QT_USE_FILE}) + endif() +endif() + +if(QT4_FOUND) + add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp) + target_link_libraries(Tutorial_sparse_example ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) + + add_custom_command( + TARGET Tutorial_sparse_example + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../html/ + COMMAND Tutorial_sparse_example ARGS ${CMAKE_CURRENT_BINARY_DIR}/../html/Tutorial_sparse_example.jpeg + ) + + add_dependencies(all_examples Tutorial_sparse_example) +endif() + +if(EIGEN_COMPILER_SUPPORT_CPP11) + add_executable(random_cpp11 random_cpp11.cpp) + target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + add_dependencies(all_examples random_cpp11) + ei_add_target_property(random_cpp11 COMPILE_FLAGS "-std=c++11") + + add_custom_command( + TARGET random_cpp11 + POST_BUILD + COMMAND random_cpp11 + ARGS >${CMAKE_CURRENT_BINARY_DIR}/random_cpp11.out + ) +endif() diff --git a/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example.cpp b/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example.cpp new file mode 100644 index 0000000..8850db0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example.cpp @@ -0,0 +1,38 @@ +#include +#include +#include + +typedef Eigen::SparseMatrix SpMat; // declares a column-major sparse matrix type of double +typedef Eigen::Triplet T; + +void buildProblem(std::vector& coefficients, Eigen::VectorXd& b, int n); +void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename); + +int main(int argc, char** argv) +{ + if(argc!=2) { + std::cerr << "Error: expected one and only one argument.\n"; + return -1; + } + + int n = 300; // size of the image + int m = n*n; // number of unknowns (=number of pixels) + + // Assembly: + std::vector coefficients; // list of non-zeros coefficients + Eigen::VectorXd b(m); // the right hand side-vector resulting from the constraints + buildProblem(coefficients, b, n); + + SpMat A(m,m); + A.setFromTriplets(coefficients.begin(), coefficients.end()); + + // Solving: + Eigen::SimplicialCholesky chol(A); // performs a Cholesky factorization of A + Eigen::VectorXd x = chol.solve(b); // use the factorization to solve for the given right hand side + + // Export the result to a file: + saveAsBitmap(x, n, argv[1]); + + return 0; +} + diff --git a/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example_details.cpp b/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example_details.cpp new file mode 100644 index 0000000..bc18b01 --- /dev/null +++ b/lib/eigen-3.4.0/doc/special_examples/Tutorial_sparse_example_details.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +typedef Eigen::SparseMatrix SpMat; // declares a column-major sparse matrix type of double +typedef Eigen::Triplet T; + +void insertCoefficient(int id, int i, int j, double w, std::vector& coeffs, + Eigen::VectorXd& b, const Eigen::VectorXd& boundary) +{ + int n = int(boundary.size()); + int id1 = i+j*n; + + if(i==-1 || i==n) b(id) -= w * boundary(j); // constrained coefficient + else if(j==-1 || j==n) b(id) -= w * boundary(i); // constrained coefficient + else coeffs.push_back(T(id,id1,w)); // unknown coefficient +} + +void buildProblem(std::vector& coefficients, Eigen::VectorXd& b, int n) +{ + b.setZero(); + Eigen::ArrayXd boundary = Eigen::ArrayXd::LinSpaced(n, 0,M_PI).sin().pow(2); + for(int j=0; j bits = (x*255).cast(); + QImage img(bits.data(), n,n,QImage::Format_Indexed8); + img.setColorCount(256); + for(int i=0;i<256;i++) img.setColor(i,qRgb(i,i,i)); + img.save(filename); +} diff --git a/lib/eigen-3.4.0/doc/special_examples/random_cpp11.cpp b/lib/eigen-3.4.0/doc/special_examples/random_cpp11.cpp new file mode 100644 index 0000000..33744c0 --- /dev/null +++ b/lib/eigen-3.4.0/doc/special_examples/random_cpp11.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +using namespace Eigen; + +int main() { + std::default_random_engine generator; + std::poisson_distribution distribution(4.1); + auto poisson = [&] () {return distribution(generator);}; + + RowVectorXi v = RowVectorXi::NullaryExpr(10, poisson ); + std::cout << v << "\n"; +} diff --git a/lib/eigen-3.4.0/doc/tutorial.cpp b/lib/eigen-3.4.0/doc/tutorial.cpp new file mode 100644 index 0000000..62be7c2 --- /dev/null +++ b/lib/eigen-3.4.0/doc/tutorial.cpp @@ -0,0 +1,62 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout.precision(2); + + // demo static functions + Eigen::Matrix3f m3 = Eigen::Matrix3f::Random(); + Eigen::Matrix4f m4 = Eigen::Matrix4f::Identity(); + + std::cout << "*** Step 1 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; + + // demo non-static set... functions + m4.setZero(); + m3.diagonal().setOnes(); + + std::cout << "*** Step 2 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; + + // demo fixed-size block() expression as lvalue and as rvalue + m4.block<3,3>(0,1) = m3; + m3.row(2) = m4.block<1,3>(2,0); + + std::cout << "*** Step 3 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; + + // demo dynamic-size block() + { + int rows = 3, cols = 3; + m4.block(0,1,3,3).setIdentity(); + std::cout << "*** Step 4 ***\nm4:\n" << m4 << std::endl; + } + + // demo vector blocks + m4.diagonal().block(1,2).setOnes(); + std::cout << "*** Step 5 ***\nm4.diagonal():\n" << m4.diagonal() << std::endl; + std::cout << "m4.diagonal().start(3)\n" << m4.diagonal().start(3) << std::endl; + + // demo coeff-wise operations + m4 = m4.cwise()*m4; + m3 = m3.cwise().cos(); + std::cout << "*** Step 6 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; + + // sums of coefficients + std::cout << "*** Step 7 ***\n m4.sum(): " << m4.sum() << std::endl; + std::cout << "m4.col(2).sum(): " << m4.col(2).sum() << std::endl; + std::cout << "m4.colwise().sum():\n" << m4.colwise().sum() << std::endl; + std::cout << "m4.rowwise().sum():\n" << m4.rowwise().sum() << std::endl; + + // demo intelligent auto-evaluation + m4 = m4 * m4; // auto-evaluates so no aliasing problem (performance penalty is low) + Eigen::Matrix4f other = (m4 * m4).lazy(); // forces lazy evaluation + m4 = m4 + m4; // here Eigen goes for lazy evaluation, as with most expressions + m4 = -m4 + m4 + 5 * m4; // same here, Eigen chooses lazy evaluation for all that. + m4 = m4 * (m4 + m4); // here Eigen chooses to first evaluate m4 + m4 into a temporary. + // indeed, here it is an optimization to cache this intermediate result. + m3 = m3 * m4.block<3,3>(1,1); // here Eigen chooses NOT to evaluate block() into a temporary + // because accessing coefficients of that block expression is not more costly than accessing + // coefficients of a plain matrix. + m4 = m4 * m4.transpose(); // same here, lazy evaluation of the transpose. + m4 = m4 * m4.transpose().eval(); // forces immediate evaluation of the transpose + + std::cout << "*** Step 8 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; +} diff --git a/lib/eigen-3.4.0/eigen3.pc.in b/lib/eigen-3.4.0/eigen3.pc.in new file mode 100644 index 0000000..3368a3a --- /dev/null +++ b/lib/eigen-3.4.0/eigen3.pc.in @@ -0,0 +1,9 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} + +Name: Eigen3 +Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms +Requires: +Version: @EIGEN_VERSION_NUMBER@ +Libs: +Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@ diff --git a/lib/eigen-3.4.0/failtest/CMakeLists.txt b/lib/eigen-3.4.0/failtest/CMakeLists.txt new file mode 100644 index 0000000..256e541 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/CMakeLists.txt @@ -0,0 +1,70 @@ + +ei_add_failtest("failtest_sanity_check") + +ei_add_failtest("block_nonconst_ctor_on_const_xpr_0") +ei_add_failtest("block_nonconst_ctor_on_const_xpr_1") +ei_add_failtest("block_nonconst_ctor_on_const_xpr_2") +ei_add_failtest("transpose_nonconst_ctor_on_const_xpr") +ei_add_failtest("diagonal_nonconst_ctor_on_const_xpr") +ei_add_failtest("cwiseunaryview_nonconst_ctor_on_const_xpr") +ei_add_failtest("triangularview_nonconst_ctor_on_const_xpr") +ei_add_failtest("selfadjointview_nonconst_ctor_on_const_xpr") + +ei_add_failtest("const_qualified_block_method_retval_0") +ei_add_failtest("const_qualified_block_method_retval_1") +ei_add_failtest("const_qualified_transpose_method_retval") +ei_add_failtest("const_qualified_diagonal_method_retval") + +ei_add_failtest("map_nonconst_ctor_on_const_ptr_0") +ei_add_failtest("map_nonconst_ctor_on_const_ptr_1") +ei_add_failtest("map_nonconst_ctor_on_const_ptr_2") +ei_add_failtest("map_nonconst_ctor_on_const_ptr_3") +ei_add_failtest("map_nonconst_ctor_on_const_ptr_4") + +ei_add_failtest("map_on_const_type_actually_const_0") +ei_add_failtest("map_on_const_type_actually_const_1") +ei_add_failtest("block_on_const_type_actually_const_0") +ei_add_failtest("block_on_const_type_actually_const_1") +ei_add_failtest("transpose_on_const_type_actually_const") +ei_add_failtest("diagonal_on_const_type_actually_const") +ei_add_failtest("cwiseunaryview_on_const_type_actually_const") +ei_add_failtest("triangularview_on_const_type_actually_const") +ei_add_failtest("selfadjointview_on_const_type_actually_const") + +ei_add_failtest("ref_1") +ei_add_failtest("ref_2") +ei_add_failtest("ref_3") +ei_add_failtest("ref_4") +ei_add_failtest("ref_5") + +ei_add_failtest("swap_1") +ei_add_failtest("swap_2") + +ei_add_failtest("ternary_1") +ei_add_failtest("ternary_2") + +ei_add_failtest("sparse_ref_1") +ei_add_failtest("sparse_ref_2") +ei_add_failtest("sparse_ref_3") +ei_add_failtest("sparse_ref_4") +ei_add_failtest("sparse_ref_5") + +ei_add_failtest("sparse_storage_mismatch") + +ei_add_failtest("partialpivlu_int") +ei_add_failtest("fullpivlu_int") +ei_add_failtest("llt_int") +ei_add_failtest("ldlt_int") +ei_add_failtest("qr_int") +ei_add_failtest("colpivqr_int") +ei_add_failtest("fullpivqr_int") +ei_add_failtest("jacobisvd_int") +ei_add_failtest("bdcsvd_int") +ei_add_failtest("eigensolver_int") +ei_add_failtest("eigensolver_cplx") + +if(EIGEN_TEST_CXX11) + ei_add_failtest("initializer_list_1") + ei_add_failtest("initializer_list_2") +endif() + diff --git a/lib/eigen-3.4.0/failtest/bdcsvd_int.cpp b/lib/eigen-3.4.0/failtest/bdcsvd_int.cpp new file mode 100644 index 0000000..670752c --- /dev/null +++ b/lib/eigen-3.4.0/failtest/bdcsvd_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/SVD" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + BDCSVD > qr(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_0.cpp b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_0.cpp new file mode 100644 index 0000000..40b8201 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_0.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Block b(m,0,0); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_1.cpp b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_1.cpp new file mode 100644 index 0000000..ef6d537 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_1.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Block b(m,0,0,3,3); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_2.cpp b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_2.cpp new file mode 100644 index 0000000..43f18ae --- /dev/null +++ b/lib/eigen-3.4.0/failtest/block_nonconst_ctor_on_const_xpr_2.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + // row/column constructor + Block b(m,0); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_0.cpp b/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_0.cpp new file mode 100644 index 0000000..009bebe --- /dev/null +++ b/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_0.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + Matrix3f m; + Block(m, 0, 0, 3, 3).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_1.cpp b/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_1.cpp new file mode 100644 index 0000000..4c3e93f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/block_on_const_type_actually_const_1.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + Block(m, 0, 0).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/colpivqr_int.cpp b/lib/eigen-3.4.0/failtest/colpivqr_int.cpp new file mode 100644 index 0000000..db11910 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/colpivqr_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/QR" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + ColPivHouseholderQR > qr(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_0.cpp b/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_0.cpp new file mode 100644 index 0000000..a6bd5fe --- /dev/null +++ b/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_0.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Block b(m.block<3,3>(0,0)); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_1.cpp b/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_1.cpp new file mode 100644 index 0000000..ef40c24 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/const_qualified_block_method_retval_1.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Block b(m.block(0,0,3,3)); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/const_qualified_diagonal_method_retval.cpp b/lib/eigen-3.4.0/failtest/const_qualified_diagonal_method_retval.cpp new file mode 100644 index 0000000..809594a --- /dev/null +++ b/lib/eigen-3.4.0/failtest/const_qualified_diagonal_method_retval.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Diagonal b(m.diagonal()); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/const_qualified_transpose_method_retval.cpp b/lib/eigen-3.4.0/failtest/const_qualified_transpose_method_retval.cpp new file mode 100644 index 0000000..2d7f19c --- /dev/null +++ b/lib/eigen-3.4.0/failtest/const_qualified_transpose_method_retval.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Transpose b(m.transpose()); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp b/lib/eigen-3.4.0/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 0000000..e23cf8f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + CwiseUnaryView,Matrix3d> t(m); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/cwiseunaryview_on_const_type_actually_const.cpp b/lib/eigen-3.4.0/failtest/cwiseunaryview_on_const_type_actually_const.cpp new file mode 100644 index 0000000..fcd41df --- /dev/null +++ b/lib/eigen-3.4.0/failtest/cwiseunaryview_on_const_type_actually_const.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + CwiseUnaryView,CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp b/lib/eigen-3.4.0/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 0000000..76398a2 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Diagonal d(m); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/diagonal_on_const_type_actually_const.cpp b/lib/eigen-3.4.0/failtest/diagonal_on_const_type_actually_const.cpp new file mode 100644 index 0000000..d4b2fd9 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/diagonal_on_const_type_actually_const.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + Diagonal(m).coeffRef(0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/eigensolver_cplx.cpp b/lib/eigen-3.4.0/failtest/eigensolver_cplx.cpp new file mode 100644 index 0000000..c2e21e1 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/eigensolver_cplx.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Eigenvalues" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR std::complex +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + EigenSolver > eig(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/eigensolver_int.cpp b/lib/eigen-3.4.0/failtest/eigensolver_int.cpp new file mode 100644 index 0000000..eda8dc2 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/eigensolver_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Eigenvalues" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + EigenSolver > eig(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/failtest_sanity_check.cpp b/lib/eigen-3.4.0/failtest/failtest_sanity_check.cpp new file mode 100644 index 0000000..769fa94 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/failtest_sanity_check.cpp @@ -0,0 +1,5 @@ +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +This is just some text that won't compile as a C++ file, as a basic sanity check for failtest. +#else +int main() {} +#endif diff --git a/lib/eigen-3.4.0/failtest/fullpivlu_int.cpp b/lib/eigen-3.4.0/failtest/fullpivlu_int.cpp new file mode 100644 index 0000000..e9d2c6e --- /dev/null +++ b/lib/eigen-3.4.0/failtest/fullpivlu_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/LU" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + FullPivLU > lu(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/fullpivqr_int.cpp b/lib/eigen-3.4.0/failtest/fullpivqr_int.cpp new file mode 100644 index 0000000..d182a7b --- /dev/null +++ b/lib/eigen-3.4.0/failtest/fullpivqr_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/QR" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + FullPivHouseholderQR > qr(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/initializer_list_1.cpp b/lib/eigen-3.4.0/failtest/initializer_list_1.cpp new file mode 100644 index 0000000..92dfd1f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/initializer_list_1.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define ROWS Dynamic +#else +#define ROWS 3 +#endif + +using namespace Eigen; + +int main() +{ + Matrix {1, 2, 3}; +} diff --git a/lib/eigen-3.4.0/failtest/initializer_list_2.cpp b/lib/eigen-3.4.0/failtest/initializer_list_2.cpp new file mode 100644 index 0000000..1996050 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/initializer_list_2.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define ROWS Dynamic +#define COLS Dynamic +#else +#define ROWS 3 +#define COLS 1 +#endif + +using namespace Eigen; + +int main() +{ + Matrix {1, 2, 3}; +} diff --git a/lib/eigen-3.4.0/failtest/jacobisvd_int.cpp b/lib/eigen-3.4.0/failtest/jacobisvd_int.cpp new file mode 100644 index 0000000..12790ae --- /dev/null +++ b/lib/eigen-3.4.0/failtest/jacobisvd_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/SVD" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + JacobiSVD > qr(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/ldlt_int.cpp b/lib/eigen-3.4.0/failtest/ldlt_int.cpp new file mode 100644 index 0000000..243e457 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ldlt_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Cholesky" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + LDLT > ldlt(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/llt_int.cpp b/lib/eigen-3.4.0/failtest/llt_int.cpp new file mode 100644 index 0000000..cb02065 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/llt_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Cholesky" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + LLT > llt(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_0.cpp b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_0.cpp new file mode 100644 index 0000000..d75686f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_0.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER float *ptr){ + Map m(ptr); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_1.cpp b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_1.cpp new file mode 100644 index 0000000..eda134d --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_1.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER float *ptr, DenseIndex size){ + Map m(ptr, size); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_2.cpp b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_2.cpp new file mode 100644 index 0000000..06b4b62 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_2.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ + Map m(ptr, rows, cols); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_3.cpp b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_3.cpp new file mode 100644 index 0000000..830f6f0 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_3.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ + Map > m(ptr, rows, cols, InnerStride<2>()); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_4.cpp b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_4.cpp new file mode 100644 index 0000000..c3e8c95 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_nonconst_ctor_on_const_ptr_4.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER +#else +#define CV_QUALIFIER const +#endif + +using namespace Eigen; + +void foo(const float *ptr, DenseIndex rows, DenseIndex cols){ + Map > m(ptr, rows, cols, OuterStride<>(2)); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_0.cpp b/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_0.cpp new file mode 100644 index 0000000..8cb6aa0 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_0.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(float *ptr){ + Map(ptr, 1, 1).coeffRef(0,0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_1.cpp b/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_1.cpp new file mode 100644 index 0000000..04e067c --- /dev/null +++ b/lib/eigen-3.4.0/failtest/map_on_const_type_actually_const_1.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(float *ptr){ + Map(ptr).coeffRef(0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/partialpivlu_int.cpp b/lib/eigen-3.4.0/failtest/partialpivlu_int.cpp new file mode 100644 index 0000000..98ef282 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/partialpivlu_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/LU" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + PartialPivLU > lu(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/qr_int.cpp b/lib/eigen-3.4.0/failtest/qr_int.cpp new file mode 100644 index 0000000..ce200e8 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/qr_int.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/QR" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define SCALAR int +#else +#define SCALAR float +#endif + +using namespace Eigen; + +int main() +{ + HouseholderQR > qr(Matrix::Random(10,10)); +} diff --git a/lib/eigen-3.4.0/failtest/ref_1.cpp b/lib/eigen-3.4.0/failtest/ref_1.cpp new file mode 100644 index 0000000..8b798d5 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ref_1.cpp @@ -0,0 +1,18 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void call_ref(Ref a) { } + +int main() +{ + VectorXf a(10); + CV_QUALIFIER VectorXf& ac(a); + call_ref(ac); +} diff --git a/lib/eigen-3.4.0/failtest/ref_2.cpp b/lib/eigen-3.4.0/failtest/ref_2.cpp new file mode 100644 index 0000000..0b779cc --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ref_2.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +void call_ref(Ref a) { } + +int main() +{ + MatrixXf A(10,10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(A.row(3)); +#else + call_ref(A.col(3)); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/ref_3.cpp b/lib/eigen-3.4.0/failtest/ref_3.cpp new file mode 100644 index 0000000..f46027d --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ref_3.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +void call_ref(Ref a) { } +#else +void call_ref(const Ref &a) { } +#endif + +int main() +{ + VectorXf a(10); + call_ref(a+a); +} diff --git a/lib/eigen-3.4.0/failtest/ref_4.cpp b/lib/eigen-3.4.0/failtest/ref_4.cpp new file mode 100644 index 0000000..6c11fa4 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ref_4.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +void call_ref(Ref > a) {} + +int main() +{ + MatrixXf A(10,10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(A.transpose()); +#else + call_ref(A); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/ref_5.cpp b/lib/eigen-3.4.0/failtest/ref_5.cpp new file mode 100644 index 0000000..846d527 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ref_5.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +void call_ref(Ref a) { } + +int main() +{ + VectorXf a(10); + DenseBase &ac(a); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(ac); +#else + call_ref(ac.derived()); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp b/lib/eigen-3.4.0/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 0000000..a240f81 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + SelfAdjointView t(m); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/selfadjointview_on_const_type_actually_const.cpp b/lib/eigen-3.4.0/failtest/selfadjointview_on_const_type_actually_const.cpp new file mode 100644 index 0000000..19aaad6 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/selfadjointview_on_const_type_actually_const.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + SelfAdjointView(m).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/sparse_ref_1.cpp b/lib/eigen-3.4.0/failtest/sparse_ref_1.cpp new file mode 100644 index 0000000..d78d1f9 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_ref_1.cpp @@ -0,0 +1,18 @@ +#include "../Eigen/Sparse" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void call_ref(Ref > a) { } + +int main() +{ + SparseMatrix a(10,10); + CV_QUALIFIER SparseMatrix& ac(a); + call_ref(ac); +} diff --git a/lib/eigen-3.4.0/failtest/sparse_ref_2.cpp b/lib/eigen-3.4.0/failtest/sparse_ref_2.cpp new file mode 100644 index 0000000..46c9440 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_ref_2.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Sparse" + +using namespace Eigen; + +void call_ref(Ref > a) { } + +int main() +{ + SparseMatrix A(10,10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(A.row(3)); +#else + call_ref(A.col(3)); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/sparse_ref_3.cpp b/lib/eigen-3.4.0/failtest/sparse_ref_3.cpp new file mode 100644 index 0000000..a9949b5 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_ref_3.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Sparse" + +using namespace Eigen; + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +void call_ref(Ref > a) { } +#else +void call_ref(const Ref > &a) { } +#endif + +int main() +{ + SparseMatrix a(10,10); + call_ref(a+a); +} diff --git a/lib/eigen-3.4.0/failtest/sparse_ref_4.cpp b/lib/eigen-3.4.0/failtest/sparse_ref_4.cpp new file mode 100644 index 0000000..57bb6a1 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_ref_4.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Sparse" + +using namespace Eigen; + +void call_ref(Ref > a) {} + +int main() +{ + SparseMatrix A(10,10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(A.transpose()); +#else + call_ref(A); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/sparse_ref_5.cpp b/lib/eigen-3.4.0/failtest/sparse_ref_5.cpp new file mode 100644 index 0000000..4478f6f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_ref_5.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Sparse" + +using namespace Eigen; + +void call_ref(Ref > a) { } + +int main() +{ + SparseMatrix a(10,10); + SparseMatrixBase > &ac(a); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + call_ref(ac); +#else + call_ref(ac.derived()); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/sparse_storage_mismatch.cpp b/lib/eigen-3.4.0/failtest/sparse_storage_mismatch.cpp new file mode 100644 index 0000000..51840d4 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/sparse_storage_mismatch.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Sparse" +using namespace Eigen; + +typedef SparseMatrix Mat1; +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +typedef SparseMatrix Mat2; +#else +typedef SparseMatrix Mat2; +#endif + +int main() +{ + Mat1 a(10,10); + Mat2 b(10,10); + a += b; +} diff --git a/lib/eigen-3.4.0/failtest/swap_1.cpp b/lib/eigen-3.4.0/failtest/swap_1.cpp new file mode 100644 index 0000000..1063797 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/swap_1.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +int main() +{ + VectorXf a(10), b(10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + const DenseBase &ac(a); +#else + DenseBase &ac(a); +#endif + b.swap(ac); +} diff --git a/lib/eigen-3.4.0/failtest/swap_2.cpp b/lib/eigen-3.4.0/failtest/swap_2.cpp new file mode 100644 index 0000000..b386cf4 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/swap_2.cpp @@ -0,0 +1,14 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +int main() +{ + VectorXf a(10), b(10); + VectorXf const &ac(a); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + b.swap(ac); +#else + b.swap(ac.const_cast_derived()); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/ternary_1.cpp b/lib/eigen-3.4.0/failtest/ternary_1.cpp new file mode 100644 index 0000000..b40bcb0 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ternary_1.cpp @@ -0,0 +1,13 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +int main(int argc,char **) +{ + VectorXf a(10), b(10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + b = argc>1 ? 2*a : -a; +#else + b = argc>1 ? 2*a : VectorXf(-a); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/ternary_2.cpp b/lib/eigen-3.4.0/failtest/ternary_2.cpp new file mode 100644 index 0000000..a46b12b --- /dev/null +++ b/lib/eigen-3.4.0/failtest/ternary_2.cpp @@ -0,0 +1,13 @@ +#include "../Eigen/Core" + +using namespace Eigen; + +int main(int argc,char **) +{ + VectorXf a(10), b(10); +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD + b = argc>1 ? 2*a : a+a; +#else + b = argc>1 ? VectorXf(2*a) : VectorXf(a+a); +#endif +} diff --git a/lib/eigen-3.4.0/failtest/transpose_nonconst_ctor_on_const_xpr.cpp b/lib/eigen-3.4.0/failtest/transpose_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 0000000..4223e7f --- /dev/null +++ b/lib/eigen-3.4.0/failtest/transpose_nonconst_ctor_on_const_xpr.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + Transpose t(m); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/transpose_on_const_type_actually_const.cpp b/lib/eigen-3.4.0/failtest/transpose_on_const_type_actually_const.cpp new file mode 100644 index 0000000..d0b7d0d --- /dev/null +++ b/lib/eigen-3.4.0/failtest/transpose_on_const_type_actually_const.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + Transpose(m).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp b/lib/eigen-3.4.0/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 0000000..807447e --- /dev/null +++ b/lib/eigen-3.4.0/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp @@ -0,0 +1,15 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(CV_QUALIFIER Matrix3d &m){ + TriangularView t(m); +} + +int main() {} diff --git a/lib/eigen-3.4.0/failtest/triangularview_on_const_type_actually_const.cpp b/lib/eigen-3.4.0/failtest/triangularview_on_const_type_actually_const.cpp new file mode 100644 index 0000000..0a381a6 --- /dev/null +++ b/lib/eigen-3.4.0/failtest/triangularview_on_const_type_actually_const.cpp @@ -0,0 +1,16 @@ +#include "../Eigen/Core" + +#ifdef EIGEN_SHOULD_FAIL_TO_BUILD +#define CV_QUALIFIER const +#else +#define CV_QUALIFIER +#endif + +using namespace Eigen; + +void foo(){ + MatrixXf m; + TriangularView(m).coeffRef(0, 0) = 1.0f; +} + +int main() {} diff --git a/lib/eigen-3.4.0/lapack/CMakeLists.txt b/lib/eigen-3.4.0/lapack/CMakeLists.txt new file mode 100644 index 0000000..e48497f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/CMakeLists.txt @@ -0,0 +1,452 @@ + +project(EigenLapack CXX) + +include(CheckLanguage) +check_language(Fortran) +if(CMAKE_Fortran_COMPILER) + enable_language(Fortran) + set(EIGEN_Fortran_COMPILER_WORKS ON) +else() + set(EIGEN_Fortran_COMPILER_WORKS OFF) +endif() + +add_custom_target(lapack) +include_directories(../blas) + +set(EigenLapack_SRCS +single.cpp double.cpp complex_single.cpp complex_double.cpp ../blas/xerbla.cpp +) + +if(EIGEN_Fortran_COMPILER_WORKS) + +set(EigenLapack_SRCS ${EigenLapack_SRCS} + slarft.f dlarft.f clarft.f zlarft.f + slarfb.f dlarfb.f clarfb.f zlarfb.f + slarfg.f dlarfg.f clarfg.f zlarfg.f + slarf.f dlarf.f clarf.f zlarf.f + sladiv.f dladiv.f cladiv.f zladiv.f + ilaslr.f iladlr.f ilaclr.f ilazlr.f + ilaslc.f iladlc.f ilaclc.f ilazlc.f + dlapy2.f dlapy3.f slapy2.f slapy3.f + clacgv.f zlacgv.f + slamch.f dlamch.f + second_NONE.f dsecnd_NONE.f +) + +option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests") + +if(EIGEN_ENABLE_LAPACK_TESTS) + + get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) + if(NOT EXISTS ${eigen_full_path_to_reference_lapack}) + # Download lapack and install sources and testing at the right place + message(STATUS "Download lapack_addons_3.4.1.tgz...") + + file(DOWNLOAD "http://downloads.tuxfamily.org/eigen/lapack_addons_3.4.1.tgz" + "${CMAKE_CURRENT_SOURCE_DIR}/lapack_addons_3.4.1.tgz" + INACTIVITY_TIMEOUT 15 + TIMEOUT 240 + STATUS download_status + EXPECTED_MD5 ab5742640617e3221a873aba44bbdc93 + SHOW_PROGRESS) + + message(STATUS ${download_status}) + list(GET download_status 0 download_status_num) + set(download_status_num 0) + if(download_status_num EQUAL 0) + message(STATUS "Setup lapack reference and lapack unit tests") + execute_process(COMMAND tar xzf "lapack_addons_3.4.1.tgz" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + else() + message(STATUS "Download of lapack_addons_3.4.1.tgz failed, LAPACK unit tests won't be enabled") + set(EIGEN_ENABLE_LAPACK_TESTS false) + endif() + + endif() + + get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) + if(EXISTS ${eigen_full_path_to_reference_lapack}) + set(EigenLapack_funcfilenames + ssyev.f dsyev.f csyev.f zsyev.f + spotrf.f dpotrf.f cpotrf.f zpotrf.f + spotrs.f dpotrs.f cpotrs.f zpotrs.f + sgetrf.f dgetrf.f cgetrf.f zgetrf.f + sgetrs.f dgetrs.f cgetrs.f zgetrs.f) + + file(GLOB ReferenceLapack_SRCS0 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "reference/*.f") + foreach(filename1 IN LISTS ReferenceLapack_SRCS0) + string(REPLACE "reference/" "" filename ${filename1}) + list(FIND EigenLapack_SRCS ${filename} id1) + list(FIND EigenLapack_funcfilenames ${filename} id2) + if((id1 EQUAL -1) AND (id2 EQUAL -1)) + set(ReferenceLapack_SRCS ${ReferenceLapack_SRCS} reference/${filename}) + endif() + endforeach() + endif() + + +endif() + +endif() + +set(EIGEN_LAPACK_TARGETS "") + +add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) +list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack_static) + +if (EIGEN_BUILD_SHARED_LIBS) + add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) + list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack) + target_link_libraries(eigen_lapack eigen_blas) +endif() + +foreach(target IN LISTS EIGEN_LAPACK_TARGETS) + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + endif() + add_dependencies(lapack ${target}) + install(TARGETS ${target} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +endforeach() + + +get_filename_component(eigen_full_path_to_testing_lapack "./testing/" ABSOLUTE) +if(EXISTS ${eigen_full_path_to_testing_lapack}) + + # The following comes from lapack/TESTING/CMakeLists.txt + # Get Python + find_package(PythonInterp) + message(STATUS "Looking for Python found - ${PYTHONINTERP_FOUND}") + if (PYTHONINTERP_FOUND) + message(STATUS "Using Python version ${PYTHON_VERSION_STRING}") + endif() + + set(LAPACK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(LAPACK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(BUILD_SINGLE true) + set(BUILD_DOUBLE true) + set(BUILD_COMPLEX true) + set(BUILD_COMPLEX16E true) + + if(MSVC_VERSION) +# string(REPLACE "/STACK:10000000" "/STACK:900000000000000000" +# CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + string(REGEX REPLACE "(.*)/STACK:(.*) (.*)" "\\1/STACK:900000000000000000 \\3" + CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + endif() + file(MAKE_DIRECTORY "${LAPACK_BINARY_DIR}/TESTING") + add_subdirectory(testing/MATGEN) + add_subdirectory(testing/LIN) + add_subdirectory(testing/EIG) + macro(add_lapack_test output input target) + set(TEST_INPUT "${LAPACK_SOURCE_DIR}/testing/${input}") + set(TEST_OUTPUT "${LAPACK_BINARY_DIR}/TESTING/${output}") + string(REPLACE "." "_" input_name ${input}) + set(testName "${target}_${input_name}") + if(EXISTS "${TEST_INPUT}") + add_test(NAME LAPACK-${testName} + COMMAND "${CMAKE_COMMAND}" + -DTEST=$ + -DINPUT=${TEST_INPUT} + -DOUTPUT=${TEST_OUTPUT} + -DINTDIR=${CMAKE_CFG_INTDIR} + -P "${LAPACK_SOURCE_DIR}/testing/runtest.cmake") + endif() + endmacro() + + if (BUILD_SINGLE) + add_lapack_test(stest.out stest.in xlintsts) + # + # ======== SINGLE RFP LIN TESTS ======================== + add_lapack_test(stest_rfp.out stest_rfp.in xlintstrfs) + # + # + # ======== SINGLE EIG TESTS =========================== + # + + add_lapack_test(snep.out nep.in xeigtsts) + + + add_lapack_test(ssep.out sep.in xeigtsts) + + + add_lapack_test(ssvd.out svd.in xeigtsts) + + + add_lapack_test(sec.out sec.in xeigtsts) + + + add_lapack_test(sed.out sed.in xeigtsts) + + + add_lapack_test(sgg.out sgg.in xeigtsts) + + + add_lapack_test(sgd.out sgd.in xeigtsts) + + + add_lapack_test(ssb.out ssb.in xeigtsts) + + + add_lapack_test(ssg.out ssg.in xeigtsts) + + + add_lapack_test(sbal.out sbal.in xeigtsts) + + + add_lapack_test(sbak.out sbak.in xeigtsts) + + + add_lapack_test(sgbal.out sgbal.in xeigtsts) + + + add_lapack_test(sgbak.out sgbak.in xeigtsts) + + + add_lapack_test(sbb.out sbb.in xeigtsts) + + + add_lapack_test(sglm.out glm.in xeigtsts) + + + add_lapack_test(sgqr.out gqr.in xeigtsts) + + + add_lapack_test(sgsv.out gsv.in xeigtsts) + + + add_lapack_test(scsd.out csd.in xeigtsts) + + + add_lapack_test(slse.out lse.in xeigtsts) + endif() + + if (BUILD_DOUBLE) + # + # ======== DOUBLE LIN TESTS =========================== + add_lapack_test(dtest.out dtest.in xlintstd) + # + # ======== DOUBLE RFP LIN TESTS ======================== + add_lapack_test(dtest_rfp.out dtest_rfp.in xlintstrfd) + # + # ======== DOUBLE EIG TESTS =========================== + + add_lapack_test(dnep.out nep.in xeigtstd) + + + add_lapack_test(dsep.out sep.in xeigtstd) + + + add_lapack_test(dsvd.out svd.in xeigtstd) + + + add_lapack_test(dec.out dec.in xeigtstd) + + + add_lapack_test(ded.out ded.in xeigtstd) + + + add_lapack_test(dgg.out dgg.in xeigtstd) + + + add_lapack_test(dgd.out dgd.in xeigtstd) + + + add_lapack_test(dsb.out dsb.in xeigtstd) + + + add_lapack_test(dsg.out dsg.in xeigtstd) + + + add_lapack_test(dbal.out dbal.in xeigtstd) + + + add_lapack_test(dbak.out dbak.in xeigtstd) + + + add_lapack_test(dgbal.out dgbal.in xeigtstd) + + + add_lapack_test(dgbak.out dgbak.in xeigtstd) + + + add_lapack_test(dbb.out dbb.in xeigtstd) + + + add_lapack_test(dglm.out glm.in xeigtstd) + + + add_lapack_test(dgqr.out gqr.in xeigtstd) + + + add_lapack_test(dgsv.out gsv.in xeigtstd) + + + add_lapack_test(dcsd.out csd.in xeigtstd) + + + add_lapack_test(dlse.out lse.in xeigtstd) + endif() + + if (BUILD_COMPLEX) + add_lapack_test(ctest.out ctest.in xlintstc) + # + # ======== COMPLEX RFP LIN TESTS ======================== + add_lapack_test(ctest_rfp.out ctest_rfp.in xlintstrfc) + # + # ======== COMPLEX EIG TESTS =========================== + + add_lapack_test(cnep.out nep.in xeigtstc) + + + add_lapack_test(csep.out sep.in xeigtstc) + + + add_lapack_test(csvd.out svd.in xeigtstc) + + + add_lapack_test(cec.out cec.in xeigtstc) + + + add_lapack_test(ced.out ced.in xeigtstc) + + + add_lapack_test(cgg.out cgg.in xeigtstc) + + + add_lapack_test(cgd.out cgd.in xeigtstc) + + + add_lapack_test(csb.out csb.in xeigtstc) + + + add_lapack_test(csg.out csg.in xeigtstc) + + + add_lapack_test(cbal.out cbal.in xeigtstc) + + + add_lapack_test(cbak.out cbak.in xeigtstc) + + + add_lapack_test(cgbal.out cgbal.in xeigtstc) + + + add_lapack_test(cgbak.out cgbak.in xeigtstc) + + + add_lapack_test(cbb.out cbb.in xeigtstc) + + + add_lapack_test(cglm.out glm.in xeigtstc) + + + add_lapack_test(cgqr.out gqr.in xeigtstc) + + + add_lapack_test(cgsv.out gsv.in xeigtstc) + + + add_lapack_test(ccsd.out csd.in xeigtstc) + + + add_lapack_test(clse.out lse.in xeigtstc) + endif() + + if (BUILD_COMPLEX16) + # + # ======== COMPLEX16 LIN TESTS ======================== + add_lapack_test(ztest.out ztest.in xlintstz) + # + # ======== COMPLEX16 RFP LIN TESTS ======================== + add_lapack_test(ztest_rfp.out ztest_rfp.in xlintstrfz) + # + # ======== COMPLEX16 EIG TESTS =========================== + + add_lapack_test(znep.out nep.in xeigtstz) + + + add_lapack_test(zsep.out sep.in xeigtstz) + + + add_lapack_test(zsvd.out svd.in xeigtstz) + + + add_lapack_test(zec.out zec.in xeigtstz) + + + add_lapack_test(zed.out zed.in xeigtstz) + + + add_lapack_test(zgg.out zgg.in xeigtstz) + + + add_lapack_test(zgd.out zgd.in xeigtstz) + + + add_lapack_test(zsb.out zsb.in xeigtstz) + + + add_lapack_test(zsg.out zsg.in xeigtstz) + + + add_lapack_test(zbal.out zbal.in xeigtstz) + + + add_lapack_test(zbak.out zbak.in xeigtstz) + + + add_lapack_test(zgbal.out zgbal.in xeigtstz) + + + add_lapack_test(zgbak.out zgbak.in xeigtstz) + + + add_lapack_test(zbb.out zbb.in xeigtstz) + + + add_lapack_test(zglm.out glm.in xeigtstz) + + + add_lapack_test(zgqr.out gqr.in xeigtstz) + + + add_lapack_test(zgsv.out gsv.in xeigtstz) + + + add_lapack_test(zcsd.out csd.in xeigtstz) + + + add_lapack_test(zlse.out lse.in xeigtstz) + endif() + + + if (BUILD_SIMPLE) + if (BUILD_DOUBLE) + # + # ======== SINGLE-DOUBLE PROTO LIN TESTS ============== + add_lapack_test(dstest.out dstest.in xlintstds) + endif() + endif() + + + if (BUILD_COMPLEX) + if (BUILD_COMPLEX16) + # + # ======== COMPLEX-COMPLEX16 LIN TESTS ======================== + add_lapack_test(zctest.out zctest.in xlintstzc) + endif() + endif() + + # ============================================================================== + + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${LAPACK_SOURCE_DIR}/testing/lapack_testing.py ${LAPACK_BINARY_DIR}) + add_test( + NAME LAPACK_Test_Summary + WORKING_DIRECTORY ${LAPACK_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "lapack_testing.py" + ) + +endif() + diff --git a/lib/eigen-3.4.0/lapack/cholesky.cpp b/lib/eigen-3.4.0/lapack/cholesky.cpp new file mode 100644 index 0000000..ea3bc12 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/cholesky.cpp @@ -0,0 +1,72 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "lapack_common.h" +#include + +// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A. +EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info)) +{ + *info = 0; + if(UPLO(*uplo)==INVALID) *info = -1; + else if(*n<0) *info = -2; + else if(*lda(pa); + MatrixType A(a,*n,*n,*lda); + int ret; + if(UPLO(*uplo)==UP) ret = int(internal::llt_inplace::blocked(A)); + else ret = int(internal::llt_inplace::blocked(A)); + + if(ret>=0) + *info = ret+1; + + return 0; +} + +// POTRS solves a system of linear equations A*X = B with a symmetric +// positive definite matrix A using the Cholesky factorization +// A = U**T*U or A = L*L**T computed by DPOTRF. +EIGEN_LAPACK_FUNC(potrs,(char* uplo, int *n, int *nrhs, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, int *info)) +{ + *info = 0; + if(UPLO(*uplo)==INVALID) *info = -1; + else if(*n<0) *info = -2; + else if(*nrhs<0) *info = -3; + else if(*lda(pa); + Scalar* b = reinterpret_cast(pb); + MatrixType A(a,*n,*n,*lda); + MatrixType B(b,*n,*nrhs,*ldb); + + if(UPLO(*uplo)==UP) + { + A.triangularView().adjoint().solveInPlace(B); + A.triangularView().solveInPlace(B); + } + else + { + A.triangularView().solveInPlace(B); + A.triangularView().adjoint().solveInPlace(B); + } + + return 0; +} diff --git a/lib/eigen-3.4.0/lapack/clacgv.f b/lib/eigen-3.4.0/lapack/clacgv.f new file mode 100644 index 0000000..359eb07 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/clacgv.f @@ -0,0 +1,116 @@ +*> \brief \b CLACGV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLACGV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE CLACGV( N, X, INCX ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* .. +* .. Array Arguments .. +* COMPLEX X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLACGV conjugates a complex vector of length N. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The length of the vector X. N >= 0. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is COMPLEX array, dimension +*> (1+(N-1)*abs(INCX)) +*> On entry, the vector of length N to be conjugated. +*> On exit, X is overwritten with conjg(X). +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The spacing between successive elements of X. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + SUBROUTINE CLACGV( N, X, INCX ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N +* .. +* .. Array Arguments .. + COMPLEX X( * ) +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + INTEGER I, IOFF +* .. +* .. Intrinsic Functions .. + INTRINSIC CONJG +* .. +* .. Executable Statements .. +* + IF( INCX.EQ.1 ) THEN + DO 10 I = 1, N + X( I ) = CONJG( X( I ) ) + 10 CONTINUE + ELSE + IOFF = 1 + IF( INCX.LT.0 ) + $ IOFF = 1 - ( N-1 )*INCX + DO 20 I = 1, N + X( IOFF ) = CONJG( X( IOFF ) ) + IOFF = IOFF + INCX + 20 CONTINUE + END IF + RETURN +* +* End of CLACGV +* + END diff --git a/lib/eigen-3.4.0/lapack/cladiv.f b/lib/eigen-3.4.0/lapack/cladiv.f new file mode 100644 index 0000000..2807ac5 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/cladiv.f @@ -0,0 +1,97 @@ +*> \brief \b CLADIV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLADIV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* COMPLEX FUNCTION CLADIV( X, Y ) +* +* .. Scalar Arguments .. +* COMPLEX X, Y +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLADIV := X / Y, where X and Y are complex. The computation of X / Y +*> will not overflow on an intermediary step unless the results +*> overflows. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is COMPLEX +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is COMPLEX +*> The complex scalars X and Y. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + COMPLEX FUNCTION CLADIV( X, Y ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + COMPLEX X, Y +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + REAL ZI, ZR +* .. +* .. External Subroutines .. + EXTERNAL SLADIV +* .. +* .. Intrinsic Functions .. + INTRINSIC AIMAG, CMPLX, REAL +* .. +* .. Executable Statements .. +* + CALL SLADIV( REAL( X ), AIMAG( X ), REAL( Y ), AIMAG( Y ), ZR, + $ ZI ) + CLADIV = CMPLX( ZR, ZI ) +* + RETURN +* +* End of CLADIV +* + END diff --git a/lib/eigen-3.4.0/lapack/clarf.f b/lib/eigen-3.4.0/lapack/clarf.f new file mode 100644 index 0000000..ca0328f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/clarf.f @@ -0,0 +1,232 @@ +*> \brief \b CLARF +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLARF + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE CLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* .. Scalar Arguments .. +* CHARACTER SIDE +* INTEGER INCV, LDC, M, N +* COMPLEX TAU +* .. +* .. Array Arguments .. +* COMPLEX C( LDC, * ), V( * ), WORK( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLARF applies a complex elementary reflector H to a complex M-by-N +*> matrix C, from either the left or the right. H is represented in the +*> form +*> +*> H = I - tau * v * v**H +*> +*> where tau is a complex scalar and v is a complex vector. +*> +*> If tau = 0, then H is taken to be the unit matrix. +*> +*> To apply H**H (the conjugate transpose of H), supply conjg(tau) instead +*> tau. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': form H * C +*> = 'R': form C * H +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX array, dimension +*> (1 + (M-1)*abs(INCV)) if SIDE = 'L' +*> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' +*> The vector v in the representation of H. V is not used if +*> TAU = 0. +*> \endverbatim +*> +*> \param[in] INCV +*> \verbatim +*> INCV is INTEGER +*> The increment between elements of v. INCV <> 0. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is COMPLEX +*> The value tau in the representation of H. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is COMPLEX array, dimension (LDC,N) +*> On entry, the M-by-N matrix C. +*> On exit, C is overwritten by the matrix H * C if SIDE = 'L', +*> or C * H if SIDE = 'R'. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is COMPLEX array, dimension +*> (N) if SIDE = 'L' +*> or (M) if SIDE = 'R' +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + SUBROUTINE CLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER SIDE + INTEGER INCV, LDC, M, N + COMPLEX TAU +* .. +* .. Array Arguments .. + COMPLEX C( LDC, * ), V( * ), WORK( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX ONE, ZERO + PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), + $ ZERO = ( 0.0E+0, 0.0E+0 ) ) +* .. +* .. Local Scalars .. + LOGICAL APPLYLEFT + INTEGER I, LASTV, LASTC +* .. +* .. External Subroutines .. + EXTERNAL CGEMV, CGERC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILACLR, ILACLC + EXTERNAL LSAME, ILACLR, ILACLC +* .. +* .. Executable Statements .. +* + APPLYLEFT = LSAME( SIDE, 'L' ) + LASTV = 0 + LASTC = 0 + IF( TAU.NE.ZERO ) THEN +! Set up variables for scanning V. LASTV begins pointing to the end +! of V. + IF( APPLYLEFT ) THEN + LASTV = M + ELSE + LASTV = N + END IF + IF( INCV.GT.0 ) THEN + I = 1 + (LASTV-1) * INCV + ELSE + I = 1 + END IF +! Look for the last non-zero row in V. + DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) + LASTV = LASTV - 1 + I = I - INCV + END DO + IF( APPLYLEFT ) THEN +! Scan for the last non-zero column in C(1:lastv,:). + LASTC = ILACLC(LASTV, N, C, LDC) + ELSE +! Scan for the last non-zero row in C(:,1:lastv). + LASTC = ILACLR(M, LASTV, C, LDC) + END IF + END IF +! Note that lastc.eq.0 renders the BLAS operations null; no special +! case is needed at this level. + IF( APPLYLEFT ) THEN +* +* Form H * C +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1) +* + CALL CGEMV( 'Conjugate transpose', LASTV, LASTC, ONE, + $ C, LDC, V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H +* + CALL CGERC( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) + END IF + ELSE +* +* Form C * H +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) +* + CALL CGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, + $ V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H +* + CALL CGERC( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) + END IF + END IF + RETURN +* +* End of CLARF +* + END diff --git a/lib/eigen-3.4.0/lapack/clarfb.f b/lib/eigen-3.4.0/lapack/clarfb.f new file mode 100644 index 0000000..40bbdf4 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/clarfb.f @@ -0,0 +1,771 @@ +*> \brief \b CLARFB +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLARFB + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE CLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, +* T, LDT, C, LDC, WORK, LDWORK ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, SIDE, STOREV, TRANS +* INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. +* COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ), +* $ WORK( LDWORK, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLARFB applies a complex block reflector H or its transpose H**H to a +*> complex M-by-N matrix C, from either the left or the right. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': apply H or H**H from the Left +*> = 'R': apply H or H**H from the Right +*> \endverbatim +*> +*> \param[in] TRANS +*> \verbatim +*> TRANS is CHARACTER*1 +*> = 'N': apply H (No transpose) +*> = 'C': apply H**H (Conjugate transpose) +*> \endverbatim +*> +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Indicates how H is formed from a product of elementary +*> reflectors +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Indicates how the vectors which define the elementary +*> reflectors are stored: +*> = 'C': Columnwise +*> = 'R': Rowwise +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the matrix T (= the number of elementary +*> reflectors whose product defines the block reflector). +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,M) if STOREV = 'R' and SIDE = 'L' +*> (LDV,N) if STOREV = 'R' and SIDE = 'R' +*> The matrix V. See Further Details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); +*> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); +*> if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] T +*> \verbatim +*> T is COMPLEX array, dimension (LDT,K) +*> The triangular K-by-K matrix T in the representation of the +*> block reflector. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is COMPLEX array, dimension (LDC,N) +*> On entry, the M-by-N matrix C. +*> On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is COMPLEX array, dimension (LDWORK,K) +*> \endverbatim +*> +*> \param[in] LDWORK +*> \verbatim +*> LDWORK is INTEGER +*> The leading dimension of the array WORK. +*> If SIDE = 'L', LDWORK >= max(1,N); +*> if SIDE = 'R', LDWORK >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored; the corresponding +*> array elements are modified but restored on exit. The rest of the +*> array is not used. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE CLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, + $ T, LDT, C, LDC, WORK, LDWORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, SIDE, STOREV, TRANS + INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. + COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ), + $ WORK( LDWORK, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX ONE + PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) ) +* .. +* .. Local Scalars .. + CHARACTER TRANST + INTEGER I, J, LASTV, LASTC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILACLR, ILACLC + EXTERNAL LSAME, ILACLR, ILACLC +* .. +* .. External Subroutines .. + EXTERNAL CCOPY, CGEMM, CLACGV, CTRMM +* .. +* .. Intrinsic Functions .. + INTRINSIC CONJG +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( M.LE.0 .OR. N.LE.0 ) + $ RETURN +* + IF( LSAME( TRANS, 'N' ) ) THEN + TRANST = 'C' + ELSE + TRANST = 'N' + END IF +* + IF( LSAME( STOREV, 'C' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 ) (first K rows) +* ( V2 ) +* where V1 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILACLR( M, K, V, LDV ) ) + LASTC = ILACLC( LASTV, N, C, LDC ) +* +* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) +* +* W := C1**H +* + DO 10 J = 1, K + CALL CCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + CALL CLACGV( LASTC, WORK( 1, J ), 1 ) + 10 CONTINUE +* +* W := W * V1 +* + CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**H *V2 +* + CALL CGEMM( 'Conjugate transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C( K+1, 1 ), LDC, + $ V( K+1, 1 ), LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL CTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**H +* + IF( M.GT.K ) THEN +* +* C2 := C2 - V2 * W**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTV-K, LASTC, K, -ONE, V( K+1, 1 ), LDV, + $ WORK, LDWORK, ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1**H +* + CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**H +* + DO 30 J = 1, K + DO 20 I = 1, LASTC + C( J, I ) = C( J, I ) - CONJG( WORK( I, J ) ) + 20 CONTINUE + 30 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILACLR( N, K, V, LDV ) ) + LASTC = ILACLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C1 +* + DO 40 J = 1, K + CALL CCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 40 CONTINUE +* +* W := W * V1 +* + CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2 +* + CALL CGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL CTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**H +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1**H +* + CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 60 J = 1, K + DO 50 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 50 CONTINUE + 60 CONTINUE + END IF +* + ELSE +* +* Let V = ( V1 ) +* ( V2 ) (last K rows) +* where V2 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILACLR( M, K, V, LDV ) ) + LASTC = ILACLC( LASTV, N, C, LDC ) +* +* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) +* +* W := C2**H +* + DO 70 J = 1, K + CALL CCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + CALL CLACGV( LASTC, WORK( 1, J ), 1 ) + 70 CONTINUE +* +* W := W * V2 +* + CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**H*V1 +* + CALL CGEMM( 'Conjugate transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL CTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1 * W**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**H +* + CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**H +* + DO 90 J = 1, K + DO 80 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - + $ CONJG( WORK( I, J ) ) + 80 CONTINUE + 90 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILACLR( N, K, V, LDV ) ) + LASTC = ILACLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C2 +* + DO 100 J = 1, K + CALL CCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 100 CONTINUE +* +* W := W * V2 +* + CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1 +* + CALL CGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL CTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**H +* + CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W +* + DO 120 J = 1, K + DO 110 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) + $ - WORK( I, J ) + 110 CONTINUE + 120 CONTINUE + END IF + END IF +* + ELSE IF( LSAME( STOREV, 'R' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 V2 ) (V1: first K columns) +* where V1 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILACLC( K, M, V, LDV ) ) + LASTC = ILACLC( LASTV, N, C, LDC ) +* +* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) +* +* W := C1**H +* + DO 130 J = 1, K + CALL CCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + CALL CLACGV( LASTC, WORK( 1, J ), 1 ) + 130 CONTINUE +* +* W := W * V1**H +* + CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**H*V2**H +* + CALL CGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL CTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**H * W**H +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2**H * W**H +* + CALL CGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTV-K, LASTC, K, + $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, + $ ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**H +* + DO 150 J = 1, K + DO 140 I = 1, LASTC + C( J, I ) = C( J, I ) - CONJG( WORK( I, J ) ) + 140 CONTINUE + 150 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILACLC( K, N, V, LDV ) ) + LASTC = ILACLR( M, LASTV, C, LDC ) +* +* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) +* +* W := C1 +* + DO 160 J = 1, K + CALL CCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 160 CONTINUE +* +* W := W * V1**H +* + CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, K, LASTV-K, ONE, C( 1, K+1 ), LDC, + $ V( 1, K+1 ), LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL CTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2 +* + CALL CGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 180 J = 1, K + DO 170 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 170 CONTINUE + 180 CONTINUE +* + END IF +* + ELSE +* +* Let V = ( V1 V2 ) (V2: last K columns) +* where V2 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILACLC( K, M, V, LDV ) ) + LASTC = ILACLC( LASTV, N, C, LDC ) +* +* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) +* +* W := C2**H +* + DO 190 J = 1, K + CALL CCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + CALL CLACGV( LASTC, WORK( 1, J ), 1 ) + 190 CONTINUE +* +* W := W * V2**H +* + CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**H * V1**H +* + CALL CGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTC, K, LASTV-K, + $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL CTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**H * W**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1**H * W**H +* + CALL CGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTV-K, LASTC, K, + $ -ONE, V, LDV, WORK, LDWORK, ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**H +* + DO 210 J = 1, K + DO 200 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - + $ CONJG( WORK( I, J ) ) + 200 CONTINUE + 210 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILACLC( K, N, V, LDV ) ) + LASTC = ILACLR( M, LASTV, C, LDC ) +* +* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) +* +* W := C2 +* + DO 220 J = 1, K + CALL CCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 220 CONTINUE +* +* W := W * V2**H +* + CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1**H +* + CALL CGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, ONE, + $ WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL CTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1 +* + CALL CGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 240 J = 1, K + DO 230 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) + $ - WORK( I, J ) + 230 CONTINUE + 240 CONTINUE +* + END IF +* + END IF + END IF +* + RETURN +* +* End of CLARFB +* + END diff --git a/lib/eigen-3.4.0/lapack/clarfg.f b/lib/eigen-3.4.0/lapack/clarfg.f new file mode 100644 index 0000000..d64f396 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/clarfg.f @@ -0,0 +1,203 @@ +*> \brief \b CLARFG +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLARFG + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE CLARFG( N, ALPHA, X, INCX, TAU ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* COMPLEX ALPHA, TAU +* .. +* .. Array Arguments .. +* COMPLEX X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLARFG generates a complex elementary reflector H of order n, such +*> that +*> +*> H**H * ( alpha ) = ( beta ), H**H * H = I. +*> ( x ) ( 0 ) +*> +*> where alpha and beta are scalars, with beta real, and x is an +*> (n-1)-element complex vector. H is represented in the form +*> +*> H = I - tau * ( 1 ) * ( 1 v**H ) , +*> ( v ) +*> +*> where tau is a complex scalar and v is a complex (n-1)-element +*> vector. Note that H is not hermitian. +*> +*> If the elements of x are all zero and alpha is real, then tau = 0 +*> and H is taken to be the unit matrix. +*> +*> Otherwise 1 <= real(tau) <= 2 and abs(tau-1) <= 1 . +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the elementary reflector. +*> \endverbatim +*> +*> \param[in,out] ALPHA +*> \verbatim +*> ALPHA is COMPLEX +*> On entry, the value alpha. +*> On exit, it is overwritten with the value beta. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is COMPLEX array, dimension +*> (1+(N-2)*abs(INCX)) +*> On entry, the vector x. +*> On exit, it is overwritten with the vector v. +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The increment between elements of X. INCX > 0. +*> \endverbatim +*> +*> \param[out] TAU +*> \verbatim +*> TAU is COMPLEX +*> The value tau. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + SUBROUTINE CLARFG( N, ALPHA, X, INCX, TAU ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N + COMPLEX ALPHA, TAU +* .. +* .. Array Arguments .. + COMPLEX X( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE, ZERO + PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + INTEGER J, KNT + REAL ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM +* .. +* .. External Functions .. + REAL SCNRM2, SLAMCH, SLAPY3 + COMPLEX CLADIV + EXTERNAL SCNRM2, SLAMCH, SLAPY3, CLADIV +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, AIMAG, CMPLX, REAL, SIGN +* .. +* .. External Subroutines .. + EXTERNAL CSCAL, CSSCAL +* .. +* .. Executable Statements .. +* + IF( N.LE.0 ) THEN + TAU = ZERO + RETURN + END IF +* + XNORM = SCNRM2( N-1, X, INCX ) + ALPHR = REAL( ALPHA ) + ALPHI = AIMAG( ALPHA ) +* + IF( XNORM.EQ.ZERO .AND. ALPHI.EQ.ZERO ) THEN +* +* H = I +* + TAU = ZERO + ELSE +* +* general case +* + BETA = -SIGN( SLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) + SAFMIN = SLAMCH( 'S' ) / SLAMCH( 'E' ) + RSAFMN = ONE / SAFMIN +* + KNT = 0 + IF( ABS( BETA ).LT.SAFMIN ) THEN +* +* XNORM, BETA may be inaccurate; scale X and recompute them +* + 10 CONTINUE + KNT = KNT + 1 + CALL CSSCAL( N-1, RSAFMN, X, INCX ) + BETA = BETA*RSAFMN + ALPHI = ALPHI*RSAFMN + ALPHR = ALPHR*RSAFMN + IF( ABS( BETA ).LT.SAFMIN ) + $ GO TO 10 +* +* New BETA is at most 1, at least SAFMIN +* + XNORM = SCNRM2( N-1, X, INCX ) + ALPHA = CMPLX( ALPHR, ALPHI ) + BETA = -SIGN( SLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) + END IF + TAU = CMPLX( ( BETA-ALPHR ) / BETA, -ALPHI / BETA ) + ALPHA = CLADIV( CMPLX( ONE ), ALPHA-BETA ) + CALL CSCAL( N-1, ALPHA, X, INCX ) +* +* If ALPHA is subnormal, it may lose relative accuracy +* + DO 20 J = 1, KNT + BETA = BETA*SAFMIN + 20 CONTINUE + ALPHA = BETA + END IF +* + RETURN +* +* End of CLARFG +* + END diff --git a/lib/eigen-3.4.0/lapack/clarft.f b/lib/eigen-3.4.0/lapack/clarft.f new file mode 100644 index 0000000..981447f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/clarft.f @@ -0,0 +1,328 @@ +*> \brief \b CLARFT +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download CLARFT + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE CLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, STOREV +* INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. +* COMPLEX T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> CLARFT forms the triangular factor T of a complex block reflector H +*> of order n, which is defined as a product of k elementary reflectors. +*> +*> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; +*> +*> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. +*> +*> If STOREV = 'C', the vector which defines the elementary reflector +*> H(i) is stored in the i-th column of the array V, and +*> +*> H = I - V * T * V**H +*> +*> If STOREV = 'R', the vector which defines the elementary reflector +*> H(i) is stored in the i-th row of the array V, and +*> +*> H = I - V**H * T * V +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Specifies the order in which the elementary reflectors are +*> multiplied to form the block reflector: +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Specifies how the vectors which define the elementary +*> reflectors are stored (see also Further Details): +*> = 'C': columnwise +*> = 'R': rowwise +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the block reflector H. N >= 0. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the triangular factor T (= the number of +*> elementary reflectors). K >= 1. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,N) if STOREV = 'R' +*> The matrix V. See further details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is COMPLEX array, dimension (K) +*> TAU(i) must contain the scalar factor of the elementary +*> reflector H(i). +*> \endverbatim +*> +*> \param[out] T +*> \verbatim +*> T is COMPLEX array, dimension (LDT,K) +*> The k by k triangular factor T of the block reflector. +*> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is +*> lower triangular. The rest of the array is not used. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup complexOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE CLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, STOREV + INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. + COMPLEX T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX ONE, ZERO + PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), + $ ZERO = ( 0.0E+0, 0.0E+0 ) ) +* .. +* .. Local Scalars .. + INTEGER I, J, PREVLASTV, LASTV +* .. +* .. External Subroutines .. + EXTERNAL CGEMV, CLACGV, CTRMV +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( N.EQ.0 ) + $ RETURN +* + IF( LSAME( DIRECT, 'F' ) ) THEN + PREVLASTV = N + DO I = 1, K + PREVLASTV = MAX( PREVLASTV, I ) + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = 1, I + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * CONJG( V( I , J ) ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**H * V(i:j,i) +* + CALL CGEMV( 'Conjugate transpose', J-I, I-1, + $ -TAU( I ), V( I+1, 1 ), LDV, + $ V( I+1, I ), 1, + $ ONE, T( 1, I ), 1 ) + ELSE +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( J , I ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**H +* + CALL CGEMM( 'N', 'C', I-1, 1, J-I, -TAU( I ), + $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, + $ ONE, T( 1, I ), LDT ) + END IF +* +* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) +* + CALL CTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, + $ LDT, T( 1, I ), 1 ) + T( I, I ) = TAU( I ) + IF( I.GT.1 ) THEN + PREVLASTV = MAX( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + END DO + ELSE + PREVLASTV = 1 + DO I = K, 1, -1 + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = I, K + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( I.LT.K ) THEN + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * CONJG( V( N-K+I , J ) ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**H * V(j:n-k+i,i) +* + CALL CGEMV( 'Conjugate transpose', N-K+I-J, K-I, + $ -TAU( I ), V( J, I+1 ), LDV, V( J, I ), + $ 1, ONE, T( I+1, I ), 1 ) + ELSE +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( J, N-K+I ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**H +* + CALL CGEMM( 'N', 'C', K-I, 1, N-K+I-J, -TAU( I ), + $ V( I+1, J ), LDV, V( I, J ), LDV, + $ ONE, T( I+1, I ), LDT ) + END IF +* +* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) +* + CALL CTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, + $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) + IF( I.GT.1 ) THEN + PREVLASTV = MIN( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + T( I, I ) = TAU( I ) + END IF + END DO + END IF + RETURN +* +* End of CLARFT +* + END diff --git a/lib/eigen-3.4.0/lapack/complex_double.cpp b/lib/eigen-3.4.0/lapack/complex_double.cpp new file mode 100644 index 0000000..c9c5752 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/complex_double.cpp @@ -0,0 +1,18 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define SCALAR std::complex +#define SCALAR_SUFFIX z +#define SCALAR_SUFFIX_UP "Z" +#define REAL_SCALAR_SUFFIX d +#define ISCOMPLEX 1 + +#include "cholesky.cpp" +#include "lu.cpp" +#include "svd.cpp" diff --git a/lib/eigen-3.4.0/lapack/complex_single.cpp b/lib/eigen-3.4.0/lapack/complex_single.cpp new file mode 100644 index 0000000..6d11b26 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/complex_single.cpp @@ -0,0 +1,18 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define SCALAR std::complex +#define SCALAR_SUFFIX c +#define SCALAR_SUFFIX_UP "C" +#define REAL_SCALAR_SUFFIX s +#define ISCOMPLEX 1 + +#include "cholesky.cpp" +#include "lu.cpp" +#include "svd.cpp" diff --git a/lib/eigen-3.4.0/lapack/dladiv.f b/lib/eigen-3.4.0/lapack/dladiv.f new file mode 100644 index 0000000..090a906 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dladiv.f @@ -0,0 +1,128 @@ +*> \brief \b DLADIV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLADIV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE DLADIV( A, B, C, D, P, Q ) +* +* .. Scalar Arguments .. +* DOUBLE PRECISION A, B, C, D, P, Q +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLADIV performs complex division in real arithmetic +*> +*> a + i*b +*> p + i*q = --------- +*> c + i*d +*> +*> The algorithm is due to Robert L. Smith and can be found +*> in D. Knuth, The art of Computer Programming, Vol.2, p.195 +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] A +*> \verbatim +*> A is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] B +*> \verbatim +*> B is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] C +*> \verbatim +*> C is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] D +*> \verbatim +*> D is DOUBLE PRECISION +*> The scalars a, b, c, and d in the above expression. +*> \endverbatim +*> +*> \param[out] P +*> \verbatim +*> P is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[out] Q +*> \verbatim +*> Q is DOUBLE PRECISION +*> The scalars p and q in the above expression. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + SUBROUTINE DLADIV( A, B, C, D, P, Q ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + DOUBLE PRECISION A, B, C, D, P, Q +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + DOUBLE PRECISION E, F +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS +* .. +* .. Executable Statements .. +* + IF( ABS( D ).LT.ABS( C ) ) THEN + E = D / C + F = C + D*E + P = ( A+B*E ) / F + Q = ( B-A*E ) / F + ELSE + E = C / D + F = D + C*E + P = ( B+A*E ) / F + Q = ( -A+B*E ) / F + END IF +* + RETURN +* +* End of DLADIV +* + END diff --git a/lib/eigen-3.4.0/lapack/dlamch.f b/lib/eigen-3.4.0/lapack/dlamch.f new file mode 100644 index 0000000..eb307e5 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlamch.f @@ -0,0 +1,189 @@ +*> \brief \b DLAMCH +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +* Definition: +* =========== +* +* DOUBLE PRECISION FUNCTION DLAMCH( CMACH ) +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLAMCH determines double precision machine parameters. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] CMACH +*> \verbatim +*> Specifies the value to be returned by DLAMCH: +*> = 'E' or 'e', DLAMCH := eps +*> = 'S' or 's , DLAMCH := sfmin +*> = 'B' or 'b', DLAMCH := base +*> = 'P' or 'p', DLAMCH := eps*base +*> = 'N' or 'n', DLAMCH := t +*> = 'R' or 'r', DLAMCH := rnd +*> = 'M' or 'm', DLAMCH := emin +*> = 'U' or 'u', DLAMCH := rmin +*> = 'L' or 'l', DLAMCH := emax +*> = 'O' or 'o', DLAMCH := rmax +*> where +*> eps = relative machine precision +*> sfmin = safe minimum, such that 1/sfmin does not overflow +*> base = base of the machine +*> prec = eps*base +*> t = number of (base) digits in the mantissa +*> rnd = 1.0 when rounding occurs in addition, 0.0 otherwise +*> emin = minimum exponent before (gradual) underflow +*> rmin = underflow threshold - base**(emin-1) +*> emax = largest exponent before overflow +*> rmax = overflow threshold - (base**emax)*(1-eps) +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + DOUBLE PRECISION FUNCTION DLAMCH( CMACH ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER CMACH +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE, ZERO + PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + DOUBLE PRECISION RND, EPS, SFMIN, SMALL, RMACH +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Intrinsic Functions .. + INTRINSIC DIGITS, EPSILON, HUGE, MAXEXPONENT, + $ MINEXPONENT, RADIX, TINY +* .. +* .. Executable Statements .. +* +* +* Assume rounding, not chopping. Always. +* + RND = ONE +* + IF( ONE.EQ.RND ) THEN + EPS = EPSILON(ZERO) * 0.5 + ELSE + EPS = EPSILON(ZERO) + END IF +* + IF( LSAME( CMACH, 'E' ) ) THEN + RMACH = EPS + ELSE IF( LSAME( CMACH, 'S' ) ) THEN + SFMIN = TINY(ZERO) + SMALL = ONE / HUGE(ZERO) + IF( SMALL.GE.SFMIN ) THEN +* +* Use SMALL plus a bit, to avoid the possibility of rounding +* causing overflow when computing 1/sfmin. +* + SFMIN = SMALL*( ONE+EPS ) + END IF + RMACH = SFMIN + ELSE IF( LSAME( CMACH, 'B' ) ) THEN + RMACH = RADIX(ZERO) + ELSE IF( LSAME( CMACH, 'P' ) ) THEN + RMACH = EPS * RADIX(ZERO) + ELSE IF( LSAME( CMACH, 'N' ) ) THEN + RMACH = DIGITS(ZERO) + ELSE IF( LSAME( CMACH, 'R' ) ) THEN + RMACH = RND + ELSE IF( LSAME( CMACH, 'M' ) ) THEN + RMACH = MINEXPONENT(ZERO) + ELSE IF( LSAME( CMACH, 'U' ) ) THEN + RMACH = tiny(zero) + ELSE IF( LSAME( CMACH, 'L' ) ) THEN + RMACH = MAXEXPONENT(ZERO) + ELSE IF( LSAME( CMACH, 'O' ) ) THEN + RMACH = HUGE(ZERO) + ELSE + RMACH = ZERO + END IF +* + DLAMCH = RMACH + RETURN +* +* End of DLAMCH +* + END +************************************************************************ +*> \brief \b DLAMC3 +*> \details +*> \b Purpose: +*> \verbatim +*> DLAMC3 is intended to force A and B to be stored prior to doing +*> the addition of A and B , for use in situations where optimizers +*> might hold one of these in a register. +*> \endverbatim +*> \author LAPACK is a software package provided by Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. +*> \date November 2011 +*> \ingroup auxOTHERauxiliary +*> +*> \param[in] A +*> \verbatim +*> A is a DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] B +*> \verbatim +*> B is a DOUBLE PRECISION +*> The values A and B. +*> \endverbatim +*> + DOUBLE PRECISION FUNCTION DLAMC3( A, B ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. +* November 2010 +* +* .. Scalar Arguments .. + DOUBLE PRECISION A, B +* .. +* ===================================================================== +* +* .. Executable Statements .. +* + DLAMC3 = A + B +* + RETURN +* +* End of DLAMC3 +* + END +* +************************************************************************ diff --git a/lib/eigen-3.4.0/lapack/dlapy2.f b/lib/eigen-3.4.0/lapack/dlapy2.f new file mode 100644 index 0000000..e6a62bf --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlapy2.f @@ -0,0 +1,104 @@ +*> \brief \b DLAPY2 +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLAPY2 + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* DOUBLE PRECISION FUNCTION DLAPY2( X, Y ) +* +* .. Scalar Arguments .. +* DOUBLE PRECISION X, Y +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary +*> overflow. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is DOUBLE PRECISION +*> X and Y specify the values x and y. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + DOUBLE PRECISION FUNCTION DLAPY2( X, Y ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + DOUBLE PRECISION X, Y +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ZERO + PARAMETER ( ZERO = 0.0D0 ) + DOUBLE PRECISION ONE + PARAMETER ( ONE = 1.0D0 ) +* .. +* .. Local Scalars .. + DOUBLE PRECISION W, XABS, YABS, Z +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, MAX, MIN, SQRT +* .. +* .. Executable Statements .. +* + XABS = ABS( X ) + YABS = ABS( Y ) + W = MAX( XABS, YABS ) + Z = MIN( XABS, YABS ) + IF( Z.EQ.ZERO ) THEN + DLAPY2 = W + ELSE + DLAPY2 = W*SQRT( ONE+( Z / W )**2 ) + END IF + RETURN +* +* End of DLAPY2 +* + END diff --git a/lib/eigen-3.4.0/lapack/dlapy3.f b/lib/eigen-3.4.0/lapack/dlapy3.f new file mode 100644 index 0000000..ae9844f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlapy3.f @@ -0,0 +1,111 @@ +*> \brief \b DLAPY3 +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLAPY3 + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* DOUBLE PRECISION FUNCTION DLAPY3( X, Y, Z ) +* +* .. Scalar Arguments .. +* DOUBLE PRECISION X, Y, Z +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause +*> unnecessary overflow. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is DOUBLE PRECISION +*> \endverbatim +*> +*> \param[in] Z +*> \verbatim +*> Z is DOUBLE PRECISION +*> X, Y and Z specify the values x, y and z. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + DOUBLE PRECISION FUNCTION DLAPY3( X, Y, Z ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + DOUBLE PRECISION X, Y, Z +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ZERO + PARAMETER ( ZERO = 0.0D0 ) +* .. +* .. Local Scalars .. + DOUBLE PRECISION W, XABS, YABS, ZABS +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, MAX, SQRT +* .. +* .. Executable Statements .. +* + XABS = ABS( X ) + YABS = ABS( Y ) + ZABS = ABS( Z ) + W = MAX( XABS, YABS, ZABS ) + IF( W.EQ.ZERO ) THEN +* W can be zero for max(0,nan,0) +* adding all three entries together will make sure +* NaN will not disappear. + DLAPY3 = XABS + YABS + ZABS + ELSE + DLAPY3 = W*SQRT( ( XABS / W )**2+( YABS / W )**2+ + $ ( ZABS / W )**2 ) + END IF + RETURN +* +* End of DLAPY3 +* + END diff --git a/lib/eigen-3.4.0/lapack/dlarf.f b/lib/eigen-3.4.0/lapack/dlarf.f new file mode 100644 index 0000000..2a82ff4 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlarf.f @@ -0,0 +1,227 @@ +*> \brief \b DLARF +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLARF + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* .. Scalar Arguments .. +* CHARACTER SIDE +* INTEGER INCV, LDC, M, N +* DOUBLE PRECISION TAU +* .. +* .. Array Arguments .. +* DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLARF applies a real elementary reflector H to a real m by n matrix +*> C, from either the left or the right. H is represented in the form +*> +*> H = I - tau * v * v**T +*> +*> where tau is a real scalar and v is a real vector. +*> +*> If tau = 0, then H is taken to be the unit matrix. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': form H * C +*> = 'R': form C * H +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is DOUBLE PRECISION array, dimension +*> (1 + (M-1)*abs(INCV)) if SIDE = 'L' +*> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' +*> The vector v in the representation of H. V is not used if +*> TAU = 0. +*> \endverbatim +*> +*> \param[in] INCV +*> \verbatim +*> INCV is INTEGER +*> The increment between elements of v. INCV <> 0. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is DOUBLE PRECISION +*> The value tau in the representation of H. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is DOUBLE PRECISION array, dimension (LDC,N) +*> On entry, the m by n matrix C. +*> On exit, C is overwritten by the matrix H * C if SIDE = 'L', +*> or C * H if SIDE = 'R'. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is DOUBLE PRECISION array, dimension +*> (N) if SIDE = 'L' +*> or (M) if SIDE = 'R' +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup doubleOTHERauxiliary +* +* ===================================================================== + SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER SIDE + INTEGER INCV, LDC, M, N + DOUBLE PRECISION TAU +* .. +* .. Array Arguments .. + DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE, ZERO + PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + LOGICAL APPLYLEFT + INTEGER I, LASTV, LASTC +* .. +* .. External Subroutines .. + EXTERNAL DGEMV, DGER +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILADLR, ILADLC + EXTERNAL LSAME, ILADLR, ILADLC +* .. +* .. Executable Statements .. +* + APPLYLEFT = LSAME( SIDE, 'L' ) + LASTV = 0 + LASTC = 0 + IF( TAU.NE.ZERO ) THEN +! Set up variables for scanning V. LASTV begins pointing to the end +! of V. + IF( APPLYLEFT ) THEN + LASTV = M + ELSE + LASTV = N + END IF + IF( INCV.GT.0 ) THEN + I = 1 + (LASTV-1) * INCV + ELSE + I = 1 + END IF +! Look for the last non-zero row in V. + DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) + LASTV = LASTV - 1 + I = I - INCV + END DO + IF( APPLYLEFT ) THEN +! Scan for the last non-zero column in C(1:lastv,:). + LASTC = ILADLC(LASTV, N, C, LDC) + ELSE +! Scan for the last non-zero row in C(:,1:lastv). + LASTC = ILADLR(M, LASTV, C, LDC) + END IF + END IF +! Note that lastc.eq.0 renders the BLAS operations null; no special +! case is needed at this level. + IF( APPLYLEFT ) THEN +* +* Form H * C +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1) +* + CALL DGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV, + $ ZERO, WORK, 1 ) +* +* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T +* + CALL DGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) + END IF + ELSE +* +* Form C * H +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) +* + CALL DGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, + $ V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T +* + CALL DGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) + END IF + END IF + RETURN +* +* End of DLARF +* + END diff --git a/lib/eigen-3.4.0/lapack/dlarfb.f b/lib/eigen-3.4.0/lapack/dlarfb.f new file mode 100644 index 0000000..206d3b2 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlarfb.f @@ -0,0 +1,762 @@ +*> \brief \b DLARFB +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLARFB + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE DLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, +* T, LDT, C, LDC, WORK, LDWORK ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, SIDE, STOREV, TRANS +* INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. +* DOUBLE PRECISION C( LDC, * ), T( LDT, * ), V( LDV, * ), +* $ WORK( LDWORK, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLARFB applies a real block reflector H or its transpose H**T to a +*> real m by n matrix C, from either the left or the right. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': apply H or H**T from the Left +*> = 'R': apply H or H**T from the Right +*> \endverbatim +*> +*> \param[in] TRANS +*> \verbatim +*> TRANS is CHARACTER*1 +*> = 'N': apply H (No transpose) +*> = 'T': apply H**T (Transpose) +*> \endverbatim +*> +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Indicates how H is formed from a product of elementary +*> reflectors +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Indicates how the vectors which define the elementary +*> reflectors are stored: +*> = 'C': Columnwise +*> = 'R': Rowwise +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the matrix T (= the number of elementary +*> reflectors whose product defines the block reflector). +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is DOUBLE PRECISION array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,M) if STOREV = 'R' and SIDE = 'L' +*> (LDV,N) if STOREV = 'R' and SIDE = 'R' +*> The matrix V. See Further Details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); +*> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); +*> if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] T +*> \verbatim +*> T is DOUBLE PRECISION array, dimension (LDT,K) +*> The triangular k by k matrix T in the representation of the +*> block reflector. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is DOUBLE PRECISION array, dimension (LDC,N) +*> On entry, the m by n matrix C. +*> On exit, C is overwritten by H*C or H**T*C or C*H or C*H**T. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is DOUBLE PRECISION array, dimension (LDWORK,K) +*> \endverbatim +*> +*> \param[in] LDWORK +*> \verbatim +*> LDWORK is INTEGER +*> The leading dimension of the array WORK. +*> If SIDE = 'L', LDWORK >= max(1,N); +*> if SIDE = 'R', LDWORK >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup doubleOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored; the corresponding +*> array elements are modified but restored on exit. The rest of the +*> array is not used. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE DLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, + $ T, LDT, C, LDC, WORK, LDWORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, SIDE, STOREV, TRANS + INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. + DOUBLE PRECISION C( LDC, * ), T( LDT, * ), V( LDV, * ), + $ WORK( LDWORK, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE + PARAMETER ( ONE = 1.0D+0 ) +* .. +* .. Local Scalars .. + CHARACTER TRANST + INTEGER I, J, LASTV, LASTC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILADLR, ILADLC + EXTERNAL LSAME, ILADLR, ILADLC +* .. +* .. External Subroutines .. + EXTERNAL DCOPY, DGEMM, DTRMM +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( M.LE.0 .OR. N.LE.0 ) + $ RETURN +* + IF( LSAME( TRANS, 'N' ) ) THEN + TRANST = 'T' + ELSE + TRANST = 'N' + END IF +* + IF( LSAME( STOREV, 'C' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 ) (first K rows) +* ( V2 ) +* where V1 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILADLR( M, K, V, LDV ) ) + LASTC = ILADLC( LASTV, N, C, LDC ) +* +* W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) +* +* W := C1**T +* + DO 10 J = 1, K + CALL DCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + 10 CONTINUE +* +* W := W * V1 +* + CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**T *V2 +* + CALL DGEMM( 'Transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL DTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2 * W**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, ONE, + $ C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1**T +* + CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**T +* + DO 30 J = 1, K + DO 20 I = 1, LASTC + C( J, I ) = C( J, I ) - WORK( I, J ) + 20 CONTINUE + 30 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILADLR( N, K, V, LDV ) ) + LASTC = ILADLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C1 +* + DO 40 J = 1, K + CALL DCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 40 CONTINUE +* +* W := W * V1 +* + CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2 +* + CALL DGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL DTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, ONE, + $ C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1**T +* + CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 60 J = 1, K + DO 50 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 50 CONTINUE + 60 CONTINUE + END IF +* + ELSE +* +* Let V = ( V1 ) +* ( V2 ) (last K rows) +* where V2 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILADLR( M, K, V, LDV ) ) + LASTC = ILADLC( LASTV, N, C, LDC ) +* +* W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) +* +* W := C2**T +* + DO 70 J = 1, K + CALL DCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + 70 CONTINUE +* +* W := W * V2 +* + CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**T*V1 +* + CALL DGEMM( 'Transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL DTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1 * W**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**T +* + CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**T +* + DO 90 J = 1, K + DO 80 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) + 80 CONTINUE + 90 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILADLR( N, K, V, LDV ) ) + LASTC = ILADLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C2 +* + DO 100 J = 1, K + CALL DCOPY( LASTC, C( 1, N-K+J ), 1, WORK( 1, J ), 1 ) + 100 CONTINUE +* +* W := W * V2 +* + CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1 +* + CALL DGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL DTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**T +* + CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W +* + DO 120 J = 1, K + DO 110 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) + 110 CONTINUE + 120 CONTINUE + END IF + END IF +* + ELSE IF( LSAME( STOREV, 'R' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 V2 ) (V1: first K columns) +* where V1 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILADLC( K, M, V, LDV ) ) + LASTC = ILADLC( LASTV, N, C, LDC ) +* +* W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) +* +* W := C1**T +* + DO 130 J = 1, K + CALL DCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + 130 CONTINUE +* +* W := W * V1**T +* + CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**T*V2**T +* + CALL DGEMM( 'Transpose', 'Transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL DTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**T * W**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2**T * W**T +* + CALL DGEMM( 'Transpose', 'Transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, + $ ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**T +* + DO 150 J = 1, K + DO 140 I = 1, LASTC + C( J, I ) = C( J, I ) - WORK( I, J ) + 140 CONTINUE + 150 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILADLC( K, N, V, LDV ) ) + LASTC = ILADLR( M, LASTV, C, LDC ) +* +* W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) +* +* W := C1 +* + DO 160 J = 1, K + CALL DCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 160 CONTINUE +* +* W := W * V1**T +* + CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL DTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2 +* + CALL DGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 180 J = 1, K + DO 170 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 170 CONTINUE + 180 CONTINUE +* + END IF +* + ELSE +* +* Let V = ( V1 V2 ) (V2: last K columns) +* where V2 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILADLC( K, M, V, LDV ) ) + LASTC = ILADLC( LASTV, N, C, LDC ) +* +* W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) +* +* W := C2**T +* + DO 190 J = 1, K + CALL DCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + 190 CONTINUE +* +* W := W * V2**T +* + CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**T * V1**T +* + CALL DGEMM( 'Transpose', 'Transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL DTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**T * W**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1**T * W**T +* + CALL DGEMM( 'Transpose', 'Transpose', + $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**T +* + DO 210 J = 1, K + DO 200 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) + 200 CONTINUE + 210 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILADLC( K, N, V, LDV ) ) + LASTC = ILADLR( M, LASTV, C, LDC ) +* +* W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) +* +* W := C2 +* + DO 220 J = 1, K + CALL DCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 220 CONTINUE +* +* W := W * V2**T +* + CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1**T +* + CALL DGEMM( 'No transpose', 'Transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL DTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1 +* + CALL DGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 240 J = 1, K + DO 230 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) + 230 CONTINUE + 240 CONTINUE +* + END IF +* + END IF + END IF +* + RETURN +* +* End of DLARFB +* + END diff --git a/lib/eigen-3.4.0/lapack/dlarfg.f b/lib/eigen-3.4.0/lapack/dlarfg.f new file mode 100644 index 0000000..458ad2e --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlarfg.f @@ -0,0 +1,196 @@ +*> \brief \b DLARFG +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLARFG + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE DLARFG( N, ALPHA, X, INCX, TAU ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* DOUBLE PRECISION ALPHA, TAU +* .. +* .. Array Arguments .. +* DOUBLE PRECISION X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLARFG generates a real elementary reflector H of order n, such +*> that +*> +*> H * ( alpha ) = ( beta ), H**T * H = I. +*> ( x ) ( 0 ) +*> +*> where alpha and beta are scalars, and x is an (n-1)-element real +*> vector. H is represented in the form +*> +*> H = I - tau * ( 1 ) * ( 1 v**T ) , +*> ( v ) +*> +*> where tau is a real scalar and v is a real (n-1)-element +*> vector. +*> +*> If the elements of x are all zero, then tau = 0 and H is taken to be +*> the unit matrix. +*> +*> Otherwise 1 <= tau <= 2. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the elementary reflector. +*> \endverbatim +*> +*> \param[in,out] ALPHA +*> \verbatim +*> ALPHA is DOUBLE PRECISION +*> On entry, the value alpha. +*> On exit, it is overwritten with the value beta. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is DOUBLE PRECISION array, dimension +*> (1+(N-2)*abs(INCX)) +*> On entry, the vector x. +*> On exit, it is overwritten with the vector v. +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The increment between elements of X. INCX > 0. +*> \endverbatim +*> +*> \param[out] TAU +*> \verbatim +*> TAU is DOUBLE PRECISION +*> The value tau. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup doubleOTHERauxiliary +* +* ===================================================================== + SUBROUTINE DLARFG( N, ALPHA, X, INCX, TAU ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N + DOUBLE PRECISION ALPHA, TAU +* .. +* .. Array Arguments .. + DOUBLE PRECISION X( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE, ZERO + PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER J, KNT + DOUBLE PRECISION BETA, RSAFMN, SAFMIN, XNORM +* .. +* .. External Functions .. + DOUBLE PRECISION DLAMCH, DLAPY2, DNRM2 + EXTERNAL DLAMCH, DLAPY2, DNRM2 +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, SIGN +* .. +* .. External Subroutines .. + EXTERNAL DSCAL +* .. +* .. Executable Statements .. +* + IF( N.LE.1 ) THEN + TAU = ZERO + RETURN + END IF +* + XNORM = DNRM2( N-1, X, INCX ) +* + IF( XNORM.EQ.ZERO ) THEN +* +* H = I +* + TAU = ZERO + ELSE +* +* general case +* + BETA = -SIGN( DLAPY2( ALPHA, XNORM ), ALPHA ) + SAFMIN = DLAMCH( 'S' ) / DLAMCH( 'E' ) + KNT = 0 + IF( ABS( BETA ).LT.SAFMIN ) THEN +* +* XNORM, BETA may be inaccurate; scale X and recompute them +* + RSAFMN = ONE / SAFMIN + 10 CONTINUE + KNT = KNT + 1 + CALL DSCAL( N-1, RSAFMN, X, INCX ) + BETA = BETA*RSAFMN + ALPHA = ALPHA*RSAFMN + IF( ABS( BETA ).LT.SAFMIN ) + $ GO TO 10 +* +* New BETA is at most 1, at least SAFMIN +* + XNORM = DNRM2( N-1, X, INCX ) + BETA = -SIGN( DLAPY2( ALPHA, XNORM ), ALPHA ) + END IF + TAU = ( BETA-ALPHA ) / BETA + CALL DSCAL( N-1, ONE / ( ALPHA-BETA ), X, INCX ) +* +* If ALPHA is subnormal, it may lose relative accuracy +* + DO 20 J = 1, KNT + BETA = BETA*SAFMIN + 20 CONTINUE + ALPHA = BETA + END IF +* + RETURN +* +* End of DLARFG +* + END diff --git a/lib/eigen-3.4.0/lapack/dlarft.f b/lib/eigen-3.4.0/lapack/dlarft.f new file mode 100644 index 0000000..4b75504 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dlarft.f @@ -0,0 +1,326 @@ +*> \brief \b DLARFT +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download DLARFT + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE DLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, STOREV +* INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. +* DOUBLE PRECISION T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DLARFT forms the triangular factor T of a real block reflector H +*> of order n, which is defined as a product of k elementary reflectors. +*> +*> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; +*> +*> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. +*> +*> If STOREV = 'C', the vector which defines the elementary reflector +*> H(i) is stored in the i-th column of the array V, and +*> +*> H = I - V * T * V**T +*> +*> If STOREV = 'R', the vector which defines the elementary reflector +*> H(i) is stored in the i-th row of the array V, and +*> +*> H = I - V**T * T * V +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Specifies the order in which the elementary reflectors are +*> multiplied to form the block reflector: +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Specifies how the vectors which define the elementary +*> reflectors are stored (see also Further Details): +*> = 'C': columnwise +*> = 'R': rowwise +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the block reflector H. N >= 0. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the triangular factor T (= the number of +*> elementary reflectors). K >= 1. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is DOUBLE PRECISION array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,N) if STOREV = 'R' +*> The matrix V. See further details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is DOUBLE PRECISION array, dimension (K) +*> TAU(i) must contain the scalar factor of the elementary +*> reflector H(i). +*> \endverbatim +*> +*> \param[out] T +*> \verbatim +*> T is DOUBLE PRECISION array, dimension (LDT,K) +*> The k by k triangular factor T of the block reflector. +*> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is +*> lower triangular. The rest of the array is not used. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup doubleOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE DLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, STOREV + INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. + DOUBLE PRECISION T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE, ZERO + PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER I, J, PREVLASTV, LASTV +* .. +* .. External Subroutines .. + EXTERNAL DGEMV, DTRMV +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( N.EQ.0 ) + $ RETURN +* + IF( LSAME( DIRECT, 'F' ) ) THEN + PREVLASTV = N + DO I = 1, K + PREVLASTV = MAX( I, PREVLASTV ) + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = 1, I + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( I , J ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**T * V(i:j,i) +* + CALL DGEMV( 'Transpose', J-I, I-1, -TAU( I ), + $ V( I+1, 1 ), LDV, V( I+1, I ), 1, ONE, + $ T( 1, I ), 1 ) + ELSE +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( J , I ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**T +* + CALL DGEMV( 'No transpose', I-1, J-I, -TAU( I ), + $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, ONE, + $ T( 1, I ), 1 ) + END IF +* +* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) +* + CALL DTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, + $ LDT, T( 1, I ), 1 ) + T( I, I ) = TAU( I ) + IF( I.GT.1 ) THEN + PREVLASTV = MAX( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + END DO + ELSE + PREVLASTV = 1 + DO I = K, 1, -1 + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = I, K + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( I.LT.K ) THEN + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( N-K+I , J ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**T * V(j:n-k+i,i) +* + CALL DGEMV( 'Transpose', N-K+I-J, K-I, -TAU( I ), + $ V( J, I+1 ), LDV, V( J, I ), 1, ONE, + $ T( I+1, I ), 1 ) + ELSE +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( J, N-K+I ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**T +* + CALL DGEMV( 'No transpose', K-I, N-K+I-J, + $ -TAU( I ), V( I+1, J ), LDV, V( I, J ), LDV, + $ ONE, T( I+1, I ), 1 ) + END IF +* +* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) +* + CALL DTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, + $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) + IF( I.GT.1 ) THEN + PREVLASTV = MIN( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + T( I, I ) = TAU( I ) + END IF + END DO + END IF + RETURN +* +* End of DLARFT +* + END diff --git a/lib/eigen-3.4.0/lapack/double.cpp b/lib/eigen-3.4.0/lapack/double.cpp new file mode 100644 index 0000000..ea78bb6 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/double.cpp @@ -0,0 +1,18 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define SCALAR double +#define SCALAR_SUFFIX d +#define SCALAR_SUFFIX_UP "D" +#define ISCOMPLEX 0 + +#include "cholesky.cpp" +#include "lu.cpp" +#include "eigenvalues.cpp" +#include "svd.cpp" diff --git a/lib/eigen-3.4.0/lapack/dsecnd_NONE.f b/lib/eigen-3.4.0/lapack/dsecnd_NONE.f new file mode 100644 index 0000000..61a8dff --- /dev/null +++ b/lib/eigen-3.4.0/lapack/dsecnd_NONE.f @@ -0,0 +1,52 @@ +*> \brief \b DSECND returns nothing +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +* Definition: +* =========== +* +* DOUBLE PRECISION FUNCTION DSECND( ) +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> DSECND returns nothing instead of returning the user time for a process in seconds. +*> If you are using that routine, it means that neither EXTERNAL ETIME, +*> EXTERNAL ETIME_, INTERNAL ETIME, INTERNAL CPU_TIME is available on +*> your machine. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + DOUBLE PRECISION FUNCTION DSECND( ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* ===================================================================== +* + DSECND = 0.0D+0 + RETURN +* +* End of DSECND +* + END diff --git a/lib/eigen-3.4.0/lapack/eigenvalues.cpp b/lib/eigen-3.4.0/lapack/eigenvalues.cpp new file mode 100644 index 0000000..921c515 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/eigenvalues.cpp @@ -0,0 +1,62 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "lapack_common.h" +#include + +// computes eigen values and vectors of a general N-by-N matrix A +EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info)) +{ + // TODO exploit the work buffer + bool query_size = *lwork==-1; + + *info = 0; + if(*jobz!='N' && *jobz!='V') *info = -1; + else if(UPLO(*uplo)==INVALID) *info = -2; + else if(*n<0) *info = -3; + else if(*lda eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly); + + if(eig.info()==NoConvergence) + { + make_vector(w,*n).setZero(); + if(computeVectors) + matrix(a,*n,*n,*lda).setIdentity(); + //*info = 1; + return 0; + } + + make_vector(w,*n) = eig.eigenvalues(); + if(computeVectors) + matrix(a,*n,*n,*lda) = eig.eigenvectors(); + + return 0; +} diff --git a/lib/eigen-3.4.0/lapack/ilaclc.f b/lib/eigen-3.4.0/lapack/ilaclc.f new file mode 100644 index 0000000..4ceb61c --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilaclc.f @@ -0,0 +1,118 @@ +*> \brief \b ILACLC +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILACLC + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILACLC( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* COMPLEX A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILACLC scans A for its last non-zero column. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is COMPLEX array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILACLC( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + COMPLEX A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX ZERO + PARAMETER ( ZERO = (0.0E+0, 0.0E+0) ) +* .. +* .. Local Scalars .. + INTEGER I +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( N.EQ.0 ) THEN + ILACLC = N + ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILACLC = N + ELSE +* Now scan each column from the end, returning with the first non-zero. + DO ILACLC = N, 1, -1 + DO I = 1, M + IF( A(I, ILACLC).NE.ZERO ) RETURN + END DO + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/ilaclr.f b/lib/eigen-3.4.0/lapack/ilaclr.f new file mode 100644 index 0000000..d8ab09c --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilaclr.f @@ -0,0 +1,121 @@ +*> \brief \b ILACLR +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILACLR + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILACLR( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* COMPLEX A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILACLR scans A for its last non-zero row. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup complexOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILACLR( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + COMPLEX A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX ZERO + PARAMETER ( ZERO = (0.0E+0, 0.0E+0) ) +* .. +* .. Local Scalars .. + INTEGER I, J +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( M.EQ.0 ) THEN + ILACLR = M + ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILACLR = M + ELSE +* Scan up each column tracking the last zero row seen. + ILACLR = 0 + DO J = 1, N + I=M + DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) + I=I-1 + ENDDO + ILACLR = MAX( ILACLR, I ) + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/iladlc.f b/lib/eigen-3.4.0/lapack/iladlc.f new file mode 100644 index 0000000..f84bd83 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/iladlc.f @@ -0,0 +1,118 @@ +*> \brief \b ILADLC +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILADLC + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILADLC( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* DOUBLE PRECISION A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILADLC scans A for its last non-zero column. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is DOUBLE PRECISION array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILADLC( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + DOUBLE PRECISION A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ZERO + PARAMETER ( ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER I +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( N.EQ.0 ) THEN + ILADLC = N + ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILADLC = N + ELSE +* Now scan each column from the end, returning with the first non-zero. + DO ILADLC = N, 1, -1 + DO I = 1, M + IF( A(I, ILADLC).NE.ZERO ) RETURN + END DO + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/iladlr.f b/lib/eigen-3.4.0/lapack/iladlr.f new file mode 100644 index 0000000..2114c61 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/iladlr.f @@ -0,0 +1,121 @@ +*> \brief \b ILADLR +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILADLR + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILADLR( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* DOUBLE PRECISION A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILADLR scans A for its last non-zero row. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is DOUBLE PRECISION array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILADLR( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + DOUBLE PRECISION A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ZERO + PARAMETER ( ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER I, J +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( M.EQ.0 ) THEN + ILADLR = M + ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILADLR = M + ELSE +* Scan up each column tracking the last zero row seen. + ILADLR = 0 + DO J = 1, N + I=M + DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) + I=I-1 + ENDDO + ILADLR = MAX( ILADLR, I ) + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/ilaslc.f b/lib/eigen-3.4.0/lapack/ilaslc.f new file mode 100644 index 0000000..e3db0f4 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilaslc.f @@ -0,0 +1,118 @@ +*> \brief \b ILASLC +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILASLC + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILASLC( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* REAL A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILASLC scans A for its last non-zero column. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is REAL array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup realOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILASLC( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + REAL A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ZERO + PARAMETER ( ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER I +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( N.EQ.0 ) THEN + ILASLC = N + ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILASLC = N + ELSE +* Now scan each column from the end, returning with the first non-zero. + DO ILASLC = N, 1, -1 + DO I = 1, M + IF( A(I, ILASLC).NE.ZERO ) RETURN + END DO + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/ilaslr.f b/lib/eigen-3.4.0/lapack/ilaslr.f new file mode 100644 index 0000000..48b73f4 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilaslr.f @@ -0,0 +1,121 @@ +*> \brief \b ILASLR +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILASLR + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILASLR( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* REAL A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILASLR scans A for its last non-zero row. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is REAL array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup realOTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILASLR( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + REAL A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ZERO + PARAMETER ( ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + INTEGER I, J +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( M.EQ.0 ) THEN + ILASLR = M + ELSEIF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILASLR = M + ELSE +* Scan up each column tracking the last zero row seen. + ILASLR = 0 + DO J = 1, N + I=M + DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) + I=I-1 + ENDDO + ILASLR = MAX( ILASLR, I ) + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/ilazlc.f b/lib/eigen-3.4.0/lapack/ilazlc.f new file mode 100644 index 0000000..15b1490 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilazlc.f @@ -0,0 +1,118 @@ +*> \brief \b ILAZLC +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILAZLC + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILAZLC( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* COMPLEX*16 A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILAZLC scans A for its last non-zero column. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is COMPLEX*16 array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILAZLC( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + COMPLEX*16 A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX*16 ZERO + PARAMETER ( ZERO = (0.0D+0, 0.0D+0) ) +* .. +* .. Local Scalars .. + INTEGER I +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( N.EQ.0 ) THEN + ILAZLC = N + ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILAZLC = N + ELSE +* Now scan each column from the end, returning with the first non-zero. + DO ILAZLC = N, 1, -1 + DO I = 1, M + IF( A(I, ILAZLC).NE.ZERO ) RETURN + END DO + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/ilazlr.f b/lib/eigen-3.4.0/lapack/ilazlr.f new file mode 100644 index 0000000..b2ab943 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/ilazlr.f @@ -0,0 +1,121 @@ +*> \brief \b ILAZLR +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ILAZLR + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* INTEGER FUNCTION ILAZLR( M, N, A, LDA ) +* +* .. Scalar Arguments .. +* INTEGER M, N, LDA +* .. +* .. Array Arguments .. +* COMPLEX*16 A( LDA, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ILAZLR scans A for its last non-zero row. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix A. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix A. +*> \endverbatim +*> +*> \param[in] A +*> \verbatim +*> A is COMPLEX*16 array, dimension (LDA,N) +*> The m by n matrix A. +*> \endverbatim +*> +*> \param[in] LDA +*> \verbatim +*> LDA is INTEGER +*> The leading dimension of the array A. LDA >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + INTEGER FUNCTION ILAZLR( M, N, A, LDA ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + INTEGER M, N, LDA +* .. +* .. Array Arguments .. + COMPLEX*16 A( LDA, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX*16 ZERO + PARAMETER ( ZERO = (0.0D+0, 0.0D+0) ) +* .. +* .. Local Scalars .. + INTEGER I, J +* .. +* .. Executable Statements .. +* +* Quick test for the common case where one corner is non-zero. + IF( M.EQ.0 ) THEN + ILAZLR = M + ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN + ILAZLR = M + ELSE +* Scan up each column tracking the last zero row seen. + ILAZLR = 0 + DO J = 1, N + I=M + DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) + I=I-1 + ENDDO + ILAZLR = MAX( ILAZLR, I ) + END DO + END IF + RETURN + END diff --git a/lib/eigen-3.4.0/lapack/lapack_common.h b/lib/eigen-3.4.0/lapack/lapack_common.h new file mode 100644 index 0000000..c872a81 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/lapack_common.h @@ -0,0 +1,29 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LAPACK_COMMON_H +#define EIGEN_LAPACK_COMMON_H + +#include "../blas/common.h" +#include "../Eigen/src/misc/lapack.h" + +#define EIGEN_LAPACK_FUNC(FUNC,ARGLIST) \ + extern "C" { int EIGEN_BLAS_FUNC(FUNC) ARGLIST; } \ + int EIGEN_BLAS_FUNC(FUNC) ARGLIST + +typedef Eigen::Map > PivotsType; + +#if ISCOMPLEX +#define EIGEN_LAPACK_ARG_IF_COMPLEX(X) X, +#else +#define EIGEN_LAPACK_ARG_IF_COMPLEX(X) +#endif + + +#endif // EIGEN_LAPACK_COMMON_H diff --git a/lib/eigen-3.4.0/lapack/lu.cpp b/lib/eigen-3.4.0/lapack/lu.cpp new file mode 100644 index 0000000..90cebe0 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/lu.cpp @@ -0,0 +1,89 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "common.h" +#include + +// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges +EIGEN_LAPACK_FUNC(getrf,(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info)) +{ + *info = 0; + if(*m<0) *info = -1; + else if(*n<0) *info = -2; + else if(*lda(pa); + int nb_transpositions; + int ret = int(Eigen::internal::partial_lu_impl + ::blocked_lu(*m, *n, a, *lda, ipiv, nb_transpositions)); + + for(int i=0; i=0) + *info = ret+1; + + return 0; +} + +//GETRS solves a system of linear equations +// A * X = B or A' * X = B +// with a general N-by-N matrix A using the LU factorization computed by GETRF +EIGEN_LAPACK_FUNC(getrs,(char *trans, int *n, int *nrhs, RealScalar *pa, int *lda, int *ipiv, RealScalar *pb, int *ldb, int *info)) +{ + *info = 0; + if(OP(*trans)==INVALID) *info = -1; + else if(*n<0) *info = -2; + else if(*nrhs<0) *info = -3; + else if(*lda(pa); + Scalar* b = reinterpret_cast(pb); + MatrixType lu(a,*n,*n,*lda); + MatrixType B(b,*n,*nrhs,*ldb); + + for(int i=0; i<*n; ++i) + ipiv[i]--; + if(OP(*trans)==NOTR) + { + B = PivotsType(ipiv,*n) * B; + lu.triangularView().solveInPlace(B); + lu.triangularView().solveInPlace(B); + } + else if(OP(*trans)==TR) + { + lu.triangularView().transpose().solveInPlace(B); + lu.triangularView().transpose().solveInPlace(B); + B = PivotsType(ipiv,*n).transpose() * B; + } + else if(OP(*trans)==ADJ) + { + lu.triangularView().adjoint().solveInPlace(B); + lu.triangularView().adjoint().solveInPlace(B); + B = PivotsType(ipiv,*n).transpose() * B; + } + for(int i=0; i<*n; ++i) + ipiv[i]++; + + return 0; +} diff --git a/lib/eigen-3.4.0/lapack/second_NONE.f b/lib/eigen-3.4.0/lapack/second_NONE.f new file mode 100644 index 0000000..d3e6d33 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/second_NONE.f @@ -0,0 +1,52 @@ +*> \brief \b SECOND returns nothing +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +* Definition: +* =========== +* +* REAL FUNCTION SECOND( ) +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SECOND returns nothing instead of returning the user time for a process in seconds. +*> If you are using that routine, it means that neither EXTERNAL ETIME, +*> EXTERNAL ETIME_, INTERNAL ETIME, INTERNAL CPU_TIME is available on +*> your machine. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + REAL FUNCTION SECOND( ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* ===================================================================== +* + SECOND = 0.0E+0 + RETURN +* +* End of SECOND +* + END diff --git a/lib/eigen-3.4.0/lapack/single.cpp b/lib/eigen-3.4.0/lapack/single.cpp new file mode 100644 index 0000000..c7da3ef --- /dev/null +++ b/lib/eigen-3.4.0/lapack/single.cpp @@ -0,0 +1,18 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define SCALAR float +#define SCALAR_SUFFIX s +#define SCALAR_SUFFIX_UP "S" +#define ISCOMPLEX 0 + +#include "cholesky.cpp" +#include "lu.cpp" +#include "eigenvalues.cpp" +#include "svd.cpp" diff --git a/lib/eigen-3.4.0/lapack/sladiv.f b/lib/eigen-3.4.0/lapack/sladiv.f new file mode 100644 index 0000000..da3afa3 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/sladiv.f @@ -0,0 +1,128 @@ +*> \brief \b SLADIV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLADIV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE SLADIV( A, B, C, D, P, Q ) +* +* .. Scalar Arguments .. +* REAL A, B, C, D, P, Q +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLADIV performs complex division in real arithmetic +*> +*> a + i*b +*> p + i*q = --------- +*> c + i*d +*> +*> The algorithm is due to Robert L. Smith and can be found +*> in D. Knuth, The art of Computer Programming, Vol.2, p.195 +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] A +*> \verbatim +*> A is REAL +*> \endverbatim +*> +*> \param[in] B +*> \verbatim +*> B is REAL +*> \endverbatim +*> +*> \param[in] C +*> \verbatim +*> C is REAL +*> \endverbatim +*> +*> \param[in] D +*> \verbatim +*> D is REAL +*> The scalars a, b, c, and d in the above expression. +*> \endverbatim +*> +*> \param[out] P +*> \verbatim +*> P is REAL +*> \endverbatim +*> +*> \param[out] Q +*> \verbatim +*> Q is REAL +*> The scalars p and q in the above expression. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + SUBROUTINE SLADIV( A, B, C, D, P, Q ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + REAL A, B, C, D, P, Q +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + REAL E, F +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS +* .. +* .. Executable Statements .. +* + IF( ABS( D ).LT.ABS( C ) ) THEN + E = D / C + F = C + D*E + P = ( A+B*E ) / F + Q = ( B-A*E ) / F + ELSE + E = C / D + F = D + C*E + P = ( B+A*E ) / F + Q = ( -A+B*E ) / F + END IF +* + RETURN +* +* End of SLADIV +* + END diff --git a/lib/eigen-3.4.0/lapack/slamch.f b/lib/eigen-3.4.0/lapack/slamch.f new file mode 100644 index 0000000..4bffad0 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slamch.f @@ -0,0 +1,192 @@ +*> \brief \b SLAMCH +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +* Definition: +* =========== +* +* REAL FUNCTION SLAMCH( CMACH ) +* +* .. Scalar Arguments .. +* CHARACTER CMACH +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLAMCH determines single precision machine parameters. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] CMACH +*> \verbatim +*> Specifies the value to be returned by SLAMCH: +*> = 'E' or 'e', SLAMCH := eps +*> = 'S' or 's , SLAMCH := sfmin +*> = 'B' or 'b', SLAMCH := base +*> = 'P' or 'p', SLAMCH := eps*base +*> = 'N' or 'n', SLAMCH := t +*> = 'R' or 'r', SLAMCH := rnd +*> = 'M' or 'm', SLAMCH := emin +*> = 'U' or 'u', SLAMCH := rmin +*> = 'L' or 'l', SLAMCH := emax +*> = 'O' or 'o', SLAMCH := rmax +*> where +*> eps = relative machine precision +*> sfmin = safe minimum, such that 1/sfmin does not overflow +*> base = base of the machine +*> prec = eps*base +*> t = number of (base) digits in the mantissa +*> rnd = 1.0 when rounding occurs in addition, 0.0 otherwise +*> emin = minimum exponent before (gradual) underflow +*> rmin = underflow threshold - base**(emin-1) +*> emax = largest exponent before overflow +*> rmax = overflow threshold - (base**emax)*(1-eps) +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + REAL FUNCTION SLAMCH( CMACH ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER CMACH +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE, ZERO + PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + REAL RND, EPS, SFMIN, SMALL, RMACH +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Intrinsic Functions .. + INTRINSIC DIGITS, EPSILON, HUGE, MAXEXPONENT, + $ MINEXPONENT, RADIX, TINY +* .. +* .. Executable Statements .. +* +* +* Assume rounding, not chopping. Always. +* + RND = ONE +* + IF( ONE.EQ.RND ) THEN + EPS = EPSILON(ZERO) * 0.5 + ELSE + EPS = EPSILON(ZERO) + END IF +* + IF( LSAME( CMACH, 'E' ) ) THEN + RMACH = EPS + ELSE IF( LSAME( CMACH, 'S' ) ) THEN + SFMIN = TINY(ZERO) + SMALL = ONE / HUGE(ZERO) + IF( SMALL.GE.SFMIN ) THEN +* +* Use SMALL plus a bit, to avoid the possibility of rounding +* causing overflow when computing 1/sfmin. +* + SFMIN = SMALL*( ONE+EPS ) + END IF + RMACH = SFMIN + ELSE IF( LSAME( CMACH, 'B' ) ) THEN + RMACH = RADIX(ZERO) + ELSE IF( LSAME( CMACH, 'P' ) ) THEN + RMACH = EPS * RADIX(ZERO) + ELSE IF( LSAME( CMACH, 'N' ) ) THEN + RMACH = DIGITS(ZERO) + ELSE IF( LSAME( CMACH, 'R' ) ) THEN + RMACH = RND + ELSE IF( LSAME( CMACH, 'M' ) ) THEN + RMACH = MINEXPONENT(ZERO) + ELSE IF( LSAME( CMACH, 'U' ) ) THEN + RMACH = tiny(zero) + ELSE IF( LSAME( CMACH, 'L' ) ) THEN + RMACH = MAXEXPONENT(ZERO) + ELSE IF( LSAME( CMACH, 'O' ) ) THEN + RMACH = HUGE(ZERO) + ELSE + RMACH = ZERO + END IF +* + SLAMCH = RMACH + RETURN +* +* End of SLAMCH +* + END +************************************************************************ +*> \brief \b SLAMC3 +*> \details +*> \b Purpose: +*> \verbatim +*> SLAMC3 is intended to force A and B to be stored prior to doing +*> the addition of A and B , for use in situations where optimizers +*> might hold one of these in a register. +*> \endverbatim +*> \author LAPACK is a software package provided by Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. +*> \date November 2011 +*> \ingroup auxOTHERauxiliary +*> +*> \param[in] A +*> \verbatim +*> \endverbatim +*> +*> \param[in] B +*> \verbatim +*> The values A and B. +*> \endverbatim +*> +* + REAL FUNCTION SLAMC3( A, B ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. +* November 2010 +* +* .. Scalar Arguments .. + REAL A, B +* .. +* ===================================================================== +* +* .. Executable Statements .. +* + SLAMC3 = A + B +* + RETURN +* +* End of SLAMC3 +* + END +* +************************************************************************ diff --git a/lib/eigen-3.4.0/lapack/slapy2.f b/lib/eigen-3.4.0/lapack/slapy2.f new file mode 100644 index 0000000..1f6b1ca --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slapy2.f @@ -0,0 +1,104 @@ +*> \brief \b SLAPY2 +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLAPY2 + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* REAL FUNCTION SLAPY2( X, Y ) +* +* .. Scalar Arguments .. +* REAL X, Y +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary +*> overflow. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is REAL +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is REAL +*> X and Y specify the values x and y. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + REAL FUNCTION SLAPY2( X, Y ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + REAL X, Y +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ZERO + PARAMETER ( ZERO = 0.0E0 ) + REAL ONE + PARAMETER ( ONE = 1.0E0 ) +* .. +* .. Local Scalars .. + REAL W, XABS, YABS, Z +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, MAX, MIN, SQRT +* .. +* .. Executable Statements .. +* + XABS = ABS( X ) + YABS = ABS( Y ) + W = MAX( XABS, YABS ) + Z = MIN( XABS, YABS ) + IF( Z.EQ.ZERO ) THEN + SLAPY2 = W + ELSE + SLAPY2 = W*SQRT( ONE+( Z / W )**2 ) + END IF + RETURN +* +* End of SLAPY2 +* + END diff --git a/lib/eigen-3.4.0/lapack/slapy3.f b/lib/eigen-3.4.0/lapack/slapy3.f new file mode 100644 index 0000000..aa2f5bf --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slapy3.f @@ -0,0 +1,111 @@ +*> \brief \b SLAPY3 +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLAPY3 + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* REAL FUNCTION SLAPY3( X, Y, Z ) +* +* .. Scalar Arguments .. +* REAL X, Y, Z +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause +*> unnecessary overflow. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is REAL +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is REAL +*> \endverbatim +*> +*> \param[in] Z +*> \verbatim +*> Z is REAL +*> X, Y and Z specify the values x, y and z. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup auxOTHERauxiliary +* +* ===================================================================== + REAL FUNCTION SLAPY3( X, Y, Z ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + REAL X, Y, Z +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ZERO + PARAMETER ( ZERO = 0.0E0 ) +* .. +* .. Local Scalars .. + REAL W, XABS, YABS, ZABS +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, MAX, SQRT +* .. +* .. Executable Statements .. +* + XABS = ABS( X ) + YABS = ABS( Y ) + ZABS = ABS( Z ) + W = MAX( XABS, YABS, ZABS ) + IF( W.EQ.ZERO ) THEN +* W can be zero for max(0,nan,0) +* adding all three entries together will make sure +* NaN will not disappear. + SLAPY3 = XABS + YABS + ZABS + ELSE + SLAPY3 = W*SQRT( ( XABS / W )**2+( YABS / W )**2+ + $ ( ZABS / W )**2 ) + END IF + RETURN +* +* End of SLAPY3 +* + END diff --git a/lib/eigen-3.4.0/lapack/slarf.f b/lib/eigen-3.4.0/lapack/slarf.f new file mode 100644 index 0000000..8a8ff30 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slarf.f @@ -0,0 +1,227 @@ +*> \brief \b SLARF +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLARF + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE SLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* .. Scalar Arguments .. +* CHARACTER SIDE +* INTEGER INCV, LDC, M, N +* REAL TAU +* .. +* .. Array Arguments .. +* REAL C( LDC, * ), V( * ), WORK( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLARF applies a real elementary reflector H to a real m by n matrix +*> C, from either the left or the right. H is represented in the form +*> +*> H = I - tau * v * v**T +*> +*> where tau is a real scalar and v is a real vector. +*> +*> If tau = 0, then H is taken to be the unit matrix. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': form H * C +*> = 'R': form C * H +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is REAL array, dimension +*> (1 + (M-1)*abs(INCV)) if SIDE = 'L' +*> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' +*> The vector v in the representation of H. V is not used if +*> TAU = 0. +*> \endverbatim +*> +*> \param[in] INCV +*> \verbatim +*> INCV is INTEGER +*> The increment between elements of v. INCV <> 0. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is REAL +*> The value tau in the representation of H. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is REAL array, dimension (LDC,N) +*> On entry, the m by n matrix C. +*> On exit, C is overwritten by the matrix H * C if SIDE = 'L', +*> or C * H if SIDE = 'R'. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is REAL array, dimension +*> (N) if SIDE = 'L' +*> or (M) if SIDE = 'R' +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup realOTHERauxiliary +* +* ===================================================================== + SUBROUTINE SLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER SIDE + INTEGER INCV, LDC, M, N + REAL TAU +* .. +* .. Array Arguments .. + REAL C( LDC, * ), V( * ), WORK( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE, ZERO + PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + LOGICAL APPLYLEFT + INTEGER I, LASTV, LASTC +* .. +* .. External Subroutines .. + EXTERNAL SGEMV, SGER +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILASLR, ILASLC + EXTERNAL LSAME, ILASLR, ILASLC +* .. +* .. Executable Statements .. +* + APPLYLEFT = LSAME( SIDE, 'L' ) + LASTV = 0 + LASTC = 0 + IF( TAU.NE.ZERO ) THEN +! Set up variables for scanning V. LASTV begins pointing to the end +! of V. + IF( APPLYLEFT ) THEN + LASTV = M + ELSE + LASTV = N + END IF + IF( INCV.GT.0 ) THEN + I = 1 + (LASTV-1) * INCV + ELSE + I = 1 + END IF +! Look for the last non-zero row in V. + DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) + LASTV = LASTV - 1 + I = I - INCV + END DO + IF( APPLYLEFT ) THEN +! Scan for the last non-zero column in C(1:lastv,:). + LASTC = ILASLC(LASTV, N, C, LDC) + ELSE +! Scan for the last non-zero row in C(:,1:lastv). + LASTC = ILASLR(M, LASTV, C, LDC) + END IF + END IF +! Note that lastc.eq.0 renders the BLAS operations null; no special +! case is needed at this level. + IF( APPLYLEFT ) THEN +* +* Form H * C +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1) +* + CALL SGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV, + $ ZERO, WORK, 1 ) +* +* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T +* + CALL SGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) + END IF + ELSE +* +* Form C * H +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) +* + CALL SGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, + $ V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T +* + CALL SGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) + END IF + END IF + RETURN +* +* End of SLARF +* + END diff --git a/lib/eigen-3.4.0/lapack/slarfb.f b/lib/eigen-3.4.0/lapack/slarfb.f new file mode 100644 index 0000000..eb95990 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slarfb.f @@ -0,0 +1,763 @@ +*> \brief \b SLARFB +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLARFB + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE SLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, +* T, LDT, C, LDC, WORK, LDWORK ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, SIDE, STOREV, TRANS +* INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. +* REAL C( LDC, * ), T( LDT, * ), V( LDV, * ), +* $ WORK( LDWORK, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLARFB applies a real block reflector H or its transpose H**T to a +*> real m by n matrix C, from either the left or the right. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': apply H or H**T from the Left +*> = 'R': apply H or H**T from the Right +*> \endverbatim +*> +*> \param[in] TRANS +*> \verbatim +*> TRANS is CHARACTER*1 +*> = 'N': apply H (No transpose) +*> = 'T': apply H**T (Transpose) +*> \endverbatim +*> +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Indicates how H is formed from a product of elementary +*> reflectors +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Indicates how the vectors which define the elementary +*> reflectors are stored: +*> = 'C': Columnwise +*> = 'R': Rowwise +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the matrix T (= the number of elementary +*> reflectors whose product defines the block reflector). +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is REAL array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,M) if STOREV = 'R' and SIDE = 'L' +*> (LDV,N) if STOREV = 'R' and SIDE = 'R' +*> The matrix V. See Further Details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); +*> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); +*> if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] T +*> \verbatim +*> T is REAL array, dimension (LDT,K) +*> The triangular k by k matrix T in the representation of the +*> block reflector. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is REAL array, dimension (LDC,N) +*> On entry, the m by n matrix C. +*> On exit, C is overwritten by H*C or H**T*C or C*H or C*H**T. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is REAL array, dimension (LDWORK,K) +*> \endverbatim +*> +*> \param[in] LDWORK +*> \verbatim +*> LDWORK is INTEGER +*> The leading dimension of the array WORK. +*> If SIDE = 'L', LDWORK >= max(1,N); +*> if SIDE = 'R', LDWORK >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup realOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored; the corresponding +*> array elements are modified but restored on exit. The rest of the +*> array is not used. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE SLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, + $ T, LDT, C, LDC, WORK, LDWORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, SIDE, STOREV, TRANS + INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. + REAL C( LDC, * ), T( LDT, * ), V( LDV, * ), + $ WORK( LDWORK, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE + PARAMETER ( ONE = 1.0E+0 ) +* .. +* .. Local Scalars .. + CHARACTER TRANST + INTEGER I, J, LASTV, LASTC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILASLR, ILASLC + EXTERNAL LSAME, ILASLR, ILASLC +* .. +* .. External Subroutines .. + EXTERNAL SCOPY, SGEMM, STRMM +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( M.LE.0 .OR. N.LE.0 ) + $ RETURN +* + IF( LSAME( TRANS, 'N' ) ) THEN + TRANST = 'T' + ELSE + TRANST = 'N' + END IF +* + IF( LSAME( STOREV, 'C' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 ) (first K rows) +* ( V2 ) +* where V1 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILASLR( M, K, V, LDV ) ) + LASTC = ILASLC( LASTV, N, C, LDC ) +* +* W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) +* +* W := C1**T +* + DO 10 J = 1, K + CALL SCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + 10 CONTINUE +* +* W := W * V1 +* + CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**T *V2 +* + CALL SGEMM( 'Transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL STRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2 * W**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, ONE, + $ C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1**T +* + CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**T +* + DO 30 J = 1, K + DO 20 I = 1, LASTC + C( J, I ) = C( J, I ) - WORK( I, J ) + 20 CONTINUE + 30 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILASLR( N, K, V, LDV ) ) + LASTC = ILASLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C1 +* + DO 40 J = 1, K + CALL SCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 40 CONTINUE +* +* W := W * V1 +* + CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2 +* + CALL SGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL STRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, ONE, + $ C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1**T +* + CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 60 J = 1, K + DO 50 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 50 CONTINUE + 60 CONTINUE + END IF +* + ELSE +* +* Let V = ( V1 ) +* ( V2 ) (last K rows) +* where V2 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILASLR( M, K, V, LDV ) ) + LASTC = ILASLC( LASTV, N, C, LDC ) +* +* W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) +* +* W := C2**T +* + DO 70 J = 1, K + CALL SCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + 70 CONTINUE +* +* W := W * V2 +* + CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**T*V1 +* + CALL SGEMM( 'Transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL STRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1 * W**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**T +* + CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**T +* + DO 90 J = 1, K + DO 80 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) + 80 CONTINUE + 90 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILASLR( N, K, V, LDV ) ) + LASTC = ILASLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C2 +* + DO 100 J = 1, K + CALL SCOPY( LASTC, C( 1, N-K+J ), 1, WORK( 1, J ), 1 ) + 100 CONTINUE +* +* W := W * V2 +* + CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1 +* + CALL SGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL STRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**T +* + CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W +* + DO 120 J = 1, K + DO 110 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) + 110 CONTINUE + 120 CONTINUE + END IF + END IF +* + ELSE IF( LSAME( STOREV, 'R' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 V2 ) (V1: first K columns) +* where V1 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILASLC( K, M, V, LDV ) ) + LASTC = ILASLC( LASTV, N, C, LDC ) +* +* W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) +* +* W := C1**T +* + DO 130 J = 1, K + CALL SCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + 130 CONTINUE +* +* W := W * V1**T +* + CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**T*V2**T +* + CALL SGEMM( 'Transpose', 'Transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL STRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**T * W**T +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2**T * W**T +* + CALL SGEMM( 'Transpose', 'Transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, + $ ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**T +* + DO 150 J = 1, K + DO 140 I = 1, LASTC + C( J, I ) = C( J, I ) - WORK( I, J ) + 140 CONTINUE + 150 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILASLC( K, N, V, LDV ) ) + LASTC = ILASLR( M, LASTV, C, LDC ) +* +* W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) +* +* W := C1 +* + DO 160 J = 1, K + CALL SCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 160 CONTINUE +* +* W := W * V1**T +* + CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL STRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2 +* + CALL SGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 180 J = 1, K + DO 170 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 170 CONTINUE + 180 CONTINUE +* + END IF +* + ELSE +* +* Let V = ( V1 V2 ) (V2: last K columns) +* where V2 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**T * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILASLC( K, M, V, LDV ) ) + LASTC = ILASLC( LASTV, N, C, LDC ) +* +* W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) +* +* W := C2**T +* + DO 190 J = 1, K + CALL SCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + 190 CONTINUE +* +* W := W * V2**T +* + CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**T * V1**T +* + CALL SGEMM( 'Transpose', 'Transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**T or W * T +* + CALL STRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**T * W**T +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1**T * W**T +* + CALL SGEMM( 'Transpose', 'Transpose', + $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**T +* + DO 210 J = 1, K + DO 200 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) + 200 CONTINUE + 210 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**T where C = ( C1 C2 ) +* + LASTV = MAX( K, ILASLC( K, N, V, LDV ) ) + LASTC = ILASLR( M, LASTV, C, LDC ) +* +* W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) +* +* W := C2 +* + DO 220 J = 1, K + CALL SCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 220 CONTINUE +* +* W := W * V2**T +* + CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1**T +* + CALL SGEMM( 'No transpose', 'Transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**T +* + CALL STRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1 +* + CALL SGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 240 J = 1, K + DO 230 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) + $ - WORK( I, J ) + 230 CONTINUE + 240 CONTINUE +* + END IF +* + END IF + END IF +* + RETURN +* +* End of SLARFB +* + END diff --git a/lib/eigen-3.4.0/lapack/slarfg.f b/lib/eigen-3.4.0/lapack/slarfg.f new file mode 100644 index 0000000..4f10ffc --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slarfg.f @@ -0,0 +1,196 @@ +*> \brief \b SLARFG +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLARFG + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE SLARFG( N, ALPHA, X, INCX, TAU ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* REAL ALPHA, TAU +* .. +* .. Array Arguments .. +* REAL X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLARFG generates a real elementary reflector H of order n, such +*> that +*> +*> H * ( alpha ) = ( beta ), H**T * H = I. +*> ( x ) ( 0 ) +*> +*> where alpha and beta are scalars, and x is an (n-1)-element real +*> vector. H is represented in the form +*> +*> H = I - tau * ( 1 ) * ( 1 v**T ) , +*> ( v ) +*> +*> where tau is a real scalar and v is a real (n-1)-element +*> vector. +*> +*> If the elements of x are all zero, then tau = 0 and H is taken to be +*> the unit matrix. +*> +*> Otherwise 1 <= tau <= 2. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the elementary reflector. +*> \endverbatim +*> +*> \param[in,out] ALPHA +*> \verbatim +*> ALPHA is REAL +*> On entry, the value alpha. +*> On exit, it is overwritten with the value beta. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is REAL array, dimension +*> (1+(N-2)*abs(INCX)) +*> On entry, the vector x. +*> On exit, it is overwritten with the vector v. +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The increment between elements of X. INCX > 0. +*> \endverbatim +*> +*> \param[out] TAU +*> \verbatim +*> TAU is REAL +*> The value tau. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup realOTHERauxiliary +* +* ===================================================================== + SUBROUTINE SLARFG( N, ALPHA, X, INCX, TAU ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N + REAL ALPHA, TAU +* .. +* .. Array Arguments .. + REAL X( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE, ZERO + PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + INTEGER J, KNT + REAL BETA, RSAFMN, SAFMIN, XNORM +* .. +* .. External Functions .. + REAL SLAMCH, SLAPY2, SNRM2 + EXTERNAL SLAMCH, SLAPY2, SNRM2 +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, SIGN +* .. +* .. External Subroutines .. + EXTERNAL SSCAL +* .. +* .. Executable Statements .. +* + IF( N.LE.1 ) THEN + TAU = ZERO + RETURN + END IF +* + XNORM = SNRM2( N-1, X, INCX ) +* + IF( XNORM.EQ.ZERO ) THEN +* +* H = I +* + TAU = ZERO + ELSE +* +* general case +* + BETA = -SIGN( SLAPY2( ALPHA, XNORM ), ALPHA ) + SAFMIN = SLAMCH( 'S' ) / SLAMCH( 'E' ) + KNT = 0 + IF( ABS( BETA ).LT.SAFMIN ) THEN +* +* XNORM, BETA may be inaccurate; scale X and recompute them +* + RSAFMN = ONE / SAFMIN + 10 CONTINUE + KNT = KNT + 1 + CALL SSCAL( N-1, RSAFMN, X, INCX ) + BETA = BETA*RSAFMN + ALPHA = ALPHA*RSAFMN + IF( ABS( BETA ).LT.SAFMIN ) + $ GO TO 10 +* +* New BETA is at most 1, at least SAFMIN +* + XNORM = SNRM2( N-1, X, INCX ) + BETA = -SIGN( SLAPY2( ALPHA, XNORM ), ALPHA ) + END IF + TAU = ( BETA-ALPHA ) / BETA + CALL SSCAL( N-1, ONE / ( ALPHA-BETA ), X, INCX ) +* +* If ALPHA is subnormal, it may lose relative accuracy +* + DO 20 J = 1, KNT + BETA = BETA*SAFMIN + 20 CONTINUE + ALPHA = BETA + END IF +* + RETURN +* +* End of SLARFG +* + END diff --git a/lib/eigen-3.4.0/lapack/slarft.f b/lib/eigen-3.4.0/lapack/slarft.f new file mode 100644 index 0000000..30b0668 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/slarft.f @@ -0,0 +1,326 @@ +*> \brief \b SLARFT +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download SLARFT + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE SLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, STOREV +* INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. +* REAL T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> SLARFT forms the triangular factor T of a real block reflector H +*> of order n, which is defined as a product of k elementary reflectors. +*> +*> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; +*> +*> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. +*> +*> If STOREV = 'C', the vector which defines the elementary reflector +*> H(i) is stored in the i-th column of the array V, and +*> +*> H = I - V * T * V**T +*> +*> If STOREV = 'R', the vector which defines the elementary reflector +*> H(i) is stored in the i-th row of the array V, and +*> +*> H = I - V**T * T * V +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Specifies the order in which the elementary reflectors are +*> multiplied to form the block reflector: +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Specifies how the vectors which define the elementary +*> reflectors are stored (see also Further Details): +*> = 'C': columnwise +*> = 'R': rowwise +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the block reflector H. N >= 0. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the triangular factor T (= the number of +*> elementary reflectors). K >= 1. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is REAL array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,N) if STOREV = 'R' +*> The matrix V. See further details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is REAL array, dimension (K) +*> TAU(i) must contain the scalar factor of the elementary +*> reflector H(i). +*> \endverbatim +*> +*> \param[out] T +*> \verbatim +*> T is REAL array, dimension (LDT,K) +*> The k by k triangular factor T of the block reflector. +*> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is +*> lower triangular. The rest of the array is not used. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup realOTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE SLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, STOREV + INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. + REAL T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + REAL ONE, ZERO + PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) +* .. +* .. Local Scalars .. + INTEGER I, J, PREVLASTV, LASTV +* .. +* .. External Subroutines .. + EXTERNAL SGEMV, STRMV +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( N.EQ.0 ) + $ RETURN +* + IF( LSAME( DIRECT, 'F' ) ) THEN + PREVLASTV = N + DO I = 1, K + PREVLASTV = MAX( I, PREVLASTV ) + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = 1, I + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( I , J ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**T * V(i:j,i) +* + CALL SGEMV( 'Transpose', J-I, I-1, -TAU( I ), + $ V( I+1, 1 ), LDV, V( I+1, I ), 1, ONE, + $ T( 1, I ), 1 ) + ELSE +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( J , I ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**T +* + CALL SGEMV( 'No transpose', I-1, J-I, -TAU( I ), + $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, + $ ONE, T( 1, I ), 1 ) + END IF +* +* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) +* + CALL STRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, + $ LDT, T( 1, I ), 1 ) + T( I, I ) = TAU( I ) + IF( I.GT.1 ) THEN + PREVLASTV = MAX( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + END DO + ELSE + PREVLASTV = 1 + DO I = K, 1, -1 + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = I, K + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( I.LT.K ) THEN + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( N-K+I , J ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**T * V(j:n-k+i,i) +* + CALL SGEMV( 'Transpose', N-K+I-J, K-I, -TAU( I ), + $ V( J, I+1 ), LDV, V( J, I ), 1, ONE, + $ T( I+1, I ), 1 ) + ELSE +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( J, N-K+I ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**T +* + CALL SGEMV( 'No transpose', K-I, N-K+I-J, + $ -TAU( I ), V( I+1, J ), LDV, V( I, J ), LDV, + $ ONE, T( I+1, I ), 1 ) + END IF +* +* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) +* + CALL STRMV( 'Lower', 'No transpose', 'Non-unit', K-I, + $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) + IF( I.GT.1 ) THEN + PREVLASTV = MIN( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + T( I, I ) = TAU( I ) + END IF + END DO + END IF + RETURN +* +* End of SLARFT +* + END diff --git a/lib/eigen-3.4.0/lapack/svd.cpp b/lib/eigen-3.4.0/lapack/svd.cpp new file mode 100644 index 0000000..77b302b --- /dev/null +++ b/lib/eigen-3.4.0/lapack/svd.cpp @@ -0,0 +1,138 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "lapack_common.h" +#include + +// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer +EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork, + EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar */*rwork*/) int * /*iwork*/, int *info)) +{ + // TODO exploit the work buffer + bool query_size = *lwork==-1; + int diag_size = (std::min)(*m,*n); + + *info = 0; + if(*jobz!='A' && *jobz!='S' && *jobz!='O' && *jobz!='N') *info = -1; + else if(*m<0) *info = -2; + else if(*n<0) *info = -3; + else if(*lda=*n && *ldvt<*n)) *info = -10; + + if(*info!=0) + { + int e = -*info; + return xerbla_(SCALAR_SUFFIX_UP"GESDD ", &e, 6); + } + + if(query_size) + { + *lwork = 0; + return 0; + } + + if(*n==0 || *m==0) + return 0; + + PlainMatrixType mat(*m,*n); + mat = matrix(a,*m,*n,*lda); + + int option = *jobz=='A' ? ComputeFullU|ComputeFullV + : *jobz=='S' ? ComputeThinU|ComputeThinV + : *jobz=='O' ? ComputeThinU|ComputeThinV + : 0; + + BDCSVD svd(mat,option); + + make_vector(s,diag_size) = svd.singularValues().head(diag_size); + + if(*jobz=='A') + { + matrix(u,*m,*m,*ldu) = svd.matrixU(); + matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); + } + else if(*jobz=='S') + { + matrix(u,*m,diag_size,*ldu) = svd.matrixU(); + matrix(vt,diag_size,*n,*ldvt) = svd.matrixV().adjoint(); + } + else if(*jobz=='O' && *m>=*n) + { + matrix(a,*m,*n,*lda) = svd.matrixU(); + matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); + } + else if(*jobz=='O') + { + matrix(u,*m,*m,*ldu) = svd.matrixU(); + matrix(a,diag_size,*n,*lda) = svd.matrixV().adjoint(); + } + + return 0; +} + +// computes the singular values/vectors a general M-by-N matrix A using two sided jacobi algorithm +EIGEN_LAPACK_FUNC(gesvd,(char *jobu, char *jobv, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork, + EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar */*rwork*/) int *info)) +{ + // TODO exploit the work buffer + bool query_size = *lwork==-1; + int diag_size = (std::min)(*m,*n); + + *info = 0; + if( *jobu!='A' && *jobu!='S' && *jobu!='O' && *jobu!='N') *info = -1; + else if((*jobv!='A' && *jobv!='S' && *jobv!='O' && *jobv!='N') + || (*jobu=='O' && *jobv=='O')) *info = -2; + else if(*m<0) *info = -3; + else if(*n<0) *info = -4; + else if(*lda svd(mat,option); + + make_vector(s,diag_size) = svd.singularValues().head(diag_size); + { + if(*jobu=='A') matrix(u,*m,*m,*ldu) = svd.matrixU(); + else if(*jobu=='S') matrix(u,*m,diag_size,*ldu) = svd.matrixU(); + else if(*jobu=='O') matrix(a,*m,diag_size,*lda) = svd.matrixU(); + } + { + if(*jobv=='A') matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); + else if(*jobv=='S') matrix(vt,diag_size,*n,*ldvt) = svd.matrixV().adjoint(); + else if(*jobv=='O') matrix(a,diag_size,*n,*lda) = svd.matrixV().adjoint(); + } + return 0; +} diff --git a/lib/eigen-3.4.0/lapack/zlacgv.f b/lib/eigen-3.4.0/lapack/zlacgv.f new file mode 100644 index 0000000..16c2e2e --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zlacgv.f @@ -0,0 +1,116 @@ +*> \brief \b ZLACGV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLACGV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE ZLACGV( N, X, INCX ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* .. +* .. Array Arguments .. +* COMPLEX*16 X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLACGV conjugates a complex vector of length N. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The length of the vector X. N >= 0. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is COMPLEX*16 array, dimension +*> (1+(N-1)*abs(INCX)) +*> On entry, the vector of length N to be conjugated. +*> On exit, X is overwritten with conjg(X). +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The spacing between successive elements of X. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + SUBROUTINE ZLACGV( N, X, INCX ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N +* .. +* .. Array Arguments .. + COMPLEX*16 X( * ) +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + INTEGER I, IOFF +* .. +* .. Intrinsic Functions .. + INTRINSIC DCONJG +* .. +* .. Executable Statements .. +* + IF( INCX.EQ.1 ) THEN + DO 10 I = 1, N + X( I ) = DCONJG( X( I ) ) + 10 CONTINUE + ELSE + IOFF = 1 + IF( INCX.LT.0 ) + $ IOFF = 1 - ( N-1 )*INCX + DO 20 I = 1, N + X( IOFF ) = DCONJG( X( IOFF ) ) + IOFF = IOFF + INCX + 20 CONTINUE + END IF + RETURN +* +* End of ZLACGV +* + END diff --git a/lib/eigen-3.4.0/lapack/zladiv.f b/lib/eigen-3.4.0/lapack/zladiv.f new file mode 100644 index 0000000..aa71db1 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zladiv.f @@ -0,0 +1,97 @@ +*> \brief \b ZLADIV +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLADIV + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* COMPLEX*16 FUNCTION ZLADIV( X, Y ) +* +* .. Scalar Arguments .. +* COMPLEX*16 X, Y +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLADIV := X / Y, where X and Y are complex. The computation of X / Y +*> will not overflow on an intermediary step unless the results +*> overflows. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] X +*> \verbatim +*> X is COMPLEX*16 +*> \endverbatim +*> +*> \param[in] Y +*> \verbatim +*> Y is COMPLEX*16 +*> The complex scalars X and Y. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + COMPLEX*16 FUNCTION ZLADIV( X, Y ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + COMPLEX*16 X, Y +* .. +* +* ===================================================================== +* +* .. Local Scalars .. + DOUBLE PRECISION ZI, ZR +* .. +* .. External Subroutines .. + EXTERNAL DLADIV +* .. +* .. Intrinsic Functions .. + INTRINSIC DBLE, DCMPLX, DIMAG +* .. +* .. Executable Statements .. +* + CALL DLADIV( DBLE( X ), DIMAG( X ), DBLE( Y ), DIMAG( Y ), ZR, + $ ZI ) + ZLADIV = DCMPLX( ZR, ZI ) +* + RETURN +* +* End of ZLADIV +* + END diff --git a/lib/eigen-3.4.0/lapack/zlarf.f b/lib/eigen-3.4.0/lapack/zlarf.f new file mode 100644 index 0000000..53f314d --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zlarf.f @@ -0,0 +1,232 @@ +*> \brief \b ZLARF +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLARF + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* .. Scalar Arguments .. +* CHARACTER SIDE +* INTEGER INCV, LDC, M, N +* COMPLEX*16 TAU +* .. +* .. Array Arguments .. +* COMPLEX*16 C( LDC, * ), V( * ), WORK( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLARF applies a complex elementary reflector H to a complex M-by-N +*> matrix C, from either the left or the right. H is represented in the +*> form +*> +*> H = I - tau * v * v**H +*> +*> where tau is a complex scalar and v is a complex vector. +*> +*> If tau = 0, then H is taken to be the unit matrix. +*> +*> To apply H**H, supply conjg(tau) instead +*> tau. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': form H * C +*> = 'R': form C * H +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX*16 array, dimension +*> (1 + (M-1)*abs(INCV)) if SIDE = 'L' +*> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' +*> The vector v in the representation of H. V is not used if +*> TAU = 0. +*> \endverbatim +*> +*> \param[in] INCV +*> \verbatim +*> INCV is INTEGER +*> The increment between elements of v. INCV <> 0. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is COMPLEX*16 +*> The value tau in the representation of H. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is COMPLEX*16 array, dimension (LDC,N) +*> On entry, the M-by-N matrix C. +*> On exit, C is overwritten by the matrix H * C if SIDE = 'L', +*> or C * H if SIDE = 'R'. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is COMPLEX*16 array, dimension +*> (N) if SIDE = 'L' +*> or (M) if SIDE = 'R' +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER SIDE + INTEGER INCV, LDC, M, N + COMPLEX*16 TAU +* .. +* .. Array Arguments .. + COMPLEX*16 C( LDC, * ), V( * ), WORK( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX*16 ONE, ZERO + PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ), + $ ZERO = ( 0.0D+0, 0.0D+0 ) ) +* .. +* .. Local Scalars .. + LOGICAL APPLYLEFT + INTEGER I, LASTV, LASTC +* .. +* .. External Subroutines .. + EXTERNAL ZGEMV, ZGERC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILAZLR, ILAZLC + EXTERNAL LSAME, ILAZLR, ILAZLC +* .. +* .. Executable Statements .. +* + APPLYLEFT = LSAME( SIDE, 'L' ) + LASTV = 0 + LASTC = 0 + IF( TAU.NE.ZERO ) THEN +* Set up variables for scanning V. LASTV begins pointing to the end +* of V. + IF( APPLYLEFT ) THEN + LASTV = M + ELSE + LASTV = N + END IF + IF( INCV.GT.0 ) THEN + I = 1 + (LASTV-1) * INCV + ELSE + I = 1 + END IF +* Look for the last non-zero row in V. + DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) + LASTV = LASTV - 1 + I = I - INCV + END DO + IF( APPLYLEFT ) THEN +* Scan for the last non-zero column in C(1:lastv,:). + LASTC = ILAZLC(LASTV, N, C, LDC) + ELSE +* Scan for the last non-zero row in C(:,1:lastv). + LASTC = ILAZLR(M, LASTV, C, LDC) + END IF + END IF +* Note that lastc.eq.0 renders the BLAS operations null; no special +* case is needed at this level. + IF( APPLYLEFT ) THEN +* +* Form H * C +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1) +* + CALL ZGEMV( 'Conjugate transpose', LASTV, LASTC, ONE, + $ C, LDC, V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H +* + CALL ZGERC( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) + END IF + ELSE +* +* Form C * H +* + IF( LASTV.GT.0 ) THEN +* +* w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) +* + CALL ZGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, + $ V, INCV, ZERO, WORK, 1 ) +* +* C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H +* + CALL ZGERC( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) + END IF + END IF + RETURN +* +* End of ZLARF +* + END diff --git a/lib/eigen-3.4.0/lapack/zlarfb.f b/lib/eigen-3.4.0/lapack/zlarfb.f new file mode 100644 index 0000000..30fc4b9 --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zlarfb.f @@ -0,0 +1,774 @@ +*> \brief \b ZLARFB +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLARFB + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE ZLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, +* T, LDT, C, LDC, WORK, LDWORK ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, SIDE, STOREV, TRANS +* INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. +* COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ), +* $ WORK( LDWORK, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLARFB applies a complex block reflector H or its transpose H**H to a +*> complex M-by-N matrix C, from either the left or the right. +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] SIDE +*> \verbatim +*> SIDE is CHARACTER*1 +*> = 'L': apply H or H**H from the Left +*> = 'R': apply H or H**H from the Right +*> \endverbatim +*> +*> \param[in] TRANS +*> \verbatim +*> TRANS is CHARACTER*1 +*> = 'N': apply H (No transpose) +*> = 'C': apply H**H (Conjugate transpose) +*> \endverbatim +*> +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Indicates how H is formed from a product of elementary +*> reflectors +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Indicates how the vectors which define the elementary +*> reflectors are stored: +*> = 'C': Columnwise +*> = 'R': Rowwise +*> \endverbatim +*> +*> \param[in] M +*> \verbatim +*> M is INTEGER +*> The number of rows of the matrix C. +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The number of columns of the matrix C. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the matrix T (= the number of elementary +*> reflectors whose product defines the block reflector). +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX*16 array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,M) if STOREV = 'R' and SIDE = 'L' +*> (LDV,N) if STOREV = 'R' and SIDE = 'R' +*> See Further Details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); +*> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); +*> if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] T +*> \verbatim +*> T is COMPLEX*16 array, dimension (LDT,K) +*> The triangular K-by-K matrix T in the representation of the +*> block reflector. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +*> +*> \param[in,out] C +*> \verbatim +*> C is COMPLEX*16 array, dimension (LDC,N) +*> On entry, the M-by-N matrix C. +*> On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H. +*> \endverbatim +*> +*> \param[in] LDC +*> \verbatim +*> LDC is INTEGER +*> The leading dimension of the array C. LDC >= max(1,M). +*> \endverbatim +*> +*> \param[out] WORK +*> \verbatim +*> WORK is COMPLEX*16 array, dimension (LDWORK,K) +*> \endverbatim +*> +*> \param[in] LDWORK +*> \verbatim +*> LDWORK is INTEGER +*> The leading dimension of the array WORK. +*> If SIDE = 'L', LDWORK >= max(1,N); +*> if SIDE = 'R', LDWORK >= max(1,M). +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored; the corresponding +*> array elements are modified but restored on exit. The rest of the +*> array is not used. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE ZLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, + $ T, LDT, C, LDC, WORK, LDWORK ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, SIDE, STOREV, TRANS + INTEGER K, LDC, LDT, LDV, LDWORK, M, N +* .. +* .. Array Arguments .. + COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ), + $ WORK( LDWORK, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX*16 ONE + PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) ) +* .. +* .. Local Scalars .. + CHARACTER TRANST + INTEGER I, J, LASTV, LASTC +* .. +* .. External Functions .. + LOGICAL LSAME + INTEGER ILAZLR, ILAZLC + EXTERNAL LSAME, ILAZLR, ILAZLC +* .. +* .. External Subroutines .. + EXTERNAL ZCOPY, ZGEMM, ZLACGV, ZTRMM +* .. +* .. Intrinsic Functions .. + INTRINSIC DCONJG +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( M.LE.0 .OR. N.LE.0 ) + $ RETURN +* + IF( LSAME( TRANS, 'N' ) ) THEN + TRANST = 'C' + ELSE + TRANST = 'N' + END IF +* + IF( LSAME( STOREV, 'C' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 ) (first K rows) +* ( V2 ) +* where V1 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILAZLR( M, K, V, LDV ) ) + LASTC = ILAZLC( LASTV, N, C, LDC ) +* +* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) +* +* W := C1**H +* + DO 10 J = 1, K + CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) + 10 CONTINUE +* +* W := W * V1 +* + CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**H *V2 +* + CALL ZGEMM( 'Conjugate transpose', 'No transpose', + $ LASTC, K, LASTV-K, ONE, C( K+1, 1 ), LDC, + $ V( K+1, 1 ), LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**H +* + IF( M.GT.K ) THEN +* +* C2 := C2 - V2 * W**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, + $ ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1**H +* + CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**H +* + DO 30 J = 1, K + DO 20 I = 1, LASTC + C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) ) + 20 CONTINUE + 30 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILAZLR( N, K, V, LDV ) ) + LASTC = ILAZLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C1 +* + DO 40 J = 1, K + CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 40 CONTINUE +* +* W := W * V1 +* + CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2 +* + CALL ZGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**H +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1**H +* + CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 60 J = 1, K + DO 50 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 50 CONTINUE + 60 CONTINUE + END IF +* + ELSE +* +* Let V = ( V1 ) +* ( V2 ) (last K rows) +* where V2 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILAZLR( M, K, V, LDV ) ) + LASTC = ILAZLC( LASTV, N, C, LDC ) +* +* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) +* +* W := C2**H +* + DO 70 J = 1, K + CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) + 70 CONTINUE +* +* W := W * V2 +* + CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**H*V1 +* + CALL ZGEMM( 'Conjugate transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C, LDC, V, LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V * W**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1 * W**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTV-K, LASTC, K, + $ -ONE, V, LDV, WORK, LDWORK, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**H +* + CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**H +* + DO 90 J = 1, K + DO 80 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - + $ DCONJG( WORK( I, J ) ) + 80 CONTINUE + 90 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILAZLR( N, K, V, LDV ) ) + LASTC = ILAZLR( M, LASTV, C, LDC ) +* +* W := C * V = (C1*V1 + C2*V2) (stored in WORK) +* +* W := C2 +* + DO 100 J = 1, K + CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 100 CONTINUE +* +* W := W * V2 +* + CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1 +* + CALL ZGEMM( 'No transpose', 'No transpose', + $ LASTC, K, LASTV-K, + $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2**H +* + CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W +* + DO 120 J = 1, K + DO 110 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) + $ - WORK( I, J ) + 110 CONTINUE + 120 CONTINUE + END IF + END IF +* + ELSE IF( LSAME( STOREV, 'R' ) ) THEN +* + IF( LSAME( DIRECT, 'F' ) ) THEN +* +* Let V = ( V1 V2 ) (V1: first K columns) +* where V1 is unit upper triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILAZLC( K, M, V, LDV ) ) + LASTC = ILAZLC( LASTV, N, C, LDC ) +* +* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) +* +* W := C1**H +* + DO 130 J = 1, K + CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) + CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) + 130 CONTINUE +* +* W := W * V1**H +* + CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2**H*V2**H +* + CALL ZGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTC, K, LASTV-K, + $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, + $ ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**H * W**H +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - V2**H * W**H +* + CALL ZGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTV-K, LASTC, K, + $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, + $ ONE, C( K+1, 1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W**H +* + DO 150 J = 1, K + DO 140 I = 1, LASTC + C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) ) + 140 CONTINUE + 150 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILAZLC( K, N, V, LDV ) ) + LASTC = ILAZLR( M, LASTV, C, LDC ) +* +* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) +* +* W := C1 +* + DO 160 J = 1, K + CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) + 160 CONTINUE +* +* W := W * V1**H +* + CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C2 * V2**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, K, LASTV-K, ONE, C( 1, K+1 ), LDC, + $ V( 1, K+1 ), LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C2 := C2 - W * V2 +* + CALL ZGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, + $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, + $ ONE, C( 1, K+1 ), LDC ) + END IF +* +* W := W * V1 +* + CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', + $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 180 J = 1, K + DO 170 I = 1, LASTC + C( I, J ) = C( I, J ) - WORK( I, J ) + 170 CONTINUE + 180 CONTINUE +* + END IF +* + ELSE +* +* Let V = ( V1 V2 ) (V2: last K columns) +* where V2 is unit lower triangular. +* + IF( LSAME( SIDE, 'L' ) ) THEN +* +* Form H * C or H**H * C where C = ( C1 ) +* ( C2 ) +* + LASTV = MAX( K, ILAZLC( K, M, V, LDV ) ) + LASTC = ILAZLC( LASTV, N, C, LDC ) +* +* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) +* +* W := C2**H +* + DO 190 J = 1, K + CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, + $ WORK( 1, J ), 1 ) + CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) + 190 CONTINUE +* +* W := W * V2**H +* + CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1**H * V1**H +* + CALL ZGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTC, K, LASTV-K, + $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) + END IF +* +* W := W * T**H or W * T +* + CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - V**H * W**H +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - V1**H * W**H +* + CALL ZGEMM( 'Conjugate transpose', + $ 'Conjugate transpose', LASTV-K, LASTC, K, + $ -ONE, V, LDV, WORK, LDWORK, ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C2 := C2 - W**H +* + DO 210 J = 1, K + DO 200 I = 1, LASTC + C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - + $ DCONJG( WORK( I, J ) ) + 200 CONTINUE + 210 CONTINUE +* + ELSE IF( LSAME( SIDE, 'R' ) ) THEN +* +* Form C * H or C * H**H where C = ( C1 C2 ) +* + LASTV = MAX( K, ILAZLC( K, N, V, LDV ) ) + LASTC = ILAZLR( M, LASTV, C, LDC ) +* +* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) +* +* W := C2 +* + DO 220 J = 1, K + CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1, + $ WORK( 1, J ), 1 ) + 220 CONTINUE +* +* W := W * V2**H +* + CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', + $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) + IF( LASTV.GT.K ) THEN +* +* W := W + C1 * V1**H +* + CALL ZGEMM( 'No transpose', 'Conjugate transpose', + $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, ONE, + $ WORK, LDWORK ) + END IF +* +* W := W * T or W * T**H +* + CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit', + $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) +* +* C := C - W * V +* + IF( LASTV.GT.K ) THEN +* +* C1 := C1 - W * V1 +* + CALL ZGEMM( 'No transpose', 'No transpose', + $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, + $ ONE, C, LDC ) + END IF +* +* W := W * V2 +* + CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', + $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, + $ WORK, LDWORK ) +* +* C1 := C1 - W +* + DO 240 J = 1, K + DO 230 I = 1, LASTC + C( I, LASTV-K+J ) = C( I, LASTV-K+J ) + $ - WORK( I, J ) + 230 CONTINUE + 240 CONTINUE +* + END IF +* + END IF + END IF +* + RETURN +* +* End of ZLARFB +* + END diff --git a/lib/eigen-3.4.0/lapack/zlarfg.f b/lib/eigen-3.4.0/lapack/zlarfg.f new file mode 100644 index 0000000..a90ae9f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zlarfg.f @@ -0,0 +1,203 @@ +*> \brief \b ZLARFG +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLARFG + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE ZLARFG( N, ALPHA, X, INCX, TAU ) +* +* .. Scalar Arguments .. +* INTEGER INCX, N +* COMPLEX*16 ALPHA, TAU +* .. +* .. Array Arguments .. +* COMPLEX*16 X( * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLARFG generates a complex elementary reflector H of order n, such +*> that +*> +*> H**H * ( alpha ) = ( beta ), H**H * H = I. +*> ( x ) ( 0 ) +*> +*> where alpha and beta are scalars, with beta real, and x is an +*> (n-1)-element complex vector. H is represented in the form +*> +*> H = I - tau * ( 1 ) * ( 1 v**H ) , +*> ( v ) +*> +*> where tau is a complex scalar and v is a complex (n-1)-element +*> vector. Note that H is not hermitian. +*> +*> If the elements of x are all zero and alpha is real, then tau = 0 +*> and H is taken to be the unit matrix. +*> +*> Otherwise 1 <= real(tau) <= 2 and abs(tau-1) <= 1 . +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the elementary reflector. +*> \endverbatim +*> +*> \param[in,out] ALPHA +*> \verbatim +*> ALPHA is COMPLEX*16 +*> On entry, the value alpha. +*> On exit, it is overwritten with the value beta. +*> \endverbatim +*> +*> \param[in,out] X +*> \verbatim +*> X is COMPLEX*16 array, dimension +*> (1+(N-2)*abs(INCX)) +*> On entry, the vector x. +*> On exit, it is overwritten with the vector v. +*> \endverbatim +*> +*> \param[in] INCX +*> \verbatim +*> INCX is INTEGER +*> The increment between elements of X. INCX > 0. +*> \endverbatim +*> +*> \param[out] TAU +*> \verbatim +*> TAU is COMPLEX*16 +*> The value tau. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date November 2011 +* +*> \ingroup complex16OTHERauxiliary +* +* ===================================================================== + SUBROUTINE ZLARFG( N, ALPHA, X, INCX, TAU ) +* +* -- LAPACK auxiliary routine (version 3.4.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2011 +* +* .. Scalar Arguments .. + INTEGER INCX, N + COMPLEX*16 ALPHA, TAU +* .. +* .. Array Arguments .. + COMPLEX*16 X( * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + DOUBLE PRECISION ONE, ZERO + PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) +* .. +* .. Local Scalars .. + INTEGER J, KNT + DOUBLE PRECISION ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM +* .. +* .. External Functions .. + DOUBLE PRECISION DLAMCH, DLAPY3, DZNRM2 + COMPLEX*16 ZLADIV + EXTERNAL DLAMCH, DLAPY3, DZNRM2, ZLADIV +* .. +* .. Intrinsic Functions .. + INTRINSIC ABS, DBLE, DCMPLX, DIMAG, SIGN +* .. +* .. External Subroutines .. + EXTERNAL ZDSCAL, ZSCAL +* .. +* .. Executable Statements .. +* + IF( N.LE.0 ) THEN + TAU = ZERO + RETURN + END IF +* + XNORM = DZNRM2( N-1, X, INCX ) + ALPHR = DBLE( ALPHA ) + ALPHI = DIMAG( ALPHA ) +* + IF( XNORM.EQ.ZERO .AND. ALPHI.EQ.ZERO ) THEN +* +* H = I +* + TAU = ZERO + ELSE +* +* general case +* + BETA = -SIGN( DLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) + SAFMIN = DLAMCH( 'S' ) / DLAMCH( 'E' ) + RSAFMN = ONE / SAFMIN +* + KNT = 0 + IF( ABS( BETA ).LT.SAFMIN ) THEN +* +* XNORM, BETA may be inaccurate; scale X and recompute them +* + 10 CONTINUE + KNT = KNT + 1 + CALL ZDSCAL( N-1, RSAFMN, X, INCX ) + BETA = BETA*RSAFMN + ALPHI = ALPHI*RSAFMN + ALPHR = ALPHR*RSAFMN + IF( ABS( BETA ).LT.SAFMIN ) + $ GO TO 10 +* +* New BETA is at most 1, at least SAFMIN +* + XNORM = DZNRM2( N-1, X, INCX ) + ALPHA = DCMPLX( ALPHR, ALPHI ) + BETA = -SIGN( DLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) + END IF + TAU = DCMPLX( ( BETA-ALPHR ) / BETA, -ALPHI / BETA ) + ALPHA = ZLADIV( DCMPLX( ONE ), ALPHA-BETA ) + CALL ZSCAL( N-1, ALPHA, X, INCX ) +* +* If ALPHA is subnormal, it may lose relative accuracy +* + DO 20 J = 1, KNT + BETA = BETA*SAFMIN + 20 CONTINUE + ALPHA = BETA + END IF +* + RETURN +* +* End of ZLARFG +* + END diff --git a/lib/eigen-3.4.0/lapack/zlarft.f b/lib/eigen-3.4.0/lapack/zlarft.f new file mode 100644 index 0000000..6a6151f --- /dev/null +++ b/lib/eigen-3.4.0/lapack/zlarft.f @@ -0,0 +1,327 @@ +*> \brief \b ZLARFT +* +* =========== DOCUMENTATION =========== +* +* Online html documentation available at +* http://www.netlib.org/lapack/explore-html/ +* +*> \htmlonly +*> Download ZLARFT + dependencies +*> +*> [TGZ] +*> +*> [ZIP] +*> +*> [TXT] +*> \endhtmlonly +* +* Definition: +* =========== +* +* SUBROUTINE ZLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* .. Scalar Arguments .. +* CHARACTER DIRECT, STOREV +* INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. +* COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* +*> \par Purpose: +* ============= +*> +*> \verbatim +*> +*> ZLARFT forms the triangular factor T of a complex block reflector H +*> of order n, which is defined as a product of k elementary reflectors. +*> +*> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; +*> +*> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. +*> +*> If STOREV = 'C', the vector which defines the elementary reflector +*> H(i) is stored in the i-th column of the array V, and +*> +*> H = I - V * T * V**H +*> +*> If STOREV = 'R', the vector which defines the elementary reflector +*> H(i) is stored in the i-th row of the array V, and +*> +*> H = I - V**H * T * V +*> \endverbatim +* +* Arguments: +* ========== +* +*> \param[in] DIRECT +*> \verbatim +*> DIRECT is CHARACTER*1 +*> Specifies the order in which the elementary reflectors are +*> multiplied to form the block reflector: +*> = 'F': H = H(1) H(2) . . . H(k) (Forward) +*> = 'B': H = H(k) . . . H(2) H(1) (Backward) +*> \endverbatim +*> +*> \param[in] STOREV +*> \verbatim +*> STOREV is CHARACTER*1 +*> Specifies how the vectors which define the elementary +*> reflectors are stored (see also Further Details): +*> = 'C': columnwise +*> = 'R': rowwise +*> \endverbatim +*> +*> \param[in] N +*> \verbatim +*> N is INTEGER +*> The order of the block reflector H. N >= 0. +*> \endverbatim +*> +*> \param[in] K +*> \verbatim +*> K is INTEGER +*> The order of the triangular factor T (= the number of +*> elementary reflectors). K >= 1. +*> \endverbatim +*> +*> \param[in] V +*> \verbatim +*> V is COMPLEX*16 array, dimension +*> (LDV,K) if STOREV = 'C' +*> (LDV,N) if STOREV = 'R' +*> The matrix V. See further details. +*> \endverbatim +*> +*> \param[in] LDV +*> \verbatim +*> LDV is INTEGER +*> The leading dimension of the array V. +*> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. +*> \endverbatim +*> +*> \param[in] TAU +*> \verbatim +*> TAU is COMPLEX*16 array, dimension (K) +*> TAU(i) must contain the scalar factor of the elementary +*> reflector H(i). +*> \endverbatim +*> +*> \param[out] T +*> \verbatim +*> T is COMPLEX*16 array, dimension (LDT,K) +*> The k by k triangular factor T of the block reflector. +*> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is +*> lower triangular. The rest of the array is not used. +*> \endverbatim +*> +*> \param[in] LDT +*> \verbatim +*> LDT is INTEGER +*> The leading dimension of the array T. LDT >= K. +*> \endverbatim +* +* Authors: +* ======== +* +*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +* +*> \date April 2012 +* +*> \ingroup complex16OTHERauxiliary +* +*> \par Further Details: +* ===================== +*> +*> \verbatim +*> +*> The shape of the matrix V and the storage of the vectors which define +*> the H(i) is best illustrated by the following example with n = 5 and +*> k = 3. The elements equal to 1 are not stored. +*> +*> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': +*> +*> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) +*> ( v1 1 ) ( 1 v2 v2 v2 ) +*> ( v1 v2 1 ) ( 1 v3 v3 ) +*> ( v1 v2 v3 ) +*> ( v1 v2 v3 ) +*> +*> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': +*> +*> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) +*> ( v1 v2 v3 ) ( v2 v2 v2 1 ) +*> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) +*> ( 1 v3 ) +*> ( 1 ) +*> \endverbatim +*> +* ===================================================================== + SUBROUTINE ZLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) +* +* -- LAPACK auxiliary routine (version 3.4.1) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* April 2012 +* +* .. Scalar Arguments .. + CHARACTER DIRECT, STOREV + INTEGER K, LDT, LDV, N +* .. +* .. Array Arguments .. + COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * ) +* .. +* +* ===================================================================== +* +* .. Parameters .. + COMPLEX*16 ONE, ZERO + PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ), + $ ZERO = ( 0.0D+0, 0.0D+0 ) ) +* .. +* .. Local Scalars .. + INTEGER I, J, PREVLASTV, LASTV +* .. +* .. External Subroutines .. + EXTERNAL ZGEMV, ZLACGV, ZTRMV +* .. +* .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +* .. +* .. Executable Statements .. +* +* Quick return if possible +* + IF( N.EQ.0 ) + $ RETURN +* + IF( LSAME( DIRECT, 'F' ) ) THEN + PREVLASTV = N + DO I = 1, K + PREVLASTV = MAX( PREVLASTV, I ) + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = 1, I + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * CONJG( V( I , J ) ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**H * V(i:j,i) +* + CALL ZGEMV( 'Conjugate transpose', J-I, I-1, + $ -TAU( I ), V( I+1, 1 ), LDV, + $ V( I+1, I ), 1, ONE, T( 1, I ), 1 ) + ELSE +* Skip any trailing zeros. + DO LASTV = N, I+1, -1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = 1, I-1 + T( J, I ) = -TAU( I ) * V( J , I ) + END DO + J = MIN( LASTV, PREVLASTV ) +* +* T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**H +* + CALL ZGEMM( 'N', 'C', I-1, 1, J-I, -TAU( I ), + $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, + $ ONE, T( 1, I ), LDT ) + END IF +* +* T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) +* + CALL ZTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, + $ LDT, T( 1, I ), 1 ) + T( I, I ) = TAU( I ) + IF( I.GT.1 ) THEN + PREVLASTV = MAX( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + END DO + ELSE + PREVLASTV = 1 + DO I = K, 1, -1 + IF( TAU( I ).EQ.ZERO ) THEN +* +* H(i) = I +* + DO J = I, K + T( J, I ) = ZERO + END DO + ELSE +* +* general case +* + IF( I.LT.K ) THEN + IF( LSAME( STOREV, 'C' ) ) THEN +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( LASTV, I ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * CONJG( V( N-K+I , J ) ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**H * V(j:n-k+i,i) +* + CALL ZGEMV( 'Conjugate transpose', N-K+I-J, K-I, + $ -TAU( I ), V( J, I+1 ), LDV, V( J, I ), + $ 1, ONE, T( I+1, I ), 1 ) + ELSE +* Skip any leading zeros. + DO LASTV = 1, I-1 + IF( V( I, LASTV ).NE.ZERO ) EXIT + END DO + DO J = I+1, K + T( J, I ) = -TAU( I ) * V( J, N-K+I ) + END DO + J = MAX( LASTV, PREVLASTV ) +* +* T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**H +* + CALL ZGEMM( 'N', 'C', K-I, 1, N-K+I-J, -TAU( I ), + $ V( I+1, J ), LDV, V( I, J ), LDV, + $ ONE, T( I+1, I ), LDT ) + END IF +* +* T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) +* + CALL ZTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, + $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) + IF( I.GT.1 ) THEN + PREVLASTV = MIN( PREVLASTV, LASTV ) + ELSE + PREVLASTV = LASTV + END IF + END IF + T( I, I ) = TAU( I ) + END IF + END DO + END IF + RETURN +* +* End of ZLARFT +* + END diff --git a/lib/eigen-3.4.0/scripts/CMakeLists.txt b/lib/eigen-3.4.0/scripts/CMakeLists.txt new file mode 100644 index 0000000..0d9a631 --- /dev/null +++ b/lib/eigen-3.4.0/scripts/CMakeLists.txt @@ -0,0 +1,6 @@ +get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST) +configure_file(buildtests.in ${CMAKE_BINARY_DIR}/buildtests.sh @ONLY) + +configure_file(check.in ${CMAKE_BINARY_DIR}/check.sh COPYONLY) +configure_file(debug.in ${CMAKE_BINARY_DIR}/debug.sh COPYONLY) +configure_file(release.in ${CMAKE_BINARY_DIR}/release.sh COPYONLY) diff --git a/lib/eigen-3.4.0/scripts/cdashtesting.cmake.in b/lib/eigen-3.4.0/scripts/cdashtesting.cmake.in new file mode 100644 index 0000000..0bf0fac --- /dev/null +++ b/lib/eigen-3.4.0/scripts/cdashtesting.cmake.in @@ -0,0 +1,49 @@ + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@") +set(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_BUILD_NAME "@BUILDNAME@") +set(CTEST_SITE "@SITE@") + +set(MODEL Experimental) +if(${CTEST_SCRIPT_ARG} MATCHES Nightly) + set(MODEL Nightly) +elseif(${CTEST_SCRIPT_ARG} MATCHES Continuous) + set(MODEL Continuous) +endif() + +find_program(CTEST_GIT_COMMAND NAMES git) +set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") + +ctest_start(${MODEL} ${CTEST_SOURCE_DIRECTORY} ${CTEST_BINARY_DIRECTORY}) + +ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}") +ctest_submit(PARTS Update Notes) + +# to get CTEST_PROJECT_SUBPROJECTS definition: +include("${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake") + +foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) + message("") + message("Process ${subproject}") + + set_property(GLOBAL PROPERTY SubProject ${subproject}) + set_property(GLOBAL PROPERTY Label ${subproject}) + + ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY} SOURCE ${CTEST_SOURCE_DIRECTORY} ) + ctest_submit(PARTS Configure) + + set(CTEST_BUILD_TARGET "Build${subproject}") + message("Build ${CTEST_BUILD_TARGET}") + ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + # builds target ${CTEST_BUILD_TARGET} + ctest_submit(PARTS Build) + + ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "${subproject}" ) + # runs only tests that have a LABELS property matching "${subproject}" + + ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" LABELS "${subproject}" ) + + ctest_submit(PARTS Test) + +endforeach() diff --git a/lib/eigen-3.4.0/scripts/check.in b/lib/eigen-3.4.0/scripts/check.in new file mode 100755 index 0000000..7717e2d --- /dev/null +++ b/lib/eigen-3.4.0/scripts/check.in @@ -0,0 +1,21 @@ +#!/bin/bash +# check : shorthand for make and ctest -R + +if [[ $# != 1 || $1 == *help ]] +then + echo "usage: $0 regexp" + echo " Builds and runs tests matching the regexp." + echo " The EIGEN_MAKE_ARGS environment variable allows to pass args to 'make'." + echo " For example, to launch 5 concurrent builds, use EIGEN_MAKE_ARGS='-j5'" + echo " The EIGEN_CTEST_ARGS environment variable allows to pass args to 'ctest'." + echo " For example, with CTest 2.8, you can use EIGEN_CTEST_ARGS='-j5'." + exit 0 +fi + +if [ -n "${EIGEN_CTEST_ARGS:+x}" ] +then + ./buildtests.sh "$1" && ctest -R "$1" ${EIGEN_CTEST_ARGS} +else + ./buildtests.sh "$1" && ctest -R "$1" +fi +exit $? diff --git a/lib/eigen-3.4.0/scripts/debug.in b/lib/eigen-3.4.0/scripts/debug.in new file mode 100755 index 0000000..d339d3d --- /dev/null +++ b/lib/eigen-3.4.0/scripts/debug.in @@ -0,0 +1,3 @@ +#!/bin/sh + +cmake -DCMAKE_BUILD_TYPE=Debug . diff --git a/lib/eigen-3.4.0/scripts/eigen_gen_credits.cpp b/lib/eigen-3.4.0/scripts/eigen_gen_credits.cpp new file mode 100644 index 0000000..f2e8163 --- /dev/null +++ b/lib/eigen-3.4.0/scripts/eigen_gen_credits.cpp @@ -0,0 +1,232 @@ +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +// this function takes a line that may contain a name and/or email address, +// and returns just the name, while fixing the "bad cases". +std::string contributor_name(const std::string& line) +{ + string result; + + // let's first take care of the case of isolated email addresses, like + // "user@localhost.localdomain" entries + if(line.find("markb@localhost.localdomain") != string::npos) + { + return "Mark Borgerding"; + } + + if(line.find("kayhman@contact.intra.cea.fr") != string::npos) + { + return "Guillaume Saupin"; + } + + // from there on we assume that we have a entry of the form + // either: + // Bla bli Blurp + // or: + // Bla bli Blurp + + size_t position_of_email_address = line.find_first_of('<'); + if(position_of_email_address != string::npos) + { + // there is an e-mail address in <...>. + + // Hauke once committed as "John Smith", fix that. + if(line.find("hauke.heibel") != string::npos) + result = "Hauke Heibel"; + else + { + // just remove the e-mail address + result = line.substr(0, position_of_email_address); + } + } + else + { + // there is no e-mail address in <...>. + + if(line.find("convert-repo") != string::npos) + result = ""; + else + result = line; + } + + // remove trailing spaces + size_t length = result.length(); + while(length >= 1 && result[length-1] == ' ') result.erase(--length); + + return result; +} + +// parses hg churn output to generate a contributors map. +map contributors_map_from_churn_output(const char *filename) +{ + map contributors_map; + + string line; + ifstream churn_out; + churn_out.open(filename, ios::in); + while(!getline(churn_out,line).eof()) + { + // remove the histograms "******" that hg churn may draw at the end of some lines + size_t first_star = line.find_first_of('*'); + if(first_star != string::npos) line.erase(first_star); + + // remove trailing spaces + size_t length = line.length(); + while(length >= 1 && line[length-1] == ' ') line.erase(--length); + + // now the last space indicates where the number starts + size_t last_space = line.find_last_of(' '); + + // get the number (of changesets or of modified lines for each contributor) + int number; + istringstream(line.substr(last_space+1)) >> number; + + // get the name of the contributor + line.erase(last_space); + string name = contributor_name(line); + + map::iterator it = contributors_map.find(name); + // if new contributor, insert + if(it == contributors_map.end()) + contributors_map.insert(pair(name, number)); + // if duplicate, just add the number + else + it->second += number; + } + churn_out.close(); + + return contributors_map; +} + +// find the last name, i.e. the last word. +// for "van den Schbling" types of last names, that's not a problem, that's actually what we want. +string lastname(const string& name) +{ + size_t last_space = name.find_last_of(' '); + if(last_space >= name.length()-1) return name; + else return name.substr(last_space+1); +} + +struct contributor +{ + string name; + int changedlines; + int changesets; + string url; + string misc; + + contributor() : changedlines(0), changesets(0) {} + + bool operator < (const contributor& other) + { + return lastname(name).compare(lastname(other.name)) < 0; + } +}; + +void add_online_info_into_contributors_list(list& contributors_list, const char *filename) +{ + string line; + ifstream online_info; + online_info.open(filename, ios::in); + while(!getline(online_info,line).eof()) + { + string hgname, realname, url, misc; + + size_t last_bar = line.find_last_of('|'); + if(last_bar == string::npos) continue; + if(last_bar < line.length()) + misc = line.substr(last_bar+1); + line.erase(last_bar); + + last_bar = line.find_last_of('|'); + if(last_bar == string::npos) continue; + if(last_bar < line.length()) + url = line.substr(last_bar+1); + line.erase(last_bar); + + last_bar = line.find_last_of('|'); + if(last_bar == string::npos) continue; + if(last_bar < line.length()) + realname = line.substr(last_bar+1); + line.erase(last_bar); + + hgname = line; + + // remove the example line + if(hgname.find("MercurialName") != string::npos) continue; + + list::iterator it; + for(it=contributors_list.begin(); it != contributors_list.end() && it->name != hgname; ++it) + {} + + if(it == contributors_list.end()) + { + contributor c; + c.name = realname; + c.url = url; + c.misc = misc; + contributors_list.push_back(c); + } + else + { + it->name = realname; + it->url = url; + it->misc = misc; + } + } +} + +int main() +{ + // parse the hg churn output files + map contributors_map_for_changedlines = contributors_map_from_churn_output("churn-changedlines.out"); + //map contributors_map_for_changesets = contributors_map_from_churn_output("churn-changesets.out"); + + // merge into the contributors list + list contributors_list; + map::iterator it; + for(it=contributors_map_for_changedlines.begin(); it != contributors_map_for_changedlines.end(); ++it) + { + contributor c; + c.name = it->first; + c.changedlines = it->second; + c.changesets = 0; //contributors_map_for_changesets.find(it->first)->second; + contributors_list.push_back(c); + } + + add_online_info_into_contributors_list(contributors_list, "online-info.out"); + + contributors_list.sort(); + + cout << "{| cellpadding=\"5\"\n"; + cout << "!\n"; + cout << "! Lines changed\n"; + cout << "!\n"; + + list::iterator itc; + int i = 0; + for(itc=contributors_list.begin(); itc != contributors_list.end(); ++itc) + { + if(itc->name.length() == 0) continue; + if(i%2) cout << "|-\n"; + else cout << "|- style=\"background:#FFFFD0\"\n"; + if(itc->url.length()) + cout << "| [" << itc->url << " " << itc->name << "]\n"; + else + cout << "| " << itc->name << "\n"; + if(itc->changedlines) + cout << "| " << itc->changedlines << "\n"; + else + cout << "| (no information)\n"; + cout << "| " << itc->misc << "\n"; + i++; + } + cout << "|}" << endl; +} diff --git a/lib/eigen-3.4.0/scripts/eigen_gen_docs b/lib/eigen-3.4.0/scripts/eigen_gen_docs new file mode 100644 index 0000000..787dcb3 --- /dev/null +++ b/lib/eigen-3.4.0/scripts/eigen_gen_docs @@ -0,0 +1,24 @@ +#!/bin/sh + +# configuration +# You should call this script with USER set as you want, else some default +# will be used +USER=${USER:-'orzel'} +UPLOAD_DIR=dox-devel + +#ulimit -v 1024000 + +# step 1 : build +rm build/doc/html -Rf +mkdir build -p +(cd build && cmake .. && make doc) || { echo "make failed"; exit 1; } + +#step 2 : upload +# (the '/' at the end of path is very important, see rsync documentation) +rsync -az --no-p --delete build/doc/html/ $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; } + +#step 3 : fix the perm +ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR" || { echo "perm failed"; exit 1; } + +echo "Uploaded successfully" + diff --git a/lib/eigen-3.4.0/scripts/eigen_gen_split_test_help.cmake b/lib/eigen-3.4.0/scripts/eigen_gen_split_test_help.cmake new file mode 100644 index 0000000..e43f5aa --- /dev/null +++ b/lib/eigen-3.4.0/scripts/eigen_gen_split_test_help.cmake @@ -0,0 +1,11 @@ +#!cmake -P +file(WRITE split_test_helper.h "") +foreach(i RANGE 1 999) + file(APPEND split_test_helper.h + "#if defined(EIGEN_TEST_PART_${i}) || defined(EIGEN_TEST_PART_ALL)\n" + "#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n" + "#else\n" + "#define CALL_SUBTEST_${i}(FUNC)\n" + "#endif\n\n" + ) +endforeach() \ No newline at end of file diff --git a/lib/eigen-3.4.0/scripts/eigen_monitor_perf.sh b/lib/eigen-3.4.0/scripts/eigen_monitor_perf.sh new file mode 100755 index 0000000..8f3425d --- /dev/null +++ b/lib/eigen-3.4.0/scripts/eigen_monitor_perf.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# This is a script example to automatically update and upload performance unit tests. +# The following five variables must be adjusted to match your settings. + +USER='ggael' +UPLOAD_DIR=perf_monitoring/ggaelmacbook26 +EIGEN_SOURCE_PATH=$HOME/Eigen/eigen +export PREFIX="haswell-fma" +export CXX_FLAGS="-mfma -w" + +#### + +BENCH_PATH=$EIGEN_SOURCE_PATH/bench/perf_monitoring/$PREFIX +PREVPATH=$(pwd) +cd $EIGEN_SOURCE_PATH/bench/perf_monitoring && ./runall.sh "Haswell 2.6GHz, FMA, Apple's clang" "$@" +cd $PREVPATH || exit 1 + +ALLFILES="$BENCH_PATH/*.png $BENCH_PATH/*.html $BENCH_PATH/index.html $BENCH_PATH/s1.js $BENCH_PATH/s2.js" + +# (the '/' at the end of path is very important, see rsync documentation) +rsync -az --no-p --delete $ALLFILES $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; } + +# fix the perm +ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/perf_monitoring" || { echo "perm failed"; exit 1; } diff --git a/lib/eigen-3.4.0/scripts/release.in b/lib/eigen-3.4.0/scripts/release.in new file mode 100755 index 0000000..db2d9d9 --- /dev/null +++ b/lib/eigen-3.4.0/scripts/release.in @@ -0,0 +1,3 @@ +#!/bin/sh + +cmake -DCMAKE_BUILD_TYPE=Release . diff --git a/lib/eigen-3.4.0/scripts/relicense.py b/lib/eigen-3.4.0/scripts/relicense.py new file mode 100644 index 0000000..8a5265f --- /dev/null +++ b/lib/eigen-3.4.0/scripts/relicense.py @@ -0,0 +1,69 @@ +# This file is part of Eigen, a lightweight C++ template library +# for linear algebra. +# +# Copyright (C) 2012 Keir Mierle +# +# This Source Code Form is subject to the terms of the Mozilla +# Public License v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Author: mierle@gmail.com (Keir Mierle) +# +# Make the long-awaited conversion to MPL. + +lgpl3_header = ''' +// 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 . +''' + +mpl2_header = """ +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +""" + +import os +import sys + +exclusions = set(['relicense.py']) + +def update(text): + if text.find(lgpl3_header) == -1: + return text, False + return text.replace(lgpl3_header, mpl2_header), True + +rootdir = sys.argv[1] +for root, sub_folders, files in os.walk(rootdir): + for basename in files: + if basename in exclusions: + print 'SKIPPED', filename + continue + filename = os.path.join(root, basename) + fo = file(filename) + text = fo.read() + fo.close() + + text, updated = update(text) + if updated: + fo = file(filename, "w") + fo.write(text) + fo.close() + print 'UPDATED', filename + else: + print ' ', filename diff --git a/lib/eigen-3.4.0/signature_of_eigen3_matrix_library b/lib/eigen-3.4.0/signature_of_eigen3_matrix_library new file mode 100644 index 0000000..80aaf46 --- /dev/null +++ b/lib/eigen-3.4.0/signature_of_eigen3_matrix_library @@ -0,0 +1 @@ +This file is just there as a signature to help identify directories containing Eigen3. When writing a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2... diff --git a/lib/eigen-3.4.0/test/AnnoyingScalar.h b/lib/eigen-3.4.0/test/AnnoyingScalar.h new file mode 100644 index 0000000..7ace083 --- /dev/null +++ b/lib/eigen-3.4.0/test/AnnoyingScalar.h @@ -0,0 +1,165 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011-2018 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_TEST_ANNOYING_SCALAR_H +#define EIGEN_TEST_ANNOYING_SCALAR_H + +#include + +#if EIGEN_COMP_GNUC +#pragma GCC diagnostic ignored "-Wshadow" +#endif + +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW +struct my_exception +{ + my_exception() {} + ~my_exception() {} +}; +#endif + +// An AnnoyingScalar is a pseudo scalar type that: +// - can randomly through an exception in operator + +// - randomly allocate on the heap or initialize a reference to itself making it non trivially copyable, nor movable, nor relocatable. + +class AnnoyingScalar +{ + public: + AnnoyingScalar() { init(); *v = 0; } + AnnoyingScalar(long double _v) { init(); *v = _v; } + AnnoyingScalar(double _v) { init(); *v = _v; } + AnnoyingScalar(float _v) { init(); *v = _v; } + AnnoyingScalar(int _v) { init(); *v = _v; } + AnnoyingScalar(long _v) { init(); *v = _v; } + #if EIGEN_HAS_CXX11 + AnnoyingScalar(long long _v) { init(); *v = _v; } + #endif + AnnoyingScalar(const AnnoyingScalar& other) { init(); *v = *(other.v); } + ~AnnoyingScalar() { + if(v!=&data) + delete v; + instances--; + } + + void init() { + if(internal::random()) + v = new float; + else + v = &data; + instances++; + } + + AnnoyingScalar operator+(const AnnoyingScalar& other) const + { + #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW + countdown--; + if(countdown<=0 && !dont_throw) + throw my_exception(); + #endif + return AnnoyingScalar(*v+*other.v); + } + + AnnoyingScalar operator-() const + { return AnnoyingScalar(-*v); } + + AnnoyingScalar operator-(const AnnoyingScalar& other) const + { return AnnoyingScalar(*v-*other.v); } + + AnnoyingScalar operator*(const AnnoyingScalar& other) const + { return AnnoyingScalar((*v)*(*other.v)); } + + AnnoyingScalar operator/(const AnnoyingScalar& other) const + { return AnnoyingScalar((*v)/(*other.v)); } + + AnnoyingScalar& operator+=(const AnnoyingScalar& other) { *v += *other.v; return *this; } + AnnoyingScalar& operator-=(const AnnoyingScalar& other) { *v -= *other.v; return *this; } + AnnoyingScalar& operator*=(const AnnoyingScalar& other) { *v *= *other.v; return *this; } + AnnoyingScalar& operator/=(const AnnoyingScalar& other) { *v /= *other.v; return *this; } + AnnoyingScalar& operator= (const AnnoyingScalar& other) { *v = *other.v; return *this; } + + bool operator==(const AnnoyingScalar& other) const { return *v == *other.v; } + bool operator!=(const AnnoyingScalar& other) const { return *v != *other.v; } + bool operator<=(const AnnoyingScalar& other) const { return *v <= *other.v; } + bool operator< (const AnnoyingScalar& other) const { return *v < *other.v; } + bool operator>=(const AnnoyingScalar& other) const { return *v >= *other.v; } + bool operator> (const AnnoyingScalar& other) const { return *v > *other.v; } + + float* v; + float data; + static int instances; +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW + static int countdown; + static bool dont_throw; +#endif +}; + +AnnoyingScalar real(const AnnoyingScalar &x) { return x; } +AnnoyingScalar imag(const AnnoyingScalar & ) { return 0; } +AnnoyingScalar conj(const AnnoyingScalar &x) { return x; } +AnnoyingScalar sqrt(const AnnoyingScalar &x) { return std::sqrt(*x.v); } +AnnoyingScalar abs (const AnnoyingScalar &x) { return std::abs(*x.v); } +AnnoyingScalar cos (const AnnoyingScalar &x) { return std::cos(*x.v); } +AnnoyingScalar sin (const AnnoyingScalar &x) { return std::sin(*x.v); } +AnnoyingScalar acos(const AnnoyingScalar &x) { return std::acos(*x.v); } +AnnoyingScalar atan2(const AnnoyingScalar &y,const AnnoyingScalar &x) { return std::atan2(*y.v,*x.v); } + +std::ostream& operator<<(std::ostream& stream,const AnnoyingScalar& x) { + stream << (*(x.v)); + return stream; +} + +int AnnoyingScalar::instances = 0; + +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW +int AnnoyingScalar::countdown = 0; +bool AnnoyingScalar::dont_throw = false; +#endif + +namespace Eigen { +template<> +struct NumTraits : NumTraits +{ + enum { + RequireInitialization = 1, + }; + typedef AnnoyingScalar Real; + typedef AnnoyingScalar Nested; + typedef AnnoyingScalar Literal; + typedef AnnoyingScalar NonInteger; +}; + +template<> inline AnnoyingScalar test_precision() { return test_precision(); } + +namespace numext { +template<> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +bool (isfinite)(const AnnoyingScalar& x) { + return (numext::isfinite)(*x.v); +} +} + +namespace internal { + template<> EIGEN_STRONG_INLINE double cast(const AnnoyingScalar& x) { return double(*x.v); } + template<> EIGEN_STRONG_INLINE float cast(const AnnoyingScalar& x) { return *x.v; } +} +} // namespace Eigen + +AnnoyingScalar get_test_precision(const AnnoyingScalar&) +{ return Eigen::test_precision(); } + +AnnoyingScalar test_relative_error(const AnnoyingScalar &a, const AnnoyingScalar &b) +{ return test_relative_error(*a.v, *b.v); } + +inline bool test_isApprox(const AnnoyingScalar &a, const AnnoyingScalar &b) +{ return internal::isApprox(*a.v, *b.v, test_precision()); } + +inline bool test_isMuchSmallerThan(const AnnoyingScalar &a, const AnnoyingScalar &b) +{ return test_isMuchSmallerThan(*a.v, *b.v); } + +#endif // EIGEN_TEST_ANNOYING_SCALAR_H diff --git a/lib/eigen-3.4.0/test/CMakeLists.txt b/lib/eigen-3.4.0/test/CMakeLists.txt new file mode 100644 index 0000000..5136f82 --- /dev/null +++ b/lib/eigen-3.4.0/test/CMakeLists.txt @@ -0,0 +1,465 @@ +# The file split_test_helper.h was generated at first run, +# it is now included in test/ +if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h) +endif() + +# check if we have a Fortran compiler +include(CheckLanguage) +check_language(Fortran) +if(CMAKE_Fortran_COMPILER) + enable_language(Fortran) + set(EIGEN_Fortran_COMPILER_WORKS ON) +else() + set(EIGEN_Fortran_COMPILER_WORKS OFF) + # search for a default Lapack library to complete Eigen's one + find_package(LAPACK QUIET) +endif() + +# TODO do the same for EXTERNAL_LAPACK +option(EIGEN_TEST_EXTERNAL_BLAS "Use external BLAS library for testsuite" OFF) +if(EIGEN_TEST_EXTERNAL_BLAS) + find_package(BLAS REQUIRED) + message(STATUS "BLAS_COMPILER_FLAGS: ${BLAS_COMPILER_FLAGS}") + add_definitions("-DEIGEN_USE_BLAS") # is adding ${BLAS_COMPILER_FLAGS} necessary? + list(APPEND EXTERNAL_LIBS "${BLAS_LIBRARIES}") +endif() + +# configure blas/lapack (use Eigen's ones) +set(EIGEN_BLAS_LIBRARIES eigen_blas) +set(EIGEN_LAPACK_LIBRARIES eigen_lapack) + +set(EIGEN_TEST_MATRIX_DIR "" CACHE STRING "Enable testing of realword sparse matrices contained in the specified path") +if(EIGEN_TEST_MATRIX_DIR) + if(NOT WIN32) + message(STATUS "Test realworld sparse matrices: ${EIGEN_TEST_MATRIX_DIR}") + add_definitions( -DTEST_REAL_CASES="${EIGEN_TEST_MATRIX_DIR}" ) + else() + message(STATUS "REAL CASES CAN NOT BE CURRENTLY TESTED ON WIN32") + endif() +endif() + +set(SPARSE_LIBS " ") + +find_package(CHOLMOD) +if(CHOLMOD_FOUND) + add_definitions("-DEIGEN_CHOLMOD_SUPPORT") + include_directories(${CHOLMOD_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES}) + set(CHOLMOD_ALL_LIBS ${CHOLMOD_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES}) + ei_add_property(EIGEN_TESTED_BACKENDS "CHOLMOD, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "CHOLMOD, ") +endif() + +find_package(UMFPACK) +if(UMFPACK_FOUND) + add_definitions("-DEIGEN_UMFPACK_SUPPORT") + include_directories(${UMFPACK_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + ei_add_property(EIGEN_TESTED_BACKENDS "UMFPACK, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "UMFPACK, ") +endif() + +find_package(KLU) +if(KLU_FOUND) + add_definitions("-DEIGEN_KLU_SUPPORT") + include_directories(${KLU_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + set(KLU_ALL_LIBS ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + ei_add_property(EIGEN_TESTED_BACKENDS "KLU, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "KLU, ") +endif() + +find_package(SuperLU 4.0) +if(SuperLU_FOUND) + add_definitions("-DEIGEN_SUPERLU_SUPPORT") + include_directories(${SUPERLU_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) + ei_add_property(EIGEN_TESTED_BACKENDS "SuperLU, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "SuperLU, ") +endif() + + +find_package(PASTIX QUIET COMPONENTS METIS SEQ) +# check that the PASTIX found is a version without MPI +find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS + NAMES pastix_nompi.h + HINTS ${PASTIX_INCLUDE_DIRS} +) +if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS) + message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory." + " Because Eigen tests require a version without MPI, we disable the Pastix backend.") +endif() +if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS) + add_definitions("-DEIGEN_PASTIX_SUPPORT") + include_directories(${PASTIX_INCLUDE_DIRS_DEP}) + if(SCOTCH_FOUND) + include_directories(${SCOTCH_INCLUDE_DIRS}) + set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES}) + elseif(METIS_FOUND) + include_directories(${METIS_INCLUDE_DIRS}) + set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES}) + else() + ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ") + endif() + set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES}) + set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP}) + ei_add_property(EIGEN_TESTED_BACKENDS "PaStiX, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ") +endif() + +if(METIS_FOUND) + add_definitions("-DEIGEN_METIS_SUPPORT") + include_directories(${METIS_INCLUDE_DIRS}) + ei_add_property(EIGEN_TESTED_BACKENDS "METIS, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "METIS, ") +endif() + +find_package(SPQR) +if(SPQR_FOUND AND CHOLMOD_FOUND AND (EIGEN_Fortran_COMPILER_WORKS OR LAPACK_FOUND) ) + add_definitions("-DEIGEN_SPQR_SUPPORT") + include_directories(${SPQR_INCLUDES}) + set(SPQR_ALL_LIBS ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${SPQR_ALL_LIBS}) + ei_add_property(EIGEN_TESTED_BACKENDS "SPQR, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "SPQR, ") +endif() + +option(EIGEN_TEST_NOQT "Disable Qt support in unit tests" OFF) +if(NOT EIGEN_TEST_NOQT) + find_package(Qt4) + if(QT4_FOUND) + include(${QT_USE_FILE}) + ei_add_property(EIGEN_TESTED_BACKENDS "Qt4 support, ") + else() + ei_add_property(EIGEN_MISSING_BACKENDS "Qt4 support, ") + endif() +endif() + +if(TEST_LIB) + add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1") +endif() + +set_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT "Official") +add_custom_target(BuildOfficial) + +ei_add_test(rand) +ei_add_test(meta) +ei_add_test(numext) +ei_add_test(sizeof) +ei_add_test(dynalloc) +ei_add_test(nomalloc) +ei_add_test(first_aligned) +ei_add_test(type_alias) +ei_add_test(nullary) +ei_add_test(mixingtypes) +ei_add_test(io) +ei_add_test(packetmath "-DEIGEN_FAST_MATH=1") +ei_add_test(vectorization_logic) +ei_add_test(basicstuff) +ei_add_test(constructor) +ei_add_test(linearstructure) +ei_add_test(integer_types) +ei_add_test(unalignedcount) +if(NOT EIGEN_TEST_NO_EXCEPTIONS AND NOT EIGEN_TEST_OPENMP) + ei_add_test(exceptions) +endif() +ei_add_test(redux) +ei_add_test(visitor) +ei_add_test(block) +ei_add_test(corners) +ei_add_test(symbolic_index) +ei_add_test(indexed_view) +ei_add_test(reshape) +ei_add_test(swap) +ei_add_test(resize) +ei_add_test(conservative_resize) +ei_add_test(product_small) +ei_add_test(product_large) +ei_add_test(product_extra) +ei_add_test(diagonalmatrices) +ei_add_test(adjoint) +ei_add_test(diagonal) +ei_add_test(miscmatrices) +ei_add_test(commainitializer) +ei_add_test(smallvectors) +ei_add_test(mapped_matrix) +ei_add_test(mapstride) +ei_add_test(mapstaticmethods) +ei_add_test(array_cwise) +ei_add_test(array_for_matrix) +ei_add_test(array_replicate) +ei_add_test(array_reverse) +ei_add_test(ref) +ei_add_test(is_same_dense) +ei_add_test(triangular) +ei_add_test(selfadjoint) +ei_add_test(product_selfadjoint) +ei_add_test(product_symm) +ei_add_test(product_syrk) +ei_add_test(product_trmv) +ei_add_test(product_trmm) +ei_add_test(product_trsolve) +ei_add_test(product_mmtr) +ei_add_test(product_notemporary) +ei_add_test(stable_norm) +ei_add_test(permutationmatrices) +ei_add_test(bandmatrix) +ei_add_test(cholesky) +ei_add_test(lu) +ei_add_test(determinant) +ei_add_test(inverse) +ei_add_test(qr) +ei_add_test(qr_colpivoting) +ei_add_test(qr_fullpivoting) +ei_add_test(upperbidiagonalization) +ei_add_test(hessenberg) +ei_add_test(schur_real) +ei_add_test(schur_complex) +ei_add_test(eigensolver_selfadjoint) +ei_add_test(eigensolver_generic) +ei_add_test(eigensolver_complex) +ei_add_test(real_qz) +ei_add_test(eigensolver_generalized_real) +ei_add_test(jacobi) +ei_add_test(jacobisvd) +ei_add_test(bdcsvd) +ei_add_test(householder) +ei_add_test(geo_orthomethods) +ei_add_test(geo_quaternion) +ei_add_test(geo_eulerangles) +ei_add_test(geo_parametrizedline) +ei_add_test(geo_alignedbox) +ei_add_test(geo_hyperplane) +ei_add_test(geo_transformations) +ei_add_test(geo_homogeneous) +ei_add_test(stdvector) +ei_add_test(stdvector_overload) +ei_add_test(stdlist) +ei_add_test(stdlist_overload) +ei_add_test(stddeque) +ei_add_test(stddeque_overload) +ei_add_test(sparse_basic) +ei_add_test(sparse_block) +ei_add_test(sparse_vector) +ei_add_test(sparse_product) +ei_add_test(sparse_ref) +ei_add_test(sparse_solvers) +ei_add_test(sparse_permutations) +ei_add_test(simplicial_cholesky) +ei_add_test(conjugate_gradient) +ei_add_test(incomplete_cholesky) +ei_add_test(bicgstab) +ei_add_test(lscg) +ei_add_test(sparselu) +ei_add_test(sparseqr) +ei_add_test(umeyama) +ei_add_test(nesting_ops "${CMAKE_CXX_FLAGS_DEBUG}") +ei_add_test(nestbyvalue) +ei_add_test(zerosized) +ei_add_test(dontalign) +ei_add_test(evaluators) +if(NOT EIGEN_TEST_NO_EXCEPTIONS) + ei_add_test(sizeoverflow) +endif() +ei_add_test(prec_inverse_4x4) +ei_add_test(vectorwiseop) +ei_add_test(special_numbers) +ei_add_test(rvalue_types) +ei_add_test(dense_storage) +ei_add_test(ctorleak) +ei_add_test(mpl2only) +ei_add_test(inplace_decomposition) +ei_add_test(half_float) +ei_add_test(bfloat16_float) +ei_add_test(array_of_string) +ei_add_test(num_dimensions) +ei_add_test(stl_iterators) +ei_add_test(blasutil) +if(EIGEN_TEST_CXX11) + ei_add_test(initializer_list_construction) + ei_add_test(diagonal_matrix_variadic_ctor) +endif() + +add_executable(bug1213 bug1213.cpp bug1213_main.cpp) + +check_cxx_compiler_flag("-ffast-math" COMPILER_SUPPORT_FASTMATH) +if(COMPILER_SUPPORT_FASTMATH) + set(EIGEN_FASTMATH_FLAGS "-ffast-math") +else() + check_cxx_compiler_flag("/fp:fast" COMPILER_SUPPORT_FPFAST) + if(COMPILER_SUPPORT_FPFAST) + set(EIGEN_FASTMATH_FLAGS "/fp:fast") + endif() +endif() + +ei_add_test(fastmath " ${EIGEN_FASTMATH_FLAGS} ") + +# # ei_add_test(denseLM) + +if(QT4_FOUND) + ei_add_test(qtvector "" "${QT_QTCORE_LIBRARY}") +endif() + +if(UMFPACK_FOUND) + ei_add_test(umfpack_support "" "${UMFPACK_ALL_LIBS}") +endif() + +if(KLU_FOUND OR SuiteSparse_FOUND) + ei_add_test(klu_support "" "${KLU_ALL_LIBS}") +endif() + +if(SUPERLU_FOUND) + ei_add_test(superlu_support "" "${SUPERLU_ALL_LIBS}") +endif() + +if(CHOLMOD_FOUND) + ei_add_test(cholmod_support "" "${CHOLMOD_ALL_LIBS}") +endif() + +if(PARDISO_FOUND) + ei_add_test(pardiso_support "" "${PARDISO_ALL_LIBS}") +endif() + +if(PASTIX_FOUND AND (SCOTCH_FOUND OR METIS_FOUND)) + ei_add_test(pastix_support "" "${PASTIX_ALL_LIBS}") +endif() + +if(SPQR_FOUND AND CHOLMOD_FOUND) + ei_add_test(spqr_support "" "${SPQR_ALL_LIBS}") +endif() + +if(METIS_FOUND) +ei_add_test(metis_support "" "${METIS_LIBRARIES}") +endif() + +string(TOLOWER "${CMAKE_CXX_COMPILER}" cmake_cxx_compiler_tolower) +if(cmake_cxx_compiler_tolower MATCHES "qcc") + set(CXX_IS_QCC "ON") +endif() + +ei_add_property(EIGEN_TESTING_SUMMARY "CXX: ${CMAKE_CXX_COMPILER}\n") +if(CMAKE_COMPILER_IS_GNUCXX AND NOT CXX_IS_QCC) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version COMMAND head -n 1 OUTPUT_VARIABLE EIGEN_CXX_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE) + ei_add_property(EIGEN_TESTING_SUMMARY "CXX_VERSION: ${EIGEN_CXX_VERSION_STRING}\n") +endif() +ei_add_property(EIGEN_TESTING_SUMMARY "CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n") +if (EIGEN_TEST_CUSTOM_CXX_FLAGS) + ei_add_property(EIGEN_TESTING_SUMMARY "Custom CXX flags: ${EIGEN_TEST_CUSTOM_CXX_FLAGS}\n") +endif() +ei_add_property(EIGEN_TESTING_SUMMARY "Sparse lib flags: ${SPARSE_LIBS}\n") + +option(EIGEN_TEST_EIGEN2 "Run whole Eigen2 test suite against EIGEN2_SUPPORT" OFF) +mark_as_advanced(EIGEN_TEST_EIGEN2) +if(EIGEN_TEST_EIGEN2) + message(WARNING "The Eigen2 test suite has been removed") +endif() + +# boost MP unit test +find_package(Boost 1.53.0) +if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + ei_add_test(boostmultiprec "" "${Boost_LIBRARIES}") + ei_add_property(EIGEN_TESTED_BACKENDS "Boost.Multiprecision, ") +else() + ei_add_property(EIGEN_MISSING_BACKENDS "Boost.Multiprecision, ") +endif() + + +# CUDA unit tests +option(EIGEN_TEST_CUDA "Enable CUDA support in unit tests" OFF) +option(EIGEN_TEST_CUDA_CLANG "Use clang instead of nvcc to compile the CUDA tests" OFF) + +if(EIGEN_TEST_CUDA_CLANG AND NOT CMAKE_CXX_COMPILER MATCHES "clang") + message(WARNING "EIGEN_TEST_CUDA_CLANG is set, but CMAKE_CXX_COMPILER does not appear to be clang.") +endif() + +if(EIGEN_TEST_CUDA) + +find_package(CUDA 5.0) +if(CUDA_FOUND) + + set(CUDA_PROPAGATE_HOST_FLAGS OFF) + + set(EIGEN_CUDA_RELAXED_CONSTEXPR "--expt-relaxed-constexpr") + if (${CUDA_VERSION} STREQUAL "7.0") + set(EIGEN_CUDA_RELAXED_CONSTEXPR "--relaxed-constexpr") + endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CUDA_NVCC_FLAGS "-ccbin ${CMAKE_C_COMPILER}" CACHE STRING "nvcc flags" FORCE) + endif() + if(EIGEN_TEST_CUDA_CLANG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}") + foreach(GPU IN LISTS EIGEN_CUDA_COMPUTE_ARCH) + string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${GPU}") + endforeach() + else() + foreach(GPU IN LISTS EIGEN_CUDA_COMPUTE_ARCH) + string(APPEND CUDA_NVCC_FLAGS " -gencode arch=compute_${GPU},code=sm_${GPU}") + endforeach() + endif() + string(APPEND CUDA_NVCC_FLAGS " ${EIGEN_CUDA_RELAXED_CONSTEXPR}") + set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu") + + ei_add_test(gpu_basic) + + unset(EIGEN_ADD_TEST_FILENAME_EXTENSION) + +endif() + +endif() + + +# HIP unit tests +option(EIGEN_TEST_HIP "Add HIP support." OFF) +if (EIGEN_TEST_HIP) + + set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.") + + if (EXISTS ${HIP_PATH}) + + list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake) + + find_package(HIP REQUIRED) + if (HIP_FOUND) + + execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM) + + if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd")) + + include_directories(${HIP_PATH}/include) + + set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu") + ei_add_test(gpu_basic) + unset(EIGEN_ADD_TEST_FILENAME_EXTENSION) + + elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia")) + message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen") + else () + message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}") + endif() + endif() + else () + message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist") + endif() +endif() + +cmake_dependent_option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF "EIGEN_BUILD_DOC" OFF) +if(EIGEN_TEST_BUILD_DOCUMENTATION) + add_dependencies(buildtests doc) +endif() + +# Register all smoke tests +include("EigenSmokeTestList") +ei_add_smoke_tests("${ei_smoke_test_list}") diff --git a/lib/eigen-3.4.0/test/MovableScalar.h b/lib/eigen-3.4.0/test/MovableScalar.h new file mode 100644 index 0000000..6a90d03 --- /dev/null +++ b/lib/eigen-3.4.0/test/MovableScalar.h @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2020 Sebastien Boisvert +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MISC_MOVABLE_SCALAR_H +#define EIGEN_MISC_MOVABLE_SCALAR_H + +#include + +namespace Eigen +{ +template > +struct MovableScalar : public Base +{ + MovableScalar() = default; + ~MovableScalar() = default; + MovableScalar(const MovableScalar&) = default; + MovableScalar(MovableScalar&& other) = default; + MovableScalar& operator=(const MovableScalar&) = default; + MovableScalar& operator=(MovableScalar&& other) = default; + MovableScalar(Scalar scalar) : Base(100, scalar) {} + + operator Scalar() const { return this->size() > 0 ? this->back() : Scalar(); } +}; + +template<> struct NumTraits> : GenericNumTraits {}; +} + +#endif + diff --git a/lib/eigen-3.4.0/test/SafeScalar.h b/lib/eigen-3.4.0/test/SafeScalar.h new file mode 100644 index 0000000..c5cb757 --- /dev/null +++ b/lib/eigen-3.4.0/test/SafeScalar.h @@ -0,0 +1,30 @@ + +// A Scalar that asserts for uninitialized access. +template +class SafeScalar { + public: + SafeScalar() : initialized_(false) {} + SafeScalar(const SafeScalar& other) { + *this = other; + } + SafeScalar& operator=(const SafeScalar& other) { + val_ = T(other); + initialized_ = true; + return *this; + } + + SafeScalar(T val) : val_(val), initialized_(true) {} + SafeScalar& operator=(T val) { + val_ = val; + initialized_ = true; + } + + operator T() const { + VERIFY(initialized_ && "Uninitialized access."); + return val_; + } + + private: + T val_; + bool initialized_; +}; diff --git a/lib/eigen-3.4.0/test/adjoint.cpp b/lib/eigen-3.4.0/test/adjoint.cpp new file mode 100644 index 0000000..4c4f98b --- /dev/null +++ b/lib/eigen-3.4.0/test/adjoint.cpp @@ -0,0 +1,219 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT + +#include "main.h" + +template struct adjoint_specific; + +template<> struct adjoint_specific { + template + static void run(const Vec& v1, const Vec& v2, Vec& v3, const Mat& square, Scalar s1, Scalar s2) { + VERIFY(test_isApproxWithRef((s1 * v1 + s2 * v2).dot(v3), numext::conj(s1) * v1.dot(v3) + numext::conj(s2) * v2.dot(v3), 0)); + VERIFY(test_isApproxWithRef(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), 0)); + + // check compatibility of dot and adjoint + VERIFY(test_isApproxWithRef(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), 0)); + } +}; + +template<> struct adjoint_specific { + template + static void run(const Vec& v1, const Vec& v2, Vec& v3, const Mat& square, Scalar s1, Scalar s2) { + typedef typename NumTraits::Real RealScalar; + using std::abs; + + RealScalar ref = NumTraits::IsInteger ? RealScalar(0) : (std::max)((s1 * v1 + s2 * v2).norm(),v3.norm()); + VERIFY(test_isApproxWithRef((s1 * v1 + s2 * v2).dot(v3), numext::conj(s1) * v1.dot(v3) + numext::conj(s2) * v2.dot(v3), ref)); + VERIFY(test_isApproxWithRef(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), ref)); + + VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm()); + // check normalized() and normalize() + VERIFY_IS_APPROX(v1, v1.norm() * v1.normalized()); + v3 = v1; + v3.normalize(); + VERIFY_IS_APPROX(v1, v1.norm() * v3); + VERIFY_IS_APPROX(v3, v1.normalized()); + VERIFY_IS_APPROX(v3.norm(), RealScalar(1)); + + // check null inputs + VERIFY_IS_APPROX((v1*0).normalized(), (v1*0)); +#if (!EIGEN_ARCH_i386) || defined(EIGEN_VECTORIZE) + RealScalar very_small = (std::numeric_limits::min)(); + VERIFY( (v1*very_small).norm() == 0 ); + VERIFY_IS_APPROX((v1*very_small).normalized(), (v1*very_small)); + v3 = v1*very_small; + v3.normalize(); + VERIFY_IS_APPROX(v3, (v1*very_small)); +#endif + + // check compatibility of dot and adjoint + ref = NumTraits::IsInteger ? 0 : (std::max)((std::max)(v1.norm(),v2.norm()),(std::max)((square * v2).norm(),(square.adjoint() * v1).norm())); + VERIFY(internal::isMuchSmallerThan(abs(v1.dot(square * v2) - (square.adjoint() * v1).dot(v2)), ref, test_precision())); + + // check that Random().normalized() works: tricky as the random xpr must be evaluated by + // normalized() in order to produce a consistent result. + VERIFY_IS_APPROX(Vec::Random(v1.size()).normalized().norm(), RealScalar(1)); + } +}; + +template void adjoint(const MatrixType& m) +{ + /* this test covers the following files: + Transpose.h Conjugate.h Dot.h + */ + using std::abs; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix VectorType; + typedef Matrix SquareMatrixType; + const Index PacketSize = internal::packet_traits::size; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols), + square = SquareMatrixType::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows), + v3 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); + + Scalar s1 = internal::random(), + s2 = internal::random(); + + // check basic compatibility of adjoint, transpose, conjugate + VERIFY_IS_APPROX(m1.transpose().conjugate().adjoint(), m1); + VERIFY_IS_APPROX(m1.adjoint().conjugate().transpose(), m1); + + // check multiplicative behavior + VERIFY_IS_APPROX((m1.adjoint() * m2).adjoint(), m2.adjoint() * m1); + VERIFY_IS_APPROX((s1 * m1).adjoint(), numext::conj(s1) * m1.adjoint()); + + // check basic properties of dot, squaredNorm + VERIFY_IS_APPROX(numext::conj(v1.dot(v2)), v2.dot(v1)); + VERIFY_IS_APPROX(numext::real(v1.dot(v1)), v1.squaredNorm()); + + adjoint_specific::IsInteger>::run(v1, v2, v3, square, s1, s2); + + VERIFY_IS_MUCH_SMALLER_THAN(abs(vzero.dot(v1)), static_cast(1)); + + // like in testBasicStuff, test operator() to check const-qualification + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + VERIFY_IS_APPROX(m1.conjugate()(r,c), numext::conj(m1(r,c))); + VERIFY_IS_APPROX(m1.adjoint()(c,r), numext::conj(m1(r,c))); + + // check inplace transpose + m3 = m1; + m3.transposeInPlace(); + VERIFY_IS_APPROX(m3,m1.transpose()); + m3.transposeInPlace(); + VERIFY_IS_APPROX(m3,m1); + + if(PacketSize(0,m3.rows()-PacketSize); + Index j = internal::random(0,m3.cols()-PacketSize); + m3.template block(i,j).transposeInPlace(); + VERIFY_IS_APPROX( (m3.template block(i,j)), (m1.template block(i,j).transpose()) ); + m3.template block(i,j).transposeInPlace(); + VERIFY_IS_APPROX(m3,m1); + } + + // check inplace adjoint + m3 = m1; + m3.adjointInPlace(); + VERIFY_IS_APPROX(m3,m1.adjoint()); + m3.transposeInPlace(); + VERIFY_IS_APPROX(m3,m1.conjugate()); + + // check mixed dot product + typedef Matrix RealVectorType; + RealVectorType rv1 = RealVectorType::Random(rows); + VERIFY_IS_APPROX(v1.dot(rv1.template cast()), v1.dot(rv1)); + VERIFY_IS_APPROX(rv1.template cast().dot(v1), rv1.dot(v1)); + + VERIFY( is_same_type(m1,m1.template conjugateIf()) ); + VERIFY( is_same_type(m1.conjugate(),m1.template conjugateIf()) ); +} + +template +void adjoint_extra() +{ + MatrixXcf a(10,10), b(10,10); + VERIFY_RAISES_ASSERT(a = a.transpose()); + VERIFY_RAISES_ASSERT(a = a.transpose() + b); + VERIFY_RAISES_ASSERT(a = b + a.transpose()); + VERIFY_RAISES_ASSERT(a = a.conjugate().transpose()); + VERIFY_RAISES_ASSERT(a = a.adjoint()); + VERIFY_RAISES_ASSERT(a = a.adjoint() + b); + VERIFY_RAISES_ASSERT(a = b + a.adjoint()); + + // no assertion should be triggered for these cases: + a.transpose() = a.transpose(); + a.transpose() += a.transpose(); + a.transpose() += a.transpose() + b; + a.transpose() = a.adjoint(); + a.transpose() += a.adjoint(); + a.transpose() += a.adjoint() + b; + + // regression tests for check_for_aliasing + MatrixXd c(10,10); + c = 1.0 * MatrixXd::Ones(10,10) + c; + c = MatrixXd::Ones(10,10) * 1.0 + c; + c = c + MatrixXd::Ones(10,10) .cwiseProduct( MatrixXd::Zero(10,10) ); + c = MatrixXd::Ones(10,10) * MatrixXd::Zero(10,10); + + // regression for bug 1646 + for (int j = 0; j < 10; ++j) { + c.col(j).head(j) = c.row(j).head(j); + } + + for (int j = 0; j < 10; ++j) { + c.col(j) = c.row(j); + } + + a.conservativeResize(1,1); + a = a.transpose(); + + a.conservativeResize(0,0); + a = a.transpose(); +} + +EIGEN_DECLARE_TEST(adjoint) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( adjoint(Matrix()) ); + CALL_SUBTEST_2( adjoint(Matrix3d()) ); + CALL_SUBTEST_3( adjoint(Matrix4f()) ); + + CALL_SUBTEST_4( adjoint(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); + CALL_SUBTEST_5( adjoint(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( adjoint(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + + // Complement for 128 bits vectorization: + CALL_SUBTEST_8( adjoint(Matrix2d()) ); + CALL_SUBTEST_9( adjoint(Matrix()) ); + + // 256 bits vectorization: + CALL_SUBTEST_10( adjoint(Matrix()) ); + CALL_SUBTEST_11( adjoint(Matrix()) ); + CALL_SUBTEST_12( adjoint(Matrix()) ); + } + // test a large static matrix only once + CALL_SUBTEST_7( adjoint(Matrix()) ); + + CALL_SUBTEST_13( adjoint_extra<0>() ); +} + diff --git a/lib/eigen-3.4.0/test/array_cwise.cpp b/lib/eigen-3.4.0/test/array_cwise.cpp new file mode 100644 index 0000000..0cc438b --- /dev/null +++ b/lib/eigen-3.4.0/test/array_cwise.cpp @@ -0,0 +1,710 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + + +// Test the corner cases of pow(x, y) for real types. +template +void pow_test() { + const Scalar zero = Scalar(0); + const Scalar eps = Eigen::NumTraits::epsilon(); + const Scalar one = Scalar(1); + const Scalar two = Scalar(2); + const Scalar three = Scalar(3); + const Scalar sqrt_half = Scalar(std::sqrt(0.5)); + const Scalar sqrt2 = Scalar(std::sqrt(2)); + const Scalar inf = Eigen::NumTraits::infinity(); + const Scalar nan = Eigen::NumTraits::quiet_NaN(); + const Scalar denorm_min = std::numeric_limits::denorm_min(); + const Scalar min = (std::numeric_limits::min)(); + const Scalar max = (std::numeric_limits::max)(); + const Scalar max_exp = (static_cast(int(Eigen::NumTraits::max_exponent())) * Scalar(EIGEN_LN2)) / eps; + + const static Scalar abs_vals[] = {zero, + denorm_min, + min, + eps, + sqrt_half, + one, + sqrt2, + two, + three, + max_exp, + max, + inf, + nan}; + const int abs_cases = 13; + const int num_cases = 2*abs_cases * 2*abs_cases; + // Repeat the same value to make sure we hit the vectorized path. + const int num_repeats = 32; + Array x(num_repeats, num_cases); + Array y(num_repeats, num_cases); + int count = 0; + for (int i = 0; i < abs_cases; ++i) { + const Scalar abs_x = abs_vals[i]; + for (int sign_x = 0; sign_x < 2; ++sign_x) { + Scalar x_case = sign_x == 0 ? -abs_x : abs_x; + for (int j = 0; j < abs_cases; ++j) { + const Scalar abs_y = abs_vals[j]; + for (int sign_y = 0; sign_y < 2; ++sign_y) { + Scalar y_case = sign_y == 0 ? -abs_y : abs_y; + for (int repeat = 0; repeat < num_repeats; ++repeat) { + x(repeat, count) = x_case; + y(repeat, count) = y_case; + } + ++count; + } + } + } + } + + Array actual = x.pow(y); + const Scalar tol = test_precision(); + bool all_pass = true; + for (int i = 0; i < 1; ++i) { + for (int j = 0; j < num_cases; ++j) { + Scalar e = static_cast(std::pow(x(i,j), y(i,j))); + Scalar a = actual(i, j); + bool fail = !(a==e) && !internal::isApprox(a, e, tol) && !((numext::isnan)(a) && (numext::isnan)(e)); + all_pass &= !fail; + if (fail) { + std::cout << "pow(" << x(i,j) << "," << y(i,j) << ") = " << a << " != " << e << std::endl; + } + } + } + VERIFY(all_pass); +} + +template void array(const ArrayType& m) +{ + typedef typename ArrayType::Scalar Scalar; + typedef typename ArrayType::RealScalar RealScalar; + typedef Array ColVectorType; + typedef Array RowVectorType; + + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2 = ArrayType::Random(rows, cols), + m3(rows, cols); + ArrayType m4 = m1; // copy constructor + VERIFY_IS_APPROX(m1, m4); + + ColVectorType cv1 = ColVectorType::Random(rows); + RowVectorType rv1 = RowVectorType::Random(cols); + + Scalar s1 = internal::random(), + s2 = internal::random(); + + // scalar addition + VERIFY_IS_APPROX(m1 + s1, s1 + m1); + VERIFY_IS_APPROX(m1 + s1, ArrayType::Constant(rows,cols,s1) + m1); + VERIFY_IS_APPROX(s1 - m1, (-m1)+s1 ); + VERIFY_IS_APPROX(m1 - s1, m1 - ArrayType::Constant(rows,cols,s1)); + VERIFY_IS_APPROX(s1 - m1, ArrayType::Constant(rows,cols,s1) - m1); + VERIFY_IS_APPROX((m1*Scalar(2)) - s2, (m1+m1) - ArrayType::Constant(rows,cols,s2) ); + m3 = m1; + m3 += s2; + VERIFY_IS_APPROX(m3, m1 + s2); + m3 = m1; + m3 -= s1; + VERIFY_IS_APPROX(m3, m1 - s1); + + // scalar operators via Maps + m3 = m1; + ArrayType::Map(m1.data(), m1.rows(), m1.cols()) -= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); + VERIFY_IS_APPROX(m1, m3 - m2); + + m3 = m1; + ArrayType::Map(m1.data(), m1.rows(), m1.cols()) += ArrayType::Map(m2.data(), m2.rows(), m2.cols()); + VERIFY_IS_APPROX(m1, m3 + m2); + + m3 = m1; + ArrayType::Map(m1.data(), m1.rows(), m1.cols()) *= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); + VERIFY_IS_APPROX(m1, m3 * m2); + + m3 = m1; + m2 = ArrayType::Random(rows,cols); + m2 = (m2==0).select(1,m2); + ArrayType::Map(m1.data(), m1.rows(), m1.cols()) /= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); + VERIFY_IS_APPROX(m1, m3 / m2); + + // reductions + VERIFY_IS_APPROX(m1.abs().colwise().sum().sum(), m1.abs().sum()); + VERIFY_IS_APPROX(m1.abs().rowwise().sum().sum(), m1.abs().sum()); + using std::abs; + VERIFY_IS_MUCH_SMALLER_THAN(abs(m1.colwise().sum().sum() - m1.sum()), m1.abs().sum()); + VERIFY_IS_MUCH_SMALLER_THAN(abs(m1.rowwise().sum().sum() - m1.sum()), m1.abs().sum()); + if (!internal::isMuchSmallerThan(abs(m1.sum() - (m1+m2).sum()), m1.abs().sum(), test_precision())) + VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum()); + VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op())); + + // vector-wise ops + m3 = m1; + VERIFY_IS_APPROX(m3.colwise() += cv1, m1.colwise() + cv1); + m3 = m1; + VERIFY_IS_APPROX(m3.colwise() -= cv1, m1.colwise() - cv1); + m3 = m1; + VERIFY_IS_APPROX(m3.rowwise() += rv1, m1.rowwise() + rv1); + m3 = m1; + VERIFY_IS_APPROX(m3.rowwise() -= rv1, m1.rowwise() - rv1); + + // Conversion from scalar + VERIFY_IS_APPROX((m3 = s1), ArrayType::Constant(rows,cols,s1)); + VERIFY_IS_APPROX((m3 = 1), ArrayType::Constant(rows,cols,1)); + VERIFY_IS_APPROX((m3.topLeftCorner(rows,cols) = 1), ArrayType::Constant(rows,cols,1)); + typedef Array FixedArrayType; + { + FixedArrayType f1(s1); + VERIFY_IS_APPROX(f1, FixedArrayType::Constant(s1)); + FixedArrayType f2(numext::real(s1)); + VERIFY_IS_APPROX(f2, FixedArrayType::Constant(numext::real(s1))); + FixedArrayType f3((int)100*numext::real(s1)); + VERIFY_IS_APPROX(f3, FixedArrayType::Constant((int)100*numext::real(s1))); + f1.setRandom(); + FixedArrayType f4(f1.data()); + VERIFY_IS_APPROX(f4, f1); + } + #if EIGEN_HAS_CXX11 + { + FixedArrayType f1{s1}; + VERIFY_IS_APPROX(f1, FixedArrayType::Constant(s1)); + FixedArrayType f2{numext::real(s1)}; + VERIFY_IS_APPROX(f2, FixedArrayType::Constant(numext::real(s1))); + FixedArrayType f3{(int)100*numext::real(s1)}; + VERIFY_IS_APPROX(f3, FixedArrayType::Constant((int)100*numext::real(s1))); + f1.setRandom(); + FixedArrayType f4{f1.data()}; + VERIFY_IS_APPROX(f4, f1); + } + #endif + + // pow + VERIFY_IS_APPROX(m1.pow(2), m1.square()); + VERIFY_IS_APPROX(pow(m1,2), m1.square()); + VERIFY_IS_APPROX(m1.pow(3), m1.cube()); + VERIFY_IS_APPROX(pow(m1,3), m1.cube()); + VERIFY_IS_APPROX((-m1).pow(3), -m1.cube()); + VERIFY_IS_APPROX(pow(2*m1,3), 8*m1.cube()); + ArrayType exponents = ArrayType::Constant(rows, cols, RealScalar(2)); + VERIFY_IS_APPROX(Eigen::pow(m1,exponents), m1.square()); + VERIFY_IS_APPROX(m1.pow(exponents), m1.square()); + VERIFY_IS_APPROX(Eigen::pow(2*m1,exponents), 4*m1.square()); + VERIFY_IS_APPROX((2*m1).pow(exponents), 4*m1.square()); + VERIFY_IS_APPROX(Eigen::pow(m1,2*exponents), m1.square().square()); + VERIFY_IS_APPROX(m1.pow(2*exponents), m1.square().square()); + VERIFY_IS_APPROX(Eigen::pow(m1(0,0), exponents), ArrayType::Constant(rows,cols,m1(0,0)*m1(0,0))); + + // Check possible conflicts with 1D ctor + typedef Array OneDArrayType; + { + OneDArrayType o1(rows); + VERIFY(o1.size()==rows); + OneDArrayType o2(static_cast(rows)); + VERIFY(o2.size()==rows); + } + #if EIGEN_HAS_CXX11 + { + OneDArrayType o1{rows}; + VERIFY(o1.size()==rows); + OneDArrayType o4{int(rows)}; + VERIFY(o4.size()==rows); + } + #endif + // Check possible conflicts with 2D ctor + typedef Array TwoDArrayType; + typedef Array ArrayType2; + { + TwoDArrayType o1(rows,cols); + VERIFY(o1.rows()==rows); + VERIFY(o1.cols()==cols); + TwoDArrayType o2(static_cast(rows),static_cast(cols)); + VERIFY(o2.rows()==rows); + VERIFY(o2.cols()==cols); + + ArrayType2 o3(rows,cols); + VERIFY(o3(0)==Scalar(rows) && o3(1)==Scalar(cols)); + ArrayType2 o4(static_cast(rows),static_cast(cols)); + VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols)); + } + #if EIGEN_HAS_CXX11 + { + TwoDArrayType o1{rows,cols}; + VERIFY(o1.rows()==rows); + VERIFY(o1.cols()==cols); + TwoDArrayType o2{int(rows),int(cols)}; + VERIFY(o2.rows()==rows); + VERIFY(o2.cols()==cols); + + ArrayType2 o3{rows,cols}; + VERIFY(o3(0)==Scalar(rows) && o3(1)==Scalar(cols)); + ArrayType2 o4{int(rows),int(cols)}; + VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols)); + } + #endif +} + +template void comparisons(const ArrayType& m) +{ + using std::abs; + typedef typename ArrayType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2 = ArrayType::Random(rows, cols), + m3(rows, cols), + m4 = m1; + + m4 = (m4.abs()==Scalar(0)).select(1,m4); + + VERIFY(((m1 + Scalar(1)) > m1).all()); + VERIFY(((m1 - Scalar(1)) < m1).all()); + if (rows*cols>1) + { + m3 = m1; + m3(r,c) += 1; + VERIFY(! (m1 < m3).all() ); + VERIFY(! (m1 > m3).all() ); + } + VERIFY(!(m1 > m2 && m1 < m2).any()); + VERIFY((m1 <= m2 || m1 >= m2).all()); + + // comparisons array to scalar + VERIFY( (m1 != (m1(r,c)+1) ).any() ); + VERIFY( (m1 > (m1(r,c)-1) ).any() ); + VERIFY( (m1 < (m1(r,c)+1) ).any() ); + VERIFY( (m1 == m1(r,c) ).any() ); + + // comparisons scalar to array + VERIFY( ( (m1(r,c)+1) != m1).any() ); + VERIFY( ( (m1(r,c)-1) < m1).any() ); + VERIFY( ( (m1(r,c)+1) > m1).any() ); + VERIFY( ( m1(r,c) == m1).any() ); + + // test Select + VERIFY_IS_APPROX( (m1m2).select(m1,m2), m1.cwiseMax(m2) ); + Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2); + for (int j=0; j=ArrayType::Constant(rows,cols,mid)) + .select(m1,0), m3); + // even shorter version: + VERIFY_IS_APPROX( (m1.abs()RealScalar(0.1)).count() == rows*cols); + + // and/or + VERIFY( (m1RealScalar(0)).count() == 0); + VERIFY( (m1=RealScalar(0)).count() == rows*cols); + RealScalar a = m1.abs().mean(); + VERIFY( (m1<-a || m1>a).count() == (m1.abs()>a).count()); + + typedef Array ArrayOfIndices; + + // TODO allows colwise/rowwise for array + VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).colwise().count(), ArrayOfIndices::Constant(cols,rows).transpose()); + VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).rowwise().count(), ArrayOfIndices::Constant(rows, cols)); +} + +template void array_real(const ArrayType& m) +{ + using std::abs; + using std::sqrt; + typedef typename ArrayType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2 = ArrayType::Random(rows, cols), + m3(rows, cols), + m4 = m1; + + m4 = (m4.abs()==Scalar(0)).select(Scalar(1),m4); + + Scalar s1 = internal::random(); + + // these tests are mostly to check possible compilation issues with free-functions. + VERIFY_IS_APPROX(m1.sin(), sin(m1)); + VERIFY_IS_APPROX(m1.cos(), cos(m1)); + VERIFY_IS_APPROX(m1.tan(), tan(m1)); + VERIFY_IS_APPROX(m1.asin(), asin(m1)); + VERIFY_IS_APPROX(m1.acos(), acos(m1)); + VERIFY_IS_APPROX(m1.atan(), atan(m1)); + VERIFY_IS_APPROX(m1.sinh(), sinh(m1)); + VERIFY_IS_APPROX(m1.cosh(), cosh(m1)); + VERIFY_IS_APPROX(m1.tanh(), tanh(m1)); +#if EIGEN_HAS_CXX11_MATH + VERIFY_IS_APPROX(m1.tanh().atanh(), atanh(tanh(m1))); + VERIFY_IS_APPROX(m1.sinh().asinh(), asinh(sinh(m1))); + VERIFY_IS_APPROX(m1.cosh().acosh(), acosh(cosh(m1))); +#endif + VERIFY_IS_APPROX(m1.logistic(), logistic(m1)); + + VERIFY_IS_APPROX(m1.arg(), arg(m1)); + VERIFY_IS_APPROX(m1.round(), round(m1)); + VERIFY_IS_APPROX(m1.rint(), rint(m1)); + VERIFY_IS_APPROX(m1.floor(), floor(m1)); + VERIFY_IS_APPROX(m1.ceil(), ceil(m1)); + VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all()); + VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all()); + VERIFY((m1.isFinite() == (Eigen::isfinite)(m1)).all()); + VERIFY_IS_APPROX(m4.inverse(), inverse(m4)); + VERIFY_IS_APPROX(m1.abs(), abs(m1)); + VERIFY_IS_APPROX(m1.abs2(), abs2(m1)); + VERIFY_IS_APPROX(m1.square(), square(m1)); + VERIFY_IS_APPROX(m1.cube(), cube(m1)); + VERIFY_IS_APPROX(cos(m1+RealScalar(3)*m2), cos((m1+RealScalar(3)*m2).eval())); + VERIFY_IS_APPROX(m1.sign(), sign(m1)); + VERIFY((m1.sqrt().sign().isNaN() == (Eigen::isnan)(sign(sqrt(m1)))).all()); + + // avoid inf and NaNs so verification doesn't fail + m3 = m4.abs(); + VERIFY_IS_APPROX(m3.sqrt(), sqrt(abs(m3))); + VERIFY_IS_APPROX(m3.rsqrt(), Scalar(1)/sqrt(abs(m3))); + VERIFY_IS_APPROX(rsqrt(m3), Scalar(1)/sqrt(abs(m3))); + VERIFY_IS_APPROX(m3.log(), log(m3)); + VERIFY_IS_APPROX(m3.log1p(), log1p(m3)); + VERIFY_IS_APPROX(m3.log10(), log10(m3)); + VERIFY_IS_APPROX(m3.log2(), log2(m3)); + + + VERIFY((!(m1>m2) == (m1<=m2)).all()); + + VERIFY_IS_APPROX(sin(m1.asin()), m1); + VERIFY_IS_APPROX(cos(m1.acos()), m1); + VERIFY_IS_APPROX(tan(m1.atan()), m1); + VERIFY_IS_APPROX(sinh(m1), Scalar(0.5)*(exp(m1)-exp(-m1))); + VERIFY_IS_APPROX(cosh(m1), Scalar(0.5)*(exp(m1)+exp(-m1))); + VERIFY_IS_APPROX(tanh(m1), (Scalar(0.5)*(exp(m1)-exp(-m1)))/(Scalar(0.5)*(exp(m1)+exp(-m1)))); + VERIFY_IS_APPROX(logistic(m1), (Scalar(1)/(Scalar(1)+exp(-m1)))); + VERIFY_IS_APPROX(arg(m1), ((m1())*Scalar(std::acos(Scalar(-1)))); + VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all()); + VERIFY((rint(m1) <= ceil(m1) && rint(m1) >= floor(m1)).all()); + VERIFY(((ceil(m1) - round(m1)) <= Scalar(0.5) || (round(m1) - floor(m1)) <= Scalar(0.5)).all()); + VERIFY(((ceil(m1) - round(m1)) <= Scalar(1.0) && (round(m1) - floor(m1)) <= Scalar(1.0)).all()); + VERIFY(((ceil(m1) - rint(m1)) <= Scalar(0.5) || (rint(m1) - floor(m1)) <= Scalar(0.5)).all()); + VERIFY(((ceil(m1) - rint(m1)) <= Scalar(1.0) && (rint(m1) - floor(m1)) <= Scalar(1.0)).all()); + VERIFY((Eigen::isnan)((m1*Scalar(0))/Scalar(0)).all()); + VERIFY((Eigen::isinf)(m4/Scalar(0)).all()); + VERIFY(((Eigen::isfinite)(m1) && (!(Eigen::isfinite)(m1*Scalar(0)/Scalar(0))) && (!(Eigen::isfinite)(m4/Scalar(0)))).all()); + VERIFY_IS_APPROX(inverse(inverse(m4)),m4); + VERIFY((abs(m1) == m1 || abs(m1) == -m1).all()); + VERIFY_IS_APPROX(m3, sqrt(abs2(m3))); + VERIFY_IS_APPROX(m1.absolute_difference(m2), (m1 > m2).select(m1 - m2, m2 - m1)); + VERIFY_IS_APPROX( m1.sign(), -(-m1).sign() ); + VERIFY_IS_APPROX( m1*m1.sign(),m1.abs()); + VERIFY_IS_APPROX(m1.sign() * m1.abs(), m1); + + VERIFY_IS_APPROX(numext::abs2(numext::real(m1)) + numext::abs2(numext::imag(m1)), numext::abs2(m1)); + VERIFY_IS_APPROX(numext::abs2(Eigen::real(m1)) + numext::abs2(Eigen::imag(m1)), numext::abs2(m1)); + if(!NumTraits::IsComplex) + VERIFY_IS_APPROX(numext::real(m1), m1); + + // shift argument of logarithm so that it is not zero + Scalar smallNumber = NumTraits::dummy_precision(); + VERIFY_IS_APPROX((m3 + smallNumber).log() , log(abs(m3) + smallNumber)); + VERIFY_IS_APPROX((m3 + smallNumber + Scalar(1)).log() , log1p(abs(m3) + smallNumber)); + + VERIFY_IS_APPROX(m1.exp() * m2.exp(), exp(m1+m2)); + VERIFY_IS_APPROX(m1.exp(), exp(m1)); + VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp()); + + VERIFY_IS_APPROX(m1.expm1(), expm1(m1)); + VERIFY_IS_APPROX((m3 + smallNumber).exp() - Scalar(1), expm1(abs(m3) + smallNumber)); + + VERIFY_IS_APPROX(m3.pow(RealScalar(0.5)), m3.sqrt()); + VERIFY_IS_APPROX(pow(m3,RealScalar(0.5)), m3.sqrt()); + + VERIFY_IS_APPROX(m3.pow(RealScalar(-0.5)), m3.rsqrt()); + VERIFY_IS_APPROX(pow(m3,RealScalar(-0.5)), m3.rsqrt()); + + // Avoid inf and NaN. + m3 = (m1.square()::epsilon()).select(Scalar(1),m3); + VERIFY_IS_APPROX(m3.pow(RealScalar(-2)), m3.square().inverse()); + pow_test(); + + VERIFY_IS_APPROX(log10(m3), log(m3)/numext::log(Scalar(10))); + VERIFY_IS_APPROX(log2(m3), log(m3)/numext::log(Scalar(2))); + + // scalar by array division + const RealScalar tiny = sqrt(std::numeric_limits::epsilon()); + s1 += Scalar(tiny); + m1 += ArrayType::Constant(rows,cols,Scalar(tiny)); + VERIFY_IS_APPROX(s1/m1, s1 * m1.inverse()); + + // check inplace transpose + m3 = m1; + m3.transposeInPlace(); + VERIFY_IS_APPROX(m3, m1.transpose()); + m3.transposeInPlace(); + VERIFY_IS_APPROX(m3, m1); +} + +template void array_complex(const ArrayType& m) +{ + typedef typename ArrayType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2(rows, cols), + m4 = m1; + + m4.real() = (m4.real().abs()==RealScalar(0)).select(RealScalar(1),m4.real()); + m4.imag() = (m4.imag().abs()==RealScalar(0)).select(RealScalar(1),m4.imag()); + + Array m3(rows, cols); + + for (Index i = 0; i < m.rows(); ++i) + for (Index j = 0; j < m.cols(); ++j) + m2(i,j) = sqrt(m1(i,j)); + + // these tests are mostly to check possible compilation issues with free-functions. + VERIFY_IS_APPROX(m1.sin(), sin(m1)); + VERIFY_IS_APPROX(m1.cos(), cos(m1)); + VERIFY_IS_APPROX(m1.tan(), tan(m1)); + VERIFY_IS_APPROX(m1.sinh(), sinh(m1)); + VERIFY_IS_APPROX(m1.cosh(), cosh(m1)); + VERIFY_IS_APPROX(m1.tanh(), tanh(m1)); + VERIFY_IS_APPROX(m1.logistic(), logistic(m1)); + VERIFY_IS_APPROX(m1.arg(), arg(m1)); + VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all()); + VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all()); + VERIFY((m1.isFinite() == (Eigen::isfinite)(m1)).all()); + VERIFY_IS_APPROX(m4.inverse(), inverse(m4)); + VERIFY_IS_APPROX(m1.log(), log(m1)); + VERIFY_IS_APPROX(m1.log10(), log10(m1)); + VERIFY_IS_APPROX(m1.log2(), log2(m1)); + VERIFY_IS_APPROX(m1.abs(), abs(m1)); + VERIFY_IS_APPROX(m1.abs2(), abs2(m1)); + VERIFY_IS_APPROX(m1.sqrt(), sqrt(m1)); + VERIFY_IS_APPROX(m1.square(), square(m1)); + VERIFY_IS_APPROX(m1.cube(), cube(m1)); + VERIFY_IS_APPROX(cos(m1+RealScalar(3)*m2), cos((m1+RealScalar(3)*m2).eval())); + VERIFY_IS_APPROX(m1.sign(), sign(m1)); + + + VERIFY_IS_APPROX(m1.exp() * m2.exp(), exp(m1+m2)); + VERIFY_IS_APPROX(m1.exp(), exp(m1)); + VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp()); + + VERIFY_IS_APPROX(m1.expm1(), expm1(m1)); + VERIFY_IS_APPROX(expm1(m1), exp(m1) - 1.); + // Check for larger magnitude complex numbers that expm1 matches exp - 1. + VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.); + + VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1))); + VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1))); + VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1)))); + VERIFY_IS_APPROX(logistic(m1), (1.0/(1.0 + exp(-m1)))); + + for (Index i = 0; i < m.rows(); ++i) + for (Index j = 0; j < m.cols(); ++j) + m3(i,j) = std::atan2(m1(i,j).imag(), m1(i,j).real()); + VERIFY_IS_APPROX(arg(m1), m3); + + std::complex zero(0.0,0.0); + VERIFY((Eigen::isnan)(m1*zero/zero).all()); +#if EIGEN_COMP_MSVC + // msvc complex division is not robust + VERIFY((Eigen::isinf)(m4/RealScalar(0)).all()); +#else +#if EIGEN_COMP_CLANG + // clang's complex division is notoriously broken too + if((numext::isinf)(m4(0,0)/RealScalar(0))) { +#endif + VERIFY((Eigen::isinf)(m4/zero).all()); +#if EIGEN_COMP_CLANG + } + else + { + VERIFY((Eigen::isinf)(m4.real()/zero.real()).all()); + } +#endif +#endif // MSVC + + VERIFY(((Eigen::isfinite)(m1) && (!(Eigen::isfinite)(m1*zero/zero)) && (!(Eigen::isfinite)(m1/zero))).all()); + + VERIFY_IS_APPROX(inverse(inverse(m4)),m4); + VERIFY_IS_APPROX(conj(m1.conjugate()), m1); + VERIFY_IS_APPROX(abs(m1), sqrt(square(m1.real())+square(m1.imag()))); + VERIFY_IS_APPROX(abs(m1), sqrt(abs2(m1))); + VERIFY_IS_APPROX(log10(m1), log(m1)/log(10)); + VERIFY_IS_APPROX(log2(m1), log(m1)/log(2)); + + VERIFY_IS_APPROX( m1.sign(), -(-m1).sign() ); + VERIFY_IS_APPROX( m1.sign() * m1.abs(), m1); + + // scalar by array division + Scalar s1 = internal::random(); + const RealScalar tiny = std::sqrt(std::numeric_limits::epsilon()); + s1 += Scalar(tiny); + m1 += ArrayType::Constant(rows,cols,Scalar(tiny)); + VERIFY_IS_APPROX(s1/m1, s1 * m1.inverse()); + + // check inplace transpose + m2 = m1; + m2.transposeInPlace(); + VERIFY_IS_APPROX(m2, m1.transpose()); + m2.transposeInPlace(); + VERIFY_IS_APPROX(m2, m1); + // Check vectorized inplace transpose. + ArrayType m5 = ArrayType::Random(131, 131); + ArrayType m6 = m5; + m6.transposeInPlace(); + VERIFY_IS_APPROX(m6, m5.transpose()); +} + +template void min_max(const ArrayType& m) +{ + typedef typename ArrayType::Scalar Scalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols); + + // min/max with array + Scalar maxM1 = m1.maxCoeff(); + Scalar minM1 = m1.minCoeff(); + + VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, minM1), (m1.min)(ArrayType::Constant(rows,cols, minM1))); + VERIFY_IS_APPROX(m1, (m1.min)(ArrayType::Constant(rows,cols, maxM1))); + + VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, maxM1), (m1.max)(ArrayType::Constant(rows,cols, maxM1))); + VERIFY_IS_APPROX(m1, (m1.max)(ArrayType::Constant(rows,cols, minM1))); + + // min/max with scalar input + VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, minM1), (m1.min)( minM1)); + VERIFY_IS_APPROX(m1, (m1.min)( maxM1)); + + VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, maxM1), (m1.max)( maxM1)); + VERIFY_IS_APPROX(m1, (m1.max)( minM1)); + + + // min/max with various NaN propagation options. + if (m1.size() > 1 && !NumTraits::IsInteger) { + m1(0,0) = NumTraits::quiet_NaN(); + maxM1 = m1.template maxCoeff(); + minM1 = m1.template minCoeff(); + VERIFY((numext::isnan)(maxM1)); + VERIFY((numext::isnan)(minM1)); + + maxM1 = m1.template maxCoeff(); + minM1 = m1.template minCoeff(); + VERIFY(!(numext::isnan)(maxM1)); + VERIFY(!(numext::isnan)(minM1)); + } +} + +template +struct shift_left { + template + Scalar operator()(const Scalar& v) const { + return v << N; + } +}; + +template +struct arithmetic_shift_right { + template + Scalar operator()(const Scalar& v) const { + return v >> N; + } +}; + +template void array_integer(const ArrayType& m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2(rows, cols); + + m2 = m1.template shiftLeft<2>(); + VERIFY( (m2 == m1.unaryExpr(shift_left<2>())).all() ); + m2 = m1.template shiftLeft<9>(); + VERIFY( (m2 == m1.unaryExpr(shift_left<9>())).all() ); + + m2 = m1.template shiftRight<2>(); + VERIFY( (m2 == m1.unaryExpr(arithmetic_shift_right<2>())).all() ); + m2 = m1.template shiftRight<9>(); + VERIFY( (m2 == m1.unaryExpr(arithmetic_shift_right<9>())).all() ); +} + +EIGEN_DECLARE_TEST(array_cwise) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( array(Array()) ); + CALL_SUBTEST_2( array(Array22f()) ); + CALL_SUBTEST_3( array(Array44d()) ); + CALL_SUBTEST_4( array(ArrayXXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_5( array(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( array(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( array(Array(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( array_integer(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( array_integer(Array(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( comparisons(Array()) ); + CALL_SUBTEST_2( comparisons(Array22f()) ); + CALL_SUBTEST_3( comparisons(Array44d()) ); + CALL_SUBTEST_5( comparisons(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( comparisons(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( min_max(Array()) ); + CALL_SUBTEST_2( min_max(Array22f()) ); + CALL_SUBTEST_3( min_max(Array44d()) ); + CALL_SUBTEST_5( min_max(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( min_max(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( array_real(Array()) ); + CALL_SUBTEST_2( array_real(Array22f()) ); + CALL_SUBTEST_3( array_real(Array44d()) ); + CALL_SUBTEST_5( array_real(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_7( array_real(Array()) ); + CALL_SUBTEST_8( array_real(Array()) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_4( array_complex(ArrayXXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + + VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, int >::value)); + VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, float >::value)); + VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, ArrayBase >::value)); + typedef CwiseUnaryOp, ArrayXd > Xpr; + VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, + ArrayBase + >::value)); +} diff --git a/lib/eigen-3.4.0/test/array_for_matrix.cpp b/lib/eigen-3.4.0/test/array_for_matrix.cpp new file mode 100644 index 0000000..fb6be35 --- /dev/null +++ b/lib/eigen-3.4.0/test/array_for_matrix.cpp @@ -0,0 +1,307 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void array_for_matrix(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix ColVectorType; + typedef Matrix RowVectorType; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols); + + ColVectorType cv1 = ColVectorType::Random(rows); + RowVectorType rv1 = RowVectorType::Random(cols); + + Scalar s1 = internal::random(), + s2 = internal::random(); + + // scalar addition + VERIFY_IS_APPROX(m1.array() + s1, s1 + m1.array()); + VERIFY_IS_APPROX((m1.array() + s1).matrix(), MatrixType::Constant(rows,cols,s1) + m1); + VERIFY_IS_APPROX(((m1*Scalar(2)).array() - s2).matrix(), (m1+m1) - MatrixType::Constant(rows,cols,s2) ); + m3 = m1; + m3.array() += s2; + VERIFY_IS_APPROX(m3, (m1.array() + s2).matrix()); + m3 = m1; + m3.array() -= s1; + VERIFY_IS_APPROX(m3, (m1.array() - s1).matrix()); + + // reductions + VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum().sum() - m1.sum(), m1.squaredNorm()); + VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum().sum() - m1.sum(), m1.squaredNorm()); + VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum() + m2.colwise().sum() - (m1+m2).colwise().sum(), (m1+m2).squaredNorm()); + VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum() - m2.rowwise().sum() - (m1-m2).rowwise().sum(), (m1-m2).squaredNorm()); + VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op())); + + // vector-wise ops + m3 = m1; + VERIFY_IS_APPROX(m3.colwise() += cv1, m1.colwise() + cv1); + m3 = m1; + VERIFY_IS_APPROX(m3.colwise() -= cv1, m1.colwise() - cv1); + m3 = m1; + VERIFY_IS_APPROX(m3.rowwise() += rv1, m1.rowwise() + rv1); + m3 = m1; + VERIFY_IS_APPROX(m3.rowwise() -= rv1, m1.rowwise() - rv1); + + // empty objects + VERIFY_IS_APPROX((m1.template block<0,Dynamic>(0,0,0,cols).colwise().sum()), RowVectorType::Zero(cols)); + VERIFY_IS_APPROX((m1.template block(0,0,rows,0).rowwise().sum()), ColVectorType::Zero(rows)); + VERIFY_IS_APPROX((m1.template block<0,Dynamic>(0,0,0,cols).colwise().prod()), RowVectorType::Ones(cols)); + VERIFY_IS_APPROX((m1.template block(0,0,rows,0).rowwise().prod()), ColVectorType::Ones(rows)); + + VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().sum(), RowVectorType::Zero(cols)); + VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().sum(), ColVectorType::Zero(rows)); + VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().prod(), RowVectorType::Ones(cols)); + VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().prod(), ColVectorType::Ones(rows)); + + // verify the const accessors exist + const Scalar& ref_m1 = m.matrix().array().coeffRef(0); + const Scalar& ref_m2 = m.matrix().array().coeffRef(0,0); + const Scalar& ref_a1 = m.array().matrix().coeffRef(0); + const Scalar& ref_a2 = m.array().matrix().coeffRef(0,0); + VERIFY(&ref_a1 == &ref_m1); + VERIFY(&ref_a2 == &ref_m2); + + // Check write accessors: + m1.array().coeffRef(0,0) = 1; + VERIFY_IS_APPROX(m1(0,0),Scalar(1)); + m1.array()(0,0) = 2; + VERIFY_IS_APPROX(m1(0,0),Scalar(2)); + m1.array().matrix().coeffRef(0,0) = 3; + VERIFY_IS_APPROX(m1(0,0),Scalar(3)); + m1.array().matrix()(0,0) = 4; + VERIFY_IS_APPROX(m1(0,0),Scalar(4)); +} + +template void comparisons(const MatrixType& m) +{ + using std::abs; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols); + + VERIFY(((m1.array() + Scalar(1)) > m1.array()).all()); + VERIFY(((m1.array() - Scalar(1)) < m1.array()).all()); + if (rows*cols>1) + { + m3 = m1; + m3(r,c) += 1; + VERIFY(! (m1.array() < m3.array()).all() ); + VERIFY(! (m1.array() > m3.array()).all() ); + } + + // comparisons to scalar + VERIFY( (m1.array() != (m1(r,c)+1) ).any() ); + VERIFY( (m1.array() > (m1(r,c)-1) ).any() ); + VERIFY( (m1.array() < (m1(r,c)+1) ).any() ); + VERIFY( (m1.array() == m1(r,c) ).any() ); + VERIFY( m1.cwiseEqual(m1(r,c)).any() ); + + // test Select + VERIFY_IS_APPROX( (m1.array()m2.array()).select(m1,m2), m1.cwiseMax(m2) ); + Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2); + for (int j=0; j=MatrixType::Constant(rows,cols,mid).array()) + .select(m1,0), m3); + // even shorter version: + VERIFY_IS_APPROX( (m1.array().abs()RealScalar(0.1)).count() == rows*cols); + + // and/or + VERIFY( ((m1.array()RealScalar(0)).matrix()).count() == 0); + VERIFY( ((m1.array()=RealScalar(0)).matrix()).count() == rows*cols); + RealScalar a = m1.cwiseAbs().mean(); + VERIFY( ((m1.array()<-a).matrix() || (m1.array()>a).matrix()).count() == (m1.cwiseAbs().array()>a).count()); + + typedef Matrix VectorOfIndices; + + // TODO allows colwise/rowwise for array + VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().colwise().count(), VectorOfIndices::Constant(cols,rows).transpose()); + VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().rowwise().count(), VectorOfIndices::Constant(rows, cols)); +} + +template void lpNorm(const VectorType& v) +{ + using std::sqrt; + typedef typename VectorType::RealScalar RealScalar; + VectorType u = VectorType::Random(v.size()); + + if(v.size()==0) + { + VERIFY_IS_APPROX(u.template lpNorm(), RealScalar(0)); + VERIFY_IS_APPROX(u.template lpNorm<1>(), RealScalar(0)); + VERIFY_IS_APPROX(u.template lpNorm<2>(), RealScalar(0)); + VERIFY_IS_APPROX(u.template lpNorm<5>(), RealScalar(0)); + } + else + { + VERIFY_IS_APPROX(u.template lpNorm(), u.cwiseAbs().maxCoeff()); + } + + VERIFY_IS_APPROX(u.template lpNorm<1>(), u.cwiseAbs().sum()); + VERIFY_IS_APPROX(u.template lpNorm<2>(), sqrt(u.array().abs().square().sum())); + VERIFY_IS_APPROX(numext::pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.array().abs().pow(5).sum()); +} + +template void cwise_min_max(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols); + + // min/max with array + Scalar maxM1 = m1.maxCoeff(); + Scalar minM1 = m1.minCoeff(); + + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1), m1.cwiseMin(MatrixType::Constant(rows,cols, minM1))); + VERIFY_IS_APPROX(m1, m1.cwiseMin(MatrixType::Constant(rows,cols, maxM1))); + + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1), m1.cwiseMax(MatrixType::Constant(rows,cols, maxM1))); + VERIFY_IS_APPROX(m1, m1.cwiseMax(MatrixType::Constant(rows,cols, minM1))); + + // min/max with scalar input + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1), m1.cwiseMin( minM1)); + VERIFY_IS_APPROX(m1, m1.cwiseMin(maxM1)); + VERIFY_IS_APPROX(-m1, (-m1).cwiseMin(-minM1)); + VERIFY_IS_APPROX(-m1.array(), ((-m1).array().min)( -minM1)); + + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1), m1.cwiseMax( maxM1)); + VERIFY_IS_APPROX(m1, m1.cwiseMax(minM1)); + VERIFY_IS_APPROX(-m1, (-m1).cwiseMax(-maxM1)); + VERIFY_IS_APPROX(-m1.array(), ((-m1).array().max)(-maxM1)); + + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1).array(), (m1.array().min)( minM1)); + VERIFY_IS_APPROX(m1.array(), (m1.array().min)( maxM1)); + + VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1).array(), (m1.array().max)( maxM1)); + VERIFY_IS_APPROX(m1.array(), (m1.array().max)( minM1)); + +} + +template void resize(const MatrixTraits& t) +{ + typedef typename MatrixTraits::Scalar Scalar; + typedef Matrix MatrixType; + typedef Array Array2DType; + typedef Matrix VectorType; + typedef Array Array1DType; + + Index rows = t.rows(), cols = t.cols(); + + MatrixType m(rows,cols); + VectorType v(rows); + Array2DType a2(rows,cols); + Array1DType a1(rows); + + m.array().resize(rows+1,cols+1); + VERIFY(m.rows()==rows+1 && m.cols()==cols+1); + a2.matrix().resize(rows+1,cols+1); + VERIFY(a2.rows()==rows+1 && a2.cols()==cols+1); + v.array().resize(cols); + VERIFY(v.size()==cols); + a1.matrix().resize(cols); + VERIFY(a1.size()==cols); +} + +template +void regression_bug_654() +{ + ArrayXf a = RowVectorXf(3); + VectorXf v = Array(3); +} + +// Check propagation of LvalueBit through Array/Matrix-Wrapper +template +void regrrssion_bug_1410() +{ + const Matrix4i M; + const Array4i A; + ArrayWrapper MA = M.array(); + MA.row(0); + MatrixWrapper AM = A.matrix(); + AM.row(0); + + VERIFY((internal::traits >::Flags&LvalueBit)==0); + VERIFY((internal::traits >::Flags&LvalueBit)==0); + + VERIFY((internal::traits >::Flags&LvalueBit)==LvalueBit); + VERIFY((internal::traits >::Flags&LvalueBit)==LvalueBit); +} + +EIGEN_DECLARE_TEST(array_for_matrix) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( array_for_matrix(Matrix()) ); + CALL_SUBTEST_2( array_for_matrix(Matrix2f()) ); + CALL_SUBTEST_3( array_for_matrix(Matrix4d()) ); + CALL_SUBTEST_4( array_for_matrix(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_5( array_for_matrix(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( array_for_matrix(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( comparisons(Matrix()) ); + CALL_SUBTEST_2( comparisons(Matrix2f()) ); + CALL_SUBTEST_3( comparisons(Matrix4d()) ); + CALL_SUBTEST_5( comparisons(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( comparisons(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( cwise_min_max(Matrix()) ); + CALL_SUBTEST_2( cwise_min_max(Matrix2f()) ); + CALL_SUBTEST_3( cwise_min_max(Matrix4d()) ); + CALL_SUBTEST_5( cwise_min_max(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( cwise_min_max(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( lpNorm(Matrix()) ); + CALL_SUBTEST_2( lpNorm(Vector2f()) ); + CALL_SUBTEST_7( lpNorm(Vector3d()) ); + CALL_SUBTEST_8( lpNorm(Vector4f()) ); + CALL_SUBTEST_5( lpNorm(VectorXf(internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_4( lpNorm(VectorXcf(internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + CALL_SUBTEST_5( lpNorm(VectorXf(0)) ); + CALL_SUBTEST_4( lpNorm(VectorXcf(0)) ); + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_4( resize(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_5( resize(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( resize(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + CALL_SUBTEST_6( regression_bug_654<0>() ); + CALL_SUBTEST_6( regrrssion_bug_1410<0>() ); +} diff --git a/lib/eigen-3.4.0/test/array_of_string.cpp b/lib/eigen-3.4.0/test/array_of_string.cpp new file mode 100644 index 0000000..23e5152 --- /dev/null +++ b/lib/eigen-3.4.0/test/array_of_string.cpp @@ -0,0 +1,32 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +EIGEN_DECLARE_TEST(array_of_string) +{ + typedef Array ArrayXs; + ArrayXs a1(3), a2(3), a3(3), a3ref(3); + a1 << "one", "two", "three"; + a2 << "1", "2", "3"; + a3ref << "one (1)", "two (2)", "three (3)"; + std::stringstream s1; + s1 << a1; + VERIFY_IS_EQUAL(s1.str(), std::string(" one two three")); + a3 = a1 + std::string(" (") + a2 + std::string(")"); + VERIFY((a3==a3ref).all()); + + a3 = a1; + a3 += std::string(" (") + a2 + std::string(")"); + VERIFY((a3==a3ref).all()); + + a1.swap(a3); + VERIFY((a1==a3ref).all()); + VERIFY((a3!=a3ref).all()); +} diff --git a/lib/eigen-3.4.0/test/array_replicate.cpp b/lib/eigen-3.4.0/test/array_replicate.cpp new file mode 100644 index 0000000..057c3c7 --- /dev/null +++ b/lib/eigen-3.4.0/test/array_replicate.cpp @@ -0,0 +1,81 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void replicate(const MatrixType& m) +{ + /* this test covers the following files: + Replicate.cpp + */ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + typedef Matrix MatrixX; + typedef Matrix VectorX; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols); + + VectorType v1 = VectorType::Random(rows); + + MatrixX x1, x2; + VectorX vx1; + + int f1 = internal::random(1,10), + f2 = internal::random(1,10); + + x1.resize(rows*f1,cols*f2); + for(int j=0; j())); + + x2.resize(rows,3*cols); + x2 << m2, m2, m2; + VERIFY_IS_APPROX(x2, (m2.template replicate<1,3>())); + + vx1.resize(3*rows,cols); + vx1 << m2, m2, m2; + VERIFY_IS_APPROX(vx1+vx1, vx1+(m2.template replicate<3,1>())); + + vx1=m2+(m2.colwise().replicate(1)); + + if(m2.cols()==1) + VERIFY_IS_APPROX(m2.coeff(0), (m2.template replicate<3,1>().coeff(m2.rows()))); + + x2.resize(rows,f1); + for (int j=0; j()) ); + CALL_SUBTEST_2( replicate(Vector2f()) ); + CALL_SUBTEST_3( replicate(Vector3d()) ); + CALL_SUBTEST_4( replicate(Vector4f()) ); + CALL_SUBTEST_5( replicate(VectorXf(16)) ); + CALL_SUBTEST_6( replicate(VectorXcd(10)) ); + } +} diff --git a/lib/eigen-3.4.0/test/array_reverse.cpp b/lib/eigen-3.4.0/test/array_reverse.cpp new file mode 100644 index 0000000..c77528a --- /dev/null +++ b/lib/eigen-3.4.0/test/array_reverse.cpp @@ -0,0 +1,204 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2009 Ricard Marxer +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +using namespace std; + +template void reverse(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + + Index rows = m.rows(); + Index cols = m.cols(); + + // this test relies a lot on Random.h, and there's not much more that we can do + // to test it, hence I consider that we will have tested Random.h + MatrixType m1 = MatrixType::Random(rows, cols), m2; + VectorType v1 = VectorType::Random(rows); + + MatrixType m1_r = m1.reverse(); + // Verify that MatrixBase::reverse() works + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_r(i, j), m1(rows - 1 - i, cols - 1 - j)); + } + } + + Reverse m1_rd(m1); + // Verify that a Reverse default (in both directions) of an expression works + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_rd(i, j), m1(rows - 1 - i, cols - 1 - j)); + } + } + + Reverse m1_rb(m1); + // Verify that a Reverse in both directions of an expression works + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_rb(i, j), m1(rows - 1 - i, cols - 1 - j)); + } + } + + Reverse m1_rv(m1); + // Verify that a Reverse in the vertical directions of an expression works + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_rv(i, j), m1(rows - 1 - i, j)); + } + } + + Reverse m1_rh(m1); + // Verify that a Reverse in the horizontal directions of an expression works + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_rh(i, j), m1(i, cols - 1 - j)); + } + } + + VectorType v1_r = v1.reverse(); + // Verify that a VectorType::reverse() of an expression works + for ( int i = 0; i < rows; i++ ) { + VERIFY_IS_APPROX(v1_r(i), v1(rows - 1 - i)); + } + + MatrixType m1_cr = m1.colwise().reverse(); + // Verify that PartialRedux::reverse() works (for colwise()) + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_cr(i, j), m1(rows - 1 - i, j)); + } + } + + MatrixType m1_rr = m1.rowwise().reverse(); + // Verify that PartialRedux::reverse() works (for rowwise()) + for ( int i = 0; i < rows; i++ ) { + for ( int j = 0; j < cols; j++ ) { + VERIFY_IS_APPROX(m1_rr(i, j), m1(i, cols - 1 - j)); + } + } + + Scalar x = internal::random(); + + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + + m1.reverse()(r, c) = x; + VERIFY_IS_APPROX(x, m1(rows - 1 - r, cols - 1 - c)); + + m2 = m1; + m2.reverseInPlace(); + VERIFY_IS_APPROX(m2,m1.reverse().eval()); + + m2 = m1; + m2.col(0).reverseInPlace(); + VERIFY_IS_APPROX(m2.col(0),m1.col(0).reverse().eval()); + + m2 = m1; + m2.row(0).reverseInPlace(); + VERIFY_IS_APPROX(m2.row(0),m1.row(0).reverse().eval()); + + m2 = m1; + m2.rowwise().reverseInPlace(); + VERIFY_IS_APPROX(m2,m1.rowwise().reverse().eval()); + + m2 = m1; + m2.colwise().reverseInPlace(); + VERIFY_IS_APPROX(m2,m1.colwise().reverse().eval()); + + m1.colwise().reverse()(r, c) = x; + VERIFY_IS_APPROX(x, m1(rows - 1 - r, c)); + + m1.rowwise().reverse()(r, c) = x; + VERIFY_IS_APPROX(x, m1(r, cols - 1 - c)); +} + +template +void array_reverse_extra() +{ + Vector4f x; x << 1, 2, 3, 4; + Vector4f y; y << 4, 3, 2, 1; + VERIFY(x.reverse()[1] == 3); + VERIFY(x.reverse() == y); +} + +// Simpler version of reverseInPlace leveraging a bug +// in clang 6/7 with -O2 and AVX or AVX512 enabled. +// This simpler version ensure that the clang bug is not simply hidden +// through mis-inlining of reverseInPlace or other minor changes. +template +EIGEN_DONT_INLINE +void bug1684_job1(MatrixType& m1, MatrixType& m2) +{ + m2 = m1; + m2.col(0).swap(m2.col(3)); + m2.col(1).swap(m2.col(2)); +} + +template +EIGEN_DONT_INLINE +void bug1684_job2(MatrixType& m1, MatrixType& m2) +{ + m2 = m1; // load m1/m2 in AVX registers + m1.col(0) = m2.col(3); // perform 128 bits moves + m1.col(1) = m2.col(2); + m1.col(2) = m2.col(1); + m1.col(3) = m2.col(0); +} + +template +EIGEN_DONT_INLINE +void bug1684_job3(MatrixType& m1, MatrixType& m2) +{ + m2 = m1; + Vector4f tmp; + tmp = m2.col(0); + m2.col(0) = m2.col(3); + m2.col(3) = tmp; + tmp = m2.col(1); + m2.col(1) = m2.col(2); + m2.col(2) = tmp; + +} + +template +void bug1684() +{ + Matrix4f m1 = Matrix4f::Random(); + Matrix4f m2 = Matrix4f::Random(); + bug1684_job1(m1,m2); + VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); + bug1684_job2(m1,m2); + VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); + // This one still fail after our swap's workaround, + // but I expect users not to implement their own swap. + // bug1684_job3(m1,m2); + // VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); +} + +EIGEN_DECLARE_TEST(array_reverse) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( reverse(Matrix()) ); + CALL_SUBTEST_2( reverse(Matrix2f()) ); + CALL_SUBTEST_3( reverse(Matrix4f()) ); + CALL_SUBTEST_4( reverse(Matrix4d()) ); + CALL_SUBTEST_5( reverse(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( reverse(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_7( reverse(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_8( reverse(Matrix()) ); + CALL_SUBTEST_9( reverse(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_3( bug1684<0>() ); + } + CALL_SUBTEST_3( array_reverse_extra<0>() ); +} diff --git a/lib/eigen-3.4.0/test/bandmatrix.cpp b/lib/eigen-3.4.0/test/bandmatrix.cpp new file mode 100644 index 0000000..66a1b0d --- /dev/null +++ b/lib/eigen-3.4.0/test/bandmatrix.cpp @@ -0,0 +1,71 @@ +// This file is triangularView of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void bandmatrix(const MatrixType& _m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix DenseMatrixType; + + Index rows = _m.rows(); + Index cols = _m.cols(); + Index supers = _m.supers(); + Index subs = _m.subs(); + + MatrixType m(rows,cols,supers,subs); + + DenseMatrixType dm1(rows,cols); + dm1.setZero(); + + m.diagonal().setConstant(123); + dm1.diagonal().setConstant(123); + for (int i=1; i<=m.supers();++i) + { + m.diagonal(i).setConstant(static_cast(i)); + dm1.diagonal(i).setConstant(static_cast(i)); + } + for (int i=1; i<=m.subs();++i) + { + m.diagonal(-i).setConstant(-static_cast(i)); + dm1.diagonal(-i).setConstant(-static_cast(i)); + } + //std::cerr << m.m_data << "\n\n" << m.toDense() << "\n\n" << dm1 << "\n\n\n\n"; + VERIFY_IS_APPROX(dm1,m.toDenseMatrix()); + + for (int i=0; i(i+1)); + dm1.col(i).setConstant(static_cast(i+1)); + } + Index d = (std::min)(rows,cols); + Index a = std::max(0,cols-d-supers); + Index b = std::max(0,rows-d-subs); + if(a>0) dm1.block(0,d+supers,rows,a).setZero(); + dm1.block(0,supers+1,cols-supers-1-a,cols-supers-1-a).template triangularView().setZero(); + dm1.block(subs+1,0,rows-subs-1-b,rows-subs-1-b).template triangularView().setZero(); + if(b>0) dm1.block(d+subs,0,b,cols).setZero(); + //std::cerr << m.m_data << "\n\n" << m.toDense() << "\n\n" << dm1 << "\n\n"; + VERIFY_IS_APPROX(dm1,m.toDenseMatrix()); + +} + +using Eigen::internal::BandMatrix; + +EIGEN_DECLARE_TEST(bandmatrix) +{ + for(int i = 0; i < 10*g_repeat ; i++) { + Index rows = internal::random(1,10); + Index cols = internal::random(1,10); + Index sups = internal::random(0,cols-1); + Index subs = internal::random(0,rows-1); + CALL_SUBTEST(bandmatrix(BandMatrix(rows,cols,sups,subs)) ); + } +} diff --git a/lib/eigen-3.4.0/test/basicstuff.cpp b/lib/eigen-3.4.0/test/basicstuff.cpp new file mode 100644 index 0000000..4ca607c --- /dev/null +++ b/lib/eigen-3.4.0/test/basicstuff.cpp @@ -0,0 +1,356 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT + +#include "main.h" +#include "random_without_cast_overflow.h" + +template void basicStuff(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + typedef Matrix SquareMatrixType; + + Index rows = m.rows(); + Index cols = m.cols(); + + // this test relies a lot on Random.h, and there's not much more that we can do + // to test it, hence I consider that we will have tested Random.h + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols), + mzero = MatrixType::Zero(rows, cols), + square = Matrix::Random(rows, rows); + VectorType v1 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); + SquareMatrixType sm1 = SquareMatrixType::Random(rows,rows), sm2(rows,rows); + + Scalar x = 0; + while(x == Scalar(0)) x = internal::random(); + + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + + m1.coeffRef(r,c) = x; + VERIFY_IS_APPROX(x, m1.coeff(r,c)); + m1(r,c) = x; + VERIFY_IS_APPROX(x, m1(r,c)); + v1.coeffRef(r) = x; + VERIFY_IS_APPROX(x, v1.coeff(r)); + v1(r) = x; + VERIFY_IS_APPROX(x, v1(r)); + v1[r] = x; + VERIFY_IS_APPROX(x, v1[r]); + + // test fetching with various index types. + Index r1 = internal::random(0, numext::mini(Index(127),rows-1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); +#if EIGEN_HAS_CXX11 + x = v1(static_cast(r1)); + x = v1(static_cast(r1)); +#endif + + VERIFY_IS_APPROX( v1, v1); + VERIFY_IS_NOT_APPROX( v1, 2*v1); + VERIFY_IS_MUCH_SMALLER_THAN( vzero, v1); + VERIFY_IS_MUCH_SMALLER_THAN( vzero, v1.squaredNorm()); + VERIFY_IS_NOT_MUCH_SMALLER_THAN(v1, v1); + VERIFY_IS_APPROX( vzero, v1-v1); + VERIFY_IS_APPROX( m1, m1); + VERIFY_IS_NOT_APPROX( m1, 2*m1); + VERIFY_IS_MUCH_SMALLER_THAN( mzero, m1); + VERIFY_IS_NOT_MUCH_SMALLER_THAN(m1, m1); + VERIFY_IS_APPROX( mzero, m1-m1); + + // always test operator() on each read-only expression class, + // in order to check const-qualifiers. + // indeed, if an expression class (here Zero) is meant to be read-only, + // hence has no _write() method, the corresponding MatrixBase method (here zero()) + // should return a const-qualified object so that it is the const-qualified + // operator() that gets called, which in turn calls _read(). + VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows,cols)(r,c), static_cast(1)); + + // now test copying a row-vector into a (column-)vector and conversely. + square.col(r) = square.row(r).eval(); + Matrix rv(rows); + Matrix cv(rows); + rv = square.row(r); + cv = square.col(r); + + VERIFY_IS_APPROX(rv, cv.transpose()); + + if(cols!=1 && rows!=1 && MatrixType::SizeAtCompileTime!=Dynamic) + { + VERIFY_RAISES_ASSERT(m1 = (m2.block(0,0, rows-1, cols-1))); + } + + if(cols!=1 && rows!=1) + { + VERIFY_RAISES_ASSERT(m1[0]); + VERIFY_RAISES_ASSERT((m1+m1)[0]); + } + + VERIFY_IS_APPROX(m3 = m1,m1); + MatrixType m4; + VERIFY_IS_APPROX(m4 = m1,m1); + + m3.real() = m1.real(); + VERIFY_IS_APPROX(static_cast(m3).real(), static_cast(m1).real()); + VERIFY_IS_APPROX(static_cast(m3).real(), m1.real()); + + // check == / != operators + VERIFY(m1==m1); + VERIFY(m1!=m2); + VERIFY(!(m1==m2)); + VERIFY(!(m1!=m1)); + m1 = m2; + VERIFY(m1==m2); + VERIFY(!(m1!=m2)); + + // check automatic transposition + sm2.setZero(); + for(Index i=0;i(0,10)>5; + m3 = b ? m1 : m2; + if(b) VERIFY_IS_APPROX(m3,m1); + else VERIFY_IS_APPROX(m3,m2); + m3 = b ? -m1 : m2; + if(b) VERIFY_IS_APPROX(m3,-m1); + else VERIFY_IS_APPROX(m3,m2); + m3 = b ? m1 : -m2; + if(b) VERIFY_IS_APPROX(m3,m1); + else VERIFY_IS_APPROX(m3,-m2); + } +} + +template void basicStuffComplex(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix RealMatrixType; + + Index rows = m.rows(); + Index cols = m.cols(); + + Scalar s1 = internal::random(), + s2 = internal::random(); + + VERIFY(numext::real(s1)==numext::real_ref(s1)); + VERIFY(numext::imag(s1)==numext::imag_ref(s1)); + numext::real_ref(s1) = numext::real(s2); + numext::imag_ref(s1) = numext::imag(s2); + VERIFY(internal::isApprox(s1, s2, NumTraits::epsilon())); + // extended precision in Intel FPUs means that s1 == s2 in the line above is not guaranteed. + + RealMatrixType rm1 = RealMatrixType::Random(rows,cols), + rm2 = RealMatrixType::Random(rows,cols); + MatrixType cm(rows,cols); + cm.real() = rm1; + cm.imag() = rm2; + VERIFY_IS_APPROX(static_cast(cm).real(), rm1); + VERIFY_IS_APPROX(static_cast(cm).imag(), rm2); + rm1.setZero(); + rm2.setZero(); + rm1 = cm.real(); + rm2 = cm.imag(); + VERIFY_IS_APPROX(static_cast(cm).real(), rm1); + VERIFY_IS_APPROX(static_cast(cm).imag(), rm2); + cm.real().setZero(); + VERIFY(static_cast(cm).real().isZero()); + VERIFY(!static_cast(cm).imag().isZero()); +} + +template +struct casting_test { + static void run() { + Matrix m; + for (int i=0; i::value(); + } + } + Matrix n = m.template cast(); + for (int i=0; i(m(i, j)))); + } + } + } +}; + +template +struct casting_test_runner { + static void run() { + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test::run(); +#if EIGEN_HAS_CXX11 + casting_test::run(); + casting_test::run(); +#endif + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test::run(); + casting_test >::run(); + casting_test >::run(); + } +}; + +template +struct casting_test_runner::IsComplex)>::type> +{ + static void run() { + // Only a few casts from std::complex are defined. + casting_test::run(); + casting_test::run(); + casting_test >::run(); + casting_test >::run(); + } +}; + +void casting_all() { + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); +#if EIGEN_HAS_CXX11 + casting_test_runner::run(); + casting_test_runner::run(); +#endif + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner::run(); + casting_test_runner >::run(); + casting_test_runner >::run(); +} + +template +void fixedSizeMatrixConstruction() +{ + Scalar raw[4]; + for(int k=0; k<4; ++k) + raw[k] = internal::random(); + + { + Matrix m(raw); + Array a(raw); + for(int k=0; k<4; ++k) VERIFY(m(k) == raw[k]); + for(int k=0; k<4; ++k) VERIFY(a(k) == raw[k]); + VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1],raw[2],raw[3]))); + VERIFY((a==(Array(raw[0],raw[1],raw[2],raw[3]))).all()); + } + { + Matrix m(raw); + Array a(raw); + for(int k=0; k<3; ++k) VERIFY(m(k) == raw[k]); + for(int k=0; k<3; ++k) VERIFY(a(k) == raw[k]); + VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1],raw[2]))); + VERIFY((a==Array(raw[0],raw[1],raw[2])).all()); + } + { + Matrix m(raw), m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); + Array a(raw), a2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); + for(int k=0; k<2; ++k) VERIFY(m(k) == raw[k]); + for(int k=0; k<2; ++k) VERIFY(a(k) == raw[k]); + VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1]))); + VERIFY((a==Array(raw[0],raw[1])).all()); + for(int k=0; k<2; ++k) VERIFY(m2(k) == DenseIndex(raw[k])); + for(int k=0; k<2; ++k) VERIFY(a2(k) == DenseIndex(raw[k])); + } + { + Matrix m(raw), + m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ), + m3( (int(raw[0])), (int(raw[1])) ), + m4( (float(raw[0])), (float(raw[1])) ); + Array a(raw), a2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); + for(int k=0; k<2; ++k) VERIFY(m(k) == raw[k]); + for(int k=0; k<2; ++k) VERIFY(a(k) == raw[k]); + VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1]))); + VERIFY((a==Array(raw[0],raw[1])).all()); + for(int k=0; k<2; ++k) VERIFY(m2(k) == DenseIndex(raw[k])); + for(int k=0; k<2; ++k) VERIFY(a2(k) == DenseIndex(raw[k])); + for(int k=0; k<2; ++k) VERIFY(m3(k) == int(raw[k])); + for(int k=0; k<2; ++k) VERIFY((m4(k)) == Scalar(float(raw[k]))); + } + { + Matrix m(raw), m1(raw[0]), m2( (DenseIndex(raw[0])) ), m3( (int(raw[0])) ); + Array a(raw), a1(raw[0]), a2( (DenseIndex(raw[0])) ); + VERIFY(m(0) == raw[0]); + VERIFY(a(0) == raw[0]); + VERIFY(m1(0) == raw[0]); + VERIFY(a1(0) == raw[0]); + VERIFY(m2(0) == DenseIndex(raw[0])); + VERIFY(a2(0) == DenseIndex(raw[0])); + VERIFY(m3(0) == int(raw[0])); + VERIFY_IS_EQUAL(m,(Matrix(raw[0]))); + VERIFY((a==Array(raw[0])).all()); + } +} + +EIGEN_DECLARE_TEST(basicstuff) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( basicStuff(Matrix()) ); + CALL_SUBTEST_2( basicStuff(Matrix4d()) ); + CALL_SUBTEST_3( basicStuff(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_4( basicStuff(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_5( basicStuff(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( basicStuff(Matrix()) ); + CALL_SUBTEST_7( basicStuff(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_8( casting_all() ); + + CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); +} diff --git a/lib/eigen-3.4.0/test/bdcsvd.cpp b/lib/eigen-3.4.0/test/bdcsvd.cpp new file mode 100644 index 0000000..e92a7dc --- /dev/null +++ b/lib/eigen-3.4.0/test/bdcsvd.cpp @@ -0,0 +1,118 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2013 Gauthier Brun +// Copyright (C) 2013 Nicolas Carre +// Copyright (C) 2013 Jean Ceccato +// Copyright (C) 2013 Pierre Zoppitelli +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/ + +// discard stack allocation as that too bypasses malloc +#define EIGEN_STACK_ALLOCATION_LIMIT 0 +#define EIGEN_RUNTIME_NO_MALLOC + +#include "main.h" +#include +#include +#include + + +#define SVD_DEFAULT(M) BDCSVD +#define SVD_FOR_MIN_NORM(M) BDCSVD +#include "svd_common.h" + +// Check all variants of JacobiSVD +template +void bdcsvd(const MatrixType& a = MatrixType(), bool pickrandom = true) +{ + MatrixType m; + if(pickrandom) { + m.resizeLike(a); + svd_fill_random(m); + } + else + m = a; + + CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); +} + +template +void bdcsvd_method() +{ + enum { Size = MatrixType::RowsAtCompileTime }; + typedef typename MatrixType::RealScalar RealScalar; + typedef Matrix RealVecType; + MatrixType m = MatrixType::Identity(); + VERIFY_IS_APPROX(m.bdcSvd().singularValues(), RealVecType::Ones()); + VERIFY_RAISES_ASSERT(m.bdcSvd().matrixU()); + VERIFY_RAISES_ASSERT(m.bdcSvd().matrixV()); + VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).solve(m), m); + VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); + VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); +} + +// compare the Singular values returned with Jacobi and Bdc +template +void compare_bdc_jacobi(const MatrixType& a = MatrixType(), unsigned int computationOptions = 0) +{ + MatrixType m = MatrixType::Random(a.rows(), a.cols()); + BDCSVD bdc_svd(m); + JacobiSVD jacobi_svd(m); + VERIFY_IS_APPROX(bdc_svd.singularValues(), jacobi_svd.singularValues()); + if(computationOptions & ComputeFullU) VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); + if(computationOptions & ComputeThinU) VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); + if(computationOptions & ComputeFullV) VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); + if(computationOptions & ComputeThinV) VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); +} + +EIGEN_DECLARE_TEST(bdcsvd) +{ + CALL_SUBTEST_3(( svd_verify_assert >(Matrix3f()) )); + CALL_SUBTEST_4(( svd_verify_assert >(Matrix4d()) )); + CALL_SUBTEST_7(( svd_verify_assert >(MatrixXf(10,12)) )); + CALL_SUBTEST_8(( svd_verify_assert >(MatrixXcd(7,5)) )); + + CALL_SUBTEST_101(( svd_all_trivial_2x2(bdcsvd) )); + CALL_SUBTEST_102(( svd_all_trivial_2x2(bdcsvd) )); + + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_3(( bdcsvd() )); + CALL_SUBTEST_4(( bdcsvd() )); + CALL_SUBTEST_5(( bdcsvd >() )); + + int r = internal::random(1, EIGEN_TEST_MAX_SIZE/2), + c = internal::random(1, EIGEN_TEST_MAX_SIZE/2); + + TEST_SET_BUT_UNUSED_VARIABLE(r) + TEST_SET_BUT_UNUSED_VARIABLE(c) + + CALL_SUBTEST_6(( bdcsvd(Matrix(r,2)) )); + CALL_SUBTEST_7(( bdcsvd(MatrixXf(r,c)) )); + CALL_SUBTEST_7(( compare_bdc_jacobi(MatrixXf(r,c)) )); + CALL_SUBTEST_10(( bdcsvd(MatrixXd(r,c)) )); + CALL_SUBTEST_10(( compare_bdc_jacobi(MatrixXd(r,c)) )); + CALL_SUBTEST_8(( bdcsvd(MatrixXcd(r,c)) )); + CALL_SUBTEST_8(( compare_bdc_jacobi(MatrixXcd(r,c)) )); + + // Test on inf/nan matrix + CALL_SUBTEST_7( (svd_inf_nan, MatrixXf>()) ); + CALL_SUBTEST_10( (svd_inf_nan, MatrixXd>()) ); + } + + // test matrixbase method + CALL_SUBTEST_1(( bdcsvd_method() )); + CALL_SUBTEST_3(( bdcsvd_method() )); + + // Test problem size constructors + CALL_SUBTEST_7( BDCSVD(10,10) ); + + // Check that preallocation avoids subsequent mallocs + // Disabled because not supported by BDCSVD + // CALL_SUBTEST_9( svd_preallocate() ); + + CALL_SUBTEST_2( svd_underoverflow() ); +} + diff --git a/lib/eigen-3.4.0/test/bfloat16_float.cpp b/lib/eigen-3.4.0/test/bfloat16_float.cpp new file mode 100644 index 0000000..c3de0b1 --- /dev/null +++ b/lib/eigen-3.4.0/test/bfloat16_float.cpp @@ -0,0 +1,378 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include +#include + +#include "main.h" + +#include + +#define VERIFY_BFLOAT16_BITS_EQUAL(h, bits) \ + VERIFY_IS_EQUAL((numext::bit_cast(h)), (static_cast(bits))) + +// Make sure it's possible to forward declare Eigen::bfloat16 +namespace Eigen { +struct bfloat16; +} + +using Eigen::bfloat16; + +float BinaryToFloat(uint32_t sign, uint32_t exponent, uint32_t high_mantissa, + uint32_t low_mantissa) { + float dest; + uint32_t src = (sign << 31) + (exponent << 23) + (high_mantissa << 16) + low_mantissa; + memcpy(static_cast(&dest), + static_cast(&src), sizeof(dest)); + return dest; +} + +template + void test_roundtrip() { + // Representable T round trip via bfloat16 + VERIFY_IS_EQUAL((internal::cast(internal::cast(-std::numeric_limits::infinity()))), -std::numeric_limits::infinity()); + VERIFY_IS_EQUAL((internal::cast(internal::cast(std::numeric_limits::infinity()))), std::numeric_limits::infinity()); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-1.0)))), T(-1.0)); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-0.5)))), T(-0.5)); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-0.0)))), T(-0.0)); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(1.0)))), T(1.0)); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(0.5)))), T(0.5)); + VERIFY_IS_EQUAL((internal::cast(internal::cast(T(0.0)))), T(0.0)); +} + +void test_conversion() +{ + using Eigen::bfloat16_impl::__bfloat16_raw; + + // Round-trip casts + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(bfloat16(1.0f))), + bfloat16(1.0f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(bfloat16(0.5f))), + bfloat16(0.5f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(bfloat16(-0.33333f))), + bfloat16(-0.33333f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(bfloat16(0.0f))), + bfloat16(0.0f)); + + // Conversion from float. + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(1.0f), 0x3f80); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f), 0x3f00); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.33333f), 0x3eab); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3.38e38f), 0x7f7e); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3.40e38f), 0x7f80); // Becomes infinity. + + // Verify round-to-nearest-even behavior. + float val1 = static_cast(bfloat16(__bfloat16_raw(0x3c00))); + float val2 = static_cast(bfloat16(__bfloat16_raw(0x3c01))); + float val3 = static_cast(bfloat16(__bfloat16_raw(0x3c02))); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f * (val1 + val2)), 0x3c00); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f * (val2 + val3)), 0x3c02); + + // Conversion from int. + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(-1), 0xbf80); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0), 0x0000); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(1), 0x3f80); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(2), 0x4000); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3), 0x4040); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(12), 0x4140); + + // Conversion from bool. + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(false), 0x0000); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(true), 0x3f80); + + // Conversion to bool + VERIFY_IS_EQUAL(static_cast(bfloat16(3)), true); + VERIFY_IS_EQUAL(static_cast(bfloat16(0.33333f)), true); + VERIFY_IS_EQUAL(bfloat16(-0.0), false); + VERIFY_IS_EQUAL(static_cast(bfloat16(0.0)), false); + + // Explicit conversion to float. + VERIFY_IS_EQUAL(static_cast(bfloat16(__bfloat16_raw(0x0000))), 0.0f); + VERIFY_IS_EQUAL(static_cast(bfloat16(__bfloat16_raw(0x3f80))), 1.0f); + + // Implicit conversion to float + VERIFY_IS_EQUAL(bfloat16(__bfloat16_raw(0x0000)), 0.0f); + VERIFY_IS_EQUAL(bfloat16(__bfloat16_raw(0x3f80)), 1.0f); + + // Zero representations + VERIFY_IS_EQUAL(bfloat16(0.0f), bfloat16(0.0f)); + VERIFY_IS_EQUAL(bfloat16(-0.0f), bfloat16(0.0f)); + VERIFY_IS_EQUAL(bfloat16(-0.0f), bfloat16(-0.0f)); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.0f), 0x0000); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(-0.0f), 0x8000); + + // Default is zero + VERIFY_IS_EQUAL(static_cast(bfloat16()), 0.0f); + + // Representable floats round trip via bfloat16 + test_roundtrip(); + test_roundtrip(); + test_roundtrip >(); + test_roundtrip >(); + + // Conversion + Array a; + for (int i = 0; i < 100; i++) a(i) = i + 1.25; + Array b = a.cast(); + Array c = b.cast(); + for (int i = 0; i < 100; ++i) { + VERIFY_LE(numext::abs(c(i) - a(i)), a(i) / 128); + } + + // Epsilon + VERIFY_LE(1.0f, static_cast((std::numeric_limits::epsilon)() + bfloat16(1.0f))); + VERIFY_IS_EQUAL(1.0f, static_cast((std::numeric_limits::epsilon)() / bfloat16(2.0f) + bfloat16(1.0f))); + + // Negate + VERIFY_IS_EQUAL(static_cast(-bfloat16(3.0f)), -3.0f); + VERIFY_IS_EQUAL(static_cast(-bfloat16(-4.5f)), 4.5f); + + +#if !EIGEN_COMP_MSVC + // Visual Studio errors out on divisions by 0 + VERIFY((numext::isnan)(static_cast(bfloat16(0.0 / 0.0)))); + VERIFY((numext::isinf)(static_cast(bfloat16(1.0 / 0.0)))); + VERIFY((numext::isinf)(static_cast(bfloat16(-1.0 / 0.0)))); + + // Visual Studio errors out on divisions by 0 + VERIFY((numext::isnan)(bfloat16(0.0 / 0.0))); + VERIFY((numext::isinf)(bfloat16(1.0 / 0.0))); + VERIFY((numext::isinf)(bfloat16(-1.0 / 0.0))); +#endif + + // NaNs and infinities. + VERIFY(!(numext::isinf)(static_cast(bfloat16(3.38e38f)))); // Largest finite number. + VERIFY(!(numext::isnan)(static_cast(bfloat16(0.0f)))); + VERIFY((numext::isinf)(static_cast(bfloat16(__bfloat16_raw(0xff80))))); + VERIFY((numext::isnan)(static_cast(bfloat16(__bfloat16_raw(0xffc0))))); + VERIFY((numext::isinf)(static_cast(bfloat16(__bfloat16_raw(0x7f80))))); + VERIFY((numext::isnan)(static_cast(bfloat16(__bfloat16_raw(0x7fc0))))); + + // Exactly same checks as above, just directly on the bfloat16 representation. + VERIFY(!(numext::isinf)(bfloat16(__bfloat16_raw(0x7bff)))); + VERIFY(!(numext::isnan)(bfloat16(__bfloat16_raw(0x0000)))); + VERIFY((numext::isinf)(bfloat16(__bfloat16_raw(0xff80)))); + VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0xffc0)))); + VERIFY((numext::isinf)(bfloat16(__bfloat16_raw(0x7f80)))); + VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0x7fc0)))); + + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(BinaryToFloat(0x0, 0xff, 0x40, 0x0)), 0x7fc0); + VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(BinaryToFloat(0x1, 0xff, 0x40, 0x0)), 0xffc0); +} + +void test_numtraits() +{ + std::cout << "epsilon = " << NumTraits::epsilon() << " (0x" << std::hex << numext::bit_cast(NumTraits::epsilon()) << ")" << std::endl; + std::cout << "highest = " << NumTraits::highest() << " (0x" << std::hex << numext::bit_cast(NumTraits::highest()) << ")" << std::endl; + std::cout << "lowest = " << NumTraits::lowest() << " (0x" << std::hex << numext::bit_cast(NumTraits::lowest()) << ")" << std::endl; + std::cout << "min = " << (std::numeric_limits::min)() << " (0x" << std::hex << numext::bit_cast((std::numeric_limits::min)()) << ")" << std::endl; + std::cout << "denorm min = " << (std::numeric_limits::denorm_min)() << " (0x" << std::hex << numext::bit_cast((std::numeric_limits::denorm_min)()) << ")" << std::endl; + std::cout << "infinity = " << NumTraits::infinity() << " (0x" << std::hex << numext::bit_cast(NumTraits::infinity()) << ")" << std::endl; + std::cout << "quiet nan = " << NumTraits::quiet_NaN() << " (0x" << std::hex << numext::bit_cast(NumTraits::quiet_NaN()) << ")" << std::endl; + std::cout << "signaling nan = " << std::numeric_limits::signaling_NaN() << " (0x" << std::hex << numext::bit_cast(std::numeric_limits::signaling_NaN()) << ")" << std::endl; + + VERIFY(NumTraits::IsSigned); + + VERIFY_IS_EQUAL( + numext::bit_cast(std::numeric_limits::infinity()), + numext::bit_cast(bfloat16(std::numeric_limits::infinity())) ); + // There is no guarantee that casting a 32-bit NaN to bfloat16 has a precise + // bit pattern. We test that it is in fact a NaN, then test the signaling + // bit (msb of significand is 1 for quiet, 0 for signaling). + const numext::uint16_t BFLOAT16_QUIET_BIT = 0x0040; + VERIFY( + (numext::isnan)(std::numeric_limits::quiet_NaN()) + && (numext::isnan)(bfloat16(std::numeric_limits::quiet_NaN())) + && ((numext::bit_cast(std::numeric_limits::quiet_NaN()) & BFLOAT16_QUIET_BIT) > 0) + && ((numext::bit_cast(bfloat16(std::numeric_limits::quiet_NaN())) & BFLOAT16_QUIET_BIT) > 0) ); + // After a cast to bfloat16, a signaling NaN may become non-signaling. Thus, + // we check that both are NaN, and that only the `numeric_limits` version is + // signaling. + VERIFY( + (numext::isnan)(std::numeric_limits::signaling_NaN()) + && (numext::isnan)(bfloat16(std::numeric_limits::signaling_NaN())) + && ((numext::bit_cast(std::numeric_limits::signaling_NaN()) & BFLOAT16_QUIET_BIT) == 0) ); + + VERIFY( (std::numeric_limits::min)() > bfloat16(0.f) ); + VERIFY( (std::numeric_limits::denorm_min)() > bfloat16(0.f) ); + VERIFY_IS_EQUAL( (std::numeric_limits::denorm_min)()/bfloat16(2), bfloat16(0.f) ); +} + +void test_arithmetic() +{ + VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(2)), 4); + VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(-2)), 0); + VERIFY_IS_APPROX(static_cast(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f); + VERIFY_IS_EQUAL(static_cast(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f); + VERIFY_IS_APPROX(static_cast(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f); + VERIFY_IS_EQUAL(static_cast(-bfloat16(4096.0f)), -4096.0f); + VERIFY_IS_EQUAL(static_cast(-bfloat16(-4096.0f)), 4096.0f); +} + +void test_comparison() +{ + VERIFY(bfloat16(1.0f) > bfloat16(0.5f)); + VERIFY(bfloat16(0.5f) < bfloat16(1.0f)); + VERIFY(!(bfloat16(1.0f) < bfloat16(0.5f))); + VERIFY(!(bfloat16(0.5f) > bfloat16(1.0f))); + + VERIFY(!(bfloat16(4.0f) > bfloat16(4.0f))); + VERIFY(!(bfloat16(4.0f) < bfloat16(4.0f))); + + VERIFY(!(bfloat16(0.0f) < bfloat16(-0.0f))); + VERIFY(!(bfloat16(-0.0f) < bfloat16(0.0f))); + VERIFY(!(bfloat16(0.0f) > bfloat16(-0.0f))); + VERIFY(!(bfloat16(-0.0f) > bfloat16(0.0f))); + + VERIFY(bfloat16(0.2f) > bfloat16(-1.0f)); + VERIFY(bfloat16(-1.0f) < bfloat16(0.2f)); + VERIFY(bfloat16(-16.0f) < bfloat16(-15.0f)); + + VERIFY(bfloat16(1.0f) == bfloat16(1.0f)); + VERIFY(bfloat16(1.0f) != bfloat16(2.0f)); + + // Comparisons with NaNs and infinities. +#if !EIGEN_COMP_MSVC + // Visual Studio errors out on divisions by 0 + VERIFY(!(bfloat16(0.0 / 0.0) == bfloat16(0.0 / 0.0))); + VERIFY(bfloat16(0.0 / 0.0) != bfloat16(0.0 / 0.0)); + + VERIFY(!(bfloat16(1.0) == bfloat16(0.0 / 0.0))); + VERIFY(!(bfloat16(1.0) < bfloat16(0.0 / 0.0))); + VERIFY(!(bfloat16(1.0) > bfloat16(0.0 / 0.0))); + VERIFY(bfloat16(1.0) != bfloat16(0.0 / 0.0)); + + VERIFY(bfloat16(1.0) < bfloat16(1.0 / 0.0)); + VERIFY(bfloat16(1.0) > bfloat16(-1.0 / 0.0)); +#endif +} + +void test_basic_functions() +{ + VERIFY_IS_EQUAL(static_cast(numext::abs(bfloat16(3.5f))), 3.5f); + VERIFY_IS_EQUAL(static_cast(abs(bfloat16(3.5f))), 3.5f); + VERIFY_IS_EQUAL(static_cast(numext::abs(bfloat16(-3.5f))), 3.5f); + VERIFY_IS_EQUAL(static_cast(abs(bfloat16(-3.5f))), 3.5f); + + VERIFY_IS_EQUAL(static_cast(numext::floor(bfloat16(3.5f))), 3.0f); + VERIFY_IS_EQUAL(static_cast(floor(bfloat16(3.5f))), 3.0f); + VERIFY_IS_EQUAL(static_cast(numext::floor(bfloat16(-3.5f))), -4.0f); + VERIFY_IS_EQUAL(static_cast(floor(bfloat16(-3.5f))), -4.0f); + + VERIFY_IS_EQUAL(static_cast(numext::ceil(bfloat16(3.5f))), 4.0f); + VERIFY_IS_EQUAL(static_cast(ceil(bfloat16(3.5f))), 4.0f); + VERIFY_IS_EQUAL(static_cast(numext::ceil(bfloat16(-3.5f))), -3.0f); + VERIFY_IS_EQUAL(static_cast(ceil(bfloat16(-3.5f))), -3.0f); + + VERIFY_IS_APPROX(static_cast(numext::sqrt(bfloat16(0.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(sqrt(bfloat16(0.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(numext::sqrt(bfloat16(4.0f))), 2.0f); + VERIFY_IS_APPROX(static_cast(sqrt(bfloat16(4.0f))), 2.0f); + + VERIFY_IS_APPROX(static_cast(numext::pow(bfloat16(0.0f), bfloat16(1.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(pow(bfloat16(0.0f), bfloat16(1.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(numext::pow(bfloat16(2.0f), bfloat16(2.0f))), 4.0f); + VERIFY_IS_APPROX(static_cast(pow(bfloat16(2.0f), bfloat16(2.0f))), 4.0f); + + VERIFY_IS_EQUAL(static_cast(numext::exp(bfloat16(0.0f))), 1.0f); + VERIFY_IS_EQUAL(static_cast(exp(bfloat16(0.0f))), 1.0f); + VERIFY_IS_APPROX(static_cast(numext::exp(bfloat16(EIGEN_PI))), 20.f + static_cast(EIGEN_PI)); + VERIFY_IS_APPROX(static_cast(exp(bfloat16(EIGEN_PI))), 20.f + static_cast(EIGEN_PI)); + + VERIFY_IS_EQUAL(static_cast(numext::expm1(bfloat16(0.0f))), 0.0f); + VERIFY_IS_EQUAL(static_cast(expm1(bfloat16(0.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(numext::expm1(bfloat16(2.0f))), 6.375f); + VERIFY_IS_APPROX(static_cast(expm1(bfloat16(2.0f))), 6.375f); + + VERIFY_IS_EQUAL(static_cast(numext::log(bfloat16(1.0f))), 0.0f); + VERIFY_IS_EQUAL(static_cast(log(bfloat16(1.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(numext::log(bfloat16(10.0f))), 2.296875f); + VERIFY_IS_APPROX(static_cast(log(bfloat16(10.0f))), 2.296875f); + + VERIFY_IS_EQUAL(static_cast(numext::log1p(bfloat16(0.0f))), 0.0f); + VERIFY_IS_EQUAL(static_cast(log1p(bfloat16(0.0f))), 0.0f); + VERIFY_IS_APPROX(static_cast(numext::log1p(bfloat16(10.0f))), 2.390625f); + VERIFY_IS_APPROX(static_cast(log1p(bfloat16(10.0f))), 2.390625f); +} + +void test_trigonometric_functions() +{ + VERIFY_IS_APPROX(numext::cos(bfloat16(0.0f)), bfloat16(cosf(0.0f))); + VERIFY_IS_APPROX(cos(bfloat16(0.0f)), bfloat16(cosf(0.0f))); + VERIFY_IS_APPROX(numext::cos(bfloat16(EIGEN_PI)), bfloat16(cosf(EIGEN_PI))); + // VERIFY_IS_APPROX(numext::cos(bfloat16(EIGEN_PI/2)), bfloat16(cosf(EIGEN_PI/2))); + // VERIFY_IS_APPROX(numext::cos(bfloat16(3*EIGEN_PI/2)), bfloat16(cosf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::cos(bfloat16(3.5f)), bfloat16(cosf(3.5f))); + + VERIFY_IS_APPROX(numext::sin(bfloat16(0.0f)), bfloat16(sinf(0.0f))); + VERIFY_IS_APPROX(sin(bfloat16(0.0f)), bfloat16(sinf(0.0f))); + // VERIFY_IS_APPROX(numext::sin(bfloat16(EIGEN_PI)), bfloat16(sinf(EIGEN_PI))); + VERIFY_IS_APPROX(numext::sin(bfloat16(EIGEN_PI/2)), bfloat16(sinf(EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::sin(bfloat16(3*EIGEN_PI/2)), bfloat16(sinf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::sin(bfloat16(3.5f)), bfloat16(sinf(3.5f))); + + VERIFY_IS_APPROX(numext::tan(bfloat16(0.0f)), bfloat16(tanf(0.0f))); + VERIFY_IS_APPROX(tan(bfloat16(0.0f)), bfloat16(tanf(0.0f))); + // VERIFY_IS_APPROX(numext::tan(bfloat16(EIGEN_PI)), bfloat16(tanf(EIGEN_PI))); + // VERIFY_IS_APPROX(numext::tan(bfloat16(EIGEN_PI/2)), bfloat16(tanf(EIGEN_PI/2))); + // VERIFY_IS_APPROX(numext::tan(bfloat16(3*EIGEN_PI/2)), bfloat16(tanf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::tan(bfloat16(3.5f)), bfloat16(tanf(3.5f))); +} + +void test_array() +{ + typedef Array ArrayXh; + Index size = internal::random(1,10); + Index i = internal::random(0,size-1); + ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); + VERIFY_IS_APPROX( a1+a1, bfloat16(2)*a1 ); + VERIFY( (a1.abs() >= bfloat16(0)).all() ); + VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); + + VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); + a1(i) = bfloat16(-10.); + VERIFY_IS_EQUAL( a1.minCoeff(), bfloat16(-10.) ); + a1(i) = bfloat16(10.); + VERIFY_IS_EQUAL( a1.maxCoeff(), bfloat16(10.) ); + + std::stringstream ss; + ss << a1; +} + +void test_product() +{ + typedef Matrix MatrixXh; + Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); + Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); + Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); + MatrixXh Ah = MatrixXh::Random(rows,depth); + MatrixXh Bh = MatrixXh::Random(depth,cols); + MatrixXh Ch = MatrixXh::Random(rows,cols); + MatrixXf Af = Ah.cast(); + MatrixXf Bf = Bh.cast(); + MatrixXf Cf = Ch.cast(); + VERIFY_IS_APPROX(Ch.noalias()+=Ah*Bh, (Cf.noalias()+=Af*Bf).cast()); +} + +EIGEN_DECLARE_TEST(bfloat16_float) +{ + CALL_SUBTEST(test_numtraits()); + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST(test_conversion()); + CALL_SUBTEST(test_arithmetic()); + CALL_SUBTEST(test_comparison()); + CALL_SUBTEST(test_basic_functions()); + CALL_SUBTEST(test_trigonometric_functions()); + CALL_SUBTEST(test_array()); + CALL_SUBTEST(test_product()); + } +} diff --git a/lib/eigen-3.4.0/test/bicgstab.cpp b/lib/eigen-3.4.0/test/bicgstab.cpp new file mode 100644 index 0000000..59c4b50 --- /dev/null +++ b/lib/eigen-3.4.0/test/bicgstab.cpp @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "sparse_solver.h" +#include + +template void test_bicgstab_T() +{ + BiCGSTAB, DiagonalPreconditioner > bicgstab_colmajor_diag; + BiCGSTAB, IdentityPreconditioner > bicgstab_colmajor_I; + BiCGSTAB, IncompleteLUT > bicgstab_colmajor_ilut; + //BiCGSTAB, SSORPreconditioner > bicgstab_colmajor_ssor; + + bicgstab_colmajor_diag.setTolerance(NumTraits::epsilon()*4); + bicgstab_colmajor_ilut.setTolerance(NumTraits::epsilon()*4); + + CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_diag) ); +// CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_I) ); + CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_ilut) ); + //CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_ssor) ); +} + +EIGEN_DECLARE_TEST(bicgstab) +{ + CALL_SUBTEST_1((test_bicgstab_T()) ); + CALL_SUBTEST_2((test_bicgstab_T, int>())); + CALL_SUBTEST_3((test_bicgstab_T())); +} diff --git a/lib/eigen-3.4.0/test/blasutil.cpp b/lib/eigen-3.4.0/test/blasutil.cpp new file mode 100644 index 0000000..845a498 --- /dev/null +++ b/lib/eigen-3.4.0/test/blasutil.cpp @@ -0,0 +1,210 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2020 Everton Constantino +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/ + +#include "main.h" + +// Disable "ignoring attributes on template argument" +// for packet_traits +// => The only workaround would be to wrap _m128 and the likes +// within wrappers. +#if EIGEN_GNUC_AT_LEAST(6,0) + #pragma GCC diagnostic ignored "-Wignored-attributes" +#endif + +#define GET(i,j) (StorageOrder == RowMajor ? (i)*stride + (j) : (i) + (j)*stride) +#define SCATTER(i,j,k) (StorageOrder == RowMajor ? ((i)+(k))*stride + (j) : (i) + ((j)+(k))*stride) + +template +void compare(const Packet& a, const Packet& b) +{ + int pktsz = internal::packet_traits::size; + Scalar *buffA = new Scalar[pktsz]; + Scalar *buffB = new Scalar[pktsz]; + + internal::pstoreu(buffA, a); + internal::pstoreu(buffB, b); + + for(int i = 0; i < pktsz; i++) + { + VERIFY_IS_EQUAL(buffA[i], buffB[i]); + } + + delete[] buffA; + delete[] buffB; +} + +template +struct PacketBlockSet +{ + typedef typename internal::packet_traits::type Packet; + + void setPacketBlock(internal::PacketBlock& block, Scalar value) + { + for(int idx = 0; idx < n; idx++) + { + block.packet[idx] = internal::pset1(value); + } + } + + void comparePacketBlock(Scalar *data, int i, int j, int stride, internal::PacketBlock& block) + { + for(int idx = 0; idx < n; idx++) + { + Packet line = internal::ploadu(data + SCATTER(i,j,idx)); + compare(block.packet[idx], line); + } + } +}; + +template +void run_bdmp_spec_1() +{ + typedef internal::blas_data_mapper BlasDataMapper; + int packetSize = internal::packet_traits::size; + int minSize = std::max(packetSize, BlockSize); + typedef typename internal::packet_traits::type Packet; + + int szm = internal::random(minSize,500), szn = internal::random(minSize,500); + int stride = StorageOrder == RowMajor ? szn : szm; + Scalar *d = new Scalar[szn*szm]; + + // Initializing with random entries + for(int i = 0; i < szm*szn; i++) + { + d[i] = internal::random(static_cast(3), static_cast(10)); + } + + BlasDataMapper bdm(d, stride); + + // Testing operator() + for(int i = 0; i < szm; i++) + { + for(int j = 0; j < szn; j++) + { + VERIFY_IS_EQUAL(d[GET(i,j)], bdm(i,j)); + } + } + + // Testing getSubMapper and getLinearMapper + int i0 = internal::random(0,szm-2); + int j0 = internal::random(0,szn-2); + for(int i = i0; i < szm; i++) + { + for(int j = j0; j < szn; j++) + { + const BlasDataMapper& bdmSM = bdm.getSubMapper(i0,j0); + const internal::BlasLinearMapper& bdmLM = bdm.getLinearMapper(i0,j0); + + Scalar v = bdmSM(i - i0, j - j0); + Scalar vd = d[GET(i,j)]; + VERIFY_IS_EQUAL(vd, v); + VERIFY_IS_EQUAL(vd, bdmLM(GET(i-i0, j-j0))); + } + } + + // Testing loadPacket + for(int i = 0; i < szm - minSize; i++) + { + for(int j = 0; j < szn - minSize; j++) + { + Packet pktBDM = bdm.template loadPacket(i,j); + Packet pktD = internal::ploadu(d + GET(i,j)); + + compare(pktBDM, pktD); + } + } + + // Testing gatherPacket + Scalar *buff = new Scalar[packetSize]; + for(int i = 0; i < szm - minSize; i++) + { + for(int j = 0; j < szn - minSize; j++) + { + Packet p = bdm.template gatherPacket(i,j); + internal::pstoreu(buff, p); + + for(int k = 0; k < packetSize; k++) + { + VERIFY_IS_EQUAL(d[SCATTER(i,j,k)], buff[k]); + } + + } + } + delete[] buff; + + // Testing scatterPacket + for(int i = 0; i < szm - minSize; i++) + { + for(int j = 0; j < szn - minSize; j++) + { + Packet p = internal::pset1(static_cast(1)); + bdm.template scatterPacket(i,j,p); + for(int k = 0; k < packetSize; k++) + { + VERIFY_IS_EQUAL(d[SCATTER(i,j,k)], static_cast(1)); + } + } + } + + //Testing storePacketBlock + internal::PacketBlock block; + + PacketBlockSet pbs; + pbs.setPacketBlock(block, static_cast(2)); + + for(int i = 0; i < szm - minSize; i++) + { + for(int j = 0; j < szn - minSize; j++) + { + bdm.template storePacketBlock(i, j, block); + + pbs.comparePacketBlock(d, i, j, stride, block); + } + } + + delete[] d; +} + +template +void run_test() +{ + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); + run_bdmp_spec_1(); +} + +EIGEN_DECLARE_TEST(blasutil) +{ + for(int i = 0; i < g_repeat; i++) + { + CALL_SUBTEST_1(run_test()); + CALL_SUBTEST_2(run_test()); + CALL_SUBTEST_3(run_test()); + +// TODO: Replace this by a call to numext::int64_t as soon as we have a way to +// detect the typedef for int64_t on all platforms +#if EIGEN_HAS_CXX11 + CALL_SUBTEST_4(run_test()); +#else + CALL_SUBTEST_4(run_test()); +#endif + + CALL_SUBTEST_5(run_test()); + CALL_SUBTEST_6(run_test()); + CALL_SUBTEST_7(run_test >()); + CALL_SUBTEST_8(run_test >()); + } +} diff --git a/lib/eigen-3.4.0/test/block.cpp b/lib/eigen-3.4.0/test/block.cpp new file mode 100644 index 0000000..84124ab --- /dev/null +++ b/lib/eigen-3.4.0/test/block.cpp @@ -0,0 +1,316 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT // otherwise we fail at compile time on unused paths +#include "main.h" + +template +typename Eigen::internal::enable_if::IsComplex,typename MatrixType::Scalar>::type +block_real_only(const MatrixType &m1, Index r1, Index r2, Index c1, Index c2, const Scalar& s1) { + // check cwise-Functions: + VERIFY_IS_APPROX(m1.row(r1).cwiseMax(s1), m1.cwiseMax(s1).row(r1)); + VERIFY_IS_APPROX(m1.col(c1).cwiseMin(s1), m1.cwiseMin(s1).col(c1)); + + VERIFY_IS_APPROX(m1.block(r1,c1,r2-r1+1,c2-c1+1).cwiseMin(s1), m1.cwiseMin(s1).block(r1,c1,r2-r1+1,c2-c1+1)); + VERIFY_IS_APPROX(m1.block(r1,c1,r2-r1+1,c2-c1+1).cwiseMax(s1), m1.cwiseMax(s1).block(r1,c1,r2-r1+1,c2-c1+1)); + + return Scalar(0); +} + +template +typename Eigen::internal::enable_if::IsComplex,typename MatrixType::Scalar>::type +block_real_only(const MatrixType &, Index, Index, Index, Index, const Scalar&) { + return Scalar(0); +} + +// Check at compile-time that T1==T2, and at runtime-time that a==b +template +typename internal::enable_if::value,bool>::type +is_same_block(const T1& a, const T2& b) +{ + return a.isApprox(b); +} + +template void block(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef Matrix VectorType; + typedef Matrix RowVectorType; + typedef Matrix DynamicMatrixType; + typedef Matrix DynamicVectorType; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m1_copy = m1, + m2 = MatrixType::Random(rows, cols), + m3(rows, cols), + ones = MatrixType::Ones(rows, cols); + VectorType v1 = VectorType::Random(rows); + + Scalar s1 = internal::random(); + + Index r1 = internal::random(0,rows-1); + Index r2 = internal::random(r1,rows-1); + Index c1 = internal::random(0,cols-1); + Index c2 = internal::random(c1,cols-1); + + block_real_only(m1, r1, r2, c1, c1, s1); + + //check row() and col() + VERIFY_IS_EQUAL(m1.col(c1).transpose(), m1.transpose().row(c1)); + //check operator(), both constant and non-constant, on row() and col() + m1 = m1_copy; + m1.row(r1) += s1 * m1_copy.row(r2); + VERIFY_IS_APPROX(m1.row(r1), m1_copy.row(r1) + s1 * m1_copy.row(r2)); + // check nested block xpr on lhs + m1.row(r1).row(0) += s1 * m1_copy.row(r2); + VERIFY_IS_APPROX(m1.row(r1), m1_copy.row(r1) + Scalar(2) * s1 * m1_copy.row(r2)); + m1 = m1_copy; + m1.col(c1) += s1 * m1_copy.col(c2); + VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + s1 * m1_copy.col(c2)); + m1.col(c1).col(0) += s1 * m1_copy.col(c2); + VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + Scalar(2) * s1 * m1_copy.col(c2)); + + + //check block() + Matrix b1(1,1); b1(0,0) = m1(r1,c1); + + RowVectorType br1(m1.block(r1,0,1,cols)); + VectorType bc1(m1.block(0,c1,rows,1)); + VERIFY_IS_EQUAL(b1, m1.block(r1,c1,1,1)); + VERIFY_IS_EQUAL(m1.row(r1), br1); + VERIFY_IS_EQUAL(m1.col(c1), bc1); + //check operator(), both constant and non-constant, on block() + m1.block(r1,c1,r2-r1+1,c2-c1+1) = s1 * m2.block(0, 0, r2-r1+1,c2-c1+1); + m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0); + + const Index BlockRows = 2; + const Index BlockCols = 5; + + if (rows>=5 && cols>=8) + { + // test fixed block() as lvalue + m1.template block(1,1) *= s1; + // test operator() on fixed block() both as constant and non-constant + m1.template block(1,1)(0, 3) = m1.template block<2,5>(1,1)(1,2); + // check that fixed block() and block() agree + Matrix b = m1.template block(3,3); + VERIFY_IS_EQUAL(b, m1.block(3,3,BlockRows,BlockCols)); + + // same tests with mixed fixed/dynamic size + m1.template block(1,1,BlockRows,BlockCols) *= s1; + m1.template block(1,1,BlockRows,BlockCols)(0,3) = m1.template block<2,5>(1,1)(1,2); + Matrix b2 = m1.template block(3,3,2,5); + VERIFY_IS_EQUAL(b2, m1.block(3,3,BlockRows,BlockCols)); + + VERIFY(is_same_block(m1.block(3,3,BlockRows,BlockCols), m1.block(3,3,fix(BlockRows),fix(BlockCols)))); + VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix,BlockCols))); + VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix(),fix))); + VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix,fix(BlockCols)))); + } + + if (rows>2) + { + // test sub vectors + VERIFY_IS_EQUAL(v1.template head<2>(), v1.block(0,0,2,1)); + VERIFY_IS_EQUAL(v1.template head<2>(), v1.head(2)); + VERIFY_IS_EQUAL(v1.template head<2>(), v1.segment(0,2)); + VERIFY_IS_EQUAL(v1.template head<2>(), v1.template segment<2>(0)); + Index i = rows-2; + VERIFY_IS_EQUAL(v1.template tail<2>(), v1.block(i,0,2,1)); + 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 = internal::random(0,rows-2); + VERIFY_IS_EQUAL(v1.segment(i,2), v1.template segment<2>(i)); + } + + // stress some basic stuffs with block matrices + VERIFY(numext::real(ones.col(c1).sum()) == RealScalar(rows)); + VERIFY(numext::real(ones.row(r1).sum()) == RealScalar(cols)); + + VERIFY(numext::real(ones.col(c1).dot(ones.col(c2))) == RealScalar(rows)); + VERIFY(numext::real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols)); + + // check that linear acccessors works on blocks + m1 = m1_copy; + if((MatrixType::Flags&RowMajorBit)==0) + VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1+c1*rows), m1(r1,c1)); + else + VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1+r1*cols), m1(r1,c1)); + + + // now test some block-inside-of-block. + + // expressions with direct access + VERIFY_IS_EQUAL( (m1.block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2)) , (m1.block(r2,c2,rows-r2,cols-c2)) ); + VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , (m1.row(r1).segment(c1,c2-c1+1)) ); + VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).col(0)) , (m1.col(c1).segment(r1,r2-r1+1)) ); + VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0)) , (m1.row(r1).segment(c1,c2-c1+1)).transpose() ); + VERIFY_IS_EQUAL( (m1.transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0)) , (m1.row(r1).segment(c1,c2-c1+1)).transpose() ); + + // expressions without direct access + VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2)) , ((m1+m2).block(r2,c2,rows-r2,cols-c2)) ); + VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)) ); + VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , ((m1+m2).eval().row(r1).segment(c1,c2-c1+1)) ); + VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).col(0)) , ((m1+m2).col(c1).segment(r1,r2-r1+1)) ); + VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)).transpose() ); + VERIFY_IS_APPROX( ((m1+m2).transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)).transpose() ); + VERIFY_IS_APPROX( ((m1+m2).template block(r1,c1,r2-r1+1,1)) , ((m1+m2).eval().col(c1).eval().segment(r1,r2-r1+1)) ); + VERIFY_IS_APPROX( ((m1+m2).template block<1,Dynamic>(r1,c1,1,c2-c1+1)) , ((m1+m2).eval().row(r1).eval().segment(c1,c2-c1+1)) ); + VERIFY_IS_APPROX( ((m1+m2).transpose().template block<1,Dynamic>(c1,r1,1,r2-r1+1)) , ((m1+m2).eval().col(c1).eval().segment(r1,r2-r1+1)).transpose() ); + VERIFY_IS_APPROX( (m1+m2).row(r1).eval(), (m1+m2).eval().row(r1) ); + VERIFY_IS_APPROX( (m1+m2).adjoint().col(r1).eval(), (m1+m2).adjoint().eval().col(r1) ); + VERIFY_IS_APPROX( (m1+m2).adjoint().row(c1).eval(), (m1+m2).adjoint().eval().row(c1) ); + VERIFY_IS_APPROX( (m1*1).row(r1).segment(c1,c2-c1+1).eval(), m1.row(r1).eval().segment(c1,c2-c1+1).eval() ); + VERIFY_IS_APPROX( m1.col(c1).reverse().segment(r1,r2-r1+1).eval(),m1.col(c1).reverse().eval().segment(r1,r2-r1+1).eval() ); + + VERIFY_IS_APPROX( (m1*1).topRows(r1), m1.topRows(r1) ); + VERIFY_IS_APPROX( (m1*1).leftCols(c1), m1.leftCols(c1) ); + VERIFY_IS_APPROX( (m1*1).transpose().topRows(c1), m1.transpose().topRows(c1) ); + VERIFY_IS_APPROX( (m1*1).transpose().leftCols(r1), m1.transpose().leftCols(r1) ); + VERIFY_IS_APPROX( (m1*1).transpose().middleRows(c1,c2-c1+1), m1.transpose().middleRows(c1,c2-c1+1) ); + VERIFY_IS_APPROX( (m1*1).transpose().middleCols(r1,r2-r1+1), m1.transpose().middleCols(r1,r2-r1+1) ); + + // evaluation into plain matrices from expressions with direct access (stress MapBase) + DynamicMatrixType dm; + DynamicVectorType dv; + dm.setZero(); + dm = m1.block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2); + VERIFY_IS_EQUAL(dm, (m1.block(r2,c2,rows-r2,cols-c2))); + dm.setZero(); + dv.setZero(); + dm = m1.block(r1,c1,r2-r1+1,c2-c1+1).row(0).transpose(); + dv = m1.row(r1).segment(c1,c2-c1+1); + VERIFY_IS_EQUAL(dv, dm); + dm.setZero(); + dv.setZero(); + dm = m1.col(c1).segment(r1,r2-r1+1); + dv = m1.block(r1,c1,r2-r1+1,c2-c1+1).col(0); + VERIFY_IS_EQUAL(dv, dm); + dm.setZero(); + dv.setZero(); + dm = m1.block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0); + dv = m1.row(r1).segment(c1,c2-c1+1); + VERIFY_IS_EQUAL(dv, dm); + dm.setZero(); + dv.setZero(); + dm = m1.row(r1).segment(c1,c2-c1+1).transpose(); + dv = m1.transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0); + VERIFY_IS_EQUAL(dv, dm); + + VERIFY_IS_EQUAL( (m1.template block(1,0,0,1)), m1.block(1,0,0,1)); + VERIFY_IS_EQUAL( (m1.template block<1,Dynamic>(0,1,1,0)), m1.block(0,1,1,0)); + VERIFY_IS_EQUAL( ((m1*1).template block(1,0,0,1)), m1.block(1,0,0,1)); + VERIFY_IS_EQUAL( ((m1*1).template block<1,Dynamic>(0,1,1,0)), m1.block(0,1,1,0)); + + if (rows>=2 && cols>=2) + { + VERIFY_RAISES_ASSERT( m1 += m1.col(0) ); + VERIFY_RAISES_ASSERT( m1 -= m1.col(0) ); + VERIFY_RAISES_ASSERT( m1.array() *= m1.col(0).array() ); + VERIFY_RAISES_ASSERT( m1.array() /= m1.col(0).array() ); + } + + VERIFY_IS_EQUAL( m1.template subVector(r1), m1.row(r1) ); + VERIFY_IS_APPROX( (m1+m1).template subVector(r1), (m1+m1).row(r1) ); + VERIFY_IS_EQUAL( m1.template subVector(c1), m1.col(c1) ); + VERIFY_IS_APPROX( (m1+m1).template subVector(c1), (m1+m1).col(c1) ); + VERIFY_IS_EQUAL( m1.template subVectors(), m1.rows() ); + VERIFY_IS_EQUAL( m1.template subVectors(), m1.cols() ); + + if (rows>=2 || cols>=2) { + VERIFY_IS_EQUAL( int(m1.middleCols(0,0).IsRowMajor), int(m1.IsRowMajor) ); + VERIFY_IS_EQUAL( m1.middleCols(0,0).outerSize(), m1.IsRowMajor ? rows : 0); + VERIFY_IS_EQUAL( m1.middleCols(0,0).innerSize(), m1.IsRowMajor ? 0 : rows); + + VERIFY_IS_EQUAL( int(m1.middleRows(0,0).IsRowMajor), int(m1.IsRowMajor) ); + VERIFY_IS_EQUAL( m1.middleRows(0,0).outerSize(), m1.IsRowMajor ? 0 : cols); + VERIFY_IS_EQUAL( m1.middleRows(0,0).innerSize(), m1.IsRowMajor ? cols : 0); + } +} + + +template +void compare_using_data_and_stride(const MatrixType& m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + Index size = m.size(); + Index innerStride = m.innerStride(); + Index outerStride = m.outerStride(); + Index rowStride = m.rowStride(); + Index colStride = m.colStride(); + const typename MatrixType::Scalar* data = m.data(); + + for(int j=0;j +void data_and_stride(const MatrixType& m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + + Index r1 = internal::random(0,rows-1); + Index r2 = internal::random(r1,rows-1); + Index c1 = internal::random(0,cols-1); + Index c2 = internal::random(c1,cols-1); + + MatrixType m1 = MatrixType::Random(rows, cols); + compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1)); + compare_using_data_and_stride(m1.transpose().block(c1, r1, c2-c1+1, r2-r1+1)); + compare_using_data_and_stride(m1.row(r1)); + compare_using_data_and_stride(m1.col(c1)); + compare_using_data_and_stride(m1.row(r1).transpose()); + compare_using_data_and_stride(m1.col(c1).transpose()); +} + +EIGEN_DECLARE_TEST(block) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( block(Matrix()) ); + CALL_SUBTEST_1( block(Matrix(internal::random(2,50))) ); + CALL_SUBTEST_1( block(Matrix(internal::random(2,50))) ); + CALL_SUBTEST_2( block(Matrix4d()) ); + CALL_SUBTEST_3( block(MatrixXcf(internal::random(2,50), internal::random(2,50))) ); + CALL_SUBTEST_4( block(MatrixXi(internal::random(2,50), internal::random(2,50))) ); + CALL_SUBTEST_5( block(MatrixXcd(internal::random(2,50), internal::random(2,50))) ); + CALL_SUBTEST_6( block(MatrixXf(internal::random(2,50), internal::random(2,50))) ); + CALL_SUBTEST_7( block(Matrix(internal::random(2,50), internal::random(2,50))) ); + + CALL_SUBTEST_8( block(Matrix(3, 4)) ); + +#ifndef EIGEN_DEFAULT_TO_ROW_MAJOR + CALL_SUBTEST_6( data_and_stride(MatrixXf(internal::random(5,50), internal::random(5,50))) ); + CALL_SUBTEST_7( data_and_stride(Matrix(internal::random(5,50), internal::random(5,50))) ); +#endif + } +} diff --git a/lib/eigen-3.4.0/test/boostmultiprec.cpp b/lib/eigen-3.4.0/test/boostmultiprec.cpp new file mode 100644 index 0000000..7c79ded --- /dev/null +++ b/lib/eigen-3.4.0/test/boostmultiprec.cpp @@ -0,0 +1,208 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#ifdef EIGEN_TEST_MAX_SIZE +#undef EIGEN_TEST_MAX_SIZE +#endif + +#define EIGEN_TEST_MAX_SIZE 50 + +#ifdef EIGEN_TEST_PART_1 +#include "cholesky.cpp" +#endif + +#ifdef EIGEN_TEST_PART_2 +#include "lu.cpp" +#endif + +#ifdef EIGEN_TEST_PART_3 +#include "qr.cpp" +#endif + +#ifdef EIGEN_TEST_PART_4 +#include "qr_colpivoting.cpp" +#endif + +#ifdef EIGEN_TEST_PART_5 +#include "qr_fullpivoting.cpp" +#endif + +#ifdef EIGEN_TEST_PART_6 +#include "eigensolver_selfadjoint.cpp" +#endif + +#ifdef EIGEN_TEST_PART_7 +#include "eigensolver_generic.cpp" +#endif + +#ifdef EIGEN_TEST_PART_8 +#include "eigensolver_generalized_real.cpp" +#endif + +#ifdef EIGEN_TEST_PART_9 +#include "jacobisvd.cpp" +#endif + +#ifdef EIGEN_TEST_PART_10 +#include "bdcsvd.cpp" +#endif + +#ifdef EIGEN_TEST_PART_11 +#include "simplicial_cholesky.cpp" +#endif + +#include + +#undef min +#undef max +#undef isnan +#undef isinf +#undef isfinite +#undef I + +#include +#include +#include +#include +#include + +namespace mp = boost::multiprecision; +typedef mp::number, mp::et_on> Real; + +namespace Eigen { + template<> struct NumTraits : GenericNumTraits { + static inline Real dummy_precision() { return 1e-50; } + }; + + template + struct NumTraits > : NumTraits {}; + + template<> + Real test_precision() { return 1e-50; } + + // needed in C++93 mode where number does not support explicit cast. + namespace internal { + template + struct cast_impl { + static inline NewType run(const Real& x) { + return x.template convert_to(); + } + }; + + template<> + struct cast_impl > { + static inline std::complex run(const Real& x) { + return std::complex(x); + } + }; + } +} + +namespace boost { +namespace multiprecision { + // to make ADL works as expected: + using boost::math::isfinite; + using boost::math::isnan; + using boost::math::isinf; + using boost::math::copysign; + using boost::math::hypot; + + // The following is needed for std::complex: + Real fabs(const Real& a) { return abs EIGEN_NOT_A_MACRO (a); } + Real fmax(const Real& a, const Real& b) { using std::max; return max(a,b); } + + // some specialization for the unit tests: + inline bool test_isMuchSmallerThan(const Real& a, const Real& b) { + return internal::isMuchSmallerThan(a, b, test_precision()); + } + + inline bool test_isApprox(const Real& a, const Real& b) { + return internal::isApprox(a, b, test_precision()); + } + + inline bool test_isApproxOrLessThan(const Real& a, const Real& b) { + return internal::isApproxOrLessThan(a, b, test_precision()); + } + + Real get_test_precision(const Real&) { + return test_precision(); + } + + Real test_relative_error(const Real &a, const Real &b) { + using Eigen::numext::abs2; + return sqrt(abs2(a-b)/Eigen::numext::mini(abs2(a),abs2(b))); + } +} +} + +namespace Eigen { + +} + +EIGEN_DECLARE_TEST(boostmultiprec) +{ + typedef Matrix Mat; + typedef Matrix,Dynamic,Dynamic> MatC; + + std::cout << "NumTraits::epsilon() = " << NumTraits::epsilon() << std::endl; + std::cout << "NumTraits::dummy_precision() = " << NumTraits::dummy_precision() << std::endl; + std::cout << "NumTraits::lowest() = " << NumTraits::lowest() << std::endl; + std::cout << "NumTraits::highest() = " << NumTraits::highest() << std::endl; + std::cout << "NumTraits::digits10() = " << NumTraits::digits10() << std::endl; + + // check stream output + { + Mat A(10,10); + A.setRandom(); + std::stringstream ss; + ss << A; + } + { + MatC A(10,10); + A.setRandom(); + std::stringstream ss; + ss << A; + } + + for(int i = 0; i < g_repeat; i++) { + int s = internal::random(1,EIGEN_TEST_MAX_SIZE); + + CALL_SUBTEST_1( cholesky(Mat(s,s)) ); + + CALL_SUBTEST_2( lu_non_invertible() ); + CALL_SUBTEST_2( lu_invertible() ); + CALL_SUBTEST_2( lu_non_invertible() ); + CALL_SUBTEST_2( lu_invertible() ); + + CALL_SUBTEST_3( qr(Mat(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_3( qr_invertible() ); + + CALL_SUBTEST_4( qr() ); + CALL_SUBTEST_4( cod() ); + CALL_SUBTEST_4( qr_invertible() ); + + CALL_SUBTEST_5( qr() ); + CALL_SUBTEST_5( qr_invertible() ); + + CALL_SUBTEST_6( selfadjointeigensolver(Mat(s,s)) ); + + CALL_SUBTEST_7( eigensolver(Mat(s,s)) ); + + CALL_SUBTEST_8( generalized_eigensolver_real(Mat(s,s)) ); + + TEST_SET_BUT_UNUSED_VARIABLE(s) + } + + CALL_SUBTEST_9(( jacobisvd(Mat(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); + CALL_SUBTEST_10(( bdcsvd(Mat(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); + + CALL_SUBTEST_11(( test_simplicial_cholesky_T() )); +} diff --git a/lib/eigen-3.4.0/test/bug1213.cpp b/lib/eigen-3.4.0/test/bug1213.cpp new file mode 100644 index 0000000..581760c --- /dev/null +++ b/lib/eigen-3.4.0/test/bug1213.cpp @@ -0,0 +1,13 @@ + +// This anonymous enum is essential to trigger the linking issue +enum { + Foo +}; + +#include "bug1213.h" + +bool bug1213_1(const Eigen::Vector3f& x) +{ + return bug1213_2(x); +} + diff --git a/lib/eigen-3.4.0/test/bug1213.h b/lib/eigen-3.4.0/test/bug1213.h new file mode 100644 index 0000000..040e5a4 --- /dev/null +++ b/lib/eigen-3.4.0/test/bug1213.h @@ -0,0 +1,8 @@ + +#include + +template +bool bug1213_2(const Eigen::Matrix& x); + +bool bug1213_1(const Eigen::Vector3f& x); + diff --git a/lib/eigen-3.4.0/test/bug1213_main.cpp b/lib/eigen-3.4.0/test/bug1213_main.cpp new file mode 100644 index 0000000..4802c00 --- /dev/null +++ b/lib/eigen-3.4.0/test/bug1213_main.cpp @@ -0,0 +1,18 @@ + +// This is a regression unit regarding a weird linking issue with gcc. + +#include "bug1213.h" + +int main() +{ + return 0; +} + + +template +bool bug1213_2(const Eigen::Matrix& ) +{ + return true; +} + +template bool bug1213_2(const Eigen::Vector3f&); diff --git a/lib/eigen-3.4.0/test/cholesky.cpp b/lib/eigen-3.4.0/test/cholesky.cpp new file mode 100644 index 0000000..0b1a7b4 --- /dev/null +++ b/lib/eigen-3.4.0/test/cholesky.cpp @@ -0,0 +1,532 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define TEST_ENABLE_TEMPORARY_TRACKING + +#include "main.h" +#include +#include +#include "solverbase.h" + +template +typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { + if(m.cols()==0) return typename MatrixType::RealScalar(0); + MatrixType symm = m.template selfadjointView(); + return symm.cwiseAbs().colwise().sum().maxCoeff(); +} + +template class CholType> void test_chol_update(const MatrixType& symm) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef Matrix VectorType; + + MatrixType symmLo = symm.template triangularView(); + MatrixType symmUp = symm.template triangularView(); + MatrixType symmCpy = symm; + + CholType chollo(symmLo); + CholType cholup(symmUp); + + for (int k=0; k<10; ++k) + { + VectorType vec = VectorType::Random(symm.rows()); + RealScalar sigma = internal::random(); + symmCpy += sigma * vec * vec.adjoint(); + + // we are doing some downdates, so it might be the case that the matrix is not SPD anymore + CholType chol(symmCpy); + if(chol.info()!=Success) + break; + + chollo.rankUpdate(vec, sigma); + VERIFY_IS_APPROX(symmCpy, chollo.reconstructedMatrix()); + + cholup.rankUpdate(vec, sigma); + VERIFY_IS_APPROX(symmCpy, cholup.reconstructedMatrix()); + } +} + +template void cholesky(const MatrixType& m) +{ + /* this test covers the following files: + LLT.h LDLT.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix SquareMatrixType; + typedef Matrix VectorType; + + MatrixType a0 = MatrixType::Random(rows,cols); + VectorType vecB = VectorType::Random(rows), vecX(rows); + MatrixType matB = MatrixType::Random(rows,cols), matX(rows,cols); + SquareMatrixType symm = a0 * a0.adjoint(); + // let's make sure the matrix is not singular or near singular + for (int k=0; k<3; ++k) + { + MatrixType a1 = MatrixType::Random(rows,cols); + symm += a1 * a1.adjoint(); + } + + { + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + + SquareMatrixType symmUp = symm.template triangularView(); + SquareMatrixType symmLo = symm.template triangularView(); + + LLT chollo(symmLo); + VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix()); + + check_solverbase(symm, chollo, rows, rows, 1); + check_solverbase(symm, chollo, rows, cols, rows); + + const MatrixType symmLo_inverse = chollo.solve(MatrixType::Identity(rows,cols)); + RealScalar rcond = (RealScalar(1) / matrix_l1_norm(symmLo)) / + matrix_l1_norm(symmLo_inverse); + RealScalar rcond_est = chollo.rcond(); + // Verify that the estimated condition number is within a factor of 10 of the + // truth. + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); + + // test the upper mode + LLT cholup(symmUp); + VERIFY_IS_APPROX(symm, cholup.reconstructedMatrix()); + vecX = cholup.solve(vecB); + VERIFY_IS_APPROX(symm * vecX, vecB); + matX = cholup.solve(matB); + VERIFY_IS_APPROX(symm * matX, matB); + + // Verify that the estimated condition number is within a factor of 10 of the + // truth. + const MatrixType symmUp_inverse = cholup.solve(MatrixType::Identity(rows,cols)); + rcond = (RealScalar(1) / matrix_l1_norm(symmUp)) / + matrix_l1_norm(symmUp_inverse); + rcond_est = cholup.rcond(); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); + + + MatrixType neg = -symmLo; + chollo.compute(neg); + VERIFY(neg.size()==0 || chollo.info()==NumericalIssue); + + VERIFY_IS_APPROX(MatrixType(chollo.matrixL().transpose().conjugate()), MatrixType(chollo.matrixU())); + VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL())); + VERIFY_IS_APPROX(MatrixType(cholup.matrixL().transpose().conjugate()), MatrixType(cholup.matrixU())); + VERIFY_IS_APPROX(MatrixType(cholup.matrixU().transpose().conjugate()), MatrixType(cholup.matrixL())); + + // test some special use cases of SelfCwiseBinaryOp: + MatrixType m1 = MatrixType::Random(rows,cols), m2(rows,cols); + m2 = m1; + m2 += symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2 -= symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2.noalias() += symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2.noalias() -= symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); + } + + // LDLT + { + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + + int sign = internal::random()%2 ? 1 : -1; + + if(sign == -1) + { + symm = -symm; // test a negative matrix + } + + SquareMatrixType symmUp = symm.template triangularView(); + SquareMatrixType symmLo = symm.template triangularView(); + + LDLT ldltlo(symmLo); + VERIFY(ldltlo.info()==Success); + VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix()); + + check_solverbase(symm, ldltlo, rows, rows, 1); + check_solverbase(symm, ldltlo, rows, cols, rows); + + const MatrixType symmLo_inverse = ldltlo.solve(MatrixType::Identity(rows,cols)); + RealScalar rcond = (RealScalar(1) / matrix_l1_norm(symmLo)) / + matrix_l1_norm(symmLo_inverse); + RealScalar rcond_est = ldltlo.rcond(); + // Verify that the estimated condition number is within a factor of 10 of the + // truth. + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); + + + LDLT ldltup(symmUp); + VERIFY(ldltup.info()==Success); + VERIFY_IS_APPROX(symm, ldltup.reconstructedMatrix()); + vecX = ldltup.solve(vecB); + VERIFY_IS_APPROX(symm * vecX, vecB); + matX = ldltup.solve(matB); + VERIFY_IS_APPROX(symm * matX, matB); + + // Verify that the estimated condition number is within a factor of 10 of the + // truth. + const MatrixType symmUp_inverse = ldltup.solve(MatrixType::Identity(rows,cols)); + rcond = (RealScalar(1) / matrix_l1_norm(symmUp)) / + matrix_l1_norm(symmUp_inverse); + rcond_est = ldltup.rcond(); + VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); + + VERIFY_IS_APPROX(MatrixType(ldltlo.matrixL().transpose().conjugate()), MatrixType(ldltlo.matrixU())); + VERIFY_IS_APPROX(MatrixType(ldltlo.matrixU().transpose().conjugate()), MatrixType(ldltlo.matrixL())); + VERIFY_IS_APPROX(MatrixType(ldltup.matrixL().transpose().conjugate()), MatrixType(ldltup.matrixU())); + VERIFY_IS_APPROX(MatrixType(ldltup.matrixU().transpose().conjugate()), MatrixType(ldltup.matrixL())); + + if(MatrixType::RowsAtCompileTime==Dynamic) + { + // note : each inplace permutation requires a small temporary vector (mask) + + // check inplace solve + matX = matB; + VERIFY_EVALUATION_COUNT(matX = ldltlo.solve(matX), 0); + VERIFY_IS_APPROX(matX, ldltlo.solve(matB).eval()); + + + matX = matB; + VERIFY_EVALUATION_COUNT(matX = ldltup.solve(matX), 0); + VERIFY_IS_APPROX(matX, ldltup.solve(matB).eval()); + } + + // restore + if(sign == -1) + symm = -symm; + + // check matrices coming from linear constraints with Lagrange multipliers + if(rows>=3) + { + SquareMatrixType A = symm; + Index c = internal::random(0,rows-2); + A.bottomRightCorner(c,c).setZero(); + // Make sure a solution exists: + vecX.setRandom(); + vecB = A * vecX; + vecX.setZero(); + ldltlo.compute(A); + VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); + vecX = ldltlo.solve(vecB); + VERIFY_IS_APPROX(A * vecX, vecB); + } + + // check non-full rank matrices + if(rows>=3) + { + Index r = internal::random(1,rows-1); + Matrix a = Matrix::Random(rows,r); + SquareMatrixType A = a * a.adjoint(); + // Make sure a solution exists: + vecX.setRandom(); + vecB = A * vecX; + vecX.setZero(); + ldltlo.compute(A); + VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); + vecX = ldltlo.solve(vecB); + VERIFY_IS_APPROX(A * vecX, vecB); + } + + // check matrices with a wide spectrum + if(rows>=3) + { + using std::pow; + using std::sqrt; + RealScalar s = (std::min)(16,std::numeric_limits::max_exponent10/8); + Matrix a = Matrix::Random(rows,rows); + Matrix d = Matrix::Random(rows); + for(Index k=0; k(-s,s)); + SquareMatrixType A = a * d.asDiagonal() * a.adjoint(); + // Make sure a solution exists: + vecX.setRandom(); + vecB = A * vecX; + vecX.setZero(); + ldltlo.compute(A); + VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); + vecX = ldltlo.solve(vecB); + + if(ldltlo.vectorD().real().cwiseAbs().minCoeff()>RealScalar(0)) + { + VERIFY_IS_APPROX(A * vecX,vecB); + } + else + { + RealScalar large_tol = sqrt(test_precision()); + VERIFY((A * vecX).isApprox(vecB, large_tol)); + + ++g_test_level; + VERIFY_IS_APPROX(A * vecX,vecB); + --g_test_level; + } + } + } + + // update/downdate + CALL_SUBTEST(( test_chol_update(symm) )); + CALL_SUBTEST(( test_chol_update(symm) )); +} + +template void cholesky_cplx(const MatrixType& m) +{ + // classic test + cholesky(m); + + // test mixing real/scalar types + + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix RealMatrixType; + typedef Matrix VectorType; + + RealMatrixType a0 = RealMatrixType::Random(rows,cols); + VectorType vecB = VectorType::Random(rows), vecX(rows); + MatrixType matB = MatrixType::Random(rows,cols), matX(rows,cols); + RealMatrixType symm = a0 * a0.adjoint(); + // let's make sure the matrix is not singular or near singular + for (int k=0; k<3; ++k) + { + RealMatrixType a1 = RealMatrixType::Random(rows,cols); + symm += a1 * a1.adjoint(); + } + + { + RealMatrixType symmLo = symm.template triangularView(); + + LLT chollo(symmLo); + VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix()); + + check_solverbase(symm, chollo, rows, rows, 1); + //check_solverbase(symm, chollo, rows, cols, rows); + } + + // LDLT + { + int sign = internal::random()%2 ? 1 : -1; + + if(sign == -1) + { + symm = -symm; // test a negative matrix + } + + RealMatrixType symmLo = symm.template triangularView(); + + LDLT ldltlo(symmLo); + VERIFY(ldltlo.info()==Success); + VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix()); + + check_solverbase(symm, ldltlo, rows, rows, 1); + //check_solverbase(symm, ldltlo, rows, cols, rows); + } +} + +// regression test for bug 241 +template void cholesky_bug241(const MatrixType& m) +{ + eigen_assert(m.rows() == 2 && m.cols() == 2); + + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + + MatrixType matA; + matA << 1, 1, 1, 1; + VectorType vecB; + vecB << 1, 1; + VectorType vecX = matA.ldlt().solve(vecB); + VERIFY_IS_APPROX(matA * vecX, vecB); +} + +// LDLT is not guaranteed to work for indefinite matrices, but happens to work fine if matrix is diagonal. +// This test checks that LDLT reports correctly that matrix is indefinite. +// See http://forum.kde.org/viewtopic.php?f=74&t=106942 and bug 736 +template void cholesky_definiteness(const MatrixType& m) +{ + eigen_assert(m.rows() == 2 && m.cols() == 2); + MatrixType mat; + LDLT ldlt(2); + + { + mat << 1, 0, 0, -1; + ldlt.compute(mat); + VERIFY(ldlt.info()==Success); + VERIFY(!ldlt.isNegative()); + VERIFY(!ldlt.isPositive()); + VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); + } + { + mat << 1, 2, 2, 1; + ldlt.compute(mat); + VERIFY(ldlt.info()==Success); + VERIFY(!ldlt.isNegative()); + VERIFY(!ldlt.isPositive()); + VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); + } + { + mat << 0, 0, 0, 0; + ldlt.compute(mat); + VERIFY(ldlt.info()==Success); + VERIFY(ldlt.isNegative()); + VERIFY(ldlt.isPositive()); + VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); + } + { + mat << 0, 0, 0, 1; + ldlt.compute(mat); + VERIFY(ldlt.info()==Success); + VERIFY(!ldlt.isNegative()); + VERIFY(ldlt.isPositive()); + VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); + } + { + mat << -1, 0, 0, 0; + ldlt.compute(mat); + VERIFY(ldlt.info()==Success); + VERIFY(ldlt.isNegative()); + VERIFY(!ldlt.isPositive()); + VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); + } +} + +template +void cholesky_faillure_cases() +{ + MatrixXd mat; + LDLT ldlt; + + { + mat.resize(2,2); + mat << 0, 1, 1, 0; + ldlt.compute(mat); + VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); + VERIFY(ldlt.info()==NumericalIssue); + } +#if (!EIGEN_ARCH_i386) || defined(EIGEN_VECTORIZE_SSE2) + { + mat.resize(3,3); + mat << -1, -3, 3, + -3, -8.9999999999999999999, 1, + 3, 1, 0; + ldlt.compute(mat); + VERIFY(ldlt.info()==NumericalIssue); + VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); + } +#endif + { + mat.resize(3,3); + mat << 1, 2, 3, + 2, 4, 1, + 3, 1, 0; + ldlt.compute(mat); + VERIFY(ldlt.info()==NumericalIssue); + VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); + } + + { + mat.resize(8,8); + mat << 0.1, 0, -0.1, 0, 0, 0, 1, 0, + 0, 4.24667, 0, 2.00333, 0, 0, 0, 0, + -0.1, 0, 0.2, 0, -0.1, 0, 0, 0, + 0, 2.00333, 0, 8.49333, 0, 2.00333, 0, 0, + 0, 0, -0.1, 0, 0.1, 0, 0, 1, + 0, 0, 0, 2.00333, 0, 4.24667, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0; + ldlt.compute(mat); + VERIFY(ldlt.info()==NumericalIssue); + VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); + } + + // bug 1479 + { + mat.resize(4,4); + mat << 1, 2, 0, 1, + 2, 4, 0, 2, + 0, 0, 0, 1, + 1, 2, 1, 1; + ldlt.compute(mat); + VERIFY(ldlt.info()==NumericalIssue); + VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); + } +} + +template void cholesky_verify_assert() +{ + MatrixType tmp; + + LLT llt; + VERIFY_RAISES_ASSERT(llt.matrixL()) + VERIFY_RAISES_ASSERT(llt.matrixU()) + VERIFY_RAISES_ASSERT(llt.solve(tmp)) + VERIFY_RAISES_ASSERT(llt.transpose().solve(tmp)) + VERIFY_RAISES_ASSERT(llt.adjoint().solve(tmp)) + VERIFY_RAISES_ASSERT(llt.solveInPlace(tmp)) + + LDLT ldlt; + VERIFY_RAISES_ASSERT(ldlt.matrixL()) + VERIFY_RAISES_ASSERT(ldlt.transpositionsP()) + VERIFY_RAISES_ASSERT(ldlt.vectorD()) + VERIFY_RAISES_ASSERT(ldlt.isPositive()) + VERIFY_RAISES_ASSERT(ldlt.isNegative()) + VERIFY_RAISES_ASSERT(ldlt.solve(tmp)) + VERIFY_RAISES_ASSERT(ldlt.transpose().solve(tmp)) + VERIFY_RAISES_ASSERT(ldlt.adjoint().solve(tmp)) + VERIFY_RAISES_ASSERT(ldlt.solveInPlace(tmp)) +} + +EIGEN_DECLARE_TEST(cholesky) +{ + int s = 0; + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( cholesky(Matrix()) ); + CALL_SUBTEST_3( cholesky(Matrix2d()) ); + CALL_SUBTEST_3( cholesky_bug241(Matrix2d()) ); + CALL_SUBTEST_3( cholesky_definiteness(Matrix2d()) ); + CALL_SUBTEST_4( cholesky(Matrix3f()) ); + CALL_SUBTEST_5( cholesky(Matrix4d()) ); + + s = internal::random(1,EIGEN_TEST_MAX_SIZE); + CALL_SUBTEST_2( cholesky(MatrixXd(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + + s = internal::random(1,EIGEN_TEST_MAX_SIZE/2); + CALL_SUBTEST_6( cholesky_cplx(MatrixXcd(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + } + // empty matrix, regression test for Bug 785: + CALL_SUBTEST_2( cholesky(MatrixXd(0,0)) ); + + // This does not work yet: + // CALL_SUBTEST_2( cholesky(Matrix()) ); + + CALL_SUBTEST_4( cholesky_verify_assert() ); + CALL_SUBTEST_7( cholesky_verify_assert() ); + CALL_SUBTEST_8( cholesky_verify_assert() ); + CALL_SUBTEST_2( cholesky_verify_assert() ); + + // Test problem size constructors + CALL_SUBTEST_9( LLT(10) ); + CALL_SUBTEST_9( LDLT(10) ); + + CALL_SUBTEST_2( cholesky_faillure_cases() ); + + TEST_SET_BUT_UNUSED_VARIABLE(nb_temporaries) +} diff --git a/lib/eigen-3.4.0/test/cholmod_support.cpp b/lib/eigen-3.4.0/test/cholmod_support.cpp new file mode 100644 index 0000000..89b9cf4 --- /dev/null +++ b/lib/eigen-3.4.0/test/cholmod_support.cpp @@ -0,0 +1,69 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS +#include "sparse_solver.h" + +#include + +template void test_cholmod_ST() +{ + CholmodDecomposition g_chol_colmajor_lower; g_chol_colmajor_lower.setMode(CholmodSupernodalLLt); + CholmodDecomposition g_chol_colmajor_upper; g_chol_colmajor_upper.setMode(CholmodSupernodalLLt); + CholmodDecomposition g_llt_colmajor_lower; g_llt_colmajor_lower.setMode(CholmodSimplicialLLt); + CholmodDecomposition g_llt_colmajor_upper; g_llt_colmajor_upper.setMode(CholmodSimplicialLLt); + CholmodDecomposition g_ldlt_colmajor_lower; g_ldlt_colmajor_lower.setMode(CholmodLDLt); + CholmodDecomposition g_ldlt_colmajor_upper; g_ldlt_colmajor_upper.setMode(CholmodLDLt); + + CholmodSupernodalLLT chol_colmajor_lower; + CholmodSupernodalLLT chol_colmajor_upper; + CholmodSimplicialLLT llt_colmajor_lower; + CholmodSimplicialLLT llt_colmajor_upper; + CholmodSimplicialLDLT ldlt_colmajor_lower; + CholmodSimplicialLDLT ldlt_colmajor_upper; + + check_sparse_spd_solving(g_chol_colmajor_lower); + check_sparse_spd_solving(g_chol_colmajor_upper); + check_sparse_spd_solving(g_llt_colmajor_lower); + check_sparse_spd_solving(g_llt_colmajor_upper); + check_sparse_spd_solving(g_ldlt_colmajor_lower); + check_sparse_spd_solving(g_ldlt_colmajor_upper); + + check_sparse_spd_solving(chol_colmajor_lower); + check_sparse_spd_solving(chol_colmajor_upper); + check_sparse_spd_solving(llt_colmajor_lower); + check_sparse_spd_solving(llt_colmajor_upper); + check_sparse_spd_solving(ldlt_colmajor_lower); + check_sparse_spd_solving(ldlt_colmajor_upper); + + check_sparse_spd_determinant(chol_colmajor_lower); + check_sparse_spd_determinant(chol_colmajor_upper); + check_sparse_spd_determinant(llt_colmajor_lower); + check_sparse_spd_determinant(llt_colmajor_upper); + check_sparse_spd_determinant(ldlt_colmajor_lower); + check_sparse_spd_determinant(ldlt_colmajor_upper); +} + +template void test_cholmod_T() +{ + test_cholmod_ST >(); +} + +EIGEN_DECLARE_TEST(cholmod_support) +{ + CALL_SUBTEST_11( (test_cholmod_T()) ); + CALL_SUBTEST_12( (test_cholmod_T()) ); + CALL_SUBTEST_13( (test_cholmod_T()) ); + CALL_SUBTEST_14( (test_cholmod_T()) ); + CALL_SUBTEST_21( (test_cholmod_T, ColMajor, int >()) ); + CALL_SUBTEST_22( (test_cholmod_T, ColMajor, long>()) ); + // TODO complex row-major matrices do not work at the moment: + // CALL_SUBTEST_23( (test_cholmod_T, RowMajor, int >()) ); + // CALL_SUBTEST_24( (test_cholmod_T, RowMajor, long>()) ); +} diff --git a/lib/eigen-3.4.0/test/commainitializer.cpp b/lib/eigen-3.4.0/test/commainitializer.cpp new file mode 100644 index 0000000..eb275be --- /dev/null +++ b/lib/eigen-3.4.0/test/commainitializer.cpp @@ -0,0 +1,118 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + + +template +void test_blocks() +{ + Matrix m_fixed; + MatrixXi m_dynamic(M1+M2, N1+N2); + + Matrix mat11; mat11.setRandom(); + Matrix mat12; mat12.setRandom(); + Matrix mat21; mat21.setRandom(); + Matrix mat22; mat22.setRandom(); + + MatrixXi matx11 = mat11, matx12 = mat12, matx21 = mat21, matx22 = mat22; + + { + VERIFY_IS_EQUAL((m_fixed << mat11, mat12, mat21, matx22).finished(), (m_dynamic << mat11, matx12, mat21, matx22).finished()); + VERIFY_IS_EQUAL((m_fixed.template topLeftCorner()), mat11); + VERIFY_IS_EQUAL((m_fixed.template topRightCorner()), mat12); + VERIFY_IS_EQUAL((m_fixed.template bottomLeftCorner()), mat21); + VERIFY_IS_EQUAL((m_fixed.template bottomRightCorner()), mat22); + VERIFY_IS_EQUAL((m_fixed << mat12, mat11, matx21, mat22).finished(), (m_dynamic << mat12, matx11, matx21, mat22).finished()); + } + + if(N1 > 0) + { + if(M1 > 0) + { + VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat11, mat21, mat22)); + } + if(M2 > 0) + { + VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat21, mat21, mat22)); + } + } + else + { + // allow insertion of zero-column blocks: + VERIFY_IS_EQUAL((m_fixed << mat11, mat12, mat11, mat11, mat21, mat21, mat22).finished(), (m_dynamic << mat12, mat22).finished()); + } + if(M1 != M2) + { + VERIFY_RAISES_ASSERT((m_fixed << mat11, mat21, mat12, mat22)); + } +} + + +template +struct test_block_recursion +{ + static void run() + { + test_block_recursion::run(); + test_block_recursion::run(); + } +}; + +template +struct test_block_recursion<0,N> +{ + static void run() { + test_blocks<(N>>6)&3, (N>>4)&3, (N>>2)&3, N & 3>(); + } +}; + +void test_basics() { + Matrix3d m3; + Matrix4d m4; + + VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8) ); + + #ifndef _MSC_VER + VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ); + #endif + + double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + Matrix3d ref = Map >(data); + + m3 = Matrix3d::Random(); + m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; + VERIFY_IS_APPROX(m3, ref ); + + Vector3d vec[3]; + vec[0] << 1, 4, 7; + vec[1] << 2, 5, 8; + vec[2] << 3, 6, 9; + m3 = Matrix3d::Random(); + m3 << vec[0], vec[1], vec[2]; + VERIFY_IS_APPROX(m3, ref); + + vec[0] << 1, 2, 3; + vec[1] << 4, 5, 6; + vec[2] << 7, 8, 9; + m3 = Matrix3d::Random(); + m3 << vec[0].transpose(), + 4, 5, 6, + vec[2].transpose(); + VERIFY_IS_APPROX(m3, ref); +} + +EIGEN_DECLARE_TEST(commainitializer) +{ + + CALL_SUBTEST_1(test_basics()); + + // recursively test all block-sizes from 0 to 3: + CALL_SUBTEST_2(test_block_recursion<8>::run()); +} diff --git a/lib/eigen-3.4.0/test/conjugate_gradient.cpp b/lib/eigen-3.4.0/test/conjugate_gradient.cpp new file mode 100644 index 0000000..b076a12 --- /dev/null +++ b/lib/eigen-3.4.0/test/conjugate_gradient.cpp @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "sparse_solver.h" +#include + +template void test_conjugate_gradient_T() +{ + typedef SparseMatrix SparseMatrixType; + ConjugateGradient cg_colmajor_lower_diag; + ConjugateGradient cg_colmajor_upper_diag; + ConjugateGradient cg_colmajor_loup_diag; + ConjugateGradient cg_colmajor_lower_I; + ConjugateGradient cg_colmajor_upper_I; + + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_diag) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_diag) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_loup_diag) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_I) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_I) ); +} + +EIGEN_DECLARE_TEST(conjugate_gradient) +{ + CALL_SUBTEST_1(( test_conjugate_gradient_T() )); + CALL_SUBTEST_2(( test_conjugate_gradient_T, int>() )); + CALL_SUBTEST_3(( test_conjugate_gradient_T() )); +} diff --git a/lib/eigen-3.4.0/test/conservative_resize.cpp b/lib/eigen-3.4.0/test/conservative_resize.cpp new file mode 100644 index 0000000..d48eb12 --- /dev/null +++ b/lib/eigen-3.4.0/test/conservative_resize.cpp @@ -0,0 +1,167 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +#include +#include "AnnoyingScalar.h" + +using namespace Eigen; + +template +void run_matrix_tests() +{ + typedef Matrix MatrixType; + + MatrixType m, n; + + // boundary cases ... + m = n = MatrixType::Random(50,50); + m.conservativeResize(1,50); + VERIFY_IS_APPROX(m, n.block(0,0,1,50)); + + m = n = MatrixType::Random(50,50); + m.conservativeResize(50,1); + VERIFY_IS_APPROX(m, n.block(0,0,50,1)); + + m = n = MatrixType::Random(50,50); + m.conservativeResize(50,50); + VERIFY_IS_APPROX(m, n.block(0,0,50,50)); + + // random shrinking ... + for (int i=0; i<25; ++i) + { + const Index rows = internal::random(1,50); + const Index cols = internal::random(1,50); + m = n = MatrixType::Random(50,50); + m.conservativeResize(rows,cols); + VERIFY_IS_APPROX(m, n.block(0,0,rows,cols)); + } + + // random growing with zeroing ... + for (int i=0; i<25; ++i) + { + const Index rows = internal::random(50,75); + const Index cols = internal::random(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); + VERIFY( rows<=50 || m.block(50,0,rows-50,cols).sum() == Scalar(0) ); + VERIFY( cols<=50 || m.block(0,50,rows,cols-50).sum() == Scalar(0) ); + } +} + +template +void run_vector_tests() +{ + typedef Matrix VectorType; + + VectorType m, n; + + // boundary cases ... + m = n = VectorType::Random(50); + m.conservativeResize(1); + VERIFY_IS_APPROX(m, n.segment(0,1)); + + m = n = VectorType::Random(50); + m.conservativeResize(50); + VERIFY_IS_APPROX(m, n.segment(0,50)); + + m = n = VectorType::Random(50); + m.conservativeResize(m.rows(),1); + VERIFY_IS_APPROX(m, n.segment(0,1)); + + m = n = VectorType::Random(50); + m.conservativeResize(m.rows(),50); + VERIFY_IS_APPROX(m, n.segment(0,50)); + + // random shrinking ... + for (int i=0; i<50; ++i) + { + const int size = internal::random(1,50); + m = n = VectorType::Random(50); + m.conservativeResize(size); + VERIFY_IS_APPROX(m, n.segment(0,size)); + + m = n = VectorType::Random(50); + m.conservativeResize(m.rows(), size); + VERIFY_IS_APPROX(m, n.segment(0,size)); + } + + // random growing with zeroing ... + for (int i=0; i<50; ++i) + { + const int size = internal::random(50,100); + m = n = VectorType::Random(50); + m.conservativeResizeLike(VectorType::Zero(size)); + VERIFY_IS_APPROX(m.segment(0,50), n); + VERIFY( size<=50 || m.segment(50,size-50).sum() == Scalar(0) ); + + m = n = VectorType::Random(50); + m.conservativeResizeLike(Matrix::Zero(1,size)); + VERIFY_IS_APPROX(m.segment(0,50), n); + VERIFY( size<=50 || m.segment(50,size-50).sum() == Scalar(0) ); + } +} + +// Basic memory leak check with a non-copyable scalar type +template void noncopyable() +{ + typedef Eigen::Matrix VectorType; + typedef Eigen::Matrix MatrixType; + + { +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW + AnnoyingScalar::dont_throw = true; +#endif + int n = 50; + VectorType v0(n), v1(n); + MatrixType m0(n,n), m1(n,n), m2(n,n); + v0.setOnes(); v1.setOnes(); + m0.setOnes(); m1.setOnes(); m2.setOnes(); + VERIFY(m0==m1); + m0.conservativeResize(2*n,2*n); + VERIFY(m0.topLeftCorner(n,n) == m1); + + VERIFY(v0.head(n) == v1); + v0.conservativeResize(2*n); + VERIFY(v0.head(n) == v1); + } + VERIFY(AnnoyingScalar::instances==0 && "global memory leak detected in noncopyable"); +} + +EIGEN_DECLARE_TEST(conservative_resize) +{ + for(int i=0; i())); + CALL_SUBTEST_1((run_matrix_tests())); + CALL_SUBTEST_2((run_matrix_tests())); + CALL_SUBTEST_2((run_matrix_tests())); + CALL_SUBTEST_3((run_matrix_tests())); + CALL_SUBTEST_3((run_matrix_tests())); + CALL_SUBTEST_4((run_matrix_tests, Eigen::RowMajor>())); + CALL_SUBTEST_4((run_matrix_tests, Eigen::ColMajor>())); + CALL_SUBTEST_5((run_matrix_tests, Eigen::RowMajor>())); + CALL_SUBTEST_5((run_matrix_tests, Eigen::ColMajor>())); + CALL_SUBTEST_1((run_matrix_tests())); + + CALL_SUBTEST_1((run_vector_tests())); + CALL_SUBTEST_2((run_vector_tests())); + CALL_SUBTEST_3((run_vector_tests())); + CALL_SUBTEST_4((run_vector_tests >())); + CALL_SUBTEST_5((run_vector_tests >())); + +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW + AnnoyingScalar::dont_throw = true; +#endif + CALL_SUBTEST_6(( run_vector_tests() )); + CALL_SUBTEST_6(( noncopyable<0>() )); + } +} diff --git a/lib/eigen-3.4.0/test/constructor.cpp b/lib/eigen-3.4.0/test/constructor.cpp new file mode 100644 index 0000000..ffd5e80 --- /dev/null +++ b/lib/eigen-3.4.0/test/constructor.cpp @@ -0,0 +1,98 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#define TEST_ENABLE_TEMPORARY_TRACKING + +#include "main.h" + +template struct Wrapper +{ + MatrixType m_mat; + inline Wrapper(const MatrixType &x) : m_mat(x) {} + inline operator const MatrixType& () const { return m_mat; } + inline operator MatrixType& () { return m_mat; } +}; + +enum my_sizes { M = 12, N = 7}; + +template void ctor_init1(const MatrixType& m) +{ + // Check logic in PlainObjectBase::_init1 + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m0 = MatrixType::Random(rows,cols); + + VERIFY_EVALUATION_COUNT( MatrixType m1(m0), 1); + VERIFY_EVALUATION_COUNT( MatrixType m2(m0+m0), 1); + VERIFY_EVALUATION_COUNT( MatrixType m2(m0.block(0,0,rows,cols)) , 1); + + Wrapper wrapper(m0); + VERIFY_EVALUATION_COUNT( MatrixType m3(wrapper) , 1); +} + + +EIGEN_DECLARE_TEST(constructor) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( ctor_init1(Matrix()) ); + CALL_SUBTEST_1( ctor_init1(Matrix4d()) ); + CALL_SUBTEST_1( ctor_init1(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_1( ctor_init1(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } + { + Matrix a(123); + VERIFY_IS_EQUAL(a[0], 123); + } + { + Matrix a(123.0); + VERIFY_IS_EQUAL(a[0], 123); + } + { + Matrix a(123); + VERIFY_IS_EQUAL(a[0], 123.f); + } + { + Array a(123); + VERIFY_IS_EQUAL(a[0], 123); + } + { + Array a(123.0); + VERIFY_IS_EQUAL(a[0], 123); + } + { + Array a(123); + VERIFY_IS_EQUAL(a[0], 123.f); + } + { + Array a(123); + VERIFY_IS_EQUAL(a(4), 123); + } + { + Array a(123.0); + VERIFY_IS_EQUAL(a(4), 123); + } + { + Array a(123); + VERIFY_IS_EQUAL(a(4), 123.f); + } + { + MatrixXi m1(M,N); + VERIFY_IS_EQUAL(m1.rows(),M); + VERIFY_IS_EQUAL(m1.cols(),N); + ArrayXXi a1(M,N); + VERIFY_IS_EQUAL(a1.rows(),M); + VERIFY_IS_EQUAL(a1.cols(),N); + VectorXi v1(M); + VERIFY_IS_EQUAL(v1.size(),M); + ArrayXi a2(M); + VERIFY_IS_EQUAL(a2.size(),M); + } +} diff --git a/lib/eigen-3.4.0/test/corners.cpp b/lib/eigen-3.4.0/test/corners.cpp new file mode 100644 index 0000000..73342a8 --- /dev/null +++ b/lib/eigen-3.4.0/test/corners.cpp @@ -0,0 +1,117 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +#define COMPARE_CORNER(A,B) \ + VERIFY_IS_EQUAL(matrix.A, matrix.B); \ + VERIFY_IS_EQUAL(const_matrix.A, const_matrix.B); + +template void corners(const MatrixType& m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + + Index r = internal::random(1,rows); + Index c = internal::random(1,cols); + + MatrixType matrix = MatrixType::Random(rows,cols); + const MatrixType const_matrix = MatrixType::Random(rows,cols); + + COMPARE_CORNER(topLeftCorner(r,c), block(0,0,r,c)); + COMPARE_CORNER(topRightCorner(r,c), block(0,cols-c,r,c)); + 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 = internal::random(1,rows) - 1; + Index nr = internal::random(1,rows-sr); + Index sc = internal::random(1,cols) - 1; + Index nc = internal::random(1,cols-sc); + + COMPARE_CORNER(topRows(r), block(0,0,r,cols)); + COMPARE_CORNER(middleRows(sr,nr), block(sr,0,nr,cols)); + COMPARE_CORNER(bottomRows(r), block(rows-r,0,r,cols)); + COMPARE_CORNER(leftCols(c), block(0,0,rows,c)); + COMPARE_CORNER(middleCols(sc,nc), block(0,sc,rows,nc)); + COMPARE_CORNER(rightCols(c), block(0,cols-c,rows,c)); +} + +template void corners_fixedsize() +{ + MatrixType matrix = MatrixType::Random(); + const MatrixType const_matrix = MatrixType::Random(); + + enum { + rows = MatrixType::RowsAtCompileTime, + cols = MatrixType::ColsAtCompileTime, + r = CRows, + c = CCols, + sr = SRows, + sc = SCols + }; + + VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template block(0,0))); + VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template block(0,cols-c))); + VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template block(rows-r,0))); + VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template block(rows-r,cols-c))); + + VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template topLeftCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template topRightCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template bottomLeftCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template bottomRightCorner(r,c))); + + VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template topLeftCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template topRightCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template bottomLeftCorner(r,c))); + VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template bottomRightCorner(r,c))); + + VERIFY_IS_EQUAL((matrix.template topRows()), (matrix.template block(0,0))); + VERIFY_IS_EQUAL((matrix.template middleRows(sr)), (matrix.template block(sr,0))); + VERIFY_IS_EQUAL((matrix.template bottomRows()), (matrix.template block(rows-r,0))); + VERIFY_IS_EQUAL((matrix.template leftCols()), (matrix.template block(0,0))); + VERIFY_IS_EQUAL((matrix.template middleCols(sc)), (matrix.template block(0,sc))); + VERIFY_IS_EQUAL((matrix.template rightCols()), (matrix.template block(0,cols-c))); + + VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template block(0,0))); + VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template block(0,cols-c))); + VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template block(rows-r,0))); + VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template block(rows-r,cols-c))); + + VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template topLeftCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template topRightCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template bottomLeftCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template bottomRightCorner(r,c))); + + VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template topLeftCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template topRightCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template bottomLeftCorner(r,c))); + VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template bottomRightCorner(r,c))); + + VERIFY_IS_EQUAL((const_matrix.template topRows()), (const_matrix.template block(0,0))); + VERIFY_IS_EQUAL((const_matrix.template middleRows(sr)), (const_matrix.template block(sr,0))); + VERIFY_IS_EQUAL((const_matrix.template bottomRows()), (const_matrix.template block(rows-r,0))); + VERIFY_IS_EQUAL((const_matrix.template leftCols()), (const_matrix.template block(0,0))); + VERIFY_IS_EQUAL((const_matrix.template middleCols(sc)), (const_matrix.template block(0,sc))); + VERIFY_IS_EQUAL((const_matrix.template rightCols()), (const_matrix.template block(0,cols-c))); +} + +EIGEN_DECLARE_TEST(corners) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( corners(Matrix()) ); + CALL_SUBTEST_2( corners(Matrix4d()) ); + CALL_SUBTEST_3( corners(Matrix()) ); + CALL_SUBTEST_4( corners(MatrixXcf(5, 7)) ); + CALL_SUBTEST_5( corners(MatrixXf(21, 20)) ); + + CALL_SUBTEST_1(( corners_fixedsize, 1, 1, 0, 0>() )); + CALL_SUBTEST_2(( corners_fixedsize() )); + CALL_SUBTEST_3(( corners_fixedsize,4,7,5,2>() )); + } +} diff --git a/lib/eigen-3.4.0/test/ctorleak.cpp b/lib/eigen-3.4.0/test/ctorleak.cpp new file mode 100644 index 0000000..7390417 --- /dev/null +++ b/lib/eigen-3.4.0/test/ctorleak.cpp @@ -0,0 +1,81 @@ +#include "main.h" + +#include // std::exception + +struct Foo +{ + static Index object_count; + static Index object_limit; + int dummy; + + Foo() : dummy(0) + { +#ifdef EIGEN_EXCEPTIONS + // TODO: Is this the correct way to handle this? + if (Foo::object_count > Foo::object_limit) { std::cout << "\nThrow!\n"; throw Foo::Fail(); } +#endif + std::cout << '+'; + ++Foo::object_count; + } + + ~Foo() + { + std::cout << '-'; + --Foo::object_count; + } + + class Fail : public std::exception {}; +}; + +Index Foo::object_count = 0; +Index Foo::object_limit = 0; + +#undef EIGEN_TEST_MAX_SIZE +#define EIGEN_TEST_MAX_SIZE 3 + +EIGEN_DECLARE_TEST(ctorleak) +{ + typedef Matrix MatrixX; + typedef Matrix VectorX; + + Foo::object_count = 0; + for(int i = 0; i < g_repeat; i++) { + Index rows = internal::random(2,EIGEN_TEST_MAX_SIZE), cols = internal::random(2,EIGEN_TEST_MAX_SIZE); + Foo::object_limit = rows*cols; + { + MatrixX r(rows, cols); + Foo::object_limit = r.size()+internal::random(0, rows*cols - 2); + std::cout << "object_limit =" << Foo::object_limit << std::endl; +#ifdef EIGEN_EXCEPTIONS + try + { +#endif + if(internal::random()) { + std::cout << "\nMatrixX m(" << rows << ", " << cols << ");\n"; + MatrixX m(rows, cols); + } + else { + std::cout << "\nMatrixX m(r);\n"; + MatrixX m(r); + } +#ifdef EIGEN_EXCEPTIONS + VERIFY(false); // not reached if exceptions are enabled + } + catch (const Foo::Fail&) { /* ignore */ } +#endif + } + VERIFY_IS_EQUAL(Index(0), Foo::object_count); + + { + Foo::object_limit = (rows+1)*(cols+1); + MatrixX A(rows, cols); + VERIFY_IS_EQUAL(Foo::object_count, rows*cols); + VectorX v=A.row(0); + VERIFY_IS_EQUAL(Foo::object_count, (rows+1)*cols); + v = A.col(0); + VERIFY_IS_EQUAL(Foo::object_count, rows*(cols+1)); + } + VERIFY_IS_EQUAL(Index(0), Foo::object_count); + } + std::cout << "\n"; +} diff --git a/lib/eigen-3.4.0/test/denseLM.cpp b/lib/eigen-3.4.0/test/denseLM.cpp new file mode 100644 index 0000000..afb8004 --- /dev/null +++ b/lib/eigen-3.4.0/test/denseLM.cpp @@ -0,0 +1,190 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Desire Nuentsa +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include +#include + +#include "main.h" +#include +using namespace std; +using namespace Eigen; + +template +struct DenseLM : DenseFunctor +{ + typedef DenseFunctor Base; + typedef typename Base::JacobianType JacobianType; + typedef Matrix VectorType; + + DenseLM(int n, int m) : DenseFunctor(n,m) + { } + + VectorType model(const VectorType& uv, VectorType& x) + { + VectorType y; // Should change to use expression template + int m = Base::values(); + int n = Base::inputs(); + eigen_assert(uv.size()%2 == 0); + eigen_assert(uv.size() == n); + eigen_assert(x.size() == m); + y.setZero(m); + int half = n/2; + VectorBlock u(uv, 0, half); + VectorBlock v(uv, half, half); + for (int j = 0; j < m; j++) + { + for (int i = 0; i < half; i++) + y(j) += u(i)*std::exp(-(x(j)-i)*(x(j)-i)/(v(i)*v(i))); + } + return y; + + } + void initPoints(VectorType& uv_ref, VectorType& x) + { + m_x = x; + m_y = this->model(uv_ref, x); + } + + int operator()(const VectorType& uv, VectorType& fvec) + { + + int m = Base::values(); + int n = Base::inputs(); + eigen_assert(uv.size()%2 == 0); + eigen_assert(uv.size() == n); + eigen_assert(fvec.size() == m); + int half = n/2; + VectorBlock u(uv, 0, half); + VectorBlock v(uv, half, half); + for (int j = 0; j < m; j++) + { + fvec(j) = m_y(j); + for (int i = 0; i < half; i++) + { + fvec(j) -= u(i) *std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); + } + } + + return 0; + } + int df(const VectorType& uv, JacobianType& fjac) + { + int m = Base::values(); + int n = Base::inputs(); + eigen_assert(n == uv.size()); + eigen_assert(fjac.rows() == m); + eigen_assert(fjac.cols() == n); + int half = n/2; + VectorBlock u(uv, 0, half); + VectorBlock v(uv, half, half); + for (int j = 0; j < m; j++) + { + for (int i = 0; i < half; i++) + { + fjac.coeffRef(j,i) = -std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); + fjac.coeffRef(j,i+half) = -2.*u(i)*(m_x(j)-i)*(m_x(j)-i)/(std::pow(v(i),3)) * std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); + } + } + return 0; + } + VectorType m_x, m_y; //Data Points +}; + +template +int test_minimizeLM(FunctorType& functor, VectorType& uv) +{ + LevenbergMarquardt lm(functor); + LevenbergMarquardtSpace::Status info; + + info = lm.minimize(uv); + + VERIFY_IS_EQUAL(info, 1); + //FIXME Check other parameters + return info; +} + +template +int test_lmder(FunctorType& functor, VectorType& uv) +{ + typedef typename VectorType::Scalar Scalar; + LevenbergMarquardtSpace::Status info; + LevenbergMarquardt lm(functor); + info = lm.lmder1(uv); + + VERIFY_IS_EQUAL(info, 1); + //FIXME Check other parameters + return info; +} + +template +int test_minimizeSteps(FunctorType& functor, VectorType& uv) +{ + LevenbergMarquardtSpace::Status info; + LevenbergMarquardt lm(functor); + info = lm.minimizeInit(uv); + if (info==LevenbergMarquardtSpace::ImproperInputParameters) + return info; + do + { + info = lm.minimizeOneStep(uv); + } while (info==LevenbergMarquardtSpace::Running); + + VERIFY_IS_EQUAL(info, 1); + //FIXME Check other parameters + return info; +} + +template +void test_denseLM_T() +{ + typedef Matrix VectorType; + + int inputs = 10; + int values = 1000; + DenseLM dense_gaussian(inputs, values); + VectorType uv(inputs),uv_ref(inputs); + VectorType x(values); + + // Generate the reference solution + uv_ref << -2, 1, 4 ,8, 6, 1.8, 1.2, 1.1, 1.9 , 3; + + //Generate the reference data points + x.setRandom(); + x = 10*x; + x.array() += 10; + dense_gaussian.initPoints(uv_ref, x); + + // Generate the initial parameters + VectorBlock u(uv, 0, inputs/2); + VectorBlock v(uv, inputs/2, inputs/2); + + // Solve the optimization problem + + //Solve in one go + u.setOnes(); v.setOnes(); + test_minimizeLM(dense_gaussian, uv); + + //Solve until the machine precision + u.setOnes(); v.setOnes(); + test_lmder(dense_gaussian, uv); + + // Solve step by step + v.setOnes(); u.setOnes(); + test_minimizeSteps(dense_gaussian, uv); + +} + +EIGEN_DECLARE_TEST(denseLM) +{ + CALL_SUBTEST_2(test_denseLM_T()); + + // CALL_SUBTEST_2(test_sparseLM_T()); +} diff --git a/lib/eigen-3.4.0/test/dense_storage.cpp b/lib/eigen-3.4.0/test/dense_storage.cpp new file mode 100644 index 0000000..45c2bd7 --- /dev/null +++ b/lib/eigen-3.4.0/test/dense_storage.cpp @@ -0,0 +1,190 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2013 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include "AnnoyingScalar.h" +#include "SafeScalar.h" + +#include + +#if EIGEN_HAS_TYPE_TRAITS && EIGEN_HAS_CXX11 +using DenseStorageD3x3 = Eigen::DenseStorage; +static_assert(std::is_trivially_move_constructible::value, "DenseStorage not trivially_move_constructible"); +static_assert(std::is_trivially_move_assignable::value, "DenseStorage not trivially_move_assignable"); +#if !defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) +static_assert(std::is_trivially_copy_constructible::value, "DenseStorage not trivially_copy_constructible"); +static_assert(std::is_trivially_copy_assignable::value, "DenseStorage not trivially_copy_assignable"); +static_assert(std::is_trivially_copyable::value, "DenseStorage not trivially_copyable"); +#endif +#endif + +template +void dense_storage_copy(int rows, int cols) +{ + typedef DenseStorage DenseStorageType; + + const int size = rows*cols; + DenseStorageType reference(size, rows, cols); + T* raw_reference = reference.data(); + for (int i=0; i(i); + + DenseStorageType copied_reference(reference); + const T* raw_copied_reference = copied_reference.data(); + for (int i=0; i +void dense_storage_assignment(int rows, int cols) +{ + typedef DenseStorage DenseStorageType; + + const int size = rows*cols; + DenseStorageType reference(size, rows, cols); + T* raw_reference = reference.data(); + for (int i=0; i(i); + + DenseStorageType copied_reference; + copied_reference = reference; + const T* raw_copied_reference = copied_reference.data(); + for (int i=0; i +void dense_storage_swap(int rows0, int cols0, int rows1, int cols1) +{ + typedef DenseStorage DenseStorageType; + + const int size0 = rows0*cols0; + DenseStorageType a(size0, rows0, cols0); + for (int i=0; i(i); + } + + const int size1 = rows1*cols1; + DenseStorageType b(size1, rows1, cols1); + for (int i=0; i(-i); + } + + a.swap(b); + + for (int i=0; i(i)); + } + + for (int i=0; i(-i)); + } +} + +template +void dense_storage_alignment() +{ + #if EIGEN_HAS_ALIGNAS + + struct alignas(Alignment) Empty1 {}; + VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); + + struct EIGEN_ALIGN_TO_BOUNDARY(Alignment) Empty2 {}; + VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); + + struct Nested1 { EIGEN_ALIGN_TO_BOUNDARY(Alignment) T data[Size]; }; + VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); + + VERIFY_IS_EQUAL( (std::alignment_of >::value), Alignment); + + const std::size_t default_alignment = internal::compute_default_alignment::value; + + VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); + VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); + struct Nested2 { Matrix mat; }; + VERIFY_IS_EQUAL(std::alignment_of::value, default_alignment); + + #endif +} + +template +void dense_storage_tests() { + // Dynamic Storage. + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + // Fixed Storage. + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + // Fixed Storage with Uninitialized Elements. + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + dense_storage_copy(4, 3); + + // Dynamic Storage. + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + // Fixed Storage. + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + // Fixed Storage with Uninitialized Elements. + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + dense_storage_assignment(4, 3); + + // Dynamic Storage. + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 1); + dense_storage_swap(2, 1, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 3); + dense_storage_swap(2, 3, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 4, 1); + dense_storage_swap(4, 1, 4, 3); + // Fixed Storage. + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 1); + dense_storage_swap(2, 1, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 4, 1); + dense_storage_swap(4, 1, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 3); + dense_storage_swap(2, 3, 4, 3); + // Fixed Storage with Uninitialized Elements. + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 1); + dense_storage_swap(2, 1, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 4, 1); + dense_storage_swap(4, 1, 4, 3); + dense_storage_swap(4, 3, 4, 3); + dense_storage_swap(4, 3, 2, 3); + dense_storage_swap(2, 3, 4, 3); + + dense_storage_alignment(); + dense_storage_alignment(); + dense_storage_alignment(); + dense_storage_alignment(); +} + +EIGEN_DECLARE_TEST(dense_storage) +{ + dense_storage_tests(); + dense_storage_tests(); + dense_storage_tests >(); + dense_storage_tests(); +} diff --git a/lib/eigen-3.4.0/test/determinant.cpp b/lib/eigen-3.4.0/test/determinant.cpp new file mode 100644 index 0000000..7dd33c3 --- /dev/null +++ b/lib/eigen-3.4.0/test/determinant.cpp @@ -0,0 +1,66 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template void determinant(const MatrixType& m) +{ + /* this test covers the following files: + Determinant.h + */ + Index size = m.rows(); + + MatrixType m1(size, size), m2(size, size); + m1.setRandom(); + m2.setRandom(); + typedef typename MatrixType::Scalar Scalar; + Scalar x = internal::random(); + 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 = internal::random(0, size-1); + Index j; + do { + j = internal::random(0, size-1); + } while(j==i); + m2 = m1; + m2.row(i).swap(m2.row(j)); + VERIFY_IS_APPROX(m2.determinant(), -m1.determinant()); + m2 = m1; + 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(numext::conj(m2.determinant()), m2.adjoint().determinant()); + m2 = m1; + m2.row(i) += x*m2.row(j); + VERIFY_IS_APPROX(m2.determinant(), m1.determinant()); + m2 = m1; + m2.row(i) *= x; + VERIFY_IS_APPROX(m2.determinant(), m1.determinant() * x); + + // check empty matrix + VERIFY_IS_APPROX(m2.block(0,0,0,0).determinant(), Scalar(1)); +} + +EIGEN_DECLARE_TEST(determinant) +{ + for(int i = 0; i < g_repeat; i++) { + int s = 0; + CALL_SUBTEST_1( determinant(Matrix()) ); + CALL_SUBTEST_2( determinant(Matrix()) ); + CALL_SUBTEST_3( determinant(Matrix()) ); + CALL_SUBTEST_4( determinant(Matrix()) ); + CALL_SUBTEST_5( determinant(Matrix, 10, 10>()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_6( determinant(MatrixXd(s, s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + } +} diff --git a/lib/eigen-3.4.0/test/diagonal.cpp b/lib/eigen-3.4.0/test/diagonal.cpp new file mode 100644 index 0000000..4e8c4b3 --- /dev/null +++ b/lib/eigen-3.4.0/test/diagonal.cpp @@ -0,0 +1,105 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void diagonal(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols); + + Scalar s1 = internal::random(); + + //check diagonal() + VERIFY_IS_APPROX(m1.diagonal(), m1.transpose().diagonal()); + m2.diagonal() = 2 * m1.diagonal(); + m2.diagonal()[0] *= 3; + + if (rows>2) + { + enum { + N1 = MatrixType::RowsAtCompileTime>2 ? 2 : 0, + N2 = MatrixType::RowsAtCompileTime>1 ? -1 : 0 + }; + + // check sub/super diagonal + if(MatrixType::SizeAtCompileTime!=Dynamic) + { + VERIFY(m1.template diagonal().RowsAtCompileTime == m1.diagonal(N1).size()); + VERIFY(m1.template diagonal().RowsAtCompileTime == m1.diagonal(N2).size()); + } + + m2.template diagonal() = 2 * m1.template diagonal(); + VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N1)); + m2.template diagonal()[0] *= 3; + VERIFY_IS_APPROX(m2.template diagonal()[0], static_cast(6) * m1.template diagonal()[0]); + + + m2.template diagonal() = 2 * m1.template diagonal(); + m2.template diagonal()[0] *= 3; + VERIFY_IS_APPROX(m2.template diagonal()[0], static_cast(6) * m1.template diagonal()[0]); + + m2.diagonal(N1) = 2 * m1.diagonal(N1); + VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N1)); + m2.diagonal(N1)[0] *= 3; + VERIFY_IS_APPROX(m2.diagonal(N1)[0], static_cast(6) * m1.diagonal(N1)[0]); + + m2.diagonal(N2) = 2 * m1.diagonal(N2); + VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N2)); + m2.diagonal(N2)[0] *= 3; + VERIFY_IS_APPROX(m2.diagonal(N2)[0], static_cast(6) * m1.diagonal(N2)[0]); + + m2.diagonal(N2).x() = s1; + VERIFY_IS_APPROX(m2.diagonal(N2).x(), s1); + m2.diagonal(N2).coeffRef(0) = Scalar(2)*s1; + VERIFY_IS_APPROX(m2.diagonal(N2).coeff(0), Scalar(2)*s1); + } + + VERIFY( m1.diagonal( cols).size()==0 ); + VERIFY( m1.diagonal(-rows).size()==0 ); +} + +template void diagonal_assert(const MatrixType& m) { + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols); + + if (rows>=2 && cols>=2) + { + VERIFY_RAISES_ASSERT( m1 += m1.diagonal() ); + VERIFY_RAISES_ASSERT( m1 -= m1.diagonal() ); + VERIFY_RAISES_ASSERT( m1.array() *= m1.diagonal().array() ); + VERIFY_RAISES_ASSERT( m1.array() /= m1.diagonal().array() ); + } + + VERIFY_RAISES_ASSERT( m1.diagonal(cols+1) ); + VERIFY_RAISES_ASSERT( m1.diagonal(-(rows+1)) ); +} + +EIGEN_DECLARE_TEST(diagonal) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( diagonal(Matrix()) ); + CALL_SUBTEST_1( diagonal(Matrix()) ); + CALL_SUBTEST_1( diagonal(Matrix()) ); + CALL_SUBTEST_2( diagonal(Matrix4d()) ); + CALL_SUBTEST_2( diagonal(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_2( diagonal(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_2( diagonal(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_1( diagonal(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_1( diagonal(Matrix(3, 4)) ); + CALL_SUBTEST_1( diagonal_assert(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + } +} diff --git a/lib/eigen-3.4.0/test/diagonal_matrix_variadic_ctor.cpp b/lib/eigen-3.4.0/test/diagonal_matrix_variadic_ctor.cpp new file mode 100644 index 0000000..fbc8f84 --- /dev/null +++ b/lib/eigen-3.4.0/test/diagonal_matrix_variadic_ctor.cpp @@ -0,0 +1,185 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2019 David Tellenbach +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT + +#include "main.h" + +template +void assertionTest() +{ + typedef DiagonalMatrix DiagMatrix5; + typedef DiagonalMatrix DiagMatrix7; + typedef DiagonalMatrix DiagMatrixX; + + Scalar raw[6]; + for (int i = 0; i < 6; ++i) { + raw[i] = internal::random(); + } + + VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[2], raw[3]})); + VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[3]})); + VERIFY_RAISES_ASSERT((DiagMatrix7{raw[0], raw[1], raw[2], raw[3]})); + + VERIFY_RAISES_ASSERT((DiagMatrixX { + {raw[0], raw[1], raw[2]}, + {raw[3], raw[4], raw[5]} + })); +} + +#define VERIFY_IMPLICIT_CONVERSION_3(DIAGTYPE, V0, V1, V2) \ + DIAGTYPE d(V0, V1, V2); \ + DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ + VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ + VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ + VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); + +#define VERIFY_IMPLICIT_CONVERSION_4(DIAGTYPE, V0, V1, V2, V3) \ + DIAGTYPE d(V0, V1, V2, V3); \ + DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ + VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ + VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ + VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); \ + VERIFY_IS_APPROX(Dense(3, 3), (Scalar)V3); + +#define VERIFY_IMPLICIT_CONVERSION_5(DIAGTYPE, V0, V1, V2, V3, V4) \ + DIAGTYPE d(V0, V1, V2, V3, V4); \ + DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ + VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ + VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ + VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); \ + VERIFY_IS_APPROX(Dense(3, 3), (Scalar)V3); \ + VERIFY_IS_APPROX(Dense(4, 4), (Scalar)V4); + +template +void constructorTest() +{ + typedef DiagonalMatrix DiagonalMatrix0; + typedef DiagonalMatrix DiagonalMatrix3; + typedef DiagonalMatrix DiagonalMatrix4; + typedef DiagonalMatrix DiagonalMatrixX; + + Scalar raw[7]; + for (int k = 0; k < 7; ++k) raw[k] = internal::random(); + + // Fixed-sized matrices + { + DiagonalMatrix0 a {{}}; + VERIFY(a.rows() == 0); + VERIFY(a.cols() == 0); + typename DiagonalMatrix0::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrix3 a {{raw[0], raw[1], raw[2]}}; + VERIFY(a.rows() == 3); + VERIFY(a.cols() == 3); + typename DiagonalMatrix3::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrix4 a {{raw[0], raw[1], raw[2], raw[3]}}; + VERIFY(a.rows() == 4); + VERIFY(a.cols() == 4); + typename DiagonalMatrix4::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + + // dynamically sized matrices + { + DiagonalMatrixX a{{}}; + VERIFY(a.rows() == 0); + VERIFY(a.rows() == 0); + typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrixX a{{raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6]}}; + VERIFY(a.rows() == 7); + VERIFY(a.rows() == 7); + typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } +} + +template<> +void constructorTest() +{ + typedef float Scalar; + + typedef DiagonalMatrix DiagonalMatrix0; + typedef DiagonalMatrix DiagonalMatrix3; + typedef DiagonalMatrix DiagonalMatrix4; + typedef DiagonalMatrix DiagonalMatrix5; + typedef DiagonalMatrix DiagonalMatrixX; + + Scalar raw[7]; + for (int k = 0; k < 7; ++k) raw[k] = internal::random(); + + // Fixed-sized matrices + { + DiagonalMatrix0 a {{}}; + VERIFY(a.rows() == 0); + VERIFY(a.cols() == 0); + typename DiagonalMatrix0::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrix3 a {{raw[0], raw[1], raw[2]}}; + VERIFY(a.rows() == 3); + VERIFY(a.cols() == 3); + typename DiagonalMatrix3::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrix4 a {{raw[0], raw[1], raw[2], raw[3]}}; + VERIFY(a.rows() == 4); + VERIFY(a.cols() == 4); + typename DiagonalMatrix4::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + + // dynamically sized matrices + { + DiagonalMatrixX a{{}}; + VERIFY(a.rows() == 0); + VERIFY(a.rows() == 0); + typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { + DiagonalMatrixX a{{raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6]}}; + VERIFY(a.rows() == 7); + VERIFY(a.rows() == 7); + typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); + for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); + } + { VERIFY_IMPLICIT_CONVERSION_3(DiagonalMatrix3, 1.2647, 2.56f, -3); } + { VERIFY_IMPLICIT_CONVERSION_4(DiagonalMatrix4, 1.2647, 2.56f, -3, 3.23f); } + { VERIFY_IMPLICIT_CONVERSION_5(DiagonalMatrix5, 1.2647, 2.56f, -3, 3.23f, 2); } +} + +EIGEN_DECLARE_TEST(diagonal_matrix_variadic_ctor) +{ + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest()); + CALL_SUBTEST_1(assertionTest>()); + + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest()); + CALL_SUBTEST_2(constructorTest>()); +} diff --git a/lib/eigen-3.4.0/test/diagonalmatrices.cpp b/lib/eigen-3.4.0/test/diagonalmatrices.cpp new file mode 100644 index 0000000..276bead --- /dev/null +++ b/lib/eigen-3.4.0/test/diagonalmatrices.cpp @@ -0,0 +1,173 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +using namespace std; +template void diagonalmatrices(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; + typedef Matrix VectorType; + typedef Matrix RowVectorType; + typedef Matrix SquareMatrixType; + typedef Matrix DynMatrixType; + typedef DiagonalMatrix LeftDiagonalMatrix; + typedef DiagonalMatrix RightDiagonalMatrix; + typedef Matrix BigMatrix; + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols); + VectorType v1 = VectorType::Random(rows), + v2 = VectorType::Random(rows); + RowVectorType rv1 = RowVectorType::Random(cols), + rv2 = RowVectorType::Random(cols); + + LeftDiagonalMatrix ldm1(v1), ldm2(v2); + RightDiagonalMatrix rdm1(rv1), rdm2(rv2); + + Scalar s1 = internal::random(); + + SquareMatrixType sq_m1 (v1.asDiagonal()); + VERIFY_IS_APPROX(sq_m1, v1.asDiagonal().toDenseMatrix()); + sq_m1 = v1.asDiagonal(); + VERIFY_IS_APPROX(sq_m1, v1.asDiagonal().toDenseMatrix()); + SquareMatrixType sq_m2 = v1.asDiagonal(); + VERIFY_IS_APPROX(sq_m1, sq_m2); + + ldm1 = v1.asDiagonal(); + LeftDiagonalMatrix ldm3(v1); + VERIFY_IS_APPROX(ldm1.diagonal(), ldm3.diagonal()); + LeftDiagonalMatrix ldm4 = v1.asDiagonal(); + VERIFY_IS_APPROX(ldm1.diagonal(), ldm4.diagonal()); + + sq_m1.block(0,0,rows,rows) = ldm1; + VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix()); + sq_m1.transpose() = ldm1; + VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix()); + + Index i = internal::random(0, rows-1); + Index j = internal::random(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) ); + VERIFY_IS_APPROX( ((m1 * rdm1)(i,j)) , rdm1.diagonal()(j) * m1(i,j) ); + VERIFY_IS_APPROX( ((v1.asDiagonal() * m1)(i,j)) , v1(i) * m1(i,j) ); + VERIFY_IS_APPROX( ((m1 * rv1.asDiagonal())(i,j)) , rv1(j) * m1(i,j) ); + VERIFY_IS_APPROX( (((v1+v2).asDiagonal() * m1)(i,j)) , (v1+v2)(i) * m1(i,j) ); + VERIFY_IS_APPROX( (((v1+v2).asDiagonal() * (m1+m2))(i,j)) , (v1+v2)(i) * (m1+m2)(i,j) ); + VERIFY_IS_APPROX( ((m1 * (rv1+rv2).asDiagonal())(i,j)) , (rv1+rv2)(j) * m1(i,j) ); + VERIFY_IS_APPROX( (((m1+m2) * (rv1+rv2).asDiagonal())(i,j)) , (rv1+rv2)(j) * (m1+m2)(i,j) ); + + if(rows>1) + { + DynMatrixType tmp = m1.topRows(rows/2), res; + VERIFY_IS_APPROX( (res = m1.topRows(rows/2) * rv1.asDiagonal()), tmp * rv1.asDiagonal() ); + VERIFY_IS_APPROX( (res = v1.head(rows/2).asDiagonal()*m1.topRows(rows/2)), v1.head(rows/2).asDiagonal()*tmp ); + } + + BigMatrix big; + big.setZero(2*rows, 2*cols); + + big.block(i,j,rows,cols) = m1; + big.block(i,j,rows,cols) = v1.asDiagonal() * big.block(i,j,rows,cols); + + VERIFY_IS_APPROX((big.block(i,j,rows,cols)) , v1.asDiagonal() * m1 ); + + big.block(i,j,rows,cols) = m1; + big.block(i,j,rows,cols) = big.block(i,j,rows,cols) * rv1.asDiagonal(); + VERIFY_IS_APPROX((big.block(i,j,rows,cols)) , m1 * rv1.asDiagonal() ); + + + // scalar multiple + VERIFY_IS_APPROX(LeftDiagonalMatrix(ldm1*s1).diagonal(), ldm1.diagonal() * s1); + VERIFY_IS_APPROX(LeftDiagonalMatrix(s1*ldm1).diagonal(), s1 * ldm1.diagonal()); + + VERIFY_IS_APPROX(m1 * (rdm1 * s1), (m1 * rdm1) * s1); + VERIFY_IS_APPROX(m1 * (s1 * rdm1), (m1 * rdm1) * s1); + + // Diagonal to dense + sq_m1.setRandom(); + sq_m2 = sq_m1; + VERIFY_IS_APPROX( (sq_m1 += (s1*v1).asDiagonal()), sq_m2 += (s1*v1).asDiagonal().toDenseMatrix() ); + VERIFY_IS_APPROX( (sq_m1 -= (s1*v1).asDiagonal()), sq_m2 -= (s1*v1).asDiagonal().toDenseMatrix() ); + VERIFY_IS_APPROX( (sq_m1 = (s1*v1).asDiagonal()), (s1*v1).asDiagonal().toDenseMatrix() ); + + sq_m1.setRandom(); + sq_m2 = v1.asDiagonal(); + sq_m2 = sq_m1 * sq_m2; + VERIFY_IS_APPROX( (sq_m1*v1.asDiagonal()).col(i), sq_m2.col(i) ); + VERIFY_IS_APPROX( (sq_m1*v1.asDiagonal()).row(i), sq_m2.row(i) ); + + sq_m1 = v1.asDiagonal(); + sq_m2 = v2.asDiagonal(); + SquareMatrixType sq_m3 = v1.asDiagonal(); + VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() + v2.asDiagonal(), sq_m1 + sq_m2); + VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() - v2.asDiagonal(), sq_m1 - sq_m2); + VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() - 2*v2.asDiagonal() + v1.asDiagonal(), sq_m1 - 2*sq_m2 + sq_m1); +} + +template void as_scalar_product(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + typedef Matrix DynMatrixType; + typedef Matrix DynVectorType; + typedef Matrix DynRowVectorType; + + Index rows = m.rows(); + Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); + + VectorType v1 = VectorType::Random(rows); + DynVectorType dv1 = DynVectorType::Random(depth); + DynRowVectorType drv1 = DynRowVectorType::Random(depth); + DynMatrixType dm1 = dv1; + DynMatrixType drm1 = drv1; + + Scalar s = v1(0); + + VERIFY_IS_APPROX( v1.asDiagonal() * drv1, s*drv1 ); + VERIFY_IS_APPROX( dv1 * v1.asDiagonal(), dv1*s ); + + VERIFY_IS_APPROX( v1.asDiagonal() * drm1, s*drm1 ); + VERIFY_IS_APPROX( dm1 * v1.asDiagonal(), dm1*s ); +} + +template +void bug987() +{ + Matrix3Xd points = Matrix3Xd::Random(3, 3); + Vector2d diag = Vector2d::Random(); + Matrix2Xd tmp1 = points.topRows<2>(), res1, res2; + VERIFY_IS_APPROX( res1 = diag.asDiagonal() * points.topRows<2>(), res2 = diag.asDiagonal() * tmp1 ); + Matrix2d tmp2 = points.topLeftCorner<2,2>(); + VERIFY_IS_APPROX(( res1 = points.topLeftCorner<2,2>()*diag.asDiagonal()) , res2 = tmp2*diag.asDiagonal() ); +} + +EIGEN_DECLARE_TEST(diagonalmatrices) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( diagonalmatrices(Matrix()) ); + CALL_SUBTEST_1( as_scalar_product(Matrix()) ); + + CALL_SUBTEST_2( diagonalmatrices(Matrix3f()) ); + CALL_SUBTEST_3( diagonalmatrices(Matrix()) ); + CALL_SUBTEST_4( diagonalmatrices(Matrix4d()) ); + CALL_SUBTEST_5( diagonalmatrices(Matrix()) ); + CALL_SUBTEST_6( diagonalmatrices(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( as_scalar_product(MatrixXcf(1,1)) ); + CALL_SUBTEST_7( diagonalmatrices(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_8( diagonalmatrices(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_9( diagonalmatrices(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_9( diagonalmatrices(MatrixXf(1,1)) ); + CALL_SUBTEST_9( as_scalar_product(MatrixXf(1,1)) ); + } + CALL_SUBTEST_10( bug987<0>() ); +} diff --git a/lib/eigen-3.4.0/test/dontalign.cpp b/lib/eigen-3.4.0/test/dontalign.cpp new file mode 100644 index 0000000..2e4102b --- /dev/null +++ b/lib/eigen-3.4.0/test/dontalign.cpp @@ -0,0 +1,62 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_4 +#define EIGEN_DONT_ALIGN +#elif defined EIGEN_TEST_PART_5 || defined EIGEN_TEST_PART_6 || defined EIGEN_TEST_PART_7 || defined EIGEN_TEST_PART_8 +#define EIGEN_DONT_ALIGN_STATICALLY +#endif + +#include "main.h" +#include + +template +void dontalign(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + typedef Matrix SquareMatrixType; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType a = MatrixType::Random(rows,cols); + SquareMatrixType square = SquareMatrixType::Random(rows,rows); + VectorType v = VectorType::Random(rows); + + VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v)); + square = square.inverse().eval(); + a = square * a; + square = square*square; + v = square * v; + v = a.adjoint() * v; + VERIFY(square.determinant() != Scalar(0)); + + // bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed + Scalar* array = internal::aligned_new(rows); + v = VectorType::MapAligned(array, rows); + internal::aligned_delete(array, rows); +} + +EIGEN_DECLARE_TEST(dontalign) +{ +#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5 + dontalign(Matrix3d()); + dontalign(Matrix4f()); +#elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6 + dontalign(Matrix3cd()); + dontalign(Matrix4cf()); +#elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7 + dontalign(Matrix()); + dontalign(Matrix, 32, 32>()); +#elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8 + dontalign(MatrixXd(32, 32)); + dontalign(MatrixXcf(32, 32)); +#endif +} diff --git a/lib/eigen-3.4.0/test/dynalloc.cpp b/lib/eigen-3.4.0/test/dynalloc.cpp new file mode 100644 index 0000000..23c90a7 --- /dev/null +++ b/lib/eigen-3.4.0/test/dynalloc.cpp @@ -0,0 +1,177 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +#if EIGEN_MAX_ALIGN_BYTES>0 +#define ALIGNMENT EIGEN_MAX_ALIGN_BYTES +#else +#define ALIGNMENT 1 +#endif + +typedef Matrix Vector16f; +typedef Matrix Vector8f; + +void check_handmade_aligned_malloc() +{ + for(int i = 1; i < 1000; i++) + { + char *p = (char*)internal::handmade_aligned_malloc(i); + VERIFY(internal::UIntPtr(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; + internal::handmade_aligned_free(p); + } +} + +void check_aligned_malloc() +{ + for(int i = ALIGNMENT; i < 1000; i++) + { + char *p = (char*)internal::aligned_malloc(i); + VERIFY(internal::UIntPtr(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; + internal::aligned_free(p); + } +} + +void check_aligned_new() +{ + for(int i = ALIGNMENT; i < 1000; i++) + { + float *p = internal::aligned_new(i); + VERIFY(internal::UIntPtr(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; + internal::aligned_delete(p,i); + } +} + +void check_aligned_stack_alloc() +{ + for(int i = ALIGNMENT; i < 400; i++) + { + ei_declare_aligned_stack_constructed_variable(float,p,i,0); + VERIFY(internal::UIntPtr(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; + } +} + + +// test compilation with both a struct and a class... +struct MyStruct +{ + EIGEN_MAKE_ALIGNED_OPERATOR_NEW + char dummychar; + Vector16f avec; +}; + +class MyClassA +{ + public: + EIGEN_MAKE_ALIGNED_OPERATOR_NEW + char dummychar; + Vector16f avec; +}; + +template void check_dynaligned() +{ + // TODO have to be updated once we support multiple alignment values + if(T::SizeAtCompileTime % ALIGNMENT == 0) + { + T* obj = new T; + VERIFY(T::NeedsToAlign==1); + VERIFY(internal::UIntPtr(obj)%ALIGNMENT==0); + delete obj; + } +} + +template void check_custom_new_delete() +{ + { + T* t = new T; + delete t; + } + + { + std::size_t N = internal::random(1,10); + T* t = new T[N]; + delete[] t; + } + +#if EIGEN_MAX_ALIGN_BYTES>0 && (!EIGEN_HAS_CXX17_OVERALIGN) + { + T* t = static_cast((T::operator new)(sizeof(T))); + (T::operator delete)(t, sizeof(T)); + } + + { + T* t = static_cast((T::operator new)(sizeof(T))); + (T::operator delete)(t); + } +#endif +} + +EIGEN_DECLARE_TEST(dynalloc) +{ + // low level dynamic memory allocation + CALL_SUBTEST(check_handmade_aligned_malloc()); + CALL_SUBTEST(check_aligned_malloc()); + CALL_SUBTEST(check_aligned_new()); + CALL_SUBTEST(check_aligned_stack_alloc()); + + for (int i=0; i() ); + CALL_SUBTEST( check_custom_new_delete() ); + CALL_SUBTEST( check_custom_new_delete() ); + CALL_SUBTEST( check_custom_new_delete() ); + } + + // check static allocation, who knows ? + #if EIGEN_MAX_STATIC_ALIGN_BYTES + for (int i=0; i() ); + CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); + } + + { + MyStruct foo0; VERIFY(internal::UIntPtr(foo0.avec.data())%ALIGNMENT==0); + MyClassA fooA; VERIFY(internal::UIntPtr(fooA.avec.data())%ALIGNMENT==0); + } + + // dynamic allocation, single object + for (int i=0; iavec.data())%ALIGNMENT==0); + MyClassA *fooA = new MyClassA(); VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); + delete foo0; + delete fooA; + } + + // dynamic allocation, array + const int N = 10; + for (int i=0; iavec.data())%ALIGNMENT==0); + MyClassA *fooA = new MyClassA[N]; VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); + delete[] foo0; + delete[] fooA; + } + #endif + +} diff --git a/lib/eigen-3.4.0/test/eigen2support.cpp b/lib/eigen-3.4.0/test/eigen2support.cpp new file mode 100644 index 0000000..49d7328 --- /dev/null +++ b/lib/eigen-3.4.0/test/eigen2support.cpp @@ -0,0 +1,65 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN2_SUPPORT + +#include "main.h" + +template void eigen2support(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m3(rows, cols); + + Scalar s1 = internal::random(), + s2 = internal::random(); + + // scalar addition + VERIFY_IS_APPROX(m1.cwise() + s1, s1 + m1.cwise()); + VERIFY_IS_APPROX(m1.cwise() + s1, MatrixType::Constant(rows,cols,s1) + m1); + VERIFY_IS_APPROX((m1*Scalar(2)).cwise() - s2, (m1+m1) - MatrixType::Constant(rows,cols,s2) ); + m3 = m1; + m3.cwise() += s2; + VERIFY_IS_APPROX(m3, m1.cwise() + s2); + m3 = m1; + m3.cwise() -= s1; + VERIFY_IS_APPROX(m3, m1.cwise() - s1); + + VERIFY_IS_EQUAL((m1.corner(TopLeft,1,1)), (m1.block(0,0,1,1))); + VERIFY_IS_EQUAL((m1.template corner<1,1>(TopLeft)), (m1.template block<1,1>(0,0))); + VERIFY_IS_EQUAL((m1.col(0).start(1)), (m1.col(0).segment(0,1))); + VERIFY_IS_EQUAL((m1.col(0).template start<1>()), (m1.col(0).segment(0,1))); + VERIFY_IS_EQUAL((m1.col(0).end(1)), (m1.col(0).segment(rows-1,1))); + VERIFY_IS_EQUAL((m1.col(0).template end<1>()), (m1.col(0).segment(rows-1,1))); + + using std::cos; + using numext::real; + using numext::abs2; + VERIFY_IS_EQUAL(ei_cos(s1), cos(s1)); + VERIFY_IS_EQUAL(ei_real(s1), real(s1)); + VERIFY_IS_EQUAL(ei_abs2(s1), abs2(s1)); + + m1.minor(0,0); +} + +EIGEN_DECLARE_TEST(eigen2support) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( eigen2support(Matrix()) ); + CALL_SUBTEST_2( eigen2support(MatrixXd(1,1)) ); + CALL_SUBTEST_4( eigen2support(Matrix3f()) ); + CALL_SUBTEST_5( eigen2support(Matrix4d()) ); + CALL_SUBTEST_2( eigen2support(MatrixXf(200,200)) ); + CALL_SUBTEST_6( eigen2support(MatrixXcd(100,100)) ); + } +} diff --git a/lib/eigen-3.4.0/test/eigensolver_complex.cpp b/lib/eigen-3.4.0/test/eigensolver_complex.cpp new file mode 100644 index 0000000..c5373f4 --- /dev/null +++ b/lib/eigen-3.4.0/test/eigensolver_complex.cpp @@ -0,0 +1,176 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2010 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +template bool find_pivot(typename MatrixType::Scalar tol, MatrixType &diffs, Index col=0) +{ + bool match = diffs.diagonal().sum() <= tol; + if(match || col==diffs.cols()) + { + return match; + } + else + { + Index n = diffs.cols(); + std::vector > transpositions; + for(Index i=col; i tol) + break; + + best_index += col; + + diffs.row(col).swap(diffs.row(best_index)); + if(find_pivot(tol,diffs,col+1)) return true; + diffs.row(col).swap(diffs.row(best_index)); + + // move current pivot to the end + diffs.row(n-(i-col)-1).swap(diffs.row(best_index)); + transpositions.push_back(std::pair(n-(i-col)-1,best_index)); + } + // restore + for(Index k=transpositions.size()-1; k>=0; --k) + diffs.row(transpositions[k].first).swap(diffs.row(transpositions[k].second)); + } + return false; +} + +/* Check that two column vectors are approximately equal up to permutations. + * Initially, this method checked that the k-th power sums are equal for all k = 1, ..., vec1.rows(), + * however this strategy is numerically inacurate because of numerical cancellation issues. + */ +template +void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& vec2) +{ + typedef typename VectorType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + VERIFY(vec1.cols() == 1); + VERIFY(vec2.cols() == 1); + VERIFY(vec1.rows() == vec2.rows()); + + Index n = vec1.rows(); + RealScalar tol = test_precision()*test_precision()*numext::maxi(vec1.squaredNorm(),vec2.squaredNorm()); + Matrix diffs = (vec1.rowwise().replicate(n) - vec2.rowwise().replicate(n).transpose()).cwiseAbs2(); + + VERIFY( find_pivot(tol, diffs) ); +} + + +template void eigensolver(const MatrixType& m) +{ + /* this test covers the following files: + ComplexEigenSolver.h, and indirectly ComplexSchur.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + MatrixType a = MatrixType::Random(rows,cols); + MatrixType symmA = a.adjoint() * a; + + ComplexEigenSolver ei0(symmA); + VERIFY_IS_EQUAL(ei0.info(), Success); + VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal()); + + ComplexEigenSolver ei1(a); + VERIFY_IS_EQUAL(ei1.info(), Success); + VERIFY_IS_APPROX(a * ei1.eigenvectors(), ei1.eigenvectors() * ei1.eigenvalues().asDiagonal()); + // Note: If MatrixType is real then a.eigenvalues() uses EigenSolver and thus + // another algorithm so results may differ slightly + verify_is_approx_upto_permutation(a.eigenvalues(), ei1.eigenvalues()); + + ComplexEigenSolver ei2; + ei2.setMaxIterations(ComplexSchur::m_maxIterationsPerRow * rows).compute(a); + VERIFY_IS_EQUAL(ei2.info(), Success); + VERIFY_IS_EQUAL(ei2.eigenvectors(), ei1.eigenvectors()); + VERIFY_IS_EQUAL(ei2.eigenvalues(), ei1.eigenvalues()); + if (rows > 2) { + ei2.setMaxIterations(1).compute(a); + VERIFY_IS_EQUAL(ei2.info(), NoConvergence); + VERIFY_IS_EQUAL(ei2.getMaxIterations(), 1); + } + + ComplexEigenSolver eiNoEivecs(a, false); + VERIFY_IS_EQUAL(eiNoEivecs.info(), Success); + VERIFY_IS_APPROX(ei1.eigenvalues(), eiNoEivecs.eigenvalues()); + + // Regression test for issue #66 + MatrixType z = MatrixType::Zero(rows,cols); + ComplexEigenSolver eiz(z); + VERIFY((eiz.eigenvalues().cwiseEqual(0)).all()); + + MatrixType id = MatrixType::Identity(rows, cols); + VERIFY_IS_APPROX(id.operatorNorm(), RealScalar(1)); + + if (rows > 1 && rows < 20) + { + // Test matrix with NaN + a(0,0) = std::numeric_limits::quiet_NaN(); + ComplexEigenSolver eiNaN(a); + VERIFY_IS_EQUAL(eiNaN.info(), NoConvergence); + } + + // regression test for bug 1098 + { + ComplexEigenSolver eig(a.adjoint() * a); + eig.compute(a.adjoint() * a); + } + + // regression test for bug 478 + { + a.setZero(); + ComplexEigenSolver ei3(a); + VERIFY_IS_EQUAL(ei3.info(), Success); + VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); + VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); + } +} + +template void eigensolver_verify_assert(const MatrixType& m) +{ + ComplexEigenSolver eig; + VERIFY_RAISES_ASSERT(eig.eigenvectors()); + VERIFY_RAISES_ASSERT(eig.eigenvalues()); + + MatrixType a = MatrixType::Random(m.rows(),m.cols()); + eig.compute(a, false); + VERIFY_RAISES_ASSERT(eig.eigenvectors()); +} + +EIGEN_DECLARE_TEST(eigensolver_complex) +{ + int s = 0; + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( eigensolver(Matrix4cf()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_2( eigensolver(MatrixXcd(s,s)) ); + CALL_SUBTEST_3( eigensolver(Matrix, 1, 1>()) ); + CALL_SUBTEST_4( eigensolver(Matrix3f()) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + } + CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4cf()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXcd(s,s)) ); + CALL_SUBTEST_3( eigensolver_verify_assert(Matrix, 1, 1>()) ); + CALL_SUBTEST_4( eigensolver_verify_assert(Matrix3f()) ); + + // Test problem size constructors + CALL_SUBTEST_5(ComplexEigenSolver tmp(s)); + + TEST_SET_BUT_UNUSED_VARIABLE(s) +} diff --git a/lib/eigen-3.4.0/test/eigensolver_generalized_real.cpp b/lib/eigen-3.4.0/test/eigensolver_generalized_real.cpp new file mode 100644 index 0000000..95ed431 --- /dev/null +++ b/lib/eigen-3.4.0/test/eigensolver_generalized_real.cpp @@ -0,0 +1,103 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012-2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_RUNTIME_NO_MALLOC +#include "main.h" +#include +#include +#include + +template void generalized_eigensolver_real(const MatrixType& m) +{ + /* this test covers the following files: + GeneralizedEigenSolver.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef std::complex ComplexScalar; + typedef Matrix VectorType; + + MatrixType a = MatrixType::Random(rows,cols); + MatrixType b = MatrixType::Random(rows,cols); + MatrixType a1 = MatrixType::Random(rows,cols); + MatrixType b1 = MatrixType::Random(rows,cols); + MatrixType spdA = a.adjoint() * a + a1.adjoint() * a1; + MatrixType spdB = b.adjoint() * b + b1.adjoint() * b1; + + // lets compare to GeneralizedSelfAdjointEigenSolver + { + GeneralizedSelfAdjointEigenSolver symmEig(spdA, spdB); + GeneralizedEigenSolver eig(spdA, spdB); + + VERIFY_IS_EQUAL(eig.eigenvalues().imag().cwiseAbs().maxCoeff(), 0); + + VectorType realEigenvalues = eig.eigenvalues().real(); + std::sort(realEigenvalues.data(), realEigenvalues.data()+realEigenvalues.size()); + VERIFY_IS_APPROX(realEigenvalues, symmEig.eigenvalues()); + + // check eigenvectors + typename GeneralizedEigenSolver::EigenvectorsType D = eig.eigenvalues().asDiagonal(); + typename GeneralizedEigenSolver::EigenvectorsType V = eig.eigenvectors(); + VERIFY_IS_APPROX(spdA*V, spdB*V*D); + } + + // non symmetric case: + { + GeneralizedEigenSolver eig(rows); + // TODO enable full-prealocation of required memory, this probably requires an in-place mode for HessenbergDecomposition + //Eigen::internal::set_is_malloc_allowed(false); + eig.compute(a,b); + //Eigen::internal::set_is_malloc_allowed(true); + for(Index k=0; k tmp = (eig.betas()(k)*a).template cast() - eig.alphas()(k)*b; + if(tmp.size()>1 && tmp.norm()>(std::numeric_limits::min)()) + tmp /= tmp.norm(); + VERIFY_IS_MUCH_SMALLER_THAN( std::abs(tmp.determinant()), Scalar(1) ); + } + // check eigenvectors + typename GeneralizedEigenSolver::EigenvectorsType D = eig.eigenvalues().asDiagonal(); + typename GeneralizedEigenSolver::EigenvectorsType V = eig.eigenvectors(); + VERIFY_IS_APPROX(a*V, b*V*D); + } + + // regression test for bug 1098 + { + GeneralizedSelfAdjointEigenSolver eig1(a.adjoint() * a,b.adjoint() * b); + eig1.compute(a.adjoint() * a,b.adjoint() * b); + GeneralizedEigenSolver eig2(a.adjoint() * a,b.adjoint() * b); + eig2.compute(a.adjoint() * a,b.adjoint() * b); + } + + // check without eigenvectors + { + GeneralizedEigenSolver eig1(spdA, spdB, true); + GeneralizedEigenSolver eig2(spdA, spdB, false); + VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues()); + } +} + +EIGEN_DECLARE_TEST(eigensolver_generalized_real) +{ + for(int i = 0; i < g_repeat; i++) { + int s = 0; + CALL_SUBTEST_1( generalized_eigensolver_real(Matrix4f()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(s,s)) ); + + // some trivial but implementation-wise special cases + CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(1,1)) ); + CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(2,2)) ); + CALL_SUBTEST_3( generalized_eigensolver_real(Matrix()) ); + CALL_SUBTEST_4( generalized_eigensolver_real(Matrix2d()) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + } +} diff --git a/lib/eigen-3.4.0/test/eigensolver_generic.cpp b/lib/eigen-3.4.0/test/eigensolver_generic.cpp new file mode 100644 index 0000000..7adb986 --- /dev/null +++ b/lib/eigen-3.4.0/test/eigensolver_generic.cpp @@ -0,0 +1,247 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2010,2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include + +template +void check_eigensolver_for_given_mat(const EigType &eig, const MatType& a) +{ + typedef typename NumTraits::Real RealScalar; + typedef Matrix RealVectorType; + typedef typename std::complex Complex; + Index n = a.rows(); + VERIFY_IS_EQUAL(eig.info(), Success); + VERIFY_IS_APPROX(a * eig.pseudoEigenvectors(), eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()); + VERIFY_IS_APPROX(a.template cast() * eig.eigenvectors(), + eig.eigenvectors() * eig.eigenvalues().asDiagonal()); + VERIFY_IS_APPROX(eig.eigenvectors().colwise().norm(), RealVectorType::Ones(n).transpose()); + VERIFY_IS_APPROX(a.eigenvalues(), eig.eigenvalues()); +} + +template void eigensolver(const MatrixType& m) +{ + /* this test covers the following files: + EigenSolver.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef typename std::complex Complex; + + MatrixType a = MatrixType::Random(rows,cols); + MatrixType a1 = MatrixType::Random(rows,cols); + MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1; + + EigenSolver ei0(symmA); + VERIFY_IS_EQUAL(ei0.info(), Success); + VERIFY_IS_APPROX(symmA * ei0.pseudoEigenvectors(), ei0.pseudoEigenvectors() * ei0.pseudoEigenvalueMatrix()); + VERIFY_IS_APPROX((symmA.template cast()) * (ei0.pseudoEigenvectors().template cast()), + (ei0.pseudoEigenvectors().template cast()) * (ei0.eigenvalues().asDiagonal())); + + EigenSolver ei1(a); + CALL_SUBTEST( check_eigensolver_for_given_mat(ei1,a) ); + + EigenSolver ei2; + ei2.setMaxIterations(RealSchur::m_maxIterationsPerRow * rows).compute(a); + VERIFY_IS_EQUAL(ei2.info(), Success); + VERIFY_IS_EQUAL(ei2.eigenvectors(), ei1.eigenvectors()); + VERIFY_IS_EQUAL(ei2.eigenvalues(), ei1.eigenvalues()); + if (rows > 2) { + ei2.setMaxIterations(1).compute(a); + VERIFY_IS_EQUAL(ei2.info(), NoConvergence); + VERIFY_IS_EQUAL(ei2.getMaxIterations(), 1); + } + + EigenSolver eiNoEivecs(a, false); + VERIFY_IS_EQUAL(eiNoEivecs.info(), Success); + VERIFY_IS_APPROX(ei1.eigenvalues(), eiNoEivecs.eigenvalues()); + VERIFY_IS_APPROX(ei1.pseudoEigenvalueMatrix(), eiNoEivecs.pseudoEigenvalueMatrix()); + + MatrixType id = MatrixType::Identity(rows, cols); + VERIFY_IS_APPROX(id.operatorNorm(), RealScalar(1)); + + if (rows > 2 && rows < 20) + { + // Test matrix with NaN + a(0,0) = std::numeric_limits::quiet_NaN(); + EigenSolver eiNaN(a); + VERIFY_IS_NOT_EQUAL(eiNaN.info(), Success); + } + + // regression test for bug 1098 + { + EigenSolver eig(a.adjoint() * a); + eig.compute(a.adjoint() * a); + } + + // regression test for bug 478 + { + a.setZero(); + EigenSolver ei3(a); + VERIFY_IS_EQUAL(ei3.info(), Success); + VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); + VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); + } +} + +template void eigensolver_verify_assert(const MatrixType& m) +{ + EigenSolver eig; + VERIFY_RAISES_ASSERT(eig.eigenvectors()); + VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); + VERIFY_RAISES_ASSERT(eig.pseudoEigenvalueMatrix()); + VERIFY_RAISES_ASSERT(eig.eigenvalues()); + + MatrixType a = MatrixType::Random(m.rows(),m.cols()); + eig.compute(a, false); + VERIFY_RAISES_ASSERT(eig.eigenvectors()); + VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); +} + + +template +Matrix +make_companion(const CoeffType& coeffs) +{ + Index n = coeffs.size()-1; + Matrix res(n,n); + res.setZero(); + res.row(0) = -coeffs.tail(n) / coeffs(0); + res.diagonal(-1).setOnes(); + return res; +} + +template +void eigensolver_generic_extra() +{ + { + // regression test for bug 793 + MatrixXd a(3,3); + a << 0, 0, 1, + 1, 1, 1, + 1, 1e+200, 1; + Eigen::EigenSolver eig(a); + double scale = 1e-200; // scale to avoid overflow during the comparisons + VERIFY_IS_APPROX(a * eig.pseudoEigenvectors()*scale, eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()*scale); + VERIFY_IS_APPROX(a * eig.eigenvectors()*scale, eig.eigenvectors() * eig.eigenvalues().asDiagonal()*scale); + } + { + // check a case where all eigenvalues are null. + MatrixXd a(2,2); + a << 1, 1, + -1, -1; + Eigen::EigenSolver eig(a); + VERIFY_IS_APPROX(eig.pseudoEigenvectors().squaredNorm(), 2.); + VERIFY_IS_APPROX((a * eig.pseudoEigenvectors()).norm()+1., 1.); + VERIFY_IS_APPROX((eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()).norm()+1., 1.); + VERIFY_IS_APPROX((a * eig.eigenvectors()).norm()+1., 1.); + VERIFY_IS_APPROX((eig.eigenvectors() * eig.eigenvalues().asDiagonal()).norm()+1., 1.); + } + + // regression test for bug 933 + { + { + VectorXd coeffs(5); coeffs << 1, -3, -175, -225, 2250; + MatrixXd C = make_companion(coeffs); + EigenSolver eig(C); + CALL_SUBTEST( check_eigensolver_for_given_mat(eig,C) ); + } + { + // this test is tricky because it requires high accuracy in smallest eigenvalues + VectorXd coeffs(5); coeffs << 6.154671e-15, -1.003870e-10, -9.819570e-01, 3.995715e+03, 2.211511e+08; + MatrixXd C = make_companion(coeffs); + EigenSolver eig(C); + CALL_SUBTEST( check_eigensolver_for_given_mat(eig,C) ); + Index n = C.rows(); + for(Index i=0;i Complex; + MatrixXcd ac = C.cast(); + ac.diagonal().array() -= eig.eigenvalues()(i); + VectorXd sv = ac.jacobiSvd().singularValues(); + // comparing to sv(0) is not enough here to catch the "bug", + // the hard-coded 1.0 is important! + VERIFY_IS_MUCH_SMALLER_THAN(sv(n-1), 1.0); + } + } + } + // regression test for bug 1557 + { + // this test is interesting because it contains zeros on the diagonal. + MatrixXd A_bug1557(3,3); + A_bug1557 << 0, 0, 0, 1, 0, 0.5887907064808635127, 0, 1, 0; + EigenSolver eig(A_bug1557); + CALL_SUBTEST( check_eigensolver_for_given_mat(eig,A_bug1557) ); + } + + // regression test for bug 1174 + { + Index n = 12; + MatrixXf A_bug1174(n,n); + A_bug1174 << 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, + 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, + 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, + 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, + 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0; + EigenSolver eig(A_bug1174); + CALL_SUBTEST( check_eigensolver_for_given_mat(eig,A_bug1174) ); + } +} + +EIGEN_DECLARE_TEST(eigensolver_generic) +{ + int s = 0; + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( eigensolver(Matrix4f()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + + // some trivial but implementation-wise tricky cases + CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) ); + CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) ); + CALL_SUBTEST_3( eigensolver(Matrix()) ); + CALL_SUBTEST_4( eigensolver(Matrix2d()) ); + } + + CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) ); + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) ); + CALL_SUBTEST_3( eigensolver_verify_assert(Matrix()) ); + CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) ); + + // Test problem size constructors + CALL_SUBTEST_5(EigenSolver tmp(s)); + + // regression test for bug 410 + CALL_SUBTEST_2( + { + MatrixXd A(1,1); + A(0,0) = std::sqrt(-1.); // is Not-a-Number + Eigen::EigenSolver solver(A); + VERIFY_IS_EQUAL(solver.info(), NumericalIssue); + } + ); + + CALL_SUBTEST_2( eigensolver_generic_extra<0>() ); + + TEST_SET_BUT_UNUSED_VARIABLE(s) +} diff --git a/lib/eigen-3.4.0/test/eigensolver_selfadjoint.cpp b/lib/eigen-3.4.0/test/eigensolver_selfadjoint.cpp new file mode 100644 index 0000000..0fb2f4d --- /dev/null +++ b/lib/eigen-3.4.0/test/eigensolver_selfadjoint.cpp @@ -0,0 +1,281 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2010 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include "svd_fill.h" +#include +#include +#include + + +template void selfadjointeigensolver_essential_check(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + RealScalar eival_eps = numext::mini(test_precision(), NumTraits::dummy_precision()*20000); + + SelfAdjointEigenSolver eiSymm(m); + VERIFY_IS_EQUAL(eiSymm.info(), Success); + + RealScalar scaling = m.cwiseAbs().maxCoeff(); + + if(scaling<(std::numeric_limits::min)()) + { + VERIFY(eiSymm.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits::min)()); + } + else + { + VERIFY_IS_APPROX((m.template selfadjointView() * eiSymm.eigenvectors())/scaling, + (eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal())/scaling); + } + VERIFY_IS_APPROX(m.template selfadjointView().eigenvalues(), eiSymm.eigenvalues()); + VERIFY_IS_UNITARY(eiSymm.eigenvectors()); + + if(m.cols()<=4) + { + SelfAdjointEigenSolver eiDirect; + eiDirect.computeDirect(m); + VERIFY_IS_EQUAL(eiDirect.info(), Success); + if(! eiSymm.eigenvalues().isApprox(eiDirect.eigenvalues(), eival_eps) ) + { + std::cerr << "reference eigenvalues: " << eiSymm.eigenvalues().transpose() << "\n" + << "obtained eigenvalues: " << eiDirect.eigenvalues().transpose() << "\n" + << "diff: " << (eiSymm.eigenvalues()-eiDirect.eigenvalues()).transpose() << "\n" + << "error (eps): " << (eiSymm.eigenvalues()-eiDirect.eigenvalues()).norm() / eiSymm.eigenvalues().norm() << " (" << eival_eps << ")\n"; + } + if(scaling<(std::numeric_limits::min)()) + { + VERIFY(eiDirect.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits::min)()); + } + else + { + VERIFY_IS_APPROX(eiSymm.eigenvalues()/scaling, eiDirect.eigenvalues()/scaling); + VERIFY_IS_APPROX((m.template selfadjointView() * eiDirect.eigenvectors())/scaling, + (eiDirect.eigenvectors() * eiDirect.eigenvalues().asDiagonal())/scaling); + VERIFY_IS_APPROX(m.template selfadjointView().eigenvalues()/scaling, eiDirect.eigenvalues()/scaling); + } + + VERIFY_IS_UNITARY(eiDirect.eigenvectors()); + } +} + +template void selfadjointeigensolver(const MatrixType& m) +{ + /* this test covers the following files: + EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h) + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + RealScalar largerEps = 10*test_precision(); + + MatrixType a = MatrixType::Random(rows,cols); + MatrixType a1 = MatrixType::Random(rows,cols); + MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1; + MatrixType symmC = symmA; + + svd_fill_random(symmA,Symmetric); + + symmA.template triangularView().setZero(); + symmC.template triangularView().setZero(); + + MatrixType b = MatrixType::Random(rows,cols); + MatrixType b1 = MatrixType::Random(rows,cols); + MatrixType symmB = b.adjoint() * b + b1.adjoint() * b1; + symmB.template triangularView().setZero(); + + CALL_SUBTEST( selfadjointeigensolver_essential_check(symmA) ); + + SelfAdjointEigenSolver eiSymm(symmA); + // generalized eigen pb + GeneralizedSelfAdjointEigenSolver eiSymmGen(symmC, symmB); + + SelfAdjointEigenSolver eiSymmNoEivecs(symmA, false); + VERIFY_IS_EQUAL(eiSymmNoEivecs.info(), Success); + VERIFY_IS_APPROX(eiSymm.eigenvalues(), eiSymmNoEivecs.eigenvalues()); + + // generalized eigen problem Ax = lBx + eiSymmGen.compute(symmC, symmB,Ax_lBx); + VERIFY_IS_EQUAL(eiSymmGen.info(), Success); + VERIFY((symmC.template selfadjointView() * eiSymmGen.eigenvectors()).isApprox( + symmB.template selfadjointView() * (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); + + // generalized eigen problem BAx = lx + eiSymmGen.compute(symmC, symmB,BAx_lx); + VERIFY_IS_EQUAL(eiSymmGen.info(), Success); + VERIFY((symmB.template selfadjointView() * (symmC.template selfadjointView() * eiSymmGen.eigenvectors())).isApprox( + (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); + + // generalized eigen problem ABx = lx + eiSymmGen.compute(symmC, symmB,ABx_lx); + VERIFY_IS_EQUAL(eiSymmGen.info(), Success); + VERIFY((symmC.template selfadjointView() * (symmB.template selfadjointView() * eiSymmGen.eigenvectors())).isApprox( + (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); + + + eiSymm.compute(symmC); + MatrixType sqrtSymmA = eiSymm.operatorSqrt(); + VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), sqrtSymmA*sqrtSymmA); + VERIFY_IS_APPROX(sqrtSymmA, symmC.template selfadjointView()*eiSymm.operatorInverseSqrt()); + + MatrixType id = MatrixType::Identity(rows, cols); + VERIFY_IS_APPROX(id.template selfadjointView().operatorNorm(), RealScalar(1)); + + SelfAdjointEigenSolver eiSymmUninitialized; + VERIFY_RAISES_ASSERT(eiSymmUninitialized.info()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvalues()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvectors()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorSqrt()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorInverseSqrt()); + + eiSymmUninitialized.compute(symmA, false); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvectors()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorSqrt()); + VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorInverseSqrt()); + + // test Tridiagonalization's methods + Tridiagonalization tridiag(symmC); + VERIFY_IS_APPROX(tridiag.diagonal(), tridiag.matrixT().diagonal()); + VERIFY_IS_APPROX(tridiag.subDiagonal(), tridiag.matrixT().template diagonal<-1>()); + Matrix T = tridiag.matrixT(); + if(rows>1 && cols>1) { + // FIXME check that upper and lower part are 0: + //VERIFY(T.topRightCorner(rows-2, cols-2).template triangularView().isZero()); + } + VERIFY_IS_APPROX(tridiag.diagonal(), T.diagonal()); + VERIFY_IS_APPROX(tridiag.subDiagonal(), T.template diagonal<1>()); + VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), tridiag.matrixQ() * tridiag.matrixT().eval() * MatrixType(tridiag.matrixQ()).adjoint()); + VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), tridiag.matrixQ() * tridiag.matrixT() * tridiag.matrixQ().adjoint()); + + // Test computation of eigenvalues from tridiagonal matrix + if(rows > 1) + { + SelfAdjointEigenSolver eiSymmTridiag; + eiSymmTridiag.computeFromTridiagonal(tridiag.matrixT().diagonal(), tridiag.matrixT().diagonal(-1), ComputeEigenvectors); + VERIFY_IS_APPROX(eiSymm.eigenvalues(), eiSymmTridiag.eigenvalues()); + VERIFY_IS_APPROX(tridiag.matrixT(), eiSymmTridiag.eigenvectors().real() * eiSymmTridiag.eigenvalues().asDiagonal() * eiSymmTridiag.eigenvectors().real().transpose()); + } + + if (rows > 1 && rows < 20) + { + // Test matrix with NaN + symmC(0,0) = std::numeric_limits::quiet_NaN(); + SelfAdjointEigenSolver eiSymmNaN(symmC); + VERIFY_IS_EQUAL(eiSymmNaN.info(), NoConvergence); + } + + // regression test for bug 1098 + { + SelfAdjointEigenSolver eig(a.adjoint() * a); + eig.compute(a.adjoint() * a); + } + + // regression test for bug 478 + { + a.setZero(); + SelfAdjointEigenSolver ei3(a); + VERIFY_IS_EQUAL(ei3.info(), Success); + VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); + VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); + } +} + +template +void bug_854() +{ + Matrix3d m; + m << 850.961, 51.966, 0, + 51.966, 254.841, 0, + 0, 0, 0; + selfadjointeigensolver_essential_check(m); +} + +template +void bug_1014() +{ + Matrix3d m; + m << 0.11111111111111114658, 0, 0, + 0, 0.11111111111111109107, 0, + 0, 0, 0.11111111111111107719; + selfadjointeigensolver_essential_check(m); +} + +template +void bug_1225() +{ + Matrix3d m1, m2; + m1.setRandom(); + m1 = m1*m1.transpose(); + m2 = m1.triangularView(); + SelfAdjointEigenSolver eig1(m1); + SelfAdjointEigenSolver eig2(m2.selfadjointView()); + VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues()); +} + +template +void bug_1204() +{ + SparseMatrix A(2,2); + A.setIdentity(); + SelfAdjointEigenSolver > eig(A); +} + +EIGEN_DECLARE_TEST(eigensolver_selfadjoint) +{ + int s = 0; + for(int i = 0; i < g_repeat; i++) { + + // trivial test for 1x1 matrices: + CALL_SUBTEST_1( selfadjointeigensolver(Matrix())); + CALL_SUBTEST_1( selfadjointeigensolver(Matrix())); + CALL_SUBTEST_1( selfadjointeigensolver(Matrix, 1, 1>())); + + // very important to test 3x3 and 2x2 matrices since we provide special paths for them + CALL_SUBTEST_12( selfadjointeigensolver(Matrix2f()) ); + CALL_SUBTEST_12( selfadjointeigensolver(Matrix2d()) ); + CALL_SUBTEST_12( selfadjointeigensolver(Matrix2cd()) ); + CALL_SUBTEST_13( selfadjointeigensolver(Matrix3f()) ); + CALL_SUBTEST_13( selfadjointeigensolver(Matrix3d()) ); + CALL_SUBTEST_13( selfadjointeigensolver(Matrix3cd()) ); + CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) ); + CALL_SUBTEST_2( selfadjointeigensolver(Matrix4cd()) ); + + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(s,s)) ); + CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(s,s)) ); + CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(s,s)) ); + CALL_SUBTEST_9( selfadjointeigensolver(Matrix,Dynamic,Dynamic,RowMajor>(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + + // some trivial but implementation-wise tricky cases + CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(1,1)) ); + CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(2,2)) ); + CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(1,1)) ); + CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(2,2)) ); + CALL_SUBTEST_6( selfadjointeigensolver(Matrix()) ); + CALL_SUBTEST_7( selfadjointeigensolver(Matrix()) ); + } + + CALL_SUBTEST_13( bug_854<0>() ); + CALL_SUBTEST_13( bug_1014<0>() ); + CALL_SUBTEST_13( bug_1204<0>() ); + CALL_SUBTEST_13( bug_1225<0>() ); + + // Test problem size constructors + s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); + CALL_SUBTEST_8(SelfAdjointEigenSolver tmp1(s)); + CALL_SUBTEST_8(Tridiagonalization tmp2(s)); + + TEST_SET_BUT_UNUSED_VARIABLE(s) +} + diff --git a/lib/eigen-3.4.0/test/evaluator_common.h b/lib/eigen-3.4.0/test/evaluator_common.h new file mode 100644 index 0000000..e69de29 diff --git a/lib/eigen-3.4.0/test/evaluators.cpp b/lib/eigen-3.4.0/test/evaluators.cpp new file mode 100644 index 0000000..2810cd2 --- /dev/null +++ b/lib/eigen-3.4.0/test/evaluators.cpp @@ -0,0 +1,525 @@ + +#include "main.h" + +namespace Eigen { + + template + const Product + prod(const Lhs& lhs, const Rhs& rhs) + { + return Product(lhs,rhs); + } + + template + const Product + lazyprod(const Lhs& lhs, const Rhs& rhs) + { + return Product(lhs,rhs); + } + + template + EIGEN_STRONG_INLINE + DstXprType& copy_using_evaluator(const EigenBase &dst, const SrcXprType &src) + { + call_assignment(dst.const_cast_derived(), src.derived(), internal::assign_op()); + return dst.const_cast_derived(); + } + + template class StorageBase, typename SrcXprType> + EIGEN_STRONG_INLINE + const DstXprType& copy_using_evaluator(const NoAlias& dst, const SrcXprType &src) + { + call_assignment(dst, src.derived(), internal::assign_op()); + return dst.expression(); + } + + template + EIGEN_STRONG_INLINE + DstXprType& copy_using_evaluator(const PlainObjectBase &dst, const SrcXprType &src) + { + #ifdef EIGEN_NO_AUTOMATIC_RESIZING + eigen_assert((dst.size()==0 || (IsVectorAtCompileTime ? (dst.size() == src.size()) + : (dst.rows() == src.rows() && dst.cols() == src.cols()))) + && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined"); + #else + dst.const_cast_derived().resizeLike(src.derived()); + #endif + + call_assignment(dst.const_cast_derived(), src.derived(), internal::assign_op()); + return dst.const_cast_derived(); + } + + template + void add_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) + { + typedef typename DstXprType::Scalar Scalar; + call_assignment(const_cast(dst), src.derived(), internal::add_assign_op()); + } + + template + void subtract_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) + { + typedef typename DstXprType::Scalar Scalar; + call_assignment(const_cast(dst), src.derived(), internal::sub_assign_op()); + } + + template + void multiply_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) + { + typedef typename DstXprType::Scalar Scalar; + call_assignment(dst.const_cast_derived(), src.derived(), internal::mul_assign_op()); + } + + template + void divide_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) + { + typedef typename DstXprType::Scalar Scalar; + call_assignment(dst.const_cast_derived(), src.derived(), internal::div_assign_op()); + } + + template + void swap_using_evaluator(const DstXprType& dst, const SrcXprType& src) + { + typedef typename DstXprType::Scalar Scalar; + call_assignment(dst.const_cast_derived(), src.const_cast_derived(), internal::swap_assign_op()); + } + + namespace internal { + template class StorageBase, typename Src, typename Func> + EIGEN_DEVICE_FUNC void call_assignment(const NoAlias& dst, const Src& src, const Func& func) + { + call_assignment_no_alias(dst.expression(), src, func); + } + + template class StorageBase, typename Src, typename Func> + EIGEN_DEVICE_FUNC void call_restricted_packet_assignment(const NoAlias& dst, const Src& src, const Func& func) + { + call_restricted_packet_assignment_no_alias(dst.expression(), src, func); + } + } + +} + +template long get_cost(const XprType& ) { return Eigen::internal::evaluator::CoeffReadCost; } + +using namespace std; + +#define VERIFY_IS_APPROX_EVALUATOR(DEST,EXPR) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (EXPR).eval()); +#define VERIFY_IS_APPROX_EVALUATOR2(DEST,EXPR,REF) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (REF).eval()); + +EIGEN_DECLARE_TEST(evaluators) +{ + // Testing Matrix evaluator and Transpose + Vector2d v = Vector2d::Random(); + const Vector2d v_const(v); + Vector2d v2; + RowVector2d w; + + VERIFY_IS_APPROX_EVALUATOR(v2, v); + VERIFY_IS_APPROX_EVALUATOR(v2, v_const); + + // Testing Transpose + VERIFY_IS_APPROX_EVALUATOR(w, v.transpose()); // Transpose as rvalue + VERIFY_IS_APPROX_EVALUATOR(w, v_const.transpose()); + + copy_using_evaluator(w.transpose(), v); // Transpose as lvalue + VERIFY_IS_APPROX(w,v.transpose().eval()); + + copy_using_evaluator(w.transpose(), v_const); + VERIFY_IS_APPROX(w,v_const.transpose().eval()); + + // Testing Array evaluator + { + ArrayXXf a(2,3); + ArrayXXf b(3,2); + a << 1,2,3, 4,5,6; + const ArrayXXf a_const(a); + + VERIFY_IS_APPROX_EVALUATOR(b, a.transpose()); + + VERIFY_IS_APPROX_EVALUATOR(b, a_const.transpose()); + + // Testing CwiseNullaryOp evaluator + copy_using_evaluator(w, RowVector2d::Random()); + VERIFY((w.array() >= -1).all() && (w.array() <= 1).all()); // not easy to test ... + + VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Zero()); + + VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Constant(3)); + + // mix CwiseNullaryOp and transpose + VERIFY_IS_APPROX_EVALUATOR(w, Vector2d::Zero().transpose()); + } + + { + // test product expressions + int s = internal::random(1,100); + MatrixXf a(s,s), b(s,s), c(s,s), d(s,s); + a.setRandom(); + b.setRandom(); + c.setRandom(); + d.setRandom(); + VERIFY_IS_APPROX_EVALUATOR(d, (a + b)); + VERIFY_IS_APPROX_EVALUATOR(d, (a + b).transpose()); + VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b), a*b); + VERIFY_IS_APPROX_EVALUATOR2(d.noalias(), prod(a,b), a*b); + VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + c, a*b + c); + VERIFY_IS_APPROX_EVALUATOR2(d, s * prod(a,b), s * a*b); + VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b).transpose(), (a*b).transpose()); + VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + prod(b,c), a*b + b*c); + + // check that prod works even with aliasing present + c = a*a; + copy_using_evaluator(a, prod(a,a)); + VERIFY_IS_APPROX(a,c); + + // check compound assignment of products + d = c; + add_assign_using_evaluator(c.noalias(), prod(a,b)); + d.noalias() += a*b; + VERIFY_IS_APPROX(c, d); + + d = c; + subtract_assign_using_evaluator(c.noalias(), prod(a,b)); + d.noalias() -= a*b; + VERIFY_IS_APPROX(c, d); + } + + { + // test product with all possible sizes + int s = internal::random(1,100); + Matrix m11, res11; m11.setRandom(1,1); + Matrix m14, res14; m14.setRandom(1,4); + Matrix m1X, res1X; m1X.setRandom(1,s); + Matrix m41, res41; m41.setRandom(4,1); + Matrix m44, res44; m44.setRandom(4,4); + Matrix m4X, res4X; m4X.setRandom(4,s); + Matrix mX1, resX1; mX1.setRandom(s,1); + Matrix mX4, resX4; mX4.setRandom(s,4); + Matrix mXX, resXX; mXX.setRandom(s,s); + + VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m11,m11), m11*m11); + VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m14,m41), m14*m41); + VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m1X,mX1), m1X*mX1); + VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m11,m14), m11*m14); + VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m14,m44), m14*m44); + VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m1X,mX4), m1X*mX4); + VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m11,m1X), m11*m1X); + VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m14,m4X), m14*m4X); + VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m1X,mXX), m1X*mXX); + VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m41,m11), m41*m11); + VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m44,m41), m44*m41); + VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m4X,mX1), m4X*mX1); + VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m41,m14), m41*m14); + VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m44,m44), m44*m44); + VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m4X,mX4), m4X*mX4); + VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m41,m1X), m41*m1X); + VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m44,m4X), m44*m4X); + VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m4X,mXX), m4X*mXX); + VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mX1,m11), mX1*m11); + VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mX4,m41), mX4*m41); + VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mXX,mX1), mXX*mX1); + VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mX1,m14), mX1*m14); + VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mX4,m44), mX4*m44); + VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mXX,mX4), mXX*mX4); + VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mX1,m1X), mX1*m1X); + VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mX4,m4X), mX4*m4X); + VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mXX,mXX), mXX*mXX); + } + + { + ArrayXXf a(2,3); + ArrayXXf b(3,2); + a << 1,2,3, 4,5,6; + const ArrayXXf a_const(a); + + // this does not work because Random is eval-before-nested: + // copy_using_evaluator(w, Vector2d::Random().transpose()); + + // test CwiseUnaryOp + VERIFY_IS_APPROX_EVALUATOR(v2, 3 * v); + VERIFY_IS_APPROX_EVALUATOR(w, (3 * v).transpose()); + VERIFY_IS_APPROX_EVALUATOR(b, (a + 3).transpose()); + VERIFY_IS_APPROX_EVALUATOR(b, (2 * a_const + 3).transpose()); + + // test CwiseBinaryOp + VERIFY_IS_APPROX_EVALUATOR(v2, v + Vector2d::Ones()); + VERIFY_IS_APPROX_EVALUATOR(w, (v + Vector2d::Ones()).transpose().cwiseProduct(RowVector2d::Constant(3))); + + // dynamic matrices and arrays + MatrixXd mat1(6,6), mat2(6,6); + VERIFY_IS_APPROX_EVALUATOR(mat1, MatrixXd::Identity(6,6)); + VERIFY_IS_APPROX_EVALUATOR(mat2, mat1); + copy_using_evaluator(mat2.transpose(), mat1); + VERIFY_IS_APPROX(mat2.transpose(), mat1); + + ArrayXXd arr1(6,6), arr2(6,6); + VERIFY_IS_APPROX_EVALUATOR(arr1, ArrayXXd::Constant(6,6, 3.0)); + VERIFY_IS_APPROX_EVALUATOR(arr2, arr1); + + // test automatic resizing + mat2.resize(3,3); + VERIFY_IS_APPROX_EVALUATOR(mat2, mat1); + arr2.resize(9,9); + VERIFY_IS_APPROX_EVALUATOR(arr2, arr1); + + // test direct traversal + Matrix3f m3; + Array33f a3; + VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Identity()); // matrix, nullary + // TODO: find a way to test direct traversal with array + VERIFY_IS_APPROX_EVALUATOR(m3.transpose(), Matrix3f::Identity().transpose()); // transpose + VERIFY_IS_APPROX_EVALUATOR(m3, 2 * Matrix3f::Identity()); // unary + VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Identity() + Matrix3f::Zero()); // binary + VERIFY_IS_APPROX_EVALUATOR(m3.block(0,0,2,2), Matrix3f::Identity().block(1,1,2,2)); // block + + // test linear traversal + VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Zero()); // matrix, nullary + VERIFY_IS_APPROX_EVALUATOR(a3, Array33f::Zero()); // array + VERIFY_IS_APPROX_EVALUATOR(m3.transpose(), Matrix3f::Zero().transpose()); // transpose + VERIFY_IS_APPROX_EVALUATOR(m3, 2 * Matrix3f::Zero()); // unary + VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Zero() + m3); // binary + + // test inner vectorization + Matrix4f m4, m4src = Matrix4f::Random(); + Array44f a4, a4src = Matrix4f::Random(); + VERIFY_IS_APPROX_EVALUATOR(m4, m4src); // matrix + VERIFY_IS_APPROX_EVALUATOR(a4, a4src); // array + VERIFY_IS_APPROX_EVALUATOR(m4.transpose(), m4src.transpose()); // transpose + // TODO: find out why Matrix4f::Zero() does not allow inner vectorization + VERIFY_IS_APPROX_EVALUATOR(m4, 2 * m4src); // unary + VERIFY_IS_APPROX_EVALUATOR(m4, m4src + m4src); // binary + + // test linear vectorization + MatrixXf mX(6,6), mXsrc = MatrixXf::Random(6,6); + ArrayXXf aX(6,6), aXsrc = ArrayXXf::Random(6,6); + VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc); // matrix + VERIFY_IS_APPROX_EVALUATOR(aX, aXsrc); // array + VERIFY_IS_APPROX_EVALUATOR(mX.transpose(), mXsrc.transpose()); // transpose + VERIFY_IS_APPROX_EVALUATOR(mX, MatrixXf::Zero(6,6)); // nullary + VERIFY_IS_APPROX_EVALUATOR(mX, 2 * mXsrc); // unary + VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc + mXsrc); // binary + + // test blocks and slice vectorization + VERIFY_IS_APPROX_EVALUATOR(m4, (mXsrc.block<4,4>(1,0))); + VERIFY_IS_APPROX_EVALUATOR(aX, ArrayXXf::Constant(10, 10, 3.0).block(2, 3, 6, 6)); + + Matrix4f m4ref = m4; + copy_using_evaluator(m4.block(1, 1, 2, 3), m3.bottomRows(2)); + m4ref.block(1, 1, 2, 3) = m3.bottomRows(2); + VERIFY_IS_APPROX(m4, m4ref); + + mX.setIdentity(20,20); + MatrixXf mXref = MatrixXf::Identity(20,20); + mXsrc = MatrixXf::Random(9,12); + copy_using_evaluator(mX.block(4, 4, 9, 12), mXsrc); + mXref.block(4, 4, 9, 12) = mXsrc; + VERIFY_IS_APPROX(mX, mXref); + + // test Map + const float raw[3] = {1,2,3}; + float buffer[3] = {0,0,0}; + Vector3f v3; + Array3f a3f; + VERIFY_IS_APPROX_EVALUATOR(v3, Map(raw)); + VERIFY_IS_APPROX_EVALUATOR(a3f, Map(raw)); + Vector3f::Map(buffer) = 2*v3; + VERIFY(buffer[0] == 2); + VERIFY(buffer[1] == 4); + VERIFY(buffer[2] == 6); + + // test CwiseUnaryView + mat1.setRandom(); + mat2.setIdentity(); + MatrixXcd matXcd(6,6), matXcd_ref(6,6); + copy_using_evaluator(matXcd.real(), mat1); + copy_using_evaluator(matXcd.imag(), mat2); + matXcd_ref.real() = mat1; + matXcd_ref.imag() = mat2; + VERIFY_IS_APPROX(matXcd, matXcd_ref); + + // test Select + VERIFY_IS_APPROX_EVALUATOR(aX, (aXsrc > 0).select(aXsrc, -aXsrc)); + + // test Replicate + mXsrc = MatrixXf::Random(6, 6); + VectorXf vX = VectorXf::Random(6); + mX.resize(6, 6); + VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc.colwise() + vX); + matXcd.resize(12, 12); + VERIFY_IS_APPROX_EVALUATOR(matXcd, matXcd_ref.replicate(2,2)); + VERIFY_IS_APPROX_EVALUATOR(matXcd, (matXcd_ref.replicate<2,2>())); + + // test partial reductions + VectorXd vec1(6); + VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.rowwise().sum()); + VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.colwise().sum().transpose()); + + // test MatrixWrapper and ArrayWrapper + mat1.setRandom(6,6); + arr1.setRandom(6,6); + VERIFY_IS_APPROX_EVALUATOR(mat2, arr1.matrix()); + VERIFY_IS_APPROX_EVALUATOR(arr2, mat1.array()); + VERIFY_IS_APPROX_EVALUATOR(mat2, (arr1 + 2).matrix()); + VERIFY_IS_APPROX_EVALUATOR(arr2, mat1.array() + 2); + mat2.array() = arr1 * arr1; + VERIFY_IS_APPROX(mat2, (arr1 * arr1).matrix()); + arr2.matrix() = MatrixXd::Identity(6,6); + VERIFY_IS_APPROX(arr2, MatrixXd::Identity(6,6).array()); + + // test Reverse + VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.reverse()); + VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.colwise().reverse()); + VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.rowwise().reverse()); + arr2.reverse() = arr1; + VERIFY_IS_APPROX(arr2, arr1.reverse()); + mat2.array() = mat1.array().reverse(); + VERIFY_IS_APPROX(mat2.array(), mat1.array().reverse()); + + // test Diagonal + VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal()); + vec1.resize(5); + VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal(1)); + VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal<-1>()); + vec1.setRandom(); + + mat2 = mat1; + copy_using_evaluator(mat1.diagonal(1), vec1); + mat2.diagonal(1) = vec1; + VERIFY_IS_APPROX(mat1, mat2); + + copy_using_evaluator(mat1.diagonal<-1>(), mat1.diagonal(1)); + mat2.diagonal<-1>() = mat2.diagonal(1); + VERIFY_IS_APPROX(mat1, mat2); + } + + { + // test swapping + MatrixXd mat1, mat2, mat1ref, mat2ref; + mat1ref = mat1 = MatrixXd::Random(6, 6); + mat2ref = mat2 = 2 * mat1 + MatrixXd::Identity(6, 6); + swap_using_evaluator(mat1, mat2); + mat1ref.swap(mat2ref); + VERIFY_IS_APPROX(mat1, mat1ref); + VERIFY_IS_APPROX(mat2, mat2ref); + + swap_using_evaluator(mat1.block(0, 0, 3, 3), mat2.block(3, 3, 3, 3)); + mat1ref.block(0, 0, 3, 3).swap(mat2ref.block(3, 3, 3, 3)); + VERIFY_IS_APPROX(mat1, mat1ref); + VERIFY_IS_APPROX(mat2, mat2ref); + + swap_using_evaluator(mat1.row(2), mat2.col(3).transpose()); + mat1.row(2).swap(mat2.col(3).transpose()); + VERIFY_IS_APPROX(mat1, mat1ref); + VERIFY_IS_APPROX(mat2, mat2ref); + } + + { + // test compound assignment + const Matrix4d mat_const = Matrix4d::Random(); + Matrix4d mat, mat_ref; + mat = mat_ref = Matrix4d::Identity(); + add_assign_using_evaluator(mat, mat_const); + mat_ref += mat_const; + VERIFY_IS_APPROX(mat, mat_ref); + + subtract_assign_using_evaluator(mat.row(1), 2*mat.row(2)); + mat_ref.row(1) -= 2*mat_ref.row(2); + VERIFY_IS_APPROX(mat, mat_ref); + + const ArrayXXf arr_const = ArrayXXf::Random(5,3); + ArrayXXf arr, arr_ref; + arr = arr_ref = ArrayXXf::Constant(5, 3, 0.5); + multiply_assign_using_evaluator(arr, arr_const); + arr_ref *= arr_const; + VERIFY_IS_APPROX(arr, arr_ref); + + divide_assign_using_evaluator(arr.row(1), arr.row(2) + 1); + arr_ref.row(1) /= (arr_ref.row(2) + 1); + VERIFY_IS_APPROX(arr, arr_ref); + } + + { + // test triangular shapes + MatrixXd A = MatrixXd::Random(6,6), B(6,6), C(6,6), D(6,6); + A.setRandom();B.setRandom(); + VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); + + A.setRandom();B.setRandom(); + VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); + + A.setRandom();B.setRandom(); + VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); + + A.setRandom();B.setRandom(); + C = B; C.triangularView() = A; + copy_using_evaluator(B.triangularView(), A); + VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A)"); + + A.setRandom();B.setRandom(); + C = B; C.triangularView() = A.triangularView(); + copy_using_evaluator(B.triangularView(), A.triangularView()); + VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A.triangularView())"); + + + A.setRandom();B.setRandom(); + C = B; C.triangularView() = A.triangularView().transpose(); + copy_using_evaluator(B.triangularView(), A.triangularView().transpose()); + VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A.triangularView().transpose())"); + + + A.setRandom();B.setRandom(); C = B; D = A; + C.triangularView().swap(D.triangularView()); + swap_using_evaluator(B.triangularView(), A.triangularView()); + VERIFY(B.isApprox(C) && "swap_using_evaluator(B.triangularView(), A.triangularView())"); + + + VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.triangularView(),A), MatrixXd(A.triangularView()*A)); + + VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.selfadjointView(),A), MatrixXd(A.selfadjointView()*A)); + } + + { + // test diagonal shapes + VectorXd d = VectorXd::Random(6); + MatrixXd A = MatrixXd::Random(6,6), B(6,6); + A.setRandom();B.setRandom(); + + VERIFY_IS_APPROX_EVALUATOR2(B, lazyprod(d.asDiagonal(),A), MatrixXd(d.asDiagonal()*A)); + VERIFY_IS_APPROX_EVALUATOR2(B, lazyprod(A,d.asDiagonal()), MatrixXd(A*d.asDiagonal())); + } + + { + // test CoeffReadCost + Matrix4d a, b; + VERIFY_IS_EQUAL( get_cost(a), 1 ); + VERIFY_IS_EQUAL( get_cost(a+b), 3); + VERIFY_IS_EQUAL( get_cost(2*a+b), 4); + VERIFY_IS_EQUAL( get_cost(a*b), 1); + VERIFY_IS_EQUAL( get_cost(a.lazyProduct(b)), 15); + VERIFY_IS_EQUAL( get_cost(a*(a*b)), 1); + VERIFY_IS_EQUAL( get_cost(a.lazyProduct(a*b)), 15); + VERIFY_IS_EQUAL( get_cost(a*(a+b)), 1); + VERIFY_IS_EQUAL( get_cost(a.lazyProduct(a+b)), 15); + } + + // regression test for PR 544 and bug 1622 (introduced in #71609c4) + { + // test restricted_packet_assignment with an unaligned destination + const size_t M = 2; + const size_t K = 2; + const size_t N = 5; + float *destMem = new float[(M*N) + 1]; + float *dest = (internal::UIntPtr(destMem)%EIGEN_MAX_ALIGN_BYTES) == 0 ? destMem+1 : destMem; + + const Matrix a = Matrix::Random(M, K); + const Matrix b = Matrix::Random(K, N); + + Map > z(dest, M, N);; + Product, Matrix, LazyProduct> tmp(a,b); + internal::call_restricted_packet_assignment(z.noalias(), tmp.derived(), internal::assign_op()); + + VERIFY_IS_APPROX(z, a*b); + delete[] destMem; + } +} diff --git a/lib/eigen-3.4.0/test/exceptions.cpp b/lib/eigen-3.4.0/test/exceptions.cpp new file mode 100644 index 0000000..3d93060 --- /dev/null +++ b/lib/eigen-3.4.0/test/exceptions.cpp @@ -0,0 +1,49 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +// Various sanity tests with exceptions and non trivially copyable scalar type. +// - no memory leak when a custom scalar type trow an exceptions +// - todo: complete the list of tests! + +#define EIGEN_STACK_ALLOCATION_LIMIT 100000000 + +#include "main.h" +#include "AnnoyingScalar.h" + +#define CHECK_MEMLEAK(OP) { \ + AnnoyingScalar::countdown = 100; \ + int before = AnnoyingScalar::instances; \ + bool exception_thrown = false; \ + try { OP; } \ + catch (my_exception) { \ + exception_thrown = true; \ + VERIFY(AnnoyingScalar::instances==before && "memory leak detected in " && EIGEN_MAKESTRING(OP)); \ + } \ + VERIFY( (AnnoyingScalar::dont_throw) || (exception_thrown && " no exception thrown in " && EIGEN_MAKESTRING(OP)) ); \ + } + +EIGEN_DECLARE_TEST(exceptions) +{ + typedef Eigen::Matrix VectorType; + typedef Eigen::Matrix MatrixType; + + { + AnnoyingScalar::dont_throw = false; + int n = 50; + VectorType v0(n), v1(n); + MatrixType m0(n,n), m1(n,n), m2(n,n); + v0.setOnes(); v1.setOnes(); + m0.setOnes(); m1.setOnes(); m2.setOnes(); + CHECK_MEMLEAK(v0 = m0 * m1 * v1); + CHECK_MEMLEAK(m2 = m0 * m1 * m2); + CHECK_MEMLEAK((v0+v1).dot(v0+v1)); + } + VERIFY(AnnoyingScalar::instances==0 && "global memory leak detected in " && EIGEN_MAKESTRING(OP)); +} diff --git a/lib/eigen-3.4.0/test/fastmath.cpp b/lib/eigen-3.4.0/test/fastmath.cpp new file mode 100644 index 0000000..00a1a59 --- /dev/null +++ b/lib/eigen-3.4.0/test/fastmath.cpp @@ -0,0 +1,99 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +void check(bool b, bool ref) +{ + std::cout << b; + if(b==ref) + std::cout << " OK "; + else + std::cout << " BAD "; +} + +#if EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1800 +namespace std { + template bool (isfinite)(T x) { return _finite(x); } + template bool (isnan)(T x) { return _isnan(x); } + template bool (isinf)(T x) { return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; } +} +#endif + +template +void check_inf_nan(bool dryrun) { + Matrix m(10); + m.setRandom(); + m(3) = std::numeric_limits::quiet_NaN(); + + if(dryrun) + { + std::cout << "std::isfinite(" << m(3) << ") = "; check((std::isfinite)(m(3)),false); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(3)), false); std::cout << "\n"; + std::cout << "std::isinf(" << m(3) << ") = "; check((std::isinf)(m(3)),false); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(3)), false); std::cout << "\n"; + std::cout << "std::isnan(" << m(3) << ") = "; check((std::isnan)(m(3)),true); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(3)), true); std::cout << "\n"; + std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; + std::cout << "hasNaN: "; check(m.hasNaN(), 1); std::cout << "\n"; + std::cout << "\n"; + } + else + { + if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(3)) ); g_test_level=0; + if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; + if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( (numext::isnan)(m(3)) ); g_test_level=0; + if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; + if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; + } + T hidden_zero = (std::numeric_limits::min)()*(std::numeric_limits::min)(); + m(4) /= hidden_zero; + if(dryrun) + { + std::cout << "std::isfinite(" << m(4) << ") = "; check((std::isfinite)(m(4)),false); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(4)), false); std::cout << "\n"; + std::cout << "std::isinf(" << m(4) << ") = "; check((std::isinf)(m(4)),true); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(4)), true); std::cout << "\n"; + std::cout << "std::isnan(" << m(4) << ") = "; check((std::isnan)(m(4)),false); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(4)), false); std::cout << "\n"; + std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; + std::cout << "hasNaN: "; check(m.hasNaN(), 1); std::cout << "\n"; + std::cout << "\n"; + } + else + { + if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(4)) ); g_test_level=0; + if(!(std::isinf) (m(3))) g_test_level=1; VERIFY( (numext::isinf)(m(4)) ); g_test_level=0; + if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(4)) ); g_test_level=0; + if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; + if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; + } + m(3) = 0; + if(dryrun) + { + std::cout << "std::isfinite(" << m(3) << ") = "; check((std::isfinite)(m(3)),true); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(3)), true); std::cout << "\n"; + std::cout << "std::isinf(" << m(3) << ") = "; check((std::isinf)(m(3)),false); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(3)), false); std::cout << "\n"; + std::cout << "std::isnan(" << m(3) << ") = "; check((std::isnan)(m(3)),false); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(3)), false); std::cout << "\n"; + std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; + std::cout << "hasNaN: "; check(m.hasNaN(), 0); std::cout << "\n"; + std::cout << "\n\n"; + } + else + { + if(!(std::isfinite)(m(3))) g_test_level=1; VERIFY( (numext::isfinite)(m(3)) ); g_test_level=0; + if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; + if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(3)) ); g_test_level=0; + if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; + if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !m.hasNaN() ); g_test_level=0; + } +} + +EIGEN_DECLARE_TEST(fastmath) { + std::cout << "*** float *** \n\n"; check_inf_nan(true); + std::cout << "*** double ***\n\n"; check_inf_nan(true); + std::cout << "*** long double *** \n\n"; check_inf_nan(true); + + check_inf_nan(false); + check_inf_nan(false); + check_inf_nan(false); +} diff --git a/lib/eigen-3.4.0/test/first_aligned.cpp b/lib/eigen-3.4.0/test/first_aligned.cpp new file mode 100644 index 0000000..ed99450 --- /dev/null +++ b/lib/eigen-3.4.0/test/first_aligned.cpp @@ -0,0 +1,51 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template +void test_first_aligned_helper(Scalar *array, int size) +{ + const int packet_size = sizeof(Scalar) * internal::packet_traits::size; + VERIFY(((size_t(array) + sizeof(Scalar) * internal::first_default_aligned(array, size)) % packet_size) == 0); +} + +template +void test_none_aligned_helper(Scalar *array, int size) +{ + EIGEN_UNUSED_VARIABLE(array); + EIGEN_UNUSED_VARIABLE(size); + VERIFY(internal::packet_traits::size == 1 || internal::first_default_aligned(array, size) == size); +} + +struct some_non_vectorizable_type { float x; }; + +EIGEN_DECLARE_TEST(first_aligned) +{ + EIGEN_ALIGN16 float array_float[100]; + test_first_aligned_helper(array_float, 50); + test_first_aligned_helper(array_float+1, 50); + test_first_aligned_helper(array_float+2, 50); + test_first_aligned_helper(array_float+3, 50); + test_first_aligned_helper(array_float+4, 50); + test_first_aligned_helper(array_float+5, 50); + + EIGEN_ALIGN16 double array_double[100]; + test_first_aligned_helper(array_double, 50); + test_first_aligned_helper(array_double+1, 50); + test_first_aligned_helper(array_double+2, 50); + + double *array_double_plus_4_bytes = (double*)(internal::UIntPtr(array_double)+4); + test_none_aligned_helper(array_double_plus_4_bytes, 50); + test_none_aligned_helper(array_double_plus_4_bytes+1, 50); + + some_non_vectorizable_type array_nonvec[100]; + test_first_aligned_helper(array_nonvec, 100); + test_none_aligned_helper(array_nonvec, 100); +} diff --git a/lib/eigen-3.4.0/test/geo_alignedbox.cpp b/lib/eigen-3.4.0/test/geo_alignedbox.cpp new file mode 100644 index 0000000..7b1684f --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_alignedbox.cpp @@ -0,0 +1,531 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +using namespace std; + +// NOTE the following workaround was needed on some 32 bits builds to kill extra precision of x87 registers. +// It seems that it is not needed anymore, but let's keep it here, just in case... + +template EIGEN_DONT_INLINE +void kill_extra_precision(T& /* x */) { + // This one worked but triggered a warning: + /* eigen_assert((void*)(&x) != (void*)0); */ + // An alternative could be: + /* volatile T tmp = x; */ + /* x = tmp; */ +} + + +template void alignedbox(const BoxType& box) +{ + /* this test covers the following files: + AlignedBox.h + */ + typedef typename BoxType::Scalar Scalar; + typedef NumTraits ScalarTraits; + typedef typename ScalarTraits::Real RealScalar; + typedef Matrix VectorType; + + const Index dim = box.dim(); + + VectorType p0 = VectorType::Random(dim); + VectorType p1 = VectorType::Random(dim); + while( p1 == p0 ){ + p1 = VectorType::Random(dim); } + RealScalar s1 = internal::random(0,1); + + BoxType b0(dim); + BoxType b1(VectorType::Random(dim),VectorType::Random(dim)); + BoxType b2; + + kill_extra_precision(b1); + kill_extra_precision(p0); + kill_extra_precision(p1); + + b0.extend(p0); + b0.extend(p1); + VERIFY(b0.contains(p0*s1+(Scalar(1)-s1)*p1)); + VERIFY(b0.contains(b0.center())); + VERIFY_IS_APPROX(b0.center(),(p0+p1)/Scalar(2)); + + (b2 = b0).extend(b1); + VERIFY(b2.contains(b0)); + VERIFY(b2.contains(b1)); + VERIFY_IS_APPROX(b2.clamp(b0), b0); + + // intersection + BoxType box1(VectorType::Random(dim)); + box1.extend(VectorType::Random(dim)); + BoxType box2(VectorType::Random(dim)); + box2.extend(VectorType::Random(dim)); + + VERIFY(box1.intersects(box2) == !box1.intersection(box2).isEmpty()); + + // alignment -- make sure there is no memory alignment assertion + BoxType *bp0 = new BoxType(dim); + BoxType *bp1 = new BoxType(dim); + bp0->extend(*bp1); + delete bp0; + delete bp1; + + // sampling + for( int i=0; i<10; ++i ) + { + VectorType r = b0.sample(); + VERIFY(b0.contains(r)); + } + +} + +template void alignedboxTranslatable(const BoxType& box) +{ + typedef typename BoxType::Scalar Scalar; + typedef Matrix VectorType; + typedef Transform IsometryTransform; + typedef Transform AffineTransform; + + alignedbox(box); + + const VectorType Ones = VectorType::Ones(); + const VectorType UnitX = VectorType::UnitX(); + const Index dim = box.dim(); + + // box((-1, -1, -1), (1, 1, 1)) + BoxType a(-Ones, Ones); + + VERIFY_IS_APPROX(a.sizes(), Ones * Scalar(2)); + + BoxType b = a; + VectorType translate = Ones; + translate[0] = Scalar(2); + b.translate(translate); + // translate by (2, 1, 1) -> box((1, 0, 0), (3, 2, 2)) + + VERIFY_IS_APPROX(b.sizes(), Ones * Scalar(2)); + VERIFY_IS_APPROX((b.min)(), UnitX); + VERIFY_IS_APPROX((b.max)(), Ones * Scalar(2) + UnitX); + + // Test transform + + IsometryTransform tf = IsometryTransform::Identity(); + tf.translation() = -translate; + + BoxType c = b.transformed(tf); + // translate by (-2, -1, -1) -> box((-1, -1, -1), (1, 1, 1)) + VERIFY_IS_APPROX(c.sizes(), a.sizes()); + VERIFY_IS_APPROX((c.min)(), (a.min)()); + VERIFY_IS_APPROX((c.max)(), (a.max)()); + + c.transform(tf); + // translate by (-2, -1, -1) -> box((-3, -2, -2), (-1, 0, 0)) + VERIFY_IS_APPROX(c.sizes(), a.sizes()); + VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) - UnitX); + VERIFY_IS_APPROX((c.max)(), -UnitX); + + // Scaling + + AffineTransform atf = AffineTransform::Identity(); + atf.scale(Scalar(3)); + c.transform(atf); + // scale by 3 -> box((-9, -6, -6), (-3, 0, 0)) + VERIFY_IS_APPROX(c.sizes(), Scalar(3) * a.sizes()); + VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-6) - UnitX * Scalar(3)); + VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(-3)); + + atf = AffineTransform::Identity(); + atf.scale(Scalar(-3)); + c.transform(atf); + // scale by -3 -> box((27, 18, 18), (9, 0, 0)) + VERIFY_IS_APPROX(c.sizes(), Scalar(9) * a.sizes()); + VERIFY_IS_APPROX((c.min)(), UnitX * Scalar(9)); + VERIFY_IS_APPROX((c.max)(), Ones * Scalar(18) + UnitX * Scalar(9)); + + // Check identity transform within numerical precision. + BoxType transformedC = c.transformed(IsometryTransform::Identity()); + VERIFY_IS_APPROX(transformedC, c); + + for (size_t i = 0; i < 10; ++i) + { + VectorType minCorner; + VectorType maxCorner; + for (Index d = 0; d < dim; ++d) + { + minCorner[d] = internal::random(-10,10); + maxCorner[d] = minCorner[d] + internal::random(0, 10); + } + + c = BoxType(minCorner, maxCorner); + + translate = VectorType::Random(); + c.translate(translate); + + VERIFY_IS_APPROX((c.min)(), minCorner + translate); + VERIFY_IS_APPROX((c.max)(), maxCorner + translate); + } +} + +template +Rotation rotate2D(Scalar angle) { + return Rotation2D(angle); +} + +template +Rotation rotate2DIntegral(typename NumTraits::NonInteger angle) { + typedef typename NumTraits::NonInteger NonInteger; + return Rotation2D(angle).toRotationMatrix(). + template cast(); +} + +template +Rotation rotate3DZAxis(Scalar angle) { + return AngleAxis(angle, Matrix(0, 0, 1)); +} + +template +Rotation rotate3DZAxisIntegral(typename NumTraits::NonInteger angle) { + typedef typename NumTraits::NonInteger NonInteger; + return AngleAxis(angle, Matrix(0, 0, 1)). + toRotationMatrix().template cast(); +} + +template +Rotation rotate4DZWAxis(Scalar angle) { + Rotation result = Matrix::Identity(); + result.block(0, 0, 3, 3) = rotate3DZAxis(angle).toRotationMatrix(); + return result; +} + +template +MatrixType randomRotationMatrix() +{ + // algorithm from + // https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/III-7/103/2016/isprs-annals-III-7-103-2016.pdf + const MatrixType rand = MatrixType::Random(); + const MatrixType q = rand.householderQr().householderQ(); + const JacobiSVD svd = q.jacobiSvd(ComputeFullU | ComputeFullV); + const typename MatrixType::Scalar det = (svd.matrixU() * svd.matrixV().transpose()).determinant(); + MatrixType diag = rand.Identity(); + diag(MatrixType::RowsAtCompileTime - 1, MatrixType::ColsAtCompileTime - 1) = det; + const MatrixType rotation = svd.matrixU() * diag * svd.matrixV().transpose(); + return rotation; +} + +template +Matrix boxGetCorners(const Matrix& min_, const Matrix& max_) +{ + Matrix result; + for(Index i=0; i<(1< void alignedboxRotatable( + const BoxType& box, + Rotation (*rotate)(typename NumTraits::NonInteger /*_angle*/)) +{ + alignedboxTranslatable(box); + + typedef typename BoxType::Scalar Scalar; + typedef typename NumTraits::NonInteger NonInteger; + typedef Matrix VectorType; + typedef Transform IsometryTransform; + typedef Transform AffineTransform; + + const VectorType Zero = VectorType::Zero(); + const VectorType Ones = VectorType::Ones(); + const VectorType UnitX = VectorType::UnitX(); + const VectorType UnitY = VectorType::UnitY(); + // this is vector (0, 0, -1, -1, -1, ...), i.e. with zeros at first and second dimensions + const VectorType UnitZ = Ones - UnitX - UnitY; + + // in this kind of comments the 3D case values will be illustrated + // box((-1, -1, -1), (1, 1, 1)) + BoxType a(-Ones, Ones); + + // to allow templating this test for both 2D and 3D cases, we always set all + // but the first coordinate to the same value; so basically 3D case works as + // if you were looking at the scene from top + + VectorType minPoint = -2 * Ones; + minPoint[0] = -3; + VectorType maxPoint = Zero; + maxPoint[0] = -1; + BoxType c(minPoint, maxPoint); + // box((-3, -2, -2), (-1, 0, 0)) + + IsometryTransform tf2 = IsometryTransform::Identity(); + // for some weird reason the following statement has to be put separate from + // the following rotate call, otherwise precision problems arise... + Rotation rot = rotate(NonInteger(EIGEN_PI)); + tf2.rotate(rot); + + c.transform(tf2); + // rotate by 180 deg around origin -> box((1, 0, -2), (3, 2, 0)) + + VERIFY_IS_APPROX(c.sizes(), a.sizes()); + VERIFY_IS_APPROX((c.min)(), UnitX - UnitZ * Scalar(2)); + VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(3) + UnitY * Scalar(2)); + + rot = rotate(NonInteger(EIGEN_PI / 2)); + tf2.setIdentity(); + tf2.rotate(rot); + + c.transform(tf2); + // rotate by 90 deg around origin -> box((-2, 1, -2), (0, 3, 0)) + + VERIFY_IS_APPROX(c.sizes(), a.sizes()); + VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) + UnitY * Scalar(3)); + VERIFY_IS_APPROX((c.max)(), UnitY * Scalar(3)); + + // box((-1, -1, -1), (1, 1, 1)) + AffineTransform atf = AffineTransform::Identity(); + atf.linearExt()(0, 1) = Scalar(1); + c = BoxType(-Ones, Ones); + c.transform(atf); + // 45 deg shear in x direction -> box((-2, -1, -1), (2, 1, 1)) + + VERIFY_IS_APPROX(c.sizes(), Ones * Scalar(2) + UnitX * Scalar(2)); + VERIFY_IS_APPROX((c.min)(), -Ones - UnitX); + VERIFY_IS_APPROX((c.max)(), Ones + UnitX); +} + +template void alignedboxNonIntegralRotatable( + const BoxType& box, + Rotation (*rotate)(typename NumTraits::NonInteger /*_angle*/)) +{ + alignedboxRotatable(box, rotate); + + typedef typename BoxType::Scalar Scalar; + typedef typename NumTraits::NonInteger NonInteger; + enum { Dim = BoxType::AmbientDimAtCompileTime }; + typedef Matrix VectorType; + typedef Matrix CornersType; + typedef Transform IsometryTransform; + typedef Transform AffineTransform; + + const Index dim = box.dim(); + const VectorType Zero = VectorType::Zero(); + const VectorType Ones = VectorType::Ones(); + + VectorType minPoint = -2 * Ones; + minPoint[1] = 1; + VectorType maxPoint = Zero; + maxPoint[1] = 3; + BoxType c(minPoint, maxPoint); + // ((-2, 1, -2), (0, 3, 0)) + + VectorType cornerBL = (c.min)(); + VectorType cornerTR = (c.max)(); + VectorType cornerBR = (c.min)(); cornerBR[0] = cornerTR[0]; + VectorType cornerTL = (c.max)(); cornerTL[0] = cornerBL[0]; + + NonInteger angle = NonInteger(EIGEN_PI/3); + Rotation rot = rotate(angle); + IsometryTransform tf2; + tf2.setIdentity(); + tf2.rotate(rot); + + c.transform(tf2); + // rotate by 60 deg -> box((-3.59, -1.23, -2), (-0.86, 1.5, 0)) + + cornerBL = tf2 * cornerBL; + cornerBR = tf2 * cornerBR; + cornerTL = tf2 * cornerTL; + cornerTR = tf2 * cornerTR; + + VectorType minCorner = Ones * Scalar(-2); + VectorType maxCorner = Zero; + minCorner[0] = (min)((min)(cornerBL[0], cornerBR[0]), (min)(cornerTL[0], cornerTR[0])); + maxCorner[0] = (max)((max)(cornerBL[0], cornerBR[0]), (max)(cornerTL[0], cornerTR[0])); + minCorner[1] = (min)((min)(cornerBL[1], cornerBR[1]), (min)(cornerTL[1], cornerTR[1])); + maxCorner[1] = (max)((max)(cornerBL[1], cornerBR[1]), (max)(cornerTL[1], cornerTR[1])); + + for (Index d = 2; d < dim; ++d) + VERIFY_IS_APPROX(c.sizes()[d], Scalar(2)); + + VERIFY_IS_APPROX((c.min)(), minCorner); + VERIFY_IS_APPROX((c.max)(), maxCorner); + + VectorType minCornerValue = Ones * Scalar(-2); + VectorType maxCornerValue = Zero; + minCornerValue[0] = Scalar(Scalar(-sqrt(2*2 + 3*3)) * Scalar(cos(Scalar(atan(2.0/3.0)) - angle/2))); + minCornerValue[1] = Scalar(Scalar(-sqrt(1*1 + 2*2)) * Scalar(sin(Scalar(atan(2.0/1.0)) - angle/2))); + maxCornerValue[0] = Scalar(-sin(angle)); + maxCornerValue[1] = Scalar(3 * cos(angle)); + VERIFY_IS_APPROX((c.min)(), minCornerValue); + VERIFY_IS_APPROX((c.max)(), maxCornerValue); + + // randomized test - translate and rotate the box and compare to a box made of transformed vertices + for (size_t i = 0; i < 10; ++i) + { + for (Index d = 0; d < dim; ++d) + { + minCorner[d] = internal::random(-10,10); + maxCorner[d] = minCorner[d] + internal::random(0, 10); + } + + c = BoxType(minCorner, maxCorner); + + CornersType corners = boxGetCorners(minCorner, maxCorner); + + typename AffineTransform::LinearMatrixType rotation = + randomRotationMatrix(); + + tf2.setIdentity(); + tf2.rotate(rotation); + tf2.translate(VectorType::Random()); + + c.transform(tf2); + corners = tf2 * corners; + + minCorner = corners.rowwise().minCoeff(); + maxCorner = corners.rowwise().maxCoeff(); + + VERIFY_IS_APPROX((c.min)(), minCorner); + VERIFY_IS_APPROX((c.max)(), maxCorner); + } + + // randomized test - transform the box with a random affine matrix and compare to a box made of transformed vertices + for (size_t i = 0; i < 10; ++i) + { + for (Index d = 0; d < dim; ++d) + { + minCorner[d] = internal::random(-10,10); + maxCorner[d] = minCorner[d] + internal::random(0, 10); + } + + c = BoxType(minCorner, maxCorner); + + CornersType corners = boxGetCorners(minCorner, maxCorner); + + AffineTransform atf = AffineTransform::Identity(); + atf.linearExt() = AffineTransform::LinearPart::Random(); + atf.translate(VectorType::Random()); + + c.transform(atf); + corners = atf * corners; + + minCorner = corners.rowwise().minCoeff(); + maxCorner = corners.rowwise().maxCoeff(); + + VERIFY_IS_APPROX((c.min)(), minCorner); + VERIFY_IS_APPROX((c.max)(), maxCorner); + } +} + +template +void alignedboxCastTests(const BoxType& box) +{ + // casting + typedef typename BoxType::Scalar Scalar; + typedef Matrix VectorType; + + const Index dim = box.dim(); + + VectorType p0 = VectorType::Random(dim); + VectorType p1 = VectorType::Random(dim); + + BoxType b0(dim); + + b0.extend(p0); + b0.extend(p1); + + const int Dim = BoxType::AmbientDimAtCompileTime; + typedef typename GetDifferentType::type OtherScalar; + AlignedBox hp1f = b0.template cast(); + VERIFY_IS_APPROX(hp1f.template cast(),b0); + AlignedBox hp1d = b0.template cast(); + VERIFY_IS_APPROX(hp1d.template cast(),b0); +} + + +void specificTest1() +{ + Vector2f m; m << -1.0f, -2.0f; + Vector2f M; M << 1.0f, 5.0f; + + typedef AlignedBox2f BoxType; + BoxType box( m, M ); + + Vector2f sides = M-m; + VERIFY_IS_APPROX(sides, box.sizes() ); + VERIFY_IS_APPROX(sides[1], box.sizes()[1] ); + VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() ); + VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() ); + + VERIFY_IS_APPROX( 14.0f, box.volume() ); + VERIFY_IS_APPROX( 53.0f, box.diagonal().squaredNorm() ); + VERIFY_IS_APPROX( std::sqrt( 53.0f ), box.diagonal().norm() ); + + VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeft ) ); + VERIFY_IS_APPROX( M, box.corner( BoxType::TopRight ) ); + Vector2f bottomRight; bottomRight << M[0], m[1]; + Vector2f topLeft; topLeft << m[0], M[1]; + VERIFY_IS_APPROX( bottomRight, box.corner( BoxType::BottomRight ) ); + VERIFY_IS_APPROX( topLeft, box.corner( BoxType::TopLeft ) ); +} + + +void specificTest2() +{ + Vector3i m; m << -1, -2, 0; + Vector3i M; M << 1, 5, 3; + + typedef AlignedBox3i BoxType; + BoxType box( m, M ); + + Vector3i sides = M-m; + VERIFY_IS_APPROX(sides, box.sizes() ); + VERIFY_IS_APPROX(sides[1], box.sizes()[1] ); + VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() ); + VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() ); + + VERIFY_IS_APPROX( 42, box.volume() ); + VERIFY_IS_APPROX( 62, box.diagonal().squaredNorm() ); + + VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeftFloor ) ); + VERIFY_IS_APPROX( M, box.corner( BoxType::TopRightCeil ) ); + Vector3i bottomRightFloor; bottomRightFloor << M[0], m[1], m[2]; + Vector3i topLeftFloor; topLeftFloor << m[0], M[1], m[2]; + VERIFY_IS_APPROX( bottomRightFloor, box.corner( BoxType::BottomRightFloor ) ); + VERIFY_IS_APPROX( topLeftFloor, box.corner( BoxType::TopLeftFloor ) ); +} + + +EIGEN_DECLARE_TEST(geo_alignedbox) +{ + for(int i = 0; i < g_repeat; i++) + { + CALL_SUBTEST_1( (alignedboxNonIntegralRotatable(AlignedBox2f(), &rotate2D)) ); + CALL_SUBTEST_2( alignedboxCastTests(AlignedBox2f()) ); + + CALL_SUBTEST_3( (alignedboxNonIntegralRotatable(AlignedBox3f(), &rotate3DZAxis)) ); + CALL_SUBTEST_4( alignedboxCastTests(AlignedBox3f()) ); + + CALL_SUBTEST_5( (alignedboxNonIntegralRotatable(AlignedBox4d(), &rotate4DZWAxis)) ); + CALL_SUBTEST_6( alignedboxCastTests(AlignedBox4d()) ); + + CALL_SUBTEST_7( alignedboxTranslatable(AlignedBox1d()) ); + CALL_SUBTEST_8( alignedboxCastTests(AlignedBox1d()) ); + + CALL_SUBTEST_9( alignedboxTranslatable(AlignedBox1i()) ); + CALL_SUBTEST_10( (alignedboxRotatable(AlignedBox2i(), &rotate2DIntegral)) ); + CALL_SUBTEST_11( (alignedboxRotatable(AlignedBox3i(), &rotate3DZAxisIntegral)) ); + + CALL_SUBTEST_14( alignedbox(AlignedBox(4)) ); + } + CALL_SUBTEST_12( specificTest1() ); + CALL_SUBTEST_13( specificTest2() ); +} diff --git a/lib/eigen-3.4.0/test/geo_eulerangles.cpp b/lib/eigen-3.4.0/test/geo_eulerangles.cpp new file mode 100644 index 0000000..693c627 --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_eulerangles.cpp @@ -0,0 +1,112 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + + +template +void verify_euler(const Matrix& ea, int i, int j, int k) +{ + typedef Matrix Matrix3; + typedef Matrix Vector3; + typedef AngleAxis AngleAxisx; + using std::abs; + Matrix3 m(AngleAxisx(ea[0], Vector3::Unit(i)) * AngleAxisx(ea[1], Vector3::Unit(j)) * AngleAxisx(ea[2], Vector3::Unit(k))); + Vector3 eabis = m.eulerAngles(i, j, k); + Matrix3 mbis(AngleAxisx(eabis[0], Vector3::Unit(i)) * AngleAxisx(eabis[1], Vector3::Unit(j)) * AngleAxisx(eabis[2], Vector3::Unit(k))); + VERIFY_IS_APPROX(m, mbis); + /* If I==K, and ea[1]==0, then there no unique solution. */ + /* The remark apply in the case where I!=K, and |ea[1]| is close to pi/2. */ + if( (i!=k || ea[1]!=0) && (i==k || !internal::isApprox(abs(ea[1]),Scalar(EIGEN_PI/2),test_precision())) ) + VERIFY((ea-eabis).norm() <= test_precision()); + + // approx_or_less_than does not work for 0 + VERIFY(0 < eabis[0] || test_isMuchSmallerThan(eabis[0], Scalar(1))); + VERIFY_IS_APPROX_OR_LESS_THAN(eabis[0], Scalar(EIGEN_PI)); + VERIFY_IS_APPROX_OR_LESS_THAN(-Scalar(EIGEN_PI), eabis[1]); + VERIFY_IS_APPROX_OR_LESS_THAN(eabis[1], Scalar(EIGEN_PI)); + VERIFY_IS_APPROX_OR_LESS_THAN(-Scalar(EIGEN_PI), eabis[2]); + VERIFY_IS_APPROX_OR_LESS_THAN(eabis[2], Scalar(EIGEN_PI)); +} + +template void check_all_var(const Matrix& ea) +{ + verify_euler(ea, 0,1,2); + verify_euler(ea, 0,1,0); + verify_euler(ea, 0,2,1); + verify_euler(ea, 0,2,0); + + verify_euler(ea, 1,2,0); + verify_euler(ea, 1,2,1); + verify_euler(ea, 1,0,2); + verify_euler(ea, 1,0,1); + + verify_euler(ea, 2,0,1); + verify_euler(ea, 2,0,2); + verify_euler(ea, 2,1,0); + verify_euler(ea, 2,1,2); +} + +template void eulerangles() +{ + typedef Matrix Matrix3; + typedef Matrix Vector3; + typedef Array Array3; + typedef Quaternion Quaternionx; + typedef AngleAxis AngleAxisx; + + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + Quaternionx q1; + q1 = AngleAxisx(a, Vector3::Random().normalized()); + Matrix3 m; + m = q1; + + Vector3 ea = m.eulerAngles(0,1,2); + check_all_var(ea); + ea = m.eulerAngles(0,1,0); + check_all_var(ea); + + // Check with purely random Quaternion: + q1.coeffs() = Quaternionx::Coefficients::Random().normalized(); + m = q1; + ea = m.eulerAngles(0,1,2); + check_all_var(ea); + ea = m.eulerAngles(0,1,0); + check_all_var(ea); + + // Check with random angles in range [0:pi]x[-pi:pi]x[-pi:pi]. + ea = (Array3::Random() + Array3(1,0,0))*Scalar(EIGEN_PI)*Array3(0.5,1,1); + check_all_var(ea); + + ea[2] = ea[0] = internal::random(0,Scalar(EIGEN_PI)); + check_all_var(ea); + + ea[0] = ea[1] = internal::random(0,Scalar(EIGEN_PI)); + check_all_var(ea); + + ea[1] = 0; + check_all_var(ea); + + ea.head(2).setZero(); + check_all_var(ea); + + ea.setZero(); + check_all_var(ea); +} + +EIGEN_DECLARE_TEST(geo_eulerangles) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( eulerangles() ); + CALL_SUBTEST_2( eulerangles() ); + } +} diff --git a/lib/eigen-3.4.0/test/geo_homogeneous.cpp b/lib/eigen-3.4.0/test/geo_homogeneous.cpp new file mode 100644 index 0000000..9aebe62 --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_homogeneous.cpp @@ -0,0 +1,125 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template void homogeneous(void) +{ + /* this test covers the following files: + Homogeneous.h + */ + + typedef Matrix MatrixType; + typedef Matrix VectorType; + + typedef Matrix HMatrixType; + typedef Matrix HVectorType; + + typedef Matrix T1MatrixType; + typedef Matrix T2MatrixType; + typedef Matrix T3MatrixType; + + VectorType v0 = VectorType::Random(), + ones = VectorType::Ones(); + + HVectorType hv0 = HVectorType::Random(); + + MatrixType m0 = MatrixType::Random(); + + HMatrixType hm0 = HMatrixType::Random(); + + hv0 << v0, 1; + VERIFY_IS_APPROX(v0.homogeneous(), hv0); + VERIFY_IS_APPROX(v0, hv0.hnormalized()); + + VERIFY_IS_APPROX(v0.homogeneous().sum(), hv0.sum()); + VERIFY_IS_APPROX(v0.homogeneous().minCoeff(), hv0.minCoeff()); + VERIFY_IS_APPROX(v0.homogeneous().maxCoeff(), hv0.maxCoeff()); + + hm0 << m0, ones.transpose(); + VERIFY_IS_APPROX(m0.colwise().homogeneous(), hm0); + VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized()); + hm0.row(Size-1).setRandom(); + for(int j=0; j aff; + Transform caff; + Transform proj; + Matrix pts; + Matrix pts1, pts2; + + aff.affine().setRandom(); + proj = caff = aff; + pts.setRandom(Size,internal::random(1,20)); + + pts1 = pts.colwise().homogeneous(); + VERIFY_IS_APPROX(aff * pts.colwise().homogeneous(), (aff * pts1).colwise().hnormalized()); + VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized()); + VERIFY_IS_APPROX(proj * pts.colwise().homogeneous(), (proj * pts1)); + + VERIFY_IS_APPROX((aff * pts1).colwise().hnormalized(), aff * pts); + VERIFY_IS_APPROX((caff * pts1).colwise().hnormalized(), caff * pts); + + pts2 = pts1; + pts2.row(Size).setRandom(); + VERIFY_IS_APPROX((aff * pts2).colwise().hnormalized(), aff * pts2.colwise().hnormalized()); + VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized()); + VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized()); + + // Test combination of homogeneous + + VERIFY_IS_APPROX( (t2 * v0.homogeneous()).hnormalized(), + (t2.template topLeftCorner() * v0 + t2.template topRightCorner()) + / ((t2.template bottomLeftCorner<1,Size>()*v0).value() + t2(Size,Size)) ); + + VERIFY_IS_APPROX( (t2 * pts.colwise().homogeneous()).colwise().hnormalized(), + (Matrix(t2 * pts1).colwise().hnormalized()) ); + + VERIFY_IS_APPROX( (t2 .lazyProduct( v0.homogeneous() )).hnormalized(), (t2 * v0.homogeneous()).hnormalized() ); + VERIFY_IS_APPROX( (t2 .lazyProduct ( pts.colwise().homogeneous() )).colwise().hnormalized(), (t2 * pts1).colwise().hnormalized() ); + + VERIFY_IS_APPROX( (v0.transpose().homogeneous() .lazyProduct( t2 )).hnormalized(), (v0.transpose().homogeneous()*t2).hnormalized() ); + VERIFY_IS_APPROX( (pts.transpose().rowwise().homogeneous() .lazyProduct( t2 )).rowwise().hnormalized(), (pts1.transpose()*t2).rowwise().hnormalized() ); + + VERIFY_IS_APPROX( (t2.template triangularView() * v0.homogeneous()).eval(), (t2.template triangularView()*hv0) ); +} + +EIGEN_DECLARE_TEST(geo_homogeneous) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(( homogeneous() )); + CALL_SUBTEST_2(( homogeneous() )); + CALL_SUBTEST_3(( homogeneous() )); + } +} diff --git a/lib/eigen-3.4.0/test/geo_hyperplane.cpp b/lib/eigen-3.4.0/test/geo_hyperplane.cpp new file mode 100644 index 0000000..44b2f2a --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_hyperplane.cpp @@ -0,0 +1,192 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +template void hyperplane(const HyperplaneType& _plane) +{ + /* this test covers the following files: + Hyperplane.h + */ + using std::abs; + const Index dim = _plane.dim(); + enum { Options = HyperplaneType::Options }; + typedef typename HyperplaneType::Scalar Scalar; + typedef typename HyperplaneType::RealScalar RealScalar; + typedef Matrix VectorType; + typedef Matrix MatrixType; + + VectorType p0 = VectorType::Random(dim); + VectorType p1 = VectorType::Random(dim); + + VectorType n0 = VectorType::Random(dim).normalized(); + VectorType n1 = VectorType::Random(dim).normalized(); + + HyperplaneType pl0(n0, p0); + HyperplaneType pl1(n1, p1); + HyperplaneType pl2 = pl1; + + Scalar s0 = internal::random(); + Scalar s1 = internal::random(); + + VERIFY_IS_APPROX( n1.dot(n1), Scalar(1) ); + + VERIFY_IS_MUCH_SMALLER_THAN( pl0.absDistance(p0), Scalar(1) ); + if(numext::abs2(s0)>RealScalar(1e-6)) + VERIFY_IS_APPROX( pl1.signedDistance(p1 + n1 * s0), s0); + else + VERIFY_IS_MUCH_SMALLER_THAN( abs(pl1.signedDistance(p1 + n1 * s0) - s0), Scalar(1) ); + VERIFY_IS_MUCH_SMALLER_THAN( pl1.signedDistance(pl1.projection(p0)), Scalar(1) ); + VERIFY_IS_MUCH_SMALLER_THAN( pl1.absDistance(p1 + pl1.normal().unitOrthogonal() * s1), Scalar(1) ); + + // transform + if (!NumTraits::IsComplex) + { + MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ(); + DiagonalMatrix scaling(VectorType::Random()); + Translation translation(VectorType::Random()); + + while(scaling.diagonal().cwiseAbs().minCoeff()::type OtherScalar; + Hyperplane hp1f = pl1.template cast(); + VERIFY_IS_APPROX(hp1f.template cast(),pl1); + Hyperplane hp1d = pl1.template cast(); + VERIFY_IS_APPROX(hp1d.template cast(),pl1); +} + +template void lines() +{ + using std::abs; + typedef Hyperplane HLine; + typedef ParametrizedLine PLine; + typedef Matrix Vector; + typedef Matrix CoeffsType; + + for(int i = 0; i < 10; i++) + { + Vector center = Vector::Random(); + Vector u = Vector::Random(); + Vector v = Vector::Random(); + Scalar a = internal::random(); + while (abs(a-1) < Scalar(1e-4)) a = internal::random(); + while (u.norm() < Scalar(1e-4)) u = Vector::Random(); + while (v.norm() < Scalar(1e-4)) v = Vector::Random(); + + HLine line_u = HLine::Through(center + u, center + a*u); + HLine line_v = HLine::Through(center + v, center + a*v); + + // the line equations should be normalized so that a^2+b^2=1 + VERIFY_IS_APPROX(line_u.normal().norm(), Scalar(1)); + VERIFY_IS_APPROX(line_v.normal().norm(), Scalar(1)); + + Vector result = line_u.intersection(line_v); + + // the lines should intersect at the point we called "center" + if(abs(a-1) > Scalar(1e-2) && abs(v.normalized().dot(u.normalized())) void planes() +{ + using std::abs; + typedef Hyperplane Plane; + typedef Matrix Vector; + + for(int i = 0; i < 10; i++) + { + Vector v0 = Vector::Random(); + Vector v1(v0), v2(v0); + if(internal::random(0,1)>0.25) + v1 += Vector::Random(); + if(internal::random(0,1)>0.25) + v2 += v1 * std::pow(internal::random(0,1),internal::random(1,16)); + if(internal::random(0,1)>0.25) + v2 += Vector::Random() * std::pow(internal::random(0,1),internal::random(1,16)); + + Plane p0 = Plane::Through(v0, v1, v2); + + VERIFY_IS_APPROX(p0.normal().norm(), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v0), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v1), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v2), Scalar(1)); + } +} + +template void hyperplane_alignment() +{ + typedef Hyperplane Plane3a; + typedef Hyperplane Plane3u; + + EIGEN_ALIGN_MAX Scalar array1[4]; + EIGEN_ALIGN_MAX Scalar array2[4]; + EIGEN_ALIGN_MAX Scalar array3[4+1]; + Scalar* array3u = array3+1; + + Plane3a *p1 = ::new(reinterpret_cast(array1)) Plane3a; + Plane3u *p2 = ::new(reinterpret_cast(array2)) Plane3u; + Plane3u *p3 = ::new(reinterpret_cast(array3u)) Plane3u; + + p1->coeffs().setRandom(); + *p2 = *p1; + *p3 = *p1; + + VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs()); + VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs()); +} + + +EIGEN_DECLARE_TEST(geo_hyperplane) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( hyperplane(Hyperplane()) ); + CALL_SUBTEST_2( hyperplane(Hyperplane()) ); + CALL_SUBTEST_2( hyperplane(Hyperplane()) ); + CALL_SUBTEST_2( hyperplane_alignment() ); + CALL_SUBTEST_3( hyperplane(Hyperplane()) ); + CALL_SUBTEST_4( hyperplane(Hyperplane,5>()) ); + CALL_SUBTEST_1( lines() ); + CALL_SUBTEST_3( lines() ); + CALL_SUBTEST_2( planes() ); + CALL_SUBTEST_5( planes() ); + } +} diff --git a/lib/eigen-3.4.0/test/geo_orthomethods.cpp b/lib/eigen-3.4.0/test/geo_orthomethods.cpp new file mode 100644 index 0000000..b7b6607 --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_orthomethods.cpp @@ -0,0 +1,133 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +/* this test covers the following files: + Geometry/OrthoMethods.h +*/ + +template void orthomethods_3() +{ + typedef typename NumTraits::Real RealScalar; + typedef Matrix Matrix3; + typedef Matrix Vector3; + + typedef Matrix Vector4; + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(), + v2 = Vector3::Random(); + + // cross product + VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(v2).dot(v1), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(v1.dot(v1.cross(v2)), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(v2).dot(v2), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(v2.dot(v1.cross(v2)), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(Vector3::Random()).dot(v1), Scalar(1)); + Matrix3 mat3; + mat3 << v0.normalized(), + (v0.cross(v1)).normalized(), + (v0.cross(v1).cross(v0)).normalized(); + VERIFY(mat3.isUnitary()); + + mat3.setRandom(); + VERIFY_IS_APPROX(v0.cross(mat3*v1), -(mat3*v1).cross(v0)); + VERIFY_IS_APPROX(v0.cross(mat3.lazyProduct(v1)), -(mat3.lazyProduct(v1)).cross(v0)); + + // colwise/rowwise cross product + mat3.setRandom(); + Vector3 vec3 = Vector3::Random(); + Matrix3 mcross; + int i = internal::random(0,2); + mcross = mat3.colwise().cross(vec3); + VERIFY_IS_APPROX(mcross.col(i), mat3.col(i).cross(vec3)); + + VERIFY_IS_MUCH_SMALLER_THAN((mat3.adjoint() * mat3.colwise().cross(vec3)).diagonal().cwiseAbs().sum(), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN((mat3.adjoint() * mat3.colwise().cross(Vector3::Random())).diagonal().cwiseAbs().sum(), Scalar(1)); + + VERIFY_IS_MUCH_SMALLER_THAN((vec3.adjoint() * mat3.colwise().cross(vec3)).cwiseAbs().sum(), Scalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN((vec3.adjoint() * Matrix3::Random().colwise().cross(vec3)).cwiseAbs().sum(), Scalar(1)); + + mcross = mat3.rowwise().cross(vec3); + VERIFY_IS_APPROX(mcross.row(i), mat3.row(i).cross(vec3)); + + // cross3 + Vector4 v40 = Vector4::Random(), + v41 = Vector4::Random(), + v42 = Vector4::Random(); + v40.w() = v41.w() = v42.w() = 0; + v42.template head<3>() = v40.template head<3>().cross(v41.template head<3>()); + VERIFY_IS_APPROX(v40.cross3(v41), v42); + VERIFY_IS_MUCH_SMALLER_THAN(v40.cross3(Vector4::Random()).dot(v40), Scalar(1)); + + // check mixed product + typedef Matrix RealVector3; + RealVector3 rv1 = RealVector3::Random(); + VERIFY_IS_APPROX(v1.cross(rv1.template cast()), v1.cross(rv1)); + VERIFY_IS_APPROX(rv1.template cast().cross(v1), rv1.cross(v1)); +} + +template void orthomethods(int size=Size) +{ + typedef typename NumTraits::Real RealScalar; + typedef Matrix VectorType; + typedef Matrix Matrix3N; + typedef Matrix MatrixN3; + typedef Matrix Vector3; + + VectorType v0 = VectorType::Random(size); + + // unitOrthogonal + VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); + VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); + + if (size>=3) + { + v0.template head<2>().setZero(); + v0.tail(size-2).setRandom(); + + VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); + VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); + } + + // colwise/rowwise cross product + Vector3 vec3 = Vector3::Random(); + int i = internal::random(0,size-1); + + Matrix3N mat3N(3,size), mcross3N(3,size); + mat3N.setRandom(); + mcross3N = mat3N.colwise().cross(vec3); + VERIFY_IS_APPROX(mcross3N.col(i), mat3N.col(i).cross(vec3)); + + MatrixN3 matN3(size,3), mcrossN3(size,3); + matN3.setRandom(); + mcrossN3 = matN3.rowwise().cross(vec3); + VERIFY_IS_APPROX(mcrossN3.row(i), matN3.row(i).cross(vec3)); +} + +EIGEN_DECLARE_TEST(geo_orthomethods) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( orthomethods_3() ); + CALL_SUBTEST_2( orthomethods_3() ); + CALL_SUBTEST_4( orthomethods_3 >() ); + CALL_SUBTEST_1( (orthomethods()) ); + CALL_SUBTEST_2( (orthomethods()) ); + CALL_SUBTEST_1( (orthomethods()) ); + CALL_SUBTEST_2( (orthomethods()) ); + CALL_SUBTEST_3( (orthomethods()) ); + CALL_SUBTEST_4( (orthomethods,8>()) ); + CALL_SUBTEST_5( (orthomethods(36)) ); + CALL_SUBTEST_6( (orthomethods(35)) ); + } +} diff --git a/lib/eigen-3.4.0/test/geo_parametrizedline.cpp b/lib/eigen-3.4.0/test/geo_parametrizedline.cpp new file mode 100644 index 0000000..e4b194a --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_parametrizedline.cpp @@ -0,0 +1,125 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +template void parametrizedline(const LineType& _line) +{ + /* this test covers the following files: + ParametrizedLine.h + */ + using std::abs; + const Index dim = _line.dim(); + typedef typename LineType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix VectorType; + typedef Hyperplane HyperplaneType; + typedef Matrix MatrixType; + + VectorType p0 = VectorType::Random(dim); + VectorType p1 = VectorType::Random(dim); + + VectorType d0 = VectorType::Random(dim).normalized(); + + LineType l0(p0, d0); + + Scalar s0 = internal::random(); + Scalar s1 = abs(internal::random()); + + VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0), RealScalar(1) ); + VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0+s0*d0), RealScalar(1) ); + VERIFY_IS_APPROX( (l0.projection(p1)-p1).norm(), l0.distance(p1) ); + VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(l0.projection(p1)), RealScalar(1) ); + VERIFY_IS_APPROX( Scalar(l0.distance((p0+s0*d0) + d0.unitOrthogonal() * s1)), s1 ); + + // casting + const int Dim = LineType::AmbientDimAtCompileTime; + typedef typename GetDifferentType::type OtherScalar; + ParametrizedLine hp1f = l0.template cast(); + VERIFY_IS_APPROX(hp1f.template cast(),l0); + ParametrizedLine hp1d = l0.template cast(); + VERIFY_IS_APPROX(hp1d.template cast(),l0); + + // intersections + VectorType p2 = VectorType::Random(dim); + VectorType n2 = VectorType::Random(dim).normalized(); + HyperplaneType hp(p2,n2); + Scalar t = l0.intersectionParameter(hp); + VectorType pi = l0.pointAt(t); + VERIFY_IS_MUCH_SMALLER_THAN(hp.signedDistance(pi), RealScalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(l0.distance(pi), RealScalar(1)); + VERIFY_IS_APPROX(l0.intersectionPoint(hp), pi); + + // transform + if (!NumTraits::IsComplex) + { + MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ(); + DiagonalMatrix scaling(VectorType::Random()); + Translation translation(VectorType::Random()); + + while(scaling.diagonal().cwiseAbs().minCoeff() void parametrizedline_alignment() +{ + typedef ParametrizedLine Line4a; + typedef ParametrizedLine Line4u; + + EIGEN_ALIGN_MAX Scalar array1[16]; + EIGEN_ALIGN_MAX Scalar array2[16]; + EIGEN_ALIGN_MAX Scalar array3[16+1]; + Scalar* array3u = array3+1; + + Line4a *p1 = ::new(reinterpret_cast(array1)) Line4a; + Line4u *p2 = ::new(reinterpret_cast(array2)) Line4u; + Line4u *p3 = ::new(reinterpret_cast(array3u)) Line4u; + + p1->origin().setRandom(); + p1->direction().setRandom(); + *p2 = *p1; + *p3 = *p1; + + VERIFY_IS_APPROX(p1->origin(), p2->origin()); + VERIFY_IS_APPROX(p1->origin(), p3->origin()); + VERIFY_IS_APPROX(p1->direction(), p2->direction()); + VERIFY_IS_APPROX(p1->direction(), p3->direction()); +} + +EIGEN_DECLARE_TEST(geo_parametrizedline) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( parametrizedline(ParametrizedLine()) ); + CALL_SUBTEST_2( parametrizedline(ParametrizedLine()) ); + CALL_SUBTEST_2( parametrizedline_alignment() ); + CALL_SUBTEST_3( parametrizedline(ParametrizedLine()) ); + CALL_SUBTEST_3( parametrizedline_alignment() ); + CALL_SUBTEST_4( parametrizedline(ParametrizedLine,5>()) ); + } +} diff --git a/lib/eigen-3.4.0/test/geo_quaternion.cpp b/lib/eigen-3.4.0/test/geo_quaternion.cpp new file mode 100644 index 0000000..c561fc8 --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_quaternion.cpp @@ -0,0 +1,332 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2009 Mathieu Gautier +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include +#include "AnnoyingScalar.h" + +template T bounded_acos(T v) +{ + using std::acos; + using std::min; + using std::max; + return acos((max)(T(-1),(min)(v,T(1)))); +} + +template void check_slerp(const QuatType& q0, const QuatType& q1) +{ + using std::abs; + typedef typename QuatType::Scalar Scalar; + typedef AngleAxis AA; + + Scalar largeEps = test_precision(); + + Scalar theta_tot = AA(q1*q0.inverse()).angle(); + if(theta_tot>Scalar(EIGEN_PI)) + theta_tot = Scalar(2.)*Scalar(EIGEN_PI)-theta_tot; + for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1)) + { + QuatType q = q0.slerp(t,q1); + Scalar theta = AA(q*q0.inverse()).angle(); + VERIFY(abs(q.norm() - 1) < largeEps); + if(theta_tot==0) VERIFY(theta_tot==0); + else VERIFY(abs(theta - t * theta_tot) < largeEps); + } +} + +template void quaternion(void) +{ + /* this test covers the following files: + Quaternion.h + */ + using std::abs; + typedef Matrix Vector3; + typedef Matrix Matrix3; + typedef Quaternion Quaternionx; + typedef AngleAxis AngleAxisx; + + Scalar largeEps = test_precision(); + if (internal::is_same::value) + largeEps = Scalar(1e-3); + + Scalar eps = internal::random() * Scalar(1e-2); + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(), + v2 = Vector3::Random(), + v3 = Vector3::Random(); + + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)), + b = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + + // Quaternion: Identity(), setIdentity(); + Quaternionx q1, q2; + q2.setIdentity(); + VERIFY_IS_APPROX(Quaternionx(Quaternionx::Identity()).coeffs(), q2.coeffs()); + q1.coeffs().setRandom(); + VERIFY_IS_APPROX(q1.coeffs(), (q1*q2).coeffs()); + +#ifndef EIGEN_NO_IO + // Printing + std::ostringstream ss; + ss << q2; + VERIFY(ss.str() == "0i + 0j + 0k + 1"); +#endif + + // concatenation + q1 *= q2; + + q1 = AngleAxisx(a, v0.normalized()); + q2 = AngleAxisx(a, v1.normalized()); + + // angular distance + Scalar refangle = abs(AngleAxisx(q1.inverse()*q2).angle()); + if (refangle>Scalar(EIGEN_PI)) + refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle; + + if((q1.coeffs()-q2.coeffs()).norm() > Scalar(10)*largeEps) + { + VERIFY_IS_MUCH_SMALLER_THAN(abs(q1.angularDistance(q2) - refangle), Scalar(1)); + } + + // rotation matrix conversion + VERIFY_IS_APPROX(q1 * v2, q1.toRotationMatrix() * v2); + VERIFY_IS_APPROX(q1 * q2 * v2, + q1.toRotationMatrix() * q2.toRotationMatrix() * v2); + + VERIFY( (q2*q1).isApprox(q1*q2, largeEps) + || !(q2 * q1 * v2).isApprox(q1.toRotationMatrix() * q2.toRotationMatrix() * v2)); + + q2 = q1.toRotationMatrix(); + VERIFY_IS_APPROX(q1*v1,q2*v1); + + Matrix3 rot1(q1); + VERIFY_IS_APPROX(q1*v1,rot1*v1); + Quaternionx q3(rot1.transpose()*rot1); + VERIFY_IS_APPROX(q3*v1,v1); + + + // angle-axis conversion + AngleAxisx aa = AngleAxisx(q1); + VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); + + // Do not execute the test if the rotation angle is almost zero, or + // the rotation axis and v1 are almost parallel. + if (abs(aa.angle()) > Scalar(5)*test_precision() + && (aa.axis() - v1.normalized()).norm() < Scalar(1.99) + && (aa.axis() + v1.normalized()).norm() < Scalar(1.99)) + { + VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1); + } + + // from two vector creation + 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 (internal::is_same::value) + { + v3 = (v1.array()+eps).matrix(); + VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized()); + VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized()); + } + + // from two vector creation static function + VERIFY_IS_APPROX( v2.normalized(),(Quaternionx::FromTwoVectors(v1, v2)*v1).normalized()); + VERIFY_IS_APPROX( v1.normalized(),(Quaternionx::FromTwoVectors(v1, v1)*v1).normalized()); + VERIFY_IS_APPROX(-v1.normalized(),(Quaternionx::FromTwoVectors(v1,-v1)*v1).normalized()); + if (internal::is_same::value) + { + v3 = (v1.array()+eps).matrix(); + VERIFY_IS_APPROX( v3.normalized(),(Quaternionx::FromTwoVectors(v1, v3)*v1).normalized()); + VERIFY_IS_APPROX(-v3.normalized(),(Quaternionx::FromTwoVectors(v1,-v3)*v1).normalized()); + } + + // inverse and conjugate + VERIFY_IS_APPROX(q1 * (q1.inverse() * v1), v1); + VERIFY_IS_APPROX(q1 * (q1.conjugate() * v1), v1); + + // test casting + Quaternion q1f = q1.template cast(); + VERIFY_IS_APPROX(q1f.template cast(),q1); + Quaternion q1d = q1.template cast(); + VERIFY_IS_APPROX(q1d.template cast(),q1); + + // test bug 369 - improper alignment. + Quaternionx *q = new Quaternionx; + delete q; + + q1 = Quaternionx::UnitRandom(); + q2 = Quaternionx::UnitRandom(); + check_slerp(q1,q2); + + q1 = AngleAxisx(b, v1.normalized()); + q2 = AngleAxisx(b+Scalar(EIGEN_PI), v1.normalized()); + check_slerp(q1,q2); + + q1 = AngleAxisx(b, v1.normalized()); + q2 = AngleAxisx(-b, -v1.normalized()); + check_slerp(q1,q2); + + q1 = Quaternionx::UnitRandom(); + q2.coeffs() = -q1.coeffs(); + check_slerp(q1,q2); +} + +template void mapQuaternion(void){ + typedef Map, Aligned> MQuaternionA; + typedef Map, Aligned> MCQuaternionA; + typedef Map > MQuaternionUA; + typedef Map > MCQuaternionUA; + typedef Quaternion Quaternionx; + typedef Matrix Vector3; + typedef AngleAxis AngleAxisx; + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(); + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + + EIGEN_ALIGN_MAX Scalar array1[4]; + EIGEN_ALIGN_MAX Scalar array2[4]; + EIGEN_ALIGN_MAX Scalar array3[4+1]; + Scalar* array3unaligned = array3+1; + + MQuaternionA mq1(array1); + MCQuaternionA mcq1(array1); + MQuaternionA mq2(array2); + MQuaternionUA mq3(array3unaligned); + MCQuaternionUA mcq3(array3unaligned); + +// std::cerr << array1 << " " << array2 << " " << array3 << "\n"; + mq1 = AngleAxisx(a, v0.normalized()); + mq2 = mq1; + mq3 = mq1; + + Quaternionx q1 = mq1; + Quaternionx q2 = mq2; + Quaternionx q3 = mq3; + Quaternionx q4 = MCQuaternionUA(array3unaligned); + + VERIFY_IS_APPROX(q1.coeffs(), q2.coeffs()); + VERIFY_IS_APPROX(q1.coeffs(), q3.coeffs()); + VERIFY_IS_APPROX(q4.coeffs(), q3.coeffs()); + + VERIFY_IS_APPROX(mq1 * (mq1.inverse() * v1), v1); + VERIFY_IS_APPROX(mq1 * (mq1.conjugate() * v1), v1); + + VERIFY_IS_APPROX(mcq1 * (mcq1.inverse() * v1), v1); + VERIFY_IS_APPROX(mcq1 * (mcq1.conjugate() * v1), v1); + + VERIFY_IS_APPROX(mq3 * (mq3.inverse() * v1), v1); + VERIFY_IS_APPROX(mq3 * (mq3.conjugate() * v1), v1); + + VERIFY_IS_APPROX(mcq3 * (mcq3.inverse() * v1), v1); + VERIFY_IS_APPROX(mcq3 * (mcq3.conjugate() * v1), v1); + + VERIFY_IS_APPROX(mq1*mq2, q1*q2); + VERIFY_IS_APPROX(mq3*mq2, q3*q2); + VERIFY_IS_APPROX(mcq1*mq2, q1*q2); + VERIFY_IS_APPROX(mcq3*mq2, q3*q2); + + // Bug 1461, compilation issue with Map::w(), and other reference/constness checks: + VERIFY_IS_APPROX(mcq3.coeffs().x() + mcq3.coeffs().y() + mcq3.coeffs().z() + mcq3.coeffs().w(), mcq3.coeffs().sum()); + VERIFY_IS_APPROX(mcq3.x() + mcq3.y() + mcq3.z() + mcq3.w(), mcq3.coeffs().sum()); + mq3.w() = 1; + const Quaternionx& cq3(q3); + VERIFY( &cq3.x() == &q3.x() ); + const MQuaternionUA& cmq3(mq3); + VERIFY( &cmq3.x() == &mq3.x() ); + // FIXME the following should be ok. The problem is that currently the LValueBit flag + // is used to determine whether we can return a coeff by reference or not, which is not enough for Map. + //const MCQuaternionUA& cmcq3(mcq3); + //VERIFY( &cmcq3.x() == &mcq3.x() ); + + // test cast + { + Quaternion q1f = mq1.template cast(); + VERIFY_IS_APPROX(q1f.template cast(),mq1); + Quaternion q1d = mq1.template cast(); + VERIFY_IS_APPROX(q1d.template cast(),mq1); + } +} + +template void quaternionAlignment(void){ + typedef Quaternion QuaternionA; + typedef Quaternion QuaternionUA; + + EIGEN_ALIGN_MAX Scalar array1[4]; + EIGEN_ALIGN_MAX Scalar array2[4]; + EIGEN_ALIGN_MAX Scalar array3[4+1]; + Scalar* arrayunaligned = array3+1; + + QuaternionA *q1 = ::new(reinterpret_cast(array1)) QuaternionA; + QuaternionUA *q2 = ::new(reinterpret_cast(array2)) QuaternionUA; + QuaternionUA *q3 = ::new(reinterpret_cast(arrayunaligned)) QuaternionUA; + + q1->coeffs().setRandom(); + *q2 = *q1; + *q3 = *q1; + + VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs()); + VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs()); +} + +template void check_const_correctness(const PlainObjectType&) +{ + // there's a lot that we can't test here while still having this test compile! + // the only possible approach would be to run a script trying to compile stuff and checking that it fails. + // CMake can help with that. + + // verify that map-to-const don't have LvalueBit + typedef typename internal::add_const::type ConstPlainObjectType; + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); +} + +#if EIGEN_HAS_RVALUE_REFERENCES + +// Regression for bug 1573 +struct MovableClass { + // The following line is a workaround for gcc 4.7 and 4.8 (see bug 1573 comments). + static_assert(std::is_nothrow_move_constructible::value,""); + MovableClass() = default; + MovableClass(const MovableClass&) = default; + MovableClass(MovableClass&&) noexcept = default; + MovableClass& operator=(const MovableClass&) = default; + MovableClass& operator=(MovableClass&&) = default; + Quaternionf m_quat; +}; + +#endif + +EIGEN_DECLARE_TEST(geo_quaternion) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(( quaternion() )); + CALL_SUBTEST_1( check_const_correctness(Quaternionf()) ); + CALL_SUBTEST_1(( quaternion() )); + CALL_SUBTEST_1(( quaternionAlignment() )); + CALL_SUBTEST_1( mapQuaternion() ); + + CALL_SUBTEST_2(( quaternion() )); + CALL_SUBTEST_2( check_const_correctness(Quaterniond()) ); + CALL_SUBTEST_2(( quaternion() )); + CALL_SUBTEST_2(( quaternionAlignment() )); + CALL_SUBTEST_2( mapQuaternion() ); + +#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW + AnnoyingScalar::dont_throw = true; +#endif + CALL_SUBTEST_3(( quaternion() )); + } +} diff --git a/lib/eigen-3.4.0/test/geo_transformations.cpp b/lib/eigen-3.4.0/test/geo_transformations.cpp new file mode 100644 index 0000000..72c6eda --- /dev/null +++ b/lib/eigen-3.4.0/test/geo_transformations.cpp @@ -0,0 +1,731 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +template +Matrix angleToVec(T a) +{ + return Matrix(std::cos(a), std::sin(a)); +} + +// This permits to workaround a bug in clang/llvm code generation. +template +EIGEN_DONT_INLINE +void dont_over_optimize(T& x) { volatile typename T::Scalar tmp = x(0); x(0) = tmp; } + +template void non_projective_only() +{ + /* this test covers the following files: + Cross.h Quaternion.h, Transform.cpp + */ + typedef Matrix Vector3; + typedef Quaternion Quaternionx; + typedef AngleAxis AngleAxisx; + typedef Transform Transform3; + typedef DiagonalMatrix AlignedScaling3; + typedef Translation Translation3; + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(); + + Transform3 t0, t1, t2; + + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + + Quaternionx q1, q2; + + q1 = AngleAxisx(a, v0.normalized()); + + t0 = Transform3::Identity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + + t0.linear() = q1.toRotationMatrix(); + + v0 << 50, 2, 1; + t0.scale(v0); + + VERIFY_IS_APPROX( (t0 * Vector3(1,0,0)).template head<3>().norm(), v0.x()); + + t0.setIdentity(); + t1.setIdentity(); + v1 << 1, 2, 3; + t0.linear() = q1.toRotationMatrix(); + t0.pretranslate(v0); + t0.scale(v1); + t1.linear() = q1.conjugate().toRotationMatrix(); + t1.prescale(v1.cwiseInverse()); + t1.translate(-v0); + + VERIFY((t0 * t1).matrix().isIdentity(test_precision())); + + t1.fromPositionOrientationScale(v0, q1, v1); + VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); + VERIFY_IS_APPROX(t1*v1, t0*v1); + + // translation * vector + t0.setIdentity(); + t0.translate(v0); + VERIFY_IS_APPROX((t0 * v1).template head<3>(), Translation3(v0) * v1); + + // AlignedScaling * vector + t0.setIdentity(); + t0.scale(v0); + VERIFY_IS_APPROX((t0 * v1).template head<3>(), AlignedScaling3(v0) * v1); +} + +template void transformations() +{ + /* this test covers the following files: + Cross.h Quaternion.h, Transform.cpp + */ + using std::cos; + using std::abs; + typedef Matrix Matrix3; + typedef Matrix Matrix4; + typedef Matrix Vector2; + typedef Matrix Vector3; + typedef Matrix Vector4; + typedef Quaternion Quaternionx; + typedef AngleAxis AngleAxisx; + typedef Transform Transform2; + typedef Transform Transform3; + typedef typename Transform3::MatrixType MatrixType; + typedef DiagonalMatrix AlignedScaling3; + typedef Translation Translation2; + typedef Translation Translation3; + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(); + Matrix3 matrot1, m; + + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + Scalar s0 = internal::random(), s1 = internal::random(); + + while(v0.norm() < test_precision()) v0 = Vector3::Random(); + while(v1.norm() < test_precision()) v1 = Vector3::Random(); + + VERIFY_IS_APPROX(v0, AngleAxisx(a, v0.normalized()) * v0); + VERIFY_IS_APPROX(-v0, AngleAxisx(Scalar(EIGEN_PI), v0.unitOrthogonal()) * v0); + if(abs(cos(a)) > test_precision()) + { + VERIFY_IS_APPROX(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); + + Quaternionx q1, q2; + q1 = AngleAxisx(a, v0.normalized()); + q2 = AngleAxisx(a, v1.normalized()); + + // rotation matrix conversion + matrot1 = AngleAxisx(Scalar(0.1), Vector3::UnitX()) + * AngleAxisx(Scalar(0.2), Vector3::UnitY()) + * AngleAxisx(Scalar(0.3), Vector3::UnitZ()); + VERIFY_IS_APPROX(matrot1 * v1, + AngleAxisx(Scalar(0.1), Vector3(1,0,0)).toRotationMatrix() + * (AngleAxisx(Scalar(0.2), Vector3(0,1,0)).toRotationMatrix() + * (AngleAxisx(Scalar(0.3), Vector3(0,0,1)).toRotationMatrix() * v1))); + + // angle-axis conversion + AngleAxisx aa = AngleAxisx(q1); + VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); + + // The following test is stable only if 2*angle != angle and v1 is not colinear with axis + if( (abs(aa.angle()) > test_precision()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision())) ) + { + VERIFY( !(q1 * v1).isApprox(Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1) ); + } + + aa.fromRotationMatrix(aa.toRotationMatrix()); + VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); + // The following test is stable only if 2*angle != angle and v1 is not colinear with axis + if( (abs(aa.angle()) > test_precision()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision())) ) + { + VERIFY( !(q1 * v1).isApprox(Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1) ); + } + + // AngleAxis + VERIFY_IS_APPROX(AngleAxisx(a,v1.normalized()).toRotationMatrix(), + Quaternionx(AngleAxisx(a,v1.normalized())).toRotationMatrix()); + + AngleAxisx aa1; + m = q1.toRotationMatrix(); + aa1 = m; + VERIFY_IS_APPROX(AngleAxisx(m).toRotationMatrix(), + Quaternionx(m).toRotationMatrix()); + + // Transform + // TODO complete the tests ! + a = 0; + while (abs(a)(-Scalar(0.4)*Scalar(EIGEN_PI), Scalar(0.4)*Scalar(EIGEN_PI)); + q1 = AngleAxisx(a, v0.normalized()); + Transform3 t0, t1, t2; + + // first test setIdentity() and Identity() + t0.setIdentity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + t0.matrix().setZero(); + t0 = Transform3::Identity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + + t0.setIdentity(); + t1.setIdentity(); + v1 << 1, 2, 3; + t0.linear() = q1.toRotationMatrix(); + t0.pretranslate(v0); + t0.scale(v1); + t1.linear() = q1.conjugate().toRotationMatrix(); + t1.prescale(v1.cwiseInverse()); + t1.translate(-v0); + + VERIFY((t0 * t1).matrix().isIdentity(test_precision())); + + t1.fromPositionOrientationScale(v0, q1, v1); + VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); + + t0.setIdentity(); t0.scale(v0).rotate(q1.toRotationMatrix()); + t1.setIdentity(); t1.scale(v0).rotate(q1); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + t0.setIdentity(); t0.scale(v0).rotate(AngleAxisx(q1)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + VERIFY_IS_APPROX(t0.scale(a).matrix(), t1.scale(Vector3::Constant(a)).matrix()); + VERIFY_IS_APPROX(t0.prescale(a).matrix(), t1.prescale(Vector3::Constant(a)).matrix()); + + // More transform constructors, operator=, operator*= + + Matrix3 mat3 = Matrix3::Random(); + Matrix4 mat4; + mat4 << mat3 , Vector3::Zero() , Vector4::Zero().transpose(); + Transform3 tmat3(mat3), tmat4(mat4); + if(Mode!=int(AffineCompact)) + tmat4.matrix()(3,3) = Scalar(1); + VERIFY_IS_APPROX(tmat3.matrix(), tmat4.matrix()); + + Scalar a3 = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + Vector3 v3 = Vector3::Random().normalized(); + AngleAxisx aa3(a3, v3); + Transform3 t3(aa3); + Transform3 t4; + t4 = aa3; + VERIFY_IS_APPROX(t3.matrix(), t4.matrix()); + t4.rotate(AngleAxisx(-a3,v3)); + VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); + t4 *= aa3; + VERIFY_IS_APPROX(t3.matrix(), t4.matrix()); + + do { + v3 = Vector3::Random(); + dont_over_optimize(v3); + } while (v3.cwiseAbs().minCoeff()::epsilon()); + Translation3 tv3(v3); + Transform3 t5(tv3); + t4 = tv3; + VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); + t4.translate((-v3).eval()); + VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); + t4 *= tv3; + VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); + + AlignedScaling3 sv3(v3); + Transform3 t6(sv3); + t4 = sv3; + VERIFY_IS_APPROX(t6.matrix(), t4.matrix()); + t4.scale(v3.cwiseInverse()); + VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); + t4 *= sv3; + VERIFY_IS_APPROX(t6.matrix(), t4.matrix()); + + // matrix * transform + VERIFY_IS_APPROX((t3.matrix()*t4).matrix(), (t3*t4).matrix()); + + // chained Transform product + VERIFY_IS_APPROX(((t3*t4)*t5).matrix(), (t3*(t4*t5)).matrix()); + + // check that Transform product doesn't have aliasing problems + t5 = t4; + t5 = t5*t5; + VERIFY_IS_APPROX(t5, t4*t4); + + // 2D transformation + Transform2 t20, t21; + Vector2 v20 = Vector2::Random(); + Vector2 v21 = Vector2::Random(); + for (int k=0; k<2; ++k) + if (abs(v21[k])(a).toRotationMatrix(); + VERIFY_IS_APPROX(t20.fromPositionOrientationScale(v20,a,v21).matrix(), + t21.pretranslate(v20).scale(v21).matrix()); + + t21.setIdentity(); + t21.linear() = Rotation2D(-a).toRotationMatrix(); + VERIFY( (t20.fromPositionOrientationScale(v20,a,v21) + * (t21.prescale(v21.cwiseInverse()).translate(-v20))).matrix().isIdentity(test_precision()) ); + + // Transform - new API + // 3D + t0.setIdentity(); + t0.rotate(q1).scale(v0).translate(v0); + // mat * aligned scaling and mat * translation + t1 = (Matrix3(q1) * AlignedScaling3(v0)) * Translation3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t1 = (Matrix3(q1) * Eigen::Scaling(v0)) * Translation3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t1 = (q1 * Eigen::Scaling(v0)) * Translation3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + // mat * transformation and aligned scaling * translation + t1 = Matrix3(q1) * (AlignedScaling3(v0) * Translation3(v0)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + + t0.setIdentity(); + t0.scale(s0).translate(v0); + t1 = Eigen::Scaling(s0) * Translation3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t0.prescale(s0); + t1 = Eigen::Scaling(s0) * t1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + t0 = t3; + t0.scale(s0); + t1 = t3 * Eigen::Scaling(s0,s0,s0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t0.prescale(s0); + t1 = Eigen::Scaling(s0,s0,s0) * t1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + t0 = t3; + t0.scale(s0); + t1 = t3 * Eigen::Scaling(s0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t0.prescale(s0); + t1 = Eigen::Scaling(s0) * t1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + t0.setIdentity(); + t0.prerotate(q1).prescale(v0).pretranslate(v0); + // translation * aligned scaling and transformation * mat + t1 = (Translation3(v0) * AlignedScaling3(v0)) * Transform3(q1); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + // scaling * mat and translation * mat + t1 = Translation3(v0) * (AlignedScaling3(v0) * Transform3(q1)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + t0.setIdentity(); + t0.scale(v0).translate(v0).rotate(q1); + // translation * mat and aligned scaling * transformation + t1 = AlignedScaling3(v0) * (Translation3(v0) * Transform3(q1)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + // transformation * aligned scaling + t0.scale(v0); + t1 *= AlignedScaling3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + t1 = AlignedScaling3(v0) * (Translation3(v0) * Transform3(q1)); + t1 = t1 * v0.asDiagonal(); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + // transformation * translation + t0.translate(v0); + t1 = t1 * Translation3(v0); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + // translation * transformation + t0.pretranslate(v0); + t1 = Translation3(v0) * t1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // transform * quaternion + t0.rotate(q1); + t1 = t1 * q1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // translation * quaternion + t0.translate(v1).rotate(q1); + t1 = t1 * (Translation3(v1) * q1); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // aligned scaling * quaternion + t0.scale(v1).rotate(q1); + t1 = t1 * (AlignedScaling3(v1) * q1); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // quaternion * transform + t0.prerotate(q1); + t1 = q1 * t1; + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // quaternion * translation + t0.rotate(q1).translate(v1); + t1 = t1 * (q1 * Translation3(v1)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // quaternion * aligned scaling + t0.rotate(q1).scale(v1); + t1 = t1 * (q1 * AlignedScaling3(v1)); + VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); + + // test transform inversion + t0.setIdentity(); + t0.translate(v0); + do { + t0.linear().setRandom(); + } while(t0.linear().jacobiSvd().singularValues()(2)()); + Matrix4 t044 = Matrix4::Zero(); + t044(3,3) = 1; + t044.block(0,0,t0.matrix().rows(),4) = t0.matrix(); + VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4)); + t0.setIdentity(); + t0.translate(v0).rotate(q1); + t044 = Matrix4::Zero(); + t044(3,3) = 1; + t044.block(0,0,t0.matrix().rows(),4) = t0.matrix(); + VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4)); + + Matrix3 mat_rotation, mat_scaling; + t0.setIdentity(); + t0.translate(v0).rotate(q1).scale(v1); + t0.computeRotationScaling(&mat_rotation, &mat_scaling); + VERIFY_IS_APPROX(t0.linear(), mat_rotation * mat_scaling); + VERIFY_IS_APPROX(mat_rotation*mat_rotation.adjoint(), Matrix3::Identity()); + VERIFY_IS_APPROX(mat_rotation.determinant(), Scalar(1)); + t0.computeScalingRotation(&mat_scaling, &mat_rotation); + VERIFY_IS_APPROX(t0.linear(), mat_scaling * mat_rotation); + VERIFY_IS_APPROX(mat_rotation*mat_rotation.adjoint(), Matrix3::Identity()); + VERIFY_IS_APPROX(mat_rotation.determinant(), Scalar(1)); + + // test casting + Transform t1f = t1.template cast(); + VERIFY_IS_APPROX(t1f.template cast(),t1); + Transform t1d = t1.template cast(); + VERIFY_IS_APPROX(t1d.template cast(),t1); + + Translation3 tr1(v0); + Translation tr1f = tr1.template cast(); + VERIFY_IS_APPROX(tr1f.template cast(),tr1); + Translation tr1d = tr1.template cast(); + VERIFY_IS_APPROX(tr1d.template cast(),tr1); + + AngleAxis aa1f = aa1.template cast(); + VERIFY_IS_APPROX(aa1f.template cast(),aa1); + AngleAxis aa1d = aa1.template cast(); + VERIFY_IS_APPROX(aa1d.template cast(),aa1); + + Rotation2D r2d1(internal::random()); + Rotation2D r2d1f = r2d1.template cast(); + VERIFY_IS_APPROX(r2d1f.template cast(),r2d1); + Rotation2D r2d1d = r2d1.template cast(); + VERIFY_IS_APPROX(r2d1d.template cast(),r2d1); + + for(int k=0; k<100; ++k) + { + Scalar angle = internal::random(-100,100); + Rotation2D rot2(angle); + VERIFY( rot2.smallestPositiveAngle() >= 0 ); + VERIFY( rot2.smallestPositiveAngle() <= Scalar(2)*Scalar(EIGEN_PI) ); + VERIFY_IS_APPROX( angleToVec(rot2.smallestPositiveAngle()), angleToVec(rot2.angle()) ); + + VERIFY( rot2.smallestAngle() >= -Scalar(EIGEN_PI) ); + VERIFY( rot2.smallestAngle() <= Scalar(EIGEN_PI) ); + VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot2.angle()) ); + + Matrix rot2_as_mat(rot2); + Rotation2D rot3(rot2_as_mat); + VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot3.angle()) ); + } + + s0 = internal::random(-100,100); + s1 = internal::random(-100,100); + Rotation2D R0(s0), R1(s1); + + t20 = Translation2(v20) * (R0 * Eigen::Scaling(s0)); + t21 = Translation2(v20) * R0 * Eigen::Scaling(s0); + VERIFY_IS_APPROX(t20,t21); + + t20 = Translation2(v20) * (R0 * R0.inverse() * Eigen::Scaling(s0)); + t21 = Translation2(v20) * Eigen::Scaling(s0); + VERIFY_IS_APPROX(t20,t21); + + VERIFY_IS_APPROX(s0, (R0.slerp(0, R1)).angle()); + VERIFY_IS_APPROX( angleToVec(R1.smallestPositiveAngle()), angleToVec((R0.slerp(1, R1)).smallestPositiveAngle()) ); + VERIFY_IS_APPROX(R0.smallestPositiveAngle(), (R0.slerp(0.5, R0)).smallestPositiveAngle()); + + if(std::cos(s0)>0) + VERIFY_IS_MUCH_SMALLER_THAN((R0.slerp(0.5, R0.inverse())).smallestAngle(), Scalar(1)); + else + VERIFY_IS_APPROX(Scalar(EIGEN_PI), (R0.slerp(0.5, R0.inverse())).smallestPositiveAngle()); + + // Check path length + Scalar l = 0; + int path_steps = 100; + for(int k=0; k::epsilon()*Scalar(path_steps/2))); + + // check basic features + { + Rotation2D r1; // default ctor + r1 = Rotation2D(s0); // copy assignment + VERIFY_IS_APPROX(r1.angle(),s0); + Rotation2D r2(r1); // copy ctor + VERIFY_IS_APPROX(r2.angle(),s0); + } + + { + Transform3 t32(Matrix4::Random()), t33, t34; + t34 = t33 = t32; + t32.scale(v0); + t33*=AlignedScaling3(v0); + VERIFY_IS_APPROX(t32.matrix(), t33.matrix()); + t33 = t34 * AlignedScaling3(v0); + VERIFY_IS_APPROX(t32.matrix(), t33.matrix()); + } + +} + +template +void transform_associativity_left(const A1& a1, const A2& a2, const P& p, const Q& q, const V& v, const H& h) +{ + VERIFY_IS_APPROX( q*(a1*v), (q*a1)*v ); + VERIFY_IS_APPROX( q*(a2*v), (q*a2)*v ); + VERIFY_IS_APPROX( q*(p*h).hnormalized(), ((q*p)*h).hnormalized() ); +} + +template +void transform_associativity2(const A1& a1, const A2& a2, const P& p, const Q& q, const V& v, const H& h) +{ + VERIFY_IS_APPROX( a1*(q*v), (a1*q)*v ); + VERIFY_IS_APPROX( a2*(q*v), (a2*q)*v ); + VERIFY_IS_APPROX( p *(q*v).homogeneous(), (p *q)*v.homogeneous() ); + + transform_associativity_left(a1, a2,p, q, v, h); +} + +template +void transform_associativity(const RotationType& R) +{ + typedef Matrix VectorType; + typedef Matrix HVectorType; + typedef Matrix LinearType; + typedef Matrix MatrixType; + typedef Transform AffineCompactType; + typedef Transform AffineType; + typedef Transform ProjectiveType; + typedef DiagonalMatrix ScalingType; + typedef Translation TranslationType; + + AffineCompactType A1c; A1c.matrix().setRandom(); + AffineCompactType A2c; A2c.matrix().setRandom(); + AffineType A1(A1c); + AffineType A2(A2c); + ProjectiveType P1; P1.matrix().setRandom(); + VectorType v1 = VectorType::Random(); + VectorType v2 = VectorType::Random(); + HVectorType h1 = HVectorType::Random(); + Scalar s1 = internal::random(); + LinearType L = LinearType::Random(); + MatrixType M = MatrixType::Random(); + + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, A2, v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, A2c, v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, v1.asDiagonal(), v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, ScalingType(v1), v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, Scaling(v1), v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, Scaling(s1), v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, TranslationType(v1), v2, h1) ); + CALL_SUBTEST( transform_associativity_left(A1c, A1, P1, L, v2, h1) ); + CALL_SUBTEST( transform_associativity2(A1c, A1, P1, R, v2, h1) ); + + VERIFY_IS_APPROX( A1*(M*h1), (A1*M)*h1 ); + VERIFY_IS_APPROX( A1c*(M*h1), (A1c*M)*h1 ); + VERIFY_IS_APPROX( P1*(M*h1), (P1*M)*h1 ); + + VERIFY_IS_APPROX( M*(A1*h1), (M*A1)*h1 ); + VERIFY_IS_APPROX( M*(A1c*h1), (M*A1c)*h1 ); + VERIFY_IS_APPROX( M*(P1*h1), ((M*P1)*h1) ); +} + +template void transform_alignment() +{ + typedef Transform Projective3a; + typedef Transform Projective3u; + + EIGEN_ALIGN_MAX Scalar array1[16]; + EIGEN_ALIGN_MAX Scalar array2[16]; + EIGEN_ALIGN_MAX Scalar array3[16+1]; + Scalar* array3u = array3+1; + + Projective3a *p1 = ::new(reinterpret_cast(array1)) Projective3a; + Projective3u *p2 = ::new(reinterpret_cast(array2)) Projective3u; + Projective3u *p3 = ::new(reinterpret_cast(array3u)) Projective3u; + + p1->matrix().setRandom(); + *p2 = *p1; + *p3 = *p1; + + VERIFY_IS_APPROX(p1->matrix(), p2->matrix()); + VERIFY_IS_APPROX(p1->matrix(), p3->matrix()); + + VERIFY_IS_APPROX( (*p1) * (*p1), (*p2)*(*p3)); +} + +template void transform_products() +{ + typedef Matrix Mat; + typedef Transform Proj; + typedef Transform Aff; + typedef Transform AffC; + + Proj p; p.matrix().setRandom(); + Aff a; a.linear().setRandom(); a.translation().setRandom(); + AffC ac = a; + + Mat p_m(p.matrix()), a_m(a.matrix()); + + VERIFY_IS_APPROX((p*p).matrix(), p_m*p_m); + VERIFY_IS_APPROX((a*a).matrix(), a_m*a_m); + VERIFY_IS_APPROX((p*a).matrix(), p_m*a_m); + VERIFY_IS_APPROX((a*p).matrix(), a_m*p_m); + VERIFY_IS_APPROX((ac*a).matrix(), a_m*a_m); + VERIFY_IS_APPROX((a*ac).matrix(), a_m*a_m); + VERIFY_IS_APPROX((p*ac).matrix(), p_m*a_m); + VERIFY_IS_APPROX((ac*p).matrix(), a_m*p_m); +} + +template void transformations_no_scale() +{ + /* this test covers the following files: + Cross.h Quaternion.h, Transform.h + */ + typedef Matrix Vector3; + typedef Matrix Vector4; + typedef Quaternion Quaternionx; + typedef AngleAxis AngleAxisx; + typedef Transform Transform3; + typedef Translation Translation3; + typedef Matrix Matrix4; + + Vector3 v0 = Vector3::Random(), + v1 = Vector3::Random(); + + Transform3 t0, t1, t2; + + Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); + + Quaternionx q1, q2; + + q1 = AngleAxisx(a, v0.normalized()); + + t0 = Transform3::Identity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + + t0.setIdentity(); + t1.setIdentity(); + v1 = Vector3::Ones(); + t0.linear() = q1.toRotationMatrix(); + t0.pretranslate(v0); + t1.linear() = q1.conjugate().toRotationMatrix(); + t1.translate(-v0); + + VERIFY((t0 * t1).matrix().isIdentity(test_precision())); + + t1.fromPositionOrientationScale(v0, q1, v1); + VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); + VERIFY_IS_APPROX(t1*v1, t0*v1); + + // translation * vector + t0.setIdentity(); + t0.translate(v0); + VERIFY_IS_APPROX((t0 * v1).template head<3>(), Translation3(v0) * v1); + + // Conversion to matrix. + Transform3 t3; + t3.linear() = q1.toRotationMatrix(); + t3.translation() = v1; + Matrix4 m3 = t3.matrix(); + VERIFY((m3 * m3.inverse()).isIdentity(test_precision())); + // Verify implicit last row is initialized. + VERIFY_IS_APPROX(Vector4(m3.row(3)), Vector4(0.0, 0.0, 0.0, 1.0)); + + VERIFY_IS_APPROX(t3.rotation(), t3.linear()); + if(Mode==Isometry) + VERIFY(t3.rotation().data()==t3.linear().data()); +} + +template void transformations_computed_scaling_continuity() +{ + typedef Matrix Vector3; + typedef Transform Transform3; + typedef Matrix Matrix3; + + // Given: two transforms that differ by '2*eps'. + Scalar eps(1e-3); + Vector3 v0 = Vector3::Random().normalized(), + v1 = Vector3::Random().normalized(), + v3 = Vector3::Random().normalized(); + Transform3 t0, t1; + // The interesting case is when their determinants have different signs. + Matrix3 rank2 = 50 * v0 * v0.adjoint() + 20 * v1 * v1.adjoint(); + t0.linear() = rank2 + eps * v3 * v3.adjoint(); + t1.linear() = rank2 - eps * v3 * v3.adjoint(); + + // When: computing the rotation-scaling parts + Matrix3 r0, s0, r1, s1; + t0.computeRotationScaling(&r0, &s0); + t1.computeRotationScaling(&r1, &s1); + + // Then: the scaling parts should differ by no more than '2*eps'. + const Scalar c(2.1); // 2 + room for rounding errors + VERIFY((s0 - s1).norm() < c * eps); +} + +EIGEN_DECLARE_TEST(geo_transformations) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(( transformations() )); + CALL_SUBTEST_1(( non_projective_only() )); + CALL_SUBTEST_1(( transformations_computed_scaling_continuity() )); + + CALL_SUBTEST_2(( transformations() )); + CALL_SUBTEST_2(( non_projective_only() )); + CALL_SUBTEST_2(( transform_alignment() )); + + CALL_SUBTEST_3(( transformations() )); + CALL_SUBTEST_3(( transformations() )); + CALL_SUBTEST_3(( transform_alignment() )); + + CALL_SUBTEST_4(( transformations() )); + CALL_SUBTEST_4(( non_projective_only() )); + + CALL_SUBTEST_5(( transformations() )); + CALL_SUBTEST_5(( non_projective_only() )); + + CALL_SUBTEST_6(( transformations() )); + CALL_SUBTEST_6(( transformations() )); + + + CALL_SUBTEST_7(( transform_products() )); + CALL_SUBTEST_7(( transform_products() )); + + CALL_SUBTEST_8(( transform_associativity(Rotation2D(internal::random()*double(EIGEN_PI))) )); + CALL_SUBTEST_8(( transform_associativity(Quaterniond::UnitRandom()) )); + + CALL_SUBTEST_9(( transformations_no_scale() )); + CALL_SUBTEST_9(( transformations_no_scale() )); + } +} diff --git a/lib/eigen-3.4.0/test/gpu_basic.cu b/lib/eigen-3.4.0/test/gpu_basic.cu new file mode 100644 index 0000000..4298da3 --- /dev/null +++ b/lib/eigen-3.4.0/test/gpu_basic.cu @@ -0,0 +1,461 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015-2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// workaround issue between gcc >= 4.7 and cuda 5.5 +#if (defined __GNUC__) && (__GNUC__>4 || __GNUC_MINOR__>=7) + #undef _GLIBCXX_ATOMIC_BUILTINS + #undef _GLIBCXX_USE_INT128 +#endif + +#define EIGEN_TEST_NO_LONGDOUBLE +#define EIGEN_DEFAULT_DENSE_INDEX_TYPE int + +#include "main.h" +#include "gpu_common.h" + +// Check that dense modules can be properly parsed by nvcc +#include + +// struct Foo{ +// EIGEN_DEVICE_FUNC +// void operator()(int i, const float* mats, float* vecs) const { +// using namespace Eigen; +// // Matrix3f M(data); +// // Vector3f x(data+9); +// // Map(data+9) = M.inverse() * x; +// Matrix3f M(mats+i/16); +// Vector3f x(vecs+i*3); +// // using std::min; +// // using std::sqrt; +// Map(vecs+i*3) << x.minCoeff(), 1, 2;// / x.dot(x);//(M.inverse() * x) / x.x(); +// //x = x*2 + x.y() * x + x * x.maxCoeff() - x / x.sum(); +// } +// }; + +template +struct coeff_wise { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + T x1(in+i); + T x2(in+i+1); + T x3(in+i+2); + Map res(out+i*T::MaxSizeAtCompileTime); + + res.array() += (in[0] * x1 + x2).array() * x3.array(); + } +}; + +template +struct complex_sqrt { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + typedef typename T::Scalar ComplexType; + typedef typename T::Scalar::value_type ValueType; + const int num_special_inputs = 18; + + if (i == 0) { + const ValueType nan = std::numeric_limits::quiet_NaN(); + typedef Eigen::Vector SpecialInputs; + SpecialInputs special_in; + special_in.setZero(); + int idx = 0; + special_in[idx++] = ComplexType(0, 0); + special_in[idx++] = ComplexType(-0, 0); + special_in[idx++] = ComplexType(0, -0); + special_in[idx++] = ComplexType(-0, -0); + // GCC's fallback sqrt implementation fails for inf inputs. + // It is called when _GLIBCXX_USE_C99_COMPLEX is false or if + // clang includes the GCC header (which temporarily disables + // _GLIBCXX_USE_C99_COMPLEX) + #if !defined(_GLIBCXX_COMPLEX) || \ + (_GLIBCXX_USE_C99_COMPLEX && !defined(__CLANG_CUDA_WRAPPERS_COMPLEX)) + const ValueType inf = std::numeric_limits::infinity(); + special_in[idx++] = ComplexType(1.0, inf); + special_in[idx++] = ComplexType(nan, inf); + special_in[idx++] = ComplexType(1.0, -inf); + special_in[idx++] = ComplexType(nan, -inf); + special_in[idx++] = ComplexType(-inf, 1.0); + special_in[idx++] = ComplexType(inf, 1.0); + special_in[idx++] = ComplexType(-inf, -1.0); + special_in[idx++] = ComplexType(inf, -1.0); + special_in[idx++] = ComplexType(-inf, nan); + special_in[idx++] = ComplexType(inf, nan); + #endif + special_in[idx++] = ComplexType(1.0, nan); + special_in[idx++] = ComplexType(nan, 1.0); + special_in[idx++] = ComplexType(nan, -1.0); + special_in[idx++] = ComplexType(nan, nan); + + Map special_out(out); + special_out = special_in.cwiseSqrt(); + } + + T x1(in + i); + Map res(out + num_special_inputs + i*T::MaxSizeAtCompileTime); + res = x1.cwiseSqrt(); + } +}; + +template +struct complex_operators { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + typedef typename T::Scalar ComplexType; + typedef typename T::Scalar::value_type ValueType; + const int num_scalar_operators = 24; + const int num_vector_operators = 23; // no unary + operator. + int out_idx = i * (num_scalar_operators + num_vector_operators * T::MaxSizeAtCompileTime); + + // Scalar operators. + const ComplexType a = in[i]; + const ComplexType b = in[i + 1]; + + out[out_idx++] = +a; + out[out_idx++] = -a; + + out[out_idx++] = a + b; + out[out_idx++] = a + numext::real(b); + out[out_idx++] = numext::real(a) + b; + out[out_idx++] = a - b; + out[out_idx++] = a - numext::real(b); + out[out_idx++] = numext::real(a) - b; + out[out_idx++] = a * b; + out[out_idx++] = a * numext::real(b); + out[out_idx++] = numext::real(a) * b; + out[out_idx++] = a / b; + out[out_idx++] = a / numext::real(b); + out[out_idx++] = numext::real(a) / b; + + out[out_idx] = a; out[out_idx++] += b; + out[out_idx] = a; out[out_idx++] -= b; + out[out_idx] = a; out[out_idx++] *= b; + out[out_idx] = a; out[out_idx++] /= b; + + const ComplexType true_value = ComplexType(ValueType(1), ValueType(0)); + const ComplexType false_value = ComplexType(ValueType(0), ValueType(0)); + out[out_idx++] = (a == b ? true_value : false_value); + out[out_idx++] = (a == numext::real(b) ? true_value : false_value); + out[out_idx++] = (numext::real(a) == b ? true_value : false_value); + out[out_idx++] = (a != b ? true_value : false_value); + out[out_idx++] = (a != numext::real(b) ? true_value : false_value); + out[out_idx++] = (numext::real(a) != b ? true_value : false_value); + + // Vector versions. + T x1(in + i); + T x2(in + i + 1); + const int res_size = T::MaxSizeAtCompileTime * num_scalar_operators; + const int size = T::MaxSizeAtCompileTime; + int block_idx = 0; + + Map> res(out + out_idx, res_size); + res.segment(block_idx, size) = -x1; + block_idx += size; + + res.segment(block_idx, size) = x1 + x2; + block_idx += size; + res.segment(block_idx, size) = x1 + x2.real(); + block_idx += size; + res.segment(block_idx, size) = x1.real() + x2; + block_idx += size; + res.segment(block_idx, size) = x1 - x2; + block_idx += size; + res.segment(block_idx, size) = x1 - x2.real(); + block_idx += size; + res.segment(block_idx, size) = x1.real() - x2; + block_idx += size; + res.segment(block_idx, size) = x1.array() * x2.array(); + block_idx += size; + res.segment(block_idx, size) = x1.array() * x2.real().array(); + block_idx += size; + res.segment(block_idx, size) = x1.real().array() * x2.array(); + block_idx += size; + res.segment(block_idx, size) = x1.array() / x2.array(); + block_idx += size; + res.segment(block_idx, size) = x1.array() / x2.real().array(); + block_idx += size; + res.segment(block_idx, size) = x1.real().array() / x2.array(); + block_idx += size; + + res.segment(block_idx, size) = x1; res.segment(block_idx, size) += x2; + block_idx += size; + res.segment(block_idx, size) = x1; res.segment(block_idx, size) -= x2; + block_idx += size; + res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() *= x2.array(); + block_idx += size; + res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() /= x2.array(); + block_idx += size; + + const T true_vector = T::Constant(true_value); + const T false_vector = T::Constant(false_value); + res.segment(block_idx, size) = (x1 == x2 ? true_vector : false_vector); + block_idx += size; + // Mixing types in equality comparison does not work. + // res.segment(block_idx, size) = (x1 == x2.real() ? true_vector : false_vector); + // block_idx += size; + // res.segment(block_idx, size) = (x1.real() == x2 ? true_vector : false_vector); + // block_idx += size; + res.segment(block_idx, size) = (x1 != x2 ? true_vector : false_vector); + block_idx += size; + // res.segment(block_idx, size) = (x1 != x2.real() ? true_vector : false_vector); + // block_idx += size; + // res.segment(block_idx, size) = (x1.real() != x2 ? true_vector : false_vector); + // block_idx += size; + } +}; + +template +struct replicate { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + T x1(in+i); + int step = x1.size() * 4; + int stride = 3 * step; + + typedef Map > MapType; + MapType(out+i*stride+0*step, x1.rows()*2, x1.cols()*2) = x1.replicate(2,2); + MapType(out+i*stride+1*step, x1.rows()*3, x1.cols()) = in[i] * x1.colwise().replicate(3); + MapType(out+i*stride+2*step, x1.rows(), x1.cols()*3) = in[i] * x1.rowwise().replicate(3); + } +}; + +template +struct alloc_new_delete { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + int offset = 2*i*T::MaxSizeAtCompileTime; + T* x = new T(in + offset); + Eigen::Map u(out + offset); + u = *x; + delete x; + + offset += T::MaxSizeAtCompileTime; + T* y = new T[1]; + y[0] = T(in + offset); + Eigen::Map v(out + offset); + v = y[0]; + delete[] y; + } +}; + +template +struct redux { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + int N = 10; + T x1(in+i); + out[i*N+0] = x1.minCoeff(); + out[i*N+1] = x1.maxCoeff(); + out[i*N+2] = x1.sum(); + out[i*N+3] = x1.prod(); + out[i*N+4] = x1.matrix().squaredNorm(); + out[i*N+5] = x1.matrix().norm(); + out[i*N+6] = x1.colwise().sum().maxCoeff(); + out[i*N+7] = x1.rowwise().maxCoeff().sum(); + out[i*N+8] = x1.matrix().colwise().squaredNorm().sum(); + } +}; + +template +struct prod_test { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T1::Scalar* in, typename T1::Scalar* out) const + { + using namespace Eigen; + typedef Matrix T3; + T1 x1(in+i); + T2 x2(in+i+1); + Map res(out+i*T3::MaxSizeAtCompileTime); + res += in[i] * x1 * x2; + } +}; + +template +struct diagonal { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T1::Scalar* in, typename T1::Scalar* out) const + { + using namespace Eigen; + T1 x1(in+i); + Map res(out+i*T2::MaxSizeAtCompileTime); + res += x1.diagonal(); + } +}; + +template +struct eigenvalues_direct { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + typedef Matrix Vec; + T M(in+i); + Map res(out+i*Vec::MaxSizeAtCompileTime); + T A = M*M.adjoint(); + SelfAdjointEigenSolver eig; + eig.computeDirect(A); + res = eig.eigenvalues(); + } +}; + +template +struct eigenvalues { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + typedef Matrix Vec; + T M(in+i); + Map res(out+i*Vec::MaxSizeAtCompileTime); + T A = M*M.adjoint(); + SelfAdjointEigenSolver eig; + eig.compute(A); + res = eig.eigenvalues(); + } +}; + +template +struct matrix_inverse { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + using namespace Eigen; + T M(in+i); + Map res(out+i*T::MaxSizeAtCompileTime); + res = M.inverse(); + } +}; + +template +struct numeric_limits_test { + EIGEN_DEVICE_FUNC + void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const + { + EIGEN_UNUSED_VARIABLE(in) + int out_idx = i * 5; + out[out_idx++] = numext::numeric_limits::epsilon(); + out[out_idx++] = (numext::numeric_limits::max)(); + out[out_idx++] = (numext::numeric_limits::min)(); + out[out_idx++] = numext::numeric_limits::infinity(); + out[out_idx++] = numext::numeric_limits::quiet_NaN(); + } +}; + +template +bool verifyIsApproxWithInfsNans(const Type1& a, const Type2& b, typename Type1::Scalar* = 0) // Enabled for Eigen's type only +{ + if (a.rows() != b.rows()) { + return false; + } + if (a.cols() != b.cols()) { + return false; + } + for (Index r = 0; r < a.rows(); ++r) { + for (Index c = 0; c < a.cols(); ++c) { + if (a(r, c) != b(r, c) + && !((numext::isnan)(a(r, c)) && (numext::isnan)(b(r, c))) + && !test_isApprox(a(r, c), b(r, c))) { + return false; + } + } + } + return true; +} + +template +void test_with_infs_nans(const Kernel& ker, int n, const Input& in, Output& out) +{ + Output out_ref, out_gpu; + #if !defined(EIGEN_GPU_COMPILE_PHASE) + out_ref = out_gpu = out; + #else + EIGEN_UNUSED_VARIABLE(in); + EIGEN_UNUSED_VARIABLE(out); + #endif + run_on_cpu (ker, n, in, out_ref); + run_on_gpu(ker, n, in, out_gpu); + #if !defined(EIGEN_GPU_COMPILE_PHASE) + verifyIsApproxWithInfsNans(out_ref, out_gpu); + #endif +} + +EIGEN_DECLARE_TEST(gpu_basic) +{ + ei_test_init_gpu(); + + int nthreads = 100; + Eigen::VectorXf in, out; + Eigen::VectorXcf cfin, cfout; + + #if !defined(EIGEN_GPU_COMPILE_PHASE) + int data_size = nthreads * 512; + in.setRandom(data_size); + out.setConstant(data_size, -1); + cfin.setRandom(data_size); + cfout.setConstant(data_size, -1); + #endif + + CALL_SUBTEST( run_and_compare_to_gpu(coeff_wise(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(coeff_wise(), nthreads, in, out) ); + +#if !defined(EIGEN_USE_HIP) + // FIXME + // These subtests result in a compile failure on the HIP platform + // + // eigen-upstream/Eigen/src/Core/Replicate.h:61:65: error: + // base class 'internal::dense_xpr_base, -1, -1> >::type' + // (aka 'ArrayBase, -1, -1> >') has protected default constructor + CALL_SUBTEST( run_and_compare_to_gpu(replicate(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(replicate(), nthreads, in, out) ); + + // HIP does not support new/delete on device. + CALL_SUBTEST( run_and_compare_to_gpu(alloc_new_delete(), nthreads, in, out) ); +#endif + + CALL_SUBTEST( run_and_compare_to_gpu(redux(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(redux(), nthreads, in, out) ); + + CALL_SUBTEST( run_and_compare_to_gpu(prod_test(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(prod_test(), nthreads, in, out) ); + + CALL_SUBTEST( run_and_compare_to_gpu(diagonal(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(diagonal(), nthreads, in, out) ); + + CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); + + CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues_direct(), nthreads, in, out) ); + CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues_direct(), nthreads, in, out) ); + + // Test std::complex. + CALL_SUBTEST( run_and_compare_to_gpu(complex_operators(), nthreads, cfin, cfout) ); + CALL_SUBTEST( test_with_infs_nans(complex_sqrt(), nthreads, cfin, cfout) ); + + // numeric_limits + CALL_SUBTEST( test_with_infs_nans(numeric_limits_test(), 1, in, out) ); + +#if defined(__NVCC__) + // FIXME + // These subtests compiles only with nvcc and fail with HIPCC and clang-cuda + CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues(), nthreads, in, out) ); + typedef Matrix Matrix6f; + CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues(), nthreads, in, out) ); +#endif +} diff --git a/lib/eigen-3.4.0/test/gpu_common.h b/lib/eigen-3.4.0/test/gpu_common.h new file mode 100644 index 0000000..c37eaa1 --- /dev/null +++ b/lib/eigen-3.4.0/test/gpu_common.h @@ -0,0 +1,176 @@ +#ifndef EIGEN_TEST_GPU_COMMON_H +#define EIGEN_TEST_GPU_COMMON_H + +#ifdef EIGEN_USE_HIP + #include + #include +#else + #include + #include + #include +#endif + +#include + +#define EIGEN_USE_GPU +#include + +#if !defined(__CUDACC__) && !defined(__HIPCC__) +dim3 threadIdx, blockDim, blockIdx; +#endif + +template +void run_on_cpu(const Kernel& ker, int n, const Input& in, Output& out) +{ + for(int i=0; i +__global__ +EIGEN_HIP_LAUNCH_BOUNDS_1024 +void run_on_gpu_meta_kernel(const Kernel ker, int n, const Input* in, Output* out) +{ + int i = threadIdx.x + blockIdx.x*blockDim.x; + if(i +void run_on_gpu(const Kernel& ker, int n, const Input& in, Output& out) +{ + typename Input::Scalar* d_in; + typename Output::Scalar* d_out; + std::ptrdiff_t in_bytes = in.size() * sizeof(typename Input::Scalar); + std::ptrdiff_t out_bytes = out.size() * sizeof(typename Output::Scalar); + + gpuMalloc((void**)(&d_in), in_bytes); + gpuMalloc((void**)(&d_out), out_bytes); + + gpuMemcpy(d_in, in.data(), in_bytes, gpuMemcpyHostToDevice); + gpuMemcpy(d_out, out.data(), out_bytes, gpuMemcpyHostToDevice); + + // Simple and non-optimal 1D mapping assuming n is not too large + // That's only for unit testing! + dim3 Blocks(128); + dim3 Grids( (n+int(Blocks.x)-1)/int(Blocks.x) ); + + gpuDeviceSynchronize(); + +#ifdef EIGEN_USE_HIP + hipLaunchKernelGGL(HIP_KERNEL_NAME(run_on_gpu_meta_kernel::type, + typename std::decay::type>), + dim3(Grids), dim3(Blocks), 0, 0, ker, n, d_in, d_out); +#else + run_on_gpu_meta_kernel<<>>(ker, n, d_in, d_out); +#endif + // Pre-launch errors. + gpuError_t err = gpuGetLastError(); + if (err != gpuSuccess) { + printf("%s: %s\n", gpuGetErrorName(err), gpuGetErrorString(err)); + gpu_assert(false); + } + + // Kernel execution errors. + err = gpuDeviceSynchronize(); + if (err != gpuSuccess) { + printf("%s: %s\n", gpuGetErrorName(err), gpuGetErrorString(err)); + gpu_assert(false); + } + + + // check inputs have not been modified + gpuMemcpy(const_cast(in.data()), d_in, in_bytes, gpuMemcpyDeviceToHost); + gpuMemcpy(out.data(), d_out, out_bytes, gpuMemcpyDeviceToHost); + + gpuFree(d_in); + gpuFree(d_out); +} + + +template +void run_and_compare_to_gpu(const Kernel& ker, int n, const Input& in, Output& out) +{ + Input in_ref, in_gpu; + Output out_ref, out_gpu; + #if !defined(EIGEN_GPU_COMPILE_PHASE) + in_ref = in_gpu = in; + out_ref = out_gpu = out; + #else + EIGEN_UNUSED_VARIABLE(in); + EIGEN_UNUSED_VARIABLE(out); + #endif + run_on_cpu (ker, n, in_ref, out_ref); + run_on_gpu(ker, n, in_gpu, out_gpu); + #if !defined(EIGEN_GPU_COMPILE_PHASE) + VERIFY_IS_APPROX(in_ref, in_gpu); + VERIFY_IS_APPROX(out_ref, out_gpu); + #endif +} + +struct compile_time_device_info { + EIGEN_DEVICE_FUNC + void operator()(int i, const int* /*in*/, int* info) const + { + if (i == 0) { + EIGEN_UNUSED_VARIABLE(info) + #if defined(__CUDA_ARCH__) + info[0] = int(__CUDA_ARCH__ +0); + #endif + #if defined(EIGEN_HIP_DEVICE_COMPILE) + info[1] = int(EIGEN_HIP_DEVICE_COMPILE +0); + #endif + } + } +}; + +void ei_test_init_gpu() +{ + int device = 0; + gpuDeviceProp_t deviceProp; + gpuGetDeviceProperties(&deviceProp, device); + + ArrayXi dummy(1), info(10); + info = -1; + run_on_gpu(compile_time_device_info(),10,dummy,info); + + + std::cout << "GPU compile-time info:\n"; + + #ifdef EIGEN_CUDACC + std::cout << " EIGEN_CUDACC: " << int(EIGEN_CUDACC) << "\n"; + #endif + + #ifdef EIGEN_CUDA_SDK_VER + std::cout << " EIGEN_CUDA_SDK_VER: " << int(EIGEN_CUDA_SDK_VER) << "\n"; + #endif + + #ifdef EIGEN_COMP_NVCC + std::cout << " EIGEN_COMP_NVCC: " << int(EIGEN_COMP_NVCC) << "\n"; + #endif + + #ifdef EIGEN_HIPCC + std::cout << " EIGEN_HIPCC: " << int(EIGEN_HIPCC) << "\n"; + #endif + + std::cout << " EIGEN_CUDA_ARCH: " << info[0] << "\n"; + std::cout << " EIGEN_HIP_DEVICE_COMPILE: " << info[1] << "\n"; + + std::cout << "GPU device info:\n"; + std::cout << " name: " << deviceProp.name << "\n"; + std::cout << " capability: " << deviceProp.major << "." << deviceProp.minor << "\n"; + std::cout << " multiProcessorCount: " << deviceProp.multiProcessorCount << "\n"; + std::cout << " maxThreadsPerMultiProcessor: " << deviceProp.maxThreadsPerMultiProcessor << "\n"; + std::cout << " warpSize: " << deviceProp.warpSize << "\n"; + std::cout << " regsPerBlock: " << deviceProp.regsPerBlock << "\n"; + std::cout << " concurrentKernels: " << deviceProp.concurrentKernels << "\n"; + std::cout << " clockRate: " << deviceProp.clockRate << "\n"; + std::cout << " canMapHostMemory: " << deviceProp.canMapHostMemory << "\n"; + std::cout << " computeMode: " << deviceProp.computeMode << "\n"; +} + +#endif // EIGEN_TEST_GPU_COMMON_H diff --git a/lib/eigen-3.4.0/test/half_float.cpp b/lib/eigen-3.4.0/test/half_float.cpp new file mode 100644 index 0000000..729de1b --- /dev/null +++ b/lib/eigen-3.4.0/test/half_float.cpp @@ -0,0 +1,349 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include "main.h" + +#include + +#define VERIFY_HALF_BITS_EQUAL(h, bits) \ + VERIFY_IS_EQUAL((numext::bit_cast(h)), (static_cast(bits))) + +// Make sure it's possible to forward declare Eigen::half +namespace Eigen { +struct half; +} + +using Eigen::half; + +void test_conversion() +{ + using Eigen::half_impl::__half_raw; + + // Round-trip bit-cast with uint16. + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(half(1.0f))), + half(1.0f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(half(0.5f))), + half(0.5f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(half(-0.33333f))), + half(-0.33333f)); + VERIFY_IS_EQUAL( + numext::bit_cast(numext::bit_cast(half(0.0f))), + half(0.0f)); + + // Conversion from float. + VERIFY_HALF_BITS_EQUAL(half(1.0f), 0x3c00); + VERIFY_HALF_BITS_EQUAL(half(0.5f), 0x3800); + VERIFY_HALF_BITS_EQUAL(half(0.33333f), 0x3555); + VERIFY_HALF_BITS_EQUAL(half(0.0f), 0x0000); + VERIFY_HALF_BITS_EQUAL(half(-0.0f), 0x8000); + VERIFY_HALF_BITS_EQUAL(half(65504.0f), 0x7bff); + VERIFY_HALF_BITS_EQUAL(half(65536.0f), 0x7c00); // Becomes infinity. + + // Denormals. + VERIFY_HALF_BITS_EQUAL(half(-5.96046e-08f), 0x8001); + VERIFY_HALF_BITS_EQUAL(half(5.96046e-08f), 0x0001); + VERIFY_HALF_BITS_EQUAL(half(1.19209e-07f), 0x0002); + + // Verify round-to-nearest-even behavior. + float val1 = float(half(__half_raw(0x3c00))); + float val2 = float(half(__half_raw(0x3c01))); + float val3 = float(half(__half_raw(0x3c02))); + VERIFY_HALF_BITS_EQUAL(half(0.5f * (val1 + val2)), 0x3c00); + VERIFY_HALF_BITS_EQUAL(half(0.5f * (val2 + val3)), 0x3c02); + + // Conversion from int. + VERIFY_HALF_BITS_EQUAL(half(-1), 0xbc00); + VERIFY_HALF_BITS_EQUAL(half(0), 0x0000); + VERIFY_HALF_BITS_EQUAL(half(1), 0x3c00); + VERIFY_HALF_BITS_EQUAL(half(2), 0x4000); + VERIFY_HALF_BITS_EQUAL(half(3), 0x4200); + + // Conversion from bool. + VERIFY_HALF_BITS_EQUAL(half(false), 0x0000); + VERIFY_HALF_BITS_EQUAL(half(true), 0x3c00); + + // Conversion to float. + VERIFY_IS_EQUAL(float(half(__half_raw(0x0000))), 0.0f); + VERIFY_IS_EQUAL(float(half(__half_raw(0x3c00))), 1.0f); + + // Denormals. + VERIFY_IS_APPROX(float(half(__half_raw(0x8001))), -5.96046e-08f); + VERIFY_IS_APPROX(float(half(__half_raw(0x0001))), 5.96046e-08f); + VERIFY_IS_APPROX(float(half(__half_raw(0x0002))), 1.19209e-07f); + + // NaNs and infinities. + VERIFY(!(numext::isinf)(float(half(65504.0f)))); // Largest finite number. + VERIFY(!(numext::isnan)(float(half(0.0f)))); + VERIFY((numext::isinf)(float(half(__half_raw(0xfc00))))); + VERIFY((numext::isnan)(float(half(__half_raw(0xfc01))))); + VERIFY((numext::isinf)(float(half(__half_raw(0x7c00))))); + VERIFY((numext::isnan)(float(half(__half_raw(0x7c01))))); + +#if !EIGEN_COMP_MSVC + // Visual Studio errors out on divisions by 0 + VERIFY((numext::isnan)(float(half(0.0 / 0.0)))); + VERIFY((numext::isinf)(float(half(1.0 / 0.0)))); + VERIFY((numext::isinf)(float(half(-1.0 / 0.0)))); +#endif + + // Exactly same checks as above, just directly on the half representation. + VERIFY(!(numext::isinf)(half(__half_raw(0x7bff)))); + VERIFY(!(numext::isnan)(half(__half_raw(0x0000)))); + VERIFY((numext::isinf)(half(__half_raw(0xfc00)))); + VERIFY((numext::isnan)(half(__half_raw(0xfc01)))); + VERIFY((numext::isinf)(half(__half_raw(0x7c00)))); + VERIFY((numext::isnan)(half(__half_raw(0x7c01)))); + +#if !EIGEN_COMP_MSVC + // Visual Studio errors out on divisions by 0 + VERIFY((numext::isnan)(half(0.0 / 0.0))); + VERIFY((numext::isinf)(half(1.0 / 0.0))); + VERIFY((numext::isinf)(half(-1.0 / 0.0))); +#endif + + // Conversion to bool + VERIFY(!static_cast(half(0.0))); + VERIFY(!static_cast(half(-0.0))); + VERIFY(static_cast(half(__half_raw(0x7bff)))); + VERIFY(static_cast(half(-0.33333))); + VERIFY(static_cast(half(1.0))); + VERIFY(static_cast(half(-1.0))); + VERIFY(static_cast(half(-5.96046e-08f))); +} + +void test_numtraits() +{ + std::cout << "epsilon = " << NumTraits::epsilon() << " (0x" << std::hex << numext::bit_cast(NumTraits::epsilon()) << ")" << std::endl; + std::cout << "highest = " << NumTraits::highest() << " (0x" << std::hex << numext::bit_cast(NumTraits::highest()) << ")" << std::endl; + std::cout << "lowest = " << NumTraits::lowest() << " (0x" << std::hex << numext::bit_cast(NumTraits::lowest()) << ")" << std::endl; + std::cout << "min = " << (std::numeric_limits::min)() << " (0x" << std::hex << numext::bit_cast(half((std::numeric_limits::min)())) << ")" << std::endl; + std::cout << "denorm min = " << (std::numeric_limits::denorm_min)() << " (0x" << std::hex << numext::bit_cast(half((std::numeric_limits::denorm_min)())) << ")" << std::endl; + std::cout << "infinity = " << NumTraits::infinity() << " (0x" << std::hex << numext::bit_cast(NumTraits::infinity()) << ")" << std::endl; + std::cout << "quiet nan = " << NumTraits::quiet_NaN() << " (0x" << std::hex << numext::bit_cast(NumTraits::quiet_NaN()) << ")" << std::endl; + std::cout << "signaling nan = " << std::numeric_limits::signaling_NaN() << " (0x" << std::hex << numext::bit_cast(std::numeric_limits::signaling_NaN()) << ")" << std::endl; + + VERIFY(NumTraits::IsSigned); + + VERIFY_IS_EQUAL( + numext::bit_cast(std::numeric_limits::infinity()), + numext::bit_cast(half(std::numeric_limits::infinity())) ); + // There is no guarantee that casting a 32-bit NaN to 16-bit has a precise + // bit pattern. We test that it is in fact a NaN, then test the signaling + // bit (msb of significand is 1 for quiet, 0 for signaling). + const numext::uint16_t HALF_QUIET_BIT = 0x0200; + VERIFY( + (numext::isnan)(std::numeric_limits::quiet_NaN()) + && (numext::isnan)(half(std::numeric_limits::quiet_NaN())) + && ((numext::bit_cast(std::numeric_limits::quiet_NaN()) & HALF_QUIET_BIT) > 0) + && ((numext::bit_cast(half(std::numeric_limits::quiet_NaN())) & HALF_QUIET_BIT) > 0) ); + // After a cast to half, a signaling NaN may become non-signaling + // (e.g. in the case of casting float to native __fp16). Thus, we check that + // both are NaN, and that only the `numeric_limits` version is signaling. + VERIFY( + (numext::isnan)(std::numeric_limits::signaling_NaN()) + && (numext::isnan)(half(std::numeric_limits::signaling_NaN())) + && ((numext::bit_cast(std::numeric_limits::signaling_NaN()) & HALF_QUIET_BIT) == 0) ); + + VERIFY( (std::numeric_limits::min)() > half(0.f) ); + VERIFY( (std::numeric_limits::denorm_min)() > half(0.f) ); + VERIFY( (std::numeric_limits::min)()/half(2) > half(0.f) ); + VERIFY_IS_EQUAL( (std::numeric_limits::denorm_min)()/half(2), half(0.f) ); +} + +void test_arithmetic() +{ + VERIFY_IS_EQUAL(float(half(2) + half(2)), 4); + VERIFY_IS_EQUAL(float(half(2) + half(-2)), 0); + VERIFY_IS_APPROX(float(half(0.33333f) + half(0.66667f)), 1.0f); + VERIFY_IS_EQUAL(float(half(2.0f) * half(-5.5f)), -11.0f); + VERIFY_IS_APPROX(float(half(1.0f) / half(3.0f)), 0.33333f); + VERIFY_IS_EQUAL(float(-half(4096.0f)), -4096.0f); + VERIFY_IS_EQUAL(float(-half(-4096.0f)), 4096.0f); + + half x(3); + half y = ++x; + VERIFY_IS_EQUAL(x, half(4)); + VERIFY_IS_EQUAL(y, half(4)); + y = --x; + VERIFY_IS_EQUAL(x, half(3)); + VERIFY_IS_EQUAL(y, half(3)); + y = x++; + VERIFY_IS_EQUAL(x, half(4)); + VERIFY_IS_EQUAL(y, half(3)); + y = x--; + VERIFY_IS_EQUAL(x, half(3)); + VERIFY_IS_EQUAL(y, half(4)); +} + +void test_comparison() +{ + VERIFY(half(1.0f) > half(0.5f)); + VERIFY(half(0.5f) < half(1.0f)); + VERIFY(!(half(1.0f) < half(0.5f))); + VERIFY(!(half(0.5f) > half(1.0f))); + + VERIFY(!(half(4.0f) > half(4.0f))); + VERIFY(!(half(4.0f) < half(4.0f))); + + VERIFY(!(half(0.0f) < half(-0.0f))); + VERIFY(!(half(-0.0f) < half(0.0f))); + VERIFY(!(half(0.0f) > half(-0.0f))); + VERIFY(!(half(-0.0f) > half(0.0f))); + + VERIFY(half(0.2f) > half(-1.0f)); + VERIFY(half(-1.0f) < half(0.2f)); + VERIFY(half(-16.0f) < half(-15.0f)); + + VERIFY(half(1.0f) == half(1.0f)); + VERIFY(half(1.0f) != half(2.0f)); + + // Comparisons with NaNs and infinities. +#if !EIGEN_COMP_MSVC + // Visual Studio errors out on divisions by 0 + VERIFY(!(half(0.0 / 0.0) == half(0.0 / 0.0))); + VERIFY(half(0.0 / 0.0) != half(0.0 / 0.0)); + + VERIFY(!(half(1.0) == half(0.0 / 0.0))); + VERIFY(!(half(1.0) < half(0.0 / 0.0))); + VERIFY(!(half(1.0) > half(0.0 / 0.0))); + VERIFY(half(1.0) != half(0.0 / 0.0)); + + VERIFY(half(1.0) < half(1.0 / 0.0)); + VERIFY(half(1.0) > half(-1.0 / 0.0)); +#endif +} + +void test_basic_functions() +{ + VERIFY_IS_EQUAL(float(numext::abs(half(3.5f))), 3.5f); + VERIFY_IS_EQUAL(float(abs(half(3.5f))), 3.5f); + VERIFY_IS_EQUAL(float(numext::abs(half(-3.5f))), 3.5f); + VERIFY_IS_EQUAL(float(abs(half(-3.5f))), 3.5f); + + VERIFY_IS_EQUAL(float(numext::floor(half(3.5f))), 3.0f); + VERIFY_IS_EQUAL(float(floor(half(3.5f))), 3.0f); + VERIFY_IS_EQUAL(float(numext::floor(half(-3.5f))), -4.0f); + VERIFY_IS_EQUAL(float(floor(half(-3.5f))), -4.0f); + + VERIFY_IS_EQUAL(float(numext::ceil(half(3.5f))), 4.0f); + VERIFY_IS_EQUAL(float(ceil(half(3.5f))), 4.0f); + VERIFY_IS_EQUAL(float(numext::ceil(half(-3.5f))), -3.0f); + VERIFY_IS_EQUAL(float(ceil(half(-3.5f))), -3.0f); + + VERIFY_IS_APPROX(float(numext::sqrt(half(0.0f))), 0.0f); + VERIFY_IS_APPROX(float(sqrt(half(0.0f))), 0.0f); + VERIFY_IS_APPROX(float(numext::sqrt(half(4.0f))), 2.0f); + VERIFY_IS_APPROX(float(sqrt(half(4.0f))), 2.0f); + + VERIFY_IS_APPROX(float(numext::pow(half(0.0f), half(1.0f))), 0.0f); + VERIFY_IS_APPROX(float(pow(half(0.0f), half(1.0f))), 0.0f); + VERIFY_IS_APPROX(float(numext::pow(half(2.0f), half(2.0f))), 4.0f); + VERIFY_IS_APPROX(float(pow(half(2.0f), half(2.0f))), 4.0f); + + VERIFY_IS_EQUAL(float(numext::exp(half(0.0f))), 1.0f); + VERIFY_IS_EQUAL(float(exp(half(0.0f))), 1.0f); + VERIFY_IS_APPROX(float(numext::exp(half(EIGEN_PI))), 20.f + float(EIGEN_PI)); + VERIFY_IS_APPROX(float(exp(half(EIGEN_PI))), 20.f + float(EIGEN_PI)); + + VERIFY_IS_EQUAL(float(numext::expm1(half(0.0f))), 0.0f); + VERIFY_IS_EQUAL(float(expm1(half(0.0f))), 0.0f); + VERIFY_IS_APPROX(float(numext::expm1(half(2.0f))), 6.3890561f); + VERIFY_IS_APPROX(float(expm1(half(2.0f))), 6.3890561f); + + VERIFY_IS_EQUAL(float(numext::log(half(1.0f))), 0.0f); + VERIFY_IS_EQUAL(float(log(half(1.0f))), 0.0f); + VERIFY_IS_APPROX(float(numext::log(half(10.0f))), 2.30273f); + VERIFY_IS_APPROX(float(log(half(10.0f))), 2.30273f); + + VERIFY_IS_EQUAL(float(numext::log1p(half(0.0f))), 0.0f); + VERIFY_IS_EQUAL(float(log1p(half(0.0f))), 0.0f); + VERIFY_IS_APPROX(float(numext::log1p(half(10.0f))), 2.3978953f); + VERIFY_IS_APPROX(float(log1p(half(10.0f))), 2.3978953f); + + VERIFY_IS_APPROX(numext::fmod(half(5.3f), half(2.0f)), half(1.3f)); + VERIFY_IS_APPROX(fmod(half(5.3f), half(2.0f)), half(1.3f)); + VERIFY_IS_APPROX(numext::fmod(half(-18.5f), half(-4.2f)), half(-1.7f)); + VERIFY_IS_APPROX(fmod(half(-18.5f), half(-4.2f)), half(-1.7f)); +} + +void test_trigonometric_functions() +{ + VERIFY_IS_APPROX(numext::cos(half(0.0f)), half(cosf(0.0f))); + VERIFY_IS_APPROX(cos(half(0.0f)), half(cosf(0.0f))); + VERIFY_IS_APPROX(numext::cos(half(EIGEN_PI)), half(cosf(EIGEN_PI))); + // VERIFY_IS_APPROX(numext::cos(half(EIGEN_PI/2)), half(cosf(EIGEN_PI/2))); + // VERIFY_IS_APPROX(numext::cos(half(3*EIGEN_PI/2)), half(cosf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::cos(half(3.5f)), half(cosf(3.5f))); + + VERIFY_IS_APPROX(numext::sin(half(0.0f)), half(sinf(0.0f))); + VERIFY_IS_APPROX(sin(half(0.0f)), half(sinf(0.0f))); + // VERIFY_IS_APPROX(numext::sin(half(EIGEN_PI)), half(sinf(EIGEN_PI))); + VERIFY_IS_APPROX(numext::sin(half(EIGEN_PI/2)), half(sinf(EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::sin(half(3*EIGEN_PI/2)), half(sinf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::sin(half(3.5f)), half(sinf(3.5f))); + + VERIFY_IS_APPROX(numext::tan(half(0.0f)), half(tanf(0.0f))); + VERIFY_IS_APPROX(tan(half(0.0f)), half(tanf(0.0f))); + // VERIFY_IS_APPROX(numext::tan(half(EIGEN_PI)), half(tanf(EIGEN_PI))); + // VERIFY_IS_APPROX(numext::tan(half(EIGEN_PI/2)), half(tanf(EIGEN_PI/2))); + //VERIFY_IS_APPROX(numext::tan(half(3*EIGEN_PI/2)), half(tanf(3*EIGEN_PI/2))); + VERIFY_IS_APPROX(numext::tan(half(3.5f)), half(tanf(3.5f))); +} + +void test_array() +{ + typedef Array ArrayXh; + Index size = internal::random(1,10); + Index i = internal::random(0,size-1); + ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); + VERIFY_IS_APPROX( a1+a1, half(2)*a1 ); + VERIFY( (a1.abs() >= half(0)).all() ); + VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); + + VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); + a1(i) = half(-10.); + VERIFY_IS_EQUAL( a1.minCoeff(), half(-10.) ); + a1(i) = half(10.); + VERIFY_IS_EQUAL( a1.maxCoeff(), half(10.) ); + + std::stringstream ss; + ss << a1; +} + +void test_product() +{ + typedef Matrix MatrixXh; + Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); + Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); + Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); + MatrixXh Ah = MatrixXh::Random(rows,depth); + MatrixXh Bh = MatrixXh::Random(depth,cols); + MatrixXh Ch = MatrixXh::Random(rows,cols); + MatrixXf Af = Ah.cast(); + MatrixXf Bf = Bh.cast(); + MatrixXf Cf = Ch.cast(); + VERIFY_IS_APPROX(Ch.noalias()+=Ah*Bh, (Cf.noalias()+=Af*Bf).cast()); +} + +EIGEN_DECLARE_TEST(half_float) +{ + CALL_SUBTEST(test_numtraits()); + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST(test_conversion()); + CALL_SUBTEST(test_arithmetic()); + CALL_SUBTEST(test_comparison()); + CALL_SUBTEST(test_basic_functions()); + CALL_SUBTEST(test_trigonometric_functions()); + CALL_SUBTEST(test_array()); + CALL_SUBTEST(test_product()); + } +} diff --git a/lib/eigen-3.4.0/test/hessenberg.cpp b/lib/eigen-3.4.0/test/hessenberg.cpp new file mode 100644 index 0000000..0e1b009 --- /dev/null +++ b/lib/eigen-3.4.0/test/hessenberg.cpp @@ -0,0 +1,62 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2010 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template void hessenberg(int size = Size) +{ + typedef Matrix MatrixType; + + // Test basic functionality: A = U H U* and H is Hessenberg + for(int counter = 0; counter < g_repeat; ++counter) { + MatrixType m = MatrixType::Random(size,size); + HessenbergDecomposition hess(m); + MatrixType Q = hess.matrixQ(); + MatrixType H = hess.matrixH(); + VERIFY_IS_APPROX(m, Q * H * Q.adjoint()); + for(int row = 2; row < size; ++row) { + for(int col = 0; col < row-1; ++col) { + VERIFY(H(row,col) == (typename MatrixType::Scalar)0); + } + } + } + + // Test whether compute() and constructor returns same result + MatrixType A = MatrixType::Random(size, size); + HessenbergDecomposition cs1; + cs1.compute(A); + HessenbergDecomposition cs2(A); + VERIFY_IS_EQUAL(cs1.matrixH().eval(), cs2.matrixH().eval()); + MatrixType cs1Q = cs1.matrixQ(); + MatrixType cs2Q = cs2.matrixQ(); + VERIFY_IS_EQUAL(cs1Q, cs2Q); + + // Test assertions for when used uninitialized + HessenbergDecomposition hessUninitialized; + VERIFY_RAISES_ASSERT( hessUninitialized.matrixH() ); + VERIFY_RAISES_ASSERT( hessUninitialized.matrixQ() ); + VERIFY_RAISES_ASSERT( hessUninitialized.householderCoefficients() ); + VERIFY_RAISES_ASSERT( hessUninitialized.packedMatrix() ); + + // TODO: Add tests for packedMatrix() and householderCoefficients() +} + +EIGEN_DECLARE_TEST(hessenberg) +{ + CALL_SUBTEST_1(( hessenberg,1>() )); + CALL_SUBTEST_2(( hessenberg,2>() )); + CALL_SUBTEST_3(( hessenberg,4>() )); + CALL_SUBTEST_4(( hessenberg(internal::random(1,EIGEN_TEST_MAX_SIZE)) )); + CALL_SUBTEST_5(( hessenberg,Dynamic>(internal::random(1,EIGEN_TEST_MAX_SIZE)) )); + + // Test problem size constructors + CALL_SUBTEST_6(HessenbergDecomposition(10)); +} diff --git a/lib/eigen-3.4.0/test/householder.cpp b/lib/eigen-3.4.0/test/householder.cpp new file mode 100644 index 0000000..cad8138 --- /dev/null +++ b/lib/eigen-3.4.0/test/householder.cpp @@ -0,0 +1,148 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template void householder(const MatrixType& m) +{ + static bool even = true; + even = !even; + /* this test covers the following files: + Householder.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix VectorType; + typedef Matrix::ret, 1> EssentialVectorType; + typedef Matrix SquareMatrixType; + typedef Matrix HBlockMatrixType; + typedef Matrix HCoeffsVectorType; + + typedef Matrix TMatrixType; + + Matrix _tmp((std::max)(rows,cols)); + Scalar* tmp = &_tmp.coeffRef(0,0); + + Scalar beta; + RealScalar alpha; + EssentialVectorType essential; + + VectorType v1 = VectorType::Random(rows), v2; + v2 = v1; + v1.makeHouseholder(essential, beta, alpha); + v1.applyHouseholderOnTheLeft(essential,beta,tmp); + VERIFY_IS_APPROX(v1.norm(), v2.norm()); + if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(v1.tail(rows-1).norm(), v1.norm()); + v1 = VectorType::Random(rows); + v2 = v1; + v1.applyHouseholderOnTheLeft(essential,beta,tmp); + VERIFY_IS_APPROX(v1.norm(), v2.norm()); + + // reconstruct householder matrix: + SquareMatrixType id, H1, H2; + id.setIdentity(rows, rows); + H1 = H2 = id; + VectorType vv(rows); + vv << Scalar(1), essential; + H1.applyHouseholderOnTheLeft(essential, beta, tmp); + H2.applyHouseholderOnTheRight(essential, beta, tmp); + VERIFY_IS_APPROX(H1, H2); + VERIFY_IS_APPROX(H1, id - beta * vv*vv.adjoint()); + + MatrixType m1(rows, cols), + m2(rows, cols); + + v1 = VectorType::Random(rows); + if(even) v1.tail(rows-1).setZero(); + m1.colwise() = v1; + m2 = m1; + m1.col(0).makeHouseholder(essential, beta, alpha); + 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(numext::imag(m1(0,0)), numext::real(m1(0,0))); + VERIFY_IS_APPROX(numext::real(m1(0,0)), alpha); + + v1 = VectorType::Random(rows); + if(even) v1.tail(rows-1).setZero(); + SquareMatrixType m3(rows,rows), m4(rows,rows); + m3.rowwise() = v1.transpose(); + m4 = m3; + m3.row(0).makeHouseholder(essential, beta, alpha); + m3.applyHouseholderOnTheRight(essential.conjugate(),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(numext::imag(m3(0,0)), numext::real(m3(0,0))); + VERIFY_IS_APPROX(numext::real(m3(0,0)), alpha); + + // test householder sequence on the left with a shift + + Index shift = internal::random(0, std::max(rows-2,0)); + Index brows = rows - shift; + m1.setRandom(rows, cols); + HBlockMatrixType hbm = m1.block(shift,0,brows,cols); + HouseholderQR qr(hbm); + m2 = m1; + m2.block(shift,0,brows,cols) = qr.matrixQR(); + HCoeffsVectorType hc = qr.hCoeffs().conjugate(); + HouseholderSequence hseq(m2, hc); + hseq.setLength(hc.size()).setShift(shift); + VERIFY(hseq.length() == hc.size()); + VERIFY(hseq.shift() == shift); + + MatrixType m5 = m2; + m5.block(shift,0,brows,cols).template triangularView().setZero(); + VERIFY_IS_APPROX(hseq * m5, m1); // test applying hseq directly + m3 = hseq; + VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating hseq to a dense matrix, then applying + + SquareMatrixType hseq_mat = hseq; + SquareMatrixType hseq_mat_conj = hseq.conjugate(); + SquareMatrixType hseq_mat_adj = hseq.adjoint(); + SquareMatrixType hseq_mat_trans = hseq.transpose(); + SquareMatrixType m6 = SquareMatrixType::Random(rows, rows); + VERIFY_IS_APPROX(hseq_mat.adjoint(), hseq_mat_adj); + VERIFY_IS_APPROX(hseq_mat.conjugate(), hseq_mat_conj); + VERIFY_IS_APPROX(hseq_mat.transpose(), hseq_mat_trans); + VERIFY_IS_APPROX(hseq * m6, hseq_mat * m6); + VERIFY_IS_APPROX(hseq.adjoint() * m6, hseq_mat_adj * m6); + VERIFY_IS_APPROX(hseq.conjugate() * m6, hseq_mat_conj * m6); + VERIFY_IS_APPROX(hseq.transpose() * m6, hseq_mat_trans * m6); + VERIFY_IS_APPROX(m6 * hseq, m6 * hseq_mat); + VERIFY_IS_APPROX(m6 * hseq.adjoint(), m6 * hseq_mat_adj); + VERIFY_IS_APPROX(m6 * hseq.conjugate(), m6 * hseq_mat_conj); + VERIFY_IS_APPROX(m6 * hseq.transpose(), m6 * hseq_mat_trans); + + // test householder sequence on the right with a shift + + TMatrixType tm2 = m2.transpose(); + HouseholderSequence rhseq(tm2, hc); + rhseq.setLength(hc.size()).setShift(shift); + VERIFY_IS_APPROX(rhseq * m5, m1); // test applying rhseq directly + m3 = rhseq; + VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating rhseq to a dense matrix, then applying +} + +EIGEN_DECLARE_TEST(householder) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( householder(Matrix()) ); + CALL_SUBTEST_2( householder(Matrix()) ); + CALL_SUBTEST_3( householder(Matrix()) ); + CALL_SUBTEST_4( householder(Matrix()) ); + CALL_SUBTEST_5( householder(MatrixXd(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_6( householder(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_7( householder(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_8( householder(Matrix()) ); + } +} diff --git a/lib/eigen-3.4.0/test/incomplete_cholesky.cpp b/lib/eigen-3.4.0/test/incomplete_cholesky.cpp new file mode 100644 index 0000000..ecc17f5 --- /dev/null +++ b/lib/eigen-3.4.0/test/incomplete_cholesky.cpp @@ -0,0 +1,69 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015-2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// #define EIGEN_DONT_VECTORIZE +// #define EIGEN_MAX_ALIGN_BYTES 0 +#include "sparse_solver.h" +#include +#include + +template void test_incomplete_cholesky_T() +{ + typedef SparseMatrix SparseMatrixType; + ConjugateGradient > > cg_illt_lower_amd; + ConjugateGradient > > cg_illt_lower_nat; + ConjugateGradient > > cg_illt_upper_amd; + ConjugateGradient > > cg_illt_upper_nat; + ConjugateGradient > > cg_illt_uplo_amd; + + + CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_amd) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_nat) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_amd) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_nat) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_illt_uplo_amd) ); +} + +template +void bug1150() +{ + // regression for bug 1150 + for(int N = 1; N<20; ++N) + { + Eigen::MatrixXd b( N, N ); + b.setOnes(); + + Eigen::SparseMatrix m( N, N ); + m.reserve(Eigen::VectorXi::Constant(N,4)); + for( int i = 0; i < N; ++i ) + { + m.insert( i, i ) = 1; + m.coeffRef( i, i / 2 ) = 2; + m.coeffRef( i, i / 3 ) = 2; + m.coeffRef( i, i / 4 ) = 2; + } + + Eigen::SparseMatrix A; + A = m * m.transpose(); + + Eigen::ConjugateGradient, + Eigen::Lower | Eigen::Upper, + Eigen::IncompleteCholesky > solver( A ); + VERIFY(solver.preconditioner().info() == Eigen::Success); + VERIFY(solver.info() == Eigen::Success); + } +} + +EIGEN_DECLARE_TEST(incomplete_cholesky) +{ + CALL_SUBTEST_1(( test_incomplete_cholesky_T() )); + CALL_SUBTEST_2(( test_incomplete_cholesky_T, int>() )); + CALL_SUBTEST_3(( test_incomplete_cholesky_T() )); + + CALL_SUBTEST_1(( bug1150<0>() )); +} diff --git a/lib/eigen-3.4.0/test/indexed_view.cpp b/lib/eigen-3.4.0/test/indexed_view.cpp new file mode 100644 index 0000000..72c54af --- /dev/null +++ b/lib/eigen-3.4.0/test/indexed_view.cpp @@ -0,0 +1,473 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifdef EIGEN_TEST_PART_2 +// Make sure we also check c++11 max implementation +#define EIGEN_MAX_CPP_VER 11 +#endif + +#ifdef EIGEN_TEST_PART_3 +// Make sure we also check c++98 max implementation +#define EIGEN_MAX_CPP_VER 03 + +// We need to disable this warning when compiling with c++11 while limiting Eigen to c++98 +// Ideally we would rather configure the compiler to build in c++98 mode but this needs +// to be done at the CMakeLists.txt level. +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) + #pragma GCC diagnostic ignored "-Wdeprecated" +#endif + +#if defined(__GNUC__) && (__GNUC__ >=9) + #pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif +#if defined(__clang__) && (__clang_major__ >= 10) + #pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif + +#endif + +#include +#include +#include "main.h" + +#if EIGEN_HAS_CXX11 +#include +#endif + +typedef std::pair IndexPair; + +int encode(Index i, Index j) { + return int(i*100 + j); +} + +IndexPair decode(Index ij) { + return IndexPair(ij / 100, ij % 100); +} + +template +bool match(const T& xpr, std::string ref, std::string str_xpr = "") { + EIGEN_UNUSED_VARIABLE(str_xpr); + std::stringstream str; + str << xpr; + if(!(str.str() == ref)) + std::cout << str_xpr << "\n" << xpr << "\n\n"; + return str.str() == ref; +} + +#define MATCH(X,R) match(X, R, #X) + +template +typename internal::enable_if::value,bool>::type +is_same_eq(const T1& a, const T2& b) +{ + return (a == b).all(); +} + +template +bool is_same_seq(const T1& a, const T2& b) +{ + bool ok = a.first()==b.first() && a.size() == b.size() && Index(a.incrObject())==Index(b.incrObject());; + if(!ok) + { + std::cerr << "seqN(" << a.first() << ", " << a.size() << ", " << Index(a.incrObject()) << ") != "; + std::cerr << "seqN(" << b.first() << ", " << b.size() << ", " << Index(b.incrObject()) << ")\n"; + } + return ok; +} + +template +typename internal::enable_if::value,bool>::type +is_same_seq_type(const T1& a, const T2& b) +{ + return is_same_seq(a,b); +} + + + +#define VERIFY_EQ_INT(A,B) VERIFY_IS_APPROX(int(A),int(B)) + +// C++03 does not allow local or unnamed enums as index +enum DummyEnum { XX=0, YY=1 }; + +void check_indexed_view() +{ + Index n = 10; + + ArrayXd a = ArrayXd::LinSpaced(n,0,n-1); + Array b = a.transpose(); + + #if EIGEN_COMP_CXXVER>=14 + ArrayXXi A = ArrayXXi::NullaryExpr(n,n, std::ref(encode)); + #else + ArrayXXi A = ArrayXXi::NullaryExpr(n,n, std::ptr_fun(&encode)); + #endif + + for(Index i=0; i vali(4); Map(&vali[0],4) = eii; + std::vector veci(4); Map(veci.data(),4) = eii; + + VERIFY( MATCH( A(3, seq(9,3,-1)), + "309 308 307 306 305 304 303") + ); + + VERIFY( MATCH( A(seqN(2,5), seq(9,3,-1)), + "209 208 207 206 205 204 203\n" + "309 308 307 306 305 304 303\n" + "409 408 407 406 405 404 403\n" + "509 508 507 506 505 504 503\n" + "609 608 607 606 605 604 603") + ); + + VERIFY( MATCH( A(seqN(2,5), 5), + "205\n" + "305\n" + "405\n" + "505\n" + "605") + ); + + VERIFY( MATCH( A(seqN(last,5,-1), seq(2,last)), + "902 903 904 905 906 907 908 909\n" + "802 803 804 805 806 807 808 809\n" + "702 703 704 705 706 707 708 709\n" + "602 603 604 605 606 607 608 609\n" + "502 503 504 505 506 507 508 509") + ); + + VERIFY( MATCH( A(eii, veci), + "303 301 306 305\n" + "103 101 106 105\n" + "603 601 606 605\n" + "503 501 506 505") + ); + + VERIFY( MATCH( A(eii, all), + "300 301 302 303 304 305 306 307 308 309\n" + "100 101 102 103 104 105 106 107 108 109\n" + "600 601 602 603 604 605 606 607 608 609\n" + "500 501 502 503 504 505 506 507 508 509") + ); + + // take row number 3, and repeat it 5 times + VERIFY( MATCH( A(seqN(3,5,0), all), + "300 301 302 303 304 305 306 307 308 309\n" + "300 301 302 303 304 305 306 307 308 309\n" + "300 301 302 303 304 305 306 307 308 309\n" + "300 301 302 303 304 305 306 307 308 309\n" + "300 301 302 303 304 305 306 307 308 309") + ); + + VERIFY( MATCH( a(seqN(3,3),0), "3\n4\n5" ) ); + VERIFY( MATCH( a(seq(3,5)), "3\n4\n5" ) ); + VERIFY( MATCH( a(seqN(3,3,1)), "3\n4\n5" ) ); + VERIFY( MATCH( a(seqN(5,3,-1)), "5\n4\n3" ) ); + + VERIFY( MATCH( b(0,seqN(3,3)), "3 4 5" ) ); + VERIFY( MATCH( b(seq(3,5)), "3 4 5" ) ); + VERIFY( MATCH( b(seqN(3,3,1)), "3 4 5" ) ); + VERIFY( MATCH( b(seqN(5,3,-1)), "5 4 3" ) ); + + VERIFY( MATCH( b(all), "0 1 2 3 4 5 6 7 8 9" ) ); + VERIFY( MATCH( b(eii), "3 1 6 5" ) ); + + Array44i B; + B.setRandom(); + VERIFY( (A(seqN(2,5), 5)).ColsAtCompileTime == 1); + VERIFY( (A(seqN(2,5), 5)).RowsAtCompileTime == Dynamic); + VERIFY_EQ_INT( (A(seqN(2,5), 5)).InnerStrideAtCompileTime , A.InnerStrideAtCompileTime); + VERIFY_EQ_INT( (A(seqN(2,5), 5)).OuterStrideAtCompileTime , A.col(5).OuterStrideAtCompileTime); + + VERIFY_EQ_INT( (A(5,seqN(2,5))).InnerStrideAtCompileTime , A.row(5).InnerStrideAtCompileTime); + VERIFY_EQ_INT( (A(5,seqN(2,5))).OuterStrideAtCompileTime , A.row(5).OuterStrideAtCompileTime); + VERIFY_EQ_INT( (B(1,seqN(1,2))).InnerStrideAtCompileTime , B.row(1).InnerStrideAtCompileTime); + VERIFY_EQ_INT( (B(1,seqN(1,2))).OuterStrideAtCompileTime , B.row(1).OuterStrideAtCompileTime); + + VERIFY_EQ_INT( (A(seqN(2,5), seq(1,3))).InnerStrideAtCompileTime , A.InnerStrideAtCompileTime); + VERIFY_EQ_INT( (A(seqN(2,5), seq(1,3))).OuterStrideAtCompileTime , A.OuterStrideAtCompileTime); + VERIFY_EQ_INT( (B(seqN(1,2), seq(1,3))).InnerStrideAtCompileTime , B.InnerStrideAtCompileTime); + VERIFY_EQ_INT( (B(seqN(1,2), seq(1,3))).OuterStrideAtCompileTime , B.OuterStrideAtCompileTime); + VERIFY_EQ_INT( (A(seqN(2,5,2), seq(1,3,2))).InnerStrideAtCompileTime , Dynamic); + VERIFY_EQ_INT( (A(seqN(2,5,2), seq(1,3,2))).OuterStrideAtCompileTime , Dynamic); + VERIFY_EQ_INT( (A(seqN(2,5,fix<2>), seq(1,3,fix<3>))).InnerStrideAtCompileTime , 2); + VERIFY_EQ_INT( (A(seqN(2,5,fix<2>), seq(1,3,fix<3>))).OuterStrideAtCompileTime , Dynamic); + VERIFY_EQ_INT( (B(seqN(1,2,fix<2>), seq(1,3,fix<3>))).InnerStrideAtCompileTime , 2); + VERIFY_EQ_INT( (B(seqN(1,2,fix<2>), seq(1,3,fix<3>))).OuterStrideAtCompileTime , 3*4); + + VERIFY_EQ_INT( (A(seqN(2,fix<5>), seqN(1,fix<3>))).RowsAtCompileTime, 5); + VERIFY_EQ_INT( (A(seqN(2,fix<5>), seqN(1,fix<3>))).ColsAtCompileTime, 3); + VERIFY_EQ_INT( (A(seqN(2,fix<5>(5)), seqN(1,fix<3>(3)))).RowsAtCompileTime, 5); + VERIFY_EQ_INT( (A(seqN(2,fix<5>(5)), seqN(1,fix<3>(3)))).ColsAtCompileTime, 3); + VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).RowsAtCompileTime, Dynamic); + VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).ColsAtCompileTime, Dynamic); + VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).rows(), 5); + VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).cols(), 3); + + VERIFY( is_same_seq_type( seqN(2,5,fix<-1>), seqN(2,5,fix<-1>(-1)) ) ); + VERIFY( is_same_seq_type( seqN(2,5), seqN(2,5,fix<1>(1)) ) ); + VERIFY( is_same_seq_type( seqN(2,5,3), seqN(2,5,fix(3)) ) ); + VERIFY( is_same_seq_type( seq(2,7,fix<3>), seqN(2,2,fix<3>) ) ); + VERIFY( is_same_seq_type( seqN(2,fix(5),3), seqN(2,5,fix(3)) ) ); + VERIFY( is_same_seq_type( seqN(2,fix<5>(5),fix<-2>), seqN(2,fix<5>,fix<-2>()) ) ); + + VERIFY( is_same_seq_type( seq(2,fix<5>), seqN(2,4) ) ); +#if EIGEN_HAS_CXX11 + VERIFY( is_same_seq_type( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) ); + VERIFY( is_same_seq( seqN(2,std::integral_constant(),std::integral_constant()), seqN(2,fix<5>,fix<-2>()) ) ); + VERIFY( is_same_seq( seq(std::integral_constant(),std::integral_constant(),std::integral_constant()), + seq(fix<1>,fix<5>,fix<2>()) ) ); + VERIFY( is_same_seq_type( seqN(2,std::integral_constant(),std::integral_constant()), seqN(2,fix<5>,fix<-2>()) ) ); + VERIFY( is_same_seq_type( seq(std::integral_constant(),std::integral_constant(),std::integral_constant()), + seq(fix<1>,fix<5>,fix<2>()) ) ); + + VERIFY( is_same_seq_type( seqN(2,std::integral_constant()), seqN(2,fix<5>) ) ); + VERIFY( is_same_seq_type( seq(std::integral_constant(),std::integral_constant()), seq(fix<1>,fix<5>) ) ); +#else + // sorry, no compile-time size recovery in c++98/03 + VERIFY( is_same_seq( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) ); +#endif + + VERIFY( (A(seqN(2,fix<5>), 5)).RowsAtCompileTime == 5); + VERIFY( (A(4, all)).ColsAtCompileTime == Dynamic); + VERIFY( (A(4, all)).RowsAtCompileTime == 1); + VERIFY( (B(1, all)).ColsAtCompileTime == 4); + VERIFY( (B(1, all)).RowsAtCompileTime == 1); + VERIFY( (B(all,1)).ColsAtCompileTime == 1); + VERIFY( (B(all,1)).RowsAtCompileTime == 4); + + VERIFY(int( (A(all, eii)).ColsAtCompileTime) == int(eii.SizeAtCompileTime)); + VERIFY_EQ_INT( (A(eii, eii)).Flags&DirectAccessBit, (unsigned int)(0)); + VERIFY_EQ_INT( (A(eii, eii)).InnerStrideAtCompileTime, 0); + VERIFY_EQ_INT( (A(eii, eii)).OuterStrideAtCompileTime, 0); + + VERIFY_IS_APPROX( A(seq(n-1,2,-2), seqN(n-1-6,3,-1)), A(seq(last,2,fix<-2>), seqN(last-6,3,fix<-1>)) ); + + VERIFY_IS_APPROX( A(seq(n-1,2,-2), seqN(n-1-6,4)), A(seq(last,2,-2), seqN(last-6,4)) ); + VERIFY_IS_APPROX( A(seq(n-1-6,n-1-2), seqN(n-1-6,4)), A(seq(last-6,last-2), seqN(6+last-6-6,4)) ); + VERIFY_IS_APPROX( A(seq((n-1)/2,(n)/2+3), seqN(2,4)), A(seq(last/2,(last+1)/2+3), seqN(last+2-last,4)) ); + VERIFY_IS_APPROX( A(seq(n-2,2,-2), seqN(n-8,4)), A(seq(lastp1-2,2,-2), seqN(lastp1-8,4)) ); + + // Check all combinations of seq: + VERIFY_IS_APPROX( A(seq(1,n-1-2,2), seq(1,n-1-2,2)), A(seq(1,last-2,2), seq(1,last-2,fix<2>)) ); + VERIFY_IS_APPROX( A(seq(n-1-5,n-1-2,2), seq(n-1-5,n-1-2,2)), A(seq(last-5,last-2,2), seq(last-5,last-2,fix<2>)) ); + VERIFY_IS_APPROX( A(seq(n-1-5,7,2), seq(n-1-5,7,2)), A(seq(last-5,7,2), seq(last-5,7,fix<2>)) ); + VERIFY_IS_APPROX( A(seq(1,n-1-2), seq(n-1-5,7)), A(seq(1,last-2), seq(last-5,7)) ); + VERIFY_IS_APPROX( A(seq(n-1-5,n-1-2), seq(n-1-5,n-1-2)), A(seq(last-5,last-2), seq(last-5,last-2)) ); + + VERIFY_IS_APPROX( A.col(A.cols()-1), A(all,last) ); + VERIFY_IS_APPROX( A(A.rows()-2, A.cols()/2), A(last-1, lastp1/2) ); + VERIFY_IS_APPROX( a(a.size()-2), a(last-1) ); + VERIFY_IS_APPROX( a(a.size()/2), a((last+1)/2) ); + + // Check fall-back to Block + { + VERIFY( is_same_eq(A.col(0), A(all,0)) ); + VERIFY( is_same_eq(A.row(0), A(0,all)) ); + VERIFY( is_same_eq(A.block(0,0,2,2), A(seqN(0,2),seq(0,1))) ); + VERIFY( is_same_eq(A.middleRows(2,4), A(seqN(2,4),all)) ); + VERIFY( is_same_eq(A.middleCols(2,4), A(all,seqN(2,4))) ); + + VERIFY( is_same_eq(A.col(A.cols()-1), A(all,last)) ); + + const ArrayXXi& cA(A); + VERIFY( is_same_eq(cA.col(0), cA(all,0)) ); + VERIFY( is_same_eq(cA.row(0), cA(0,all)) ); + VERIFY( is_same_eq(cA.block(0,0,2,2), cA(seqN(0,2),seq(0,1))) ); + VERIFY( is_same_eq(cA.middleRows(2,4), cA(seqN(2,4),all)) ); + VERIFY( is_same_eq(cA.middleCols(2,4), cA(all,seqN(2,4))) ); + + VERIFY( is_same_eq(a.head(4), a(seq(0,3))) ); + VERIFY( is_same_eq(a.tail(4), a(seqN(last-3,4))) ); + VERIFY( is_same_eq(a.tail(4), a(seq(lastp1-4,last))) ); + VERIFY( is_same_eq(a.segment<4>(3), a(seqN(3,fix<4>))) ); + } + + ArrayXXi A1=A, A2 = ArrayXXi::Random(4,4); + ArrayXi range25(4); range25 << 3,2,4,5; + A1(seqN(3,4),seq(2,5)) = A2; + VERIFY_IS_APPROX( A1.block(3,2,4,4), A2 ); + A1 = A; + A2.setOnes(); + A1(seq(6,3,-1),range25) = A2; + VERIFY_IS_APPROX( A1.block(3,2,4,4), A2 ); + + // check reverse + { + VERIFY( is_same_seq_type( seq(3,7).reverse(), seqN(7,5,fix<-1>) ) ); + VERIFY( is_same_seq_type( seq(7,3,fix<-2>).reverse(), seqN(3,3,fix<2>) ) ); + VERIFY_IS_APPROX( a(seqN(2,last/2).reverse()), a(seqN(2+(last/2-1)*1,last/2,fix<-1>)) ); + VERIFY_IS_APPROX( a(seqN(last/2,fix<4>).reverse()),a(seqN(last/2,fix<4>)).reverse() ); + VERIFY_IS_APPROX( A(seq(last-5,last-1,2).reverse(), seqN(last-3,3,fix<-2>).reverse()), + A(seq(last-5,last-1,2), seqN(last-3,3,fix<-2>)).reverse() ); + } + +#if EIGEN_HAS_CXX11 + // check lastN + VERIFY_IS_APPROX( a(lastN(3)), a.tail(3) ); + VERIFY( MATCH( a(lastN(3)), "7\n8\n9" ) ); + VERIFY_IS_APPROX( a(lastN(fix<3>())), a.tail<3>() ); + VERIFY( MATCH( a(lastN(3,2)), "5\n7\n9" ) ); + VERIFY( MATCH( a(lastN(3,fix<2>())), "5\n7\n9" ) ); + VERIFY( a(lastN(fix<3>())).SizeAtCompileTime == 3 ); + + VERIFY( (A(all, std::array{{1,3,2,4}})).ColsAtCompileTime == 4); + + VERIFY_IS_APPROX( (A(std::array{{1,3,5}}, std::array{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) ); + +#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE + VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array{{3, 1, 6, 5}}, all) ); + VERIFY_IS_APPROX( A(all,{3, 1, 6, 5}), A(all,std::array{{3, 1, 6, 5}}) ); + VERIFY_IS_APPROX( A({1,3,5},{3, 1, 6, 5}), A(std::array{{1,3,5}},std::array{{3, 1, 6, 5}}) ); + + VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).RowsAtCompileTime, 3 ); + VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).ColsAtCompileTime, 4 ); + + VERIFY_IS_APPROX( a({3, 1, 6, 5}), a(std::array{{3, 1, 6, 5}}) ); + VERIFY_IS_EQUAL( a({1,3,5}).SizeAtCompileTime, 3 ); + + VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array{{3, 1, 6, 5}}) ); + VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 ); +#endif + +#endif + + // check mat(i,j) with weird types for i and j + { + VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, 1), A(3,1) ); + VERIFY_IS_APPROX( A(B.RowsAtCompileTime, 1), A(4,1) ); + VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, B.ColsAtCompileTime-1), A(3,3) ); + VERIFY_IS_APPROX( A(B.RowsAtCompileTime, B.ColsAtCompileTime), A(4,4) ); + const Index I_ = 3, J_ = 4; + VERIFY_IS_APPROX( A(I_,J_), A(3,4) ); + } + + // check extended block API + { + VERIFY( is_same_eq( A.block<3,4>(1,1), A.block(1,1,fix<3>,fix<4>)) ); + VERIFY( is_same_eq( A.block<3,4>(1,1,3,4), A.block(1,1,fix<3>(),fix<4>(4))) ); + VERIFY( is_same_eq( A.block<3,Dynamic>(1,1,3,4), A.block(1,1,fix<3>,4)) ); + VERIFY( is_same_eq( A.block(1,1,3,4), A.block(1,1,fix(3),fix<4>)) ); + VERIFY( is_same_eq( A.block(1,1,3,4), A.block(1,1,fix(3),fix(4))) ); + + VERIFY( is_same_eq( A.topLeftCorner<3,4>(), A.topLeftCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( A.bottomLeftCorner<3,4>(), A.bottomLeftCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( A.bottomRightCorner<3,4>(), A.bottomRightCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( A.topRightCorner<3,4>(), A.topRightCorner(fix<3>,fix<4>)) ); + + VERIFY( is_same_eq( A.leftCols<3>(), A.leftCols(fix<3>)) ); + VERIFY( is_same_eq( A.rightCols<3>(), A.rightCols(fix<3>)) ); + VERIFY( is_same_eq( A.middleCols<3>(1), A.middleCols(1,fix<3>)) ); + + VERIFY( is_same_eq( A.topRows<3>(), A.topRows(fix<3>)) ); + VERIFY( is_same_eq( A.bottomRows<3>(), A.bottomRows(fix<3>)) ); + VERIFY( is_same_eq( A.middleRows<3>(1), A.middleRows(1,fix<3>)) ); + + VERIFY( is_same_eq( a.segment<3>(1), a.segment(1,fix<3>)) ); + VERIFY( is_same_eq( a.head<3>(), a.head(fix<3>)) ); + VERIFY( is_same_eq( a.tail<3>(), a.tail(fix<3>)) ); + + const ArrayXXi& cA(A); + VERIFY( is_same_eq( cA.block(1,1,3,4), cA.block(1,1,fix(3),fix<4>)) ); + + VERIFY( is_same_eq( cA.topLeftCorner<3,4>(), cA.topLeftCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( cA.bottomLeftCorner<3,4>(), cA.bottomLeftCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( cA.bottomRightCorner<3,4>(), cA.bottomRightCorner(fix<3>,fix<4>)) ); + VERIFY( is_same_eq( cA.topRightCorner<3,4>(), cA.topRightCorner(fix<3>,fix<4>)) ); + + VERIFY( is_same_eq( cA.leftCols<3>(), cA.leftCols(fix<3>)) ); + VERIFY( is_same_eq( cA.rightCols<3>(), cA.rightCols(fix<3>)) ); + VERIFY( is_same_eq( cA.middleCols<3>(1), cA.middleCols(1,fix<3>)) ); + + VERIFY( is_same_eq( cA.topRows<3>(), cA.topRows(fix<3>)) ); + VERIFY( is_same_eq( cA.bottomRows<3>(), cA.bottomRows(fix<3>)) ); + VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) ); + } + + // Check compilation of enums as index type: + a(XX) = 1; + A(XX,YY) = 1; + // Anonymous enums only work with C++11 +#if EIGEN_HAS_CXX11 + enum { X=0, Y=1 }; + a(X) = 1; + A(X,Y) = 1; + A(XX,Y) = 1; + A(X,YY) = 1; +#endif + + // Check compilation of varying integer types as index types: + Index i = n/2; + short i_short(i); + std::size_t i_sizet(i); + VERIFY_IS_EQUAL( a(i), a.coeff(i_short) ); + VERIFY_IS_EQUAL( a(i), a.coeff(i_sizet) ); + + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_sizet) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(5, i_sizet) ); + + // Regression test for Max{Rows,Cols}AtCompileTime + { + Matrix3i A3 = Matrix3i::Random(); + ArrayXi ind(5); ind << 1,1,1,1,1; + VERIFY_IS_EQUAL( A3(ind,ind).eval(), MatrixXi::Constant(5,5,A3(1,1)) ); + } + + // Regression for bug 1736 + { + VERIFY_IS_APPROX(A(all, eii).col(0).eval(), A.col(eii(0))); + A(all, eii).col(0) = A.col(eii(0)); + } + + // bug 1815: IndexedView should allow linear access + { + VERIFY( MATCH( b(eii)(0), "3" ) ); + VERIFY( MATCH( a(eii)(0), "3" ) ); + VERIFY( MATCH( A(1,eii)(0), "103")); + VERIFY( MATCH( A(eii,1)(0), "301")); + VERIFY( MATCH( A(1,all)(1), "101")); + VERIFY( MATCH( A(all,1)(1), "101")); + } + +#if EIGEN_HAS_CXX11 + //Bug IndexView with a single static row should be RowMajor: + { + // A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval(); + STATIC_CHECK(( (internal::evaluator::Flags & RowMajorBit) == RowMajorBit )); + } +#endif + +} + +EIGEN_DECLARE_TEST(indexed_view) +{ +// for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( check_indexed_view() ); + CALL_SUBTEST_2( check_indexed_view() ); + CALL_SUBTEST_3( check_indexed_view() ); +// } + + // static checks of some internals: + STATIC_CHECK(( internal::is_valid_index_type::value )); + STATIC_CHECK(( internal::is_valid_index_type::value )); + STATIC_CHECK(( internal::is_valid_index_type::value )); + STATIC_CHECK(( internal::is_valid_index_type::value )); + STATIC_CHECK(( internal::is_valid_index_type::value )); + STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); + STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); + STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); + STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); +} diff --git a/lib/eigen-3.4.0/test/initializer_list_construction.cpp b/lib/eigen-3.4.0/test/initializer_list_construction.cpp new file mode 100644 index 0000000..7a9c49e --- /dev/null +++ b/lib/eigen-3.4.0/test/initializer_list_construction.cpp @@ -0,0 +1,385 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2019 David Tellenbach +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT + +#include "main.h" + +template::IsInteger> +struct TestMethodDispatching { + static void run() {} +}; + +template +struct TestMethodDispatching { + static void run() + { + { + Matrix m {3, 4}; + Array a {3, 4}; + VERIFY(m.rows() == 3); + VERIFY(m.cols() == 4); + VERIFY(a.rows() == 3); + VERIFY(a.cols() == 4); + } + { + Matrix m {3, 4}; + Array a {3, 4}; + VERIFY(m(0) == 3); + VERIFY(m(1) == 4); + VERIFY(a(0) == 3); + VERIFY(a(1) == 4); + } + { + Matrix m {3, 4}; + Array a {3, 4}; + VERIFY(m(0) == 3); + VERIFY(m(1) == 4); + VERIFY(a(0) == 3); + VERIFY(a(1) == 4); + } + } +}; + +template void fixedsizeVariadicVectorConstruction2() +{ + { + Vec4 ref = Vec4::Random(); + Vec4 v{ ref[0], ref[1], ref[2], ref[3] }; + VERIFY_IS_APPROX(v, ref); + VERIFY_IS_APPROX(v, (Vec4( ref[0], ref[1], ref[2], ref[3] ))); + VERIFY_IS_APPROX(v, (Vec4({ref[0], ref[1], ref[2], ref[3]}))); + + Vec4 v2 = { ref[0], ref[1], ref[2], ref[3] }; + VERIFY_IS_APPROX(v2, ref); + } + { + Vec5 ref = Vec5::Random(); + Vec5 v{ ref[0], ref[1], ref[2], ref[3], ref[4] }; + VERIFY_IS_APPROX(v, ref); + VERIFY_IS_APPROX(v, (Vec5( ref[0], ref[1], ref[2], ref[3], ref[4] ))); + VERIFY_IS_APPROX(v, (Vec5({ref[0], ref[1], ref[2], ref[3], ref[4]}))); + + Vec5 v2 = { ref[0], ref[1], ref[2], ref[3], ref[4] }; + VERIFY_IS_APPROX(v2, ref); + } +} + +#define CHECK_MIXSCALAR_V5_APPROX(V, A0, A1, A2, A3, A4) { \ + VERIFY_IS_APPROX(V[0], Scalar(A0) ); \ + VERIFY_IS_APPROX(V[1], Scalar(A1) ); \ + VERIFY_IS_APPROX(V[2], Scalar(A2) ); \ + VERIFY_IS_APPROX(V[3], Scalar(A3) ); \ + VERIFY_IS_APPROX(V[4], Scalar(A4) ); \ +} + +#define CHECK_MIXSCALAR_V5(VEC5, A0, A1, A2, A3, A4) { \ + typedef VEC5::Scalar Scalar; \ + VEC5 v = { A0 , A1 , A2 , A3 , A4 }; \ + CHECK_MIXSCALAR_V5_APPROX(v, A0 , A1 , A2 , A3 , A4); \ +} + +template void fixedsizeVariadicVectorConstruction3() +{ + typedef Matrix Vec5; + typedef Array Arr5; + CHECK_MIXSCALAR_V5(Vec5, 1, 2., -3, 4.121, 5.53252); + CHECK_MIXSCALAR_V5(Arr5, 1, 2., 3.12f, 4.121, 5.53252); +} + +template void fixedsizeVariadicVectorConstruction() +{ + CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Matrix >() )); + CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Matrix >() )); + CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Array >() )); + CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Array >() )); +} + + +template void initializerListVectorConstruction() +{ + Scalar raw[4]; + for(int k = 0; k < 4; ++k) { + raw[k] = internal::random(); + } + { + Matrix m { {raw[0]}, {raw[1]},{raw[2]},{raw[3]} }; + Array a { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; + for(int k = 0; k < 4; ++k) { + VERIFY(m(k) == raw[k]); + } + for(int k = 0; k < 4; ++k) { + VERIFY(a(k) == raw[k]); + } + VERIFY_IS_EQUAL(m, (Matrix({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))); + VERIFY((a == (Array({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))).all()); + } + { + Matrix m { {raw[0], raw[1], raw[2], raw[3]} }; + Array a { {raw[0], raw[1], raw[2], raw[3]} }; + for(int k = 0; k < 4; ++k) { + VERIFY(m(k) == raw[k]); + } + for(int k = 0; k < 4; ++k) { + VERIFY(a(k) == raw[k]); + } + VERIFY_IS_EQUAL(m, (Matrix({{raw[0],raw[1],raw[2],raw[3]}}))); + VERIFY((a == (Array({{raw[0],raw[1],raw[2],raw[3]}}))).all()); + } + { + Matrix m { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; + Array a { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; + for(int k=0; k < 4; ++k) { + VERIFY(m(k) == raw[k]); + } + for(int k=0; k < 4; ++k) { + VERIFY(a(k) == raw[k]); + } + VERIFY_IS_EQUAL(m, (Matrix({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))); + VERIFY((a == (Array({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))).all()); + } + { + Matrix m {{raw[0],raw[1],raw[2],raw[3]}}; + Array a {{raw[0],raw[1],raw[2],raw[3]}}; + for(int k=0; k < 4; ++k) { + VERIFY(m(k) == raw[k]); + } + for(int k=0; k < 4; ++k) { + VERIFY(a(k) == raw[k]); + } + VERIFY_IS_EQUAL(m, (Matrix({{raw[0],raw[1],raw[2],raw[3]}}))); + VERIFY((a == (Array({{raw[0],raw[1],raw[2],raw[3]}}))).all()); + } +} + +template void initializerListMatrixConstruction() +{ + const Index RowsAtCompileTime = 5; + const Index ColsAtCompileTime = 4; + const Index SizeAtCompileTime = RowsAtCompileTime * ColsAtCompileTime; + + Scalar raw[SizeAtCompileTime]; + for (int i = 0; i < SizeAtCompileTime; ++i) { + raw[i] = internal::random(); + } + { + Matrix m {}; + VERIFY(m.cols() == 0); + VERIFY(m.rows() == 0); + VERIFY_IS_EQUAL(m, (Matrix())); + } + { + Matrix m { + {raw[0], raw[1], raw[2], raw[3]}, + {raw[4], raw[5], raw[6], raw[7]}, + {raw[8], raw[9], raw[10], raw[11]}, + {raw[12], raw[13], raw[14], raw[15]}, + {raw[16], raw[17], raw[18], raw[19]} + }; + + Matrix m2; + m2 << raw[0], raw[1], raw[2], raw[3], + raw[4], raw[5], raw[6], raw[7], + raw[8], raw[9], raw[10], raw[11], + raw[12], raw[13], raw[14], raw[15], + raw[16], raw[17], raw[18], raw[19]; + + int k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + VERIFY(m(i, j) == raw[k]); + ++k; + } + } + VERIFY_IS_EQUAL(m, m2); + } + { + Matrix m{ + {raw[0], raw[1], raw[2], raw[3]}, + {raw[4], raw[5], raw[6], raw[7]}, + {raw[8], raw[9], raw[10], raw[11]}, + {raw[12], raw[13], raw[14], raw[15]}, + {raw[16], raw[17], raw[18], raw[19]} + }; + + VERIFY(m.cols() == 4); + VERIFY(m.rows() == 5); + int k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + VERIFY(m(i, j) == raw[k]); + ++k; + } + } + + Matrix m2(RowsAtCompileTime, ColsAtCompileTime); + k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + m2(i, j) = raw[k]; + ++k; + } + } + VERIFY_IS_EQUAL(m, m2); + } +} + +template void initializerListArrayConstruction() +{ + const Index RowsAtCompileTime = 5; + const Index ColsAtCompileTime = 4; + const Index SizeAtCompileTime = RowsAtCompileTime * ColsAtCompileTime; + + Scalar raw[SizeAtCompileTime]; + for (int i = 0; i < SizeAtCompileTime; ++i) { + raw[i] = internal::random(); + } + { + Array a {}; + VERIFY(a.cols() == 0); + VERIFY(a.rows() == 0); + } + { + Array m { + {raw[0], raw[1], raw[2], raw[3]}, + {raw[4], raw[5], raw[6], raw[7]}, + {raw[8], raw[9], raw[10], raw[11]}, + {raw[12], raw[13], raw[14], raw[15]}, + {raw[16], raw[17], raw[18], raw[19]} + }; + + Array m2; + m2 << raw[0], raw[1], raw[2], raw[3], + raw[4], raw[5], raw[6], raw[7], + raw[8], raw[9], raw[10], raw[11], + raw[12], raw[13], raw[14], raw[15], + raw[16], raw[17], raw[18], raw[19]; + + int k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + VERIFY(m(i, j) == raw[k]); + ++k; + } + } + VERIFY_IS_APPROX(m, m2); + } + { + Array m { + {raw[0], raw[1], raw[2], raw[3]}, + {raw[4], raw[5], raw[6], raw[7]}, + {raw[8], raw[9], raw[10], raw[11]}, + {raw[12], raw[13], raw[14], raw[15]}, + {raw[16], raw[17], raw[18], raw[19]} + }; + + VERIFY(m.cols() == 4); + VERIFY(m.rows() == 5); + int k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + VERIFY(m(i, j) == raw[k]); + ++k; + } + } + + Array m2(RowsAtCompileTime, ColsAtCompileTime); + k = 0; + for(int i = 0; i < RowsAtCompileTime; ++i) { + for (int j = 0; j < ColsAtCompileTime; ++j) { + m2(i, j) = raw[k]; + ++k; + } + } + VERIFY_IS_APPROX(m, m2); + } +} + +template void dynamicVectorConstruction() +{ + const Index size = 4; + Scalar raw[size]; + for (int i = 0; i < size; ++i) { + raw[i] = internal::random(); + } + + typedef Matrix VectorX; + + { + VectorX v {{raw[0], raw[1], raw[2], raw[3]}}; + for (int i = 0; i < size; ++i) { + VERIFY(v(i) == raw[i]); + } + VERIFY(v.rows() == size); + VERIFY(v.cols() == 1); + VERIFY_IS_EQUAL(v, (VectorX {{raw[0], raw[1], raw[2], raw[3]}})); + } + + { + VERIFY_RAISES_ASSERT((VectorX {raw[0], raw[1], raw[2], raw[3]})); + } + { + VERIFY_RAISES_ASSERT((VectorX { + {raw[0], raw[1], raw[2], raw[3]}, + {raw[0], raw[1], raw[2], raw[3]}, + })); + } +} + +EIGEN_DECLARE_TEST(initializer_list_construction) +{ + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction()); + CALL_SUBTEST_1(initializerListVectorConstruction>()); + CALL_SUBTEST_1(initializerListVectorConstruction>()); + + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction()); + CALL_SUBTEST_2(initializerListMatrixConstruction>()); + CALL_SUBTEST_2(initializerListMatrixConstruction>()); + + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction()); + CALL_SUBTEST_3(initializerListArrayConstruction>()); + CALL_SUBTEST_3(initializerListArrayConstruction>()); + + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction>()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction>()); + CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction3<0>()); + + CALL_SUBTEST_5(TestMethodDispatching::run()); + CALL_SUBTEST_5(TestMethodDispatching::run()); + + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction()); + CALL_SUBTEST_6(dynamicVectorConstruction>()); + CALL_SUBTEST_6(dynamicVectorConstruction>()); +} diff --git a/lib/eigen-3.4.0/test/inplace_decomposition.cpp b/lib/eigen-3.4.0/test/inplace_decomposition.cpp new file mode 100644 index 0000000..e3aa995 --- /dev/null +++ b/lib/eigen-3.4.0/test/inplace_decomposition.cpp @@ -0,0 +1,110 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include +#include + +// This file test inplace decomposition through Ref<>, as supported by Cholesky, LU, and QR decompositions. + +template void inplace(bool square = false, bool SPD = false) +{ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix RhsType; + typedef Matrix ResType; + + Index rows = MatrixType::RowsAtCompileTime==Dynamic ? internal::random(2,EIGEN_TEST_MAX_SIZE/2) : Index(MatrixType::RowsAtCompileTime); + Index cols = MatrixType::ColsAtCompileTime==Dynamic ? (square?rows:internal::random(2,rows)) : Index(MatrixType::ColsAtCompileTime); + + MatrixType A = MatrixType::Random(rows,cols); + RhsType b = RhsType::Random(rows); + ResType x(cols); + + if(SPD) + { + assert(square); + A.topRows(cols) = A.topRows(cols).adjoint() * A.topRows(cols); + A.diagonal().array() += 1e-3; + } + + MatrixType A0 = A; + MatrixType A1 = A; + + DecType dec(A); + + // Check that the content of A has been modified + VERIFY_IS_NOT_APPROX( A, A0 ); + + // Check that the decomposition is correct: + if(rows==cols) + { + VERIFY_IS_APPROX( A0 * (x = dec.solve(b)), b ); + } + else + { + VERIFY_IS_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); + } + + // Check that modifying A breaks the current dec: + A.setRandom(); + if(rows==cols) + { + VERIFY_IS_NOT_APPROX( A0 * (x = dec.solve(b)), b ); + } + else + { + VERIFY_IS_NOT_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); + } + + // Check that calling compute(A1) does not modify A1: + A = A0; + dec.compute(A1); + VERIFY_IS_EQUAL(A0,A1); + VERIFY_IS_NOT_APPROX( A, A0 ); + if(rows==cols) + { + VERIFY_IS_APPROX( A0 * (x = dec.solve(b)), b ); + } + else + { + VERIFY_IS_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); + } +} + + +EIGEN_DECLARE_TEST(inplace_decomposition) +{ + EIGEN_UNUSED typedef Matrix Matrix43d; + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(( inplace >, MatrixXd>(true,true) )); + CALL_SUBTEST_1(( inplace >, Matrix4d>(true,true) )); + + CALL_SUBTEST_2(( inplace >, MatrixXd>(true,true) )); + CALL_SUBTEST_2(( inplace >, Matrix4d>(true,true) )); + + CALL_SUBTEST_3(( inplace >, MatrixXd>(true,false) )); + CALL_SUBTEST_3(( inplace >, Matrix4d>(true,false) )); + + CALL_SUBTEST_4(( inplace >, MatrixXd>(true,false) )); + CALL_SUBTEST_4(( inplace >, Matrix4d>(true,false) )); + + CALL_SUBTEST_5(( inplace >, MatrixXd>(false,false) )); + CALL_SUBTEST_5(( inplace >, Matrix43d>(false,false) )); + + CALL_SUBTEST_6(( inplace >, MatrixXd>(false,false) )); + CALL_SUBTEST_6(( inplace >, Matrix43d>(false,false) )); + + CALL_SUBTEST_7(( inplace >, MatrixXd>(false,false) )); + CALL_SUBTEST_7(( inplace >, Matrix43d>(false,false) )); + + CALL_SUBTEST_8(( inplace >, MatrixXd>(false,false) )); + CALL_SUBTEST_8(( inplace >, Matrix43d>(false,false) )); + } +} diff --git a/lib/eigen-3.4.0/test/integer_types.cpp b/lib/eigen-3.4.0/test/integer_types.cpp new file mode 100644 index 0000000..31f4100 --- /dev/null +++ b/lib/eigen-3.4.0/test/integer_types.cpp @@ -0,0 +1,173 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_STATIC_ASSERT + +#include "main.h" + +#undef VERIFY_IS_APPROX +#define VERIFY_IS_APPROX(a, b) VERIFY((a)==(b)); +#undef VERIFY_IS_NOT_APPROX +#define VERIFY_IS_NOT_APPROX(a, b) VERIFY((a)!=(b)); + +template void signed_integer_type_tests(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; + VERIFY(is_signed == 1); + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1(rows, cols), + m2 = MatrixType::Random(rows, cols), + mzero = MatrixType::Zero(rows, cols); + + do { + m1 = MatrixType::Random(rows, cols); + } while(m1 == mzero || m1 == m2); + + // check linear structure + + Scalar s1; + do { + s1 = internal::random(); + } while(s1 == 0); + + VERIFY_IS_EQUAL(-(-m1), m1); + VERIFY_IS_EQUAL(-m2+m1+m2, m1); + VERIFY_IS_EQUAL((-m1+m2)*s1, -s1*m1+s1*m2); +} + +template void integer_type_tests(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + VERIFY(NumTraits::IsInteger); + enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; + VERIFY(int(NumTraits::IsSigned) == is_signed); + + typedef Matrix VectorType; + + Index rows = m.rows(); + Index cols = m.cols(); + + // this test relies a lot on Random.h, and there's not much more that we can do + // to test it, hence I consider that we will have tested Random.h + MatrixType m1(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols), + mzero = MatrixType::Zero(rows, cols); + + typedef Matrix SquareMatrixType; + SquareMatrixType identity = SquareMatrixType::Identity(rows, rows), + square = SquareMatrixType::Random(rows, rows); + VectorType v1(rows), + v2 = VectorType::Random(rows), + vzero = VectorType::Zero(rows); + + do { + m1 = MatrixType::Random(rows, cols); + } while(m1 == mzero || m1 == m2); + + do { + v1 = VectorType::Random(rows); + } while(v1 == vzero || v1 == v2); + + VERIFY_IS_APPROX( v1, v1); + VERIFY_IS_NOT_APPROX( v1, 2*v1); + VERIFY_IS_APPROX( vzero, v1-v1); + VERIFY_IS_APPROX( m1, m1); + VERIFY_IS_NOT_APPROX( m1, 2*m1); + VERIFY_IS_APPROX( mzero, m1-m1); + + VERIFY_IS_APPROX(m3 = m1,m1); + MatrixType m4; + VERIFY_IS_APPROX(m4 = m1,m1); + + m3.real() = m1.real(); + VERIFY_IS_APPROX(static_cast(m3).real(), static_cast(m1).real()); + VERIFY_IS_APPROX(static_cast(m3).real(), m1.real()); + + // check == / != operators + VERIFY(m1==m1); + VERIFY(m1!=m2); + VERIFY(!(m1==m2)); + VERIFY(!(m1!=m1)); + m1 = m2; + VERIFY(m1==m2); + VERIFY(!(m1!=m2)); + + // check linear structure + + Scalar s1; + do { + s1 = internal::random(); + } while(s1 == 0); + + VERIFY_IS_EQUAL(m1+m1, 2*m1); + VERIFY_IS_EQUAL(m1+m2-m1, m2); + VERIFY_IS_EQUAL(m1*s1, s1*m1); + VERIFY_IS_EQUAL((m1+m2)*s1, s1*m1+s1*m2); + m3 = m2; m3 += m1; + VERIFY_IS_EQUAL(m3, m1+m2); + m3 = m2; m3 -= m1; + VERIFY_IS_EQUAL(m3, m2-m1); + m3 = m2; m3 *= s1; + VERIFY_IS_EQUAL(m3, s1*m2); + + // check matrix product. + + VERIFY_IS_APPROX(identity * m1, m1); + VERIFY_IS_APPROX(square * (m1 + m2), square * m1 + square * m2); + VERIFY_IS_APPROX((m1 + m2).transpose() * square, m1.transpose() * square + m2.transpose() * square); + VERIFY_IS_APPROX((m1 * m2.transpose()) * m1, m1 * (m2.transpose() * m1)); +} + +template +void integer_types_extra() +{ + VERIFY_IS_EQUAL(int(internal::scalar_div_cost::value), 8); + VERIFY_IS_EQUAL(int(internal::scalar_div_cost::value), 8); + if(sizeof(long)>sizeof(int)) { + VERIFY(int(internal::scalar_div_cost::value) > int(internal::scalar_div_cost::value)); + VERIFY(int(internal::scalar_div_cost::value) > int(internal::scalar_div_cost::value)); + } +} + +EIGEN_DECLARE_TEST(integer_types) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( integer_type_tests(Matrix()) ); + CALL_SUBTEST_1( integer_type_tests(Matrix()) ); + + CALL_SUBTEST_2( integer_type_tests(Matrix()) ); + CALL_SUBTEST_2( signed_integer_type_tests(Matrix()) ); + + CALL_SUBTEST_3( integer_type_tests(Matrix(2, 10)) ); + CALL_SUBTEST_3( signed_integer_type_tests(Matrix(2, 10)) ); + + CALL_SUBTEST_4( integer_type_tests(Matrix()) ); + CALL_SUBTEST_4( integer_type_tests(Matrix(20, 20)) ); + + CALL_SUBTEST_5( integer_type_tests(Matrix(7, 4)) ); + CALL_SUBTEST_5( signed_integer_type_tests(Matrix(7, 4)) ); + + CALL_SUBTEST_6( integer_type_tests(Matrix()) ); + +#if EIGEN_HAS_CXX11 + CALL_SUBTEST_7( integer_type_tests(Matrix()) ); + CALL_SUBTEST_7( signed_integer_type_tests(Matrix()) ); + + CALL_SUBTEST_8( integer_type_tests(Matrix(1, 5)) ); +#endif + } + CALL_SUBTEST_9( integer_types_extra<0>() ); +} diff --git a/lib/eigen-3.4.0/test/inverse.cpp b/lib/eigen-3.4.0/test/inverse.cpp new file mode 100644 index 0000000..9cedfa1 --- /dev/null +++ b/lib/eigen-3.4.0/test/inverse.cpp @@ -0,0 +1,150 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template +void inverse_for_fixed_size(const MatrixType&, typename internal::enable_if::type* = 0) +{ +} + +template +void inverse_for_fixed_size(const MatrixType& m1, typename internal::enable_if::type* = 0) +{ + using std::abs; + + MatrixType m2, identity = MatrixType::Identity(); + + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Matrix VectorType; + + //computeInverseAndDetWithCheck tests + //First: an invertible matrix + bool invertible; + Scalar det; + + m2.setZero(); + m1.computeInverseAndDetWithCheck(m2, det, invertible); + VERIFY(invertible); + VERIFY_IS_APPROX(identity, m1*m2); + VERIFY_IS_APPROX(det, m1.determinant()); + + m2.setZero(); + m1.computeInverseWithCheck(m2, invertible); + VERIFY(invertible); + VERIFY_IS_APPROX(identity, m1*m2); + + //Second: a rank one matrix (not invertible, except for 1x1 matrices) + VectorType v3 = VectorType::Random(); + MatrixType m3 = v3*v3.transpose(), m4; + m3.computeInverseAndDetWithCheck(m4, det, invertible); + VERIFY( m1.rows()==1 ? invertible : !invertible ); + VERIFY_IS_MUCH_SMALLER_THAN(abs(det-m3.determinant()), RealScalar(1)); + m3.computeInverseWithCheck(m4, invertible); + VERIFY( m1.rows()==1 ? invertible : !invertible ); + + // check with submatrices + { + Matrix m5; + m5.setRandom(); + m5.topLeftCorner(m1.rows(),m1.rows()) = m1; + m2 = m5.template topLeftCorner().inverse(); + VERIFY_IS_APPROX( (m5.template topLeftCorner()), m2.inverse() ); + } +} + +template void inverse(const MatrixType& m) +{ + /* this test covers the following files: + Inverse.h + */ + Index rows = m.rows(); + Index cols = m.cols(); + + typedef typename MatrixType::Scalar Scalar; + + MatrixType m1(rows, cols), + m2(rows, cols), + identity = MatrixType::Identity(rows, rows); + createRandomPIMatrixOfRank(rows,rows,rows,m1); + m2 = m1.inverse(); + VERIFY_IS_APPROX(m1, m2.inverse() ); + + VERIFY_IS_APPROX((Scalar(2)*m2).inverse(), m2.inverse()*Scalar(0.5)); + + VERIFY_IS_APPROX(identity, m1.inverse() * m1 ); + VERIFY_IS_APPROX(identity, m1 * m1.inverse() ); + + VERIFY_IS_APPROX(m1, m1.inverse().inverse() ); + + // since for the general case we implement separately row-major and col-major, test that + VERIFY_IS_APPROX(MatrixType(m1.transpose().inverse()), MatrixType(m1.inverse().transpose())); + + inverse_for_fixed_size(m1); + + // check in-place inversion + if(MatrixType::RowsAtCompileTime>=2 && MatrixType::RowsAtCompileTime<=4) + { + // in-place is forbidden + VERIFY_RAISES_ASSERT(m1 = m1.inverse()); + } + else + { + m2 = m1.inverse(); + m1 = m1.inverse(); + VERIFY_IS_APPROX(m1,m2); + } +} + +template +void inverse_zerosized() +{ + Matrix A(0,0); + { + Matrix b, x; + x = A.inverse() * b; + } + { + Matrix b(0,1), x; + x = A.inverse() * b; + VERIFY_IS_EQUAL(x.rows(), 0); + VERIFY_IS_EQUAL(x.cols(), 1); + } +} + +EIGEN_DECLARE_TEST(inverse) +{ + int s = 0; + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( inverse(Matrix()) ); + CALL_SUBTEST_2( inverse(Matrix2d()) ); + CALL_SUBTEST_3( inverse(Matrix3f()) ); + CALL_SUBTEST_4( inverse(Matrix4f()) ); + CALL_SUBTEST_4( inverse(Matrix()) ); + + s = internal::random(50,320); + CALL_SUBTEST_5( inverse(MatrixXf(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + CALL_SUBTEST_5( inverse_zerosized() ); + CALL_SUBTEST_5( inverse(MatrixXf(0, 0)) ); + CALL_SUBTEST_5( inverse(MatrixXf(1, 1)) ); + + s = internal::random(25,100); + CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) + + CALL_SUBTEST_7( inverse(Matrix4d()) ); + CALL_SUBTEST_7( inverse(Matrix()) ); + + CALL_SUBTEST_8( inverse(Matrix4cd()) ); + } +} diff --git a/lib/eigen-3.4.0/test/io.cpp b/lib/eigen-3.4.0/test/io.cpp new file mode 100644 index 0000000..aa14e76 --- /dev/null +++ b/lib/eigen-3.4.0/test/io.cpp @@ -0,0 +1,71 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2019 Joel Holdsworth +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include "main.h" + +template +struct check_ostream_impl +{ + static void run() + { + const Array array(123); + std::ostringstream ss; + ss << array; + VERIFY(ss.str() == "123"); + + check_ostream_impl< std::complex >::run(); + }; +}; + +template<> +struct check_ostream_impl +{ + static void run() + { + const Array array(1, 0); + std::ostringstream ss; + ss << array; + VERIFY(ss.str() == "1 0"); + }; +}; + +template +struct check_ostream_impl< std::complex > +{ + static void run() + { + const Array,1,1> array(std::complex(12, 34)); + std::ostringstream ss; + ss << array; + VERIFY(ss.str() == "(12,34)"); + }; +}; + +template +static void check_ostream() +{ + check_ostream_impl::run(); +} + +EIGEN_DECLARE_TEST(rand) +{ + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); + CALL_SUBTEST(check_ostream()); +} diff --git a/lib/eigen-3.4.0/test/is_same_dense.cpp b/lib/eigen-3.4.0/test/is_same_dense.cpp new file mode 100644 index 0000000..23dd806 --- /dev/null +++ b/lib/eigen-3.4.0/test/is_same_dense.cpp @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +using internal::is_same_dense; + +EIGEN_DECLARE_TEST(is_same_dense) +{ + typedef Matrix ColMatrixXd; + typedef Matrix,Dynamic,Dynamic,ColMajor> ColMatrixXcd; + ColMatrixXd m1(10,10); + ColMatrixXcd m2(10,10); + Ref ref_m1(m1); + Ref > ref_m2_real(m2.real()); + Ref const_ref_m1(m1); + + VERIFY(is_same_dense(m1,m1)); + VERIFY(is_same_dense(m1,ref_m1)); + VERIFY(is_same_dense(const_ref_m1,m1)); + VERIFY(is_same_dense(const_ref_m1,ref_m1)); + + VERIFY(is_same_dense(m1.block(0,0,m1.rows(),m1.cols()),m1)); + VERIFY(!is_same_dense(m1.row(0),m1.col(0))); + + Ref const_ref_m1_row(m1.row(1)); + VERIFY(!is_same_dense(m1.row(1),const_ref_m1_row)); + + Ref const_ref_m1_col(m1.col(1)); + VERIFY(is_same_dense(m1.col(1),const_ref_m1_col)); + + + VERIFY(!is_same_dense(m1, ref_m2_real)); + VERIFY(!is_same_dense(m2, ref_m2_real)); +} diff --git a/lib/eigen-3.4.0/test/jacobi.cpp b/lib/eigen-3.4.0/test/jacobi.cpp new file mode 100644 index 0000000..5604797 --- /dev/null +++ b/lib/eigen-3.4.0/test/jacobi.cpp @@ -0,0 +1,80 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template +void jacobi(const MatrixType& m = MatrixType()) +{ + Index rows = m.rows(); + Index cols = m.cols(); + + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime + }; + + typedef Matrix JacobiVector; + + const MatrixType a(MatrixType::Random(rows, cols)); + + JacobiVector v = JacobiVector::Random().normalized(); + JacobiScalar c = v.x(), s = v.y(); + JacobiRotation rot(c, s); + + { + Index p = internal::random(0, rows-1); + Index q; + do { + q = internal::random(0, rows-1); + } while (q == p); + + MatrixType b = a; + b.applyOnTheLeft(p, q, rot); + VERIFY_IS_APPROX(b.row(p), c * a.row(p) + numext::conj(s) * a.row(q)); + VERIFY_IS_APPROX(b.row(q), -s * a.row(p) + numext::conj(c) * a.row(q)); + } + + { + Index p = internal::random(0, cols-1); + Index q; + do { + q = internal::random(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), numext::conj(s) * a.col(p) + numext::conj(c) * a.col(q)); + } +} + +EIGEN_DECLARE_TEST(jacobi) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(( jacobi() )); + CALL_SUBTEST_2(( jacobi() )); + CALL_SUBTEST_3(( jacobi() )); + CALL_SUBTEST_3(( jacobi >() )); + + int r = internal::random(2, internal::random(1,EIGEN_TEST_MAX_SIZE)/2), + c = internal::random(2, internal::random(1,EIGEN_TEST_MAX_SIZE)/2); + CALL_SUBTEST_4(( jacobi(MatrixXf(r,c)) )); + CALL_SUBTEST_5(( jacobi(MatrixXcd(r,c)) )); + CALL_SUBTEST_5(( jacobi >(MatrixXcd(r,c)) )); + // complex is really important to test as it is the only way to cover conjugation issues in certain unaligned paths + CALL_SUBTEST_6(( jacobi(MatrixXcf(r,c)) )); + CALL_SUBTEST_6(( jacobi >(MatrixXcf(r,c)) )); + + TEST_SET_BUT_UNUSED_VARIABLE(r); + TEST_SET_BUT_UNUSED_VARIABLE(c); + } +} diff --git a/lib/eigen-3.4.0/test/jacobisvd.cpp b/lib/eigen-3.4.0/test/jacobisvd.cpp new file mode 100644 index 0000000..5b15c5a --- /dev/null +++ b/lib/eigen-3.4.0/test/jacobisvd.cpp @@ -0,0 +1,147 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// discard stack allocation as that too bypasses malloc +#define EIGEN_STACK_ALLOCATION_LIMIT 0 +#define EIGEN_RUNTIME_NO_MALLOC +#include "main.h" +#include + +#define SVD_DEFAULT(M) JacobiSVD +#define SVD_FOR_MIN_NORM(M) JacobiSVD +#include "svd_common.h" + +// Check all variants of JacobiSVD +template +void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true) +{ + MatrixType m = a; + if(pickrandom) + svd_fill_random(m); + + CALL_SUBTEST(( svd_test_all_computation_options >(m, true) )); // check full only + CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); + CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); + if(m.rows()==m.cols()) + CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); +} + +template void jacobisvd_verify_assert(const MatrixType& m) +{ + svd_verify_assert >(m); + svd_verify_assert >(m, true); + svd_verify_assert >(m); + svd_verify_assert >(m); + Index rows = m.rows(); + Index cols = m.cols(); + + enum { + ColsAtCompileTime = MatrixType::ColsAtCompileTime + }; + + + MatrixType a = MatrixType::Zero(rows, cols); + a.setZero(); + + if (ColsAtCompileTime == Dynamic) + { + JacobiSVD 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)) + } +} + +template +void jacobisvd_method() +{ + enum { Size = MatrixType::RowsAtCompileTime }; + typedef typename MatrixType::RealScalar RealScalar; + typedef Matrix 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); + VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); + VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); +} + +namespace Foo { +// older compiler require a default constructor for Bar +// cf: https://stackoverflow.com/questions/7411515/ +class Bar {public: Bar() {}}; +bool operator<(const Bar&, const Bar&) { return true; } +} +// regression test for a very strange MSVC issue for which simply +// including SVDBase.h messes up with std::max and custom scalar type +void msvc_workaround() +{ + const Foo::Bar a; + const Foo::Bar b; + std::max EIGEN_NOT_A_MACRO (a,b); +} + +EIGEN_DECLARE_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)) )); + + CALL_SUBTEST_11(svd_all_trivial_2x2(jacobisvd)); + CALL_SUBTEST_12(svd_all_trivial_2x2(jacobisvd)); + + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_3(( jacobisvd() )); + CALL_SUBTEST_4(( jacobisvd() )); + CALL_SUBTEST_5(( jacobisvd >() )); + CALL_SUBTEST_6(( jacobisvd >(Matrix(10,2)) )); + + int r = internal::random(1, 30), + c = internal::random(1, 30); + + TEST_SET_BUT_UNUSED_VARIABLE(r) + TEST_SET_BUT_UNUSED_VARIABLE(c) + + CALL_SUBTEST_10(( jacobisvd(MatrixXd(r,c)) )); + CALL_SUBTEST_7(( jacobisvd(MatrixXf(r,c)) )); + CALL_SUBTEST_8(( jacobisvd(MatrixXcd(r,c)) )); + (void) r; + (void) c; + + // Test on inf/nan matrix + CALL_SUBTEST_7( (svd_inf_nan, MatrixXf>()) ); + CALL_SUBTEST_10( (svd_inf_nan, MatrixXd>()) ); + + // bug1395 test compile-time vectors as input + CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix()) )); + CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix()) )); + CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix(r)) )); + CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix(c)) )); + } + + CALL_SUBTEST_7(( jacobisvd(MatrixXf(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); + CALL_SUBTEST_8(( jacobisvd(MatrixXcd(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3))) )); + + // test matrixbase method + CALL_SUBTEST_1(( jacobisvd_method() )); + CALL_SUBTEST_3(( jacobisvd_method() )); + + // Test problem size constructors + CALL_SUBTEST_7( JacobiSVD(10,10) ); + + // Check that preallocation avoids subsequent mallocs + CALL_SUBTEST_9( svd_preallocate() ); + + CALL_SUBTEST_2( svd_underoverflow() ); + + msvc_workaround(); +} diff --git a/lib/eigen-3.4.0/test/klu_support.cpp b/lib/eigen-3.4.0/test/klu_support.cpp new file mode 100644 index 0000000..f806ad5 --- /dev/null +++ b/lib/eigen-3.4.0/test/klu_support.cpp @@ -0,0 +1,32 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS +#include "sparse_solver.h" + +#include + +template void test_klu_support_T() +{ + KLU > klu_colmajor; + KLU > klu_rowmajor; + + check_sparse_square_solving(klu_colmajor); + check_sparse_square_solving(klu_rowmajor); + + //check_sparse_square_determinant(umfpack_colmajor); + //check_sparse_square_determinant(umfpack_rowmajor); +} + +EIGEN_DECLARE_TEST(klu_support) +{ + CALL_SUBTEST_1(test_klu_support_T()); + CALL_SUBTEST_2(test_klu_support_T >()); +} + diff --git a/lib/eigen-3.4.0/test/linearstructure.cpp b/lib/eigen-3.4.0/test/linearstructure.cpp new file mode 100644 index 0000000..46ee516 --- /dev/null +++ b/lib/eigen-3.4.0/test/linearstructure.cpp @@ -0,0 +1,147 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +static bool g_called; +#define EIGEN_SCALAR_BINARY_OP_PLUGIN { g_called |= (!internal::is_same::value); } + +#include "main.h" + +template void linearStructure(const MatrixType& m) +{ + using std::abs; + /* this test covers the following files: + CwiseUnaryOp.h, CwiseBinaryOp.h, SelfCwiseBinaryOp.h + */ + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + // this test relies a lot on Random.h, and there's not much more that we can do + // to test it, hence I consider that we will have tested Random.h + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols); + + Scalar s1 = internal::random(); + while (abs(s1)(); + + Index r = internal::random(0, rows-1), + c = internal::random(0, cols-1); + + VERIFY_IS_APPROX(-(-m1), m1); + VERIFY_IS_APPROX(m1+m1, 2*m1); + VERIFY_IS_APPROX(m1+m2-m1, m2); + VERIFY_IS_APPROX(-m2+m1+m2, m1); + VERIFY_IS_APPROX(m1*s1, s1*m1); + VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2); + VERIFY_IS_APPROX((-m1+m2)*s1, -s1*m1+s1*m2); + m3 = m2; m3 += m1; + VERIFY_IS_APPROX(m3, m1+m2); + m3 = m2; m3 -= m1; + VERIFY_IS_APPROX(m3, m2-m1); + m3 = m2; m3 *= s1; + VERIFY_IS_APPROX(m3, s1*m2); + if(!NumTraits::IsInteger) + { + m3 = m2; m3 /= s1; + VERIFY_IS_APPROX(m3, m2/s1); + } + + // again, test operator() to check const-qualification + VERIFY_IS_APPROX((-m1)(r,c), -(m1(r,c))); + VERIFY_IS_APPROX((m1-m2)(r,c), (m1(r,c))-(m2(r,c))); + VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c))); + VERIFY_IS_APPROX((s1*m1)(r,c), s1*(m1(r,c))); + VERIFY_IS_APPROX((m1*s1)(r,c), (m1(r,c))*s1); + if(!NumTraits::IsInteger) + VERIFY_IS_APPROX((m1/s1)(r,c), (m1(r,c))/s1); + + // use .block to disable vectorization and compare to the vectorized version + VERIFY_IS_APPROX(m1+m1.block(0,0,rows,cols), m1+m1); + VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), m1.cwiseProduct(m1)); + VERIFY_IS_APPROX(m1 - m1.block(0,0,rows,cols), m1 - m1); + VERIFY_IS_APPROX(m1.block(0,0,rows,cols) * s1, m1 * s1); +} + +// Make sure that complex * real and real * complex are properly optimized +template void real_complex(DenseIndex rows = MatrixType::RowsAtCompileTime, DenseIndex cols = MatrixType::ColsAtCompileTime) +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + RealScalar s = internal::random(); + MatrixType m1 = MatrixType::Random(rows, cols); + + g_called = false; + VERIFY_IS_APPROX(s*m1, Scalar(s)*m1); + VERIFY(g_called && "real * matrix not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(m1*s, m1*Scalar(s)); + VERIFY(g_called && "matrix * real not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(m1/s, m1/Scalar(s)); + VERIFY(g_called && "matrix / real not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(s+m1.array(), Scalar(s)+m1.array()); + VERIFY(g_called && "real + matrix not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(m1.array()+s, m1.array()+Scalar(s)); + VERIFY(g_called && "matrix + real not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(s-m1.array(), Scalar(s)-m1.array()); + VERIFY(g_called && "real - matrix not properly optimized"); + + g_called = false; + VERIFY_IS_APPROX(m1.array()-s, m1.array()-Scalar(s)); + VERIFY(g_called && "matrix - real not properly optimized"); +} + +template +void linearstructure_overflow() +{ + // make sure that /=scalar and /scalar do not overflow + // rational: 1.0/4.94e-320 overflow, but m/4.94e-320 should not + Matrix4d m2, m3; + m3 = m2 = Matrix4d::Random()*1e-20; + m2 = m2 / 4.9e-320; + VERIFY_IS_APPROX(m2.cwiseQuotient(m2), Matrix4d::Ones()); + m3 /= 4.9e-320; + VERIFY_IS_APPROX(m3.cwiseQuotient(m3), Matrix4d::Ones()); +} + +EIGEN_DECLARE_TEST(linearstructure) +{ + g_called = true; + VERIFY(g_called); // avoid `unneeded-internal-declaration` warning. + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( linearStructure(Matrix()) ); + CALL_SUBTEST_2( linearStructure(Matrix2f()) ); + CALL_SUBTEST_3( linearStructure(Vector3d()) ); + CALL_SUBTEST_4( linearStructure(Matrix4d()) ); + CALL_SUBTEST_5( linearStructure(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); + CALL_SUBTEST_6( linearStructure(MatrixXf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_7( linearStructure(MatrixXi (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_8( linearStructure(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); + CALL_SUBTEST_9( linearStructure(ArrayXXf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_10( linearStructure(ArrayXXcf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); + + CALL_SUBTEST_11( real_complex() ); + CALL_SUBTEST_11( real_complex(10,10) ); + CALL_SUBTEST_11( real_complex(10,10) ); + } + CALL_SUBTEST_4( linearstructure_overflow<0>() ); +} diff --git a/lib/eigen-3.4.0/test/lscg.cpp b/lib/eigen-3.4.0/test/lscg.cpp new file mode 100644 index 0000000..feb2347 --- /dev/null +++ b/lib/eigen-3.4.0/test/lscg.cpp @@ -0,0 +1,37 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "sparse_solver.h" +#include + +template void test_lscg_T() +{ + LeastSquaresConjugateGradient > lscg_colmajor_diag; + LeastSquaresConjugateGradient, IdentityPreconditioner> lscg_colmajor_I; + LeastSquaresConjugateGradient > lscg_rowmajor_diag; + LeastSquaresConjugateGradient, IdentityPreconditioner> lscg_rowmajor_I; + + CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_diag) ); + CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_I) ); + + CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_diag) ); + CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_I) ); + + CALL_SUBTEST( check_sparse_square_solving(lscg_rowmajor_diag) ); + CALL_SUBTEST( check_sparse_square_solving(lscg_rowmajor_I) ); + + CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_rowmajor_diag) ); + CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_rowmajor_I) ); +} + +EIGEN_DECLARE_TEST(lscg) +{ + CALL_SUBTEST_1(test_lscg_T()); + CALL_SUBTEST_2(test_lscg_T >()); +} diff --git a/lib/eigen-3.4.0/test/lu.cpp b/lib/eigen-3.4.0/test/lu.cpp new file mode 100644 index 0000000..1bbadcb --- /dev/null +++ b/lib/eigen-3.4.0/test/lu.cpp @@ -0,0 +1,252 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include +#include "solverbase.h" +using namespace std; + +template +typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { + return m.cwiseAbs().colwise().sum().maxCoeff(); +} + +template void lu_non_invertible() +{ + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + + typedef typename MatrixType::RealScalar RealScalar; + /* this test covers the following files: + LU.h + */ + Index rows, cols, cols2; + if(MatrixType::RowsAtCompileTime==Dynamic) + { + rows = internal::random(2,EIGEN_TEST_MAX_SIZE); + } + else + { + rows = MatrixType::RowsAtCompileTime; + } + if(MatrixType::ColsAtCompileTime==Dynamic) + { + cols = internal::random(2,EIGEN_TEST_MAX_SIZE); + cols2 = internal::random(2,EIGEN_TEST_MAX_SIZE); + } + else + { + cols2 = cols = MatrixType::ColsAtCompileTime; + } + + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime + }; + typedef typename internal::kernel_retval_base >::ReturnType KernelMatrixType; + typedef typename internal::image_retval_base >::ReturnType ImageMatrixType; + typedef Matrix + CMatrixType; + typedef Matrix + RMatrixType; + + Index rank = internal::random(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)); + + // The kernel of the zero matrix is the entire space, and thus is an invertible matrix of dimensions cols. + KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel(); + VERIFY((kernel.fullPivLu().isInvertible())); + + MatrixType m1(rows, cols), m3(rows, cols2); + CMatrixType m2(cols, cols2); + createRandomPIMatrixOfRank(rank, rows, cols, m1); + + FullPivLU lu; + + // The special value 0.01 below works well in tests. Keep in mind that we're only computing the rank + // of singular values are either 0 or 1. + // So it's not clear at all that the epsilon should play any role there. + lu.setThreshold(RealScalar(0.01)); + lu.compute(m1); + + MatrixType u(rows,cols); + u = lu.matrixLU().template triangularView(); + RMatrixType l = RMatrixType::Identity(rows,rows); + l.block(0,0,rows,(std::min)(rows,cols)).template triangularView() + = lu.matrixLU().block(0,0,rows,(std::min)(rows,cols)); + + VERIFY_IS_APPROX(lu.permutationP() * m1 * lu.permutationQ(), l*u); + + KernelMatrixType m1kernel = lu.kernel(); + ImageMatrixType m1image = lu.image(m1); + + VERIFY_IS_APPROX(m1, lu.reconstructedMatrix()); + VERIFY(rank == lu.rank()); + VERIFY(cols - lu.rank() == lu.dimensionOfKernel()); + VERIFY(!lu.isInjective()); + VERIFY(!lu.isInvertible()); + VERIFY(!lu.isSurjective()); + VERIFY_IS_MUCH_SMALLER_THAN((m1 * m1kernel), m1); + VERIFY(m1image.fullPivLu().rank() == rank); + VERIFY_IS_APPROX(m1 * m1.adjoint() * m1image, m1image); + + check_solverbase(m1, lu, rows, cols, cols2); + + m2 = CMatrixType::Random(cols,cols2); + m3 = m1*m2; + m2 = CMatrixType::Random(cols,cols2); + // test that the code, which does resize(), may be applied to an xpr + m2.block(0,0,m2.rows(),m2.cols()) = lu.solve(m3); + VERIFY_IS_APPROX(m3, m1*m2); +} + +template void lu_invertible() +{ + /* this test covers the following files: + FullPivLU.h + */ + typedef typename NumTraits::Real RealScalar; + Index size = MatrixType::RowsAtCompileTime; + if( size==Dynamic) + size = internal::random(1,EIGEN_TEST_MAX_SIZE); + + MatrixType m1(size, size), m2(size, size), m3(size, size); + FullPivLU lu; + lu.setThreshold(RealScalar(0.01)); + do { + m1 = MatrixType::Random(size,size); + lu.compute(m1); + } while(!lu.isInvertible()); + + VERIFY_IS_APPROX(m1, lu.reconstructedMatrix()); + VERIFY(0 == lu.dimensionOfKernel()); + VERIFY(lu.kernel().cols() == 1); // the kernel() should consist of a single (zero) column vector + VERIFY(size == lu.rank()); + VERIFY(lu.isInjective()); + VERIFY(lu.isSurjective()); + VERIFY(lu.isInvertible()); + VERIFY(lu.image(m1).fullPivLu().isInvertible()); + + check_solverbase(m1, lu, size, size, size); + + MatrixType m1_inverse = lu.inverse(); + m3 = MatrixType::Random(size,size); + m2 = lu.solve(m3); + VERIFY_IS_APPROX(m2, m1_inverse*m3); + + RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse); + const RealScalar rcond_est = lu.rcond(); + // Verify that the estimated condition number is within a factor of 10 of the + // truth. + VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); + + // Regression test for Bug 302 + MatrixType m4 = MatrixType::Random(size,size); + VERIFY_IS_APPROX(lu.solve(m3*m4), lu.solve(m3)*m4); +} + +template void lu_partial_piv(Index size = MatrixType::ColsAtCompileTime) +{ + /* this test covers the following files: + PartialPivLU.h + */ + typedef typename NumTraits::Real RealScalar; + + MatrixType m1(size, size), m2(size, size), m3(size, size); + m1.setRandom(); + PartialPivLU plu(m1); + + STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); + + VERIFY_IS_APPROX(m1, plu.reconstructedMatrix()); + + check_solverbase(m1, plu, size, size, size); + + MatrixType m1_inverse = plu.inverse(); + m3 = MatrixType::Random(size,size); + m2 = plu.solve(m3); + VERIFY_IS_APPROX(m2, m1_inverse*m3); + + RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse); + const RealScalar rcond_est = plu.rcond(); + // Verify that the estimate is within a factor of 10 of the truth. + VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); +} + +template void lu_verify_assert() +{ + MatrixType tmp; + + FullPivLU lu; + VERIFY_RAISES_ASSERT(lu.matrixLU()) + VERIFY_RAISES_ASSERT(lu.permutationP()) + VERIFY_RAISES_ASSERT(lu.permutationQ()) + VERIFY_RAISES_ASSERT(lu.kernel()) + VERIFY_RAISES_ASSERT(lu.image(tmp)) + VERIFY_RAISES_ASSERT(lu.solve(tmp)) + VERIFY_RAISES_ASSERT(lu.transpose().solve(tmp)) + VERIFY_RAISES_ASSERT(lu.adjoint().solve(tmp)) + VERIFY_RAISES_ASSERT(lu.determinant()) + VERIFY_RAISES_ASSERT(lu.rank()) + VERIFY_RAISES_ASSERT(lu.dimensionOfKernel()) + VERIFY_RAISES_ASSERT(lu.isInjective()) + VERIFY_RAISES_ASSERT(lu.isSurjective()) + VERIFY_RAISES_ASSERT(lu.isInvertible()) + VERIFY_RAISES_ASSERT(lu.inverse()) + + PartialPivLU plu; + VERIFY_RAISES_ASSERT(plu.matrixLU()) + VERIFY_RAISES_ASSERT(plu.permutationP()) + VERIFY_RAISES_ASSERT(plu.solve(tmp)) + VERIFY_RAISES_ASSERT(plu.transpose().solve(tmp)) + VERIFY_RAISES_ASSERT(plu.adjoint().solve(tmp)) + VERIFY_RAISES_ASSERT(plu.determinant()) + VERIFY_RAISES_ASSERT(plu.inverse()) +} + +EIGEN_DECLARE_TEST(lu) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( lu_non_invertible() ); + CALL_SUBTEST_1( lu_invertible() ); + CALL_SUBTEST_1( lu_verify_assert() ); + CALL_SUBTEST_1( lu_partial_piv() ); + + CALL_SUBTEST_2( (lu_non_invertible >()) ); + CALL_SUBTEST_2( (lu_verify_assert >()) ); + CALL_SUBTEST_2( lu_partial_piv() ); + CALL_SUBTEST_2( lu_partial_piv() ); + CALL_SUBTEST_2( (lu_partial_piv >()) ); + + CALL_SUBTEST_3( lu_non_invertible() ); + CALL_SUBTEST_3( lu_invertible() ); + CALL_SUBTEST_3( lu_verify_assert() ); + + CALL_SUBTEST_4( lu_non_invertible() ); + CALL_SUBTEST_4( lu_invertible() ); + CALL_SUBTEST_4( lu_partial_piv(internal::random(1,EIGEN_TEST_MAX_SIZE)) ); + CALL_SUBTEST_4( lu_verify_assert() ); + + CALL_SUBTEST_5( lu_non_invertible() ); + CALL_SUBTEST_5( lu_invertible() ); + CALL_SUBTEST_5( lu_verify_assert() ); + + CALL_SUBTEST_6( lu_non_invertible() ); + CALL_SUBTEST_6( lu_invertible() ); + CALL_SUBTEST_6( lu_partial_piv(internal::random(1,EIGEN_TEST_MAX_SIZE)) ); + CALL_SUBTEST_6( lu_verify_assert() ); + + CALL_SUBTEST_7(( lu_non_invertible >() )); + + // Test problem size constructors + CALL_SUBTEST_9( PartialPivLU(10) ); + CALL_SUBTEST_9( FullPivLU(10, 20); ); + } +} diff --git a/lib/eigen-3.4.0/test/main.h b/lib/eigen-3.4.0/test/main.h new file mode 100644 index 0000000..07f3794 --- /dev/null +++ b/lib/eigen-3.4.0/test/main.h @@ -0,0 +1,857 @@ + +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// The following includes of STL headers have to be done _before_ the +// definition of macros min() and max(). The reason is that many STL +// implementations will not work properly as the min and max symbols collide +// with the STL functions std:min() and std::max(). The STL headers may check +// for the macro definition of min/max and issue a warning or undefine the +// macros. +// +// Still, Windows defines min() and max() in windef.h as part of the regular +// Windows system interfaces and many other Windows APIs depend on these +// macros being available. To prevent the macro expansion of min/max and to +// make Eigen compatible with the Windows environment all function calls of +// std::min() and std::max() have to be written with parenthesis around the +// function name. +// +// All STL headers used by Eigen should be included here. Because main.h is +// included before any Eigen header and because the STL headers are guarded +// against multiple inclusions, no STL header will see our own min/max macro +// definitions. +#include +#include +// Disable ICC's std::complex operator specializations so we can use our own. +#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 +#include +#include +#include +#include +#include +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#include +#include +#ifdef EIGEN_USE_THREADS +#include +#endif +#endif + +// Same for cuda_fp16.h +#if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA) + // Means the compiler is either nvcc or clang with CUDA enabled + #define EIGEN_CUDACC __CUDACC__ +#endif +#if defined(EIGEN_CUDACC) +#include + #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10) +#else + #define EIGEN_CUDA_SDK_VER 0 +#endif +#if EIGEN_CUDA_SDK_VER >= 70500 +#include +#endif + +// To test that all calls from Eigen code to std::min() and std::max() are +// protected by parenthesis against macro expansion, the min()/max() macros +// are defined here and any not-parenthesized min/max call will cause a +// compiler error. +#if !defined(__HIPCC__) && !defined(EIGEN_USE_SYCL) + // + // HIP header files include the following files + // + // + // + // which seem to contain not-parenthesized calls to "max"/"min", triggering the following check and causing the compile to fail + // + // Including those header files before the following macro definition for "min" / "max", only partially resolves the issue + // This is because other HIP header files also define "isnan" / "isinf" / "isfinite" functions, which are needed in other + // headers. + // + // So instead choosing to simply disable this check for HIP + // + #define min(A,B) please_protect_your_min_with_parentheses + #define max(A,B) please_protect_your_max_with_parentheses + #define isnan(X) please_protect_your_isnan_with_parentheses + #define isinf(X) please_protect_your_isinf_with_parentheses + #define isfinite(X) please_protect_your_isfinite_with_parentheses +#endif + + +// test possible conflicts +struct real {}; +struct imag {}; + +#ifdef M_PI +#undef M_PI +#endif +#define M_PI please_use_EIGEN_PI_instead_of_M_PI + +#define FORBIDDEN_IDENTIFIER (this_identifier_is_forbidden_to_avoid_clashes) this_identifier_is_forbidden_to_avoid_clashes +// B0 is defined in POSIX header termios.h +#define B0 FORBIDDEN_IDENTIFIER +// `I` may be defined by complex.h: +#define I FORBIDDEN_IDENTIFIER + +// Unit tests calling Eigen's blas library must preserve the default blocking size +// to avoid troubles. +#ifndef EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS +#define EIGEN_DEBUG_SMALL_PRODUCT_BLOCKS +#endif + +// shuts down ICC's remark #593: variable "XXX" was set but never used +#define TEST_SET_BUT_UNUSED_VARIABLE(X) EIGEN_UNUSED_VARIABLE(X) + +#ifdef TEST_ENABLE_TEMPORARY_TRACKING + +static long int nb_temporaries; +static long int nb_temporaries_on_assert = -1; + +inline void on_temporary_creation(long int size) { + // here's a great place to set a breakpoint when debugging failures in this test! + if(size!=0) nb_temporaries++; + if(nb_temporaries_on_assert>0) assert(nb_temporaries if NDEBUG is not defined. +#ifndef DEBUG +#define DEBUG +#endif + +// bounds integer values for AltiVec +#if defined(__ALTIVEC__) || defined(__VSX__) +#define EIGEN_MAKING_DOCS +#endif + +#define DEFAULT_REPEAT 10 + +namespace Eigen +{ + static std::vector g_test_stack; + // level == 0 <=> abort if test fail + // level >= 1 <=> warning message to std::cerr if test fail + static int g_test_level = 0; + static int g_repeat = 1; + static unsigned int g_seed = 0; + static bool g_has_set_repeat = false, g_has_set_seed = false; + + class EigenTest + { + public: + EigenTest() : m_func(0) {} + EigenTest(const char* a_name, void (*func)(void)) + : m_name(a_name), m_func(func) + { + get_registered_tests().push_back(this); + } + const std::string& name() const { return m_name; } + void operator()() const { m_func(); } + + static const std::vector& all() { return get_registered_tests(); } + protected: + static std::vector& get_registered_tests() + { + static std::vector* ms_registered_tests = new std::vector(); + return *ms_registered_tests; + } + std::string m_name; + void (*m_func)(void); + }; + + // Declare and register a test, e.g.: + // EIGEN_DECLARE_TEST(mytest) { ... } + // will create a function: + // void test_mytest() { ... } + // that will be automatically called. + #define EIGEN_DECLARE_TEST(X) \ + void EIGEN_CAT(test_,X) (); \ + static EigenTest EIGEN_CAT(test_handler_,X) (EIGEN_MAKESTRING(X), & EIGEN_CAT(test_,X)); \ + void EIGEN_CAT(test_,X) () +} + +#define TRACK std::cerr << __FILE__ << " " << __LINE__ << std::endl +// #define TRACK while() + +#define EIGEN_DEFAULT_IO_FORMAT IOFormat(4, 0, " ", "\n", "", "", "", "") + +#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__) && !defined(__SYCL_DEVICE_ONLY__) + #define EIGEN_EXCEPTIONS +#endif + +#ifndef EIGEN_NO_ASSERTION_CHECKING + + namespace Eigen + { + static const bool should_raise_an_assert = false; + + // Used to avoid to raise two exceptions at a time in which + // case the exception is not properly caught. + // This may happen when a second exceptions is triggered in a destructor. + static bool no_more_assert = false; + static bool report_on_cerr_on_assert_failure = true; + + struct eigen_assert_exception + { + eigen_assert_exception(void) {} + ~eigen_assert_exception() { Eigen::no_more_assert = false; } + }; + + struct eigen_static_assert_exception + { + eigen_static_assert_exception(void) {} + ~eigen_static_assert_exception() { Eigen::no_more_assert = false; } + }; + } + // If EIGEN_DEBUG_ASSERTS is defined and if no assertion is triggered while + // one should have been, then the list of executed assertions is printed out. + // + // EIGEN_DEBUG_ASSERTS is not enabled by default as it + // significantly increases the compilation time + // and might even introduce side effects that would hide + // some memory errors. + #ifdef EIGEN_DEBUG_ASSERTS + + namespace Eigen + { + namespace internal + { + static bool push_assert = false; + } + static std::vector eigen_assert_list; + } + #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; \ + EIGEN_THROW_X(Eigen::eigen_assert_exception()); \ + } \ + else if (Eigen::internal::push_assert) \ + { \ + eigen_assert_list.push_back(std::string(EIGEN_MAKESTRING(__FILE__) " (" EIGEN_MAKESTRING(__LINE__) ") : " #a) ); \ + } + + #ifdef EIGEN_EXCEPTIONS + #define VERIFY_RAISES_ASSERT(a) \ + { \ + Eigen::no_more_assert = false; \ + 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 // required for createRandomPIMatrixOfRank + +inline void verify_impl(bool condition, const char *testname, const char *file, int line, const char *condition_as_string) +{ + if (!condition) + { + if(Eigen::g_test_level>0) + std::cerr << "WARNING: "; + std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" + << std::endl << " " << condition_as_string << std::endl; + std::cerr << "Stack:\n"; + const int test_stack_size = static_cast(Eigen::g_test_stack.size()); + for(int i=test_stack_size-1; i>=0; --i) + std::cerr << " - " << Eigen::g_test_stack[i] << "\n"; + std::cerr << "\n"; + if(Eigen::g_test_level==0) + abort(); + } +} + +#define VERIFY(a) ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a)) + +#define VERIFY_GE(a, b) ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a >= b)) +#define VERIFY_LE(a, b) ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a <= b)) + + +#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b, true)) +#define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(test_is_equal(a, b, false)) +#define VERIFY_IS_APPROX(a, b) VERIFY(verifyIsApprox(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)) + +#define STATIC_CHECK(COND) EIGEN_STATIC_ASSERT( (COND) , EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT ) + +#define CALL_SUBTEST(FUNC) do { \ + g_test_stack.push_back(EIGEN_MAKESTRING(FUNC)); \ + FUNC; \ + g_test_stack.pop_back(); \ + } while (0) + + +namespace Eigen { + +template +typename internal::enable_if::value,bool>::type +is_same_type(const T1&, const T2&) +{ + return true; +} + +template inline typename NumTraits::Real test_precision() { return NumTraits::dummy_precision(); } +template<> inline float test_precision() { return 1e-3f; } +template<> inline double test_precision() { return 1e-6; } +template<> inline long double test_precision() { return 1e-6l; } +template<> inline float test_precision >() { return test_precision(); } +template<> inline double test_precision >() { return test_precision(); } +template<> inline long double test_precision >() { return test_precision(); } + +#define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE) \ + inline bool test_isApprox(TYPE a, TYPE b) \ + { return internal::isApprox(a, b, test_precision()); } \ + inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \ + { return internal::isMuchSmallerThan(a, b, test_precision()); } \ + inline bool test_isApproxOrLessThan(TYPE a, TYPE b) \ + { return internal::isApproxOrLessThan(a, b, test_precision()); } + +EIGEN_TEST_SCALAR_TEST_OVERLOAD(short) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned short) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(int) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned int) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(long) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long) +#if EIGEN_HAS_CXX11 +EIGEN_TEST_SCALAR_TEST_OVERLOAD(long long) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long long) +#endif +EIGEN_TEST_SCALAR_TEST_OVERLOAD(float) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(double) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(half) +EIGEN_TEST_SCALAR_TEST_OVERLOAD(bfloat16) + +#undef EIGEN_TEST_SCALAR_TEST_OVERLOAD + +#ifndef EIGEN_TEST_NO_COMPLEX +inline bool test_isApprox(const std::complex& a, const std::complex& b) +{ return internal::isApprox(a, b, test_precision >()); } +inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) +{ return internal::isMuchSmallerThan(a, b, test_precision >()); } + +inline bool test_isApprox(const std::complex& a, const std::complex& b) +{ return internal::isApprox(a, b, test_precision >()); } +inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) +{ return internal::isMuchSmallerThan(a, b, test_precision >()); } + +#ifndef EIGEN_TEST_NO_LONGDOUBLE +inline bool test_isApprox(const std::complex& a, const std::complex& b) +{ return internal::isApprox(a, b, test_precision >()); } +inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) +{ return internal::isMuchSmallerThan(a, b, test_precision >()); } +#endif +#endif + +#ifndef EIGEN_TEST_NO_LONGDOUBLE +inline bool test_isApprox(const long double& a, const long double& b) +{ + bool ret = internal::isApprox(a, b, test_precision()); + if (!ret) std::cerr + << std::endl << " actual = " << a + << std::endl << " expected = " << b << std::endl << std::endl; + return ret; +} + +inline bool test_isMuchSmallerThan(const long double& a, const long double& b) +{ return internal::isMuchSmallerThan(a, b, test_precision()); } +inline bool test_isApproxOrLessThan(const long double& a, const long double& b) +{ return internal::isApproxOrLessThan(a, b, test_precision()); } +#endif // EIGEN_TEST_NO_LONGDOUBLE + +// test_relative_error returns the relative difference between a and b as a real scalar as used in isApprox. +template +typename NumTraits::NonInteger test_relative_error(const EigenBase &a, const EigenBase &b) +{ + using std::sqrt; + typedef typename NumTraits::NonInteger RealScalar; + typename internal::nested_eval::type ea(a.derived()); + typename internal::nested_eval::type eb(b.derived()); + return sqrt(RealScalar((ea-eb).cwiseAbs2().sum()) / RealScalar((std::min)(eb.cwiseAbs2().sum(),ea.cwiseAbs2().sum()))); +} + +template +typename T1::RealScalar test_relative_error(const T1 &a, const T2 &b, const typename T1::Coefficients* = 0) +{ + return test_relative_error(a.coeffs(), b.coeffs()); +} + +template +typename T1::Scalar test_relative_error(const T1 &a, const T2 &b, const typename T1::MatrixType* = 0) +{ + return test_relative_error(a.matrix(), b.matrix()); +} + +template +S test_relative_error(const Translation &a, const Translation &b) +{ + return test_relative_error(a.vector(), b.vector()); +} + +template +S test_relative_error(const ParametrizedLine &a, const ParametrizedLine &b) +{ + return (std::max)(test_relative_error(a.origin(), b.origin()), test_relative_error(a.origin(), b.origin())); +} + +template +S test_relative_error(const AlignedBox &a, const AlignedBox &b) +{ + return (std::max)(test_relative_error((a.min)(), (b.min)()), test_relative_error((a.max)(), (b.max)())); +} + +template class SparseMatrixBase; +template +typename T1::RealScalar test_relative_error(const MatrixBase &a, const SparseMatrixBase &b) +{ + return test_relative_error(a,b.toDense()); +} + +template class SparseMatrixBase; +template +typename T1::RealScalar test_relative_error(const SparseMatrixBase &a, const MatrixBase &b) +{ + return test_relative_error(a.toDense(),b); +} + +template class SparseMatrixBase; +template +typename T1::RealScalar test_relative_error(const SparseMatrixBase &a, const SparseMatrixBase &b) +{ + return test_relative_error(a.toDense(),b.toDense()); +} + +template +typename NumTraits::Real>::NonInteger test_relative_error(const T1 &a, const T2 &b, typename internal::enable_if::Real>::value, T1>::type* = 0) +{ + typedef typename NumTraits::Real>::NonInteger RealScalar; + return numext::sqrt(RealScalar(numext::abs2(a-b))/(numext::mini)(RealScalar(numext::abs2(a)),RealScalar(numext::abs2(b)))); +} + +template +T test_relative_error(const Rotation2D &a, const Rotation2D &b) +{ + return test_relative_error(a.angle(), b.angle()); +} + +template +T test_relative_error(const AngleAxis &a, const AngleAxis &b) +{ + return (std::max)(test_relative_error(a.angle(), b.angle()), test_relative_error(a.axis(), b.axis())); +} + +template +inline bool test_isApprox(const Type1& a, const Type2& b, typename Type1::Scalar* = 0) // Enabled for Eigen's type only +{ + return a.isApprox(b, test_precision()); +} + +// get_test_precision is a small wrapper to test_precision allowing to return the scalar precision for either scalars or expressions +template +typename NumTraits::Real get_test_precision(const T&, const typename T::Scalar* = 0) +{ + return test_precision::Real>(); +} + +template +typename NumTraits::Real get_test_precision(const T&,typename internal::enable_if::Real>::value, T>::type* = 0) +{ + return test_precision::Real>(); +} + +// verifyIsApprox is a wrapper to test_isApprox that outputs the relative difference magnitude if the test fails. +template +inline bool verifyIsApprox(const Type1& a, const Type2& b) +{ + bool ret = test_isApprox(a,b); + if(!ret) + { + std::cerr << "Difference too large wrt tolerance " << get_test_precision(a) << ", relative error is: " << test_relative_error(a,b) << std::endl; + } + return ret; +} + +// The idea behind this function is to compare the two scalars a and b where +// the scalar ref is a hint about the expected order of magnitude of a and b. +// WARNING: the scalar a and b must be positive +// Therefore, if for some reason a and b are very small compared to ref, +// we won't issue a false negative. +// This test could be: abs(a-b) <= eps * ref +// However, it seems that simply comparing a+ref and b+ref is more sensitive to true error. +template +inline bool test_isApproxWithRef(const Scalar& a, const Scalar& b, const ScalarRef& ref) +{ + return test_isApprox(a+ref, b+ref); +} + +template +inline bool test_isMuchSmallerThan(const MatrixBase& m1, + const MatrixBase& m2) +{ + return m1.isMuchSmallerThan(m2, test_precision::Scalar>()); +} + +template +inline bool test_isMuchSmallerThan(const MatrixBase& m, + const typename NumTraits::Scalar>::Real& s) +{ + return m.isMuchSmallerThan(s, test_precision::Scalar>()); +} + +template +inline bool test_isUnitary(const MatrixBase& m) +{ + return m.isUnitary(test_precision::Scalar>()); +} + +// Forward declaration to avoid ICC warning +template +bool test_is_equal(const T& actual, const U& expected, bool expect_equal=true); + +template +bool test_is_equal(const T& actual, const U& expected, bool expect_equal) +{ + if ((actual==expected) == expect_equal) + return true; + // false: + std::cerr + << "\n actual = " << actual + << "\n expected " << (expect_equal ? "= " : "!=") << expected << "\n\n"; + return false; +} + +/** Creates a random Partial Isometry matrix of given rank. + * + * A partial isometry is a matrix all of whose singular values are either 0 or 1. + * This is very useful to test rank-revealing algorithms. + */ +// Forward declaration to avoid ICC warning +template +void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m); +template +void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m) +{ + typedef typename internal::traits::Scalar Scalar; + enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; + + typedef Matrix VectorType; + typedef Matrix MatrixAType; + typedef Matrix MatrixBType; + + if(desired_rank == 0) + { + m.setZero(rows,cols); + return; + } + + if(desired_rank == 1) + { + // here we normalize the vectors to get a partial isometry + m = VectorType::Random(rows).normalized() * VectorType::Random(cols).normalized().transpose(); + return; + } + + MatrixAType a = MatrixAType::Random(rows,rows); + MatrixType d = MatrixType::Identity(rows,cols); + MatrixBType b = MatrixBType::Random(cols,cols); + + // set the diagonal such that only desired_rank non-zero entries reamain + const Index diag_size = (std::min)(d.rows(),d.cols()); + if(diag_size != desired_rank) + d.diagonal().segment(desired_rank, diag_size-desired_rank) = VectorType::Zero(diag_size-desired_rank); + + HouseholderQR qra(a); + HouseholderQR qrb(b); + m = qra.householderQ() * d * qrb.householderQ(); +} + +// Forward declaration to avoid ICC warning +template +void randomPermutationVector(PermutationVectorType& v, Index size); +template +void randomPermutationVector(PermutationVectorType& v, Index size) +{ + typedef typename PermutationVectorType::Scalar Scalar; + v.resize(size); + for(Index i = 0; i < size; ++i) v(i) = Scalar(i); + if(size == 1) return; + for(Index n = 0; n < 3 * size; ++n) + { + Index i = internal::random(0, size-1); + Index j; + do j = internal::random(0, size-1); while(j==i); + std::swap(v(i), v(j)); + } +} + +template bool isNotNaN(const T& x) +{ + return x==x; +} + +template bool isPlusInf(const T& x) +{ + return x > NumTraits::highest(); +} + +template bool isMinusInf(const T& x) +{ + return x < NumTraits::lowest(); +} + +} // end namespace Eigen + +template struct GetDifferentType; + +template<> struct GetDifferentType { typedef double type; }; +template<> struct GetDifferentType { typedef float type; }; +template struct GetDifferentType > +{ typedef std::complex::type> type; }; + +// Forward declaration to avoid ICC warning +template std::string type_name(); +template std::string type_name() { return "other"; } +template<> std::string type_name() { return "float"; } +template<> std::string type_name() { return "double"; } +template<> std::string type_name() { return "long double"; } +template<> std::string type_name() { return "int"; } +template<> std::string type_name >() { return "complex"; } +template<> std::string type_name >() { return "complex"; } +template<> std::string type_name >() { return "complex"; } +template<> std::string type_name >() { return "complex"; } + +using namespace Eigen; + +inline void set_repeat_from_string(const char *str) +{ + errno = 0; + g_repeat = int(strtoul(str, 0, 10)); + if(errno || g_repeat <= 0) + { + std::cout << "Invalid repeat value " << str << std::endl; + exit(EXIT_FAILURE); + } + g_has_set_repeat = true; +} + +inline void set_seed_from_string(const char *str) +{ + errno = 0; + g_seed = int(strtoul(str, 0, 10)); + if(errno || g_seed == 0) + { + std::cout << "Invalid seed value " << str << std::endl; + exit(EXIT_FAILURE); + } + g_has_set_seed = true; +} + +int main(int argc, char *argv[]) +{ + g_has_set_repeat = false; + g_has_set_seed = false; + bool need_help = false; + + for(int i = 1; i < argc; i++) + { + if(argv[i][0] == 'r') + { + if(g_has_set_repeat) + { + std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl; + return 1; + } + set_repeat_from_string(argv[i]+1); + } + else if(argv[i][0] == 's') + { + if(g_has_set_seed) + { + std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl; + return 1; + } + set_seed_from_string(argv[i]+1); + } + else + { + need_help = true; + } + } + + if(need_help) + { + std::cout << "This test application takes the following optional arguments:" << std::endl; + std::cout << " rN Repeat each test N times (default: " << DEFAULT_REPEAT << ")" << std::endl; + std::cout << " sN Use N as seed for random numbers (default: based on current time)" << std::endl; + std::cout << std::endl; + std::cout << "If defined, the environment variables EIGEN_REPEAT and EIGEN_SEED" << std::endl; + std::cout << "will be used as default values for these parameters." << std::endl; + return 1; + } + + char *env_EIGEN_REPEAT = getenv("EIGEN_REPEAT"); + if(!g_has_set_repeat && env_EIGEN_REPEAT) + set_repeat_from_string(env_EIGEN_REPEAT); + char *env_EIGEN_SEED = getenv("EIGEN_SEED"); + if(!g_has_set_seed && env_EIGEN_SEED) + set_seed_from_string(env_EIGEN_SEED); + + if(!g_has_set_seed) g_seed = (unsigned int) time(NULL); + if(!g_has_set_repeat) g_repeat = DEFAULT_REPEAT; + + std::cout << "Initializing random number generator with seed " << g_seed << std::endl; + std::stringstream ss; + ss << "Seed: " << g_seed; + g_test_stack.push_back(ss.str()); + srand(g_seed); + std::cout << "Repeating each test " << g_repeat << " times" << std::endl; + + VERIFY(EigenTest::all().size()>0); + + for(std::size_t i=0; i this warning is raised even for legal usage as: g_test_stack.push_back("foo"); where g_test_stack is a std::vector + // remark #1418: external function definition with no prior declaration + // -> this warning is raised for all our test functions. Declaring them static would fix the issue. + // warning #279: controlling expression is constant + // remark #1572: floating-point equality and inequality comparisons are unreliable + #pragma warning disable 279 383 1418 1572 +#endif + +#ifdef _MSC_VER + // 4503 - decorated name length exceeded, name was truncated + #pragma warning( disable : 4503) +#endif diff --git a/lib/eigen-3.4.0/test/mapped_matrix.cpp b/lib/eigen-3.4.0/test/mapped_matrix.cpp new file mode 100644 index 0000000..0ea136a --- /dev/null +++ b/lib/eigen-3.4.0/test/mapped_matrix.cpp @@ -0,0 +1,207 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NO_STATIC_ASSERT +#define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them +#endif + +#include "main.h" + +#define EIGEN_TESTMAP_MAX_SIZE 256 + +template void map_class_vector(const VectorType& m) +{ + typedef typename VectorType::Scalar Scalar; + + Index size = m.size(); + + Scalar* array1 = internal::aligned_new(size); + Scalar* array2 = internal::aligned_new(size); + Scalar* array3 = new Scalar[size+1]; + Scalar* array3unaligned = (internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3; + Scalar array4[EIGEN_TESTMAP_MAX_SIZE]; + + Map(array1, size) = VectorType::Random(size); + Map(array2, size) = Map(array1, size); + Map(array3unaligned, size) = Map(array1, size); + Map(array4, size) = Map(array1, size); + VectorType ma1 = Map(array1, size); + VectorType ma2 = Map(array2, size); + VectorType ma3 = Map(array3unaligned, size); + VectorType ma4 = Map(array4, size); + VERIFY_IS_EQUAL(ma1, ma2); + VERIFY_IS_EQUAL(ma1, ma3); + VERIFY_IS_EQUAL(ma1, ma4); + #ifdef EIGEN_VECTORIZE + if(internal::packet_traits::Vectorizable && size>=AlignedMax) + VERIFY_RAISES_ASSERT((Map(array3unaligned, size))) + #endif + + internal::aligned_delete(array1, size); + internal::aligned_delete(array2, size); + delete[] array3; +} + +template void map_class_matrix(const MatrixType& m) +{ + typedef typename MatrixType::Scalar Scalar; + + Index rows = m.rows(), cols = m.cols(), size = rows*cols; + Scalar s1 = internal::random(); + + // array1 and array2 -> aligned heap allocation + Scalar* array1 = internal::aligned_new(size); + for(int i = 0; i < size; i++) array1[i] = Scalar(1); + Scalar* array2 = internal::aligned_new(size); + for(int i = 0; i < size; i++) array2[i] = Scalar(1); + // array3unaligned -> unaligned pointer to heap + Scalar* array3 = new Scalar[size+1]; + Index sizep1 = size + 1; // <- without this temporary MSVC 2103 generates bad code + for(Index i = 0; i < sizep1; i++) array3[i] = Scalar(1); + Scalar* array3unaligned = (internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3; + Scalar array4[256]; + if(size<=256) + for(int i = 0; i < size; i++) array4[i] = Scalar(1); + + Map map1(array1, rows, cols); + Map map2(array2, rows, cols); + Map map3(array3unaligned, rows, cols); + Map map4(array4, rows, cols); + + VERIFY_IS_EQUAL(map1, MatrixType::Ones(rows,cols)); + VERIFY_IS_EQUAL(map2, MatrixType::Ones(rows,cols)); + VERIFY_IS_EQUAL(map3, MatrixType::Ones(rows,cols)); + map1 = MatrixType::Random(rows,cols); + map2 = map1; + map3 = map1; + MatrixType ma1 = map1; + MatrixType ma2 = map2; + MatrixType ma3 = map3; + VERIFY_IS_EQUAL(map1, map2); + VERIFY_IS_EQUAL(map1, map3); + VERIFY_IS_EQUAL(ma1, ma2); + VERIFY_IS_EQUAL(ma1, ma3); + VERIFY_IS_EQUAL(ma1, map3); + + VERIFY_IS_APPROX(s1*map1, s1*map2); + VERIFY_IS_APPROX(s1*ma1, s1*ma2); + VERIFY_IS_EQUAL(s1*ma1, s1*ma3); + VERIFY_IS_APPROX(s1*map1, s1*map3); + + map2 *= s1; + map3 *= s1; + VERIFY_IS_APPROX(s1*map1, map2); + VERIFY_IS_APPROX(s1*map1, map3); + + if(size<=256) + { + VERIFY_IS_EQUAL(map4, MatrixType::Ones(rows,cols)); + map4 = map1; + MatrixType ma4 = map4; + VERIFY_IS_EQUAL(map1, map4); + VERIFY_IS_EQUAL(ma1, map4); + VERIFY_IS_EQUAL(ma1, ma4); + VERIFY_IS_APPROX(s1*map1, s1*map4); + + map4 *= s1; + VERIFY_IS_APPROX(s1*map1, map4); + } + + internal::aligned_delete(array1, size); + internal::aligned_delete(array2, size); + delete[] array3; +} + +template void map_static_methods(const VectorType& m) +{ + typedef typename VectorType::Scalar Scalar; + + Index size = m.size(); + + Scalar* array1 = internal::aligned_new(size); + Scalar* array2 = internal::aligned_new(size); + Scalar* array3 = new Scalar[size+1]; + Scalar* array3unaligned = internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3; + + VectorType::MapAligned(array1, size) = VectorType::Random(size); + VectorType::Map(array2, size) = VectorType::Map(array1, size); + VectorType::Map(array3unaligned, size) = VectorType::Map(array1, size); + VectorType ma1 = VectorType::Map(array1, size); + VectorType ma2 = VectorType::MapAligned(array2, size); + VectorType ma3 = VectorType::Map(array3unaligned, size); + VERIFY_IS_EQUAL(ma1, ma2); + VERIFY_IS_EQUAL(ma1, ma3); + + internal::aligned_delete(array1, size); + internal::aligned_delete(array2, size); + delete[] array3; +} + +template void check_const_correctness(const PlainObjectType&) +{ + // there's a lot that we can't test here while still having this test compile! + // the only possible approach would be to run a script trying to compile stuff and checking that it fails. + // CMake can help with that. + + // verify that map-to-const don't have LvalueBit + typedef typename internal::add_const::type ConstPlainObjectType; + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(internal::traits >::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); + VERIFY( !(Map::Flags & LvalueBit) ); +} + +template +void map_not_aligned_on_scalar() +{ + typedef Matrix MatrixType; + Index size = 11; + Scalar* array1 = internal::aligned_new((size+1)*(size+1)+1); + Scalar* array2 = reinterpret_cast(sizeof(Scalar)/2+std::size_t(array1)); + Map > map2(array2, size, size, OuterStride<>(size+1)); + MatrixType m2 = MatrixType::Random(size,size); + map2 = m2; + VERIFY_IS_EQUAL(m2, map2); + + typedef Matrix VectorType; + Map map3(array2, size); + MatrixType v3 = VectorType::Random(size); + map3 = v3; + VERIFY_IS_EQUAL(v3, map3); + + internal::aligned_delete(array1, (size+1)*(size+1)+1); +} + +EIGEN_DECLARE_TEST(mapped_matrix) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( map_class_vector(Matrix()) ); + CALL_SUBTEST_1( check_const_correctness(Matrix()) ); + CALL_SUBTEST_2( map_class_vector(Vector4d()) ); + CALL_SUBTEST_2( map_class_vector(VectorXd(13)) ); + CALL_SUBTEST_2( check_const_correctness(Matrix4d()) ); + CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); + CALL_SUBTEST_4( map_class_vector(VectorXcf(8)) ); + CALL_SUBTEST_5( map_class_vector(VectorXi(12)) ); + CALL_SUBTEST_5( check_const_correctness(VectorXi(12)) ); + + CALL_SUBTEST_1( map_class_matrix(Matrix()) ); + CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); + CALL_SUBTEST_11( map_class_matrix(Matrix()) ); + CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,10),internal::random(1,10))) ); + CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,10),internal::random(1,10))) ); + + CALL_SUBTEST_6( map_static_methods(Matrix()) ); + CALL_SUBTEST_7( map_static_methods(Vector3f()) ); + CALL_SUBTEST_8( map_static_methods(RowVector3d()) ); + CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) ); + CALL_SUBTEST_10( map_static_methods(VectorXf(12)) ); + CALL_SUBTEST_11( map_not_aligned_on_scalar() ); + } +} diff --git a/lib/eigen-3.4.0/test/mapstaticmethods.cpp b/lib/eigen-3.4.0/test/mapstaticmethods.cpp new file mode 100644 index 0000000..d0128ba --- /dev/null +++ b/lib/eigen-3.4.0/test/mapstaticmethods.cpp @@ -0,0 +1,177 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +// GCC<=4.8 has spurious shadow warnings, because `ptr` re-appears inside template instantiations +// workaround: put these in an anonymous namespace +namespace { +float *ptr; +const float *const_ptr; +} + +template +struct mapstaticmethods_impl {}; + +template +struct mapstaticmethods_impl +{ + static void run(const PlainObjectType& m) + { + mapstaticmethods_impl::run(m); + + int i = internal::random(2,5), j = internal::random(2,5); + + PlainObjectType::Map(ptr).setZero(); + PlainObjectType::MapAligned(ptr).setZero(); + PlainObjectType::Map(const_ptr).sum(); + PlainObjectType::MapAligned(const_ptr).sum(); + + PlainObjectType::Map(ptr, InnerStride<>(i)).setZero(); + PlainObjectType::MapAligned(ptr, InnerStride<>(i)).setZero(); + PlainObjectType::Map(const_ptr, InnerStride<>(i)).sum(); + PlainObjectType::MapAligned(const_ptr, InnerStride<>(i)).sum(); + + PlainObjectType::Map(ptr, InnerStride<2>()).setZero(); + PlainObjectType::MapAligned(ptr, InnerStride<3>()).setZero(); + PlainObjectType::Map(const_ptr, InnerStride<4>()).sum(); + PlainObjectType::MapAligned(const_ptr, InnerStride<5>()).sum(); + + PlainObjectType::Map(ptr, OuterStride<>(i)).setZero(); + PlainObjectType::MapAligned(ptr, OuterStride<>(i)).setZero(); + PlainObjectType::Map(const_ptr, OuterStride<>(i)).sum(); + PlainObjectType::MapAligned(const_ptr, OuterStride<>(i)).sum(); + + PlainObjectType::Map(ptr, OuterStride<2>()).setZero(); + PlainObjectType::MapAligned(ptr, OuterStride<3>()).setZero(); + PlainObjectType::Map(const_ptr, OuterStride<4>()).sum(); + PlainObjectType::MapAligned(const_ptr, OuterStride<5>()).sum(); + + PlainObjectType::Map(ptr, Stride(i,j)).setZero(); + PlainObjectType::MapAligned(ptr, Stride<2,Dynamic>(2,i)).setZero(); + PlainObjectType::Map(const_ptr, Stride(i,3)).sum(); + PlainObjectType::MapAligned(const_ptr, Stride(i,j)).sum(); + + PlainObjectType::Map(ptr, Stride<2,3>()).setZero(); + PlainObjectType::MapAligned(ptr, Stride<3,4>()).setZero(); + PlainObjectType::Map(const_ptr, Stride<2,4>()).sum(); + PlainObjectType::MapAligned(const_ptr, Stride<5,3>()).sum(); + } +}; + +template +struct mapstaticmethods_impl +{ + static void run(const PlainObjectType& m) + { + Index rows = m.rows(), cols = m.cols(); + + int i = internal::random(2,5), j = internal::random(2,5); + + PlainObjectType::Map(ptr, rows, cols).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols).setZero(); + PlainObjectType::Map(const_ptr, rows, cols).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols).sum(); + + PlainObjectType::Map(ptr, rows, cols, InnerStride<>(i)).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, InnerStride<>(i)).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, InnerStride<>(i)).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, InnerStride<>(i)).sum(); + + PlainObjectType::Map(ptr, rows, cols, InnerStride<2>()).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, InnerStride<3>()).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, InnerStride<4>()).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, InnerStride<5>()).sum(); + + PlainObjectType::Map(ptr, rows, cols, OuterStride<>(i)).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, OuterStride<>(i)).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, OuterStride<>(i)).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, OuterStride<>(i)).sum(); + + PlainObjectType::Map(ptr, rows, cols, OuterStride<2>()).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, OuterStride<3>()).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, OuterStride<4>()).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, OuterStride<5>()).sum(); + + PlainObjectType::Map(ptr, rows, cols, Stride(i,j)).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, Stride<2,Dynamic>(2,i)).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, Stride(i,3)).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, Stride(i,j)).sum(); + + PlainObjectType::Map(ptr, rows, cols, Stride<2,3>()).setZero(); + PlainObjectType::MapAligned(ptr, rows, cols, Stride<3,4>()).setZero(); + PlainObjectType::Map(const_ptr, rows, cols, Stride<2,4>()).sum(); + PlainObjectType::MapAligned(const_ptr, rows, cols, Stride<5,3>()).sum(); + } +}; + +template +struct mapstaticmethods_impl +{ + static void run(const PlainObjectType& v) + { + Index size = v.size(); + + int i = internal::random(2,5); + + PlainObjectType::Map(ptr, size).setZero(); + PlainObjectType::MapAligned(ptr, size).setZero(); + PlainObjectType::Map(const_ptr, size).sum(); + PlainObjectType::MapAligned(const_ptr, size).sum(); + + PlainObjectType::Map(ptr, size, InnerStride<>(i)).setZero(); + PlainObjectType::MapAligned(ptr, size, InnerStride<>(i)).setZero(); + PlainObjectType::Map(const_ptr, size, InnerStride<>(i)).sum(); + PlainObjectType::MapAligned(const_ptr, size, InnerStride<>(i)).sum(); + + PlainObjectType::Map(ptr, size, InnerStride<2>()).setZero(); + PlainObjectType::MapAligned(ptr, size, InnerStride<3>()).setZero(); + PlainObjectType::Map(const_ptr, size, InnerStride<4>()).sum(); + PlainObjectType::MapAligned(const_ptr, size, InnerStride<5>()).sum(); + } +}; + +template +void mapstaticmethods(const PlainObjectType& m) +{ + mapstaticmethods_impl::run(m); + VERIFY(true); // just to avoid 'unused function' warning +} + +EIGEN_DECLARE_TEST(mapstaticmethods) +{ + ptr = internal::aligned_new(1000); + for(int i = 0; i < 1000; i++) ptr[i] = float(i); + + const_ptr = ptr; + + CALL_SUBTEST_1(( mapstaticmethods(Matrix()) )); + CALL_SUBTEST_1(( mapstaticmethods(Vector2f()) )); + CALL_SUBTEST_2(( mapstaticmethods(Vector3f()) )); + CALL_SUBTEST_2(( mapstaticmethods(Matrix2f()) )); + CALL_SUBTEST_3(( mapstaticmethods(Matrix4f()) )); + CALL_SUBTEST_3(( mapstaticmethods(Array4f()) )); + CALL_SUBTEST_4(( mapstaticmethods(Array3f()) )); + CALL_SUBTEST_4(( mapstaticmethods(Array33f()) )); + CALL_SUBTEST_5(( mapstaticmethods(Array44f()) )); + CALL_SUBTEST_5(( mapstaticmethods(VectorXf(1)) )); + CALL_SUBTEST_5(( mapstaticmethods(VectorXf(8)) )); + CALL_SUBTEST_6(( mapstaticmethods(MatrixXf(1,1)) )); + CALL_SUBTEST_6(( mapstaticmethods(MatrixXf(5,7)) )); + CALL_SUBTEST_7(( mapstaticmethods(ArrayXf(1)) )); + CALL_SUBTEST_7(( mapstaticmethods(ArrayXf(5)) )); + CALL_SUBTEST_8(( mapstaticmethods(ArrayXXf(1,1)) )); + CALL_SUBTEST_8(( mapstaticmethods(ArrayXXf(8,6)) )); + + internal::aligned_delete(ptr, 1000); +} + diff --git a/lib/eigen-3.4.0/test/mapstride.cpp b/lib/eigen-3.4.0/test/mapstride.cpp new file mode 100644 index 0000000..fde73f2 --- /dev/null +++ b/lib/eigen-3.4.0/test/mapstride.cpp @@ -0,0 +1,260 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void map_class_vector(const VectorType& m) +{ + typedef typename VectorType::Scalar Scalar; + + Index size = m.size(); + + VectorType v = VectorType::Random(size); + + Index arraysize = 3*size; + + Scalar* a_array = internal::aligned_new(arraysize+1); + Scalar* array = a_array; + if(Alignment!=Aligned) + array = (Scalar*)(internal::IntPtr(a_array) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + + { + Map > map(array, size); + map = v; + for(int i = 0; i < size; ++i) + { + VERIFY(array[3*i] == v[i]); + VERIFY(map[i] == v[i]); + } + } + + { + Map > map(array, size, InnerStride(2)); + map = v; + for(int i = 0; i < size; ++i) + { + VERIFY(array[2*i] == v[i]); + VERIFY(map[i] == v[i]); + } + } + + internal::aligned_delete(a_array, arraysize+1); +} + +template void map_class_matrix(const MatrixType& _m) +{ + typedef typename MatrixType::Scalar Scalar; + + Index rows = _m.rows(), cols = _m.cols(); + + MatrixType m = MatrixType::Random(rows,cols); + Scalar s1 = internal::random(); + + Index arraysize = 4*(rows+4)*(cols+4); + + Scalar* a_array1 = internal::aligned_new(arraysize+1); + Scalar* array1 = a_array1; + if(Alignment!=Aligned) + array1 = (Scalar*)(internal::IntPtr(a_array1) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + + Scalar a_array2[256]; + Scalar* array2 = a_array2; + if(Alignment!=Aligned) + array2 = (Scalar*)(internal::IntPtr(a_array2) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + else + array2 = (Scalar*)(((internal::UIntPtr(a_array2)+EIGEN_MAX_ALIGN_BYTES-1)/EIGEN_MAX_ALIGN_BYTES)*EIGEN_MAX_ALIGN_BYTES); + Index maxsize2 = a_array2 - array2 + 256; + + // test no inner stride and some dynamic outer stride + for(int k=0; k<2; ++k) + { + if(k==1 && (m.innerSize()+1)*m.outerSize() > maxsize2) + break; + Scalar* array = (k==0 ? array1 : array2); + + Map > map(array, rows, cols, OuterStride(m.innerSize()+1)); + map = m; + VERIFY(map.outerStride() == map.innerSize()+1); + for(int i = 0; i < m.outerSize(); ++i) + for(int j = 0; j < m.innerSize(); ++j) + { + VERIFY(array[map.outerStride()*i+j] == m.coeffByOuterInner(i,j)); + VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); + } + VERIFY_IS_APPROX(s1*map,s1*m); + map *= s1; + VERIFY_IS_APPROX(map,s1*m); + } + + // test no inner stride and an outer stride of +4. This is quite important as for fixed-size matrices, + // this allows to hit the special case where it's vectorizable. + for(int k=0; k<2; ++k) + { + if(k==1 && (m.innerSize()+4)*m.outerSize() > maxsize2) + break; + Scalar* array = (k==0 ? array1 : array2); + + enum { + InnerSize = MatrixType::InnerSizeAtCompileTime, + OuterStrideAtCompileTime = InnerSize==Dynamic ? Dynamic : InnerSize+4 + }; + Map > + map(array, rows, cols, OuterStride(m.innerSize()+4)); + map = m; + VERIFY(map.outerStride() == map.innerSize()+4); + for(int i = 0; i < m.outerSize(); ++i) + for(int j = 0; j < m.innerSize(); ++j) + { + VERIFY(array[map.outerStride()*i+j] == m.coeffByOuterInner(i,j)); + VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); + } + VERIFY_IS_APPROX(s1*map,s1*m); + map *= s1; + VERIFY_IS_APPROX(map,s1*m); + } + + // test both inner stride and outer stride + for(int k=0; k<2; ++k) + { + if(k==1 && (2*m.innerSize()+1)*(m.outerSize()*2) > maxsize2) + break; + Scalar* array = (k==0 ? array1 : array2); + + Map > map(array, rows, cols, Stride(2*m.innerSize()+1, 2)); + map = m; + VERIFY(map.outerStride() == 2*map.innerSize()+1); + VERIFY(map.innerStride() == 2); + for(int i = 0; i < m.outerSize(); ++i) + for(int j = 0; j < m.innerSize(); ++j) + { + VERIFY(array[map.outerStride()*i+map.innerStride()*j] == m.coeffByOuterInner(i,j)); + VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); + } + VERIFY_IS_APPROX(s1*map,s1*m); + map *= s1; + VERIFY_IS_APPROX(map,s1*m); + } + + // test inner stride and no outer stride + for(int k=0; k<2; ++k) + { + if(k==1 && (m.innerSize()*2)*m.outerSize() > maxsize2) + break; + Scalar* array = (k==0 ? array1 : array2); + + Map > map(array, rows, cols, InnerStride(2)); + map = m; + VERIFY(map.outerStride() == map.innerSize()*2); + for(int i = 0; i < m.outerSize(); ++i) + for(int j = 0; j < m.innerSize(); ++j) + { + VERIFY(array[map.innerSize()*i*2+j*2] == m.coeffByOuterInner(i,j)); + VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); + } + VERIFY_IS_APPROX(s1*map,s1*m); + map *= s1; + VERIFY_IS_APPROX(map,s1*m); + } + + // test negative strides + { + Matrix::Map(a_array1, arraysize+1).setRandom(); + Index outerstride = m.innerSize()+4; + Scalar* array = array1; + + { + Map > map1(array, rows, cols, OuterStride<>( outerstride)); + Map > map2(array+(m.outerSize()-1)*outerstride, rows, cols, OuterStride<>(-outerstride)); + if(MatrixType::IsRowMajor) VERIFY_IS_APPROX(map1.colwise().reverse(), map2); + else VERIFY_IS_APPROX(map1.rowwise().reverse(), map2); + } + + { + Map > map1(array, rows, cols, OuterStride<>( outerstride)); + Map > map2(array+(m.outerSize()-1)*outerstride+m.innerSize()-1, rows, cols, Stride(-outerstride,-1)); + VERIFY_IS_APPROX(map1.reverse(), map2); + } + + { + Map > map1(array, rows, cols, OuterStride<>( outerstride)); + Map > map2(array+(m.outerSize()-1)*outerstride+m.innerSize()-1, rows, cols, Stride(-outerstride,-1)); + VERIFY_IS_APPROX(map1.reverse(), map2); + } + } + + internal::aligned_delete(a_array1, arraysize+1); +} + +// Additional tests for inner-stride but no outer-stride +template +void bug1453() +{ + const int data[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; + typedef Matrix RowMatrixXi; + typedef Matrix ColMatrix23i; + typedef Matrix ColMatrix32i; + typedef Matrix RowMatrix23i; + typedef Matrix RowMatrix32i; + + VERIFY_IS_APPROX(MatrixXi::Map(data, 2, 3, InnerStride<2>()), MatrixXi::Map(data, 2, 3, Stride<4,2>())); + VERIFY_IS_APPROX(MatrixXi::Map(data, 2, 3, InnerStride<>(2)), MatrixXi::Map(data, 2, 3, Stride<4,2>())); + VERIFY_IS_APPROX(MatrixXi::Map(data, 3, 2, InnerStride<2>()), MatrixXi::Map(data, 3, 2, Stride<6,2>())); + VERIFY_IS_APPROX(MatrixXi::Map(data, 3, 2, InnerStride<>(2)), MatrixXi::Map(data, 3, 2, Stride<6,2>())); + + VERIFY_IS_APPROX(RowMatrixXi::Map(data, 2, 3, InnerStride<2>()), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); + VERIFY_IS_APPROX(RowMatrixXi::Map(data, 2, 3, InnerStride<>(2)), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); + VERIFY_IS_APPROX(RowMatrixXi::Map(data, 3, 2, InnerStride<2>()), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); + VERIFY_IS_APPROX(RowMatrixXi::Map(data, 3, 2, InnerStride<>(2)), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); + + VERIFY_IS_APPROX(ColMatrix23i::Map(data, InnerStride<2>()), MatrixXi::Map(data, 2, 3, Stride<4,2>())); + VERIFY_IS_APPROX(ColMatrix23i::Map(data, InnerStride<>(2)), MatrixXi::Map(data, 2, 3, Stride<4,2>())); + VERIFY_IS_APPROX(ColMatrix32i::Map(data, InnerStride<2>()), MatrixXi::Map(data, 3, 2, Stride<6,2>())); + VERIFY_IS_APPROX(ColMatrix32i::Map(data, InnerStride<>(2)), MatrixXi::Map(data, 3, 2, Stride<6,2>())); + + VERIFY_IS_APPROX(RowMatrix23i::Map(data, InnerStride<2>()), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); + VERIFY_IS_APPROX(RowMatrix23i::Map(data, InnerStride<>(2)), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); + VERIFY_IS_APPROX(RowMatrix32i::Map(data, InnerStride<2>()), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); + VERIFY_IS_APPROX(RowMatrix32i::Map(data, InnerStride<>(2)), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); +} + +EIGEN_DECLARE_TEST(mapstride) +{ + for(int i = 0; i < g_repeat; i++) { + int maxn = 3; + CALL_SUBTEST_1( map_class_vector(Matrix()) ); + CALL_SUBTEST_1( map_class_vector(Matrix()) ); + CALL_SUBTEST_2( map_class_vector(Vector4d()) ); + CALL_SUBTEST_2( map_class_vector(Vector4d()) ); + CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); + CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); + CALL_SUBTEST_4( map_class_vector(VectorXcf(internal::random(1,maxn))) ); + CALL_SUBTEST_4( map_class_vector(VectorXcf(internal::random(1,maxn))) ); + CALL_SUBTEST_5( map_class_vector(VectorXi(internal::random(1,maxn))) ); + CALL_SUBTEST_5( map_class_vector(VectorXi(internal::random(1,maxn))) ); + + CALL_SUBTEST_1( map_class_matrix(Matrix()) ); + CALL_SUBTEST_1( map_class_matrix(Matrix()) ); + CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); + CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); + CALL_SUBTEST_3( map_class_matrix(Matrix()) ); + CALL_SUBTEST_3( map_class_matrix(Matrix()) ); + CALL_SUBTEST_3( map_class_matrix(Matrix()) ); + CALL_SUBTEST_3( map_class_matrix(Matrix()) ); + CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,maxn),internal::random(1,maxn))) ); + CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,maxn),internal::random(1,maxn))) ); + CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,maxn),internal::random(1,maxn))) ); + CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,maxn),internal::random(1,maxn))) ); + CALL_SUBTEST_6( map_class_matrix(MatrixXcd(internal::random(1,maxn),internal::random(1,maxn))) ); + CALL_SUBTEST_6( map_class_matrix(MatrixXcd(internal::random(1,maxn),internal::random(1,maxn))) ); + + CALL_SUBTEST_5( bug1453<0>() ); + + TEST_SET_BUT_UNUSED_VARIABLE(maxn); + } +} diff --git a/lib/eigen-3.4.0/test/meta.cpp b/lib/eigen-3.4.0/test/meta.cpp new file mode 100644 index 0000000..7a8b93c --- /dev/null +++ b/lib/eigen-3.4.0/test/meta.cpp @@ -0,0 +1,158 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template +bool check_is_convertible(const From&, const To&) +{ + return internal::is_convertible::value; +} + +struct FooReturnType { + typedef int ReturnType; +}; + +struct MyInterface { + virtual void func() = 0; + virtual ~MyInterface() {} +}; +struct MyImpl : public MyInterface { + void func() {} +}; + +EIGEN_DECLARE_TEST(meta) +{ + VERIFY((internal::conditional<(3<4),internal::true_type, internal::false_type>::type::value)); + VERIFY(( internal::is_same::value)); + VERIFY((!internal::is_same::value)); + VERIFY((!internal::is_same::value)); + VERIFY((!internal::is_same::value)); + + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + + // test add_const + VERIFY(( internal::is_same< internal::add_const::type, const float >::value)); + VERIFY(( internal::is_same< internal::add_const::type, float* const>::value)); + VERIFY(( internal::is_same< internal::add_const::type, float const* const>::value)); + VERIFY(( internal::is_same< internal::add_const::type, float& >::value)); + + // test remove_const + VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); + VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); + VERIFY(( internal::is_same< internal::remove_const::type, float* >::value)); + + // test add_const_on_value_type + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const& >::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const* >::value)); + + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); + + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); + VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); + + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + VERIFY(( internal::is_same::type >::value)); + + + // is_convertible + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible >::value )); + STATIC_CHECK((!internal::is_convertible,double>::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + STATIC_CHECK((!internal::is_convertible::value )); + STATIC_CHECK((!internal::is_convertible::value )); + STATIC_CHECK(!( internal::is_convertible::value )); + + STATIC_CHECK(!( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + + //STATIC_CHECK((!internal::is_convertible::value )); //does not even compile because the conversion is prevented by a static assertion + STATIC_CHECK((!internal::is_convertible::value )); + STATIC_CHECK((!internal::is_convertible::value )); + { + float f = 0.0f; + MatrixXf A, B; + VectorXf a, b; + VERIFY(( check_is_convertible(a.dot(b), f) )); + VERIFY(( check_is_convertible(a.transpose()*b, f) )); + VERIFY((!check_is_convertible(A*B, f) )); + VERIFY(( check_is_convertible(A*B, A) )); + } + + #if (EIGEN_COMP_GNUC && EIGEN_COMP_GNUC <= 99) \ + || (EIGEN_COMP_CLANG && EIGEN_COMP_CLANG <= 909) \ + || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC <=1914) + // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1752, + // basically, a fix in the c++ standard breaks our c++98 implementation + // of is_convertible for abstract classes. + // So the following tests are expected to fail with recent compilers. + + STATIC_CHECK(( !internal::is_convertible::value )); + #if (!EIGEN_COMP_GNUC_STRICT) || (EIGEN_GNUC_AT_LEAST(4,8)) + // GCC prior to 4.8 fails to compile this test: + // error: cannot allocate an object of abstract type 'MyInterface' + // In other word, it does not obey SFINAE. + // Nevertheless, we don't really care about supporting abstract type as scalar type! + STATIC_CHECK(( !internal::is_convertible::value )); + #endif + STATIC_CHECK(( internal::is_convertible::value )); + + #endif + + { + int i = 0; + VERIFY(( check_is_convertible(fix<3>(), i) )); + VERIFY((!check_is_convertible(i, fix()) )); + } + + + VERIFY(( internal::has_ReturnType::value )); + VERIFY(( internal::has_ReturnType >::value )); + VERIFY(( !internal::has_ReturnType::value )); + VERIFY(( !internal::has_ReturnType::value )); + + VERIFY(internal::meta_sqrt<1>::ret == 1); + #define VERIFY_META_SQRT(X) VERIFY(internal::meta_sqrt::ret == int(std::sqrt(double(X)))) + VERIFY_META_SQRT(2); + VERIFY_META_SQRT(3); + VERIFY_META_SQRT(4); + VERIFY_META_SQRT(5); + VERIFY_META_SQRT(6); + VERIFY_META_SQRT(8); + VERIFY_META_SQRT(9); + VERIFY_META_SQRT(15); + VERIFY_META_SQRT(16); + VERIFY_META_SQRT(17); + VERIFY_META_SQRT(255); + VERIFY_META_SQRT(256); + VERIFY_META_SQRT(257); + VERIFY_META_SQRT(1023); + VERIFY_META_SQRT(1024); + VERIFY_META_SQRT(1025); +} diff --git a/lib/eigen-3.4.0/test/metis_support.cpp b/lib/eigen-3.4.0/test/metis_support.cpp new file mode 100644 index 0000000..b490dac --- /dev/null +++ b/lib/eigen-3.4.0/test/metis_support.cpp @@ -0,0 +1,25 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "sparse_solver.h" +#include +#include +#include + +template void test_metis_T() +{ + SparseLU, MetisOrdering > sparselu_metis; + + check_sparse_square_solving(sparselu_metis); +} + +EIGEN_DECLARE_TEST(metis_support) +{ + CALL_SUBTEST_1(test_metis_T()); +} diff --git a/lib/eigen-3.4.0/test/miscmatrices.cpp b/lib/eigen-3.4.0/test/miscmatrices.cpp new file mode 100644 index 0000000..e71712f --- /dev/null +++ b/lib/eigen-3.4.0/test/miscmatrices.cpp @@ -0,0 +1,46 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template void miscMatrices(const MatrixType& m) +{ + /* this test covers the following files: + DiagonalMatrix.h Ones.h + */ + typedef typename MatrixType::Scalar Scalar; + typedef Matrix VectorType; + Index rows = m.rows(); + Index cols = m.cols(); + + Index r = internal::random(0, rows-1), r2 = internal::random(0, rows-1), c = internal::random(0, cols-1); + VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast(1)); + MatrixType m1 = MatrixType::Ones(rows,cols); + VERIFY_IS_APPROX(m1(r,c), static_cast(1)); + VectorType v1 = VectorType::Random(rows); + v1[0]; + Matrix + square(v1.asDiagonal()); + if(r==r2) VERIFY_IS_APPROX(square(r,r2), v1[r]); + else VERIFY_IS_MUCH_SMALLER_THAN(square(r,r2), static_cast(1)); + square = MatrixType::Zero(rows, rows); + square.diagonal() = VectorType::Ones(rows); + VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows)); +} + +EIGEN_DECLARE_TEST(miscmatrices) +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1( miscMatrices(Matrix()) ); + CALL_SUBTEST_2( miscMatrices(Matrix4d()) ); + CALL_SUBTEST_3( miscMatrices(MatrixXcf(3, 3)) ); + CALL_SUBTEST_4( miscMatrices(MatrixXi(8, 12)) ); + CALL_SUBTEST_5( miscMatrices(MatrixXcd(20, 20)) ); + } +} diff --git a/lib/eigen-3.4.0/test/mixingtypes.cpp b/lib/eigen-3.4.0/test/mixingtypes.cpp new file mode 100644 index 0000000..d450dbf --- /dev/null +++ b/lib/eigen-3.4.0/test/mixingtypes.cpp @@ -0,0 +1,329 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2015 Gael Guennebaud +// Copyright (C) 2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#if defined(EIGEN_TEST_PART_7) + +#ifndef EIGEN_NO_STATIC_ASSERT +#define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them +#endif + +// ignore double-promotion diagnostic for clang and gcc, if we check for static assertion anyway: +// TODO do the same for MSVC? +#if defined(__clang__) +# if (__clang_major__ * 100 + __clang_minor__) >= 308 +# pragma clang diagnostic ignored "-Wdouble-promotion" +# endif +#elif defined(__GNUC__) + // TODO is there a minimal GCC version for this? At least g++-4.7 seems to be fine with this. +# pragma GCC diagnostic ignored "-Wdouble-promotion" +#endif + +#endif + + + +#if defined(EIGEN_TEST_PART_1) || defined(EIGEN_TEST_PART_2) || defined(EIGEN_TEST_PART_3) + +#ifndef EIGEN_DONT_VECTORIZE +#define EIGEN_DONT_VECTORIZE +#endif + +#endif + +static bool g_called; +#define EIGEN_SCALAR_BINARY_OP_PLUGIN { g_called |= (!internal::is_same::value); } + +#include "main.h" + +using namespace std; + +#define VERIFY_MIX_SCALAR(XPR,REF) \ + g_called = false; \ + VERIFY_IS_APPROX(XPR,REF); \ + VERIFY( g_called && #XPR" not properly optimized"); + +template +void raise_assertion(Index size = SizeAtCompileType) +{ + // VERIFY_RAISES_ASSERT(mf+md); // does not even compile + Matrix vf; vf.setRandom(size); + Matrix vd; vd.setRandom(size); + VERIFY_RAISES_ASSERT(vf=vd); + VERIFY_RAISES_ASSERT(vf+=vd); + VERIFY_RAISES_ASSERT(vf-=vd); + VERIFY_RAISES_ASSERT(vd=vf); + VERIFY_RAISES_ASSERT(vd+=vf); + VERIFY_RAISES_ASSERT(vd-=vf); + + // vd.asDiagonal() * mf; // does not even compile + // vcd.asDiagonal() * mf; // does not even compile + +#if 0 // we get other compilation errors here than just static asserts + VERIFY_RAISES_ASSERT(vd.dot(vf)); +#endif +} + + +template void mixingtypes(int size = SizeAtCompileType) +{ + typedef std::complex CF; + typedef std::complex CD; + typedef Matrix Mat_f; + typedef Matrix Mat_d; + typedef Matrix, SizeAtCompileType, SizeAtCompileType> Mat_cf; + typedef Matrix, SizeAtCompileType, SizeAtCompileType> Mat_cd; + typedef Matrix Vec_f; + typedef Matrix Vec_d; + typedef Matrix, SizeAtCompileType, 1> Vec_cf; + typedef Matrix, SizeAtCompileType, 1> Vec_cd; + + Mat_f mf = Mat_f::Random(size,size); + Mat_d md = mf.template cast(); + //Mat_d rd = md; + Mat_cf mcf = Mat_cf::Random(size,size); + Mat_cd mcd = mcf.template cast >(); + Mat_cd rcd = mcd; + Vec_f vf = Vec_f::Random(size,1); + Vec_d vd = vf.template cast(); + Vec_cf vcf = Vec_cf::Random(size,1); + Vec_cd vcd = vcf.template cast >(); + float sf = internal::random(); + double sd = internal::random(); + complex scf = internal::random >(); + complex scd = internal::random >(); + + mf+mf; + + float epsf = std::sqrt(std::numeric_limits ::min EIGEN_EMPTY ()); + double epsd = std::sqrt(std::numeric_limits::min EIGEN_EMPTY ()); + + while(std::abs(sf )(); + while(std::abs(sd )(); + while(std::abs(scf)(); + while(std::abs(scd)(); + + // check scalar products + VERIFY_MIX_SCALAR(vcf * sf , vcf * complex(sf)); + VERIFY_MIX_SCALAR(sd * vcd , complex(sd) * vcd); + VERIFY_MIX_SCALAR(vf * scf , vf.template cast >() * scf); + VERIFY_MIX_SCALAR(scd * vd , scd * vd.template cast >()); + + VERIFY_MIX_SCALAR(vcf * 2 , vcf * complex(2)); + VERIFY_MIX_SCALAR(vcf * 2.1 , vcf * complex(2.1)); + VERIFY_MIX_SCALAR(2 * vcf, vcf * complex(2)); + VERIFY_MIX_SCALAR(2.1 * vcf , vcf * complex(2.1)); + + // check scalar quotients + VERIFY_MIX_SCALAR(vcf / sf , vcf / complex(sf)); + VERIFY_MIX_SCALAR(vf / scf , vf.template cast >() / scf); + VERIFY_MIX_SCALAR(vf.array() / scf, vf.template cast >().array() / scf); + VERIFY_MIX_SCALAR(scd / vd.array() , scd / vd.template cast >().array()); + + // check scalar increment + VERIFY_MIX_SCALAR(vcf.array() + sf , vcf.array() + complex(sf)); + VERIFY_MIX_SCALAR(sd + vcd.array(), complex(sd) + vcd.array()); + VERIFY_MIX_SCALAR(vf.array() + scf, vf.template cast >().array() + scf); + VERIFY_MIX_SCALAR(scd + vd.array() , scd + vd.template cast >().array()); + + // check scalar subtractions + VERIFY_MIX_SCALAR(vcf.array() - sf , vcf.array() - complex(sf)); + VERIFY_MIX_SCALAR(sd - vcd.array(), complex(sd) - vcd.array()); + VERIFY_MIX_SCALAR(vf.array() - scf, vf.template cast >().array() - scf); + VERIFY_MIX_SCALAR(scd - vd.array() , scd - vd.template cast >().array()); + + // check scalar powers + VERIFY_MIX_SCALAR( pow(vcf.array(), sf), Eigen::pow(vcf.array(), complex(sf)) ); + VERIFY_MIX_SCALAR( vcf.array().pow(sf) , Eigen::pow(vcf.array(), complex(sf)) ); + VERIFY_MIX_SCALAR( pow(sd, vcd.array()), Eigen::pow(complex(sd), vcd.array()) ); + VERIFY_MIX_SCALAR( Eigen::pow(vf.array(), scf), Eigen::pow(vf.template cast >().array(), scf) ); + VERIFY_MIX_SCALAR( vf.array().pow(scf) , Eigen::pow(vf.template cast >().array(), scf) ); + VERIFY_MIX_SCALAR( Eigen::pow(scd, vd.array()), Eigen::pow(scd, vd.template cast >().array()) ); + + // check dot product + vf.dot(vf); + VERIFY_IS_APPROX(vcf.dot(vf), vcf.dot(vf.template cast >())); + + // check diagonal product + VERIFY_IS_APPROX(vf.asDiagonal() * mcf, vf.template cast >().asDiagonal() * mcf); + VERIFY_IS_APPROX(vcd.asDiagonal() * md, vcd.asDiagonal() * md.template cast >()); + VERIFY_IS_APPROX(mcf * vf.asDiagonal(), mcf * vf.template cast >().asDiagonal()); + VERIFY_IS_APPROX(md * vcd.asDiagonal(), md.template cast >() * vcd.asDiagonal()); + + // check inner product + VERIFY_IS_APPROX((vf.transpose() * vcf).value(), (vf.template cast >().transpose() * vcf).value()); + + // check outer product + VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast >() * vcf.transpose()).eval()); + + // coeff wise product + + VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast >() * vcf.transpose()).eval()); + + Mat_cd mcd2 = mcd; + VERIFY_IS_APPROX(mcd.array() *= md.array(), mcd2.array() *= md.array().template cast >()); + + // check matrix-matrix products + VERIFY_IS_APPROX(sd*md*mcd, (sd*md).template cast().eval()*mcd); + VERIFY_IS_APPROX(sd*mcd*md, sd*mcd*md.template cast()); + VERIFY_IS_APPROX(scd*md*mcd, scd*md.template cast().eval()*mcd); + VERIFY_IS_APPROX(scd*mcd*md, scd*mcd*md.template cast()); + + VERIFY_IS_APPROX(sf*mf*mcf, sf*mf.template cast()*mcf); + VERIFY_IS_APPROX(sf*mcf*mf, sf*mcf*mf.template cast()); + VERIFY_IS_APPROX(scf*mf*mcf, scf*mf.template cast()*mcf); + VERIFY_IS_APPROX(scf*mcf*mf, scf*mcf*mf.template cast()); + + VERIFY_IS_APPROX(sd*md.adjoint()*mcd, (sd*md).template cast().eval().adjoint()*mcd); + VERIFY_IS_APPROX(sd*mcd.adjoint()*md, sd*mcd.adjoint()*md.template cast()); + VERIFY_IS_APPROX(sd*md.adjoint()*mcd.adjoint(), (sd*md).template cast().eval().adjoint()*mcd.adjoint()); + VERIFY_IS_APPROX(sd*mcd.adjoint()*md.adjoint(), sd*mcd.adjoint()*md.template cast().adjoint()); + VERIFY_IS_APPROX(sd*md*mcd.adjoint(), (sd*md).template cast().eval()*mcd.adjoint()); + VERIFY_IS_APPROX(sd*mcd*md.adjoint(), sd*mcd*md.template cast().adjoint()); + + VERIFY_IS_APPROX(sf*mf.adjoint()*mcf, (sf*mf).template cast().eval().adjoint()*mcf); + VERIFY_IS_APPROX(sf*mcf.adjoint()*mf, sf*mcf.adjoint()*mf.template cast()); + VERIFY_IS_APPROX(sf*mf.adjoint()*mcf.adjoint(), (sf*mf).template cast().eval().adjoint()*mcf.adjoint()); + VERIFY_IS_APPROX(sf*mcf.adjoint()*mf.adjoint(), sf*mcf.adjoint()*mf.template cast().adjoint()); + VERIFY_IS_APPROX(sf*mf*mcf.adjoint(), (sf*mf).template cast().eval()*mcf.adjoint()); + VERIFY_IS_APPROX(sf*mcf*mf.adjoint(), sf*mcf*mf.template cast().adjoint()); + + VERIFY_IS_APPROX(sf*mf*vcf, (sf*mf).template cast().eval()*vcf); + VERIFY_IS_APPROX(scf*mf*vcf,(scf*mf.template cast()).eval()*vcf); + VERIFY_IS_APPROX(sf*mcf*vf, sf*mcf*vf.template cast()); + VERIFY_IS_APPROX(scf*mcf*vf,scf*mcf*vf.template cast()); + + VERIFY_IS_APPROX(sf*vcf.adjoint()*mf, sf*vcf.adjoint()*mf.template cast().eval()); + VERIFY_IS_APPROX(scf*vcf.adjoint()*mf, scf*vcf.adjoint()*mf.template cast().eval()); + VERIFY_IS_APPROX(sf*vf.adjoint()*mcf, sf*vf.adjoint().template cast().eval()*mcf); + VERIFY_IS_APPROX(scf*vf.adjoint()*mcf, scf*vf.adjoint().template cast().eval()*mcf); + + VERIFY_IS_APPROX(sd*md*vcd, (sd*md).template cast().eval()*vcd); + VERIFY_IS_APPROX(scd*md*vcd,(scd*md.template cast()).eval()*vcd); + VERIFY_IS_APPROX(sd*mcd*vd, sd*mcd*vd.template cast().eval()); + VERIFY_IS_APPROX(scd*mcd*vd,scd*mcd*vd.template cast().eval()); + + VERIFY_IS_APPROX(sd*vcd.adjoint()*md, sd*vcd.adjoint()*md.template cast().eval()); + VERIFY_IS_APPROX(scd*vcd.adjoint()*md, scd*vcd.adjoint()*md.template cast().eval()); + VERIFY_IS_APPROX(sd*vd.adjoint()*mcd, sd*vd.adjoint().template cast().eval()*mcd); + VERIFY_IS_APPROX(scd*vd.adjoint()*mcd, scd*vd.adjoint().template cast().eval()*mcd); + + VERIFY_IS_APPROX( sd*vcd.adjoint()*md.template triangularView(), sd*vcd.adjoint()*md.template cast().eval().template triangularView()); + VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template triangularView(), scd*vcd.adjoint()*md.template cast().eval().template triangularView()); + VERIFY_IS_APPROX( sd*vcd.adjoint()*md.transpose().template triangularView(), sd*vcd.adjoint()*md.transpose().template cast().eval().template triangularView()); + VERIFY_IS_APPROX(scd*vcd.adjoint()*md.transpose().template triangularView(), scd*vcd.adjoint()*md.transpose().template cast().eval().template triangularView()); + VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.template triangularView(), sd*vd.adjoint().template cast().eval()*mcd.template triangularView()); + VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template triangularView(), scd*vd.adjoint().template cast().eval()*mcd.template triangularView()); + VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.transpose().template triangularView(), sd*vd.adjoint().template cast().eval()*mcd.transpose().template triangularView()); + VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.transpose().template triangularView(), scd*vd.adjoint().template cast().eval()*mcd.transpose().template triangularView()); + + // Not supported yet: trmm +// VERIFY_IS_APPROX(sd*mcd*md.template triangularView(), sd*mcd*md.template cast().eval().template triangularView()); +// VERIFY_IS_APPROX(scd*mcd*md.template triangularView(), scd*mcd*md.template cast().eval().template triangularView()); +// VERIFY_IS_APPROX(sd*md*mcd.template triangularView(), sd*md.template cast().eval()*mcd.template triangularView()); +// VERIFY_IS_APPROX(scd*md*mcd.template triangularView(), scd*md.template cast().eval()*mcd.template triangularView()); + + // Not supported yet: symv +// VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView(), sd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); +// VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView(), scd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); +// VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView(), sd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); +// VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView(), scd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); + + // Not supported yet: symm +// VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView(), sd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); +// VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView(), scd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); +// VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView(), sd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); +// VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView(), scd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); + + rcd.setZero(); + VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = sd * mcd * md), + Mat_cd((sd * mcd * md.template cast().eval()).template triangularView())); + VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = sd * md * mcd), + Mat_cd((sd * md.template cast().eval() * mcd).template triangularView())); + VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = scd * mcd * md), + Mat_cd((scd * mcd * md.template cast().eval()).template triangularView())); + VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = scd * md * mcd), + Mat_cd((scd * md.template cast().eval() * mcd).template triangularView())); + + + VERIFY_IS_APPROX( md.array() * mcd.array(), md.template cast().eval().array() * mcd.array() ); + VERIFY_IS_APPROX( mcd.array() * md.array(), mcd.array() * md.template cast().eval().array() ); + + VERIFY_IS_APPROX( md.array() + mcd.array(), md.template cast().eval().array() + mcd.array() ); + VERIFY_IS_APPROX( mcd.array() + md.array(), mcd.array() + md.template cast().eval().array() ); + + VERIFY_IS_APPROX( md.array() - mcd.array(), md.template cast().eval().array() - mcd.array() ); + VERIFY_IS_APPROX( mcd.array() - md.array(), mcd.array() - md.template cast().eval().array() ); + + if(mcd.array().abs().minCoeff()>epsd) + { + VERIFY_IS_APPROX( md.array() / mcd.array(), md.template cast().eval().array() / mcd.array() ); + } + if(md.array().abs().minCoeff()>epsd) + { + VERIFY_IS_APPROX( mcd.array() / md.array(), mcd.array() / md.template cast().eval().array() ); + } + + if(md.array().abs().minCoeff()>epsd || mcd.array().abs().minCoeff()>epsd) + { + VERIFY_IS_APPROX( md.array().pow(mcd.array()), md.template cast().eval().array().pow(mcd.array()) ); + VERIFY_IS_APPROX( mcd.array().pow(md.array()), mcd.array().pow(md.template cast().eval().array()) ); + + VERIFY_IS_APPROX( pow(md.array(),mcd.array()), md.template cast().eval().array().pow(mcd.array()) ); + VERIFY_IS_APPROX( pow(mcd.array(),md.array()), mcd.array().pow(md.template cast().eval().array()) ); + } + + rcd = mcd; + VERIFY_IS_APPROX( rcd = md, md.template cast().eval() ); + rcd = mcd; + VERIFY_IS_APPROX( rcd += md, mcd + md.template cast().eval() ); + rcd = mcd; + VERIFY_IS_APPROX( rcd -= md, mcd - md.template cast().eval() ); + rcd = mcd; + VERIFY_IS_APPROX( rcd.array() *= md.array(), mcd.array() * md.template cast().eval().array() ); + rcd = mcd; + if(md.array().abs().minCoeff()>epsd) + { + VERIFY_IS_APPROX( rcd.array() /= md.array(), mcd.array() / md.template cast().eval().array() ); + } + + rcd = mcd; + VERIFY_IS_APPROX( rcd.noalias() += md + mcd*md, mcd + (md.template cast().eval()) + mcd*(md.template cast().eval())); + + VERIFY_IS_APPROX( rcd.noalias() = md*md, ((md*md).eval().template cast()) ); + rcd = mcd; + VERIFY_IS_APPROX( rcd.noalias() += md*md, mcd + ((md*md).eval().template cast()) ); + rcd = mcd; + VERIFY_IS_APPROX( rcd.noalias() -= md*md, mcd - ((md*md).eval().template cast()) ); + + VERIFY_IS_APPROX( rcd.noalias() = mcd + md*md, mcd + ((md*md).eval().template cast()) ); + rcd = mcd; + VERIFY_IS_APPROX( rcd.noalias() += mcd + md*md, mcd + mcd + ((md*md).eval().template cast()) ); + rcd = mcd; + VERIFY_IS_APPROX( rcd.noalias() -= mcd + md*md, - ((md*md).eval().template cast()) ); +} + +EIGEN_DECLARE_TEST(mixingtypes) +{ + g_called = false; // Silence -Wunneeded-internal-declaration. + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_1(mixingtypes<3>()); + CALL_SUBTEST_2(mixingtypes<4>()); + CALL_SUBTEST_3(mixingtypes(internal::random(1,EIGEN_TEST_MAX_SIZE))); + + CALL_SUBTEST_4(mixingtypes<3>()); + CALL_SUBTEST_5(mixingtypes<4>()); + CALL_SUBTEST_6(mixingtypes(internal::random(1,EIGEN_TEST_MAX_SIZE))); + CALL_SUBTEST_7(raise_assertion(internal::random(1,EIGEN_TEST_MAX_SIZE))); + } + CALL_SUBTEST_7(raise_assertion<0>()); + CALL_SUBTEST_7(raise_assertion<3>()); + CALL_SUBTEST_7(raise_assertion<4>()); + CALL_SUBTEST_7(raise_assertion(0)); +} diff --git a/lib/eigen-3.4.0/test/mpl2only.cpp b/lib/eigen-3.4.0/test/mpl2only.cpp new file mode 100644 index 0000000..296350d --- /dev/null +++ b/lib/eigen-3.4.0/test/mpl2only.cpp @@ -0,0 +1,24 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MPL2_ONLY +#define EIGEN_MPL2_ONLY +#endif +#include +#include +#include +#include +#include +#include +#include + +int main() +{ + return 0; +} diff --git a/lib/eigen-3.4.0/test/nestbyvalue.cpp b/lib/eigen-3.4.0/test/nestbyvalue.cpp new file mode 100644 index 0000000..c5356bc --- /dev/null +++ b/lib/eigen-3.4.0/test/nestbyvalue.cpp @@ -0,0 +1,37 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2019 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define TEST_ENABLE_TEMPORARY_TRACKING + +#include "main.h" + +typedef NestByValue CpyMatrixXd; +typedef CwiseBinaryOp,const CpyMatrixXd,const CpyMatrixXd> XprType; + +XprType get_xpr_with_temps(const MatrixXd& a) +{ + MatrixXd t1 = a.rowwise().reverse(); + MatrixXd t2 = a+a; + return t1.nestByValue() + t2.nestByValue(); +} + +EIGEN_DECLARE_TEST(nestbyvalue) +{ + for(int i = 0; i < g_repeat; i++) { + Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); + Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); + MatrixXd a = MatrixXd(rows,cols); + nb_temporaries = 0; + XprType x = get_xpr_with_temps(a); + VERIFY_IS_EQUAL(nb_temporaries,6); + MatrixXd b = x; + VERIFY_IS_EQUAL(nb_temporaries,6+1); + VERIFY_IS_APPROX(b, a.rowwise().reverse().eval() + (a+a).eval()); + } +} diff --git a/lib/eigen-3.4.0/test/nesting_ops.cpp b/lib/eigen-3.4.0/test/nesting_ops.cpp new file mode 100644 index 0000000..4b5fc21 --- /dev/null +++ b/lib/eigen-3.4.0/test/nesting_ops.cpp @@ -0,0 +1,107 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Hauke Heibel +// Copyright (C) 2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define TEST_ENABLE_TEMPORARY_TRACKING + +#include "main.h" + +template +void use_n_times(const XprType &xpr) +{ + typename internal::nested_eval::type mat(xpr); + typename XprType::PlainObject res(mat.rows(), mat.cols()); + nb_temporaries--; // remove res + res.setZero(); + for(int i=0; i +bool verify_eval_type(const XprType &, const ReferenceType&) +{ + typedef typename internal::nested_eval::type EvalType; + return internal::is_same::type, typename internal::remove_all::type>::value; +} + +template void run_nesting_ops_1(const MatrixType& _m) +{ + typename internal::nested_eval::type m(_m); + + // Make really sure that we are in debug mode! + VERIFY_RAISES_ASSERT(eigen_assert(false)); + + // The only intention of these tests is to ensure that this code does + // not trigger any asserts or segmentation faults... more to come. + VERIFY_IS_APPROX( (m.transpose() * m).diagonal().sum(), (m.transpose() * m).diagonal().sum() ); + VERIFY_IS_APPROX( (m.transpose() * m).diagonal().array().abs().sum(), (m.transpose() * m).diagonal().array().abs().sum() ); + + VERIFY_IS_APPROX( (m.transpose() * m).array().abs().sum(), (m.transpose() * m).array().abs().sum() ); +} + +template void run_nesting_ops_2(const MatrixType& _m) +{ + typedef typename MatrixType::Scalar Scalar; + Index rows = _m.rows(); + Index cols = _m.cols(); + MatrixType m1 = MatrixType::Random(rows,cols); + Matrix m2; + + if((MatrixType::SizeAtCompileTime==Dynamic)) + { + VERIFY_EVALUATION_COUNT( use_n_times<1>(m1 + m1*m1), 1 ); + VERIFY_EVALUATION_COUNT( use_n_times<10>(m1 + m1*m1), 1 ); + + VERIFY_EVALUATION_COUNT( use_n_times<1>(m1.template triangularView().solve(m1.col(0))), 1 ); + VERIFY_EVALUATION_COUNT( use_n_times<10>(m1.template triangularView().solve(m1.col(0))), 1 ); + + VERIFY_EVALUATION_COUNT( use_n_times<1>(Scalar(2)*m1.template triangularView().solve(m1.col(0))), 2 ); // FIXME could be one by applying the scaling in-place on the solve result + VERIFY_EVALUATION_COUNT( use_n_times<1>(m1.col(0)+m1.template triangularView().solve(m1.col(0))), 2 ); // FIXME could be one by adding m1.col() inplace + VERIFY_EVALUATION_COUNT( use_n_times<10>(m1.col(0)+m1.template triangularView().solve(m1.col(0))), 2 ); + } + + { + VERIFY( verify_eval_type<10>(m1, m1) ); + if(!NumTraits::IsComplex) + { + VERIFY( verify_eval_type<3>(2*m1, 2*m1) ); + VERIFY( verify_eval_type<4>(2*m1, m1) ); + } + else + { + VERIFY( verify_eval_type<2>(2*m1, 2*m1) ); + VERIFY( verify_eval_type<3>(2*m1, m1) ); + } + VERIFY( verify_eval_type<2>(m1+m1, m1+m1) ); + VERIFY( verify_eval_type<3>(m1+m1, m1) ); + VERIFY( verify_eval_type<1>(m1*m1.transpose(), m2) ); + VERIFY( verify_eval_type<1>(m1*(m1+m1).transpose(), m2) ); + VERIFY( verify_eval_type<2>(m1*m1.transpose(), m2) ); + VERIFY( verify_eval_type<1>(m1+m1*m1, m1) ); + + VERIFY( verify_eval_type<1>(m1.template triangularView().solve(m1), m1) ); + VERIFY( verify_eval_type<1>(m1+m1.template triangularView().solve(m1), m1) ); + } +} + + +EIGEN_DECLARE_TEST(nesting_ops) +{ + CALL_SUBTEST_1(run_nesting_ops_1(MatrixXf::Random(25,25))); + CALL_SUBTEST_2(run_nesting_ops_1(MatrixXcd::Random(25,25))); + CALL_SUBTEST_3(run_nesting_ops_1(Matrix4f::Random())); + CALL_SUBTEST_4(run_nesting_ops_1(Matrix2d::Random())); + + Index s = internal::random(1,EIGEN_TEST_MAX_SIZE); + CALL_SUBTEST_1( run_nesting_ops_2(MatrixXf(s,s)) ); + CALL_SUBTEST_2( run_nesting_ops_2(MatrixXcd(s,s)) ); + CALL_SUBTEST_3( run_nesting_ops_2(Matrix4f()) ); + CALL_SUBTEST_4( run_nesting_ops_2(Matrix2d()) ); + TEST_SET_BUT_UNUSED_VARIABLE(s) +} diff --git a/lib/eigen-3.4.0/test/nomalloc.cpp b/lib/eigen-3.4.0/test/nomalloc.cpp new file mode 100644 index 0000000..cb4c073 --- /dev/null +++ b/lib/eigen-3.4.0/test/nomalloc.cpp @@ -0,0 +1,228 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// discard stack allocation as that too bypasses malloc +#define EIGEN_STACK_ALLOCATION_LIMIT 0 +// heap allocation will raise an assert if enabled at runtime +#define EIGEN_RUNTIME_NO_MALLOC + +#include "main.h" +#include +#include +#include +#include +#include + +template void nomalloc(const MatrixType& m) +{ + /* this test check no dynamic memory allocation are issued with fixed-size matrices + */ + typedef typename MatrixType::Scalar Scalar; + + Index rows = m.rows(); + Index cols = m.cols(); + + MatrixType m1 = MatrixType::Random(rows, cols), + m2 = MatrixType::Random(rows, cols), + m3(rows, cols); + + Scalar s1 = internal::random(); + + Index r = internal::random(0, rows-1), + c = internal::random(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))); + VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), (m1.array()*m1.array()).matrix()); + VERIFY_IS_APPROX((m1*m1.transpose())*m2, m1*(m1.transpose()*m2)); + + m2.col(0).noalias() = m1 * m1.col(0); + m2.col(0).noalias() -= m1.adjoint() * m1.col(0); + m2.col(0).noalias() -= m1 * m1.row(0).adjoint(); + m2.col(0).noalias() -= m1.adjoint() * m1.row(0).adjoint(); + + m2.row(0).noalias() = m1.row(0) * m1; + m2.row(0).noalias() -= m1.row(0) * m1.adjoint(); + m2.row(0).noalias() -= m1.col(0).adjoint() * m1; + m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint(); + VERIFY_IS_APPROX(m2,m2); + + m2.col(0).noalias() = m1.template triangularView() * m1.col(0); + m2.col(0).noalias() -= m1.adjoint().template triangularView() * m1.col(0); + m2.col(0).noalias() -= m1.template triangularView() * m1.row(0).adjoint(); + m2.col(0).noalias() -= m1.adjoint().template triangularView() * m1.row(0).adjoint(); + + m2.row(0).noalias() = m1.row(0) * m1.template triangularView(); + m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template triangularView(); + m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template triangularView(); + m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template triangularView(); + VERIFY_IS_APPROX(m2,m2); + + m2.col(0).noalias() = m1.template selfadjointView() * m1.col(0); + m2.col(0).noalias() -= m1.adjoint().template selfadjointView() * m1.col(0); + m2.col(0).noalias() -= m1.template selfadjointView() * m1.row(0).adjoint(); + m2.col(0).noalias() -= m1.adjoint().template selfadjointView() * m1.row(0).adjoint(); + + m2.row(0).noalias() = m1.row(0) * m1.template selfadjointView(); + m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template selfadjointView(); + m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template selfadjointView(); + m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template selfadjointView(); + VERIFY_IS_APPROX(m2,m2); + + m2.template selfadjointView().rankUpdate(m1.col(0),-1); + m2.template selfadjointView().rankUpdate(m1.row(0),-1); + m2.template selfadjointView().rankUpdate(m1.col(0), m1.col(0)); // rank-2 + + // The following fancy matrix-matrix products are not safe yet regarding static allocation + m2.template selfadjointView().rankUpdate(m1); + m2 += m2.template triangularView() * m1; + m2.template triangularView() = m2 * m2; + m1 += m1.template selfadjointView() * m2; + VERIFY_IS_APPROX(m2,m2); +} + +template +void ctms_decompositions() +{ + const int maxSize = 16; + const int size = 12; + + typedef Eigen::Matrix Matrix; + + typedef Eigen::Matrix Vector; + + typedef Eigen::Matrix, + Eigen::Dynamic, Eigen::Dynamic, + 0, + maxSize, maxSize> ComplexMatrix; + + const Matrix A(Matrix::Random(size, size)), B(Matrix::Random(size, size)); + Matrix X(size,size); + const ComplexMatrix complexA(ComplexMatrix::Random(size, size)); + const Matrix saA = A.adjoint() * A; + const Vector b(Vector::Random(size)); + Vector x(size); + + // Cholesky module + Eigen::LLT LLT; LLT.compute(A); + X = LLT.solve(B); + x = LLT.solve(b); + Eigen::LDLT LDLT; LDLT.compute(A); + X = LDLT.solve(B); + x = LDLT.solve(b); + + // Eigenvalues module + Eigen::HessenbergDecomposition hessDecomp; hessDecomp.compute(complexA); + Eigen::ComplexSchur cSchur(size); cSchur.compute(complexA); + Eigen::ComplexEigenSolver cEigSolver; cEigSolver.compute(complexA); + Eigen::EigenSolver eigSolver; eigSolver.compute(A); + Eigen::SelfAdjointEigenSolver saEigSolver(size); saEigSolver.compute(saA); + Eigen::Tridiagonalization tridiag; tridiag.compute(saA); + + // LU module + Eigen::PartialPivLU ppLU; ppLU.compute(A); + X = ppLU.solve(B); + x = ppLU.solve(b); + Eigen::FullPivLU fpLU; fpLU.compute(A); + X = fpLU.solve(B); + x = fpLU.solve(b); + + // QR module + Eigen::HouseholderQR hQR; hQR.compute(A); + X = hQR.solve(B); + x = hQR.solve(b); + Eigen::ColPivHouseholderQR cpQR; cpQR.compute(A); + X = cpQR.solve(B); + x = cpQR.solve(b); + Eigen::FullPivHouseholderQR fpQR; fpQR.compute(A); + // FIXME X = fpQR.solve(B); + x = fpQR.solve(b); + + // SVD module + Eigen::JacobiSVD jSVD; jSVD.compute(A, ComputeFullU | ComputeFullV); +} + +void test_zerosized() { + // default constructors: + Eigen::MatrixXd A; + Eigen::VectorXd v; + // explicit zero-sized: + Eigen::ArrayXXd A0(0,0); + Eigen::ArrayXd v0(0); + + // assigning empty objects to each other: + A=A0; + v=v0; +} + +template void test_reference(const MatrixType& m) { + typedef typename MatrixType::Scalar Scalar; + enum { Flag = MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor}; + enum { TransposeFlag = !MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor}; + Index rows = m.rows(), cols=m.cols(); + typedef Eigen::Matrix MatrixX; + typedef Eigen::Matrix MatrixXT; + // Dynamic reference: + typedef Eigen::Ref Ref; + typedef Eigen::Ref RefT; + + Ref r1(m); + Ref r2(m.block(rows/3, cols/4, rows/2, cols/2)); + RefT r3(m.transpose()); + RefT r4(m.topLeftCorner(rows/2, cols/2).transpose()); + + VERIFY_RAISES_ASSERT(RefT r5(m)); + VERIFY_RAISES_ASSERT(Ref r6(m.transpose())); + VERIFY_RAISES_ASSERT(Ref r7(Scalar(2) * m)); + + // Copy constructors shall also never malloc + Ref r8 = r1; + RefT r9 = r3; + + // Initializing from a compatible Ref shall also never malloc + Eigen::Ref > r10=r8, r11=m; + + // Initializing from an incompatible Ref will malloc: + typedef Eigen::Ref RefAligned; + VERIFY_RAISES_ASSERT(RefAligned r12=r10); + VERIFY_RAISES_ASSERT(Ref r13=r10); // r10 has more dynamic strides + +} + +EIGEN_DECLARE_TEST(nomalloc) +{ + // create some dynamic objects + Eigen::MatrixXd M1 = MatrixXd::Random(3,3); + Ref R1 = 2.0*M1; // Ref requires temporary + + // from here on prohibit malloc: + Eigen::internal::set_is_malloc_allowed(false); + + // check that our operator new is indeed called: + VERIFY_RAISES_ASSERT(MatrixXd dummy(MatrixXd::Random(3,3))); + CALL_SUBTEST_1(nomalloc(Matrix()) ); + CALL_SUBTEST_2(nomalloc(Matrix4d()) ); + CALL_SUBTEST_3(nomalloc(Matrix()) ); + + // Check decomposition modules with dynamic matrices that have a known compile-time max size (ctms) + CALL_SUBTEST_4(ctms_decompositions()); + + CALL_SUBTEST_5(test_zerosized()); + + CALL_SUBTEST_6(test_reference(Matrix())); + CALL_SUBTEST_7(test_reference(R1)); + CALL_SUBTEST_8(Ref R2 = M1.topRows<2>(); test_reference(R2)); +} diff --git a/lib/eigen-3.4.0/test/nullary.cpp b/lib/eigen-3.4.0/test/nullary.cpp new file mode 100644 index 0000000..9b25ea4 --- /dev/null +++ b/lib/eigen-3.4.0/test/nullary.cpp @@ -0,0 +1,341 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2011 Jitse Niesen +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +template +bool equalsIdentity(const MatrixType& A) +{ + typedef typename MatrixType::Scalar Scalar; + Scalar zero = static_cast(0); + + bool offDiagOK = true; + for (Index i = 0; i < A.rows(); ++i) { + for (Index j = i+1; j < A.cols(); ++j) { + offDiagOK = offDiagOK && (A(i,j) == zero); + } + } + for (Index i = 0; i < A.rows(); ++i) { + for (Index j = 0; j < (std::min)(i, A.cols()); ++j) { + offDiagOK = offDiagOK && (A(i,j) == zero); + } + } + + bool diagOK = (A.diagonal().array() == 1).all(); + return offDiagOK && diagOK; + +} + +template +void check_extremity_accuracy(const VectorType &v, const typename VectorType::Scalar &low, const typename VectorType::Scalar &high) +{ + typedef typename VectorType::Scalar Scalar; + typedef typename VectorType::RealScalar RealScalar; + + RealScalar prec = internal::is_same::value ? NumTraits::dummy_precision()*10 : NumTraits::dummy_precision()/10; + Index size = v.size(); + + if(size<20) + return; + + for (int i=0; isize-6) + { + Scalar ref = (low*RealScalar(size-i-1))/RealScalar(size-1) + (high*RealScalar(i))/RealScalar(size-1); + if(std::abs(ref)>1) + { + if(!internal::isApprox(v(i), ref, prec)) + std::cout << v(i) << " != " << ref << " ; relative error: " << std::abs((v(i)-ref)/ref) << " ; required precision: " << prec << " ; range: " << low << "," << high << " ; i: " << i << "\n"; + VERIFY(internal::isApprox(v(i), (low*RealScalar(size-i-1))/RealScalar(size-1) + (high*RealScalar(i))/RealScalar(size-1), prec)); + } + } + } +} + +template +void testVectorType(const VectorType& base) +{ + typedef typename VectorType::Scalar Scalar; + typedef typename VectorType::RealScalar RealScalar; + + const Index size = base.size(); + + Scalar high = internal::random(-500,500); + Scalar low = (size == 1 ? high : internal::random(-500,500)); + if (numext::real(low)>numext::real(high)) std::swap(low,high); + + // check low==high + if(internal::random(0.f,1.f)<0.05f) + low = high; + // check abs(low) >> abs(high) + else if(size>2 && std::numeric_limits::max_exponent10>0 && internal::random(0.f,1.f)<0.1f) + low = -internal::random(1,2) * RealScalar(std::pow(RealScalar(10),std::numeric_limits::max_exponent10/2)); + + const Scalar step = ((size == 1) ? 1 : (high-low)/RealScalar(size-1)); + + // check whether the result yields what we expect it to do + VectorType m(base); + m.setLinSpaced(size,low,high); + + if(!NumTraits::IsInteger) + { + VectorType n(size); + for (int i=0; i::IsInteger) || (range_length>=size && (Index(range_length)%(size-1))==0) || (Index(range_length+1)::IsInteger) || (range_length>=size)) + for (int i=0; i::IsInteger) + CALL_SUBTEST( check_extremity_accuracy(m, low, high) ); + } + + VERIFY( numext::real(m(m.size()-1)) <= numext::real(high) ); + VERIFY( (m.array().real() <= numext::real(high)).all() ); + VERIFY( (m.array().real() >= numext::real(low)).all() ); + + + VERIFY( numext::real(m(m.size()-1)) >= numext::real(low) ); + if(size>=1) + { + VERIFY( internal::isApprox(m(0),low) ); + VERIFY_IS_EQUAL(m(0) , low); + } + + // check whether everything works with row and col major vectors + Matrix row_vector(size); + Matrix col_vector(size); + row_vector.setLinSpaced(size,low,high); + col_vector.setLinSpaced(size,low,high); + // when using the extended precision (e.g., FPU) the relative error might exceed 1 bit + // when computing the squared sum in isApprox, thus the 2x factor. + VERIFY( row_vector.isApprox(col_vector.transpose(), RealScalar(2)*NumTraits::epsilon())); + + Matrix size_changer(size+50); + size_changer.setLinSpaced(size,low,high); + VERIFY( size_changer.size() == size ); + + typedef Matrix ScalarMatrix; + ScalarMatrix scalar; + scalar.setLinSpaced(1,low,high); + VERIFY_IS_APPROX( scalar, ScalarMatrix::Constant(high) ); + VERIFY_IS_APPROX( ScalarMatrix::LinSpaced(1,low,high), ScalarMatrix::Constant(high) ); + + // regression test for bug 526 (linear vectorized transversal) + if (size > 1 && (!NumTraits::IsInteger)) { + m.tail(size-1).setLinSpaced(low, high); + VERIFY_IS_APPROX(m(size-1), high); + } + + // regression test for bug 1383 (LinSpaced with empty size/range) + { + Index n0 = VectorType::SizeAtCompileTime==Dynamic ? 0 : VectorType::SizeAtCompileTime; + low = internal::random(); + m = VectorType::LinSpaced(n0,low,low-RealScalar(1)); + VERIFY(m.size()==n0); + + if(VectorType::SizeAtCompileTime==Dynamic) + { + VERIFY_IS_EQUAL(VectorType::LinSpaced(n0,0,Scalar(n0-1)).sum(),Scalar(0)); + VERIFY_IS_EQUAL(VectorType::LinSpaced(n0,low,low-RealScalar(1)).sum(),Scalar(0)); + } + + m.setLinSpaced(n0,0,Scalar(n0-1)); + VERIFY(m.size()==n0); + m.setLinSpaced(n0,low,low-RealScalar(1)); + VERIFY(m.size()==n0); + + // empty range only: + VERIFY_IS_APPROX(VectorType::LinSpaced(size,low,low),VectorType::Constant(size,low)); + m.setLinSpaced(size,low,low); + VERIFY_IS_APPROX(m,VectorType::Constant(size,low)); + + if(NumTraits::IsInteger) + { + VERIFY_IS_APPROX( VectorType::LinSpaced(size,low,low+Scalar(size-1)), VectorType::LinSpaced(size,low+Scalar(size-1),low).reverse() ); + + if(VectorType::SizeAtCompileTime==Dynamic) + { + // Check negative multiplicator path: + for(Index k=1; k<5; ++k) + VERIFY_IS_APPROX( VectorType::LinSpaced(size,low,low+Scalar((size-1)*k)), VectorType::LinSpaced(size,low+Scalar((size-1)*k),low).reverse() ); + // Check negative divisor path: + for(Index k=1; k<5; ++k) + VERIFY_IS_APPROX( VectorType::LinSpaced(size*k,low,low+Scalar(size-1)), VectorType::LinSpaced(size*k,low+Scalar(size-1),low).reverse() ); + } + } + } + + // test setUnit() + if(m.size()>0) + { + for(Index k=0; k<10; ++k) + { + Index i = internal::random(0,m.size()-1); + m.setUnit(i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(), i) ); + } + if(VectorType::SizeAtCompileTime==Dynamic) + { + Index i = internal::random(0,2*m.size()-1); + m.setUnit(2*m.size(),i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(),i) ); + } + } + +} + +template +void testMatrixType(const MatrixType& m) +{ + using std::abs; + const Index rows = m.rows(); + const Index cols = m.cols(); + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + Scalar s1; + do { + s1 = internal::random(); + } while(abs(s1)::IsInteger)); + + MatrixType A; + A.setIdentity(rows, cols); + VERIFY(equalsIdentity(A)); + VERIFY(equalsIdentity(MatrixType::Identity(rows, cols))); + + + A = MatrixType::Constant(rows,cols,s1); + Index i = internal::random(0,rows-1); + Index j = internal::random(0,cols-1); + VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1)(i,j), s1 ); + VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1).coeff(i,j), s1 ); + VERIFY_IS_APPROX( A(i,j), s1 ); +} + +template +void bug79() +{ + // 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::epsilon() ); +} + +template +void bug1630() +{ + Array4d x4 = Array4d::LinSpaced(0.0, 1.0); + Array3d x3(Array4d::LinSpaced(0.0, 1.0).head(3)); + VERIFY_IS_APPROX(x4.head(3), x3); +} + +template +void nullary_overflow() +{ + // Check possible overflow issue + int n = 60000; + ArrayXi a1(n), a2(n); + a1.setLinSpaced(n, 0, n-1); + for(int i=0; i +void nullary_internal_logic() +{ + // check some internal logic + VERIFY(( internal::has_nullary_operator >::value )); + VERIFY(( !internal::has_unary_operator >::value )); + VERIFY(( !internal::has_binary_operator >::value )); + VERIFY(( internal::functor_has_linear_access >::ret )); + + VERIFY(( !internal::has_nullary_operator >::value )); + VERIFY(( !internal::has_unary_operator >::value )); + VERIFY(( internal::has_binary_operator >::value )); + VERIFY(( !internal::functor_has_linear_access >::ret )); + + VERIFY(( !internal::has_nullary_operator >::value )); + VERIFY(( internal::has_unary_operator >::value )); + VERIFY(( !internal::has_binary_operator >::value )); + VERIFY(( internal::functor_has_linear_access >::ret )); + + // Regression unit test for a weird MSVC bug. + // Search "nullary_wrapper_workaround_msvc" in CoreEvaluators.h for the details. + // See also traits::match. + { + MatrixXf A = MatrixXf::Random(3,3); + Ref R = 2.0*A; + VERIFY_IS_APPROX(R, A+A); + + Ref R1 = MatrixXf::Random(3,3)+A; + + VectorXi V = VectorXi::Random(3); + Ref R2 = VectorXi::LinSpaced(3,1,3)+V; + VERIFY_IS_APPROX(R2, V+Vector3i(1,2,3)); + + VERIFY(( internal::has_nullary_operator >::value )); + VERIFY(( !internal::has_unary_operator >::value )); + VERIFY(( !internal::has_binary_operator >::value )); + VERIFY(( internal::functor_has_linear_access >::ret )); + + VERIFY(( !internal::has_nullary_operator >::value )); + VERIFY(( internal::has_unary_operator >::value )); + VERIFY(( !internal::has_binary_operator >::value )); + VERIFY(( internal::functor_has_linear_access >::ret )); + } +} + +EIGEN_DECLARE_TEST(nullary) +{ + CALL_SUBTEST_1( testMatrixType(Matrix2d()) ); + CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random(1,300),internal::random(1,300))) ); + CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random(1,300),internal::random(1,300))) ); + + for(int i = 0; i < g_repeat*10; i++) { + CALL_SUBTEST_3( testVectorType(VectorXcd(internal::random(1,30000))) ); + CALL_SUBTEST_4( testVectorType(VectorXd(internal::random(1,30000))) ); + CALL_SUBTEST_5( testVectorType(Vector4d()) ); // regression test for bug 232 + CALL_SUBTEST_6( testVectorType(Vector3d()) ); + CALL_SUBTEST_7( testVectorType(VectorXf(internal::random(1,30000))) ); + CALL_SUBTEST_8( testVectorType(Vector3f()) ); + CALL_SUBTEST_8( testVectorType(Vector4f()) ); + CALL_SUBTEST_8( testVectorType(Matrix()) ); + CALL_SUBTEST_8( testVectorType(Matrix()) ); + + CALL_SUBTEST_9( testVectorType(VectorXi(internal::random(1,10))) ); + CALL_SUBTEST_9( testVectorType(VectorXi(internal::random(9,300))) ); + CALL_SUBTEST_9( testVectorType(Matrix()) ); + } + + CALL_SUBTEST_6( bug79<0>() ); + CALL_SUBTEST_6( bug1630<0>() ); + CALL_SUBTEST_9( nullary_overflow<0>() ); + CALL_SUBTEST_10( nullary_internal_logic<0>() ); +} diff --git a/lib/eigen-3.4.0/test/num_dimensions.cpp b/lib/eigen-3.4.0/test/num_dimensions.cpp new file mode 100644 index 0000000..7ad7ef6 --- /dev/null +++ b/lib/eigen-3.4.0/test/num_dimensions.cpp @@ -0,0 +1,90 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2018 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" +#include + +template +void check_dim(const Xpr& ) { + STATIC_CHECK( Xpr::NumDimensions == ExpectedDim ); +} + +#if EIGEN_HAS_CXX11 +template