tomoto 0.2.2 → 0.3.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.
Files changed (369) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +8 -10
  4. data/ext/tomoto/ct.cpp +11 -11
  5. data/ext/tomoto/dmr.cpp +14 -13
  6. data/ext/tomoto/dt.cpp +14 -14
  7. data/ext/tomoto/extconf.rb +7 -5
  8. data/ext/tomoto/gdmr.cpp +7 -7
  9. data/ext/tomoto/hdp.cpp +9 -9
  10. data/ext/tomoto/hlda.cpp +13 -13
  11. data/ext/tomoto/hpa.cpp +5 -5
  12. data/ext/tomoto/lda.cpp +42 -39
  13. data/ext/tomoto/llda.cpp +6 -6
  14. data/ext/tomoto/mglda.cpp +15 -15
  15. data/ext/tomoto/pa.cpp +6 -6
  16. data/ext/tomoto/plda.cpp +6 -6
  17. data/ext/tomoto/slda.cpp +8 -8
  18. data/ext/tomoto/{ext.cpp → tomoto.cpp} +8 -8
  19. data/ext/tomoto/utils.h +16 -70
  20. data/lib/tomoto/version.rb +1 -1
  21. data/lib/tomoto.rb +5 -1
  22. data/vendor/EigenRand/EigenRand/Core.h +10 -10
  23. data/vendor/EigenRand/EigenRand/Dists/Basic.h +208 -9
  24. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +52 -31
  25. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +9 -8
  26. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +28 -21
  27. data/vendor/EigenRand/EigenRand/EigenRand +11 -6
  28. data/vendor/EigenRand/EigenRand/Macro.h +13 -7
  29. data/vendor/EigenRand/EigenRand/MorePacketMath.h +348 -740
  30. data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +5 -3
  31. data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +9 -3
  32. data/vendor/EigenRand/EigenRand/PacketFilter.h +11 -253
  33. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +21 -47
  34. data/vendor/EigenRand/EigenRand/RandUtils.h +50 -344
  35. data/vendor/EigenRand/EigenRand/arch/AVX/MorePacketMath.h +619 -0
  36. data/vendor/EigenRand/EigenRand/arch/AVX/PacketFilter.h +149 -0
  37. data/vendor/EigenRand/EigenRand/arch/AVX/RandUtils.h +228 -0
  38. data/vendor/EigenRand/EigenRand/arch/NEON/MorePacketMath.h +473 -0
  39. data/vendor/EigenRand/EigenRand/arch/NEON/PacketFilter.h +142 -0
  40. data/vendor/EigenRand/EigenRand/arch/NEON/RandUtils.h +126 -0
  41. data/vendor/EigenRand/EigenRand/arch/SSE/MorePacketMath.h +501 -0
  42. data/vendor/EigenRand/EigenRand/arch/SSE/PacketFilter.h +133 -0
  43. data/vendor/EigenRand/EigenRand/arch/SSE/RandUtils.h +120 -0
  44. data/vendor/EigenRand/EigenRand/doc.h +24 -12
  45. data/vendor/EigenRand/README.md +57 -4
  46. data/vendor/eigen/COPYING.APACHE +203 -0
  47. data/vendor/eigen/COPYING.BSD +1 -1
  48. data/vendor/eigen/COPYING.MINPACK +51 -52
  49. data/vendor/eigen/Eigen/Cholesky +0 -1
  50. data/vendor/eigen/Eigen/Core +112 -265
  51. data/vendor/eigen/Eigen/Eigenvalues +2 -3
  52. data/vendor/eigen/Eigen/Geometry +5 -8
  53. data/vendor/eigen/Eigen/Householder +0 -1
  54. data/vendor/eigen/Eigen/Jacobi +0 -1
  55. data/vendor/eigen/Eigen/KLUSupport +41 -0
  56. data/vendor/eigen/Eigen/LU +2 -5
  57. data/vendor/eigen/Eigen/OrderingMethods +0 -3
  58. data/vendor/eigen/Eigen/PaStiXSupport +1 -0
  59. data/vendor/eigen/Eigen/PardisoSupport +0 -0
  60. data/vendor/eigen/Eigen/QR +2 -3
  61. data/vendor/eigen/Eigen/QtAlignedMalloc +0 -1
  62. data/vendor/eigen/Eigen/SVD +0 -1
  63. data/vendor/eigen/Eigen/Sparse +0 -2
  64. data/vendor/eigen/Eigen/SparseCholesky +0 -8
  65. data/vendor/eigen/Eigen/SparseLU +4 -0
  66. data/vendor/eigen/Eigen/SparseQR +0 -1
  67. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
  68. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +39 -23
  69. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
  70. data/vendor/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
  71. data/vendor/eigen/Eigen/src/Core/Array.h +99 -11
  72. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +3 -3
  73. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
  74. data/vendor/eigen/Eigen/src/Core/Assign.h +1 -1
  75. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
  76. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
  77. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +16 -16
  78. data/vendor/eigen/Eigen/src/Core/Block.h +56 -60
  79. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
  80. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
  81. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
  82. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +5 -0
  83. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
  84. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
  85. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
  86. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +14 -10
  87. data/vendor/eigen/Eigen/src/Core/DenseBase.h +132 -42
  88. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
  89. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +153 -71
  90. data/vendor/eigen/Eigen/src/Core/Diagonal.h +21 -23
  91. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
  92. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
  93. data/vendor/eigen/Eigen/src/Core/Dot.h +10 -10
  94. data/vendor/eigen/Eigen/src/Core/EigenBase.h +10 -9
  95. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
  96. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +3 -3
  97. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
  98. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +599 -152
  99. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
  100. data/vendor/eigen/Eigen/src/Core/IO.h +40 -7
  101. data/vendor/eigen/Eigen/src/Core/IndexedView.h +237 -0
  102. data/vendor/eigen/Eigen/src/Core/Inverse.h +9 -10
  103. data/vendor/eigen/Eigen/src/Core/Map.h +7 -7
  104. data/vendor/eigen/Eigen/src/Core/MapBase.h +10 -3
  105. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +767 -125
  106. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
  107. data/vendor/eigen/Eigen/src/Core/Matrix.h +131 -25
  108. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +21 -3
  109. data/vendor/eigen/Eigen/src/Core/NestByValue.h +25 -50
  110. data/vendor/eigen/Eigen/src/Core/NoAlias.h +4 -3
  111. data/vendor/eigen/Eigen/src/Core/NumTraits.h +107 -20
  112. data/vendor/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  113. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +3 -31
  114. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +152 -59
  115. data/vendor/eigen/Eigen/src/Core/Product.h +30 -25
  116. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +192 -125
  117. data/vendor/eigen/Eigen/src/Core/Random.h +37 -1
  118. data/vendor/eigen/Eigen/src/Core/Redux.h +180 -170
  119. data/vendor/eigen/Eigen/src/Core/Ref.h +121 -23
  120. data/vendor/eigen/Eigen/src/Core/Replicate.h +8 -8
  121. data/vendor/eigen/Eigen/src/Core/Reshaped.h +454 -0
  122. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
  123. data/vendor/eigen/Eigen/src/Core/Reverse.h +18 -12
  124. data/vendor/eigen/Eigen/src/Core/Select.h +8 -6
  125. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
  126. data/vendor/eigen/Eigen/src/Core/Solve.h +14 -14
  127. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +16 -16
  128. data/vendor/eigen/Eigen/src/Core/SolverBase.h +41 -3
  129. data/vendor/eigen/Eigen/src/Core/StableNorm.h +100 -70
  130. data/vendor/eigen/Eigen/src/Core/StlIterators.h +463 -0
  131. data/vendor/eigen/Eigen/src/Core/Stride.h +9 -4
  132. data/vendor/eigen/Eigen/src/Core/Swap.h +5 -4
  133. data/vendor/eigen/Eigen/src/Core/Transpose.h +88 -27
  134. data/vendor/eigen/Eigen/src/Core/Transpositions.h +26 -47
  135. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +93 -75
  136. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +5 -5
  137. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
  138. data/vendor/eigen/Eigen/src/Core/Visitor.h +137 -29
  139. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
  140. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
  141. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
  142. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
  143. data/vendor/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +207 -236
  145. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1482 -495
  146. data/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
  148. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
  149. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
  153. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
  154. data/vendor/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  155. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
  156. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  157. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  158. data/vendor/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
  160. data/vendor/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  161. data/vendor/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
  162. data/vendor/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  163. data/vendor/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  164. data/vendor/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  165. data/vendor/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  166. data/vendor/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  167. data/vendor/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  168. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
  169. data/vendor/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  170. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
  171. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
  172. data/vendor/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  173. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
  174. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
  175. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
  176. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
  177. data/vendor/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  178. data/vendor/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  179. data/vendor/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  180. data/vendor/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  181. data/vendor/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  182. data/vendor/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  183. data/vendor/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  184. data/vendor/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  185. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
  186. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
  187. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
  188. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
  189. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
  190. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
  191. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
  192. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +355 -16
  193. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1075 -586
  194. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +49 -24
  195. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +41 -35
  196. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +6 -6
  197. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +4 -2
  198. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
  199. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +22 -5
  200. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +53 -30
  201. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +16 -8
  202. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
  203. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +4 -4
  204. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
  205. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +33 -27
  206. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +14 -12
  207. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +36 -34
  208. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +8 -4
  209. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
  210. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +304 -119
  211. data/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  212. data/vendor/eigen/Eigen/src/Core/util/Constants.h +25 -9
  213. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +26 -3
  214. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +29 -9
  215. data/vendor/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  216. data/vendor/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
  217. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
  218. data/vendor/eigen/Eigen/src/Core/util/Macros.h +709 -246
  219. data/vendor/eigen/Eigen/src/Core/util/Memory.h +222 -52
  220. data/vendor/eigen/Eigen/src/Core/util/Meta.h +355 -77
  221. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +5 -1
  222. data/vendor/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  223. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
  224. data/vendor/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  225. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +65 -30
  226. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
  227. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +7 -4
  228. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
  229. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
  230. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
  231. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
  232. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
  233. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +21 -9
  234. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +77 -43
  235. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
  236. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
  237. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
  238. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
  239. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
  240. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
  241. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
  242. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
  243. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +70 -14
  244. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
  245. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +23 -5
  246. data/vendor/eigen/Eigen/src/Geometry/Transform.h +88 -67
  247. data/vendor/eigen/Eigen/src/Geometry/Translation.h +6 -12
  248. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +1 -1
  249. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  250. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
  251. data/vendor/eigen/Eigen/src/Householder/Householder.h +8 -4
  252. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
  253. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
  254. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
  255. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
  256. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
  257. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
  258. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
  259. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
  260. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
  261. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
  262. data/vendor/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  263. data/vendor/eigen/Eigen/src/LU/Determinant.h +35 -19
  264. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +29 -43
  265. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +25 -8
  266. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +71 -58
  267. data/vendor/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
  268. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
  269. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
  270. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
  271. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
  272. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +9 -7
  273. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
  274. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
  275. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
  276. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
  277. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
  278. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +183 -63
  279. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
  280. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +83 -22
  281. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
  282. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +17 -9
  283. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +12 -37
  284. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +3 -2
  285. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
  286. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
  287. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
  288. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
  289. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
  290. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
  291. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +4 -2
  292. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
  293. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +126 -11
  294. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
  295. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
  296. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
  297. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +5 -2
  298. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
  299. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
  300. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +1 -0
  301. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +162 -12
  302. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
  303. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
  304. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
  305. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
  306. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
  307. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
  308. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +2 -12
  309. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +2 -2
  310. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
  311. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
  312. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
  313. data/vendor/eigen/Eigen/src/misc/lapacke.h +5 -4
  314. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +28 -2
  315. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
  316. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
  317. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
  318. data/vendor/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  319. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
  320. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
  321. data/vendor/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
  322. data/vendor/eigen/README.md +2 -0
  323. data/vendor/eigen/bench/btl/README +1 -1
  324. data/vendor/eigen/bench/tensors/README +6 -7
  325. data/vendor/eigen/ci/README.md +56 -0
  326. data/vendor/eigen/demos/mix_eigen_and_c/README +1 -1
  327. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +213 -158
  328. data/vendor/eigen/unsupported/README.txt +1 -1
  329. data/vendor/tomotopy/README.kr.rst +78 -0
  330. data/vendor/tomotopy/README.rst +75 -0
  331. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +2 -2
  332. data/vendor/tomotopy/src/Labeling/Phraser.hpp +4 -4
  333. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +7 -3
  334. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +7 -3
  335. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +6 -3
  336. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +2 -2
  337. data/vendor/tomotopy/src/TopicModel/HDP.h +1 -0
  338. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +57 -6
  339. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +6 -3
  340. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +3 -2
  341. data/vendor/tomotopy/src/TopicModel/LDA.h +3 -3
  342. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +5 -5
  343. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +50 -19
  344. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +6 -2
  345. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +3 -2
  346. data/vendor/tomotopy/src/TopicModel/PAModel.hpp +1 -1
  347. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +6 -2
  348. data/vendor/tomotopy/src/TopicModel/PT.h +3 -1
  349. data/vendor/tomotopy/src/TopicModel/PTModel.hpp +36 -3
  350. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +6 -3
  351. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +55 -26
  352. data/vendor/tomotopy/src/Utils/AliasMethod.hpp +5 -4
  353. data/vendor/tomotopy/src/Utils/Dictionary.h +2 -2
  354. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +36 -1
  355. data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +1 -1
  356. data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +1 -1
  357. data/vendor/tomotopy/src/Utils/exception.h +6 -0
  358. data/vendor/tomotopy/src/Utils/math.h +2 -2
  359. data/vendor/tomotopy/src/Utils/sample.hpp +14 -12
  360. data/vendor/tomotopy/src/Utils/serializer.hpp +30 -5
  361. data/vendor/tomotopy/src/Utils/sse_gamma.h +0 -3
  362. metadata +64 -18
  363. data/vendor/eigen/Eigen/CMakeLists.txt +0 -19
  364. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -674
  365. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  366. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  367. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  368. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  369. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
