@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
@@ -10,7 +10,7 @@
10
10
  #ifndef EIGEN_SELFADJOINTMATRIX_H
11
11
  #define EIGEN_SELFADJOINTMATRIX_H
12
12
 
13
- namespace Eigen {
13
+ namespace Eigen {
14
14
 
15
15
  /** \class SelfAdjointView
16
16
  * \ingroup Core_Module
@@ -58,14 +58,15 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
58
58
  typedef MatrixTypeNestedCleaned NestedExpression;
59
59
 
60
60
  /** \brief The type of coefficients in this matrix */
61
- typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
61
+ typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
62
62
  typedef typename MatrixType::StorageIndex StorageIndex;
63
63
  typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
64
+ typedef SelfAdjointView<typename internal::add_const<MatrixType>::type, UpLo> ConstSelfAdjointView;
64
65
 
65
66
  enum {
66
67
  Mode = internal::traits<SelfAdjointView>::Mode,
67
68
  Flags = internal::traits<SelfAdjointView>::Flags,
68
- TransposeMode = ((Mode & Upper) ? Lower : 0) | ((Mode & Lower) ? Upper : 0)
69
+ TransposeMode = ((int(Mode) & int(Upper)) ? Lower : 0) | ((int(Mode) & int(Lower)) ? Upper : 0)
69
70
  };
70
71
  typedef typename MatrixType::PlainObject PlainObject;
71
72
 
@@ -75,14 +76,14 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
75
76
  EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
76
77
  }
77
78
 
78
- EIGEN_DEVICE_FUNC
79
- inline Index rows() const { return m_matrix.rows(); }
80
- EIGEN_DEVICE_FUNC
81
- inline Index cols() const { return m_matrix.cols(); }
82
- EIGEN_DEVICE_FUNC
83
- inline Index outerStride() const { return m_matrix.outerStride(); }
84
- EIGEN_DEVICE_FUNC
85
- inline Index innerStride() const { return m_matrix.innerStride(); }
79
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
80
+ inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); }
81
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
82
+ inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }
83
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
84
+ inline Index outerStride() const EIGEN_NOEXCEPT { return m_matrix.outerStride(); }
85
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
86
+ inline Index innerStride() const EIGEN_NOEXCEPT { return m_matrix.innerStride(); }
86
87
 
87
88
  /** \sa MatrixBase::coeff()
88
89
  * \warning the coordinates must fit into the referenced triangular part
@@ -131,7 +132,7 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
131
132
  {
132
133
  return Product<OtherDerived,SelfAdjointView>(lhs.derived(),rhs);
133
134
  }
134
-
135
+
135
136
  friend EIGEN_DEVICE_FUNC
136
137
  const SelfAdjointView<const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,MatrixType,product),UpLo>
137
138
  operator*(const Scalar& s, const SelfAdjointView& mat)
@@ -197,6 +198,18 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
197
198
  inline const ConjugateReturnType conjugate() const
198
199
  { return ConjugateReturnType(m_matrix.conjugate()); }
199
200
 
201
+ /** \returns an expression of the complex conjugate of \c *this if Cond==true,
202
+ * returns \c *this otherwise.
203
+ */
204
+ template<bool Cond>
205
+ EIGEN_DEVICE_FUNC
206
+ inline typename internal::conditional<Cond,ConjugateReturnType,ConstSelfAdjointView>::type
207
+ conjugateIf() const
208
+ {
209
+ typedef typename internal::conditional<Cond,ConjugateReturnType,ConstSelfAdjointView>::type ReturnType;
210
+ return ReturnType(m_matrix.template conjugateIf<Cond>());
211
+ }
212
+
200
213
  typedef SelfAdjointView<const typename MatrixType::AdjointReturnType,TransposeMode> AdjointReturnType;
201
214
  /** \sa MatrixBase::adjoint() const */
202
215
  EIGEN_DEVICE_FUNC
