tomoto 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/ext/tomoto/ext.cpp +245 -0
- data/ext/tomoto/extconf.rb +28 -0
- data/lib/tomoto.rb +12 -0
- data/lib/tomoto/ct.rb +11 -0
- data/lib/tomoto/hdp.rb +11 -0
- data/lib/tomoto/lda.rb +67 -0
- data/lib/tomoto/version.rb +3 -0
- data/vendor/EigenRand/EigenRand/Core.h +1139 -0
- data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
- data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
- data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
- data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
- data/vendor/EigenRand/EigenRand/EigenRand +19 -0
- data/vendor/EigenRand/EigenRand/Macro.h +24 -0
- data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
- data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
- data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
- data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
- data/vendor/EigenRand/EigenRand/doc.h +220 -0
- data/vendor/EigenRand/LICENSE +21 -0
- data/vendor/EigenRand/README.md +288 -0
- data/vendor/eigen/COPYING.BSD +26 -0
- data/vendor/eigen/COPYING.GPL +674 -0
- data/vendor/eigen/COPYING.LGPL +502 -0
- data/vendor/eigen/COPYING.MINPACK +52 -0
- data/vendor/eigen/COPYING.MPL2 +373 -0
- data/vendor/eigen/COPYING.README +18 -0
- data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
- data/vendor/eigen/Eigen/Cholesky +46 -0
- data/vendor/eigen/Eigen/CholmodSupport +48 -0
- data/vendor/eigen/Eigen/Core +537 -0
- data/vendor/eigen/Eigen/Dense +7 -0
- data/vendor/eigen/Eigen/Eigen +2 -0
- data/vendor/eigen/Eigen/Eigenvalues +61 -0
- data/vendor/eigen/Eigen/Geometry +62 -0
- data/vendor/eigen/Eigen/Householder +30 -0
- data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
- data/vendor/eigen/Eigen/Jacobi +33 -0
- data/vendor/eigen/Eigen/LU +50 -0
- data/vendor/eigen/Eigen/MetisSupport +35 -0
- data/vendor/eigen/Eigen/OrderingMethods +73 -0
- data/vendor/eigen/Eigen/PaStiXSupport +48 -0
- data/vendor/eigen/Eigen/PardisoSupport +35 -0
- data/vendor/eigen/Eigen/QR +51 -0
- data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
- data/vendor/eigen/Eigen/SPQRSupport +34 -0
- data/vendor/eigen/Eigen/SVD +51 -0
- data/vendor/eigen/Eigen/Sparse +36 -0
- data/vendor/eigen/Eigen/SparseCholesky +45 -0
- data/vendor/eigen/Eigen/SparseCore +69 -0
- data/vendor/eigen/Eigen/SparseLU +46 -0
- data/vendor/eigen/Eigen/SparseQR +37 -0
- data/vendor/eigen/Eigen/StdDeque +27 -0
- data/vendor/eigen/Eigen/StdList +26 -0
- data/vendor/eigen/Eigen/StdVector +27 -0
- data/vendor/eigen/Eigen/SuperLUSupport +64 -0
- data/vendor/eigen/Eigen/UmfPackSupport +40 -0
- data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
- data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
- data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
- data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
- data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
- data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
- data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
- data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
- data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
- data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
- data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
- data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
- data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
- data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
- data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
- data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
- data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
- data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
- data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
- data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
- data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
- data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
- data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
- data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
- data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
- data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
- data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
- data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
- data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
- data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
- data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
- data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
- data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
- data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
- data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
- data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
- data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
- data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
- data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
- data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
- data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
- data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
- data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
- data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
- data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
- data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
- data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
- data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
- data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
- data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
- data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
- data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
- data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
- data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
- data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
- data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
- data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
- data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
- data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
- data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
- data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
- data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
- data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
- data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
- data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
- data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
- data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
- data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
- data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
- data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
- data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
- data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
- data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
- data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
- data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
- data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
- data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
- data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
- data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
- data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
- data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
- data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
- data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
- data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
- data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
- data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
- data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
- data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
- data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
- data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
- data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
- data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
- data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
- data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
- data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
- data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
- data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
- data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
- data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
- data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
- data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
- data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
- data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
- data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
- data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
- data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
- data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
- data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
- data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
- data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
- data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
- data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
- data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
- data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
- data/vendor/eigen/README.md +3 -0
- data/vendor/eigen/bench/README.txt +55 -0
- data/vendor/eigen/bench/btl/COPYING +340 -0
- data/vendor/eigen/bench/btl/README +154 -0
- data/vendor/eigen/bench/tensors/README +21 -0
- data/vendor/eigen/blas/README.txt +6 -0
- data/vendor/eigen/demos/mandelbrot/README +10 -0
- data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
- data/vendor/eigen/demos/opengl/README +13 -0
- data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
- data/vendor/eigen/unsupported/README.txt +50 -0
- data/vendor/tomotopy/LICENSE +21 -0
- data/vendor/tomotopy/README.kr.rst +375 -0
- data/vendor/tomotopy/README.rst +382 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
- data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
- data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
- data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
- data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
- data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
- data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
- data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
- data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
- data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
- data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
- data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
- data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
- data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
- data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
- data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
- data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
- data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
- data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
- data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
- data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
- data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
- data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
- data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
- data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
- data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
- data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
- data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
- data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
- data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
- data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
- data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
- data/vendor/tomotopy/src/Utils/exception.h +28 -0
- data/vendor/tomotopy/src/Utils/math.h +281 -0
- data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
- data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
- data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
- data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
- data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
- data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
- data/vendor/tomotopy/src/Utils/text.hpp +49 -0
- data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
- metadata +531 -0
@@ -0,0 +1,430 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
// Copyright (C) 2010-2016 Konstantinos Margaritis <markos@freevec.org>
|
6
|
+
//
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
#ifndef EIGEN_COMPLEX32_ALTIVEC_H
|
12
|
+
#define EIGEN_COMPLEX32_ALTIVEC_H
|
13
|
+
|
14
|
+
namespace Eigen {
|
15
|
+
|
16
|
+
namespace internal {
|
17
|
+
|
18
|
+
static Packet4ui p4ui_CONJ_XOR = vec_mergeh((Packet4ui)p4i_ZERO, (Packet4ui)p4f_MZERO);//{ 0x00000000, 0x80000000, 0x00000000, 0x80000000 };
|
19
|
+
#ifdef __VSX__
|
20
|
+
#if defined(_BIG_ENDIAN)
|
21
|
+
static Packet2ul p2ul_CONJ_XOR1 = (Packet2ul) vec_sld((Packet4ui) p2d_MZERO, (Packet4ui) p2l_ZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 };
|
22
|
+
static Packet2ul p2ul_CONJ_XOR2 = (Packet2ul) vec_sld((Packet4ui) p2l_ZERO, (Packet4ui) p2d_MZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 };
|
23
|
+
#else
|
24
|
+
static Packet2ul p2ul_CONJ_XOR1 = (Packet2ul) vec_sld((Packet4ui) p2l_ZERO, (Packet4ui) p2d_MZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 };
|
25
|
+
static Packet2ul p2ul_CONJ_XOR2 = (Packet2ul) vec_sld((Packet4ui) p2d_MZERO, (Packet4ui) p2l_ZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 };
|
26
|
+
#endif
|
27
|
+
#endif
|
28
|
+
|
29
|
+
//---------- float ----------
|
30
|
+
struct Packet2cf
|
31
|
+
{
|
32
|
+
EIGEN_STRONG_INLINE explicit Packet2cf() : v(p4f_ZERO) {}
|
33
|
+
EIGEN_STRONG_INLINE explicit Packet2cf(const Packet4f& a) : v(a) {}
|
34
|
+
Packet4f v;
|
35
|
+
};
|
36
|
+
|
37
|
+
template<> struct packet_traits<std::complex<float> > : default_packet_traits
|
38
|
+
{
|
39
|
+
typedef Packet2cf type;
|
40
|
+
typedef Packet2cf half;
|
41
|
+
enum {
|
42
|
+
Vectorizable = 1,
|
43
|
+
AlignedOnScalar = 1,
|
44
|
+
size = 2,
|
45
|
+
HasHalfPacket = 0,
|
46
|
+
|
47
|
+
HasAdd = 1,
|
48
|
+
HasSub = 1,
|
49
|
+
HasMul = 1,
|
50
|
+
HasDiv = 1,
|
51
|
+
HasNegate = 1,
|
52
|
+
HasAbs = 0,
|
53
|
+
HasAbs2 = 0,
|
54
|
+
HasMin = 0,
|
55
|
+
HasMax = 0,
|
56
|
+
#ifdef __VSX__
|
57
|
+
HasBlend = 1,
|
58
|
+
#endif
|
59
|
+
HasSetLinear = 0
|
60
|
+
};
|
61
|
+
};
|
62
|
+
|
63
|
+
template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2, alignment=Aligned16}; typedef Packet2cf half; };
|
64
|
+
|
65
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
|
66
|
+
{
|
67
|
+
Packet2cf res;
|
68
|
+
if((std::ptrdiff_t(&from) % 16) == 0)
|
69
|
+
res.v = pload<Packet4f>((const float *)&from);
|
70
|
+
else
|
71
|
+
res.v = ploadu<Packet4f>((const float *)&from);
|
72
|
+
res.v = vec_perm(res.v, res.v, p16uc_PSET64_HI);
|
73
|
+
return res;
|
74
|
+
}
|
75
|
+
|
76
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) { return Packet2cf(pload<Packet4f>((const float *) from)); }
|
77
|
+
template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { return Packet2cf(ploadu<Packet4f>((const float*) from)); }
|
78
|
+
template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); }
|
79
|
+
|
80
|
+
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstore((float*)to, from.v); }
|
81
|
+
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstoreu((float*)to, from.v); }
|
82
|
+
|
83
|
+
template<> EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(const std::complex<float>* from, Index stride)
|
84
|
+
{
|
85
|
+
std::complex<float> EIGEN_ALIGN16 af[2];
|
86
|
+
af[0] = from[0*stride];
|
87
|
+
af[1] = from[1*stride];
|
88
|
+
return pload<Packet2cf>(af);
|
89
|
+
}
|
90
|
+
template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to, const Packet2cf& from, Index stride)
|
91
|
+
{
|
92
|
+
std::complex<float> EIGEN_ALIGN16 af[2];
|
93
|
+
pstore<std::complex<float> >((std::complex<float> *) af, from);
|
94
|
+
to[0*stride] = af[0];
|
95
|
+
to[1*stride] = af[1];
|
96
|
+
}
|
97
|
+
|
98
|
+
template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(a.v + b.v); }
|
99
|
+
template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(a.v - b.v); }
|
100
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate(a.v)); }
|
101
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a) { return Packet2cf(pxor<Packet4f>(a.v, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR))); }
|
102
|
+
|
103
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
|
104
|
+
{
|
105
|
+
Packet4f v1, v2;
|
106
|
+
|
107
|
+
// Permute and multiply the real parts of a and b
|
108
|
+
v1 = vec_perm(a.v, a.v, p16uc_PSET32_WODD);
|
109
|
+
// Get the imaginary parts of a
|
110
|
+
v2 = vec_perm(a.v, a.v, p16uc_PSET32_WEVEN);
|
111
|
+
// multiply a_re * b
|
112
|
+
v1 = vec_madd(v1, b.v, p4f_ZERO);
|
113
|
+
// multiply a_im * b and get the conjugate result
|
114
|
+
v2 = vec_madd(v2, b.v, p4f_ZERO);
|
115
|
+
v2 = reinterpret_cast<Packet4f>(pxor(v2, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR)));
|
116
|
+
// permute back to a proper order
|
117
|
+
v2 = vec_perm(v2, v2, p16uc_COMPLEX32_REV);
|
118
|
+
|
119
|
+
return Packet2cf(padd<Packet4f>(v1, v2));
|
120
|
+
}
|
121
|
+
|
122
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pand<Packet4f>(a.v, b.v)); }
|
123
|
+
template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(por<Packet4f>(a.v, b.v)); }
|
124
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pxor<Packet4f>(a.v, b.v)); }
|
125
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pandnot<Packet4f>(a.v, b.v)); }
|
126
|
+
|
127
|
+
template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { EIGEN_PPC_PREFETCH(addr); }
|
128
|
+
|
129
|
+
template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
|
130
|
+
{
|
131
|
+
std::complex<float> EIGEN_ALIGN16 res[2];
|
132
|
+
pstore((float *)&res, a.v);
|
133
|
+
|
134
|
+
return res[0];
|
135
|
+
}
|
136
|
+
|
137
|
+
template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)
|
138
|
+
{
|
139
|
+
Packet4f rev_a;
|
140
|
+
rev_a = vec_perm(a.v, a.v, p16uc_COMPLEX32_REV2);
|
141
|
+
return Packet2cf(rev_a);
|
142
|
+
}
|
143
|
+
|
144
|
+
template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)
|
145
|
+
{
|
146
|
+
Packet4f b;
|
147
|
+
b = vec_sld(a.v, a.v, 8);
|
148
|
+
b = padd<Packet4f>(a.v, b);
|
149
|
+
return pfirst<Packet2cf>(Packet2cf(b));
|
150
|
+
}
|
151
|
+
|
152
|
+
template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
|
153
|
+
{
|
154
|
+
Packet4f b1, b2;
|
155
|
+
#ifdef _BIG_ENDIAN
|
156
|
+
b1 = vec_sld(vecs[0].v, vecs[1].v, 8);
|
157
|
+
b2 = vec_sld(vecs[1].v, vecs[0].v, 8);
|
158
|
+
#else
|
159
|
+
b1 = vec_sld(vecs[1].v, vecs[0].v, 8);
|
160
|
+
b2 = vec_sld(vecs[0].v, vecs[1].v, 8);
|
161
|
+
#endif
|
162
|
+
b2 = vec_sld(b2, b2, 8);
|
163
|
+
b2 = padd<Packet4f>(b1, b2);
|
164
|
+
|
165
|
+
return Packet2cf(b2);
|
166
|
+
}
|
167
|
+
|
168
|
+
template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)
|
169
|
+
{
|
170
|
+
Packet4f b;
|
171
|
+
Packet2cf prod;
|
172
|
+
b = vec_sld(a.v, a.v, 8);
|
173
|
+
prod = pmul<Packet2cf>(a, Packet2cf(b));
|
174
|
+
|
175
|
+
return pfirst<Packet2cf>(prod);
|
176
|
+
}
|
177
|
+
|
178
|
+
template<int Offset>
|
179
|
+
struct palign_impl<Offset,Packet2cf>
|
180
|
+
{
|
181
|
+
static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second)
|
182
|
+
{
|
183
|
+
if (Offset==1)
|
184
|
+
{
|
185
|
+
#ifdef _BIG_ENDIAN
|
186
|
+
first.v = vec_sld(first.v, second.v, 8);
|
187
|
+
#else
|
188
|
+
first.v = vec_sld(second.v, first.v, 8);
|
189
|
+
#endif
|
190
|
+
}
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
|
195
|
+
{
|
196
|
+
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
|
197
|
+
{ return padd(pmul(x,y),c); }
|
198
|
+
|
199
|
+
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
200
|
+
{
|
201
|
+
return internal::pmul(a, pconj(b));
|
202
|
+
}
|
203
|
+
};
|
204
|
+
|
205
|
+
template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
|
206
|
+
{
|
207
|
+
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
|
208
|
+
{ return padd(pmul(x,y),c); }
|
209
|
+
|
210
|
+
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
211
|
+
{
|
212
|
+
return internal::pmul(pconj(a), b);
|
213
|
+
}
|
214
|
+
};
|
215
|
+
|
216
|
+
template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
|
217
|
+
{
|
218
|
+
EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const
|
219
|
+
{ return padd(pmul(x,y),c); }
|
220
|
+
|
221
|
+
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
222
|
+
{
|
223
|
+
return pconj(internal::pmul(a, b));
|
224
|
+
}
|
225
|
+
};
|
226
|
+
|
227
|
+
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)
|
228
|
+
|
229
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
|
230
|
+
{
|
231
|
+
// TODO optimize it for AltiVec
|
232
|
+
Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a, b);
|
233
|
+
Packet4f s = pmul<Packet4f>(b.v, b.v);
|
234
|
+
return Packet2cf(pdiv(res.v, padd<Packet4f>(s, vec_perm(s, s, p16uc_COMPLEX32_REV))));
|
235
|
+
}
|
236
|
+
|
237
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& x)
|
238
|
+
{
|
239
|
+
return Packet2cf(vec_perm(x.v, x.v, p16uc_COMPLEX32_REV));
|
240
|
+
}
|
241
|
+
|
242
|
+
EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel)
|
243
|
+
{
|
244
|
+
Packet4f tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI);
|
245
|
+
kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO);
|
246
|
+
kernel.packet[0].v = tmp;
|
247
|
+
}
|
248
|
+
|
249
|
+
#ifdef __VSX__
|
250
|
+
template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) {
|
251
|
+
Packet2cf result;
|
252
|
+
result.v = reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v)));
|
253
|
+
return result;
|
254
|
+
}
|
255
|
+
#endif
|
256
|
+
|
257
|
+
//---------- double ----------
|
258
|
+
#ifdef __VSX__
|
259
|
+
struct Packet1cd
|
260
|
+
{
|
261
|
+
EIGEN_STRONG_INLINE Packet1cd() {}
|
262
|
+
EIGEN_STRONG_INLINE explicit Packet1cd(const Packet2d& a) : v(a) {}
|
263
|
+
Packet2d v;
|
264
|
+
};
|
265
|
+
|
266
|
+
template<> struct packet_traits<std::complex<double> > : default_packet_traits
|
267
|
+
{
|
268
|
+
typedef Packet1cd type;
|
269
|
+
typedef Packet1cd half;
|
270
|
+
enum {
|
271
|
+
Vectorizable = 1,
|
272
|
+
AlignedOnScalar = 0,
|
273
|
+
size = 1,
|
274
|
+
HasHalfPacket = 0,
|
275
|
+
|
276
|
+
HasAdd = 1,
|
277
|
+
HasSub = 1,
|
278
|
+
HasMul = 1,
|
279
|
+
HasDiv = 1,
|
280
|
+
HasNegate = 1,
|
281
|
+
HasAbs = 0,
|
282
|
+
HasAbs2 = 0,
|
283
|
+
HasMin = 0,
|
284
|
+
HasMax = 0,
|
285
|
+
HasSetLinear = 0
|
286
|
+
};
|
287
|
+
};
|
288
|
+
|
289
|
+
template<> struct unpacket_traits<Packet1cd> { typedef std::complex<double> type; enum {size=1, alignment=Aligned16}; typedef Packet1cd half; };
|
290
|
+
|
291
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pload <Packet1cd>(const std::complex<double>* from) { return Packet1cd(pload<Packet2d>((const double*)from)); }
|
292
|
+
template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<double>* from) { return Packet1cd(ploadu<Packet2d>((const double*)from)); }
|
293
|
+
template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstore((double*)to, from.v); }
|
294
|
+
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstoreu((double*)to, from.v); }
|
295
|
+
|
296
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>& from)
|
297
|
+
{ /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); }
|
298
|
+
|
299
|
+
template<> EIGEN_DEVICE_FUNC inline Packet1cd pgather<std::complex<double>, Packet1cd>(const std::complex<double>* from, Index stride)
|
300
|
+
{
|
301
|
+
std::complex<double> EIGEN_ALIGN16 af[2];
|
302
|
+
af[0] = from[0*stride];
|
303
|
+
af[1] = from[1*stride];
|
304
|
+
return pload<Packet1cd>(af);
|
305
|
+
}
|
306
|
+
template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::complex<double>* to, const Packet1cd& from, Index stride)
|
307
|
+
{
|
308
|
+
std::complex<double> EIGEN_ALIGN16 af[2];
|
309
|
+
pstore<std::complex<double> >(af, from);
|
310
|
+
to[0*stride] = af[0];
|
311
|
+
to[1*stride] = af[1];
|
312
|
+
}
|
313
|
+
|
314
|
+
template<> EIGEN_STRONG_INLINE Packet1cd padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v + b.v); }
|
315
|
+
template<> EIGEN_STRONG_INLINE Packet1cd psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v - b.v); }
|
316
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pnegate(const Packet1cd& a) { return Packet1cd(pnegate(Packet2d(a.v))); }
|
317
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pconj(const Packet1cd& a) { return Packet1cd(pxor(a.v, reinterpret_cast<Packet2d>(p2ul_CONJ_XOR2))); }
|
318
|
+
|
319
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
|
320
|
+
{
|
321
|
+
Packet2d a_re, a_im, v1, v2;
|
322
|
+
|
323
|
+
// Permute and multiply the real parts of a and b
|
324
|
+
a_re = vec_perm(a.v, a.v, p16uc_PSET64_HI);
|
325
|
+
// Get the imaginary parts of a
|
326
|
+
a_im = vec_perm(a.v, a.v, p16uc_PSET64_LO);
|
327
|
+
// multiply a_re * b
|
328
|
+
v1 = vec_madd(a_re, b.v, p2d_ZERO);
|
329
|
+
// multiply a_im * b and get the conjugate result
|
330
|
+
v2 = vec_madd(a_im, b.v, p2d_ZERO);
|
331
|
+
v2 = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4ui>(v2), reinterpret_cast<Packet4ui>(v2), 8));
|
332
|
+
v2 = pxor(v2, reinterpret_cast<Packet2d>(p2ul_CONJ_XOR1));
|
333
|
+
|
334
|
+
return Packet1cd(padd<Packet2d>(v1, v2));
|
335
|
+
}
|
336
|
+
|
337
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pand <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pand(a.v,b.v)); }
|
338
|
+
template<> EIGEN_STRONG_INLINE Packet1cd por <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(por(a.v,b.v)); }
|
339
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pxor <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pxor(a.v,b.v)); }
|
340
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pandnot(a.v, b.v)); }
|
341
|
+
|
342
|
+
template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* from) { return pset1<Packet1cd>(*from); }
|
343
|
+
|
344
|
+
template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> * addr) { EIGEN_PPC_PREFETCH(addr); }
|
345
|
+
|
346
|
+
template<> EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a)
|
347
|
+
{
|
348
|
+
std::complex<double> EIGEN_ALIGN16 res[2];
|
349
|
+
pstore<std::complex<double> >(res, a);
|
350
|
+
|
351
|
+
return res[0];
|
352
|
+
}
|
353
|
+
|
354
|
+
template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; }
|
355
|
+
|
356
|
+
template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a) { return pfirst(a); }
|
357
|
+
template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs) { return vecs[0]; }
|
358
|
+
|
359
|
+
template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a) { return pfirst(a); }
|
360
|
+
|
361
|
+
template<int Offset>
|
362
|
+
struct palign_impl<Offset,Packet1cd>
|
363
|
+
{
|
364
|
+
static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)
|
365
|
+
{
|
366
|
+
// FIXME is it sure we never have to align a Packet1cd?
|
367
|
+
// Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary...
|
368
|
+
}
|
369
|
+
};
|
370
|
+
|
371
|
+
template<> struct conj_helper<Packet1cd, Packet1cd, false,true>
|
372
|
+
{
|
373
|
+
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
|
374
|
+
{ return padd(pmul(x,y),c); }
|
375
|
+
|
376
|
+
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
|
377
|
+
{
|
378
|
+
return internal::pmul(a, pconj(b));
|
379
|
+
}
|
380
|
+
};
|
381
|
+
|
382
|
+
template<> struct conj_helper<Packet1cd, Packet1cd, true,false>
|
383
|
+
{
|
384
|
+
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
|
385
|
+
{ return padd(pmul(x,y),c); }
|
386
|
+
|
387
|
+
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
|
388
|
+
{
|
389
|
+
return internal::pmul(pconj(a), b);
|
390
|
+
}
|
391
|
+
};
|
392
|
+
|
393
|
+
template<> struct conj_helper<Packet1cd, Packet1cd, true,true>
|
394
|
+
{
|
395
|
+
EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const
|
396
|
+
{ return padd(pmul(x,y),c); }
|
397
|
+
|
398
|
+
EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const
|
399
|
+
{
|
400
|
+
return pconj(internal::pmul(a, b));
|
401
|
+
}
|
402
|
+
};
|
403
|
+
|
404
|
+
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
|
405
|
+
|
406
|
+
template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)
|
407
|
+
{
|
408
|
+
// TODO optimize it for AltiVec
|
409
|
+
Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);
|
410
|
+
Packet2d s = pmul<Packet2d>(b.v, b.v);
|
411
|
+
return Packet1cd(pdiv(res.v, padd<Packet2d>(s, vec_perm(s, s, p16uc_REVERSE64))));
|
412
|
+
}
|
413
|
+
|
414
|
+
EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x)
|
415
|
+
{
|
416
|
+
return Packet1cd(preverse(Packet2d(x.v)));
|
417
|
+
}
|
418
|
+
|
419
|
+
EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet1cd,2>& kernel)
|
420
|
+
{
|
421
|
+
Packet2d tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI);
|
422
|
+
kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO);
|
423
|
+
kernel.packet[0].v = tmp;
|
424
|
+
}
|
425
|
+
#endif // __VSX__
|
426
|
+
} // end namespace internal
|
427
|
+
|
428
|
+
} // end namespace Eigen
|
429
|
+
|
430
|
+
#endif // EIGEN_COMPLEX32_ALTIVEC_H
|
@@ -0,0 +1,322 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2007 Julien Pommier
|
5
|
+
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
6
|
+
// Copyright (C) 2016 Konstantinos Margaritis <markos@freevec.org>
|
7
|
+
//
|
8
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
9
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
10
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
|
12
|
+
/* The sin, cos, exp, and log functions of this file come from
|
13
|
+
* Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/
|
14
|
+
*/
|
15
|
+
|
16
|
+
#ifndef EIGEN_MATH_FUNCTIONS_ALTIVEC_H
|
17
|
+
#define EIGEN_MATH_FUNCTIONS_ALTIVEC_H
|
18
|
+
|
19
|
+
namespace Eigen {
|
20
|
+
|
21
|
+
namespace internal {
|
22
|
+
|
23
|
+
static _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
24
|
+
static _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
25
|
+
static _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
|
26
|
+
static _EIGEN_DECLARE_CONST_Packet4i(23, 23);
|
27
|
+
|
28
|
+
static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(inv_mant_mask, ~0x7f800000);
|
29
|
+
|
30
|
+
/* the smallest non denormalized float number */
|
31
|
+
static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(min_norm_pos, 0x00800000);
|
32
|
+
static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(minus_inf, 0xff800000); // -1.f/0.f
|
33
|
+
static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(minus_nan, 0xffffffff);
|
34
|
+
|
35
|
+
/* natural logarithm computed for 4 simultaneous float
|
36
|
+
return NaN for x <= 0
|
37
|
+
*/
|
38
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_SQRTHF, 0.707106781186547524f);
|
39
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p0, 7.0376836292E-2f);
|
40
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p1, - 1.1514610310E-1f);
|
41
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p2, 1.1676998740E-1f);
|
42
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p3, - 1.2420140846E-1f);
|
43
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p4, + 1.4249322787E-1f);
|
44
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p5, - 1.6668057665E-1f);
|
45
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p6, + 2.0000714765E-1f);
|
46
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p7, - 2.4999993993E-1f);
|
47
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p8, + 3.3333331174E-1f);
|
48
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q1, -2.12194440e-4f);
|
49
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q2, 0.693359375f);
|
50
|
+
|
51
|
+
static _EIGEN_DECLARE_CONST_Packet4f(exp_hi, 88.3762626647950f);
|
52
|
+
static _EIGEN_DECLARE_CONST_Packet4f(exp_lo, -88.3762626647949f);
|
53
|
+
|
54
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_LOG2EF, 1.44269504088896341f);
|
55
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C1, 0.693359375f);
|
56
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C2, -2.12194440e-4f);
|
57
|
+
|
58
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p0, 1.9875691500E-4f);
|
59
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p1, 1.3981999507E-3f);
|
60
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p2, 8.3334519073E-3f);
|
61
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p3, 4.1665795894E-2f);
|
62
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f);
|
63
|
+
static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f);
|
64
|
+
|
65
|
+
#ifdef __VSX__
|
66
|
+
static _EIGEN_DECLARE_CONST_Packet2d(1 , 1.0);
|
67
|
+
static _EIGEN_DECLARE_CONST_Packet2d(2 , 2.0);
|
68
|
+
static _EIGEN_DECLARE_CONST_Packet2d(half, 0.5);
|
69
|
+
|
70
|
+
static _EIGEN_DECLARE_CONST_Packet2d(exp_hi, 709.437);
|
71
|
+
static _EIGEN_DECLARE_CONST_Packet2d(exp_lo, -709.436139303);
|
72
|
+
|
73
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_LOG2EF, 1.4426950408889634073599);
|
74
|
+
|
75
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_p0, 1.26177193074810590878e-4);
|
76
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_p1, 3.02994407707441961300e-2);
|
77
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_p2, 9.99999999999999999910e-1);
|
78
|
+
|
79
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_q0, 3.00198505138664455042e-6);
|
80
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_q1, 2.52448340349684104192e-3);
|
81
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_q2, 2.27265548208155028766e-1);
|
82
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_q3, 2.00000000000000000009e0);
|
83
|
+
|
84
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_C1, 0.693145751953125);
|
85
|
+
static _EIGEN_DECLARE_CONST_Packet2d(cephes_exp_C2, 1.42860682030941723212e-6);
|
86
|
+
|
87
|
+
#ifdef __POWER8_VECTOR__
|
88
|
+
static Packet2l p2l_1023 = { 1023, 1023 };
|
89
|
+
static Packet2ul p2ul_52 = { 52, 52 };
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#endif
|
93
|
+
|
94
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
95
|
+
Packet4f plog<Packet4f>(const Packet4f& _x)
|
96
|
+
{
|
97
|
+
Packet4f x = _x;
|
98
|
+
|
99
|
+
Packet4i emm0;
|
100
|
+
|
101
|
+
/* isvalid_mask is 0 if x < 0 or x is NaN. */
|
102
|
+
Packet4ui isvalid_mask = reinterpret_cast<Packet4ui>(vec_cmpge(x, p4f_ZERO));
|
103
|
+
Packet4ui iszero_mask = reinterpret_cast<Packet4ui>(vec_cmpeq(x, p4f_ZERO));
|
104
|
+
|
105
|
+
x = pmax(x, p4f_min_norm_pos); /* cut off denormalized stuff */
|
106
|
+
emm0 = vec_sr(reinterpret_cast<Packet4i>(x),
|
107
|
+
reinterpret_cast<Packet4ui>(p4i_23));
|
108
|
+
|
109
|
+
/* keep only the fractional part */
|
110
|
+
x = pand(x, p4f_inv_mant_mask);
|
111
|
+
x = por(x, p4f_half);
|
112
|
+
|
113
|
+
emm0 = psub(emm0, p4i_0x7f);
|
114
|
+
Packet4f e = padd(vec_ctf(emm0, 0), p4f_1);
|
115
|
+
|
116
|
+
/* part2:
|
117
|
+
if( x < SQRTHF ) {
|
118
|
+
e -= 1;
|
119
|
+
x = x + x - 1.0;
|
120
|
+
} else { x = x - 1.0; }
|
121
|
+
*/
|
122
|
+
Packet4f mask = reinterpret_cast<Packet4f>(vec_cmplt(x, p4f_cephes_SQRTHF));
|
123
|
+
Packet4f tmp = pand(x, mask);
|
124
|
+
x = psub(x, p4f_1);
|
125
|
+
e = psub(e, pand(p4f_1, mask));
|
126
|
+
x = padd(x, tmp);
|
127
|
+
|
128
|
+
Packet4f x2 = pmul(x,x);
|
129
|
+
Packet4f x3 = pmul(x2,x);
|
130
|
+
|
131
|
+
Packet4f y, y1, y2;
|
132
|
+
y = pmadd(p4f_cephes_log_p0, x, p4f_cephes_log_p1);
|
133
|
+
y1 = pmadd(p4f_cephes_log_p3, x, p4f_cephes_log_p4);
|
134
|
+
y2 = pmadd(p4f_cephes_log_p6, x, p4f_cephes_log_p7);
|
135
|
+
y = pmadd(y , x, p4f_cephes_log_p2);
|
136
|
+
y1 = pmadd(y1, x, p4f_cephes_log_p5);
|
137
|
+
y2 = pmadd(y2, x, p4f_cephes_log_p8);
|
138
|
+
y = pmadd(y, x3, y1);
|
139
|
+
y = pmadd(y, x3, y2);
|
140
|
+
y = pmul(y, x3);
|
141
|
+
|
142
|
+
y1 = pmul(e, p4f_cephes_log_q1);
|
143
|
+
tmp = pmul(x2, p4f_half);
|
144
|
+
y = padd(y, y1);
|
145
|
+
x = psub(x, tmp);
|
146
|
+
y2 = pmul(e, p4f_cephes_log_q2);
|
147
|
+
x = padd(x, y);
|
148
|
+
x = padd(x, y2);
|
149
|
+
// negative arg will be NAN, 0 will be -INF
|
150
|
+
x = vec_sel(x, p4f_minus_inf, iszero_mask);
|
151
|
+
x = vec_sel(p4f_minus_nan, x, isvalid_mask);
|
152
|
+
return x;
|
153
|
+
}
|
154
|
+
|
155
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
156
|
+
Packet4f pexp<Packet4f>(const Packet4f& _x)
|
157
|
+
{
|
158
|
+
Packet4f x = _x;
|
159
|
+
|
160
|
+
Packet4f tmp, fx;
|
161
|
+
Packet4i emm0;
|
162
|
+
|
163
|
+
// clamp x
|
164
|
+
x = pmax(pmin(x, p4f_exp_hi), p4f_exp_lo);
|
165
|
+
|
166
|
+
// express exp(x) as exp(g + n*log(2))
|
167
|
+
fx = pmadd(x, p4f_cephes_LOG2EF, p4f_half);
|
168
|
+
|
169
|
+
fx = pfloor(fx);
|
170
|
+
|
171
|
+
tmp = pmul(fx, p4f_cephes_exp_C1);
|
172
|
+
Packet4f z = pmul(fx, p4f_cephes_exp_C2);
|
173
|
+
x = psub(x, tmp);
|
174
|
+
x = psub(x, z);
|
175
|
+
|
176
|
+
z = pmul(x,x);
|
177
|
+
|
178
|
+
Packet4f y = p4f_cephes_exp_p0;
|
179
|
+
y = pmadd(y, x, p4f_cephes_exp_p1);
|
180
|
+
y = pmadd(y, x, p4f_cephes_exp_p2);
|
181
|
+
y = pmadd(y, x, p4f_cephes_exp_p3);
|
182
|
+
y = pmadd(y, x, p4f_cephes_exp_p4);
|
183
|
+
y = pmadd(y, x, p4f_cephes_exp_p5);
|
184
|
+
y = pmadd(y, z, x);
|
185
|
+
y = padd(y, p4f_1);
|
186
|
+
|
187
|
+
// build 2^n
|
188
|
+
emm0 = vec_cts(fx, 0);
|
189
|
+
emm0 = vec_add(emm0, p4i_0x7f);
|
190
|
+
emm0 = vec_sl(emm0, reinterpret_cast<Packet4ui>(p4i_23));
|
191
|
+
|
192
|
+
// Altivec's max & min operators just drop silent NaNs. Check NaNs in
|
193
|
+
// inputs and return them unmodified.
|
194
|
+
Packet4ui isnumber_mask = reinterpret_cast<Packet4ui>(vec_cmpeq(_x, _x));
|
195
|
+
return vec_sel(_x, pmax(pmul(y, reinterpret_cast<Packet4f>(emm0)), _x),
|
196
|
+
isnumber_mask);
|
197
|
+
}
|
198
|
+
|
199
|
+
#ifndef EIGEN_COMP_CLANG
|
200
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
201
|
+
Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
202
|
+
{
|
203
|
+
return vec_rsqrt(x);
|
204
|
+
}
|
205
|
+
#endif
|
206
|
+
|
207
|
+
#ifdef __VSX__
|
208
|
+
#ifndef EIGEN_COMP_CLANG
|
209
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
210
|
+
Packet2d prsqrt<Packet2d>(const Packet2d& x)
|
211
|
+
{
|
212
|
+
return vec_rsqrt(x);
|
213
|
+
}
|
214
|
+
#endif
|
215
|
+
|
216
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
217
|
+
Packet4f psqrt<Packet4f>(const Packet4f& x)
|
218
|
+
{
|
219
|
+
return vec_sqrt(x);
|
220
|
+
}
|
221
|
+
|
222
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
223
|
+
Packet2d psqrt<Packet2d>(const Packet2d& x)
|
224
|
+
{
|
225
|
+
return vec_sqrt(x);
|
226
|
+
}
|
227
|
+
|
228
|
+
// VSX support varies between different compilers and even different
|
229
|
+
// versions of the same compiler. For gcc version >= 4.9.3, we can use
|
230
|
+
// vec_cts to efficiently convert Packet2d to Packet2l. Otherwise, use
|
231
|
+
// a slow version that works with older compilers.
|
232
|
+
// Update: apparently vec_cts/vec_ctf intrinsics for 64-bit doubles
|
233
|
+
// are buggy, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70963
|
234
|
+
static inline Packet2l ConvertToPacket2l(const Packet2d& x) {
|
235
|
+
#if EIGEN_GNUC_AT_LEAST(5, 4) || \
|
236
|
+
(EIGEN_GNUC_AT(6, 1) && __GNUC_PATCHLEVEL__ >= 1)
|
237
|
+
return vec_cts(x, 0); // TODO: check clang version.
|
238
|
+
#else
|
239
|
+
double tmp[2];
|
240
|
+
memcpy(tmp, &x, sizeof(tmp));
|
241
|
+
Packet2l l = { static_cast<long long>(tmp[0]),
|
242
|
+
static_cast<long long>(tmp[1]) };
|
243
|
+
return l;
|
244
|
+
#endif
|
245
|
+
}
|
246
|
+
|
247
|
+
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
248
|
+
Packet2d pexp<Packet2d>(const Packet2d& _x)
|
249
|
+
{
|
250
|
+
Packet2d x = _x;
|
251
|
+
|
252
|
+
Packet2d tmp, fx;
|
253
|
+
Packet2l emm0;
|
254
|
+
|
255
|
+
// clamp x
|
256
|
+
x = pmax(pmin(x, p2d_exp_hi), p2d_exp_lo);
|
257
|
+
|
258
|
+
/* express exp(x) as exp(g + n*log(2)) */
|
259
|
+
fx = pmadd(x, p2d_cephes_LOG2EF, p2d_half);
|
260
|
+
|
261
|
+
fx = pfloor(fx);
|
262
|
+
|
263
|
+
tmp = pmul(fx, p2d_cephes_exp_C1);
|
264
|
+
Packet2d z = pmul(fx, p2d_cephes_exp_C2);
|
265
|
+
x = psub(x, tmp);
|
266
|
+
x = psub(x, z);
|
267
|
+
|
268
|
+
Packet2d x2 = pmul(x,x);
|
269
|
+
|
270
|
+
Packet2d px = p2d_cephes_exp_p0;
|
271
|
+
px = pmadd(px, x2, p2d_cephes_exp_p1);
|
272
|
+
px = pmadd(px, x2, p2d_cephes_exp_p2);
|
273
|
+
px = pmul (px, x);
|
274
|
+
|
275
|
+
Packet2d qx = p2d_cephes_exp_q0;
|
276
|
+
qx = pmadd(qx, x2, p2d_cephes_exp_q1);
|
277
|
+
qx = pmadd(qx, x2, p2d_cephes_exp_q2);
|
278
|
+
qx = pmadd(qx, x2, p2d_cephes_exp_q3);
|
279
|
+
|
280
|
+
x = pdiv(px,psub(qx,px));
|
281
|
+
x = pmadd(p2d_2,x,p2d_1);
|
282
|
+
|
283
|
+
// build 2^n
|
284
|
+
emm0 = ConvertToPacket2l(fx);
|
285
|
+
|
286
|
+
#ifdef __POWER8_VECTOR__
|
287
|
+
emm0 = vec_add(emm0, p2l_1023);
|
288
|
+
emm0 = vec_sl(emm0, p2ul_52);
|
289
|
+
#else
|
290
|
+
// Code is a bit complex for POWER7. There is actually a
|
291
|
+
// vec_xxsldi intrinsic but it is not supported by some gcc versions.
|
292
|
+
// So we shift (52-32) bits and do a word swap with zeros.
|
293
|
+
_EIGEN_DECLARE_CONST_Packet4i(1023, 1023);
|
294
|
+
_EIGEN_DECLARE_CONST_Packet4i(20, 20); // 52 - 32
|
295
|
+
|
296
|
+
Packet4i emm04i = reinterpret_cast<Packet4i>(emm0);
|
297
|
+
emm04i = vec_add(emm04i, p4i_1023);
|
298
|
+
emm04i = vec_sl(emm04i, reinterpret_cast<Packet4ui>(p4i_20));
|
299
|
+
static const Packet16uc perm = {
|
300
|
+
0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03,
|
301
|
+
0x1c, 0x1d, 0x1e, 0x1f, 0x08, 0x09, 0x0a, 0x0b };
|
302
|
+
#ifdef _BIG_ENDIAN
|
303
|
+
emm0 = reinterpret_cast<Packet2l>(vec_perm(p4i_ZERO, emm04i, perm));
|
304
|
+
#else
|
305
|
+
emm0 = reinterpret_cast<Packet2l>(vec_perm(emm04i, p4i_ZERO, perm));
|
306
|
+
#endif
|
307
|
+
|
308
|
+
#endif
|
309
|
+
|
310
|
+
// Altivec's max & min operators just drop silent NaNs. Check NaNs in
|
311
|
+
// inputs and return them unmodified.
|
312
|
+
Packet2ul isnumber_mask = reinterpret_cast<Packet2ul>(vec_cmpeq(_x, _x));
|
313
|
+
return vec_sel(_x, pmax(pmul(x, reinterpret_cast<Packet2d>(emm0)), _x),
|
314
|
+
isnumber_mask);
|
315
|
+
}
|
316
|
+
#endif
|
317
|
+
|
318
|
+
} // end namespace internal
|
319
|
+
|
320
|
+
} // end namespace Eigen
|
321
|
+
|
322
|
+
#endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H
|