@@ -11,19 +11,56 @@
11
11
  #ifndef EIGEN_MACROS_H
12
12
  #define EIGEN_MACROS_H
13
13
 
14
+ //------------------------------------------------------------------------------------------
15
+ // Eigen version and basic defaults
16
+ //------------------------------------------------------------------------------------------
17
+
14
18
  #define EIGEN_WORLD_VERSION 3
15
- #define EIGEN_MAJOR_VERSION 3
16
- #define EIGEN_MINOR_VERSION 7
19
+ #define EIGEN_MAJOR_VERSION 4
20
+ #define EIGEN_MINOR_VERSION 0
17
21
 
18
22
  #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
19
23
  (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
20
24
  EIGEN_MINOR_VERSION>=z))))
21
25
 
26
+ #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
27
+ #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor
28
+ #else
29
+ #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor
30
+ #endif
31
+
32
+ #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
33
+ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
34
+ #endif
35
+
36
+ // Upperbound on the C++ version to use.
37
+ // Expected values are 03, 11, 14, 17, etc.
38
+ // By default, let's use an arbitrarily large C++ version.
39
+ #ifndef EIGEN_MAX_CPP_VER
40
+ #define EIGEN_MAX_CPP_VER 99
41
+ #endif
42
+
43
+ /** Allows to disable some optimizations which might affect the accuracy of the result.
44
+ * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
45
+ * They currently include:
46
+ * - single precision ArrayBase::sin() and ArrayBase::cos() for SSE and AVX vectorization.
47
+ */
48
+ #ifndef EIGEN_FAST_MATH
49
+ #define EIGEN_FAST_MATH 1
50
+ #endif
51
+
52
+ #ifndef EIGEN_STACK_ALLOCATION_LIMIT
53
+ // 131072 == 128 KB
54
+ #define EIGEN_STACK_ALLOCATION_LIMIT 131072
55
+ #endif
56
+
57
+ //------------------------------------------------------------------------------------------
22
58
  // Compiler identification, EIGEN_COMP_*
59
+ //------------------------------------------------------------------------------------------
23
60
 
24
61
  /// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC
25
62
  #ifdef __GNUC__
26
- #define EIGEN_COMP_GNUC 1
63
+ #define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)
27
64
  #else
28
65
  #define EIGEN_COMP_GNUC 0
29
66
  #endif
@@ -35,6 +72,12 @@
35
72
  #define EIGEN_COMP_CLANG 0
36
73
  #endif
37
74
 
75
+ /// \internal EIGEN_COMP_CASTXML set to 1 if being preprocessed by CastXML
76
+ #if defined(__castxml__)
77
+ #define EIGEN_COMP_CASTXML 1
78
+ #else
79
+ #define EIGEN_COMP_CASTXML 0
80
+ #endif
38
81
 
39
82
  /// \internal EIGEN_COMP_LLVM set to 1 if the compiler backend is llvm
40
83
  #if defined(__llvm__)
@@ -71,14 +114,44 @@
71
114
  #define EIGEN_COMP_MSVC 0
72
115
  #endif
73
116
 
117
+ #if defined(__NVCC__)
118
+ #if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
119
+ #define EIGEN_COMP_NVCC ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
120
+ #elif defined(__CUDACC_VER__)
121
+ #define EIGEN_COMP_NVCC __CUDACC_VER__
122
+ #else
123
+ #error "NVCC did not define compiler version."
124
+ #endif
125
+ #else
126
+ #define EIGEN_COMP_NVCC 0
127
+ #endif
128
+
74
129
  // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC:
75
- // name ver MSC_VER
76
- // 2008 9 1500
77
- // 2010 10 1600
78
- // 2012 11 1700
79
- // 2013 12 1800
80
- // 2015 14 1900
81
- // "15" 15 1900
130
+ // name ver MSC_VER
131
+ // 2008 9 1500
132
+ // 2010 10 1600
133
+ // 2012 11 1700
134
+ // 2013 12 1800
135
+ // 2015 14 1900
136
+ // "15" 15 1900
137
+ // 2017-14.1 15.0 1910
138
+ // 2017-14.11 15.3 1911
139
+ // 2017-14.12 15.5 1912
140
+ // 2017-14.13 15.6 1913
141
+ // 2017-14.14 15.7 1914
142
+
143
+ /// \internal EIGEN_COMP_MSVC_LANG set to _MSVC_LANG if the compiler is Microsoft Visual C++, 0 otherwise.
144
+ #if defined(_MSVC_LANG)
145
+ #define EIGEN_COMP_MSVC_LANG _MSVC_LANG
146
+ #else
147
+ #define EIGEN_COMP_MSVC_LANG 0
148
+ #endif
149
+
150
+ // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC_LANG:
151
+ // MSVC option Standard MSVC_LANG
152
+ // /std:c++14 (default as of VS 2019) C++14 201402L
153
+ // /std:c++17 C++17 201703L
154
+ // /std:c++latest >C++17 >201703L
82
155
 
83
156
  /// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC or clang-cl
84
157
  #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)
@@ -87,16 +160,21 @@
87
160
  #define EIGEN_COMP_MSVC_STRICT 0
88
161
  #endif
89
162
 