@@ -287,17 +300,17 @@ protected:
287
300
  using Base::m_src;
288
301
  using Base::m_functor;
289
302
  public:
290
-
303
+
291
304
  typedef typename Base::DstEvaluatorType DstEvaluatorType;
292
305
  typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
293
306
  typedef typename Base::Scalar Scalar;
294
307
  typedef typename Base::AssignmentTraits AssignmentTraits;
295
-
296
-
308
+
309
+
297
310
  EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr)
298
311
  : Base(dst, src, func, dstExpr)
299
312
  {}
300
-
313
+
301
314
  EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col)
302
315
  {
303
316
  eigen_internal_assert(row!=col);
@@ -305,12 +318,12 @@ public:
305
318
  m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
306
319
  m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
307
320
  }
308
-
321
+
309
322
  EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
310
323
  {
311
324
  Base::assignCoeff(id,id);
312
325
  }
313
-
326
+
314
327
  EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index, Index)
315
328
  { eigen_internal_assert(false && "should never be called"); }
316
329
  };
@@ -324,7 +337,7 @@ public:
324
337
  /** This is the const version of MatrixBase::selfadjointView() */
325
338
  template<typename Derived>
326
339
  template<unsigned int UpLo>
327
- typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
340
+ EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
328
341
  MatrixBase<Derived>::selfadjointView() const
