@smake/eigen 1.0.1 → 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.
Files changed (283) hide show
  1. package/README.md +1 -1
  2. package/eigen/COPYING.APACHE +203 -0
  3. package/eigen/COPYING.BSD +1 -1
  4. package/eigen/COPYING.MINPACK +51 -52
  5. package/eigen/Eigen/Cholesky +0 -1
  6. package/eigen/Eigen/Core +108 -266
  7. package/eigen/Eigen/Eigenvalues +0 -1
  8. package/eigen/Eigen/Geometry +3 -6
  9. package/eigen/Eigen/Householder +0 -1
  10. package/eigen/Eigen/Jacobi +0 -1
  11. package/eigen/Eigen/KLUSupport +41 -0
  12. package/eigen/Eigen/LU +2 -5
  13. package/eigen/Eigen/OrderingMethods +0 -3
  14. package/eigen/Eigen/PaStiXSupport +1 -0
  15. package/eigen/Eigen/PardisoSupport +0 -0
  16. package/eigen/Eigen/QR +0 -1
  17. package/eigen/Eigen/QtAlignedMalloc +0 -1
  18. package/eigen/Eigen/SVD +0 -1
  19. package/eigen/Eigen/Sparse +0 -2
  20. package/eigen/Eigen/SparseCholesky +0 -8
  21. package/eigen/Eigen/SparseLU +4 -0
  22. package/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
  23. package/eigen/Eigen/src/Cholesky/LLT.h +39 -23
  24. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
  25. package/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
  26. package/eigen/Eigen/src/Core/Array.h +99 -11
  27. package/eigen/Eigen/src/Core/ArrayBase.h +1 -1
  28. package/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
  29. package/eigen/Eigen/src/Core/Assign.h +1 -1
  30. package/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
  31. package/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
  32. package/eigen/Eigen/src/Core/BandMatrix.h +16 -16
  33. package/eigen/Eigen/src/Core/Block.h +56 -60
  34. package/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
  35. package/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
  36. package/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
  37. package/eigen/Eigen/src/Core/CoreIterators.h +5 -0
  38. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
  39. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
  40. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
  41. package/eigen/Eigen/src/Core/CwiseUnaryView.h +12 -10
  42. package/eigen/Eigen/src/Core/DenseBase.h +128 -39
  43. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
  44. package/eigen/Eigen/src/Core/DenseStorage.h +150 -68
  45. package/eigen/Eigen/src/Core/Diagonal.h +21 -23
  46. package/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
  47. package/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
  48. package/eigen/Eigen/src/Core/Dot.h +10 -10
  49. package/eigen/Eigen/src/Core/EigenBase.h +10 -9
  50. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
  51. package/eigen/Eigen/src/Core/Fuzzy.h +3 -3
  52. package/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
  53. package/eigen/Eigen/src/Core/GenericPacketMath.h +597 -147
  54. package/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
  55. package/eigen/Eigen/src/Core/IO.h +40 -7
  56. package/eigen/Eigen/src/Core/IndexedView.h +237 -0
  57. package/eigen/Eigen/src/Core/Inverse.h +9 -10
  58. package/eigen/Eigen/src/Core/Map.h +7 -7
  59. package/eigen/Eigen/src/Core/MapBase.h +5 -3
  60. package/eigen/Eigen/src/Core/MathFunctions.h +756 -120
  61. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
  62. package/eigen/Eigen/src/Core/Matrix.h +131 -25
  63. package/eigen/Eigen/src/Core/MatrixBase.h +19 -2
  64. package/eigen/Eigen/src/Core/NestByValue.h +25 -50
  65. package/eigen/Eigen/src/Core/NoAlias.h +4 -3
  66. package/eigen/Eigen/src/Core/NumTraits.h +107 -20
  67. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  68. package/eigen/Eigen/src/Core/PermutationMatrix.h +3 -3
  69. package/eigen/Eigen/src/Core/PlainObjectBase.h +145 -54
  70. package/eigen/Eigen/src/Core/Product.h +30 -25
  71. package/eigen/Eigen/src/Core/ProductEvaluators.h +183 -142
  72. package/eigen/Eigen/src/Core/Random.h +37 -1
  73. package/eigen/Eigen/src/Core/Redux.h +180 -170
  74. package/eigen/Eigen/src/Core/Ref.h +118 -21
  75. package/eigen/Eigen/src/Core/Replicate.h +8 -8
  76. package/eigen/Eigen/src/Core/Reshaped.h +454 -0
  77. package/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
  78. package/eigen/Eigen/src/Core/Reverse.h +18 -12
  79. package/eigen/Eigen/src/Core/Select.h +8 -6
  80. package/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
  81. package/eigen/Eigen/src/Core/Solve.h +14 -14
  82. package/eigen/Eigen/src/Core/SolveTriangular.h +13 -13
  83. package/eigen/Eigen/src/Core/SolverBase.h +41 -3
  84. package/eigen/Eigen/src/Core/StableNorm.h +100 -70
  85. package/eigen/Eigen/src/Core/StlIterators.h +463 -0
  86. package/eigen/Eigen/src/Core/Stride.h +9 -4
  87. package/eigen/Eigen/src/Core/Swap.h +5 -4
  88. package/eigen/Eigen/src/Core/Transpose.h +86 -27
  89. package/eigen/Eigen/src/Core/Transpositions.h +26 -8
  90. package/eigen/Eigen/src/Core/TriangularMatrix.h +88 -72
  91. package/eigen/Eigen/src/Core/VectorBlock.h +5 -5
  92. package/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
  93. package/eigen/Eigen/src/Core/Visitor.h +137 -29
  94. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
  95. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
  96. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
  97. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
  98. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  99. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +186 -213
  100. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1250 -252
  101. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  102. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
  103. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
  104. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  105. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  106. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  107. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
  108. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
  109. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  110. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
  111. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  112. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  113. package/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
  114. package/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
  115. package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  116. package/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
  117. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  118. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  119. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  120. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  121. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  122. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  123. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
  124. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  125. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
  126. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
  127. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  128. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
  129. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
  130. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
  131. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
  132. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  133. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  134. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  135. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  136. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  137. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  138. package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  139. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  140. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
  141. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
  142. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
  143. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
  144. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
  145. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
  146. package/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
  147. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +354 -15
  148. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1073 -585
  149. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +29 -7
  150. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +4 -4
  151. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +1 -1
  152. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
  153. package/eigen/Eigen/src/Core/products/Parallelizer.h +23 -9
  154. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +23 -6
  155. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
  156. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +2 -2
  157. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
  158. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +3 -3
  159. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +5 -3
  160. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
  161. package/eigen/Eigen/src/Core/util/BlasUtil.h +208 -124
  162. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  163. package/eigen/Eigen/src/Core/util/Constants.h +25 -9
  164. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +14 -2
  165. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +28 -4
  166. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  167. package/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
  168. package/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
  169. package/eigen/Eigen/src/Core/util/Macros.h +661 -250
  170. package/eigen/Eigen/src/Core/util/Memory.h +222 -52
  171. package/eigen/Eigen/src/Core/util/Meta.h +349 -105
  172. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  173. package/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
  174. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  175. package/eigen/Eigen/src/Core/util/XprHelper.h +48 -30
  176. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
  177. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +1 -1
  178. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
  179. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
  180. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
  181. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
  182. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
  183. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +10 -5
  184. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +75 -42
  185. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
  186. package/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
  187. package/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
  188. package/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
  189. package/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
  190. package/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
  191. package/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
  192. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
  193. package/eigen/Eigen/src/Geometry/Quaternion.h +52 -14
  194. package/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
  195. package/eigen/Eigen/src/Geometry/Scaling.h +22 -4
  196. package/eigen/Eigen/src/Geometry/Transform.h +86 -65
  197. package/eigen/Eigen/src/Geometry/Translation.h +6 -6
  198. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  199. package/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
  200. package/eigen/Eigen/src/Householder/Householder.h +8 -4
  201. package/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
  202. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
  203. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
  204. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
  205. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
  206. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
  207. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
  208. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
  209. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
  210. package/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
  211. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  212. package/eigen/Eigen/src/LU/Determinant.h +35 -19
  213. package/eigen/Eigen/src/LU/FullPivLU.h +29 -43
  214. package/eigen/Eigen/src/LU/InverseImpl.h +25 -8
  215. package/eigen/Eigen/src/LU/PartialPivLU.h +67 -57
  216. package/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
  217. package/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
  218. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
  219. package/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
  220. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
  221. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +10 -9
  222. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
  223. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
  224. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
  225. package/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
  226. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
  227. package/eigen/Eigen/src/SVD/BDCSVD.h +137 -48
  228. package/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
  229. package/eigen/Eigen/src/SVD/SVDBase.h +82 -21
  230. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
  231. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +16 -8
  232. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +11 -36
  233. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
  234. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
  235. package/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
  236. package/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
  237. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
  238. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
  239. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +2 -2
  240. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
  241. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +124 -10
  242. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
  243. package/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
  244. package/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
  245. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +3 -0
  246. package/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
  247. package/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
  248. package/eigen/Eigen/src/SparseLU/SparseLU.h +160 -10
  249. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
  250. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
  251. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
  252. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
  253. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
  254. package/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
  255. package/eigen/Eigen/src/StlSupport/StdDeque.h +2 -14
  256. package/eigen/Eigen/src/StlSupport/StdList.h +2 -2
  257. package/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
  258. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
  259. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
  260. package/eigen/Eigen/src/misc/lapacke.h +5 -4
  261. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +27 -1
  262. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
  263. package/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
  264. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
  265. package/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  266. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
  267. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
  268. package/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
  269. package/eigen/README.md +2 -0
  270. package/lib/LibEigen.d.ts +4 -0
  271. package/lib/LibEigen.js +14 -0
  272. package/lib/index.d.ts +1 -1
  273. package/lib/index.js +7 -3
  274. package/package.json +2 -10
  275. package/eigen/Eigen/CMakeLists.txt +0 -19
  276. package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
  277. package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  278. package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  279. package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  280. package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  281. package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
  282. package/lib/eigen.d.ts +0 -2
  283. package/lib/eigen.js +0 -15