90
- /// \internal EIGEN_COMP_IBM set to 1 if the compiler is IBM XL C++
91
- #if defined(__IBMCPP__) || defined(__xlc__)
92
- #define EIGEN_COMP_IBM 1
163
+ /// \internal EIGEN_COMP_IBM set to xlc version if the compiler is IBM XL C++
164
+ // XLC version
165
+ // 3.1 0x0301
166
+ // 4.5 0x0405
167
+ // 5.0 0x0500
168
+ // 12.1 0x0C01
169
+ #if defined(__IBMCPP__) || defined(__xlc__) || defined(__ibmxl__)
170
+ #define EIGEN_COMP_IBM __xlC__
93
171
  #else
94
172
  #define EIGEN_COMP_IBM 0
95
173
  #endif
96
174
 
97
- /// \internal EIGEN_COMP_PGI set to 1 if the compiler is Portland Group Compiler
175
+ /// \internal EIGEN_COMP_PGI set to PGI version if the compiler is Portland Group Compiler
98
176
  #if defined(__PGI)
99
- #define EIGEN_COMP_PGI 1
177
+ #define EIGEN_COMP_PGI (__PGIC__*100+__PGIC_MINOR__)
100
178
  #else
101
179
  #define EIGEN_COMP_PGI 0
102
180
  #endif
@@ -108,7 +186,7 @@
108
186
  #define EIGEN_COMP_ARM 0
109
187
  #endif
110
188
 
111
- /// \internal EIGEN_COMP_ARM set to 1 if the compiler is ARM Compiler
189
+ /// \internal EIGEN_COMP_EMSCRIPTEN set to 1 if the compiler is Emscripten Compiler
112
190
  #if defined(__EMSCRIPTEN__)
113
191
  #define EIGEN_COMP_EMSCRIPTEN 1
114
192
  #else
@@ -142,9 +220,13 @@
142
220
  #endif
143
221
 
144
222
 
223
+
224
+ //------------------------------------------------------------------------------------------
145
225
  // Architecture identification, EIGEN_ARCH_*
226
+ //------------------------------------------------------------------------------------------
227
+
146
228
 
147
- #if defined(__x86_64__) || defined(_M_X64) || defined(__amd64)
229
+ #if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC)) || defined(__amd64)
148
230
  #define EIGEN_ARCH_x86_64 1
149
231
  #else
150
232
  #define EIGEN_ARCH_x86_64 0
@@ -170,18 +252,61 @@
170
252
  #endif
171
253
 
172
254
  /// \internal EIGEN_ARCH_ARM64 set to 1 if the architecture is ARM64
173
- #if defined(__aarch64__)
255
+ #if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
174
256
  #define EIGEN_ARCH_ARM64 1
175
257
  #else
176
258
  #define EIGEN_ARCH_ARM64 0
177
259
  #endif
178
260
 
261
+ /// \internal EIGEN_ARCH_ARM_OR_ARM64 set to 1 if the architecture is ARM or ARM64
179
262
  #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64
180
263
  #define EIGEN_ARCH_ARM_OR_ARM64 1
181
264
  #else
182
265
  #define EIGEN_ARCH_ARM_OR_ARM64 0
183
266
  #endif
184
267
 
268
+ /// \internal EIGEN_ARCH_ARMV8 set to 1 if the architecture is armv8 or greater.
269
+ #if EIGEN_ARCH_ARM_OR_ARM64 && defined(__ARM_ARCH) && __ARM_ARCH >= 8
270
+ #define EIGEN_ARCH_ARMV8 1
271
+ #else
272
+ #define EIGEN_ARCH_ARMV8 0
273
+ #endif
274
+
275
+
276
+ /// \internal EIGEN_HAS_ARM64_FP16 set to 1 if the architecture provides an IEEE
277
+ /// compliant Arm fp16 type
278
+ #if EIGEN_ARCH_ARM64
279
+ #ifndef EIGEN_HAS_ARM64_FP16
280
+ #if defined(__ARM_FP16_FORMAT_IEEE)
281
+ #define EIGEN_HAS_ARM64_FP16 1
282
+ #else
283
+ #define EIGEN_HAS_ARM64_FP16 0
284
+ #endif
285
+ #endif
286
+ #endif
287
+
288
+ /// \internal EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC set to 1 if the architecture
289
+ /// supports Neon vector intrinsics for fp16.
290
+ #if EIGEN_ARCH_ARM64
291
+ #ifndef EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
292
+ #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
293
+ #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 1
294
+ #else
295
+ #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 0
296
+ #endif
297
+ #endif
298
+ #endif
299
+
300
+ /// \internal EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC set to 1 if the architecture
301
+ /// supports Neon scalar intrinsics for fp16.
302
+ #if EIGEN_ARCH_ARM64
303
+ #ifndef EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC
304
+ #if defined(__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
305
+ #define EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC 1
306
+ #endif
307
+ #endif
308
+ #endif
309
+
185
310
  /// \internal EIGEN_ARCH_MIPS set to 1 if the architecture is MIPS
186
311
  #if defined(__mips__) || defined(__mips)
187
312
  #define EIGEN_ARCH_MIPS 1
@@ -212,7 +337,9 @@
212
337
 
213
338
 
214
339
 
340
+ //------------------------------------------------------------------------------------------
215
341
  // Operating system identification, EIGEN_OS_*
342
+ //------------------------------------------------------------------------------------------
216
343
 
217
344
  /// \internal EIGEN_OS_UNIX set to 1 if the OS is a unix variant
218
345
  #if defined(__unix__) || defined(__unix)
@@ -299,9 +426,17 @@
299
426
  #define EIGEN_OS_WIN_STRICT 0
300
427
  #endif
301
428
 
302
- /// \internal EIGEN_OS_SUN set to 1 if the OS is SUN
429
+ /// \internal EIGEN_OS_SUN set to __SUNPRO_C if the OS is SUN
430
+ // compiler solaris __SUNPRO_C
431
+ // version studio
432
+ // 5.7 10 0x570
433
+ // 5.8 11 0x580
434
+ // 5.9 12 0x590
435
+ // 5.10 12.1 0x5100
436
+ // 5.11 12.2 0x5110
437
+ // 5.12 12.3 0x5120
303
438
  #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
304
- #define EIGEN_OS_SUN 1
439
+ #define EIGEN_OS_SUN __SUNPRO_C
305
440
  #else
306
441
  #define EIGEN_OS_SUN 0
307
442
  #endif
@@ -314,26 +449,137 @@
314
449
  #endif
315
450
 
316
451
 
452
+ //------------------------------------------------------------------------------------------
453
+ // Detect GPU compilers and architectures
454
+ //------------------------------------------------------------------------------------------
317
455
 
318
- #if EIGEN_GNUC_AT_MOST(4,3) && !EIGEN_COMP_CLANG
319
- // see bug 89
320
- #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
321
- #else
322
- #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
456
+ // NVCC is not supported as the target platform for HIPCC
457
+ // Note that this also makes EIGEN_CUDACC and EIGEN_HIPCC mutually exclusive
458
+ #if defined(__NVCC__) && defined(__HIPCC__)
459
+ #error "NVCC as the target platform for HIPCC is currently not supported."
323
460
  #endif
324
461
 
325
- // This macro can be used to prevent from macro expansion, e.g.:
326
- // std::max EIGEN_NOT_A_MACRO(a,b)
327
- #define EIGEN_NOT_A_MACRO
462
+ #if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
463
+ // Means the compiler is either nvcc or clang with CUDA enabled
464
+ #define EIGEN_CUDACC __CUDACC__
465
+ #endif
328
466
 
329
- #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
330
- #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor
467
+ #if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
468
+ // Means we are generating code for the device
469
+ #define EIGEN_CUDA_ARCH __CUDA_ARCH__
470
+ #endif
471
+
472
+ #if defined(EIGEN_CUDACC)
473
+ #include <cuda.h>
474
+ #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10)
331
475
  #else
332
- #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor
476
+ #define EIGEN_CUDA_SDK_VER 0
333
477
  #endif
334
478
 