329
342
  {
330
343
  return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
@@ -341,7 +354,7 @@ MatrixBase<Derived>::selfadjointView() const
341
354
  */
342
355
  template<typename Derived>
343
356
  template<unsigned int UpLo>
344
- typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
357
+ EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
345
358
  MatrixBase<Derived>::selfadjointView()
346
359
  {
347
360
  return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
@@ -13,13 +13,13 @@
13
13
  namespace Eigen {
14
14
 
15
15
  template<typename Decomposition, typename RhsType, typename StorageKind> class SolveImpl;
16
-
16
+
17
17
  /** \class Solve
18
18
  * \ingroup Core_Module
19
19
  *
20
20
  * \brief Pseudo expression representing a solving operation
21
21
  *
22
- * \tparam Decomposition the type of the matrix or decomposion object
22
+ * \tparam Decomposition the type of the matrix or decomposition object
23
23
  * \tparam Rhstype the type of the right-hand side
24
24
  *
25
25
  * This class represents an expression of A.solve(B)
@@ -64,13 +64,13 @@ class Solve : public SolveImpl<Decomposition,RhsType,typename internal::traits<R
64
64
  public:
65
65
  typedef typename internal::traits<Solve>::PlainObject PlainObject;
66
66
  typedef typename internal::traits<Solve>::StorageIndex StorageIndex;
67
-
67
+
68
68
  Solve(const Decomposition &dec, const RhsType &rhs)
69
69
  : m_dec(dec), m_rhs(rhs)
70
70
  {}
71
-
72
- EIGEN_DEVICE_FUNC Index rows() const { return m_dec.cols(); }
73
- EIGEN_DEVICE_FUNC Index cols() const { return m_rhs.cols(); }
71
+
72
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dec.cols(); }
73
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); }
74
74
 
75
75
  EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; }
76
76
  EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; }
@@ -87,14 +87,14 @@ class SolveImpl<Decomposition,RhsType,Dense>
87
87
  : public MatrixBase<Solve<Decomposition,RhsType> >
88
88
  {
89
89
  typedef Solve<Decomposition,RhsType> Derived;
90
-
90
+
91
91
  public:
92
-
92
+
93
93
  typedef MatrixBase<Solve<Decomposition,RhsType> > Base;
94
94
  EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
95
95
 
96
96
  private:
97
-
97
+
98
98
  Scalar coeff(Index row, Index col) const;
99
99
  Scalar coeff(Index i) const;
100
100
  };
@@ -119,15 +119,15 @@ struct evaluator<Solve<Decomposition,RhsType> >
119
119
  typedef evaluator<PlainObject> Base;
120
120
 
121
121
  enum { Flags = Base::Flags | EvalBeforeNestingBit };
122
-
122
+
123
123
  EIGEN_DEVICE_FUNC explicit evaluator(const SolveType& solve)
124
124
  : m_result(solve.rows(), solve.cols())
125
125
  {
126
126
  ::new (static_cast<Base*>(this)) Base(m_result);
127
127
  solve.dec()._solve_impl(solve.rhs(), m_result);
128
128
  }
129
-
130
- protected:
129
+
130
+ protected:
131
131
  PlainObject m_result;
132
132
  };
133
133
 
@@ -176,12 +176,12 @@ struct Assignment<DstXprType, Solve<CwiseUnaryOp<internal::scalar_conjugate_op<t
176
176
  Index dstCols = src.cols();
177
177
  if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
178
178
  dst.resize(dstRows, dstCols);
179
-
179
+
180
180
  src.dec().nestedExpression().nestedExpression().template _solve_impl_transposed<true>(src.rhs(), dst);
181
181
  }
182
182
  };
183
183
 
184
- } // end namepsace internal
184
+ } // end namespace internal
185
185
 
186
186
  } // end namespace Eigen
187
187
 
@@ -10,7 +10,7 @@
10
10
  #ifndef EIGEN_SOLVETRIANGULAR_H
11
11
  #define EIGEN_SOLVETRIANGULAR_H
12
12
 
13
- namespace Eigen {
13
+ namespace Eigen {
14
14
 
15
15
  namespace internal {
16
16
 
@@ -54,7 +54,7 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,1>
54
54
  typedef blas_traits<Lhs> LhsProductTraits;
55
55
  typedef typename LhsProductTraits::ExtractType ActualLhsType;
56
56
  typedef Map<Matrix<RhsScalar,Dynamic,1>, Aligned> MappedRhs;
57
- static void run(const Lhs& lhs, Rhs& rhs)
57
+ static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
58
58
  {
59
59
  ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
60
60
 
@@ -64,7 +64,7 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,1>
64
64
 
65
65
  ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhs,rhs.size(),
66
66
  (useRhsDirectly ? rhs.data() : 0));
67
-
67
+
68
68
  if(!useRhsDirectly)
69
69
  MappedRhs(actualRhs,rhs.size()) = rhs;
70
70
 
@@ -85,7 +85,7 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
85
85
  typedef blas_traits<Lhs> LhsProductTraits;
86
86
  typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
87
87
 
88
- static void run(const Lhs& lhs, Rhs& rhs)
88
+ static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
89
89
  {
90
90
  typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsProductTraits::extract(lhs);
91
91
 
@@ -118,7 +118,7 @@ struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
118
118
  DiagIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
119
119
  StartIndex = IsLower ? 0 : DiagIndex+1
120
120
  };
121
- static void run(const Lhs& lhs, Rhs& rhs)
121
+ static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
122
122
  {
123
123
  if (LoopIndex>0)
124
124
  rhs.coeffRef(DiagIndex) -= lhs.row(DiagIndex).template segment<LoopIndex>(StartIndex).transpose()
@@ -133,22 +133,22 @@ struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
133
133
 
134
134
  template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
135
135
  struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,true> {
136
- static void run(const Lhs&, Rhs&) {}
136
+ static EIGEN_DEVICE_FUNC void run(const Lhs&, Rhs&) {}
137
137
  };
138
138
 
139
139
  template<typename Lhs, typename Rhs, int Mode>
140
140
  struct triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,CompleteUnrolling,1> {
141
- static void run(const Lhs& lhs, Rhs& rhs)
141
+ static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
142
142
  { triangular_solver_unroller<Lhs,Rhs,Mode,0,Rhs::SizeAtCompileTime>::run(lhs,rhs); }
143
143
  };
144
144
 
145
145
  template<typename Lhs, typename Rhs, int Mode>
146
146
  struct triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,CompleteUnrolling,1> {
147
- static void run(const Lhs& lhs, Rhs& rhs)
147
+ static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
148
148
  {
149
149
  Transpose<const Lhs> trLhs(lhs);
150
150
  Transpose<Rhs> trRhs(rhs);
151
-
151
+
152
152
  triangular_solver_unroller<Transpose<const Lhs>,Transpose<Rhs>,
153
153
  ((Mode&Upper)==Upper ? Lower : Upper) | (Mode&UnitDiag),
154
154
  0,Rhs::SizeAtCompileTime>::run(trLhs,trRhs);
@@ -164,11 +164,11 @@ struct triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,CompleteUnrolling,1> {
164
164
  #ifndef EIGEN_PARSED_BY_DOXYGEN
165
165
  template<typename MatrixType, unsigned int Mode>
166
166
  template<int Side, typename OtherDerived>
167
- void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
167
+ EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
168
168
  {
169
169
  OtherDerived& other = _other.const_cast_derived();
170
170
  eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
171
- eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
171
+ eigen_assert((!(int(Mode) & int(ZeroDiag))) && bool(int(Mode) & (int(Upper) | int(Lower))));
172
172
  // If solving for a 0x0 matrix, nothing to do, simply return.
173
173
  if (derived().cols() == 0)
174
174
  return;
@@ -213,8 +213,8 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv
213
213
  : m_triangularMatrix(tri), m_rhs(rhs)
214
214
  {}
215
215
 
216
- inline Index rows() const { return m_rhs.rows(); }
217
- inline Index cols() const { return m_rhs.cols(); }
216
+ inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_rhs.rows(); }
217
+ inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); }
218
218
 
219
219
  template<typename Dest> inline void evalTo(Dest& dst) const
220
220
  {
@@ -14,8 +14,35 @@ namespace Eigen {
14
14
 
15
15
  namespace internal {
16
16
 
17
+ template<typename Derived>
18
+ struct solve_assertion {
19
+ template<bool Transpose_, typename Rhs>
20
+ static void run(const Derived& solver, const Rhs& b) { solver.template _check_solve_assertion<Transpose_>(b); }
21
+ };
22
+
23
+ template<typename Derived>
24
+ struct solve_assertion<Transpose<Derived> >
25
+ {
26
+ typedef Transpose<Derived> type;
27
+
28
+ template<bool Transpose_, typename Rhs>
29
+ static void run(const type& transpose, const Rhs& b)
30
+ {
31
+ internal::solve_assertion<typename internal::remove_all<Derived>::type>::template run<true>(transpose.nestedExpression(), b);
32
+ }
33
+ };
17
34
 
35
+ template<typename Scalar, typename Derived>
36
+ struct solve_assertion<CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<Scalar>, const Transpose<Derived> > >
37
+ {
38
+ typedef CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<Scalar>, const Transpose<Derived> > type;
18
39
 
40
+ template<bool Transpose_, typename Rhs>
41
+ static void run(const type& adjoint, const Rhs& b)
42
+ {
43
+ internal::solve_assertion<typename internal::remove_all<Transpose<Derived> >::type>::template run<true>(adjoint.nestedExpression(), b);
44
+ }
45
+ };
19
46
  } // end namespace internal
20
47
 
21
48
  /** \class SolverBase
@@ -35,7 +62,7 @@ namespace internal {
35
62
  *
36
63
  * \warning Currently, any other usage of transpose() and adjoint() are not supported and will produce compilation errors.
37
64
  *
38
- * \sa class PartialPivLU, class FullPivLU
65
+ * \sa class PartialPivLU, class FullPivLU, class HouseholderQR, class ColPivHouseholderQR, class FullPivHouseholderQR, class CompleteOrthogonalDecomposition, class LLT, class LDLT, class SVDBase
39
66
  */
40
67
  template<typename Derived>
41
68
  class SolverBase : public EigenBase<Derived>
@@ -46,6 +73,9 @@ class SolverBase : public EigenBase<Derived>
46
73
  typedef typename internal::traits<Derived>::Scalar Scalar;
47
74
  typedef Scalar CoeffReturnType;
48
75
 
76
+ template<typename Derived_>
77
+ friend struct internal::solve_assertion;
78
+
49
79
  enum {
50
80
  RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
51
81
  ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
@@ -56,7 +86,8 @@ class SolverBase : public EigenBase<Derived>
56
86
  MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
57
87
  internal::traits<Derived>::MaxColsAtCompileTime>::ret),
58
88
  IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
59
- || internal::traits<Derived>::MaxColsAtCompileTime == 1
89
+ || internal::traits<Derived>::MaxColsAtCompileTime == 1,
90
+ NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2
60
91
  };
61
92
 
62
93
  /** Default constructor */
@@ -74,7 +105,7 @@ class SolverBase : public EigenBase<Derived>
74
105
  inline const Solve<Derived, Rhs>
75
106
  solve(const MatrixBase<Rhs>& b) const
76
107
  {
77
- eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b");
108
+ internal::solve_assertion<typename internal::remove_all<Derived>::type>::template run<false>(derived(), b);
78
109
  return Solve<Derived, Rhs>(derived(), b.derived());
79
110
  }
80
111
 
@@ -112,6 +143,13 @@ class SolverBase : public EigenBase<Derived>
112
143
  }
113
144
 
114
145
  protected:
146
+
147
+ template<bool Transpose_, typename Rhs>
148
+ void _check_solve_assertion(const Rhs& b) const {
149
+ EIGEN_ONLY_USED_FOR_DEBUG(b);
150
+ eigen_assert(derived().m_isInitialized && "Solver is not initialized.");
151
+ eigen_assert((Transpose_?derived().cols():derived().rows())==b.rows() && "SolverBase::solve(): invalid number of rows of the right hand side matrix b");
152
+ }
115
153
  };
