@smake/eigen 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eigen/COPYING.APACHE +203 -0
- package/eigen/COPYING.BSD +26 -0
- package/eigen/COPYING.GPL +674 -0
- package/eigen/COPYING.LGPL +502 -0
- package/eigen/COPYING.MINPACK +51 -0
- package/eigen/COPYING.MPL2 +373 -0
- package/eigen/COPYING.README +18 -0
- package/eigen/Eigen/Cholesky +0 -1
- package/eigen/Eigen/Core +108 -266
- package/eigen/Eigen/Eigenvalues +0 -1
- package/eigen/Eigen/Geometry +3 -6
- package/eigen/Eigen/Householder +0 -1
- package/eigen/Eigen/Jacobi +0 -1
- package/eigen/Eigen/KLUSupport +41 -0
- package/eigen/Eigen/LU +2 -5
- package/eigen/Eigen/OrderingMethods +0 -3
- package/eigen/Eigen/PaStiXSupport +1 -0
- package/eigen/Eigen/PardisoSupport +0 -0
- package/eigen/Eigen/QR +0 -1
- package/eigen/Eigen/QtAlignedMalloc +0 -1
- package/eigen/Eigen/SVD +0 -1
- package/eigen/Eigen/Sparse +0 -2
- package/eigen/Eigen/SparseCholesky +0 -8
- package/eigen/Eigen/SparseLU +4 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
- package/eigen/Eigen/src/Cholesky/LLT.h +39 -23
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
- package/eigen/Eigen/src/Core/Array.h +99 -11
- package/eigen/Eigen/src/Core/ArrayBase.h +1 -1
- package/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
- package/eigen/Eigen/src/Core/Assign.h +1 -1
- package/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
- package/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
- package/eigen/Eigen/src/Core/BandMatrix.h +16 -16
- package/eigen/Eigen/src/Core/Block.h +56 -60
- package/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
- package/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
- package/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
- package/eigen/Eigen/src/Core/CoreIterators.h +5 -0
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +12 -10
- package/eigen/Eigen/src/Core/DenseBase.h +128 -39
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
- package/eigen/Eigen/src/Core/DenseStorage.h +150 -68
- package/eigen/Eigen/src/Core/Diagonal.h +21 -23
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
- package/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
- package/eigen/Eigen/src/Core/Dot.h +10 -10
- package/eigen/Eigen/src/Core/EigenBase.h +10 -9
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
- package/eigen/Eigen/src/Core/Fuzzy.h +3 -3
- package/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
- package/eigen/Eigen/src/Core/GenericPacketMath.h +597 -147
- package/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
- package/eigen/Eigen/src/Core/IO.h +40 -7
- package/eigen/Eigen/src/Core/IndexedView.h +237 -0
- package/eigen/Eigen/src/Core/Inverse.h +9 -10
- package/eigen/Eigen/src/Core/Map.h +7 -7
- package/eigen/Eigen/src/Core/MapBase.h +5 -3
- package/eigen/Eigen/src/Core/MathFunctions.h +756 -120
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
- package/eigen/Eigen/src/Core/Matrix.h +131 -25
- package/eigen/Eigen/src/Core/MatrixBase.h +19 -2
- package/eigen/Eigen/src/Core/NestByValue.h +25 -50
- package/eigen/Eigen/src/Core/NoAlias.h +4 -3
- package/eigen/Eigen/src/Core/NumTraits.h +107 -20
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- package/eigen/Eigen/src/Core/PermutationMatrix.h +3 -3
- package/eigen/Eigen/src/Core/PlainObjectBase.h +145 -54
- package/eigen/Eigen/src/Core/Product.h +30 -25
- package/eigen/Eigen/src/Core/ProductEvaluators.h +183 -142
- package/eigen/Eigen/src/Core/Random.h +37 -1
- package/eigen/Eigen/src/Core/Redux.h +180 -170
- package/eigen/Eigen/src/Core/Ref.h +118 -21
- package/eigen/Eigen/src/Core/Replicate.h +8 -8
- package/eigen/Eigen/src/Core/Reshaped.h +454 -0
- package/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
- package/eigen/Eigen/src/Core/Reverse.h +18 -12
- package/eigen/Eigen/src/Core/Select.h +8 -6
- package/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
- package/eigen/Eigen/src/Core/Solve.h +14 -14
- package/eigen/Eigen/src/Core/SolveTriangular.h +13 -13
- package/eigen/Eigen/src/Core/SolverBase.h +41 -3
- package/eigen/Eigen/src/Core/StableNorm.h +100 -70
- package/eigen/Eigen/src/Core/StlIterators.h +463 -0
- package/eigen/Eigen/src/Core/Stride.h +9 -4
- package/eigen/Eigen/src/Core/Swap.h +5 -4
- package/eigen/Eigen/src/Core/Transpose.h +86 -27
- package/eigen/Eigen/src/Core/Transpositions.h +26 -8
- package/eigen/Eigen/src/Core/TriangularMatrix.h +88 -72
- package/eigen/Eigen/src/Core/VectorBlock.h +5 -5
- package/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
- package/eigen/Eigen/src/Core/Visitor.h +137 -29
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +186 -213
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1250 -252
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- package/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
- package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- package/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +354 -15
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1073 -585
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +29 -7
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +4 -4
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +1 -1
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
- package/eigen/Eigen/src/Core/products/Parallelizer.h +23 -9
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +23 -6
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +2 -2
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +3 -3
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +5 -3
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
- package/eigen/Eigen/src/Core/util/BlasUtil.h +208 -124
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- package/eigen/Eigen/src/Core/util/Constants.h +25 -9
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +14 -2
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +28 -4
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
- package/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
- package/eigen/Eigen/src/Core/util/Macros.h +661 -250
- package/eigen/Eigen/src/Core/util/Memory.h +222 -52
- package/eigen/Eigen/src/Core/util/Meta.h +349 -105
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- package/eigen/Eigen/src/Core/util/XprHelper.h +48 -30
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +10 -5
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +75 -42
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
- package/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
- package/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
- package/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
- package/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
- package/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
- package/eigen/Eigen/src/Geometry/Quaternion.h +52 -14
- package/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
- package/eigen/Eigen/src/Geometry/Scaling.h +22 -4
- package/eigen/Eigen/src/Geometry/Transform.h +86 -65
- package/eigen/Eigen/src/Geometry/Translation.h +6 -6
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
- package/eigen/Eigen/src/Householder/Householder.h +8 -4
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
- package/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- package/eigen/Eigen/src/LU/Determinant.h +35 -19
- package/eigen/Eigen/src/LU/FullPivLU.h +29 -43
- package/eigen/Eigen/src/LU/InverseImpl.h +25 -8
- package/eigen/Eigen/src/LU/PartialPivLU.h +67 -57
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
- package/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +10 -9
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
- package/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
- package/eigen/Eigen/src/SVD/BDCSVD.h +137 -48
- package/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
- package/eigen/Eigen/src/SVD/SVDBase.h +82 -21
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +16 -8
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +11 -36
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +2 -2
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +124 -10
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
- package/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
- package/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU.h +160 -10
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
- package/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
- package/eigen/Eigen/src/StlSupport/StdDeque.h +2 -14
- package/eigen/Eigen/src/StlSupport/StdList.h +2 -2
- package/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
- package/eigen/Eigen/src/misc/lapacke.h +5 -4
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +27 -1
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
- package/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
- package/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
- package/eigen/README.md +5 -0
- package/lib/LibEigen.d.ts +4 -0
- package/lib/LibEigen.js +14 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -3
- package/package.json +2 -10
- package/eigen/Eigen/CMakeLists.txt +0 -19
- package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
- package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
- package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
- package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
- package/lib/eigen.d.ts +0 -2
- package/lib/eigen.js +0 -15
|
@@ -11,13 +11,54 @@
|
|
|
11
11
|
#ifndef EIGEN_META_H
|
|
12
12
|
#define EIGEN_META_H
|
|
13
13
|
|
|
14
|
-
#if defined(
|
|
15
|
-
|
|
16
|
-
#include <
|
|
14
|
+
#if defined(EIGEN_GPU_COMPILE_PHASE)
|
|
15
|
+
|
|
16
|
+
#include <cfloat>
|
|
17
|
+
|
|
18
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
19
|
+
#include <math_constants.h>
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#if defined(EIGEN_HIP_DEVICE_COMPILE)
|
|
23
|
+
#include "Eigen/src/Core/arch/HIP/hcc/math_constants.h"
|
|
24
|
+
#endif
|
|
25
|
+
|
|
17
26
|
#endif
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
// Recent versions of ICC require <cstdint> for pointer types below.
|
|
29
|
+
#define EIGEN_ICC_NEEDS_CSTDINT (EIGEN_COMP_ICC>=1600 && EIGEN_COMP_CXXVER >= 11)
|
|
30
|
+
|
|
31
|
+
// Define portable (u)int{32,64} types
|
|
32
|
+
#if EIGEN_HAS_CXX11 || EIGEN_ICC_NEEDS_CSTDINT
|
|
20
33
|
#include <cstdint>
|
|
34
|
+
namespace Eigen {
|
|
35
|
+
namespace numext {
|
|
36
|
+
typedef std::uint8_t uint8_t;
|
|
37
|
+
typedef std::int8_t int8_t;
|
|
38
|
+
typedef std::uint16_t uint16_t;
|
|
39
|
+
typedef std::int16_t int16_t;
|
|
40
|
+
typedef std::uint32_t uint32_t;
|
|
41
|
+
typedef std::int32_t int32_t;
|
|
42
|
+
typedef std::uint64_t uint64_t;
|
|
43
|
+
typedef std::int64_t int64_t;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
#else
|
|
47
|
+
// Without c++11, all compilers able to compile Eigen also
|
|
48
|
+
// provide the C99 stdint.h header file.
|
|
49
|
+
#include <stdint.h>
|
|
50
|
+
namespace Eigen {
|
|
51
|
+
namespace numext {
|
|
52
|
+
typedef ::uint8_t uint8_t;
|
|
53
|
+
typedef ::int8_t int8_t;
|
|
54
|
+
typedef ::uint16_t uint16_t;
|
|
55
|
+
typedef ::int16_t int16_t;
|
|
56
|
+
typedef ::uint32_t uint32_t;
|
|
57
|
+
typedef ::int32_t int32_t;
|
|
58
|
+
typedef ::uint64_t uint64_t;
|
|
59
|
+
typedef ::int64_t int64_t;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
21
62
|
#endif
|
|
22
63
|
|
|
23
64
|
namespace Eigen {
|
|
@@ -43,26 +84,33 @@ namespace internal {
|
|
|
43
84
|
|
|
44
85
|
// Only recent versions of ICC complain about using ptrdiff_t to hold pointers,
|
|
45
86
|
// and older versions do not provide *intptr_t types.
|
|
46
|
-
#if
|
|
87
|
+
#if EIGEN_ICC_NEEDS_CSTDINT
|
|
47
88
|
typedef std::intptr_t IntPtr;
|
|
48
89
|
typedef std::uintptr_t UIntPtr;
|
|
49
90
|
#else
|
|
50
91
|
typedef std::ptrdiff_t IntPtr;
|
|
51
92
|
typedef std::size_t UIntPtr;
|
|
52
93
|
#endif
|
|
94
|
+
#undef EIGEN_ICC_NEEDS_CSTDINT
|
|
53
95
|
|
|
54
96
|
struct true_type { enum { value = 1 }; };
|
|
55
97
|
struct false_type { enum { value = 0 }; };
|
|
56
98
|
|
|
99
|
+
template<bool Condition>
|
|
100
|
+
struct bool_constant;
|
|
101
|
+
|
|
102
|
+
template<>
|
|
103
|
+
struct bool_constant<true> : true_type {};
|
|
104
|
+
|
|
105
|
+
template<>
|
|
106
|
+
struct bool_constant<false> : false_type {};
|
|
107
|
+
|
|
57
108
|
template<bool Condition, typename Then, typename Else>
|
|
58
109
|
struct conditional { typedef Then type; };
|
|
59
110
|
|
|
60
111
|
template<typename Then, typename Else>
|
|
61
112
|
struct conditional <false, Then, Else> { typedef Else type; };
|
|
62
113
|
|
|
63
|
-
template<typename T, typename U> struct is_same { enum { value = 0 }; };
|
|
64
|
-
template<typename T> struct is_same<T,T> { enum { value = 1 }; };
|
|
65
|
-
|
|
66
114
|
template<typename T> struct remove_reference { typedef T type; };
|
|
67
115
|
template<typename T> struct remove_reference<T&> { typedef T type; };
|
|
68
116
|
|
|
@@ -97,23 +145,31 @@ template<> struct is_arithmetic<unsigned int> { enum { value = true }; };
|
|
|
97
145
|
template<> struct is_arithmetic<signed long> { enum { value = true }; };
|
|
98
146
|
template<> struct is_arithmetic<unsigned long> { enum { value = true }; };
|
|
99
147
|
|
|
148
|
+
template<typename T, typename U> struct is_same { enum { value = 0 }; };
|
|
149
|
+
template<typename T> struct is_same<T,T> { enum { value = 1 }; };
|
|
150
|
+
|
|
151
|
+
template< class T >
|
|
152
|
+
struct is_void : is_same<void, typename remove_const<T>::type> {};
|
|
153
|
+
|
|
100
154
|
#if EIGEN_HAS_CXX11
|
|
155
|
+
template<> struct is_arithmetic<signed long long> { enum { value = true }; };
|
|
156
|
+
template<> struct is_arithmetic<unsigned long long> { enum { value = true }; };
|
|
101
157
|
using std::is_integral;
|
|
102
158
|
#else
|
|
103
|
-
template<typename T> struct is_integral
|
|
104
|
-
template<> struct is_integral<bool>
|
|
105
|
-
template<> struct is_integral<char>
|
|
106
|
-
template<> struct is_integral<signed char>
|
|
107
|
-
template<> struct is_integral<unsigned char>
|
|
108
|
-
template<> struct is_integral<signed short>
|
|
109
|
-
template<> struct is_integral<unsigned short>
|
|
110
|
-
template<> struct is_integral<signed int>
|
|
111
|
-
template<> struct is_integral<unsigned int>
|
|
112
|
-
template<> struct is_integral<signed long>
|
|
113
|
-
template<> struct is_integral<unsigned long>
|
|
159
|
+
template<typename T> struct is_integral { enum { value = false }; };
|
|
160
|
+
template<> struct is_integral<bool> { enum { value = true }; };
|
|
161
|
+
template<> struct is_integral<char> { enum { value = true }; };
|
|
162
|
+
template<> struct is_integral<signed char> { enum { value = true }; };
|
|
163
|
+
template<> struct is_integral<unsigned char> { enum { value = true }; };
|
|
164
|
+
template<> struct is_integral<signed short> { enum { value = true }; };
|
|
165
|
+
template<> struct is_integral<unsigned short> { enum { value = true }; };
|
|
166
|
+
template<> struct is_integral<signed int> { enum { value = true }; };
|
|
167
|
+
template<> struct is_integral<unsigned int> { enum { value = true }; };
|
|
168
|
+
template<> struct is_integral<signed long> { enum { value = true }; };
|
|
169
|
+
template<> struct is_integral<unsigned long> { enum { value = true }; };
|
|
114
170
|
#if EIGEN_COMP_MSVC
|
|
115
|
-
template<> struct is_integral<signed __int64>
|
|
116
|
-
template<> struct is_integral<unsigned __int64>{ enum { value = true }; };
|
|
171
|
+
template<> struct is_integral<signed __int64> { enum { value = true }; };
|
|
172
|
+
template<> struct is_integral<unsigned __int64> { enum { value = true }; };
|
|
117
173
|
#endif
|
|
118
174
|
#endif
|
|
119
175
|
|
|
@@ -137,6 +193,16 @@ template<> struct make_unsigned<unsigned long> { typedef unsigned long type;
|
|
|
137
193
|
template<> struct make_unsigned<signed __int64> { typedef unsigned __int64 type; };
|
|
138
194
|
template<> struct make_unsigned<unsigned __int64> { typedef unsigned __int64 type; };
|
|
139
195
|
#endif
|
|
196
|
+
|
|
197
|
+
// Some platforms define int64_t as `long long` even for C++03, where
|
|
198
|
+
// `long long` is not guaranteed by the standard. In this case we are missing
|
|
199
|
+
// the definition for make_unsigned. If we just define it, we run into issues
|
|
200
|
+
// where `long long` doesn't exist in some compilers for C++03. We therefore add
|
|
201
|
+
// the specialization for these platforms only.
|
|
202
|
+
#if EIGEN_OS_MAC || EIGEN_COMP_MINGW
|
|
203
|
+
template<> struct make_unsigned<unsigned long long> { typedef unsigned long long type; };
|
|
204
|
+
template<> struct make_unsigned<long long> { typedef unsigned long long type; };
|
|
205
|
+
#endif
|
|
140
206
|
#endif
|
|
141
207
|
|
|
142
208
|
template <typename T> struct add_const { typedef const T type; };
|
|
@@ -151,6 +217,11 @@ template<typename T> struct add_const_on_value_type<T*> { typedef T const
|
|
|
151
217
|
template<typename T> struct add_const_on_value_type<T* const> { typedef T const* const type; };
|
|
152
218
|
template<typename T> struct add_const_on_value_type<T const* const> { typedef T const* const type; };
|
|
153
219
|
|
|
220
|
+
#if EIGEN_HAS_CXX11
|
|
221
|
+
|
|
222
|
+
using std::is_convertible;
|
|
223
|
+
|
|
224
|
+
#else
|
|
154
225
|
|
|
155
226
|
template<typename From, typename To>
|
|
156
227
|
struct is_convertible_impl
|
|
@@ -164,16 +235,19 @@ private:
|
|
|
164
235
|
struct yes {int a[1];};
|
|
165
236
|
struct no {int a[2];};
|
|
166
237
|
|
|
167
|
-
|
|
238
|
+
template<typename T>
|
|
239
|
+
static yes test(T, int);
|
|
240
|
+
|
|
241
|
+
template<typename T>
|
|
168
242
|
static no test(any_conversion, ...);
|
|
169
243
|
|
|
170
244
|
public:
|
|
171
|
-
static From ms_from;
|
|
245
|
+
static typename internal::remove_reference<From>::type* ms_from;
|
|
172
246
|
#ifdef __INTEL_COMPILER
|
|
173
247
|
#pragma warning push
|
|
174
248
|
#pragma warning ( disable : 2259 )
|
|
175
249
|
#endif
|
|
176
|
-
enum { value = sizeof(test(ms_from, 0))==sizeof(yes) };
|
|
250
|
+
enum { value = sizeof(test<To>(*ms_from, 0))==sizeof(yes) };
|
|
177
251
|
#ifdef __INTEL_COMPILER
|
|
178
252
|
#pragma warning pop
|
|
179
253
|
#endif
|
|
@@ -182,10 +256,17 @@ public:
|
|
|
182
256
|
template<typename From, typename To>
|
|
183
257
|
struct is_convertible
|
|
184
258
|
{
|
|
185
|
-
enum { value = is_convertible_impl<
|
|
186
|
-
typename remove_all<To >::type>::value };
|
|
259
|
+
enum { value = is_convertible_impl<From,To>::value };
|
|
187
260
|
};
|
|
188
261
|
|
|
262
|
+
template<typename T>
|
|
263
|
+
struct is_convertible<T,T&> { enum { value = false }; };
|
|
264
|
+
|
|
265
|
+
template<typename T>
|
|
266
|
+
struct is_convertible<const T,const T&> { enum { value = true }; };
|
|
267
|
+
|
|
268
|
+
#endif
|
|
269
|
+
|
|
189
270
|
/** \internal Allows to enable/disable an overload
|
|
190
271
|
* according to a compile time condition.
|
|
191
272
|
*/
|
|
@@ -194,7 +275,7 @@ template<bool Condition, typename T=void> struct enable_if;
|
|
|
194
275
|
template<typename T> struct enable_if<true,T>
|
|
195
276
|
{ typedef T type; };
|
|
196
277
|
|
|
197
|
-
#if defined(
|
|
278
|
+
#if defined(EIGEN_GPU_COMPILE_PHASE) && !EIGEN_HAS_CXX11
|
|
198
279
|
#if !defined(__FLT_EPSILON__)
|
|
199
280
|
#define __FLT_EPSILON__ FLT_EPSILON
|
|
200
281
|
#define __DBL_EPSILON__ DBL_EPSILON
|
|
@@ -205,7 +286,7 @@ namespace device {
|
|
|
205
286
|
template<typename T> struct numeric_limits
|
|
206
287
|
{
|
|
207
288
|
EIGEN_DEVICE_FUNC
|
|
208
|
-
static T epsilon() { return 0; }
|
|
289
|
+
static EIGEN_CONSTEXPR T epsilon() { return 0; }
|
|
209
290
|
static T (max)() { assert(false && "Highest not supported for this type"); }
|
|
210
291
|
static T (min)() { assert(false && "Lowest not supported for this type"); }
|
|
211
292
|
static T infinity() { assert(false && "Infinity not supported for this type"); }
|
|
@@ -213,91 +294,130 @@ template<typename T> struct numeric_limits
|
|
|
213
294
|
};
|
|
214
295
|
template<> struct numeric_limits<float>
|
|
215
296
|
{
|
|
216
|
-
EIGEN_DEVICE_FUNC
|
|
297
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
217
298
|
static float epsilon() { return __FLT_EPSILON__; }
|
|
218
299
|
EIGEN_DEVICE_FUNC
|
|
219
|
-
static float (max)() {
|
|
220
|
-
|
|
300
|
+
static float (max)() {
|
|
301
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
302
|
+
return CUDART_MAX_NORMAL_F;
|
|
303
|
+
#else
|
|
304
|
+
return HIPRT_MAX_NORMAL_F;
|
|
305
|
+
#endif
|
|
306
|
+
}
|
|
307
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
221
308
|
static float (min)() { return FLT_MIN; }
|
|
222
309
|
EIGEN_DEVICE_FUNC
|
|
223
|
-
static float infinity() {
|
|
310
|
+
static float infinity() {
|
|
311
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
312
|
+
return CUDART_INF_F;
|
|
313
|
+
#else
|
|
314
|
+
return HIPRT_INF_F;
|
|
315
|
+
#endif
|
|
316
|
+
}
|
|
224
317
|
EIGEN_DEVICE_FUNC
|
|
225
|
-
static float quiet_NaN() {
|
|
318
|
+
static float quiet_NaN() {
|
|
319
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
320
|
+
return CUDART_NAN_F;
|
|
321
|
+
#else
|
|
322
|
+
return HIPRT_NAN_F;
|
|
323
|
+
#endif
|
|
324
|
+
}
|
|
226
325
|
};
|
|
227
326
|
template<> struct numeric_limits<double>
|
|
228
327
|
{
|
|
229
|
-
EIGEN_DEVICE_FUNC
|
|
328
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
230
329
|
static double epsilon() { return __DBL_EPSILON__; }
|
|
231
|
-
EIGEN_DEVICE_FUNC
|
|
330
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
232
331
|
static double (max)() { return DBL_MAX; }
|
|
233
|
-
EIGEN_DEVICE_FUNC
|
|
332
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
234
333
|
static double (min)() { return DBL_MIN; }
|
|
235
334
|
EIGEN_DEVICE_FUNC
|
|
236
|
-
static double infinity() {
|
|
335
|
+
static double infinity() {
|
|
336
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
337
|
+
return CUDART_INF;
|
|
338
|
+
#else
|
|
339
|
+
return HIPRT_INF;
|
|
340
|
+
#endif
|
|
341
|
+
}
|
|
237
342
|
EIGEN_DEVICE_FUNC
|
|
238
|
-
static double quiet_NaN() {
|
|
343
|
+
static double quiet_NaN() {
|
|
344
|
+
#if defined(EIGEN_CUDA_ARCH)
|
|
345
|
+
return CUDART_NAN;
|
|
346
|
+
#else
|
|
347
|
+
return HIPRT_NAN;
|
|
348
|
+
#endif
|
|
349
|
+
}
|
|
239
350
|
};
|
|
240
351
|
template<> struct numeric_limits<int>
|
|
241
352
|
{
|
|
242
|
-
EIGEN_DEVICE_FUNC
|
|
353
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
243
354
|
static int epsilon() { return 0; }
|
|
244
|
-
EIGEN_DEVICE_FUNC
|
|
355
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
245
356
|
static int (max)() { return INT_MAX; }
|
|
246
|
-
EIGEN_DEVICE_FUNC
|
|
357
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
247
358
|
static int (min)() { return INT_MIN; }
|
|
248
359
|
};
|
|
249
360
|
template<> struct numeric_limits<unsigned int>
|
|
250
361
|
{
|
|
251
|
-
EIGEN_DEVICE_FUNC
|
|
362
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
252
363
|
static unsigned int epsilon() { return 0; }
|
|
253
|
-
EIGEN_DEVICE_FUNC
|
|
364
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
254
365
|
static unsigned int (max)() { return UINT_MAX; }
|
|
255
|
-
EIGEN_DEVICE_FUNC
|
|
366
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
256
367
|
static unsigned int (min)() { return 0; }
|
|
257
368
|
};
|
|
258
369
|
template<> struct numeric_limits<long>
|
|
259
370
|
{
|
|
260
|
-
EIGEN_DEVICE_FUNC
|
|
371
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
261
372
|
static long epsilon() { return 0; }
|
|
262
|
-
EIGEN_DEVICE_FUNC
|
|
373
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
263
374
|
static long (max)() { return LONG_MAX; }
|
|
264
|
-
EIGEN_DEVICE_FUNC
|
|
375
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
265
376
|
static long (min)() { return LONG_MIN; }
|
|
266
377
|
};
|
|
267
378
|
template<> struct numeric_limits<unsigned long>
|
|
268
379
|
{
|
|
269
|
-
EIGEN_DEVICE_FUNC
|
|
380
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
270
381
|
static unsigned long epsilon() { return 0; }
|
|
271
|
-
EIGEN_DEVICE_FUNC
|
|
382
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
272
383
|
static unsigned long (max)() { return ULONG_MAX; }
|
|
273
|
-
EIGEN_DEVICE_FUNC
|
|
384
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
274
385
|
static unsigned long (min)() { return 0; }
|
|
275
386
|
};
|
|
276
387
|
template<> struct numeric_limits<long long>
|
|
277
388
|
{
|
|
278
|
-
EIGEN_DEVICE_FUNC
|
|
389
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
279
390
|
static long long epsilon() { return 0; }
|
|
280
|
-
EIGEN_DEVICE_FUNC
|
|
391
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
281
392
|
static long long (max)() { return LLONG_MAX; }
|
|
282
|
-
EIGEN_DEVICE_FUNC
|
|
393
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
283
394
|
static long long (min)() { return LLONG_MIN; }
|
|
284
395
|
};
|
|
285
396
|
template<> struct numeric_limits<unsigned long long>
|
|
286
397
|
{
|
|
287
|
-
EIGEN_DEVICE_FUNC
|
|
398
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
288
399
|
static unsigned long long epsilon() { return 0; }
|
|
289
|
-
EIGEN_DEVICE_FUNC
|
|
400
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
290
401
|
static unsigned long long (max)() { return ULLONG_MAX; }
|
|
291
|
-
EIGEN_DEVICE_FUNC
|
|
402
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
292
403
|
static unsigned long long (min)() { return 0; }
|
|
293
404
|
};
|
|
405
|
+
template<> struct numeric_limits<bool>
|
|
406
|
+
{
|
|
407
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
408
|
+
static bool epsilon() { return false; }
|
|
409
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
410
|
+
static bool (max)() { return true; }
|
|
411
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
|
412
|
+
static bool (min)() { return false; }
|
|
413
|
+
};
|
|
294
414
|
|
|
295
415
|
}
|
|
296
416
|
|
|
297
|
-
#endif
|
|
417
|
+
#endif // defined(EIGEN_GPU_COMPILE_PHASE) && !EIGEN_HAS_CXX11
|
|
298
418
|
|
|
299
419
|
/** \internal
|
|
300
|
-
* A base class do disable default copy ctor and copy
|
|
420
|
+
* A base class do disable default copy ctor and copy assignment operator.
|
|
301
421
|
*/
|
|
302
422
|
class noncopyable
|
|
303
423
|
{
|
|
@@ -309,13 +429,82 @@ protected:
|
|
|
309
429
|
};
|
|
310
430
|
|
|
311
431
|
/** \internal
|
|
312
|
-
*
|
|
432
|
+
* Provides access to the number of elements in the object of as a compile-time constant expression.
|
|
433
|
+
* It "returns" Eigen::Dynamic if the size cannot be resolved at compile-time (default).
|
|
434
|
+
*
|
|
435
|
+
* Similar to std::tuple_size, but more general.
|
|
436
|
+
*
|
|
437
|
+
* It currently supports:
|
|
438
|
+
* - any types T defining T::SizeAtCompileTime
|
|
439
|
+
* - plain C arrays as T[N]
|
|
440
|
+
* - std::array (c++11)
|
|
441
|
+
* - some internal types such as SingleRange and AllRange
|
|
442
|
+
*
|
|
443
|
+
* The second template parameter eases SFINAE-based specializations.
|
|
444
|
+
*/
|
|
445
|
+
template<typename T, typename EnableIf = void> struct array_size {
|
|
446
|
+
enum { value = Dynamic };
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
template<typename T> struct array_size<T,typename internal::enable_if<((T::SizeAtCompileTime&0)==0)>::type> {
|
|
450
|
+
enum { value = T::SizeAtCompileTime };
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
template<typename T, int N> struct array_size<const T (&)[N]> {
|
|
454
|
+
enum { value = N };
|
|
455
|
+
};
|
|
456
|
+
template<typename T, int N> struct array_size<T (&)[N]> {
|
|
457
|
+
enum { value = N };
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
#if EIGEN_HAS_CXX11
|
|
461
|
+
template<typename T, std::size_t N> struct array_size<const std::array<T,N> > {
|
|
462
|
+
enum { value = N };
|
|
463
|
+
};
|
|
464
|
+
template<typename T, std::size_t N> struct array_size<std::array<T,N> > {
|
|
465
|
+
enum { value = N };
|
|
466
|
+
};
|
|
467
|
+
#endif
|
|
468
|
+
|
|
469
|
+
/** \internal
|
|
470
|
+
* Analogue of the std::size free function.
|
|
471
|
+
* It returns the size of the container or view \a x of type \c T
|
|
472
|
+
*
|
|
473
|
+
* It currently supports:
|
|
474
|
+
* - any types T defining a member T::size() const
|
|
475
|
+
* - plain C arrays as T[N]
|
|
313
476
|
*
|
|
314
|
-
* It supports both the current STL mechanism (using the result_type member) as well as
|
|
315
|
-
* upcoming next STL generation (using a templated result member).
|
|
316
|
-
* If none of these members is provided, then the type of the first argument is returned. FIXME, that behavior is a pretty bad hack.
|
|
317
477
|
*/
|
|
318
|
-
|
|
478
|
+
template<typename T>
|
|
479
|
+
EIGEN_CONSTEXPR Index size(const T& x) { return x.size(); }
|
|
480
|
+
|
|
481
|
+
template<typename T,std::size_t N>
|
|
482
|
+
EIGEN_CONSTEXPR Index size(const T (&) [N]) { return N; }
|
|
483
|
+
|
|
484
|
+
/** \internal
|
|
485
|
+
* Convenient struct to get the result type of a nullary, unary, binary, or
|
|
486
|
+
* ternary functor.
|
|
487
|
+
*
|
|
488
|
+
* Pre C++11:
|
|
489
|
+
* Supports both a Func::result_type member and templated
|
|
490
|
+
* Func::result<Func(ArgTypes...)>::type member.
|
|
491
|
+
*
|
|
492
|
+
* If none of these members is provided, then the type of the first
|
|
493
|
+
* argument is returned.
|
|
494
|
+
*
|
|
495
|
+
* Post C++11:
|
|
496
|
+
* This uses std::result_of. However, note the `type` member removes
|
|
497
|
+
* const and converts references/pointers to their corresponding value type.
|
|
498
|
+
*/
|
|
499
|
+
#if EIGEN_HAS_STD_INVOKE_RESULT
|
|
500
|
+
template<typename T> struct result_of;
|
|
501
|
+
|
|
502
|
+
template<typename F, typename... ArgTypes>
|
|
503
|
+
struct result_of<F(ArgTypes...)> {
|
|
504
|
+
typedef typename std::invoke_result<F, ArgTypes...>::type type1;
|
|
505
|
+
typedef typename remove_all<type1>::type type;
|
|
506
|
+
};
|
|
507
|
+
#elif EIGEN_HAS_STD_RESULT_OF
|
|
319
508
|
template<typename T> struct result_of {
|
|
320
509
|
typedef typename std::result_of<T>::type type1;
|
|
321
510
|
typedef typename remove_all<type1>::type type;
|
|
@@ -327,6 +516,28 @@ struct has_none {int a[1];};
|
|
|
327
516
|
struct has_std_result_type {int a[2];};
|
|
328
517
|
struct has_tr1_result {int a[3];};
|
|
329
518
|
|
|
519
|
+
template<typename Func, int SizeOf>
|
|
520
|
+
struct nullary_result_of_select {};
|
|
521
|
+
|
|
522
|
+
template<typename Func>
|
|
523
|
+
struct nullary_result_of_select<Func, sizeof(has_std_result_type)> {typedef typename Func::result_type type;};
|
|
524
|
+
|
|
525
|
+
template<typename Func>
|
|
526
|
+
struct nullary_result_of_select<Func, sizeof(has_tr1_result)> {typedef typename Func::template result<Func()>::type type;};
|
|
527
|
+
|
|
528
|
+
template<typename Func>
|
|
529
|
+
struct result_of<Func()> {
|
|
530
|
+
template<typename T>
|
|
531
|
+
static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0);
|
|
532
|
+
template<typename T>
|
|
533
|
+
static has_tr1_result testFunctor(T const *, typename T::template result<T()>::type const * = 0);
|
|
534
|
+
static has_none testFunctor(...);
|
|
535
|
+
|
|
536
|
+
// note that the following indirection is needed for gcc-3.3
|
|
537
|
+
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
|
|
538
|
+
typedef typename nullary_result_of_select<Func, FunctorType>::type type;
|
|
539
|
+
};
|
|
540
|
+
|
|
330
541
|
template<typename Func, typename ArgType, int SizeOf=sizeof(has_none)>
|
|
331
542
|
struct unary_result_of_select {typedef typename internal::remove_all<ArgType>::type type;};
|
|
332
543
|
|
|
@@ -396,6 +607,45 @@ struct result_of<Func(ArgType0,ArgType1,ArgType2)> {
|
|
|
396
607
|
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
|
|
397
608
|
typedef typename ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, FunctorType>::type type;
|
|
398
609
|
};
|
|
610
|
+
|
|
611
|
+
#endif
|
|
612
|
+
|
|
613
|
+
#if EIGEN_HAS_STD_INVOKE_RESULT
|
|
614
|
+
template<typename F, typename... ArgTypes>
|
|
615
|
+
struct invoke_result {
|
|
616
|
+
typedef typename std::invoke_result<F, ArgTypes...>::type type1;
|
|
617
|
+
typedef typename remove_all<type1>::type type;
|
|
618
|
+
};
|
|
619
|
+
#elif EIGEN_HAS_CXX11
|
|
620
|
+
template<typename F, typename... ArgTypes>
|
|
621
|
+
struct invoke_result {
|
|
622
|
+
typedef typename result_of<F(ArgTypes...)>::type type1;
|
|
623
|
+
typedef typename remove_all<type1>::type type;
|
|
624
|
+
};
|
|
625
|
+
#else
|
|
626
|
+
template<typename F, typename ArgType0 = void, typename ArgType1 = void, typename ArgType2 = void>
|
|
627
|
+
struct invoke_result {
|
|
628
|
+
typedef typename result_of<F(ArgType0, ArgType1, ArgType2)>::type type1;
|
|
629
|
+
typedef typename remove_all<type1>::type type;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
template<typename F>
|
|
633
|
+
struct invoke_result<F, void, void, void> {
|
|
634
|
+
typedef typename result_of<F()>::type type1;
|
|
635
|
+
typedef typename remove_all<type1>::type type;
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
template<typename F, typename ArgType0>
|
|
639
|
+
struct invoke_result<F, ArgType0, void, void> {
|
|
640
|
+
typedef typename result_of<F(ArgType0)>::type type1;
|
|
641
|
+
typedef typename remove_all<type1>::type type;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
template<typename F, typename ArgType0, typename ArgType1>
|
|
645
|
+
struct invoke_result<F, ArgType0, ArgType1, void> {
|
|
646
|
+
typedef typename result_of<F(ArgType0, ArgType1)>::type type1;
|
|
647
|
+
typedef typename remove_all<type1>::type type;
|
|
648
|
+
};
|
|
399
649
|
#endif
|
|
400
650
|
|
|
401
651
|
struct meta_yes { char a[1]; };
|
|
@@ -405,10 +655,10 @@ struct meta_no { char a[2]; };
|
|
|
405
655
|
template <typename T>
|
|
406
656
|
struct has_ReturnType
|
|
407
657
|
{
|
|
408
|
-
template <typename C> static meta_yes testFunctor(typename C::ReturnType const *);
|
|
409
|
-
template <typename C> static meta_no
|
|
658
|
+
template <typename C> static meta_yes testFunctor(C const *, typename C::ReturnType const * = 0);
|
|
659
|
+
template <typename C> static meta_no testFunctor(...);
|
|
410
660
|
|
|
411
|
-
enum { value = sizeof(testFunctor<T>(0)) == sizeof(meta_yes) };
|
|
661
|
+
enum { value = sizeof(testFunctor<T>(static_cast<T*>(0))) == sizeof(meta_yes) };
|
|
412
662
|
};
|
|
413
663
|
|
|
414
664
|
template<typename T> const T* return_ptr();
|
|
@@ -465,20 +715,25 @@ class meta_sqrt<Y, InfX, SupX, true> { public: enum { ret = (SupX*SupX <= Y) ?
|
|
|
465
715
|
|
|
466
716
|
|
|
467
717
|
/** \internal Computes the least common multiple of two positive integer A and B
|
|
468
|
-
* at compile-time.
|
|
469
|
-
* It thus works better if A>=B.
|
|
718
|
+
* at compile-time.
|
|
470
719
|
*/
|
|
471
|
-
template<int A, int B, int K=1, bool Done = ((A*K)%B)==0>
|
|
720
|
+
template<int A, int B, int K=1, bool Done = ((A*K)%B)==0, bool Big=(A>=B)>
|
|
472
721
|
struct meta_least_common_multiple
|
|
473
722
|
{
|
|
474
723
|
enum { ret = meta_least_common_multiple<A,B,K+1>::ret };
|
|
475
724
|
};
|
|
725
|
+
template<int A, int B, int K, bool Done>
|
|
726
|
+
struct meta_least_common_multiple<A,B,K,Done,false>
|
|
727
|
+
{
|
|
728
|
+
enum { ret = meta_least_common_multiple<B,A,K>::ret };
|
|
729
|
+
};
|
|
476
730
|
template<int A, int B, int K>
|
|
477
|
-
struct meta_least_common_multiple<A,B,K,true>
|
|
731
|
+
struct meta_least_common_multiple<A,B,K,true,true>
|
|
478
732
|
{
|
|
479
733
|
enum { ret = A*K };
|
|
480
734
|
};
|
|
481
735
|
|
|
736
|
+
|
|
482
737
|
/** \internal determines whether the product of two numeric types is allowed and what the return type is */
|
|
483
738
|
template<typename T, typename U> struct scalar_product_traits
|
|
484
739
|
{
|
|
@@ -491,17 +746,27 @@ template<typename T, typename U> struct scalar_product_traits
|
|
|
491
746
|
// typedef typename scalar_product_traits<typename remove_all<ArgType0>::type, typename remove_all<ArgType1>::type>::ReturnType type;
|
|
492
747
|
// };
|
|
493
748
|
|
|
749
|
+
/** \internal Obtains a POD type suitable to use as storage for an object of a size
|
|
750
|
+
* of at most Len bytes, aligned as specified by \c Align.
|
|
751
|
+
*/
|
|
752
|
+
template<unsigned Len, unsigned Align>
|
|
753
|
+
struct aligned_storage {
|
|
754
|
+
struct type {
|
|
755
|
+
EIGEN_ALIGN_TO_BOUNDARY(Align) unsigned char data[Len];
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
|
|
494
759
|
} // end namespace internal
|
|
495
760
|
|
|
496
761
|
namespace numext {
|
|
497
|
-
|
|
498
|
-
#if defined(
|
|
762
|
+
|
|
763
|
+
#if defined(EIGEN_GPU_COMPILE_PHASE)
|
|
499
764
|
template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
|
|
500
765
|
#else
|
|
501
766
|
template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); }
|
|
502
767
|
#endif
|
|
503
768
|
|
|
504
|
-
#if defined(
|
|
769
|
+
#if defined(EIGEN_GPU_COMPILE_PHASE) && !EIGEN_HAS_CXX11
|
|
505
770
|
using internal::device::numeric_limits;
|
|
506
771
|
#else
|
|
507
772
|
using std::numeric_limits;
|
|
@@ -510,6 +775,7 @@ using std::numeric_limits;
|
|
|
510
775
|
// Integer division with rounding up.
|
|
511
776
|
// T is assumed to be an integer type with a>=0, and b>0
|
|
512
777
|
template<typename T>
|
|
778
|
+
EIGEN_DEVICE_FUNC
|
|
513
779
|
T div_ceil(const T &a, const T &b)
|
|
514
780
|
{
|
|
515
781
|
return (a+b-1) / b;
|
|
@@ -517,52 +783,30 @@ T div_ceil(const T &a, const T &b)
|
|
|
517
783
|
|
|
518
784
|
// The aim of the following functions is to bypass -Wfloat-equal warnings
|
|
519
785
|
// when we really want a strict equality comparison on floating points.
|
|
520
|
-
template<typename X, typename Y> EIGEN_STRONG_INLINE
|
|
786
|
+
template<typename X, typename Y> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
521
787
|
bool equal_strict(const X& x,const Y& y) { return x == y; }
|
|
522
788
|
|
|
523
|
-
|
|
789
|
+
#if !defined(EIGEN_GPU_COMPILE_PHASE) || (!defined(EIGEN_CUDA_ARCH) && defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
|
|
790
|
+
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
524
791
|
bool equal_strict(const float& x,const float& y) { return std::equal_to<float>()(x,y); }
|
|
525
792
|
|
|
526
|
-
template<> EIGEN_STRONG_INLINE
|
|
793
|
+
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
527
794
|
bool equal_strict(const double& x,const double& y) { return std::equal_to<double>()(x,y); }
|
|
795
|
+
#endif
|
|
528
796
|
|
|
529
|
-
template<typename X, typename Y> EIGEN_STRONG_INLINE
|
|
797
|
+
template<typename X, typename Y> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
530
798
|
bool not_equal_strict(const X& x,const Y& y) { return x != y; }
|
|
531
799
|
|
|
532
|
-
|
|
800
|
+
#if !defined(EIGEN_GPU_COMPILE_PHASE) || (!defined(EIGEN_CUDA_ARCH) && defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC))
|
|
801
|
+
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
533
802
|
bool not_equal_strict(const float& x,const float& y) { return std::not_equal_to<float>()(x,y); }
|
|
534
803
|
|
|
535
|
-
template<> EIGEN_STRONG_INLINE
|
|
804
|
+
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
|
|
536
805
|
bool not_equal_strict(const double& x,const double& y) { return std::not_equal_to<double>()(x,y); }
|
|
806
|
+
#endif
|
|
537
807
|
|
|
538
808
|
} // end namespace numext
|
|
539
809
|
|
|
540
810
|
} // end namespace Eigen
|
|
541
811
|
|
|
542
|
-
// Define portable (u)int{32,64} types
|
|
543
|
-
#if EIGEN_HAS_CXX11
|
|
544
|
-
#include <cstdint>
|
|
545
|
-
namespace Eigen {
|
|
546
|
-
namespace numext {
|
|
547
|
-
typedef std::uint32_t uint32_t;
|
|
548
|
-
typedef std::int32_t int32_t;
|
|
549
|
-
typedef std::uint64_t uint64_t;
|
|
550
|
-
typedef std::int64_t int64_t;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
#else
|
|
554
|
-
// Without c++11, all compilers able to compile Eigen also
|
|
555
|
-
// provides the C99 stdint.h header file.
|
|
556
|
-
#include <stdint.h>
|
|
557
|
-
namespace Eigen {
|
|
558
|
-
namespace numext {
|
|
559
|
-
typedef ::uint32_t uint32_t;
|
|
560
|
-
typedef ::int32_t int32_t;
|
|
561
|
-
typedef ::uint64_t uint64_t;
|
|
562
|
-
typedef ::int64_t int64_t;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
#endif
|
|
566
|
-
|
|
567
|
-
|
|
568
812
|
#endif // EIGEN_META_H
|