335
- #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
336
- #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
479
+ #if defined(__HIPCC__) && !defined(EIGEN_NO_HIP)
480
+ // Means the compiler is HIPCC (analogous to EIGEN_CUDACC, but for HIP)
481
+ #define EIGEN_HIPCC __HIPCC__
482
+
483
+ // We need to include hip_runtime.h here because it pulls in
484
+ // ++ hip_common.h which contains the define for __HIP_DEVICE_COMPILE__
485
+ // ++ host_defines.h which contains the defines for the __host__ and __device__ macros
486
+ #include <hip/hip_runtime.h>
487
+
488
+ #if defined(__HIP_DEVICE_COMPILE__)
489
+ // analogous to EIGEN_CUDA_ARCH, but for HIP
490
+ #define EIGEN_HIP_DEVICE_COMPILE __HIP_DEVICE_COMPILE__
491
+ #endif
492
+
493
+ // For HIP (ROCm 3.5 and higher), we need to explicitly set the launch_bounds attribute
494
+ // value to 1024. The compiler assigns a default value of 256 when the attribute is not
495
+ // specified. This results in failures on the HIP platform, for cases when a GPU kernel
496
+ // without an explicit launch_bounds attribute is called with a threads_per_block value
497
+ // greater than 256.
498
+ //
499
+ // This is a regression in functioanlity and is expected to be fixed within the next
500
+ // couple of ROCm releases (compiler will go back to using 1024 value as the default)
501
+ //
502
+ // In the meantime, we will use a "only enabled for HIP" macro to set the launch_bounds
503
+ // attribute.
504
+
505
+ #define EIGEN_HIP_LAUNCH_BOUNDS_1024 __launch_bounds__(1024)
506
+
507
+ #endif
508
+
509
+ #if !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
510
+ #define EIGEN_HIP_LAUNCH_BOUNDS_1024
511
+ #endif // !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
512
+
513
+ // Unify CUDA/HIPCC
514
+
515
+ #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
516
+ //
517
+ // If either EIGEN_CUDACC or EIGEN_HIPCC is defined, then define EIGEN_GPUCC
518
+ //
519
+ #define EIGEN_GPUCC
520
+ //
521
+ // EIGEN_HIPCC implies the HIP compiler and is used to tweak Eigen code for use in HIP kernels
522
+ // EIGEN_CUDACC implies the CUDA compiler and is used to tweak Eigen code for use in CUDA kernels
523
+ //
524
+ // In most cases the same tweaks are required to the Eigen code to enable in both the HIP and CUDA kernels.
525
+ // For those cases, the corresponding code should be guarded with
526
+ // #if defined(EIGEN_GPUCC)
527
+ // instead of
528
+ // #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
529
+ //
530
+ // For cases where the tweak is specific to HIP, the code should be guarded with
531
+ // #if defined(EIGEN_HIPCC)
532
+ //
533
+ // For cases where the tweak is specific to CUDA, the code should be guarded with
534
+ // #if defined(EIGEN_CUDACC)
535
+ //
536
+ #endif
537
+
538
+ #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
539
+ //
540
+ // If either EIGEN_CUDA_ARCH or EIGEN_HIP_DEVICE_COMPILE is defined, then define EIGEN_GPU_COMPILE_PHASE
541
+ //
542
+ #define EIGEN_GPU_COMPILE_PHASE
543
+ //
544
+ // GPU compilers (HIPCC, NVCC) typically do two passes over the source code,
545
+ // + one to compile the source for the "host" (ie CPU)
546
+ // + another to compile the source for the "device" (ie. GPU)
547
+ //
548
+ // Code that needs to enabled only during the either the "host" or "device" compilation phase
549
+ // needs to be guarded with a macro that indicates the current compilation phase
550
+ //
551
+ // EIGEN_HIP_DEVICE_COMPILE implies the device compilation phase in HIP
552
+ // EIGEN_CUDA_ARCH implies the device compilation phase in CUDA
553
+ //
554
+ // In most cases, the "host" / "device" specific code is the same for both HIP and CUDA
555
+ // For those cases, the code should be guarded with
556
+ // #if defined(EIGEN_GPU_COMPILE_PHASE)
557
+ // instead of
558
+ // #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
559
+ //
560
+ // For cases where the tweak is specific to HIP, the code should be guarded with
561
+ // #if defined(EIGEN_HIP_DEVICE_COMPILE)
562
+ //
563
+ // For cases where the tweak is specific to CUDA, the code should be guarded with
564
+ // #if defined(EIGEN_CUDA_ARCH)
565
+ //
566
+ #endif
567
+
568
+ #if defined(EIGEN_USE_SYCL) && defined(__SYCL_DEVICE_ONLY__)
569
+ // EIGEN_USE_SYCL is a user-defined macro while __SYCL_DEVICE_ONLY__ is a compiler-defined macro.
570
+ // In most cases we want to check if both macros are defined which can be done using the define below.
571
+ #define SYCL_DEVICE_ONLY
572
+ #endif
573
+
574
+ //------------------------------------------------------------------------------------------
575
+ // Detect Compiler/Architecture/OS specific features
576
+ //------------------------------------------------------------------------------------------
577
+
578
+ #if EIGEN_GNUC_AT_MOST(4,3) && !EIGEN_COMP_CLANG
579
+ // see bug 89
580
+ #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
581
+ #else
582
+ #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
337
583
  #endif
338
584
 
339
585
  // Cross compiler wrapper around LLVM's __has_builtin
@@ -349,26 +595,79 @@
349
595
  # define __has_feature(x) 0
350
596
  #endif
351
597
 
352
- // Upperbound on the C++ version to use.
353
- // Expected values are 03, 11, 14, 17, etc.
354
- // By default, let's use an arbitrarily large C++ version.
355
- #ifndef EIGEN_MAX_CPP_VER
356
- #define EIGEN_MAX_CPP_VER 99
598
+ // Some old compilers do not support template specializations like:
599
+ // template<typename T,int N> void foo(const T x[N]);
600
+ #if !( EIGEN_COMP_CLANG && ( (EIGEN_COMP_CLANG<309) \
601
+ || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000))) \
602
+ || EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<49)
603
+ #define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 1
604
+ #else
605
+ #define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 0
606
+ #endif
607
+
608
+ // The macro EIGEN_CPLUSPLUS is a replacement for __cplusplus/_MSVC_LANG that
609
+ // works for both platforms, indicating the C++ standard version number.
610
+ //
611
+ // With MSVC, without defining /Zc:__cplusplus, the __cplusplus macro will
612
+ // report 199711L regardless of the language standard specified via /std.
613
+ // We need to rely on _MSVC_LANG instead, which is only available after
614
+ // VS2015.3.
615
+ #if EIGEN_COMP_MSVC_LANG > 0
616
+ #define EIGEN_CPLUSPLUS EIGEN_COMP_MSVC_LANG
617
+ #elif EIGEN_COMP_MSVC >= 1900
618
+ #define EIGEN_CPLUSPLUS 201103L
619
+ #elif defined(__cplusplus)
620
+ #define EIGEN_CPLUSPLUS __cplusplus
621
+ #else
622
+ #define EIGEN_CPLUSPLUS 0
623
+ #endif
624
+
625
+ // The macro EIGEN_COMP_CXXVER defines the c++ verson expected by the compiler.
626
+ // For instance, if compiling with gcc and -std=c++17, then EIGEN_COMP_CXXVER
627
+ // is defined to 17.
628
+ #if EIGEN_CPLUSPLUS > 201703L
629
+ #define EIGEN_COMP_CXXVER 20
630
+ #elif EIGEN_CPLUSPLUS > 201402L
631
+ #define EIGEN_COMP_CXXVER 17
632
+ #elif EIGEN_CPLUSPLUS > 201103L
633
+ #define EIGEN_COMP_CXXVER 14
634
+ #elif EIGEN_CPLUSPLUS >= 201103L
635
+ #define EIGEN_COMP_CXXVER 11
636
+ #else
637
+ #define EIGEN_COMP_CXXVER 03
638
+ #endif
639
+
640
+ #ifndef EIGEN_HAS_CXX14_VARIABLE_TEMPLATES
641
+ #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && EIGEN_MAX_CPP_VER>=14
642
+ #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 1
643
+ #else
644
+ #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 0
645
+ #endif
357
646
  #endif
358
647
 
359
- #if EIGEN_MAX_CPP_VER>=11 && (defined(__cplusplus) && (__cplusplus >= 201103L) || EIGEN_COMP_MSVC >= 1900)
648
+
649
+ // The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features
650
+ // but in practice we should not rely on them but rather on the availabilty of
651
+ // individual features as defined later.
652
+ // This is why there is no EIGEN_HAS_CXX17.
653
+ // FIXME: get rid of EIGEN_HAS_CXX14 and maybe even EIGEN_HAS_CXX11.
654
+ #if EIGEN_MAX_CPP_VER>=11 && EIGEN_COMP_CXXVER>=11
360
655
  #define EIGEN_HAS_CXX11 1
361
656
  #else
362
657
  #define EIGEN_HAS_CXX11 0
363
658
  #endif
364
659
 
660
+ #if EIGEN_MAX_CPP_VER>=14 && EIGEN_COMP_CXXVER>=14
661
+ #define EIGEN_HAS_CXX14 1
662
+ #else
663
+ #define EIGEN_HAS_CXX14 0
664
+ #endif
365
665
 
366
666
  // Do we support r-value references?
367
667
  #ifndef EIGEN_HAS_RVALUE_REFERENCES
368
668
  #if EIGEN_MAX_CPP_VER>=11 && \
369
669
  (__has_feature(cxx_rvalue_references) || \
370
- (defined(__cplusplus) && __cplusplus >= 201103L) || \
371
- (EIGEN_COMP_MSVC >= 1600))
670
+ (EIGEN_COMP_CXXVER >= 11) || (EIGEN_COMP_MSVC >= 1600))
372
671
  #define EIGEN_HAS_RVALUE_REFERENCES 1
373
672
  #else
374
673
  #define EIGEN_HAS_RVALUE_REFERENCES 0
@@ -376,11 +675,14 @@
376
675
  #endif
377
676
 
378
677
  // Does the compiler support C99?
678
+ // Need to include <cmath> to make sure _GLIBCXX_USE_C99 gets defined
679
+ #include <cmath>
379
680
  #ifndef EIGEN_HAS_C99_MATH
380
681
  #if EIGEN_MAX_CPP_VER>=11 && \
381
682
  ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
382
683
  || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
383
- || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)))
684
+ || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \
685
+ || (EIGEN_COMP_MSVC >= 1900) || defined(SYCL_DEVICE_ONLY))
384
686
  #define EIGEN_HAS_C99_MATH 1
385
687
  #else
386
688
  #define EIGEN_HAS_C99_MATH 0
@@ -388,21 +690,73 @@
388
690
  #endif
389
691
 
390
692
  // Does the compiler support result_of?
693
+ // result_of was deprecated in c++17 and removed in c++ 20
391
694
  #ifndef EIGEN_HAS_STD_RESULT_OF
392
- #if EIGEN_MAX_CPP_VER>=11 && ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L)))
695
+ #if EIGEN_HAS_CXX11 && EIGEN_COMP_CXXVER < 17
393
696
  #define EIGEN_HAS_STD_RESULT_OF 1
394
697
  #else
395
698
  #define EIGEN_HAS_STD_RESULT_OF 0
396
699
  #endif
397
700
  #endif
398
701
 