116
154
 
117
155
  namespace internal {
@@ -50,6 +50,71 @@ inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& sc
50
50
  ssq += (bl*invScale).squaredNorm();
51
51
  }
52
52
 
53
+ template<typename VectorType, typename RealScalar>
54
+ void stable_norm_impl_inner_step(const VectorType &vec, RealScalar& ssq, RealScalar& scale, RealScalar& invScale)
55
+ {
56
+ typedef typename VectorType::Scalar Scalar;
57
+ const Index blockSize = 4096;
58
+
59
+ typedef typename internal::nested_eval<VectorType,2>::type VectorTypeCopy;
60
+ typedef typename internal::remove_all<VectorTypeCopy>::type VectorTypeCopyClean;
61
+ const VectorTypeCopy copy(vec);
62
+
63
+ enum {
64
+ CanAlign = ( (int(VectorTypeCopyClean::Flags)&DirectAccessBit)
65
+ || (int(internal::evaluator<VectorTypeCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
66
+ ) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)
67
+ && (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization
68
+ };
69
+ typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<VectorTypeCopyClean>::Alignment>,
70
+ typename VectorTypeCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
71
+ Index n = vec.size();
72
+
73
+ Index bi = internal::first_default_aligned(copy);
74
+ if (bi>0)
75
+ internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);
76
+ for (; bi<n; bi+=blockSize)
77
+ internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);
78
+ }
79
+
80
+ template<typename VectorType>
81
+ typename VectorType::RealScalar
82
+ stable_norm_impl(const VectorType &vec, typename enable_if<VectorType::IsVectorAtCompileTime>::type* = 0 )
83
+ {
84
+ using std::sqrt;
85
+ using std::abs;
86
+
87
+ Index n = vec.size();
88
+
89
+ if(n==1)
90
+ return abs(vec.coeff(0));
91
+
92
+ typedef typename VectorType::RealScalar RealScalar;
93
+ RealScalar scale(0);
94
+ RealScalar invScale(1);
95
+ RealScalar ssq(0); // sum of squares
96
+
97
+ stable_norm_impl_inner_step(vec, ssq, scale, invScale);
98
+
99
+ return scale * sqrt(ssq);
100
+ }
101
+
102
+ template<typename MatrixType>
103
+ typename MatrixType::RealScalar
104
+ stable_norm_impl(const MatrixType &mat, typename enable_if<!MatrixType::IsVectorAtCompileTime>::type* = 0 )
105
+ {
106
+ using std::sqrt;
107
+
108
+ typedef typename MatrixType::RealScalar RealScalar;
109
+ RealScalar scale(0);
110
+ RealScalar invScale(1);
111
+ RealScalar ssq(0); // sum of squares
112
+
113
+ for(Index j=0; j<mat.outerSize(); ++j)
114
+ stable_norm_impl_inner_step(mat.innerVector(j), ssq, scale, invScale);
115
+ return scale * sqrt(ssq);
116
+ }
117
+
53
118
  template<typename Derived>
