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,188 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2016 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_NULLARY_FUNCTORS_H
|
11
|
+
#define EIGEN_NULLARY_FUNCTORS_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename Scalar>
|
18
|
+
struct scalar_constant_op {
|
19
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE scalar_constant_op(const scalar_constant_op& other) : m_other(other.m_other) { }
|
20
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE scalar_constant_op(const Scalar& other) : m_other(other) { }
|
21
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() () const { return m_other; }
|
22
|
+
template<typename PacketType>
|
23
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packetOp() const { return internal::pset1<PacketType>(m_other); }
|
24
|
+
const Scalar m_other;
|
25
|
+
};
|
26
|
+
template<typename Scalar>
|
27
|
+
struct functor_traits<scalar_constant_op<Scalar> >
|
28
|
+
{ enum { Cost = 0 /* as the constant value should be loaded in register only once for the whole expression */,
|
29
|
+
PacketAccess = packet_traits<Scalar>::Vectorizable, IsRepeatable = true }; };
|
30
|
+
|
31
|
+
template<typename Scalar> struct scalar_identity_op {
|
32
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op)
|
33
|
+
template<typename IndexType>
|
34
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (IndexType row, IndexType col) const { return row==col ? Scalar(1) : Scalar(0); }
|
35
|
+
};
|
36
|
+
template<typename Scalar>
|
37
|
+
struct functor_traits<scalar_identity_op<Scalar> >
|
38
|
+
{ enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = false, IsRepeatable = true }; };
|
39
|
+
|
40
|
+
template <typename Scalar, typename Packet, bool IsInteger> struct linspaced_op_impl;
|
41
|
+
|
42
|
+
template <typename Scalar, typename Packet>
|
43
|
+
struct linspaced_op_impl<Scalar,Packet,/*IsInteger*/false>
|
44
|
+
{
|
45
|
+
linspaced_op_impl(const Scalar& low, const Scalar& high, Index num_steps) :
|
46
|
+
m_low(low), m_high(high), m_size1(num_steps==1 ? 1 : num_steps-1), m_step(num_steps==1 ? Scalar() : (high-low)/Scalar(num_steps-1)),
|
47
|
+
m_flip(numext::abs(high)<numext::abs(low))
|
48
|
+
{}
|
49
|
+
|
50
|
+
template<typename IndexType>
|
51
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (IndexType i) const {
|
52
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
53
|
+
if(m_flip)
|
54
|
+
return (i==0)? m_low : (m_high - RealScalar(m_size1-i)*m_step);
|
55
|
+
else
|
56
|
+
return (i==m_size1)? m_high : (m_low + RealScalar(i)*m_step);
|
57
|
+
}
|
58
|
+
|
59
|
+
template<typename IndexType>
|
60
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(IndexType i) const
|
61
|
+
{
|
62
|
+
// Principle:
|
63
|
+
// [low, ..., low] + ( [step, ..., step] * ( [i, ..., i] + [0, ..., size] ) )
|
64
|
+
if(m_flip)
|
65
|
+
{
|
66
|
+
Packet pi = plset<Packet>(Scalar(i-m_size1));
|
67
|
+
Packet res = padd(pset1<Packet>(m_high), pmul(pset1<Packet>(m_step), pi));
|
68
|
+
if(i==0)
|
69
|
+
res = pinsertfirst(res, m_low);
|
70
|
+
return res;
|
71
|
+
}
|
72
|
+
else
|
73
|
+
{
|
74
|
+
Packet pi = plset<Packet>(Scalar(i));
|
75
|
+
Packet res = padd(pset1<Packet>(m_low), pmul(pset1<Packet>(m_step), pi));
|
76
|
+
if(i==m_size1-unpacket_traits<Packet>::size+1)
|
77
|
+
res = pinsertlast(res, m_high);
|
78
|
+
return res;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
const Scalar m_low;
|
83
|
+
const Scalar m_high;
|
84
|
+
const Index m_size1;
|
85
|
+
const Scalar m_step;
|
86
|
+
const bool m_flip;
|
87
|
+
};
|
88
|
+
|
89
|
+
template <typename Scalar, typename Packet>
|
90
|
+
struct linspaced_op_impl<Scalar,Packet,/*IsInteger*/true>
|
91
|
+
{
|
92
|
+
linspaced_op_impl(const Scalar& low, const Scalar& high, Index num_steps) :
|
93
|
+
m_low(low),
|
94
|
+
m_multiplier((high-low)/convert_index<Scalar>(num_steps<=1 ? 1 : num_steps-1)),
|
95
|
+
m_divisor(convert_index<Scalar>((high>=low?num_steps:-num_steps)+(high-low))/((numext::abs(high-low)+1)==0?1:(numext::abs(high-low)+1))),
|
96
|
+
m_use_divisor(num_steps>1 && (numext::abs(high-low)+1)<num_steps)
|
97
|
+
{}
|
98
|
+
|
99
|
+
template<typename IndexType>
|
100
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
101
|
+
const Scalar operator() (IndexType i) const
|
102
|
+
{
|
103
|
+
if(m_use_divisor) return m_low + convert_index<Scalar>(i)/m_divisor;
|
104
|
+
else return m_low + convert_index<Scalar>(i)*m_multiplier;
|
105
|
+
}
|
106
|
+
|
107
|
+
const Scalar m_low;
|
108
|
+
const Scalar m_multiplier;
|
109
|
+
const Scalar m_divisor;
|
110
|
+
const bool m_use_divisor;
|
111
|
+
};
|
112
|
+
|
113
|
+
// ----- Linspace functor ----------------------------------------------------------------
|
114
|
+
|
115
|
+
// Forward declaration (we default to random access which does not really give
|
116
|
+
// us a speed gain when using packet access but it allows to use the functor in
|
117
|
+
// nested expressions).
|
118
|
+
template <typename Scalar, typename PacketType> struct linspaced_op;
|
119
|
+
template <typename Scalar, typename PacketType> struct functor_traits< linspaced_op<Scalar,PacketType> >
|
120
|
+
{
|
121
|
+
enum
|
122
|
+
{
|
123
|
+
Cost = 1,
|
124
|
+
PacketAccess = (!NumTraits<Scalar>::IsInteger) && packet_traits<Scalar>::HasSetLinear && packet_traits<Scalar>::HasBlend,
|
125
|
+
/*&& ((!NumTraits<Scalar>::IsInteger) || packet_traits<Scalar>::HasDiv),*/ // <- vectorization for integer is currently disabled
|
126
|
+
IsRepeatable = true
|
127
|
+
};
|
128
|
+
};
|
129
|
+
template <typename Scalar, typename PacketType> struct linspaced_op
|
130
|
+
{
|
131
|
+
linspaced_op(const Scalar& low, const Scalar& high, Index num_steps)
|
132
|
+
: impl((num_steps==1 ? high : low),high,num_steps)
|
133
|
+
{}
|
134
|
+
|
135
|
+
template<typename IndexType>
|
136
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (IndexType i) const { return impl(i); }
|
137
|
+
|
138
|
+
template<typename Packet,typename IndexType>
|
139
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(IndexType i) const { return impl.packetOp(i); }
|
140
|
+
|
141
|
+
// This proxy object handles the actual required temporaries and the different
|
142
|
+
// implementations (integer vs. floating point).
|
143
|
+
const linspaced_op_impl<Scalar,PacketType,NumTraits<Scalar>::IsInteger> impl;
|
144
|
+
};
|
145
|
+
|
146
|
+
// Linear access is automatically determined from the operator() prototypes available for the given functor.
|
147
|
+
// If it exposes an operator()(i,j), then we assume the i and j coefficients are required independently
|
148
|
+
// and linear access is not possible. In all other cases, linear access is enabled.
|
149
|
+
// Users should not have to deal with this structure.
|
150
|
+
template<typename Functor> struct functor_has_linear_access { enum { ret = !has_binary_operator<Functor>::value }; };
|
151
|
+
|
152
|
+
// For unreliable compilers, let's specialize the has_*ary_operator
|
153
|
+
// helpers so that at least built-in nullary functors work fine.
|
154
|
+
#if !( (EIGEN_COMP_MSVC>1600) || (EIGEN_GNUC_AT_LEAST(4,8)) || (EIGEN_COMP_ICC>=1600))
|
155
|
+
template<typename Scalar,typename IndexType>
|
156
|
+
struct has_nullary_operator<scalar_constant_op<Scalar>,IndexType> { enum { value = 1}; };
|
157
|
+
template<typename Scalar,typename IndexType>
|
158
|
+
struct has_unary_operator<scalar_constant_op<Scalar>,IndexType> { enum { value = 0}; };
|
159
|
+
template<typename Scalar,typename IndexType>
|
160
|
+
struct has_binary_operator<scalar_constant_op<Scalar>,IndexType> { enum { value = 0}; };
|
161
|
+
|
162
|
+
template<typename Scalar,typename IndexType>
|
163
|
+
struct has_nullary_operator<scalar_identity_op<Scalar>,IndexType> { enum { value = 0}; };
|
164
|
+
template<typename Scalar,typename IndexType>
|
165
|
+
struct has_unary_operator<scalar_identity_op<Scalar>,IndexType> { enum { value = 0}; };
|
166
|
+
template<typename Scalar,typename IndexType>
|
167
|
+
struct has_binary_operator<scalar_identity_op<Scalar>,IndexType> { enum { value = 1}; };
|
168
|
+
|
169
|
+
template<typename Scalar, typename PacketType,typename IndexType>
|
170
|
+
struct has_nullary_operator<linspaced_op<Scalar,PacketType>,IndexType> { enum { value = 0}; };
|
171
|
+
template<typename Scalar, typename PacketType,typename IndexType>
|
172
|
+
struct has_unary_operator<linspaced_op<Scalar,PacketType>,IndexType> { enum { value = 1}; };
|
173
|
+
template<typename Scalar, typename PacketType,typename IndexType>
|
174
|
+
struct has_binary_operator<linspaced_op<Scalar,PacketType>,IndexType> { enum { value = 0}; };
|
175
|
+
|
176
|
+
template<typename Scalar,typename IndexType>
|
177
|
+
struct has_nullary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 1}; };
|
178
|
+
template<typename Scalar,typename IndexType>
|
179
|
+
struct has_unary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 0}; };
|
180
|
+
template<typename Scalar,typename IndexType>
|
181
|
+
struct has_binary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 0}; };
|
182
|
+
#endif
|
183
|
+
|
184
|
+
} // end namespace internal
|
185
|
+
|
186
|
+
} // end namespace Eigen
|
187
|
+
|
188
|
+
#endif // EIGEN_NULLARY_FUNCTORS_H
|
@@ -0,0 +1,136 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_STL_FUNCTORS_H
|
11
|
+
#define EIGEN_STL_FUNCTORS_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
// default functor traits for STL functors:
|
18
|
+
|
19
|
+
template<typename T>
|
20
|
+
struct functor_traits<std::multiplies<T> >
|
21
|
+
{ enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
|
22
|
+
|
23
|
+
template<typename T>
|
24
|
+
struct functor_traits<std::divides<T> >
|
25
|
+
{ enum { Cost = NumTraits<T>::MulCost, PacketAccess = false }; };
|
26
|
+
|
27
|
+
template<typename T>
|
28
|
+
struct functor_traits<std::plus<T> >
|
29
|
+
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
|
30
|
+
|
31
|
+
template<typename T>
|
32
|
+
struct functor_traits<std::minus<T> >
|
33
|
+
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
|
34
|
+
|
35
|
+
template<typename T>
|
36
|
+
struct functor_traits<std::negate<T> >
|
37
|
+
{ enum { Cost = NumTraits<T>::AddCost, PacketAccess = false }; };
|
38
|
+
|
39
|
+
template<typename T>
|
40
|
+
struct functor_traits<std::logical_or<T> >
|
41
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
42
|
+
|
43
|
+
template<typename T>
|
44
|
+
struct functor_traits<std::logical_and<T> >
|
45
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
46
|
+
|
47
|
+
template<typename T>
|
48
|
+
struct functor_traits<std::logical_not<T> >
|
49
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
50
|
+
|
51
|
+
template<typename T>
|
52
|
+
struct functor_traits<std::greater<T> >
|
53
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
54
|
+
|
55
|
+
template<typename T>
|
56
|
+
struct functor_traits<std::less<T> >
|
57
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
58
|
+
|
59
|
+
template<typename T>
|
60
|
+
struct functor_traits<std::greater_equal<T> >
|
61
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
62
|
+
|
63
|
+
template<typename T>
|
64
|
+
struct functor_traits<std::less_equal<T> >
|
65
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
66
|
+
|
67
|
+
template<typename T>
|
68
|
+
struct functor_traits<std::equal_to<T> >
|
69
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
70
|
+
|
71
|
+
template<typename T>
|
72
|
+
struct functor_traits<std::not_equal_to<T> >
|
73
|
+
{ enum { Cost = 1, PacketAccess = false }; };
|
74
|
+
|
75
|
+
#if (__cplusplus < 201103L) && (EIGEN_COMP_MSVC <= 1900)
|
76
|
+
// std::binder* are deprecated since c++11 and will be removed in c++17
|
77
|
+
template<typename T>
|
78
|
+
struct functor_traits<std::binder2nd<T> >
|
79
|
+
{ enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
|
80
|
+
|
81
|
+
template<typename T>
|
82
|
+
struct functor_traits<std::binder1st<T> >
|
83
|
+
{ enum { Cost = functor_traits<T>::Cost, PacketAccess = false }; };
|
84
|
+
#endif
|
85
|
+
|
86
|
+
#if (__cplusplus < 201703L) && (EIGEN_COMP_MSVC < 1910)
|
87
|
+
// std::unary_negate is deprecated since c++17 and will be removed in c++20
|
88
|
+
template<typename T>
|
89
|
+
struct functor_traits<std::unary_negate<T> >
|
90
|
+
{ enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
|
91
|
+
|
92
|
+
// std::binary_negate is deprecated since c++17 and will be removed in c++20
|
93
|
+
template<typename T>
|
94
|
+
struct functor_traits<std::binary_negate<T> >
|
95
|
+
{ enum { Cost = 1 + functor_traits<T>::Cost, PacketAccess = false }; };
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#ifdef EIGEN_STDEXT_SUPPORT
|
99
|
+
|
100
|
+
template<typename T0,typename T1>
|
101
|
+
struct functor_traits<std::project1st<T0,T1> >
|
102
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
103
|
+
|
104
|
+
template<typename T0,typename T1>
|
105
|
+
struct functor_traits<std::project2nd<T0,T1> >
|
106
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
107
|
+
|
108
|
+
template<typename T0,typename T1>
|
109
|
+
struct functor_traits<std::select2nd<std::pair<T0,T1> > >
|
110
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
111
|
+
|
112
|
+
template<typename T0,typename T1>
|
113
|
+
struct functor_traits<std::select1st<std::pair<T0,T1> > >
|
114
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
115
|
+
|
116
|
+
template<typename T0,typename T1>
|
117
|
+
struct functor_traits<std::unary_compose<T0,T1> >
|
118
|
+
{ enum { Cost = functor_traits<T0>::Cost + functor_traits<T1>::Cost, PacketAccess = false }; };
|
119
|
+
|
120
|
+
template<typename T0,typename T1,typename T2>
|
121
|
+
struct functor_traits<std::binary_compose<T0,T1,T2> >
|
122
|
+
{ enum { Cost = functor_traits<T0>::Cost + functor_traits<T1>::Cost + functor_traits<T2>::Cost, PacketAccess = false }; };
|
123
|
+
|
124
|
+
#endif // EIGEN_STDEXT_SUPPORT
|
125
|
+
|
126
|
+
// allow to add new functors and specializations of functor_traits from outside Eigen.
|
127
|
+
// this macro is really needed because functor_traits must be specialized after it is declared but before it is used...
|
128
|
+
#ifdef EIGEN_FUNCTORS_PLUGIN
|
129
|
+
#include EIGEN_FUNCTORS_PLUGIN
|
130
|
+
#endif
|
131
|
+
|
132
|
+
} // end namespace internal
|
133
|
+
|
134
|
+
} // end namespace Eigen
|
135
|
+
|
136
|
+
#endif // EIGEN_STL_FUNCTORS_H
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2016 Eugene Brevdo <ebrevdo@gmail.com>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_TERNARY_FUNCTORS_H
|
11
|
+
#define EIGEN_TERNARY_FUNCTORS_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
//---------- associative ternary functors ----------
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
} // end namespace internal
|
22
|
+
|
23
|
+
} // end namespace Eigen
|
24
|
+
|
25
|
+
#endif // EIGEN_TERNARY_FUNCTORS_H
|
@@ -0,0 +1,792 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2016 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_UNARY_FUNCTORS_H
|
11
|
+
#define EIGEN_UNARY_FUNCTORS_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
/** \internal
|
18
|
+
* \brief Template functor to compute the opposite of a scalar
|
19
|
+
*
|
20
|
+
* \sa class CwiseUnaryOp, MatrixBase::operator-
|
21
|
+
*/
|
22
|
+
template<typename Scalar> struct scalar_opposite_op {
|
23
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_opposite_op)
|
24
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; }
|
25
|
+
template<typename Packet>
|
26
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
|
27
|
+
{ return internal::pnegate(a); }
|
28
|
+
};
|
29
|
+
template<typename Scalar>
|
30
|
+
struct functor_traits<scalar_opposite_op<Scalar> >
|
31
|
+
{ enum {
|
32
|
+
Cost = NumTraits<Scalar>::AddCost,
|
33
|
+
PacketAccess = packet_traits<Scalar>::HasNegate };
|
34
|
+
};
|
35
|
+
|
36
|
+
/** \internal
|
37
|
+
* \brief Template functor to compute the absolute value of a scalar
|
38
|
+
*
|
39
|
+
* \sa class CwiseUnaryOp, Cwise::abs
|
40
|
+
*/
|
41
|
+
template<typename Scalar> struct scalar_abs_op {
|
42
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op)
|
43
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
44
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs(a); }
|
45
|
+
template<typename Packet>
|
46
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
|
47
|
+
{ return internal::pabs(a); }
|
48
|
+
};
|
49
|
+
template<typename Scalar>
|
50
|
+
struct functor_traits<scalar_abs_op<Scalar> >
|
51
|
+
{
|
52
|
+
enum {
|
53
|
+
Cost = NumTraits<Scalar>::AddCost,
|
54
|
+
PacketAccess = packet_traits<Scalar>::HasAbs
|
55
|
+
};
|
56
|
+
};
|
57
|
+
|
58
|
+
/** \internal
|
59
|
+
* \brief Template functor to compute the score of a scalar, to chose a pivot
|
60
|
+
*
|
61
|
+
* \sa class CwiseUnaryOp
|
62
|
+
*/
|
63
|
+
template<typename Scalar> struct scalar_score_coeff_op : scalar_abs_op<Scalar>
|
64
|
+
{
|
65
|
+
typedef void Score_is_abs;
|
66
|
+
};
|
67
|
+
template<typename Scalar>
|
68
|
+
struct functor_traits<scalar_score_coeff_op<Scalar> > : functor_traits<scalar_abs_op<Scalar> > {};
|
69
|
+
|
70
|
+
/* Avoid recomputing abs when we know the score and they are the same. Not a true Eigen functor. */
|
71
|
+
template<typename Scalar, typename=void> struct abs_knowing_score
|
72
|
+
{
|
73
|
+
EIGEN_EMPTY_STRUCT_CTOR(abs_knowing_score)
|
74
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
75
|
+
template<typename Score>
|
76
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a, const Score&) const { return numext::abs(a); }
|
77
|
+
};
|
78
|
+
template<typename Scalar> struct abs_knowing_score<Scalar, typename scalar_score_coeff_op<Scalar>::Score_is_abs>
|
79
|
+
{
|
80
|
+
EIGEN_EMPTY_STRUCT_CTOR(abs_knowing_score)
|
81
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
82
|
+
template<typename Scal>
|
83
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scal&, const result_type& a) const { return a; }
|
84
|
+
};
|
85
|
+
|
86
|
+
/** \internal
|
87
|
+
* \brief Template functor to compute the squared absolute value of a scalar
|
88
|
+
*
|
89
|
+
* \sa class CwiseUnaryOp, Cwise::abs2
|
90
|
+
*/
|
91
|
+
template<typename Scalar> struct scalar_abs2_op {
|
92
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op)
|
93
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
94
|
+
EIGEN_DEVICE_FUNC
|
95
|
+
EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs2(a); }
|
96
|
+
template<typename Packet>
|
97
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
|
98
|
+
{ return internal::pmul(a,a); }
|
99
|
+
};
|
100
|
+
template<typename Scalar>
|
101
|
+
struct functor_traits<scalar_abs2_op<Scalar> >
|
102
|
+
{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasAbs2 }; };
|
103
|
+
|
104
|
+
/** \internal
|
105
|
+
* \brief Template functor to compute the conjugate of a complex value
|
106
|
+
*
|
107
|
+
* \sa class CwiseUnaryOp, MatrixBase::conjugate()
|
108
|
+
*/
|
109
|
+
template<typename Scalar> struct scalar_conjugate_op {
|
110
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op)
|
111
|
+
EIGEN_DEVICE_FUNC
|
112
|
+
EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { using numext::conj; return conj(a); }
|
113
|
+
template<typename Packet>
|
114
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); }
|
115
|
+
};
|
116
|
+
template<typename Scalar>
|
117
|
+
struct functor_traits<scalar_conjugate_op<Scalar> >
|
118
|
+
{
|
119
|
+
enum {
|
120
|
+
Cost = NumTraits<Scalar>::IsComplex ? NumTraits<Scalar>::AddCost : 0,
|
121
|
+
PacketAccess = packet_traits<Scalar>::HasConj
|
122
|
+
};
|
123
|
+
};
|
124
|
+
|
125
|
+
/** \internal
|
126
|
+
* \brief Template functor to compute the phase angle of a complex
|
127
|
+
*
|
128
|
+
* \sa class CwiseUnaryOp, Cwise::arg
|
129
|
+
*/
|
130
|
+
template<typename Scalar> struct scalar_arg_op {
|
131
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_arg_op)
|
132
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
133
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { using numext::arg; return arg(a); }
|
134
|
+
template<typename Packet>
|
135
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
|
136
|
+
{ return internal::parg(a); }
|
137
|
+
};
|
138
|
+
template<typename Scalar>
|
139
|
+
struct functor_traits<scalar_arg_op<Scalar> >
|
140
|
+
{
|
141
|
+
enum {
|
142
|
+
Cost = NumTraits<Scalar>::IsComplex ? 5 * NumTraits<Scalar>::MulCost : NumTraits<Scalar>::AddCost,
|
143
|
+
PacketAccess = packet_traits<Scalar>::HasArg
|
144
|
+
};
|
145
|
+
};
|
146
|
+
/** \internal
|
147
|
+
* \brief Template functor to cast a scalar to another type
|
148
|
+
*
|
149
|
+
* \sa class CwiseUnaryOp, MatrixBase::cast()
|
150
|
+
*/
|
151
|
+
template<typename Scalar, typename NewType>
|
152
|
+
struct scalar_cast_op {
|
153
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)
|
154
|
+
typedef NewType result_type;
|
155
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast<Scalar, NewType>(a); }
|
156
|
+
};
|
157
|
+
template<typename Scalar, typename NewType>
|
158
|
+
struct functor_traits<scalar_cast_op<Scalar,NewType> >
|
159
|
+
{ enum { Cost = is_same<Scalar, NewType>::value ? 0 : NumTraits<NewType>::AddCost, PacketAccess = false }; };
|
160
|
+
|
161
|
+
/** \internal
|
162
|
+
* \brief Template functor to extract the real part of a complex
|
163
|
+
*
|
164
|
+
* \sa class CwiseUnaryOp, MatrixBase::real()
|
165
|
+
*/
|
166
|
+
template<typename Scalar>
|
167
|
+
struct scalar_real_op {
|
168
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op)
|
169
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
170
|
+
EIGEN_DEVICE_FUNC
|
171
|
+
EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::real(a); }
|
172
|
+
};
|
173
|
+
template<typename Scalar>
|
174
|
+
struct functor_traits<scalar_real_op<Scalar> >
|
175
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
176
|
+
|
177
|
+
/** \internal
|
178
|
+
* \brief Template functor to extract the imaginary part of a complex
|
179
|
+
*
|
180
|
+
* \sa class CwiseUnaryOp, MatrixBase::imag()
|
181
|
+
*/
|
182
|
+
template<typename Scalar>
|
183
|
+
struct scalar_imag_op {
|
184
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op)
|
185
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
186
|
+
EIGEN_DEVICE_FUNC
|
187
|
+
EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::imag(a); }
|
188
|
+
};
|
189
|
+
template<typename Scalar>
|
190
|
+
struct functor_traits<scalar_imag_op<Scalar> >
|
191
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
192
|
+
|
193
|
+
/** \internal
|
194
|
+
* \brief Template functor to extract the real part of a complex as a reference
|
195
|
+
*
|
196
|
+
* \sa class CwiseUnaryOp, MatrixBase::real()
|
197
|
+
*/
|
198
|
+
template<typename Scalar>
|
199
|
+
struct scalar_real_ref_op {
|
200
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op)
|
201
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
202
|
+
EIGEN_DEVICE_FUNC
|
203
|
+
EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::real_ref(*const_cast<Scalar*>(&a)); }
|
204
|
+
};
|
205
|
+
template<typename Scalar>
|
206
|
+
struct functor_traits<scalar_real_ref_op<Scalar> >
|
207
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
208
|
+
|
209
|
+
/** \internal
|
210
|
+
* \brief Template functor to extract the imaginary part of a complex as a reference
|
211
|
+
*
|
212
|
+
* \sa class CwiseUnaryOp, MatrixBase::imag()
|
213
|
+
*/
|
214
|
+
template<typename Scalar>
|
215
|
+
struct scalar_imag_ref_op {
|
216
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op)
|
217
|
+
typedef typename NumTraits<Scalar>::Real result_type;
|
218
|
+
EIGEN_DEVICE_FUNC
|
219
|
+
EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::imag_ref(*const_cast<Scalar*>(&a)); }
|
220
|
+
};
|
221
|
+
template<typename Scalar>
|
222
|
+
struct functor_traits<scalar_imag_ref_op<Scalar> >
|
223
|
+
{ enum { Cost = 0, PacketAccess = false }; };
|
224
|
+
|
225
|
+
/** \internal
|
226
|
+
*
|
227
|
+
* \brief Template functor to compute the exponential of a scalar
|
228
|
+
*
|
229
|
+
* \sa class CwiseUnaryOp, Cwise::exp()
|
230
|
+
*/
|
231
|
+
template<typename Scalar> struct scalar_exp_op {
|
232
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op)
|
233
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::exp(a); }
|
234
|
+
template <typename Packet>
|
235
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pexp(a); }
|
236
|
+
};
|
237
|
+
template <typename Scalar>
|
238
|
+
struct functor_traits<scalar_exp_op<Scalar> > {
|
239
|
+
enum {
|
240
|
+
PacketAccess = packet_traits<Scalar>::HasExp,
|
241
|
+
// The following numbers are based on the AVX implementation.
|
242
|
+
#ifdef EIGEN_VECTORIZE_FMA
|
243
|
+
// Haswell can issue 2 add/mul/madd per cycle.
|
244
|
+
Cost =
|
245
|
+
(sizeof(Scalar) == 4
|
246
|
+
// float: 8 pmadd, 4 pmul, 2 padd/psub, 6 other
|
247
|
+
? (8 * NumTraits<Scalar>::AddCost + 6 * NumTraits<Scalar>::MulCost)
|
248
|
+
// double: 7 pmadd, 5 pmul, 3 padd/psub, 1 div, 13 other
|
249
|
+
: (14 * NumTraits<Scalar>::AddCost +
|
250
|
+
6 * NumTraits<Scalar>::MulCost +
|
251
|
+
scalar_div_cost<Scalar,packet_traits<Scalar>::HasDiv>::value))
|
252
|
+
#else
|
253
|
+
Cost =
|
254
|
+
(sizeof(Scalar) == 4
|
255
|
+
// float: 7 pmadd, 6 pmul, 4 padd/psub, 10 other
|
256
|
+
? (21 * NumTraits<Scalar>::AddCost + 13 * NumTraits<Scalar>::MulCost)
|
257
|
+
// double: 7 pmadd, 5 pmul, 3 padd/psub, 1 div, 13 other
|
258
|
+
: (23 * NumTraits<Scalar>::AddCost +
|
259
|
+
12 * NumTraits<Scalar>::MulCost +
|
260
|
+
scalar_div_cost<Scalar,packet_traits<Scalar>::HasDiv>::value))
|
261
|
+
#endif
|
262
|
+
};
|
263
|
+
};
|
264
|
+
|
265
|
+
/** \internal
|
266
|
+
*
|
267
|
+
* \brief Template functor to compute the logarithm of a scalar
|
268
|
+
*
|
269
|
+
* \sa class CwiseUnaryOp, ArrayBase::log()
|
270
|
+
*/
|
271
|
+
template<typename Scalar> struct scalar_log_op {
|
272
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op)
|
273
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::log(a); }
|
274
|
+
template <typename Packet>
|
275
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog(a); }
|
276
|
+
};
|
277
|
+
template <typename Scalar>
|
278
|
+
struct functor_traits<scalar_log_op<Scalar> > {
|
279
|
+
enum {
|
280
|
+
PacketAccess = packet_traits<Scalar>::HasLog,
|
281
|
+
Cost =
|
282
|
+
(PacketAccess
|
283
|
+
// The following numbers are based on the AVX implementation.
|
284
|
+
#ifdef EIGEN_VECTORIZE_FMA
|
285
|
+
// 8 pmadd, 6 pmul, 8 padd/psub, 16 other, can issue 2 add/mul/madd per cycle.
|
286
|
+
? (20 * NumTraits<Scalar>::AddCost + 7 * NumTraits<Scalar>::MulCost)
|
287
|
+
#else
|
288
|
+
// 8 pmadd, 6 pmul, 8 padd/psub, 20 other
|
289
|
+
? (36 * NumTraits<Scalar>::AddCost + 14 * NumTraits<Scalar>::MulCost)
|
290
|
+
#endif
|
291
|
+
// Measured cost of std::log.
|
292
|
+
: sizeof(Scalar)==4 ? 40 : 85)
|
293
|
+
};
|
294
|
+
};
|
295
|
+
|
296
|
+
/** \internal
|
297
|
+
*
|
298
|
+
* \brief Template functor to compute the logarithm of 1 plus a scalar value
|
299
|
+
*
|
300
|
+
* \sa class CwiseUnaryOp, ArrayBase::log1p()
|
301
|
+
*/
|
302
|
+
template<typename Scalar> struct scalar_log1p_op {
|
303
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_log1p_op)
|
304
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::log1p(a); }
|
305
|
+
template <typename Packet>
|
306
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog1p(a); }
|
307
|
+
};
|
308
|
+
template <typename Scalar>
|
309
|
+
struct functor_traits<scalar_log1p_op<Scalar> > {
|
310
|
+
enum {
|
311
|
+
PacketAccess = packet_traits<Scalar>::HasLog1p,
|
312
|
+
Cost = functor_traits<scalar_log_op<Scalar> >::Cost // TODO measure cost of log1p
|
313
|
+
};
|
314
|
+
};
|
315
|
+
|
316
|
+
/** \internal
|
317
|
+
*
|
318
|
+
* \brief Template functor to compute the base-10 logarithm of a scalar
|
319
|
+
*
|
320
|
+
* \sa class CwiseUnaryOp, Cwise::log10()
|
321
|
+
*/
|
322
|
+
template<typename Scalar> struct scalar_log10_op {
|
323
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_log10_op)
|
324
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { EIGEN_USING_STD_MATH(log10) return log10(a); }
|
325
|
+
template <typename Packet>
|
326
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog10(a); }
|
327
|
+
};
|
328
|
+
template<typename Scalar>
|
329
|
+
struct functor_traits<scalar_log10_op<Scalar> >
|
330
|
+
{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasLog10 }; };
|
331
|
+
|
332
|
+
/** \internal
|
333
|
+
* \brief Template functor to compute the square root of a scalar
|
334
|
+
* \sa class CwiseUnaryOp, Cwise::sqrt()
|
335
|
+
*/
|
336
|
+
template<typename Scalar> struct scalar_sqrt_op {
|
337
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op)
|
338
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sqrt(a); }
|
339
|
+
template <typename Packet>
|
340
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); }
|
341
|
+
};
|
342
|
+
template <typename Scalar>
|
343
|
+
struct functor_traits<scalar_sqrt_op<Scalar> > {
|
344
|
+
enum {
|
345
|
+
#if EIGEN_FAST_MATH
|
346
|
+
// The following numbers are based on the AVX implementation.
|
347
|
+
Cost = (sizeof(Scalar) == 8 ? 28
|
348
|
+
// 4 pmul, 1 pmadd, 3 other
|
349
|
+
: (3 * NumTraits<Scalar>::AddCost +
|
350
|
+
5 * NumTraits<Scalar>::MulCost)),
|
351
|
+
#else
|
352
|
+
// The following numbers are based on min VSQRT throughput on Haswell.
|
353
|
+
Cost = (sizeof(Scalar) == 8 ? 28 : 14),
|
354
|
+
#endif
|
355
|
+
PacketAccess = packet_traits<Scalar>::HasSqrt
|
356
|
+
};
|
357
|
+
};
|
358
|
+
|
359
|
+
/** \internal
|
360
|
+
* \brief Template functor to compute the reciprocal square root of a scalar
|
361
|
+
* \sa class CwiseUnaryOp, Cwise::rsqrt()
|
362
|
+
*/
|
363
|
+
template<typename Scalar> struct scalar_rsqrt_op {
|
364
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_rsqrt_op)
|
365
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return Scalar(1)/numext::sqrt(a); }
|
366
|
+
template <typename Packet>
|
367
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::prsqrt(a); }
|
368
|
+
};
|
369
|
+
|
370
|
+
template<typename Scalar>
|
371
|
+
struct functor_traits<scalar_rsqrt_op<Scalar> >
|
372
|
+
{ enum {
|
373
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
374
|
+
PacketAccess = packet_traits<Scalar>::HasRsqrt
|
375
|
+
};
|
376
|
+
};
|
377
|
+
|
378
|
+
/** \internal
|
379
|
+
* \brief Template functor to compute the cosine of a scalar
|
380
|
+
* \sa class CwiseUnaryOp, ArrayBase::cos()
|
381
|
+
*/
|
382
|
+
template<typename Scalar> struct scalar_cos_op {
|
383
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op)
|
384
|
+
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return numext::cos(a); }
|
385
|
+
template <typename Packet>
|
386
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pcos(a); }
|
387
|
+
};
|
388
|
+
template<typename Scalar>
|
389
|
+
struct functor_traits<scalar_cos_op<Scalar> >
|
390
|
+
{
|
391
|
+
enum {
|
392
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
393
|
+
PacketAccess = packet_traits<Scalar>::HasCos
|
394
|
+
};
|
395
|
+
};
|
396
|
+
|
397
|
+
/** \internal
|
398
|
+
* \brief Template functor to compute the sine of a scalar
|
399
|
+
* \sa class CwiseUnaryOp, ArrayBase::sin()
|
400
|
+
*/
|
401
|
+
template<typename Scalar> struct scalar_sin_op {
|
402
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op)
|
403
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sin(a); }
|
404
|
+
template <typename Packet>
|
405
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psin(a); }
|
406
|
+
};
|
407
|
+
template<typename Scalar>
|
408
|
+
struct functor_traits<scalar_sin_op<Scalar> >
|
409
|
+
{
|
410
|
+
enum {
|
411
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
412
|
+
PacketAccess = packet_traits<Scalar>::HasSin
|
413
|
+
};
|
414
|
+
};
|
415
|
+
|
416
|
+
|
417
|
+
/** \internal
|
418
|
+
* \brief Template functor to compute the tan of a scalar
|
419
|
+
* \sa class CwiseUnaryOp, ArrayBase::tan()
|
420
|
+
*/
|
421
|
+
template<typename Scalar> struct scalar_tan_op {
|
422
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op)
|
423
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::tan(a); }
|
424
|
+
template <typename Packet>
|
425
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::ptan(a); }
|
426
|
+
};
|
427
|
+
template<typename Scalar>
|
428
|
+
struct functor_traits<scalar_tan_op<Scalar> >
|
429
|
+
{
|
430
|
+
enum {
|
431
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
432
|
+
PacketAccess = packet_traits<Scalar>::HasTan
|
433
|
+
};
|
434
|
+
};
|
435
|
+
|
436
|
+
/** \internal
|
437
|
+
* \brief Template functor to compute the arc cosine of a scalar
|
438
|
+
* \sa class CwiseUnaryOp, ArrayBase::acos()
|
439
|
+
*/
|
440
|
+
template<typename Scalar> struct scalar_acos_op {
|
441
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op)
|
442
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::acos(a); }
|
443
|
+
template <typename Packet>
|
444
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pacos(a); }
|
445
|
+
};
|
446
|
+
template<typename Scalar>
|
447
|
+
struct functor_traits<scalar_acos_op<Scalar> >
|
448
|
+
{
|
449
|
+
enum {
|
450
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
451
|
+
PacketAccess = packet_traits<Scalar>::HasACos
|
452
|
+
};
|
453
|
+
};
|
454
|
+
|
455
|
+
/** \internal
|
456
|
+
* \brief Template functor to compute the arc sine of a scalar
|
457
|
+
* \sa class CwiseUnaryOp, ArrayBase::asin()
|
458
|
+
*/
|
459
|
+
template<typename Scalar> struct scalar_asin_op {
|
460
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op)
|
461
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::asin(a); }
|
462
|
+
template <typename Packet>
|
463
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pasin(a); }
|
464
|
+
};
|
465
|
+
template<typename Scalar>
|
466
|
+
struct functor_traits<scalar_asin_op<Scalar> >
|
467
|
+
{
|
468
|
+
enum {
|
469
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
470
|
+
PacketAccess = packet_traits<Scalar>::HasASin
|
471
|
+
};
|
472
|
+
};
|
473
|
+
|
474
|
+
|
475
|
+
/** \internal
|
476
|
+
* \brief Template functor to compute the atan of a scalar
|
477
|
+
* \sa class CwiseUnaryOp, ArrayBase::atan()
|
478
|
+
*/
|
479
|
+
template<typename Scalar> struct scalar_atan_op {
|
480
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_atan_op)
|
481
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::atan(a); }
|
482
|
+
template <typename Packet>
|
483
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::patan(a); }
|
484
|
+
};
|
485
|
+
template<typename Scalar>
|
486
|
+
struct functor_traits<scalar_atan_op<Scalar> >
|
487
|
+
{
|
488
|
+
enum {
|
489
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
490
|
+
PacketAccess = packet_traits<Scalar>::HasATan
|
491
|
+
};
|
492
|
+
};
|
493
|
+
|
494
|
+
/** \internal
|
495
|
+
* \brief Template functor to compute the tanh of a scalar
|
496
|
+
* \sa class CwiseUnaryOp, ArrayBase::tanh()
|
497
|
+
*/
|
498
|
+
template <typename Scalar>
|
499
|
+
struct scalar_tanh_op {
|
500
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_tanh_op)
|
501
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::tanh(a); }
|
502
|
+
template <typename Packet>
|
503
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& x) const { return ptanh(x); }
|
504
|
+
};
|
505
|
+
|
506
|
+
template <typename Scalar>
|
507
|
+
struct functor_traits<scalar_tanh_op<Scalar> > {
|
508
|
+
enum {
|
509
|
+
PacketAccess = packet_traits<Scalar>::HasTanh,
|
510
|
+
Cost = ( (EIGEN_FAST_MATH && is_same<Scalar,float>::value)
|
511
|
+
// The following numbers are based on the AVX implementation,
|
512
|
+
#ifdef EIGEN_VECTORIZE_FMA
|
513
|
+
// Haswell can issue 2 add/mul/madd per cycle.
|
514
|
+
// 9 pmadd, 2 pmul, 1 div, 2 other
|
515
|
+
? (2 * NumTraits<Scalar>::AddCost +
|
516
|
+
6 * NumTraits<Scalar>::MulCost +
|
517
|
+
scalar_div_cost<Scalar,packet_traits<Scalar>::HasDiv>::value)
|
518
|
+
#else
|
519
|
+
? (11 * NumTraits<Scalar>::AddCost +
|
520
|
+
11 * NumTraits<Scalar>::MulCost +
|
521
|
+
scalar_div_cost<Scalar,packet_traits<Scalar>::HasDiv>::value)
|
522
|
+
#endif
|
523
|
+
// This number assumes a naive implementation of tanh
|
524
|
+
: (6 * NumTraits<Scalar>::AddCost +
|
525
|
+
3 * NumTraits<Scalar>::MulCost +
|
526
|
+
2 * scalar_div_cost<Scalar,packet_traits<Scalar>::HasDiv>::value +
|
527
|
+
functor_traits<scalar_exp_op<Scalar> >::Cost))
|
528
|
+
};
|
529
|
+
};
|
530
|
+
|
531
|
+
/** \internal
|
532
|
+
* \brief Template functor to compute the sinh of a scalar
|
533
|
+
* \sa class CwiseUnaryOp, ArrayBase::sinh()
|
534
|
+
*/
|
535
|
+
template<typename Scalar> struct scalar_sinh_op {
|
536
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_sinh_op)
|
537
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::sinh(a); }
|
538
|
+
template <typename Packet>
|
539
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psinh(a); }
|
540
|
+
};
|
541
|
+
template<typename Scalar>
|
542
|
+
struct functor_traits<scalar_sinh_op<Scalar> >
|
543
|
+
{
|
544
|
+
enum {
|
545
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
546
|
+
PacketAccess = packet_traits<Scalar>::HasSinh
|
547
|
+
};
|
548
|
+
};
|
549
|
+
|
550
|
+
/** \internal
|
551
|
+
* \brief Template functor to compute the cosh of a scalar
|
552
|
+
* \sa class CwiseUnaryOp, ArrayBase::cosh()
|
553
|
+
*/
|
554
|
+
template<typename Scalar> struct scalar_cosh_op {
|
555
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_cosh_op)
|
556
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::cosh(a); }
|
557
|
+
template <typename Packet>
|
558
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pcosh(a); }
|
559
|
+
};
|
560
|
+
template<typename Scalar>
|
561
|
+
struct functor_traits<scalar_cosh_op<Scalar> >
|
562
|
+
{
|
563
|
+
enum {
|
564
|
+
Cost = 5 * NumTraits<Scalar>::MulCost,
|
565
|
+
PacketAccess = packet_traits<Scalar>::HasCosh
|
566
|
+
};
|
567
|
+
};
|
568
|
+
|
569
|
+
/** \internal
|
570
|
+
* \brief Template functor to compute the inverse of a scalar
|
571
|
+
* \sa class CwiseUnaryOp, Cwise::inverse()
|
572
|
+
*/
|
573
|
+
template<typename Scalar>
|
574
|
+
struct scalar_inverse_op {
|
575
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_inverse_op)
|
576
|
+
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; }
|
577
|
+
template<typename Packet>
|
578
|
+
EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
|
579
|
+
{ return internal::pdiv(pset1<Packet>(Scalar(1)),a); }
|
580
|
+
};
|
581
|
+
template<typename Scalar>
|
582
|
+
struct functor_traits<scalar_inverse_op<Scalar> >
|
583
|
+
{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasDiv }; };
|
584
|
+
|
585
|
+
/** \internal
|
586
|
+
* \brief Template functor to compute the square of a scalar
|
587
|
+
* \sa class CwiseUnaryOp, Cwise::square()
|
588
|
+
*/
|
589
|
+
template<typename Scalar>
|
590
|
+
struct scalar_square_op {
|
591
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_square_op)
|
592
|
+
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return a*a; }
|
593
|
+
template<typename Packet>
|
594
|
+
EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
|
595
|
+
{ return internal::pmul(a,a); }
|
596
|
+
};
|
597
|
+
template<typename Scalar>
|
598
|
+
struct functor_traits<scalar_square_op<Scalar> >
|
599
|
+
{ enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
|
600
|
+
|
601
|
+
/** \internal
|
602
|
+
* \brief Template functor to compute the cube of a scalar
|
603
|
+
* \sa class CwiseUnaryOp, Cwise::cube()
|
604
|
+
*/
|
605
|
+
template<typename Scalar>
|
606
|
+
struct scalar_cube_op {
|
607
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_cube_op)
|
608
|
+
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return a*a*a; }
|
609
|
+
template<typename Packet>
|
610
|
+
EIGEN_DEVICE_FUNC inline const Packet packetOp(const Packet& a) const
|
611
|
+
{ return internal::pmul(a,pmul(a,a)); }
|
612
|
+
};
|
613
|
+
template<typename Scalar>
|
614
|
+
struct functor_traits<scalar_cube_op<Scalar> >
|
615
|
+
{ enum { Cost = 2*NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasMul }; };
|
616
|
+
|
617
|
+
/** \internal
|
618
|
+
* \brief Template functor to compute the rounded value of a scalar
|
619
|
+
* \sa class CwiseUnaryOp, ArrayBase::round()
|
620
|
+
*/
|
621
|
+
template<typename Scalar> struct scalar_round_op {
|
622
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_round_op)
|
623
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::round(a); }
|
624
|
+
template <typename Packet>
|
625
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pround(a); }
|
626
|
+
};
|
627
|
+
template<typename Scalar>
|
628
|
+
struct functor_traits<scalar_round_op<Scalar> >
|
629
|
+
{
|
630
|
+
enum {
|
631
|
+
Cost = NumTraits<Scalar>::MulCost,
|
632
|
+
PacketAccess = packet_traits<Scalar>::HasRound
|
633
|
+
};
|
634
|
+
};
|
635
|
+
|
636
|
+
/** \internal
|
637
|
+
* \brief Template functor to compute the floor of a scalar
|
638
|
+
* \sa class CwiseUnaryOp, ArrayBase::floor()
|
639
|
+
*/
|
640
|
+
template<typename Scalar> struct scalar_floor_op {
|
641
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_floor_op)
|
642
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::floor(a); }
|
643
|
+
template <typename Packet>
|
644
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pfloor(a); }
|
645
|
+
};
|
646
|
+
template<typename Scalar>
|
647
|
+
struct functor_traits<scalar_floor_op<Scalar> >
|
648
|
+
{
|
649
|
+
enum {
|
650
|
+
Cost = NumTraits<Scalar>::MulCost,
|
651
|
+
PacketAccess = packet_traits<Scalar>::HasFloor
|
652
|
+
};
|
653
|
+
};
|
654
|
+
|
655
|
+
/** \internal
|
656
|
+
* \brief Template functor to compute the ceil of a scalar
|
657
|
+
* \sa class CwiseUnaryOp, ArrayBase::ceil()
|
658
|
+
*/
|
659
|
+
template<typename Scalar> struct scalar_ceil_op {
|
660
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_ceil_op)
|
661
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return numext::ceil(a); }
|
662
|
+
template <typename Packet>
|
663
|
+
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pceil(a); }
|
664
|
+
};
|
665
|
+
template<typename Scalar>
|
666
|
+
struct functor_traits<scalar_ceil_op<Scalar> >
|
667
|
+
{
|
668
|
+
enum {
|
669
|
+
Cost = NumTraits<Scalar>::MulCost,
|
670
|
+
PacketAccess = packet_traits<Scalar>::HasCeil
|
671
|
+
};
|
672
|
+
};
|
673
|
+
|
674
|
+
/** \internal
|
675
|
+
* \brief Template functor to compute whether a scalar is NaN
|
676
|
+
* \sa class CwiseUnaryOp, ArrayBase::isnan()
|
677
|
+
*/
|
678
|
+
template<typename Scalar> struct scalar_isnan_op {
|
679
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_isnan_op)
|
680
|
+
typedef bool result_type;
|
681
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isnan)(a); }
|
682
|
+
};
|
683
|
+
template<typename Scalar>
|
684
|
+
struct functor_traits<scalar_isnan_op<Scalar> >
|
685
|
+
{
|
686
|
+
enum {
|
687
|
+
Cost = NumTraits<Scalar>::MulCost,
|
688
|
+
PacketAccess = false
|
689
|
+
};
|
690
|
+
};
|
691
|
+
|
692
|
+
/** \internal
|
693
|
+
* \brief Template functor to check whether a scalar is +/-inf
|
694
|
+
* \sa class CwiseUnaryOp, ArrayBase::isinf()
|
695
|
+
*/
|
696
|
+
template<typename Scalar> struct scalar_isinf_op {
|
697
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_isinf_op)
|
698
|
+
typedef bool result_type;
|
699
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isinf)(a); }
|
700
|
+
};
|
701
|
+
template<typename Scalar>
|
702
|
+
struct functor_traits<scalar_isinf_op<Scalar> >
|
703
|
+
{
|
704
|
+
enum {
|
705
|
+
Cost = NumTraits<Scalar>::MulCost,
|
706
|
+
PacketAccess = false
|
707
|
+
};
|
708
|
+
};
|
709
|
+
|
710
|
+
/** \internal
|
711
|
+
* \brief Template functor to check whether a scalar has a finite value
|
712
|
+
* \sa class CwiseUnaryOp, ArrayBase::isfinite()
|
713
|
+
*/
|
714
|
+
template<typename Scalar> struct scalar_isfinite_op {
|
715
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_isfinite_op)
|
716
|
+
typedef bool result_type;
|
717
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isfinite)(a); }
|
718
|
+
};
|
719
|
+
template<typename Scalar>
|
720
|
+
struct functor_traits<scalar_isfinite_op<Scalar> >
|
721
|
+
{
|
722
|
+
enum {
|
723
|
+
Cost = NumTraits<Scalar>::MulCost,
|
724
|
+
PacketAccess = false
|
725
|
+
};
|
726
|
+
};
|
727
|
+
|
728
|
+
/** \internal
|
729
|
+
* \brief Template functor to compute the logical not of a boolean
|
730
|
+
*
|
731
|
+
* \sa class CwiseUnaryOp, ArrayBase::operator!
|
732
|
+
*/
|
733
|
+
template<typename Scalar> struct scalar_boolean_not_op {
|
734
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_not_op)
|
735
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator() (const bool& a) const { return !a; }
|
736
|
+
};
|
737
|
+
template<typename Scalar>
|
738
|
+
struct functor_traits<scalar_boolean_not_op<Scalar> > {
|
739
|
+
enum {
|
740
|
+
Cost = NumTraits<bool>::AddCost,
|
741
|
+
PacketAccess = false
|
742
|
+
};
|
743
|
+
};
|
744
|
+
|
745
|
+
/** \internal
|
746
|
+
* \brief Template functor to compute the signum of a scalar
|
747
|
+
* \sa class CwiseUnaryOp, Cwise::sign()
|
748
|
+
*/
|
749
|
+
template<typename Scalar,bool iscpx=(NumTraits<Scalar>::IsComplex!=0) > struct scalar_sign_op;
|
750
|
+
template<typename Scalar>
|
751
|
+
struct scalar_sign_op<Scalar,false> {
|
752
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_sign_op)
|
753
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const
|
754
|
+
{
|
755
|
+
return Scalar( (a>Scalar(0)) - (a<Scalar(0)) );
|
756
|
+
}
|
757
|
+
//TODO
|
758
|
+
//template <typename Packet>
|
759
|
+
//EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psign(a); }
|
760
|
+
};
|
761
|
+
template<typename Scalar>
|
762
|
+
struct scalar_sign_op<Scalar,true> {
|
763
|
+
EIGEN_EMPTY_STRUCT_CTOR(scalar_sign_op)
|
764
|
+
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const
|
765
|
+
{
|
766
|
+
typedef typename NumTraits<Scalar>::Real real_type;
|
767
|
+
real_type aa = numext::abs(a);
|
768
|
+
if (aa==real_type(0))
|
769
|
+
return Scalar(0);
|
770
|
+
aa = real_type(1)/aa;
|
771
|
+
return Scalar(real(a)*aa, imag(a)*aa );
|
772
|
+
}
|
773
|
+
//TODO
|
774
|
+
//template <typename Packet>
|
775
|
+
//EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::psign(a); }
|
776
|
+
};
|
777
|
+
template<typename Scalar>
|
778
|
+
struct functor_traits<scalar_sign_op<Scalar> >
|
779
|
+
{ enum {
|
780
|
+
Cost =
|
781
|
+
NumTraits<Scalar>::IsComplex
|
782
|
+
? ( 8*NumTraits<Scalar>::MulCost ) // roughly
|
783
|
+
: ( 3*NumTraits<Scalar>::AddCost),
|
784
|
+
PacketAccess = packet_traits<Scalar>::HasSign
|
785
|
+
};
|
786
|
+
};
|
787
|
+
|
788
|
+
} // end namespace internal
|
789
|
+
|
790
|
+
} // end namespace Eigen
|
791
|
+
|
792
|
+
#endif // EIGEN_FUNCTORS_H
|