702
+ // Does the compiler support std::hash?
703
+ #ifndef EIGEN_HAS_STD_HASH
704
+ // The std::hash struct is defined in C++11 but is not labelled as a __device__
705
+ // function and is not constexpr, so cannot be used on device.
706
+ #if EIGEN_HAS_CXX11 && !defined(EIGEN_GPU_COMPILE_PHASE)
707
+ #define EIGEN_HAS_STD_HASH 1
708
+ #else
709
+ #define EIGEN_HAS_STD_HASH 0
710
+ #endif
711
+ #endif // EIGEN_HAS_STD_HASH
712
+
713
+ #ifndef EIGEN_HAS_STD_INVOKE_RESULT
714
+ #if EIGEN_MAX_CPP_VER >= 17 && EIGEN_COMP_CXXVER >= 17
715
+ #define EIGEN_HAS_STD_INVOKE_RESULT 1
716
+ #else
717
+ #define EIGEN_HAS_STD_INVOKE_RESULT 0
718
+ #endif
719
+ #endif
720
+
721
+ #ifndef EIGEN_HAS_ALIGNAS
722
+ #if EIGEN_MAX_CPP_VER>=11 && EIGEN_HAS_CXX11 && \
723
+ ( __has_feature(cxx_alignas) \
724
+ || EIGEN_HAS_CXX14 \
725
+ || (EIGEN_COMP_MSVC >= 1800) \
726
+ || (EIGEN_GNUC_AT_LEAST(4,8)) \
727
+ || (EIGEN_COMP_CLANG>=305) \
728
+ || (EIGEN_COMP_ICC>=1500) \
729
+ || (EIGEN_COMP_PGI>=1500) \
730
+ || (EIGEN_COMP_SUNCC>=0x5130))
731
+ #define EIGEN_HAS_ALIGNAS 1
732
+ #else
733
+ #define EIGEN_HAS_ALIGNAS 0
734
+ #endif
735
+ #endif
736
+
737
+ // Does the compiler support type_traits?
738
+ // - full support of type traits was added only to GCC 5.1.0.
739
+ // - 20150626 corresponds to the last release of 4.x libstdc++
740
+ #ifndef EIGEN_HAS_TYPE_TRAITS
741
+ #if EIGEN_MAX_CPP_VER>=11 && (EIGEN_HAS_CXX11 || EIGEN_COMP_MSVC >= 1700) \
742
+ && ((!EIGEN_COMP_GNUC_STRICT) || EIGEN_GNUC_AT_LEAST(5, 1)) \
743
+ && ((!defined(__GLIBCXX__)) || __GLIBCXX__ > 20150626)
744
+ #define EIGEN_HAS_TYPE_TRAITS 1
745
+ #define EIGEN_INCLUDE_TYPE_TRAITS
746
+ #else
747
+ #define EIGEN_HAS_TYPE_TRAITS 0
748
+ #endif
749
+ #endif
750
+
399
751
  // Does the compiler support variadic templates?
400
752
  #ifndef EIGEN_HAS_VARIADIC_TEMPLATES
401
- #if EIGEN_MAX_CPP_VER>=11 && (__cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900) \
402
- && (!defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64 || (EIGEN_CUDACC_VER >= 80000) )
753
+ #if EIGEN_MAX_CPP_VER>=11 && (EIGEN_COMP_CXXVER >= 11) \
754
+ && (!defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64 || (EIGEN_COMP_NVCC >= 80000) )
403
755
  // ^^ Disable the use of variadic templates when compiling with versions of nvcc older than 8.0 on ARM devices:
404
756
  // this prevents nvcc from crashing when compiling Eigen on Tegra X1
405
757
  #define EIGEN_HAS_VARIADIC_TEMPLATES 1
758
+ #elif EIGEN_MAX_CPP_VER>=11 && (EIGEN_COMP_CXXVER >= 11) && defined(SYCL_DEVICE_ONLY)
759
+ #define EIGEN_HAS_VARIADIC_TEMPLATES 1
406
760
  #else
407
761
  #define EIGEN_HAS_VARIADIC_TEMPLATES 0
408
762
  #endif
@@ -410,27 +764,33 @@
410
764
 
411
765
  // Does the compiler fully support const expressions? (as in c++14)
412
766
  #ifndef EIGEN_HAS_CONSTEXPR
767
+ #if defined(EIGEN_CUDACC)
768
+ // Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above
769
+ #if EIGEN_MAX_CPP_VER>=14 && (EIGEN_COMP_CXXVER >= 11 && (EIGEN_COMP_CLANG || EIGEN_COMP_NVCC >= 70500))
770
+ #define EIGEN_HAS_CONSTEXPR 1
771
+ #endif
772
+ #elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (EIGEN_COMP_CXXVER >= 14) || \
773
+ (EIGEN_GNUC_AT_LEAST(4,8) && (EIGEN_COMP_CXXVER >= 11)) || \
774
+ (EIGEN_COMP_CLANG >= 306 && (EIGEN_COMP_CXXVER >= 11)))
775
+ #define EIGEN_HAS_CONSTEXPR 1
776
+ #endif
413
777
 
414
- #ifdef __CUDACC__
415
- // Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above
416
- #if EIGEN_MAX_CPP_VER>=14 && (__cplusplus > 199711L && (EIGEN_COMP_CLANG || EIGEN_CUDACC_VER >= 70500))
417
- #define EIGEN_HAS_CONSTEXPR 1
418
- #endif
419
- #elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (defined(__cplusplus) && __cplusplus >= 201402L) || \
420
- (EIGEN_GNUC_AT_LEAST(4,8) && (__cplusplus > 199711L)))
421
- #define EIGEN_HAS_CONSTEXPR 1
422
- #endif
778
+ #ifndef EIGEN_HAS_CONSTEXPR
779
+ #define EIGEN_HAS_CONSTEXPR 0
780
+ #endif
423
781
 
424
- #ifndef EIGEN_HAS_CONSTEXPR
425
- #define EIGEN_HAS_CONSTEXPR 0
426
- #endif
782
+ #endif // EIGEN_HAS_CONSTEXPR
427
783
 
784
+ #if EIGEN_HAS_CONSTEXPR
785
+ #define EIGEN_CONSTEXPR constexpr
786
+ #else
787
+ #define EIGEN_CONSTEXPR
428
788
  #endif
429
789
 
430
790
  // Does the compiler support C++11 math?
431
791
  // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
432
792
  #ifndef EIGEN_HAS_CXX11_MATH
433
- #if EIGEN_MAX_CPP_VER>=11 && ((__cplusplus > 201103L) || (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
793
+ #if EIGEN_MAX_CPP_VER>=11 && ((EIGEN_COMP_CXXVER > 11) || (EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
434
794
  && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC))
435
795
  #define EIGEN_HAS_CXX11_MATH 1
436
796
  #else
@@ -441,9 +801,8 @@
441
801
  // Does the compiler support proper C++11 containers?
442
802
  #ifndef EIGEN_HAS_CXX11_CONTAINERS
443
803
  #if EIGEN_MAX_CPP_VER>=11 && \
444
- ((__cplusplus > 201103L) \
445
- || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \
446
- || EIGEN_COMP_MSVC >= 1900)
804
+ ((EIGEN_COMP_CXXVER > 11) \
805
+ || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC>=1400)))
447
806
  #define EIGEN_HAS_CXX11_CONTAINERS 1
448
807
  #else
449
808
  #define EIGEN_HAS_CXX11_CONTAINERS 0
@@ -454,24 +813,88 @@
454
813
  #ifndef EIGEN_HAS_CXX11_NOEXCEPT
455
814
  #if EIGEN_MAX_CPP_VER>=11 && \
456
815
  (__has_feature(cxx_noexcept) \
457
- || (__cplusplus > 201103L) \
458
- || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \
459
- || EIGEN_COMP_MSVC >= 1900)
816
+ || (EIGEN_COMP_CXXVER > 11) \
817
+ || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC>=1400)))
460
818
  #define EIGEN_HAS_CXX11_NOEXCEPT 1
461
819
  #else
462
820
  #define EIGEN_HAS_CXX11_NOEXCEPT 0
463
821
  #endif
464
822
  #endif
465
823
 