54
119
  inline typename NumTraits<typename traits<Derived>::Scalar>::Real
55
120
  blueNorm_impl(const EigenBase<Derived>& _vec)
@@ -58,52 +123,43 @@ blueNorm_impl(const EigenBase<Derived>& _vec)
58
123
  using std::pow;
59
124
  using std::sqrt;
60
125
  using std::abs;
126
+
127
+ // This program calculates the machine-dependent constants
128
+ // bl, b2, slm, s2m, relerr overfl
129
+ // from the "basic" machine-dependent numbers
130
+ // nbig, ibeta, it, iemin, iemax, rbig.
131
+ // The following define the basic machine-dependent constants.
132
+ // For portability, the PORT subprograms "ilmaeh" and "rlmach"
133
+ // are used. For any specific computer, each of the assignment
134
+ // statements can be replaced
135
+ static const int ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
136
+ static const int it = NumTraits<RealScalar>::digits(); // number of base-beta digits in mantissa
137
+ static const int iemin = NumTraits<RealScalar>::min_exponent(); // minimum exponent
138
+ static const int iemax = NumTraits<RealScalar>::max_exponent(); // maximum exponent
139
+ static const RealScalar rbig = NumTraits<RealScalar>::highest(); // largest floating-point number
140
+ static const RealScalar b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(-((1-iemin)/2)))); // lower boundary of midrange
141
+ static const RealScalar b2 = RealScalar(pow(RealScalar(ibeta),RealScalar((iemax + 1 - it)/2))); // upper boundary of midrange
142
+ static const RealScalar s1m = RealScalar(pow(RealScalar(ibeta),RealScalar((2-iemin)/2))); // scaling factor for lower range
143
+ static const RealScalar s2m = RealScalar(pow(RealScalar(ibeta),RealScalar(- ((iemax+it)/2)))); // scaling factor for upper range
144
+ static const RealScalar eps = RealScalar(pow(double(ibeta), 1-it));
145
+ static const RealScalar relerr = sqrt(eps); // tolerance for neglecting asml
146
+
61
147
  const Derived& vec(_vec.derived());