@@ -90,8 +90,9 @@ namespace Eigen {
90
90
  m_Z(size, size),
91
91
  m_workspace(size*2),
92
92
  m_maxIters(400),
93
- m_isInitialized(false)
94
- { }
93
+ m_isInitialized(false),
94
+ m_computeQZ(true)
95
+ {}
95
96
 
96
97
  /** \brief Constructor; computes real QZ decomposition of given matrices
97
98
  *
@@ -108,9 +109,11 @@ namespace Eigen {
108
109
  m_Z(A.rows(),A.cols()),
109
110
  m_workspace(A.rows()*2),
110
111
  m_maxIters(400),
111
- m_isInitialized(false) {
112
- compute(A, B, computeQZ);
113
- }
112
+ m_isInitialized(false),
113
+ m_computeQZ(true)
114
+ {
115
+ compute(A, B, computeQZ);
116
+ }
114
117
 
115
118
  /** \brief Returns matrix Q in the QZ decomposition.
116
119
  *
@@ -161,7 +164,7 @@ namespace Eigen {
161
164
 
162
165
  /** \brief Reports whether previous computation was successful.
163
166
  *
164
- * \returns \c Success if computation was succesful, \c NoConvergence otherwise.
167
+ * \returns \c Success if computation was successful, \c NoConvergence otherwise.
165
168
  */
166
169
  ComputationInfo info() const
167
170
  {
@@ -190,7 +190,7 @@ template<typename _MatrixType> class RealSchur
190
190
  RealSchur& computeFromHessenberg(const HessMatrixType& matrixH, const OrthMatrixType& matrixQ, bool computeU);
191
191
  /** \brief Reports whether previous computation was successful.
192
192
  *
193
- * \returns \c Success if computation was succesful, \c NoConvergence otherwise.
193
+ * \returns \c Success if computation was successful, \c NoConvergence otherwise.
194
194
  */
195
195
  ComputationInfo info() const
196
196
  {
@@ -270,8 +270,13 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const EigenBase<InputType>
270
270
  // Step 1. Reduce to Hessenberg form
271
271
  m_hess.compute(matrix.derived()/scale);
272
272
 
273
- // Step 2. Reduce to real Schur form
274
- computeFromHessenberg(m_hess.matrixH(), m_hess.matrixQ(), computeU);
273
+ // Step 2. Reduce to real Schur form
274
+ // Note: we copy m_hess.matrixQ() into m_matU here and not in computeFromHessenberg
275
+ // to be able to pass our working-space buffer for the Householder to Dense evaluation.
276
+ m_workspaceVector.resize(matrix.cols());
277
+ if(computeU)
278
+ m_hess.matrixQ().evalTo(m_matU, m_workspaceVector);
279
+ computeFromHessenberg(m_hess.matrixH(), m_matU, computeU);
275
280
 
276
281
  m_matT *= scale;
277
282
 
@@ -284,13 +289,13 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::computeFromHessenberg(const HessMa
284
289
  using std::abs;
285
290
 
286
291
  m_matT = matrixH;
287
- if(computeU)
292
+ m_workspaceVector.resize(m_matT.cols());
293
+ if(computeU && !internal::is_same_dense(m_matU,matrixQ))
288
294
  m_matU = matrixQ;
289
295
 
290
296
  Index maxIters = m_maxIters;
291
297
  if (maxIters == -1)
292
298
  maxIters = m_maxIterationsPerRow * matrixH.rows();
293
- m_workspaceVector.resize(m_matT.cols());
294
299
  Scalar* workspace = &m_workspaceVector.coeffRef(0);
295
300
 
296
301
  // The matrix m_matT is divided in three parts.
@@ -20,7 +20,9 @@ class GeneralizedSelfAdjointEigenSolver;
20
20
 
21
21
  namespace internal {
22
22
  template<typename SolverType,int Size,bool IsComplex> struct direct_selfadjoint_eigenvalues;
23
+
23
24
  template<typename MatrixType, typename DiagType, typename SubDiagType>
25
+ EIGEN_DEVICE_FUNC
24
26
  ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec);
25
27
  }
26
28
 
@@ -42,10 +44,14 @@ ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag
42
44
  * \f$ v \f$ such that \f$ Av = \lambda v \f$. The eigenvalues of a
43
45
  * selfadjoint matrix are always real. If \f$ D \f$ is a diagonal matrix with
44
46
  * the eigenvalues on the diagonal, and \f$ V \f$ is a matrix with the
45
- * eigenvectors as its columns, then \f$ A = V D V^{-1} \f$ (for selfadjoint
46
- * matrices, the matrix \f$ V \f$ is always invertible). This is called the
47
+ * eigenvectors as its columns, then \f$ A = V D V^{-1} \f$. This is called the
47
48
  * eigendecomposition.
48
49
  *
50
+ * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
51
+ * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
52
+ * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
53
+ * equal to its transpose, \f$ V^{-1} = V^T \f$.
54
+ *
49
55
  * The algorithm exploits the fact that the matrix is selfadjoint, making it
50
56
  * faster and more accurate than the general purpose eigenvalue algorithms
51
57
  * implemented in EigenSolver and ComplexEigenSolver.
@@ -119,7 +125,10 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
119
125
  : m_eivec(),
120
126
  m_eivalues(),
121
127
  m_subdiag(),
122
- m_isInitialized(false)
128
+ m_hcoeffs(),
129
+ m_info(InvalidInput),
130
+ m_isInitialized(false),
131
+ m_eigenvectorsOk(false)
123
132
  { }
124
133
 
125
134
  /** \brief Constructor, pre-allocates memory for dynamic-size matrices.
@@ -139,7 +148,9 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
139
148
  : m_eivec(size, size),
140
149
  m_eivalues(size),
141
150
  m_subdiag(size > 1 ? size - 1 : 1),
142
- m_isInitialized(false)
151
+ m_hcoeffs(size > 1 ? size - 1 : 1),
152
+ m_isInitialized(false),
153
+ m_eigenvectorsOk(false)
143
154
  {}
144
155
 
145
156
  /** \brief Constructor; computes eigendecomposition of given matrix.
@@ -163,7 +174,9 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
163
174
  : m_eivec(matrix.rows(), matrix.cols()),
164
175
  m_eivalues(matrix.cols()),
165
176
  m_subdiag(matrix.rows() > 1 ? matrix.rows() - 1 : 1),
166
- m_isInitialized(false)
177
+ m_hcoeffs(matrix.cols() > 1 ? matrix.cols() - 1 : 1),
178
+ m_isInitialized(false),
179
+ m_eigenvectorsOk(false)
167
180
  {
168
181
  compute(matrix.derived(), options);
169
182
  }
@@ -250,6 +263,11 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
250
263
  * matrix \f$ A \f$, then the matrix returned by this function is the
251
264
  * matrix \f$ V \f$ in the eigendecomposition \f$ A = V D V^{-1} \f$.
252
265
  *
266
+ * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
267
+ * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
268
+ * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
269
+ * equal to its transpose, \f$ V^{-1} = V^T \f$.
270
+ *
253
271
  * Example: \include SelfAdjointEigenSolver_eigenvectors.cpp
254
272
  * Output: \verbinclude SelfAdjointEigenSolver_eigenvectors.out
255
273
  *
@@ -337,7 +355,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
337
355
 
338
356
  /** \brief Reports whether previous computation was successful.
339
357
  *
340
- * \returns \c Success if computation was succesful, \c NoConvergence otherwise.
358
+ * \returns \c Success if computation was successful, \c NoConvergence otherwise.
341
359
  */
342
360
  EIGEN_DEVICE_FUNC
343
361
  ComputationInfo info() const
@@ -354,7 +372,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
354
372
  static const int m_maxIterations = 30;
355
373
 
356
374
  protected:
357
- static void check_template_parameters()
375
+ static EIGEN_DEVICE_FUNC
376
+ void check_template_parameters()
358
377
  {
359
378
  EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
360
379
  }
@@ -362,6 +381,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
362
381
  EigenvectorsType m_eivec;
363
382
  RealVectorType m_eivalues;
364
383
  typename TridiagonalizationType::SubDiagonalType m_subdiag;
384
+ typename TridiagonalizationType::CoeffVectorType m_hcoeffs;
365
385
  ComputationInfo m_info;
366
386
  bool m_isInitialized;
367
387
  bool m_eigenvectorsOk;
@@ -403,7 +423,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
403
423
 
404
424
  const InputType &matrix(a_matrix.derived());
405
425
 
406
- using std::abs;
426
+ EIGEN_USING_STD(abs);
407
427
  eigen_assert(matrix.cols() == matrix.rows());
408
428
  eigen_assert((options&~(EigVecMask|GenEigMask))==0
409
429
  && (options&EigVecMask)!=EigVecMask
@@ -434,7 +454,8 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
434
454
  if(scale==RealScalar(0)) scale = RealScalar(1);
435
455
  mat.template triangularView<Lower>() /= scale;
436
456
  m_subdiag.resize(n-1);
437
- internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
457
+ m_hcoeffs.resize(n-1);
458
+ internal::tridiagonalization_inplace(mat, diag, m_subdiag, m_hcoeffs, computeEigenvectors);
438
459
 
439
460
  m_info = internal::computeFromTridiagonal_impl(diag, m_subdiag, m_maxIterations, computeEigenvectors, m_eivec);
440
461
 
@@ -479,10 +500,9 @@ namespace internal {
479
500
  * \returns \c Success or \c NoConvergence
480
501
  */
481
502
  template<typename MatrixType, typename DiagType, typename SubDiagType>
503
+ EIGEN_DEVICE_FUNC
482
504
  ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec)
483
505
  {
484
- using std::abs;
485
-
486
506
  ComputationInfo info;
487
507
  typedef typename MatrixType::Scalar Scalar;
488
508
 
@@ -493,15 +513,23 @@ ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag
493
513
 
494
514
  typedef typename DiagType::RealScalar RealScalar;
495
515
  const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();
496
- const RealScalar precision = RealScalar(2)*NumTraits<RealScalar>::epsilon();
497
-
516
+ const RealScalar precision_inv = RealScalar(1)/NumTraits<RealScalar>::epsilon();
498
517
  while (end>0)
499
518
  {
500
- for (Index i = start; i<end; ++i)
501
- if (internal::isMuchSmallerThan(abs(subdiag[i]),(abs(diag[i])+abs(diag[i+1])),precision) || abs(subdiag[i]) <= considerAsZero)
502
- subdiag[i] = 0;
519
+ for (Index i = start; i<end; ++i) {
520
+ if (numext::abs(subdiag[i]) < considerAsZero) {
521
+ subdiag[i] = RealScalar(0);
522
+ } else {
523
+ // abs(subdiag[i]) <= epsilon * sqrt(abs(diag[i]) + abs(diag[i+1]))
524
+ // Scaled to prevent underflows.
525
+ const RealScalar scaled_subdiag = precision_inv * subdiag[i];
526
+ if (scaled_subdiag * scaled_subdiag <= (numext::abs(diag[i])+numext::abs(diag[i+1]))) {
527
+ subdiag[i] = RealScalar(0);
528
+ }
529
+ }
530
+ }
503
531
 
504
- // find the largest unreduced block
532
+ // find the largest unreduced block at the end of the matrix.
505
533
  while (end>0 && subdiag[end-1]==RealScalar(0))
506
534
  {
507
535
  end--;
@@ -535,7 +563,7 @@ ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag
535
563
  diag.segment(i,n-i).minCoeff(&k);
536
564
  if (k > 0)
537
565
  {
538
- std::swap(diag[i], diag[k+i]);
566
+ numext::swap(diag[i], diag[k+i]);
539
567
  if(computeEigenvectors)
540
568
  eivec.col(i).swap(eivec.col(k+i));
541
569
  }
@@ -566,10 +594,10 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
566
594
  EIGEN_DEVICE_FUNC
567
595
  static inline void computeRoots(const MatrixType& m, VectorType& roots)
568
596
  {
569
- EIGEN_USING_STD_MATH(sqrt)
570
- EIGEN_USING_STD_MATH(atan2)
571
- EIGEN_USING_STD_MATH(cos)
572
- EIGEN_USING_STD_MATH(sin)
597
+ EIGEN_USING_STD(sqrt)
598
+ EIGEN_USING_STD(atan2)
599
+ EIGEN_USING_STD(cos)
600
+ EIGEN_USING_STD(sin)
573
601
  const Scalar s_inv3 = Scalar(1)/Scalar(3);
574
602
  const Scalar s_sqrt3 = sqrt(Scalar(3));
575
603
 
@@ -605,8 +633,8 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
605
633
  EIGEN_DEVICE_FUNC
606
634
  static inline bool extract_kernel(MatrixType& mat, Ref<VectorType> res, Ref<VectorType> representative)
607
635
  {
608
- EIGEN_USING_STD_MATH(sqrt)
609
- EIGEN_USING_STD_MATH(abs)
636
+ EIGEN_USING_STD(abs);
637
+ EIGEN_USING_STD(sqrt);
610
638
  Index i0;
611
639
  // Find non-zero column i0 (by construction, there must exist a non zero coefficient on the diagonal):
612
640
  mat.diagonal().cwiseAbs().maxCoeff(&i0);
@@ -720,7 +748,7 @@ struct direct_selfadjoint_eigenvalues<SolverType,2,false>
720
748
  EIGEN_DEVICE_FUNC
721
749
  static inline void computeRoots(const MatrixType& m, VectorType& roots)
722
750
  {
723
- using std::sqrt;
751
+ EIGEN_USING_STD(sqrt);
724
752
  const Scalar t0 = Scalar(0.5) * sqrt( numext::abs2(m(0,0)-m(1,1)) + Scalar(4)*numext::abs2(m(1,0)));
725
753
  const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1));
726
754
  roots(0) = t1 - t0;
@@ -730,8 +758,8 @@ struct direct_selfadjoint_eigenvalues<SolverType,2,false>
730
758
  EIGEN_DEVICE_FUNC
731
759
  static inline void run(SolverType& solver, const MatrixType& mat, int options)
732
760
  {
733
- EIGEN_USING_STD_MATH(sqrt);
734
- EIGEN_USING_STD_MATH(abs);
761
+ EIGEN_USING_STD(sqrt);
762
+ EIGEN_USING_STD(abs);
735
763
 
736
764
  eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
737
765
  eigen_assert((options&~(EigVecMask|GenEigMask))==0
@@ -804,32 +832,38 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
804
832
  }
805
833
 
806
834
  namespace internal {
835
+
836
+ // Francis implicit QR step.
807
837
  template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
808
838
  EIGEN_DEVICE_FUNC
809
839
  static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
810
840
  {
811
- using std::abs;
841
+ // Wilkinson Shift.
812
842
  RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
813
843
  RealScalar e = subdiag[end-1];
814
844
  // Note that thanks to scaling, e^2 or td^2 cannot overflow, however they can still
815
845
  // underflow thus leading to inf/NaN values when using the following commented code:
816
- // RealScalar e2 = numext::abs2(subdiag[end-1]);
817
- // RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
846
+ // RealScalar e2 = numext::abs2(subdiag[end-1]);
847
+ // RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
818
848
  // This explain the following, somewhat more complicated, version:
819
849
  RealScalar mu = diag[end];
820
- if(td==RealScalar(0))
821
- mu -= abs(e);
822
- else
823
- {
824
- RealScalar e2 = numext::abs2(subdiag[end-1]);
825
- RealScalar h = numext::hypot(td,e);
826
- if(e2==RealScalar(0)) mu -= (e / (td + (td>RealScalar(0) ? RealScalar(1) : RealScalar(-1)))) * (e / h);
827
- else mu -= e2 / (td + (td>RealScalar(0) ? h : -h));
850
+ if(td==RealScalar(0)) {
851
+ mu -= numext::abs(e);
852
+ } else if (e != RealScalar(0)) {
853
+ const RealScalar e2 = numext::abs2(e);
854
+ const RealScalar h = numext::hypot(td,e);
855
+ if(e2 == RealScalar(0)) {
856
+ mu -= e / ((td + (td>RealScalar(0) ? h : -h)) / e);
857
+ } else {
858
+ mu -= e2 / (td + (td>RealScalar(0) ? h : -h));
859
+ }
828
860
  }
829
-
861
+
830
862
  RealScalar x = diag[start] - mu;
831
863
  RealScalar z = subdiag[start];
832
- for (Index k = start; k < end; ++k)
864
+ // If z ever becomes zero, the Givens rotation will be the identity and
865
+ // z will stay zero for all future iterations.
866
+ for (Index k = start; k < end && z != RealScalar(0); ++k)
833
867
  {
834
868
  JacobiRotation<RealScalar> rot;
835
869
  rot.makeGivens(x, z);
@@ -842,12 +876,11 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
842
876
  diag[k+1] = rot.s() * sdk + rot.c() * dkp1;
843
877
  subdiag[k] = rot.c() * sdk - rot.s() * dkp1;
844
878
 
845
-
846
879
  if (k > start)
847
880
  subdiag[k - 1] = rot.c() * subdiag[k-1] - rot.s() * z;
848
881
 
882
+ // "Chasing the bulge" to return to triangular form.
849
883
  x = subdiag[k];
850
-
851
884
  if (k < end - 1)
852
885
  {
853
886
  z = -rot.s() * subdiag[k+1];
@@ -11,10 +11,10 @@
11
11
  #ifndef EIGEN_TRIDIAGONALIZATION_H
12
12
  #define EIGEN_TRIDIAGONALIZATION_H
13
13
 
14
- namespace Eigen {
14
+ namespace Eigen {
15
15
 
16
16
  namespace internal {
17
-
17
+
18
18
  template<typename MatrixType> struct TridiagonalizationMatrixTReturnType;
19
19
  template<typename MatrixType>
20
20
  struct traits<TridiagonalizationMatrixTReturnType<MatrixType> >
@@ -25,6 +25,7 @@ struct traits<TridiagonalizationMatrixTReturnType<MatrixType> >
25
25
  };
26
26
 
27
27
  template<typename MatrixType, typename CoeffVectorType>
28
+ EIGEN_DEVICE_FUNC
28
29
  void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs);
29
30
  }
30
31
 
@@ -344,6 +345,7 @@ namespace internal {
344
345
  * \sa Tridiagonalization::packedMatrix()
345
346
  */
346
347
  template<typename MatrixType, typename CoeffVectorType>
348
+ EIGEN_DEVICE_FUNC
347
349
  void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
348
350
  {
349
351
  using numext::conj;
@@ -352,7 +354,7 @@ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
352
354
  Index n = matA.rows();
353
355
  eigen_assert(n==matA.cols());
354
356
  eigen_assert(n==hCoeffs.size()+1 || n==1);
355
-
357
+
356
358
  for (Index i = 0; i<n-1; ++i)
357
359
  {
358
360
  Index remainingSize = n-i-1;
@@ -423,11 +425,13 @@ struct tridiagonalization_inplace_selector;
423
425
  *
424
426
  * \sa class Tridiagonalization
425
427
  */
426
- template<typename MatrixType, typename DiagonalType, typename SubDiagonalType>
427
- void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
428
+ template<typename MatrixType, typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
429
+ EIGEN_DEVICE_FUNC
430
+ void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag,
431
+ CoeffVectorType& hcoeffs, bool extractQ)
428
432
  {
429
433
  eigen_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1);
430
- tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, extractQ);
434
+ tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, hcoeffs, extractQ);
431
435
  }
432
436
 
433
437
  /** \internal
@@ -439,10 +443,10 @@ struct tridiagonalization_inplace_selector
439
443
  typedef typename Tridiagonalization<MatrixType>::CoeffVectorType CoeffVectorType;
440
444
  typedef typename Tridiagonalization<MatrixType>::HouseholderSequenceType HouseholderSequenceType;
441
445
  template<typename DiagonalType, typename SubDiagonalType>
442
- static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
446
+ static EIGEN_DEVICE_FUNC
447
+ void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType& hCoeffs, bool extractQ)
443
448
  {
444
- CoeffVectorType hCoeffs(mat.cols()-1);
445
- tridiagonalization_inplace(mat,hCoeffs);
449
+ tridiagonalization_inplace(mat, hCoeffs);
446
450
  diag = mat.diagonal().real();
447
451
  subdiag = mat.template diagonal<-1>().real();
448
452
  if(extractQ)
@@ -462,8 +466,8 @@ struct tridiagonalization_inplace_selector<MatrixType,3,false>
462
466
  typedef typename MatrixType::Scalar Scalar;
463
467
  typedef typename MatrixType::RealScalar RealScalar;
464
468
 
465
- template<typename DiagonalType, typename SubDiagonalType>
466
- static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
469
+ template<typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
470
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType&, bool extractQ)
467
471
  {
468
472
  using std::sqrt;
469
473
  const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
@@ -507,8 +511,9 @@ struct tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
507
511
  {
508
512
  typedef typename MatrixType::Scalar Scalar;
509
513
 
510
- template<typename DiagonalType, typename SubDiagonalType>
511
- static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, bool extractQ)
514
+ template<typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
515
+ static EIGEN_DEVICE_FUNC
516
+ void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, CoeffVectorType&, bool extractQ)
512
517
  {
513
518
  diag(0,0) = numext::real(mat(0,0));
514
519
  if(extractQ)
@@ -542,8 +547,8 @@ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
542
547
  result.template diagonal<-1>() = m_matrix.template diagonal<-1>();
543
548
  }
544
549
 
545
- Index rows() const { return m_matrix.rows(); }
546
- Index cols() const { return m_matrix.cols(); }
550
+ EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); }
551
+ EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }
547
552
 
548
553
  protected:
549
554
  typename MatrixType::Nested m_matrix;
@@ -7,10 +7,46 @@
7
7
  // Public License v. 2.0. If a copy of the MPL was not distributed
8
8
  // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
9
 
10
+ // Function void Eigen::AlignedBox::transform(const Transform& transform)
11
+ // is provided under the following license agreement:
12
+ //
13
+ // Software License Agreement (BSD License)
14
+ //
15
+ // Copyright (c) 2011-2014, Willow Garage, Inc.
16
+ // Copyright (c) 2014-2015, Open Source Robotics Foundation
17
+ // All rights reserved.
18
+ //
19
+ // Redistribution and use in source and binary forms, with or without
20
+ // modification, are permitted provided that the following conditions
21
+ // are met:
22
+ //
23
+ // * Redistributions of source code must retain the above copyright
24
+ // notice, this list of conditions and the following disclaimer.
25
+ // * Redistributions in binary form must reproduce the above
26
+ // copyright notice, this list of conditions and the following
27
+ // disclaimer in the documentation and/or other materials provided
28
+ // with the distribution.
29
+ // * Neither the name of Open Source Robotics Foundation nor the names of its
30
+ // contributors may be used to endorse or promote products derived
31
+ // from this software without specific prior written permission.
32
+ //
33
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
36
+ // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
37
+ // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38
+ // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
39
+ // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
+ // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41
+ // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42
+ // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43
+ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44
+ // POSSIBILITY OF SUCH DAMAGE.
45
+
10
46
  #ifndef EIGEN_ALIGNEDBOX_H
11
47
  #define EIGEN_ALIGNEDBOX_H
12
48
 
13
- namespace Eigen {
49
+ namespace Eigen {
14
50
 
15
51
  /** \geometry_module \ingroup Geometry_Module
16
52
  *
@@ -63,7 +99,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
63
99
 
64
100
  /** Default constructor initializing a null box. */
65
101
  EIGEN_DEVICE_FUNC inline AlignedBox()
66
- { if (AmbientDimAtCompileTime!=Dynamic) setEmpty(); }
102
+ { if (EIGEN_CONST_CONDITIONAL(AmbientDimAtCompileTime!=Dynamic)) setEmpty(); }
67
103
 
68
104
  /** Constructs a null box with \a _dim the dimension of the ambient space. */
69
105
  EIGEN_DEVICE_FUNC inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim)
@@ -231,7 +267,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
231
267
  {return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); }
232
268
 
233
269
  /** Returns an AlignedBox that is the union of \a b and \c *this.
234
- * \note Merging with an empty box may result in a box bigger than \c *this.
270
+ * \note Merging with an empty box may result in a box bigger than \c *this.
235
271
  * \sa extend(const AlignedBox&) */
236
272
  EIGEN_DEVICE_FUNC inline AlignedBox merged(const AlignedBox& b) const
237
273
  { return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); }
@@ -246,6 +282,15 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
246
282
  return *this;
247
283
  }
248
284
 
285
+ /** \returns a copy of \c *this translated by the vector \a t. */
286
+ template<typename Derived>
287
+ EIGEN_DEVICE_FUNC inline AlignedBox translated(const MatrixBase<Derived>& a_t) const
288
+ {
289
+ AlignedBox result(m_min, m_max);
290
+ result.translate(a_t);
291
+ return result;
292
+ }
293
+
249
294
  /** \returns the squared distance between the point \a p and the box \c *this,
250
295
  * and zero if \a p is inside the box.
251
296
  * \sa exteriorDistance(const MatrixBase&), squaredExteriorDistance(const AlignedBox&)
@@ -265,14 +310,63 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
265
310
  */
266
311
  template<typename Derived>
267
312
  EIGEN_DEVICE_FUNC inline NonInteger exteriorDistance(const MatrixBase<Derived>& p) const
268
- { EIGEN_USING_STD_MATH(sqrt) return sqrt(NonInteger(squaredExteriorDistance(p))); }
313
+ { EIGEN_USING_STD(sqrt) return sqrt(NonInteger(squaredExteriorDistance(p))); }
269
314
 
270
315
  /** \returns the distance between the boxes \a b and \c *this,
271
316
  * and zero if the boxes intersect.
272
317
  * \sa squaredExteriorDistance(const AlignedBox&), exteriorDistance(const MatrixBase&)
273
318
  */
274
319
  EIGEN_DEVICE_FUNC inline NonInteger exteriorDistance(const AlignedBox& b) const
275
- { EIGEN_USING_STD_MATH(sqrt) return sqrt(NonInteger(squaredExteriorDistance(b))); }
320
+ { EIGEN_USING_STD(sqrt) return sqrt(NonInteger(squaredExteriorDistance(b))); }
321
+
322
+ /**
323
+ * Specialization of transform for pure translation.
324
+ */
325
+ template<int Mode, int Options>
326
+ EIGEN_DEVICE_FUNC inline void transform(
327
+ const typename Transform<Scalar, AmbientDimAtCompileTime, Mode, Options>::TranslationType& translation)
328
+ {
329
+ this->translate(translation);
330
+ }
331
+
332
+ /**
333
+ * Transforms this box by \a transform and recomputes it to
334
+ * still be an axis-aligned box.
335
+ *
336
+ * \note This method is provided under BSD license (see the top of this file).
337
+ */
338
+ template<int Mode, int Options>
339
+ EIGEN_DEVICE_FUNC inline void transform(const Transform<Scalar, AmbientDimAtCompileTime, Mode, Options>& transform)
340
+ {
341
+ // Only Affine and Isometry transforms are currently supported.
342
+ EIGEN_STATIC_ASSERT(Mode == Affine || Mode == AffineCompact || Mode == Isometry, THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS);
343
+
344
+ // Method adapted from FCL src/shape/geometric_shapes_utility.cpp#computeBV<AABB, Box>(...)
345
+ // https://github.com/flexible-collision-library/fcl/blob/fcl-0.4/src/shape/geometric_shapes_utility.cpp#L292
346
+ //
347
+ // Here's a nice explanation why it works: https://zeuxcg.org/2010/10/17/aabb-from-obb-with-component-wise-abs/
348
+
349
+ // two times rotated extent
350
+ const VectorType rotated_extent_2 = transform.linear().cwiseAbs() * sizes();
351
+ // two times new center
352
+ const VectorType rotated_center_2 = transform.linear() * (this->m_max + this->m_min) +
353
+ Scalar(2) * transform.translation();
354
+
355
+ this->m_max = (rotated_center_2 + rotated_extent_2) / Scalar(2);
356
+ this->m_min = (rotated_center_2 - rotated_extent_2) / Scalar(2);
357
+ }
358
+
359
+ /**
360
+ * \returns a copy of \c *this transformed by \a transform and recomputed to
361
+ * still be an axis-aligned box.
362
+ */
363
+ template<int Mode, int Options>
364
+ EIGEN_DEVICE_FUNC AlignedBox transformed(const Transform<Scalar, AmbientDimAtCompileTime, Mode, Options>& transform) const
365
+ {
366
+ AlignedBox result(m_min, m_max);
367
+ result.transform(transform);
368
+ return result;
369
+ }
276
370
 
277
371
  /** \returns \c *this with scalar type casted to \a NewScalarType
278
372
  *
@@ -169,8 +169,8 @@ template<typename Scalar>
169
169
  template<typename QuatDerived>
170
170
  EIGEN_DEVICE_FUNC AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const QuaternionBase<QuatDerived>& q)
171
171
  {
172
- EIGEN_USING_STD_MATH(atan2)
173
- EIGEN_USING_STD_MATH(abs)
172
+ EIGEN_USING_STD(atan2)
173
+ EIGEN_USING_STD(abs)
174
174
  Scalar n = q.vec().norm();
175
175
  if(n<NumTraits<Scalar>::epsilon())
176
176
  n = q.vec().stableNorm();
@@ -217,8 +217,8 @@ template<typename Scalar>
217
217
  typename AngleAxis<Scalar>::Matrix3
218
218
  EIGEN_DEVICE_FUNC AngleAxis<Scalar>::toRotationMatrix(void) const
219
219
  {
220
- EIGEN_USING_STD_MATH(sin)
221
- EIGEN_USING_STD_MATH(cos)
220
+ EIGEN_USING_STD(sin)
221
+ EIGEN_USING_STD(cos)
222
222
  Matrix3 res;
223
223
  Vector3 sin_axis = sin(m_angle) * m_axis;
224
224
  Scalar c = cos(m_angle);
@@ -36,9 +36,9 @@ template<typename Derived>
36
36
  EIGEN_DEVICE_FUNC inline Matrix<typename MatrixBase<Derived>::Scalar,3,1>
37
37
  MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
38
38
  {
39
- EIGEN_USING_STD_MATH(atan2)
40
- EIGEN_USING_STD_MATH(sin)
41
- EIGEN_USING_STD_MATH(cos)
39
+ EIGEN_USING_STD(atan2)
40
+ EIGEN_USING_STD(sin)
41
+ EIGEN_USING_STD(cos)
42
42
  /* Implemented from Graphics Gems IV */
43
43
  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3)
44
44