466
- /** Allows to disable some optimizations which might affect the accuracy of the result.
467
- * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
468
- * They currently include:
469
- * - single precision ArrayBase::sin() and ArrayBase::cos() for SSE and AVX vectorization.
470
- */
471
- #ifndef EIGEN_FAST_MATH
472
- #define EIGEN_FAST_MATH 1
824
+ #ifndef EIGEN_HAS_CXX11_ATOMIC
825
+ #if EIGEN_MAX_CPP_VER>=11 && \
826
+ (__has_feature(cxx_atomic) \
827
+ || (EIGEN_COMP_CXXVER > 11) \
828
+ || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_MSVC==0 || EIGEN_COMP_MSVC >= 1700)))
829
+ #define EIGEN_HAS_CXX11_ATOMIC 1
830
+ #else
831
+ #define EIGEN_HAS_CXX11_ATOMIC 0
832
+ #endif
833
+ #endif
834
+
835
+ #ifndef EIGEN_HAS_CXX11_OVERRIDE_FINAL
836
+ #if EIGEN_MAX_CPP_VER>=11 && \
837
+ (EIGEN_COMP_CXXVER >= 11 || EIGEN_COMP_MSVC >= 1700)
838
+ #define EIGEN_HAS_CXX11_OVERRIDE_FINAL 1
839
+ #else
840
+ #define EIGEN_HAS_CXX11_OVERRIDE_FINAL 0
841
+ #endif
842
+ #endif
843
+
844
+ // NOTE: the required Apple's clang version is very conservative
845
+ // and it could be that XCode 9 works just fine.
846
+ // NOTE: the MSVC version is based on https://en.cppreference.com/w/cpp/compiler_support
847
+ // and not tested.
848
+ #ifndef EIGEN_HAS_CXX17_OVERALIGN
849
+ #if EIGEN_MAX_CPP_VER>=17 && EIGEN_COMP_CXXVER>=17 && ( \
850
+ (EIGEN_COMP_MSVC >= 1912) \
851
+ || (EIGEN_GNUC_AT_LEAST(7,0)) \
852
+ || ((!defined(__apple_build_version__)) && (EIGEN_COMP_CLANG>=500)) \
853
+ || (( defined(__apple_build_version__)) && (__apple_build_version__>=10000000)) \
854
+ )
855
+ #define EIGEN_HAS_CXX17_OVERALIGN 1
856
+ #else
857
+ #define EIGEN_HAS_CXX17_OVERALIGN 0
858
+ #endif
859
+ #endif
860
+
861
+ #if defined(EIGEN_CUDACC) && EIGEN_HAS_CONSTEXPR
862
+ // While available already with c++11, this is useful mostly starting with c++14 and relaxed constexpr rules
863
+ #if defined(__NVCC__)
864
+ // nvcc considers constexpr functions as __host__ __device__ with the option --expt-relaxed-constexpr
865
+ #ifdef __CUDACC_RELAXED_CONSTEXPR__
866
+ #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
867
+ #endif
868
+ #elif defined(__clang__) && defined(__CUDA__) && __has_feature(cxx_relaxed_constexpr)
869
+ // clang++ always considers constexpr functions as implicitly __host__ __device__
870
+ #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
871
+ #endif
473
872
  #endif
474
873
 
874
+ // Does the compiler support the __int128 and __uint128_t extensions for 128-bit
875
+ // integer arithmetic?
876
+ //
877
+ // Clang and GCC define __SIZEOF_INT128__ when these extensions are supported,
878
+ // but we avoid using them in certain cases:
879
+ //
880
+ // * Building using Clang for Windows, where the Clang runtime library has
881
+ // 128-bit support only on LP64 architectures, but Windows is LLP64.
882
+ #ifndef EIGEN_HAS_BUILTIN_INT128
883
+ #if defined(__SIZEOF_INT128__) && !(EIGEN_OS_WIN && EIGEN_COMP_CLANG)
884
+ #define EIGEN_HAS_BUILTIN_INT128 1
885
+ #else
886
+ #define EIGEN_HAS_BUILTIN_INT128 0
887
+ #endif
888
+ #endif
889
+
890
+ //------------------------------------------------------------------------------------------
891
+ // Preprocessor programming helpers
892
+ //------------------------------------------------------------------------------------------
893
+
894
+ // This macro can be used to prevent from macro expansion, e.g.:
895
+ // std::max EIGEN_NOT_A_MACRO(a,b)
896
+ #define EIGEN_NOT_A_MACRO
897
+
475
898
  #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
476
899
 
477
900
  // concatenate two tokens
@@ -488,7 +911,7 @@
488
911
  // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
489
912
  // but GCC is still doing fine with just inline.
490
913
  #ifndef EIGEN_STRONG_INLINE
491
- #if EIGEN_COMP_MSVC || EIGEN_COMP_ICC
914
+ #if (EIGEN_COMP_MSVC || EIGEN_COMP_ICC) && !defined(EIGEN_GPUCC)
492
915
  #define EIGEN_STRONG_INLINE __forceinline
493
916
  #else
494
917
  #define EIGEN_STRONG_INLINE inline
@@ -503,7 +926,7 @@
503
926
  // Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
504
927
  // : function body not available
505
928
  // See also bug 1367
506
- #if EIGEN_GNUC_AT_LEAST(4,2)
929
+ #if EIGEN_GNUC_AT_LEAST(4,2) && !defined(SYCL_DEVICE_ONLY)
507
930
  #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
508
931
  #else
509
932
  #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
@@ -523,12 +946,43 @@
523
946
  #define EIGEN_PERMISSIVE_EXPR
524
947
  #endif
525
948
 
949
+ // GPU stuff
950
+
951
+ // Disable some features when compiling with GPU compilers (NVCC/clang-cuda/SYCL/HIPCC)
952
+ #if defined(EIGEN_CUDACC) || defined(SYCL_DEVICE_ONLY) || defined(EIGEN_HIPCC)
953
+ // Do not try asserts on device code
954
+ #ifndef EIGEN_NO_DEBUG
955
+ #define EIGEN_NO_DEBUG
956
+ #endif
957
+
958
+ #ifdef EIGEN_INTERNAL_DEBUGGING
959
+ #undef EIGEN_INTERNAL_DEBUGGING
960
+ #endif
961
+
962
+ #ifdef EIGEN_EXCEPTIONS
963
+ #undef EIGEN_EXCEPTIONS
964
+ #endif
965
+ #endif
966
+
967
+ #if defined(SYCL_DEVICE_ONLY)
968
+ #ifndef EIGEN_DONT_VECTORIZE
969
+ #define EIGEN_DONT_VECTORIZE
970
+ #endif
971
+ #define EIGEN_DEVICE_FUNC __attribute__((flatten)) __attribute__((always_inline))
972
+ // All functions callable from CUDA/HIP code must be qualified with __device__
973
+ #elif defined(EIGEN_GPUCC)
974
+ #define EIGEN_DEVICE_FUNC __host__ __device__
975
+ #else
976
+ #define EIGEN_DEVICE_FUNC
977
+ #endif
978
+
979
+
526
980
  // this macro allows to get rid of linking errors about multiply defined functions.
527
981
  // - static is not very good because it prevents definitions from different object files to be merged.
528
982
  // So static causes the resulting linked executable to be bloated with multiple copies of the same function.
529
983
  // - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
530
- #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
531
- #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
984
+ #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC
985
+ #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC inline
532
986
 
533
987
  #ifdef NDEBUG
534
988
  # ifndef EIGEN_NO_DEBUG
@@ -538,7 +992,11 @@
538
992
 
539
993
  // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
540
994
  #ifdef EIGEN_NO_DEBUG
541
- #define eigen_plain_assert(x)
995
+ #ifdef SYCL_DEVICE_ONLY // used to silence the warning on SYCL device
996
+ #define eigen_plain_assert(x) EIGEN_UNUSED_VARIABLE(x)
997
+ #else
998
+ #define eigen_plain_assert(x)
999
+ #endif
542
1000
  #else
543
1001
  #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