62
- static bool initialized = false;
63
- static RealScalar b1, b2, s1m, s2m, rbig, relerr;
64
- if(!initialized)
65
- {
66
- int ibeta, it, iemin, iemax, iexp;
67
- RealScalar eps;
68
- // This program calculates the machine-dependent constants
69
- // bl, b2, slm, s2m, relerr overfl
70
- // from the "basic" machine-dependent numbers
71
- // nbig, ibeta, it, iemin, iemax, rbig.
72
- // The following define the basic machine-dependent constants.
73
- // For portability, the PORT subprograms "ilmaeh" and "rlmach"
74
- // are used. For any specific computer, each of the assignment
75
- // statements can be replaced
76
- ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
77
- it = std::numeric_limits<RealScalar>::digits; // number of base-beta digits in mantissa
78
- iemin = std::numeric_limits<RealScalar>::min_exponent; // minimum exponent
79
- iemax = std::numeric_limits<RealScalar>::max_exponent; // maximum exponent
80
- rbig = (std::numeric_limits<RealScalar>::max)(); // largest floating-point number
81
-
82
- iexp = -((1-iemin)/2);
83
- b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // lower boundary of midrange
84
- iexp = (iemax + 1 - it)/2;
85
- b2 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // upper boundary of midrange
86
-
87
- iexp = (2-iemin)/2;
88
- s1m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for lower range
89
- iexp = - ((iemax+it)/2);
90
- s2m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for upper range
91
-
92
- eps = RealScalar(pow(double(ibeta), 1-it));
93
- relerr = sqrt(eps); // tolerance for neglecting asml
94
- initialized = true;
95
- }
96
148
  Index n = vec.size();