544
1002
  namespace Eigen {
@@ -612,7 +1070,7 @@
612
1070
  // Suppresses 'unused variable' warnings.
613
1071
  namespace Eigen {
614
1072
  namespace internal {
615
- template<typename T> EIGEN_DEVICE_FUNC void ignore_unused_variable(const T&) {}
1073
+ template<typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void ignore_unused_variable(const T&) {}
616
1074
  }
617
1075
  }
618
1076
  #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
@@ -626,169 +1084,75 @@ namespace Eigen {
626
1084
  #endif
627
1085
 
628
1086
 
629
- //------------------------------------------------------------------------------------------
630
- // Static and dynamic alignment control
1087
+ // Acts as a barrier preventing operations involving `X` from crossing. This
1088
+ // occurs, for example, in the fast rounding trick where a magic constant is
1089
+ // added then subtracted, which is otherwise compiled away with -ffast-math.
631
1090
  //
632
- // The main purpose of this section is to define EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES
633
- // as the maximal boundary in bytes on which dynamically and statically allocated data may be alignment respectively.
634
- // The values of EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES can be specified by the user. If not,
635
- // a default value is automatically computed based on architecture, compiler, and OS.
636
- //
637
- // This section also defines macros EIGEN_ALIGN_TO_BOUNDARY(N) and the shortcuts EIGEN_ALIGN{8,16,32,_MAX}
638
- // to be used to declare statically aligned buffers.
639
- //------------------------------------------------------------------------------------------
640
-
641
-
642
- /* EIGEN_ALIGN_TO_BOUNDARY(n) forces data to be n-byte aligned. This is used to satisfy SIMD requirements.
643
- * However, we do that EVEN if vectorization (EIGEN_VECTORIZE) is disabled,
644
- * so that vectorization doesn't affect binary compatibility.
645
- *
646
- * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
647
- * vectorized and non-vectorized code.
648
- */
649
- #if (defined __CUDACC__)
650
- #define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n)
651
- #elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM
652
- #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
653
- #elif EIGEN_COMP_MSVC
654
- #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
655
- #elif EIGEN_COMP_SUNCC
656
- // FIXME not sure about this one:
657
- #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
658
- #else
659
- #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
660
- #endif
661
-
662
- // If the user explicitly disable vectorization, then we also disable alignment
663
- #if defined(EIGEN_DONT_VECTORIZE)
664
- #define EIGEN_IDEAL_MAX_ALIGN_BYTES 0
665
- #elif defined(EIGEN_VECTORIZE_AVX512)
666
- // 64 bytes static alignmeent is preferred only if really required
667
- #define EIGEN_IDEAL_MAX_ALIGN_BYTES 64
668
- #elif defined(__AVX__)
669
- // 32 bytes static alignmeent is preferred only if really required
670
- #define EIGEN_IDEAL_MAX_ALIGN_BYTES 32
671
- #else
672
- #define EIGEN_IDEAL_MAX_ALIGN_BYTES 16
673
- #endif
674
-
675
-
676
- // EIGEN_MIN_ALIGN_BYTES defines the minimal value for which the notion of explicit alignment makes sense
677
- #define EIGEN_MIN_ALIGN_BYTES 16
678
-
679
- // Defined the boundary (in bytes) on which the data needs to be aligned. Note
680
- // that unless EIGEN_ALIGN is defined and not equal to 0, the data may not be
681
- // aligned at all regardless of the value of this #define.
682
-
683
- #if (defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN)) && defined(EIGEN_MAX_STATIC_ALIGN_BYTES) && EIGEN_MAX_STATIC_ALIGN_BYTES>0
684
- #error EIGEN_MAX_STATIC_ALIGN_BYTES and EIGEN_DONT_ALIGN[_STATICALLY] are both defined with EIGEN_MAX_STATIC_ALIGN_BYTES!=0. Use EIGEN_MAX_STATIC_ALIGN_BYTES=0 as a synonym of EIGEN_DONT_ALIGN_STATICALLY.
685
- #endif
686
-
687
- // EIGEN_DONT_ALIGN_STATICALLY and EIGEN_DONT_ALIGN are deprectated
688
- // They imply EIGEN_MAX_STATIC_ALIGN_BYTES=0
689
- #if defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN)
690
- #ifdef EIGEN_MAX_STATIC_ALIGN_BYTES
691
- #undef EIGEN_MAX_STATIC_ALIGN_BYTES
692
- #endif
693
- #define EIGEN_MAX_STATIC_ALIGN_BYTES 0
694
- #endif
695
-
696
- #ifndef EIGEN_MAX_STATIC_ALIGN_BYTES
697
-
698
- // Try to automatically guess what is the best default value for EIGEN_MAX_STATIC_ALIGN_BYTES
699
-
700
- // 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable
701
- // 16 byte alignment on all platforms where vectorization might be enabled. In theory we could always
702
- // enable alignment, but it can be a cause of problems on some platforms, so we just disable it in
703
- // certain common platform (compiler+architecture combinations) to avoid these problems.
704
- // Only static alignment is really problematic (relies on nonstandard compiler extensions),
705
- // try to keep heap alignment even when we have to disable static alignment.
706
- #if EIGEN_COMP_GNUC && !(EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64 || EIGEN_ARCH_PPC || EIGEN_ARCH_IA64)
707
- #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
708
- #elif EIGEN_ARCH_ARM_OR_ARM64 && EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(4, 6)
709
- // Old versions of GCC on ARM, at least 4.4, were once seen to have buggy static alignment support.
710
- // Not sure which version fixed it, hopefully it doesn't affect 4.7, which is still somewhat in use.
711
- // 4.8 and newer seem definitely unaffected.
712
- #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
713
- #else
714
- #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
715
- #endif
716
-
717
- // static alignment is completely disabled with GCC 3, Sun Studio, and QCC/QNX
718
- #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
719
- && !EIGEN_GCC3_OR_OLDER \
720
- && !EIGEN_COMP_SUNCC \
721
- && !EIGEN_OS_QNX
722
- #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
723
- #else
724
- #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
725
- #endif
726
-
727
- #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT
728
- #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
1091
+ // See bug 1674
1092
+ #if !defined(EIGEN_OPTIMIZATION_BARRIER)
1093
+ #if EIGEN_COMP_GNUC
1094
+ // According to https://gcc.gnu.org/onlinedocs/gcc/Constraints.html:
1095
+ // X: Any operand whatsoever.
1096
+ // r: A register operand is allowed provided that it is in a general
1097
+ // register.
1098
+ // g: Any register, memory or immediate integer operand is allowed, except
1099
+ // for registers that are not general registers.
1100
+ // w: (AArch32/AArch64) Floating point register, Advanced SIMD vector
1101
+ // register or SVE vector register.
1102
+ // x: (SSE) Any SSE register.
1103
+ // (AArch64) Like w, but restricted to registers 0 to 15 inclusive.
1104
+ // v: (PowerPC) An Altivec vector register.
1105
+ // wa:(PowerPC) A VSX register.
1106
+ //
1107
+ // "X" (uppercase) should work for all cases, though this seems to fail for
1108
+ // some versions of GCC for arm/aarch64 with
1109
+ // "error: inconsistent operand constraints in an 'asm'"
1110
+ // Clang x86_64/arm/aarch64 seems to require "g" to support both scalars and
1111
+ // vectors, otherwise
1112
+ // "error: non-trivial scalar-to-vector conversion, possible invalid
1113
+ // constraint for vector type"
1114
+ //
1115
+ // GCC for ppc64le generates an internal compiler error with x/X/g.
1116
+ // GCC for AVX generates an internal compiler error with X.
1117
+ //
1118
+ // Tested on icc/gcc/clang for sse, avx, avx2, avx512dq
1119
+ // gcc for arm, aarch64,
1120
+ // gcc for ppc64le,
1121
+ // both vectors and scalars.
1122
+ //
1123
+ // Note that this is restricted to plain types - this will not work
1124
+ // directly for std::complex<T>, Eigen::half, Eigen::bfloat16. For these,
1125
+ // you will need to apply to the underlying POD type.
1126
+ #if EIGEN_ARCH_PPC && EIGEN_COMP_GNUC_STRICT
1127
+ // This seems to be broken on clang. Packet4f is loaded into a single
1128
+ // register rather than a vector, zeroing out some entries. Integer
1129
+ // types also generate a compile error.
1130
+ // General, Altivec, VSX.
1131
+ #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+r,v,wa" (X));
1132
+ #elif EIGEN_ARCH_ARM_OR_ARM64
1133
+ // General, NEON.
1134
+ #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,w" (X));
1135
+ #elif EIGEN_ARCH_i386_OR_x86_64
1136
+ // General, SSE.
1137
+ #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,x" (X));
1138
+ #else
1139
+ // Not implemented for other architectures.
1140
+ #define EIGEN_OPTIMIZATION_BARRIER(X)
1141
+ #endif
729
1142
  #else
730
- #define EIGEN_MAX_STATIC_ALIGN_BYTES 0
731
- #endif
732
-
733
- #endif
734
-
735
- // If EIGEN_MAX_ALIGN_BYTES is defined, then it is considered as an upper bound for EIGEN_MAX_ALIGN_BYTES
736
- #if defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES<EIGEN_MAX_STATIC_ALIGN_BYTES
737
- #undef EIGEN_MAX_STATIC_ALIGN_BYTES
738
- #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES
739
- #endif
740
-
741
- #if EIGEN_MAX_STATIC_ALIGN_BYTES==0 && !defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
742
- #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
743
- #endif
744
-
745
- // At this stage, EIGEN_MAX_STATIC_ALIGN_BYTES>0 is the true test whether we want to align arrays on the stack or not.
746
- // It takes into account both the user choice to explicitly enable/disable alignment (by settting EIGEN_MAX_STATIC_ALIGN_BYTES)
747
- // and the architecture config (EIGEN_ARCH_WANTS_STACK_ALIGNMENT).
748
- // Henceforth, only EIGEN_MAX_STATIC_ALIGN_BYTES should be used.
749
-
750
-
751
- // Shortcuts to EIGEN_ALIGN_TO_BOUNDARY
752
- #define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
753
- #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
754
- #define EIGEN_ALIGN32 EIGEN_ALIGN_TO_BOUNDARY(32)
755
- #define EIGEN_ALIGN64 EIGEN_ALIGN_TO_BOUNDARY(64)
756
- #if EIGEN_MAX_STATIC_ALIGN_BYTES>0
757
- #define EIGEN_ALIGN_MAX EIGEN_ALIGN_TO_BOUNDARY(EIGEN_MAX_STATIC_ALIGN_BYTES)
758
- #else
759
- #define EIGEN_ALIGN_MAX
760
- #endif
761
-
762
-
763
- // Dynamic alignment control
764
-
765
- #if defined(EIGEN_DONT_ALIGN) && defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES>0
766
- #error EIGEN_MAX_ALIGN_BYTES and EIGEN_DONT_ALIGN are both defined with EIGEN_MAX_ALIGN_BYTES!=0. Use EIGEN_MAX_ALIGN_BYTES=0 as a synonym of EIGEN_DONT_ALIGN.
767
- #endif
768
-
769
- #ifdef EIGEN_DONT_ALIGN
770
- #ifdef EIGEN_MAX_ALIGN_BYTES
771
- #undef EIGEN_MAX_ALIGN_BYTES
1143
+ // Not implemented for other compilers.
1144
+ #define EIGEN_OPTIMIZATION_BARRIER(X)
772
1145
  #endif
773
- #define EIGEN_MAX_ALIGN_BYTES 0
774
- #elif !defined(EIGEN_MAX_ALIGN_BYTES)
775
- #define EIGEN_MAX_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
776
1146
  #endif
777
1147
 
778
- #if EIGEN_IDEAL_MAX_ALIGN_BYTES > EIGEN_MAX_ALIGN_BYTES
779
- #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
1148
+ #if EIGEN_COMP_MSVC
1149
+ // NOTE MSVC often gives C4127 warnings with compiletime if statements. See bug 1362.
1150
+ // This workaround is ugly, but it does the job.
1151
+ # define EIGEN_CONST_CONDITIONAL(cond) (void)0, cond
780
1152
  #else
781
- #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES
782
- #endif
783
-
784
-
785
- #ifndef EIGEN_UNALIGNED_VECTORIZE
786
- #define EIGEN_UNALIGNED_VECTORIZE 1
1153
+ # define EIGEN_CONST_CONDITIONAL(cond) cond
787
1154
  #endif
788
1155
 
789
- //----------------------------------------------------------------------
790
-
791
-
792
1156
  #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
793
1157
  #define EIGEN_RESTRICT
794
1158
  #endif
@@ -796,10 +1160,6 @@ namespace Eigen {
796
1160
  #define EIGEN_RESTRICT __restrict
797
1161
  #endif
798
1162
 
799
- #ifndef EIGEN_STACK_ALLOCATION_LIMIT
800
- // 131072 == 128 KB
801
- #define EIGEN_STACK_ALLOCATION_LIMIT 131072
802
- #endif
803
1163
 
804
1164
  #ifndef EIGEN_DEFAULT_IO_FORMAT
805
1165
  #ifdef EIGEN_MAKING_DOCS
@@ -814,8 +1174,23 @@ namespace Eigen {
814
1174
  // just an empty macro !
815
1175
  #define EIGEN_EMPTY
816
1176
 
817
- #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || EIGEN_CUDACC_VER>0)
818
- // for older MSVC versions, as well as 1900 && CUDA 8, using the base operator is sufficient (cf Bugs 1000, 1324)
1177
+
1178
+ // When compiling CUDA/HIP device code with NVCC or HIPCC
1179
+ // pull in math functions from the global namespace.
1180
+ // In host mode, and when device code is compiled with clang,
1181
+ // use the std versions.
1182
+ #if (defined(EIGEN_CUDA_ARCH) && defined(__NVCC__)) || defined(EIGEN_HIP_DEVICE_COMPILE)
1183
+ #define EIGEN_USING_STD(FUNC) using ::FUNC;
1184
+ #else
1185
+ #define EIGEN_USING_STD(FUNC) using std::FUNC;
1186
+ #endif
1187
+
1188
+ #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || (EIGEN_COMP_MSVC == 1900 && EIGEN_COMP_NVCC))
1189
+ // For older MSVC versions, as well as 1900 && CUDA 8, using the base operator is necessary,
1190
+ // otherwise we get duplicate definition errors
1191
+ // For later MSVC versions, we require explicit operator= definition, otherwise we get
1192
+ // use of implicitly deleted operator errors.
1193
+ // (cf Bugs 920, 1000, 1324, 2291)
819
1194
  #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
820
1195
  using Base::operator =;
821
1196
  #elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
@@ -835,11 +1210,48 @@ namespace Eigen {
835
1210
  #endif
836
1211
 
837
1212
 
1213
+ /**
1214
+ * \internal
1215
+ * \brief Macro to explicitly define the default copy constructor.
1216
+ * This is necessary, because the implicit definition is deprecated if the copy-assignment is overridden.
1217
+ */
1218
+ #if EIGEN_HAS_CXX11
1219
+ #define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS) CLASS(const CLASS&) = default;
1220
+ #else
1221
+ #define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
1222
+ #endif
1223
+
1224
+
1225
+
838
1226
  /** \internal
839
1227
  * \brief Macro to manually inherit assignment operators.
840
1228
  * This is necessary, because the implicitly defined assignment operator gets deleted when a custom operator= is defined.
1229
+ * With C++11 or later this also default-implements the copy-constructor
841
1230
  */
842
- #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
1231
+ #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
1232
+ EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1233
+ EIGEN_DEFAULT_COPY_CONSTRUCTOR(Derived)
1234
+
1235
+ /** \internal
1236
+ * \brief Macro to manually define default constructors and destructors.
1237
+ * This is necessary when the copy constructor is re-defined.
1238
+ * For empty helper classes this should usually be protected, to avoid accidentally creating empty objects.
1239
+ *
1240
+ * Hiding the default destructor lead to problems in C++03 mode together with boost::multiprecision
1241
+ */
1242
+ #if EIGEN_HAS_CXX11
1243
+ #define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived) \
1244
+ Derived() = default; \
1245
+ ~Derived() = default;
1246
+ #else
1247
+ #define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived) \
1248
+ Derived() {}; \
1249
+ /* ~Derived() {}; */
1250
+ #endif
1251
+
1252
+
1253
+
1254
+
843
1255
 
844
1256
  /**
845
1257
  * Just a side note. Commenting within defines works only by documenting
@@ -856,7 +1268,8 @@ namespace Eigen {
856
1268
  typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \
857
1269
  typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
858
1270
  typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \
859
- enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
1271
+ enum CompileTimeTraits \
1272
+ { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
860
1273
  ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
861
1274
  Flags = Eigen::internal::traits<Derived>::Flags, \
862
1275
  SizeAtCompileTime = Base::SizeAtCompileTime, \
@@ -901,6 +1314,14 @@ namespace Eigen {
901
1314
 
902
1315
  #define EIGEN_IMPLIES(a,b) (!(a) || (b))
903
1316
 
1317
+ #if EIGEN_HAS_BUILTIN(__builtin_expect) || EIGEN_COMP_GNUC
1318
+ #define EIGEN_PREDICT_FALSE(x) (__builtin_expect(x, false))
1319
+ #define EIGEN_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
1320
+ #else
1321
+ #define EIGEN_PREDICT_FALSE(x) (x)
1322
+ #define EIGEN_PREDICT_TRUE(x) (x)
1323
+ #endif
1324
+
904
1325
  // the expression type of a standard coefficient wise binary operation
905
1326
  #define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME) \
906
1327
  CwiseBinaryOp< \
@@ -932,14 +1353,14 @@ namespace Eigen {
932
1353
  const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR>
933
1354
 
934
1355
  // Workaround for MSVC 2010 (see ML thread "patch with compile for for MSVC 2010")
935
- #if EIGEN_COMP_MSVC_STRICT<=1600
1356
+ #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC_STRICT<=1600)
936
1357
  #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) typename internal::enable_if<true,X>::type
937
1358
  #else
938
1359
  #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) X
939
1360
  #endif
940
1361
 
941
1362
  #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) \
942
- template <typename T> EIGEN_DEVICE_FUNC inline \
1363
+ template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
943
1364
  EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type,OPNAME))\
944
1365
  (METHOD)(const T& scalar) const { \
945
1366
  typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type PromotedT; \
@@ -948,7 +1369,7 @@ namespace Eigen {
948
1369
  }
949
1370
 
950
1371
  #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
951
- template <typename T> EIGEN_DEVICE_FUNC inline friend \
1372
+ template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend \
952
1373
  EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type,Derived,OPNAME)) \
953
1374
  (METHOD)(const T& scalar, const StorageBaseType& matrix) { \
954
1375
  typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type PromotedT; \
@@ -961,15 +1382,23 @@ namespace Eigen {
961
1382
  EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME)
962
1383
 
963
1384
 
1385
+ #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_HIP_DEVICE_COMPILE)
1386
+ #define EIGEN_EXCEPTIONS
1387
+ #endif
1388
+
1389
+
964
1390
  #ifdef EIGEN_EXCEPTIONS
965
1391
  # define EIGEN_THROW_X(X) throw X
966
1392
  # define EIGEN_THROW throw
967
1393
  # define EIGEN_TRY try
968
1394
  # define EIGEN_CATCH(X) catch (X)
969
1395
  #else
970
- # ifdef __CUDA_ARCH__
1396
+ # if defined(EIGEN_CUDA_ARCH)
971
1397
  # define EIGEN_THROW_X(X) asm("trap;")
972
1398
  # define EIGEN_THROW asm("trap;")
1399
+ # elif defined(EIGEN_HIP_DEVICE_COMPILE)
1400
+ # define EIGEN_THROW_X(X) asm("s_trap 0")
1401
+ # define EIGEN_THROW asm("s_trap 0")
973
1402
  # else
974
1403
  # define EIGEN_THROW_X(X) std::abort()
975
1404
  # define EIGEN_THROW std::abort()
@@ -989,13 +1418,47 @@ namespace Eigen {
989
1418
  # define EIGEN_NOEXCEPT
990
1419
  # define EIGEN_NOEXCEPT_IF(x)
991
1420
  # define EIGEN_NO_THROW throw()
992
- # if EIGEN_COMP_MSVC
1421
+ # if EIGEN_COMP_MSVC || EIGEN_COMP_CXXVER>=17
993
1422
  // MSVC does not support exception specifications (warning C4290),
994
- // and they are deprecated in c++11 anyway.
1423
+ // and they are deprecated in c++11 anyway. This is even an error in c++17.
995
1424
  # define EIGEN_EXCEPTION_SPEC(X) throw()
996
1425
  # else
997
1426
  # define EIGEN_EXCEPTION_SPEC(X) throw(X)
998
1427
  # endif
999
1428
  #endif
1000
1429
 
1430
+ #if EIGEN_HAS_VARIADIC_TEMPLATES
1431
+ // The all function is used to enable a variadic version of eigen_assert which can take a parameter pack as its input.
1432
+ namespace Eigen {
1433
+ namespace internal {
1434
+
1435
+ inline bool all(){ return true; }
1436
+
1437
+ template<typename T, typename ...Ts>
1438
+ bool all(T t, Ts ... ts){ return t && all(ts...); }
1439
+
1440
+ }
1441
+ }
1442
+ #endif
1443
+
1444
+ #if EIGEN_HAS_CXX11_OVERRIDE_FINAL
1445
+ // provide override and final specifiers if they are available:
1446
+ # define EIGEN_OVERRIDE override
1447
+ # define EIGEN_FINAL final
1448
+ #else
1449
+ # define EIGEN_OVERRIDE
1450
+ # define EIGEN_FINAL
1451
+ #endif
1452
+
1453
+ // Wrapping #pragma unroll in a macro since it is required for SYCL
1454
+ #if defined(SYCL_DEVICE_ONLY)
1455
+ #if defined(_MSC_VER)
1456
+ #define EIGEN_UNROLL_LOOP __pragma(unroll)
1457
+ #else
1458
+ #define EIGEN_UNROLL_LOOP _Pragma("unroll")
1459
+ #endif
1460
+ #else
1461
+ #define EIGEN_UNROLL_LOOP
1462
+ #endif
1463
+
1001
1464
  #endif // EIGEN_MACROS_H