97
149
  RealScalar ab2 = b2 / RealScalar(n);
98
150
  RealScalar asml = RealScalar(0);
99
151
  RealScalar amed = RealScalar(0);
100
152
  RealScalar abig = RealScalar(0);
101
- for(typename Derived::InnerIterator it(vec, 0); it; ++it)
153
+
154
+ for(Index j=0; j<vec.outerSize(); ++j)
102
155
  {
103
- RealScalar ax = abs(it.value());
104
- if(ax > ab2) abig += numext::abs2(ax*s2m);
105
- else if(ax < b1) asml += numext::abs2(ax*s1m);
106
- else amed += numext::abs2(ax);
156
+ for(typename Derived::InnerIterator iter(vec, j); iter; ++iter)
157
+ {
158
+ RealScalar ax = abs(iter.value());
159
+ if(ax > ab2) abig += numext::abs2(ax*s2m);
160
+ else if(ax < b1) asml += numext::abs2(ax*s1m);
161
+ else amed += numext::abs2(ax);
162
+ }
107
163
  }
108
164
  if(amed!=amed)
109
165
  return amed; // we got a NaN
@@ -156,36 +212,7 @@ template<typename Derived>
156
212
  inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
157
213
  MatrixBase<Derived>::stableNorm() const
158
214
  {
159
- using std::sqrt;
160
- using std::abs;
161
- const Index blockSize = 4096;
162
- RealScalar scale(0);
163
- RealScalar invScale(1);
164
- RealScalar ssq(0); // sum of square
165
-
166
- typedef typename internal::nested_eval<Derived,2>::type DerivedCopy;
167
- typedef typename internal::remove_all<DerivedCopy>::type DerivedCopyClean;
168
- const DerivedCopy copy(derived());
169
-
170
- enum {
171
- CanAlign = ( (int(DerivedCopyClean::Flags)&DirectAccessBit)
172
- || (int(internal::evaluator<DerivedCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
173
- ) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)
174
- && (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization
175
- };
176
- typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<DerivedCopyClean>::Alignment>,
177
- typename DerivedCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
178
- Index n = size();
179
-
180
- if(n==1)
181
- return abs(this->coeff(0));
182
-
183
- Index bi = internal::first_default_aligned(copy);
184
- if (bi>0)
185
- internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);
186
- for (; bi<n; bi+=blockSize)
187
- internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);
188
- return scale * sqrt(ssq);
215
+ return internal::stable_norm_impl(derived());
189
216
  }
190
217
 
191
218
  /** \returns the \em l2 norm of \c *this using the Blue's algorithm.
@@ -213,7 +240,10 @@ template<typename Derived>
213
240
  inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
214
241
  MatrixBase<Derived>::hypotNorm() const
215
242
  {
216
- return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
243
+ if(size()==1)
244
+ return numext::abs(coeff(0,0));
245
+ else
246
+ return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
217
247
  }
218
248
 
219
249
  } // end namespace Eigen