ruby-eigen 0.0.9 → 0.0.10.pre1

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 (293) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +22 -0
  3. data/README.md +21 -0
  4. data/ext/eigen/eigen3/COPYING.BSD +26 -0
  5. data/ext/eigen/eigen3/COPYING.MPL2 +373 -0
  6. data/ext/eigen/eigen3/COPYING.README +18 -0
  7. data/ext/eigen/eigen3/Eigen/Array +11 -0
  8. data/ext/eigen/eigen3/Eigen/Cholesky +32 -0
  9. data/ext/eigen/eigen3/Eigen/CholmodSupport +45 -0
  10. data/ext/eigen/eigen3/Eigen/Core +376 -0
  11. data/ext/eigen/eigen3/Eigen/Dense +7 -0
  12. data/ext/eigen/eigen3/Eigen/Eigen +2 -0
  13. data/ext/eigen/eigen3/Eigen/Eigen2Support +95 -0
  14. data/ext/eigen/eigen3/Eigen/Eigenvalues +48 -0
  15. data/ext/eigen/eigen3/Eigen/Geometry +63 -0
  16. data/ext/eigen/eigen3/Eigen/Householder +23 -0
  17. data/ext/eigen/eigen3/Eigen/IterativeLinearSolvers +40 -0
  18. data/ext/eigen/eigen3/Eigen/Jacobi +26 -0
  19. data/ext/eigen/eigen3/Eigen/LU +41 -0
  20. data/ext/eigen/eigen3/Eigen/LeastSquares +32 -0
  21. data/ext/eigen/eigen3/Eigen/MetisSupport +28 -0
  22. data/ext/eigen/eigen3/Eigen/PaStiXSupport +46 -0
  23. data/ext/eigen/eigen3/Eigen/PardisoSupport +30 -0
  24. data/ext/eigen/eigen3/Eigen/QR +45 -0
  25. data/ext/eigen/eigen3/Eigen/QtAlignedMalloc +34 -0
  26. data/ext/eigen/eigen3/Eigen/SPQRSupport +29 -0
  27. data/ext/eigen/eigen3/Eigen/SVD +37 -0
  28. data/ext/eigen/eigen3/Eigen/Sparse +27 -0
  29. data/ext/eigen/eigen3/Eigen/SparseCore +64 -0
  30. data/ext/eigen/eigen3/Eigen/SparseLU +49 -0
  31. data/ext/eigen/eigen3/Eigen/SparseQR +33 -0
  32. data/ext/eigen/eigen3/Eigen/StdDeque +27 -0
  33. data/ext/eigen/eigen3/Eigen/StdList +26 -0
  34. data/ext/eigen/eigen3/Eigen/StdVector +27 -0
  35. data/ext/eigen/eigen3/Eigen/SuperLUSupport +59 -0
  36. data/ext/eigen/eigen3/Eigen/UmfPackSupport +36 -0
  37. data/ext/eigen/eigen3/Eigen/src/Cholesky/LDLT.h +611 -0
  38. data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT.h +498 -0
  39. data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT_MKL.h +102 -0
  40. data/ext/eigen/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +607 -0
  41. data/ext/eigen/eigen3/Eigen/src/Core/Array.h +323 -0
  42. data/ext/eigen/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
  43. data/ext/eigen/eigen3/Eigen/src/Core/ArrayWrapper.h +264 -0
  44. data/ext/eigen/eigen3/Eigen/src/Core/Assign.h +590 -0
  45. data/ext/eigen/eigen3/Eigen/src/Core/Assign_MKL.h +224 -0
  46. data/ext/eigen/eigen3/Eigen/src/Core/BandMatrix.h +334 -0
  47. data/ext/eigen/eigen3/Eigen/src/Core/Block.h +406 -0
  48. data/ext/eigen/eigen3/Eigen/src/Core/BooleanRedux.h +154 -0
  49. data/ext/eigen/eigen3/Eigen/src/Core/CommaInitializer.h +154 -0
  50. data/ext/eigen/eigen3/Eigen/src/Core/CoreIterators.h +61 -0
  51. data/ext/eigen/eigen3/Eigen/src/Core/CwiseBinaryOp.h +230 -0
  52. data/ext/eigen/eigen3/Eigen/src/Core/CwiseNullaryOp.h +864 -0
  53. data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryOp.h +126 -0
  54. data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryView.h +139 -0
  55. data/ext/eigen/eigen3/Eigen/src/Core/DenseBase.h +521 -0
  56. data/ext/eigen/eigen3/Eigen/src/Core/DenseCoeffsBase.h +754 -0
  57. data/ext/eigen/eigen3/Eigen/src/Core/DenseStorage.h +434 -0
  58. data/ext/eigen/eigen3/Eigen/src/Core/Diagonal.h +237 -0
  59. data/ext/eigen/eigen3/Eigen/src/Core/DiagonalMatrix.h +313 -0
  60. data/ext/eigen/eigen3/Eigen/src/Core/DiagonalProduct.h +131 -0
  61. data/ext/eigen/eigen3/Eigen/src/Core/Dot.h +263 -0
  62. data/ext/eigen/eigen3/Eigen/src/Core/EigenBase.h +131 -0
  63. data/ext/eigen/eigen3/Eigen/src/Core/Flagged.h +140 -0
  64. data/ext/eigen/eigen3/Eigen/src/Core/ForceAlignedAccess.h +146 -0
  65. data/ext/eigen/eigen3/Eigen/src/Core/Functors.h +1026 -0
  66. data/ext/eigen/eigen3/Eigen/src/Core/Fuzzy.h +150 -0
  67. data/ext/eigen/eigen3/Eigen/src/Core/GeneralProduct.h +635 -0
  68. data/ext/eigen/eigen3/Eigen/src/Core/GenericPacketMath.h +350 -0
  69. data/ext/eigen/eigen3/Eigen/src/Core/GlobalFunctions.h +92 -0
  70. data/ext/eigen/eigen3/Eigen/src/Core/IO.h +250 -0
  71. data/ext/eigen/eigen3/Eigen/src/Core/Map.h +192 -0
  72. data/ext/eigen/eigen3/Eigen/src/Core/MapBase.h +247 -0
  73. data/ext/eigen/eigen3/Eigen/src/Core/MathFunctions.h +768 -0
  74. data/ext/eigen/eigen3/Eigen/src/Core/Matrix.h +420 -0
  75. data/ext/eigen/eigen3/Eigen/src/Core/MatrixBase.h +563 -0
  76. data/ext/eigen/eigen3/Eigen/src/Core/NestByValue.h +111 -0
  77. data/ext/eigen/eigen3/Eigen/src/Core/NoAlias.h +134 -0
  78. data/ext/eigen/eigen3/Eigen/src/Core/NumTraits.h +150 -0
  79. data/ext/eigen/eigen3/Eigen/src/Core/PermutationMatrix.h +721 -0
  80. data/ext/eigen/eigen3/Eigen/src/Core/PlainObjectBase.h +822 -0
  81. data/ext/eigen/eigen3/Eigen/src/Core/ProductBase.h +290 -0
  82. data/ext/eigen/eigen3/Eigen/src/Core/Random.h +152 -0
  83. data/ext/eigen/eigen3/Eigen/src/Core/Redux.h +409 -0
  84. data/ext/eigen/eigen3/Eigen/src/Core/Ref.h +278 -0
  85. data/ext/eigen/eigen3/Eigen/src/Core/Replicate.h +177 -0
  86. data/ext/eigen/eigen3/Eigen/src/Core/ReturnByValue.h +99 -0
  87. data/ext/eigen/eigen3/Eigen/src/Core/Reverse.h +224 -0
  88. data/ext/eigen/eigen3/Eigen/src/Core/Select.h +162 -0
  89. data/ext/eigen/eigen3/Eigen/src/Core/SelfAdjointView.h +314 -0
  90. data/ext/eigen/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +191 -0
  91. data/ext/eigen/eigen3/Eigen/src/Core/SolveTriangular.h +260 -0
  92. data/ext/eigen/eigen3/Eigen/src/Core/StableNorm.h +203 -0
  93. data/ext/eigen/eigen3/Eigen/src/Core/Stride.h +108 -0
  94. data/ext/eigen/eigen3/Eigen/src/Core/Swap.h +126 -0
  95. data/ext/eigen/eigen3/Eigen/src/Core/Transpose.h +419 -0
  96. data/ext/eigen/eigen3/Eigen/src/Core/Transpositions.h +436 -0
  97. data/ext/eigen/eigen3/Eigen/src/Core/TriangularMatrix.h +839 -0
  98. data/ext/eigen/eigen3/Eigen/src/Core/VectorBlock.h +95 -0
  99. data/ext/eigen/eigen3/Eigen/src/Core/VectorwiseOp.h +642 -0
  100. data/ext/eigen/eigen3/Eigen/src/Core/Visitor.h +237 -0
  101. data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +217 -0
  102. data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +501 -0
  103. data/ext/eigen/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
  104. data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/Complex.h +253 -0
  105. data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +420 -0
  106. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/Complex.h +442 -0
  107. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +475 -0
  108. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +649 -0
  109. data/ext/eigen/eigen3/Eigen/src/Core/products/CoeffBasedProduct.h +476 -0
  110. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1341 -0
  111. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +427 -0
  112. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +278 -0
  113. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h +146 -0
  114. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h +118 -0
  115. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +566 -0
  116. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h +131 -0
  117. data/ext/eigen/eigen3/Eigen/src/Core/products/Parallelizer.h +162 -0
  118. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +436 -0
  119. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h +295 -0
  120. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +281 -0
  121. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h +114 -0
  122. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +123 -0
  123. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
  124. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +427 -0
  125. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h +309 -0
  126. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +348 -0
  127. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h +247 -0
  128. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +332 -0
  129. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h +155 -0
  130. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +139 -0
  131. data/ext/eigen/eigen3/Eigen/src/Core/util/BlasUtil.h +264 -0
  132. data/ext/eigen/eigen3/Eigen/src/Core/util/Constants.h +451 -0
  133. data/ext/eigen/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +40 -0
  134. data/ext/eigen/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
  135. data/ext/eigen/eigen3/Eigen/src/Core/util/MKL_support.h +158 -0
  136. data/ext/eigen/eigen3/Eigen/src/Core/util/Macros.h +451 -0
  137. data/ext/eigen/eigen3/Eigen/src/Core/util/Memory.h +977 -0
  138. data/ext/eigen/eigen3/Eigen/src/Core/util/Meta.h +243 -0
  139. data/ext/eigen/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
  140. data/ext/eigen/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +14 -0
  141. data/ext/eigen/eigen3/Eigen/src/Core/util/StaticAssert.h +208 -0
  142. data/ext/eigen/eigen3/Eigen/src/Core/util/XprHelper.h +469 -0
  143. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Block.h +126 -0
  144. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Cwise.h +192 -0
  145. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/CwiseOperators.h +298 -0
  146. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +159 -0
  147. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/All.h +115 -0
  148. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +214 -0
  149. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +254 -0
  150. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +141 -0
  151. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h +495 -0
  152. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +145 -0
  153. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h +123 -0
  154. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h +167 -0
  155. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h +786 -0
  156. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h +184 -0
  157. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LU.h +120 -0
  158. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Lazy.h +71 -0
  159. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LeastSquares.h +169 -0
  160. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Macros.h +20 -0
  161. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/MathFunctions.h +57 -0
  162. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Memory.h +45 -0
  163. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Meta.h +75 -0
  164. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Minor.h +117 -0
  165. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/QR.h +67 -0
  166. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/SVD.h +637 -0
  167. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h +42 -0
  168. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/VectorBlock.h +94 -0
  169. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +341 -0
  170. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +456 -0
  171. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h +94 -0
  172. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +607 -0
  173. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +350 -0
  174. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +227 -0
  175. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +373 -0
  176. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +160 -0
  177. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealQZ.h +624 -0
  178. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur.h +525 -0
  179. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h +83 -0
  180. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +801 -0
  181. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h +92 -0
  182. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +557 -0
  183. data/ext/eigen/eigen3/Eigen/src/Geometry/AlignedBox.h +392 -0
  184. data/ext/eigen/eigen3/Eigen/src/Geometry/AngleAxis.h +233 -0
  185. data/ext/eigen/eigen3/Eigen/src/Geometry/EulerAngles.h +104 -0
  186. data/ext/eigen/eigen3/Eigen/src/Geometry/Homogeneous.h +307 -0
  187. data/ext/eigen/eigen3/Eigen/src/Geometry/Hyperplane.h +280 -0
  188. data/ext/eigen/eigen3/Eigen/src/Geometry/OrthoMethods.h +218 -0
  189. data/ext/eigen/eigen3/Eigen/src/Geometry/ParametrizedLine.h +195 -0
  190. data/ext/eigen/eigen3/Eigen/src/Geometry/Quaternion.h +776 -0
  191. data/ext/eigen/eigen3/Eigen/src/Geometry/Rotation2D.h +160 -0
  192. data/ext/eigen/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
  193. data/ext/eigen/eigen3/Eigen/src/Geometry/Scaling.h +166 -0
  194. data/ext/eigen/eigen3/Eigen/src/Geometry/Transform.h +1455 -0
  195. data/ext/eigen/eigen3/Eigen/src/Geometry/Translation.h +206 -0
  196. data/ext/eigen/eigen3/Eigen/src/Geometry/Umeyama.h +177 -0
  197. data/ext/eigen/eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h +115 -0
  198. data/ext/eigen/eigen3/Eigen/src/Householder/BlockHouseholder.h +68 -0
  199. data/ext/eigen/eigen3/Eigen/src/Householder/Householder.h +171 -0
  200. data/ext/eigen/eigen3/Eigen/src/Householder/HouseholderSequence.h +441 -0
  201. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -0
  202. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +263 -0
  203. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +256 -0
  204. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +282 -0
  205. data/ext/eigen/eigen3/Eigen/src/Jacobi/Jacobi.h +433 -0
  206. data/ext/eigen/eigen3/Eigen/src/LU/Determinant.h +101 -0
  207. data/ext/eigen/eigen3/Eigen/src/LU/FullPivLU.h +751 -0
  208. data/ext/eigen/eigen3/Eigen/src/LU/Inverse.h +400 -0
  209. data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU.h +509 -0
  210. data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU_MKL.h +85 -0
  211. data/ext/eigen/eigen3/Eigen/src/LU/arch/Inverse_SSE.h +329 -0
  212. data/ext/eigen/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  213. data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Amd.h +444 -0
  214. data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1850 -0
  215. data/ext/eigen/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +721 -0
  216. data/ext/eigen/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +592 -0
  217. data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +580 -0
  218. data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h +99 -0
  219. data/ext/eigen/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +622 -0
  220. data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR.h +388 -0
  221. data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR_MKL.h +71 -0
  222. data/ext/eigen/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +338 -0
  223. data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD.h +976 -0
  224. data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD_MKL.h +92 -0
  225. data/ext/eigen/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +148 -0
  226. data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +671 -0
  227. data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
  228. data/ext/eigen/eigen3/Eigen/src/SparseCore/AmbiVector.h +373 -0
  229. data/ext/eigen/eigen3/Eigen/src/SparseCore/CompressedStorage.h +233 -0
  230. data/ext/eigen/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +245 -0
  231. data/ext/eigen/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +181 -0
  232. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseBlock.h +537 -0
  233. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  234. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +325 -0
  235. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +163 -0
  236. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +311 -0
  237. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +196 -0
  238. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDot.h +101 -0
  239. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +26 -0
  240. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1262 -0
  241. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +461 -0
  242. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparsePermutation.h +148 -0
  243. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseProduct.h +188 -0
  244. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseRedux.h +45 -0
  245. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +507 -0
  246. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +150 -0
  247. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTranspose.h +63 -0
  248. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +179 -0
  249. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseUtil.h +172 -0
  250. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseVector.h +448 -0
  251. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseView.h +99 -0
  252. data/ext/eigen/eigen3/Eigen/src/SparseCore/TriangularSolver.h +334 -0
  253. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU.h +806 -0
  254. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  255. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +227 -0
  256. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +111 -0
  257. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +298 -0
  258. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  259. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +180 -0
  260. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +177 -0
  261. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
  262. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +279 -0
  263. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +127 -0
  264. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  265. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  266. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  267. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  268. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +135 -0
  269. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  270. data/ext/eigen/eigen3/Eigen/src/SparseQR/SparseQR.h +714 -0
  271. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdDeque.h +134 -0
  272. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdList.h +114 -0
  273. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdVector.h +126 -0
  274. data/ext/eigen/eigen3/Eigen/src/StlSupport/details.h +84 -0
  275. data/ext/eigen/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1026 -0
  276. data/ext/eigen/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +474 -0
  277. data/ext/eigen/eigen3/Eigen/src/misc/Image.h +84 -0
  278. data/ext/eigen/eigen3/Eigen/src/misc/Kernel.h +81 -0
  279. data/ext/eigen/eigen3/Eigen/src/misc/Solve.h +76 -0
  280. data/ext/eigen/eigen3/Eigen/src/misc/SparseSolve.h +128 -0
  281. data/ext/eigen/eigen3/Eigen/src/misc/blas.h +658 -0
  282. data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +253 -0
  283. data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +187 -0
  284. data/ext/eigen/eigen3/Eigen/src/plugins/BlockMethods.h +935 -0
  285. data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +46 -0
  286. data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +172 -0
  287. data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +143 -0
  288. data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +52 -0
  289. data/ext/eigen/eigen3/signature_of_eigen3_matrix_library +1 -0
  290. data/ext/eigen/eigen_wrap.cxx +19420 -10396
  291. data/ext/eigen/extconf.rb +37 -2
  292. data/lib/eigen.rb +146 -3
  293. metadata +294 -7
@@ -0,0 +1,92 @@
1
+ /*
2
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of Intel Corporation nor the names of its contributors may
13
+ be used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ ********************************************************************************
28
+ * Content : Eigen bindings to Intel(R) MKL
29
+ * Self-adjoint eigenvalues/eigenvectors.
30
+ ********************************************************************************
31
+ */
32
+
33
+ #ifndef EIGEN_SAEIGENSOLVER_MKL_H
34
+ #define EIGEN_SAEIGENSOLVER_MKL_H
35
+
36
+ #include "Eigen/src/Core/util/MKL_support.h"
37
+
38
+ namespace Eigen {
39
+
40
+ /** \internal Specialization for the data types supported by MKL */
41
+
42
+ #define EIGEN_MKL_EIG_SELFADJ(EIGTYPE, MKLTYPE, MKLRTYPE, MKLNAME, EIGCOLROW, MKLCOLROW ) \
43
+ template<> inline \
44
+ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
45
+ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, int options) \
46
+ { \
47
+ eigen_assert(matrix.cols() == matrix.rows()); \
48
+ eigen_assert((options&~(EigVecMask|GenEigMask))==0 \
49
+ && (options&EigVecMask)!=EigVecMask \
50
+ && "invalid option parameter"); \
51
+ bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \
52
+ lapack_int n = matrix.cols(), lda, matrix_order, info; \
53
+ m_eivalues.resize(n,1); \
54
+ m_subdiag.resize(n-1); \
55
+ m_eivec = matrix; \
56
+ \
57
+ if(n==1) \
58
+ { \
59
+ m_eivalues.coeffRef(0,0) = numext::real(matrix.coeff(0,0)); \
60
+ if(computeEigenvectors) m_eivec.setOnes(n,n); \
61
+ m_info = Success; \
62
+ m_isInitialized = true; \
63
+ m_eigenvectorsOk = computeEigenvectors; \
64
+ return *this; \
65
+ } \
66
+ \
67
+ lda = matrix.outerStride(); \
68
+ matrix_order=MKLCOLROW; \
69
+ char jobz, uplo='L'/*, range='A'*/; \
70
+ jobz = computeEigenvectors ? 'V' : 'N'; \
71
+ \
72
+ info = LAPACKE_##MKLNAME( matrix_order, jobz, uplo, n, (MKLTYPE*)m_eivec.data(), lda, (MKLRTYPE*)m_eivalues.data() ); \
73
+ m_info = (info==0) ? Success : NoConvergence; \
74
+ m_isInitialized = true; \
75
+ m_eigenvectorsOk = computeEigenvectors; \
76
+ return *this; \
77
+ }
78
+
79
+
80
+ EIGEN_MKL_EIG_SELFADJ(double, double, double, dsyev, ColMajor, LAPACK_COL_MAJOR)
81
+ EIGEN_MKL_EIG_SELFADJ(float, float, float, ssyev, ColMajor, LAPACK_COL_MAJOR)
82
+ EIGEN_MKL_EIG_SELFADJ(dcomplex, MKL_Complex16, double, zheev, ColMajor, LAPACK_COL_MAJOR)
83
+ EIGEN_MKL_EIG_SELFADJ(scomplex, MKL_Complex8, float, cheev, ColMajor, LAPACK_COL_MAJOR)
84
+
85
+ EIGEN_MKL_EIG_SELFADJ(double, double, double, dsyev, RowMajor, LAPACK_ROW_MAJOR)
86
+ EIGEN_MKL_EIG_SELFADJ(float, float, float, ssyev, RowMajor, LAPACK_ROW_MAJOR)
87
+ EIGEN_MKL_EIG_SELFADJ(dcomplex, MKL_Complex16, double, zheev, RowMajor, LAPACK_ROW_MAJOR)
88
+ EIGEN_MKL_EIG_SELFADJ(scomplex, MKL_Complex8, float, cheev, RowMajor, LAPACK_ROW_MAJOR)
89
+
90
+ } // end namespace Eigen
91
+
92
+ #endif // EIGEN_SAEIGENSOLVER_H
@@ -0,0 +1,557 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ // Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>
6
+ //
7
+ // This Source Code Form is subject to the terms of the Mozilla
8
+ // Public License v. 2.0. If a copy of the MPL was not distributed
9
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
+
11
+ #ifndef EIGEN_TRIDIAGONALIZATION_H
12
+ #define EIGEN_TRIDIAGONALIZATION_H
13
+
14
+ namespace Eigen {
15
+
16
+ namespace internal {
17
+
18
+ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType;
19
+ template<typename MatrixType>
20
+ struct traits<TridiagonalizationMatrixTReturnType<MatrixType> >
21
+ {
22
+ typedef typename MatrixType::PlainObject ReturnType;
23
+ };
24
+
25
+ template<typename MatrixType, typename CoeffVectorType>
26
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs);
27
+ }
28
+
29
+ /** \eigenvalues_module \ingroup Eigenvalues_Module
30
+ *
31
+ *
32
+ * \class Tridiagonalization
33
+ *
34
+ * \brief Tridiagonal decomposition of a selfadjoint matrix
35
+ *
36
+ * \tparam _MatrixType the type of the matrix of which we are computing the
37
+ * tridiagonal decomposition; this is expected to be an instantiation of the
38
+ * Matrix class template.
39
+ *
40
+ * This class performs a tridiagonal decomposition of a selfadjoint matrix \f$ A \f$ such that:
41
+ * \f$ A = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real symmetric tridiagonal matrix.
42
+ *
43
+ * A tridiagonal matrix is a matrix which has nonzero elements only on the
44
+ * main diagonal and the first diagonal below and above it. The Hessenberg
45
+ * decomposition of a selfadjoint matrix is in fact a tridiagonal
46
+ * decomposition. This class is used in SelfAdjointEigenSolver to compute the
47
+ * eigenvalues and eigenvectors of a selfadjoint matrix.
48
+ *
49
+ * Call the function compute() to compute the tridiagonal decomposition of a
50
+ * given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&)
51
+ * constructor which computes the tridiagonal Schur decomposition at
52
+ * construction time. Once the decomposition is computed, you can use the
53
+ * matrixQ() and matrixT() functions to retrieve the matrices Q and T in the
54
+ * decomposition.
55
+ *
56
+ * The documentation of Tridiagonalization(const MatrixType&) contains an
57
+ * example of the typical use of this class.
58
+ *
59
+ * \sa class HessenbergDecomposition, class SelfAdjointEigenSolver
60
+ */
61
+ template<typename _MatrixType> class Tridiagonalization
62
+ {
63
+ public:
64
+
65
+ /** \brief Synonym for the template parameter \p _MatrixType. */
66
+ typedef _MatrixType MatrixType;
67
+
68
+ typedef typename MatrixType::Scalar Scalar;
69
+ typedef typename NumTraits<Scalar>::Real RealScalar;
70
+ typedef typename MatrixType::Index Index;
71
+
72
+ enum {
73
+ Size = MatrixType::RowsAtCompileTime,
74
+ SizeMinusOne = Size == Dynamic ? Dynamic : (Size > 1 ? Size - 1 : 1),
75
+ Options = MatrixType::Options,
76
+ MaxSize = MatrixType::MaxRowsAtCompileTime,
77
+ MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : (MaxSize > 1 ? MaxSize - 1 : 1)
78
+ };
79
+
80
+ typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> CoeffVectorType;
81
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type DiagonalType;
82
+ typedef Matrix<RealScalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> SubDiagonalType;
83
+ typedef typename internal::remove_all<typename MatrixType::RealReturnType>::type MatrixTypeRealView;
84
+ typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType;
85
+
86
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
87
+ typename internal::add_const_on_value_type<typename Diagonal<const MatrixType>::RealReturnType>::type,
88
+ const Diagonal<const MatrixType>
89
+ >::type DiagonalReturnType;
90
+
91
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
92
+ typename internal::add_const_on_value_type<typename Diagonal<
93
+ Block<const MatrixType,SizeMinusOne,SizeMinusOne> >::RealReturnType>::type,
94
+ const Diagonal<
95
+ Block<const MatrixType,SizeMinusOne,SizeMinusOne> >
96
+ >::type SubDiagonalReturnType;
97
+
98
+ /** \brief Return type of matrixQ() */
99
+ typedef HouseholderSequence<MatrixType,typename internal::remove_all<typename CoeffVectorType::ConjugateReturnType>::type> HouseholderSequenceType;
100
+
101
+ /** \brief Default constructor.
102
+ *
103
+ * \param [in] size Positive integer, size of the matrix whose tridiagonal
104
+ * decomposition will be computed.
105
+ *
106
+ * The default constructor is useful in cases in which the user intends to
107
+ * perform decompositions via compute(). The \p size parameter is only
108
+ * used as a hint. It is not an error to give a wrong \p size, but it may
109
+ * impair performance.
110
+ *
111
+ * \sa compute() for an example.
112
+ */
113
+ Tridiagonalization(Index size = Size==Dynamic ? 2 : Size)
114
+ : m_matrix(size,size),
115
+ m_hCoeffs(size > 1 ? size-1 : 1),
116
+ m_isInitialized(false)
117
+ {}
118
+
119
+ /** \brief Constructor; computes tridiagonal decomposition of given matrix.
120
+ *
121
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
122
+ * is to be computed.
123
+ *
124
+ * This constructor calls compute() to compute the tridiagonal decomposition.
125
+ *
126
+ * Example: \include Tridiagonalization_Tridiagonalization_MatrixType.cpp
127
+ * Output: \verbinclude Tridiagonalization_Tridiagonalization_MatrixType.out
128
+ */
129
+ Tridiagonalization(const MatrixType& matrix)
130
+ : m_matrix(matrix),
131
+ m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1),
132
+ m_isInitialized(false)
133
+ {
134
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
135
+ m_isInitialized = true;
136
+ }
137
+
138
+ /** \brief Computes tridiagonal decomposition of given matrix.
139
+ *
140
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
141
+ * is to be computed.
142
+ * \returns Reference to \c *this
143
+ *
144
+ * The tridiagonal decomposition is computed by bringing the columns of
145
+ * the matrix successively in the required form using Householder
146
+ * reflections. The cost is \f$ 4n^3/3 \f$ flops, where \f$ n \f$ denotes
147
+ * the size of the given matrix.
148
+ *
149
+ * This method reuses of the allocated data in the Tridiagonalization
150
+ * object, if the size of the matrix does not change.
151
+ *
152
+ * Example: \include Tridiagonalization_compute.cpp
153
+ * Output: \verbinclude Tridiagonalization_compute.out
154
+ */
155
+ Tridiagonalization& compute(const MatrixType& matrix)
156
+ {
157
+ m_matrix = matrix;
158
+ m_hCoeffs.resize(matrix.rows()-1, 1);
159
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
160
+ m_isInitialized = true;
161
+ return *this;
162
+ }
163
+
164
+ /** \brief Returns the Householder coefficients.
165
+ *
166
+ * \returns a const reference to the vector of Householder coefficients
167
+ *
168
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
169
+ * the member function compute(const MatrixType&) has been called before
170
+ * to compute the tridiagonal decomposition of a matrix.
171
+ *
172
+ * The Householder coefficients allow the reconstruction of the matrix
173
+ * \f$ Q \f$ in the tridiagonal decomposition from the packed data.
174
+ *
175
+ * Example: \include Tridiagonalization_householderCoefficients.cpp
176
+ * Output: \verbinclude Tridiagonalization_householderCoefficients.out
177
+ *
178
+ * \sa packedMatrix(), \ref Householder_Module "Householder module"
179
+ */
180
+ inline CoeffVectorType householderCoefficients() const
181
+ {
182
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
183
+ return m_hCoeffs;
184
+ }
185
+
186
+ /** \brief Returns the internal representation of the decomposition
187
+ *
188
+ * \returns a const reference to a matrix with the internal representation
189
+ * of the decomposition.
190
+ *
191
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
192
+ * the member function compute(const MatrixType&) has been called before
193
+ * to compute the tridiagonal decomposition of a matrix.
194
+ *
195
+ * The returned matrix contains the following information:
196
+ * - the strict upper triangular part is equal to the input matrix A.
197
+ * - the diagonal and lower sub-diagonal represent the real tridiagonal
198
+ * symmetric matrix T.
199
+ * - the rest of the lower part contains the Householder vectors that,
200
+ * combined with Householder coefficients returned by
201
+ * householderCoefficients(), allows to reconstruct the matrix Q as
202
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
203
+ * Here, the matrices \f$ H_i \f$ are the Householder transformations
204
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
205
+ * where \f$ h_i \f$ is the \f$ i \f$th Householder coefficient and
206
+ * \f$ v_i \f$ is the Householder vector defined by
207
+ * \f$ v_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \f$
208
+ * with M the matrix returned by this function.
209
+ *
210
+ * See LAPACK for further details on this packed storage.
211
+ *
212
+ * Example: \include Tridiagonalization_packedMatrix.cpp
213
+ * Output: \verbinclude Tridiagonalization_packedMatrix.out
214
+ *
215
+ * \sa householderCoefficients()
216
+ */
217
+ inline const MatrixType& packedMatrix() const
218
+ {
219
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
220
+ return m_matrix;
221
+ }
222
+
223
+ /** \brief Returns the unitary matrix Q in the decomposition
224
+ *
225
+ * \returns object representing the matrix Q
226
+ *
227
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
228
+ * the member function compute(const MatrixType&) has been called before
229
+ * to compute the tridiagonal decomposition of a matrix.
230
+ *
231
+ * This function returns a light-weight object of template class
232
+ * HouseholderSequence. You can either apply it directly to a matrix or
233
+ * you can convert it to a matrix of type #MatrixType.
234
+ *
235
+ * \sa Tridiagonalization(const MatrixType&) for an example,
236
+ * matrixT(), class HouseholderSequence
237
+ */
238
+ HouseholderSequenceType matrixQ() const
239
+ {
240
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
241
+ return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate())
242
+ .setLength(m_matrix.rows() - 1)
243
+ .setShift(1);
244
+ }
245
+
246
+ /** \brief Returns an expression of the tridiagonal matrix T in the decomposition
247
+ *
248
+ * \returns expression object representing the matrix T
249
+ *
250
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
251
+ * the member function compute(const MatrixType&) has been called before
252
+ * to compute the tridiagonal decomposition of a matrix.
253
+ *
254
+ * Currently, this function can be used to extract the matrix T from internal
255
+ * data and copy it to a dense matrix object. In most cases, it may be
256
+ * sufficient to directly use the packed matrix or the vector expressions
257
+ * returned by diagonal() and subDiagonal() instead of creating a new
258
+ * dense copy matrix with this function.
259
+ *
260
+ * \sa Tridiagonalization(const MatrixType&) for an example,
261
+ * matrixQ(), packedMatrix(), diagonal(), subDiagonal()
262
+ */
263
+ MatrixTReturnType matrixT() const
264
+ {
265
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
266
+ return MatrixTReturnType(m_matrix.real());
267
+ }
268
+
269
+ /** \brief Returns the diagonal of the tridiagonal matrix T in the decomposition.
270
+ *
271
+ * \returns expression representing the diagonal of T
272
+ *
273
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
274
+ * the member function compute(const MatrixType&) has been called before
275
+ * to compute the tridiagonal decomposition of a matrix.
276
+ *
277
+ * Example: \include Tridiagonalization_diagonal.cpp
278
+ * Output: \verbinclude Tridiagonalization_diagonal.out
279
+ *
280
+ * \sa matrixT(), subDiagonal()
281
+ */
282
+ DiagonalReturnType diagonal() const;
283
+
284
+ /** \brief Returns the subdiagonal of the tridiagonal matrix T in the decomposition.
285
+ *
286
+ * \returns expression representing the subdiagonal of T
287
+ *
288
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
289
+ * the member function compute(const MatrixType&) has been called before
290
+ * to compute the tridiagonal decomposition of a matrix.
291
+ *
292
+ * \sa diagonal() for an example, matrixT()
293
+ */
294
+ SubDiagonalReturnType subDiagonal() const;
295
+
296
+ protected:
297
+
298
+ MatrixType m_matrix;
299
+ CoeffVectorType m_hCoeffs;
300
+ bool m_isInitialized;
301
+ };
302
+
303
+ template<typename MatrixType>
304
+ typename Tridiagonalization<MatrixType>::DiagonalReturnType
305
+ Tridiagonalization<MatrixType>::diagonal() const
306
+ {
307
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
308
+ return m_matrix.diagonal();
309
+ }
310
+
311
+ template<typename MatrixType>
312
+ typename Tridiagonalization<MatrixType>::SubDiagonalReturnType
313
+ Tridiagonalization<MatrixType>::subDiagonal() const
314
+ {
315
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
316
+ Index n = m_matrix.rows();
317
+ return Block<const MatrixType,SizeMinusOne,SizeMinusOne>(m_matrix, 1, 0, n-1,n-1).diagonal();
318
+ }
319
+
320
+ namespace internal {
321
+
322
+ /** \internal
323
+ * Performs a tridiagonal decomposition of the selfadjoint matrix \a matA in-place.
324
+ *
325
+ * \param[in,out] matA On input the selfadjoint matrix. Only the \b lower triangular part is referenced.
326
+ * On output, the strict upper part is left unchanged, and the lower triangular part
327
+ * represents the T and Q matrices in packed format has detailed below.
328
+ * \param[out] hCoeffs returned Householder coefficients (see below)
329
+ *
330
+ * On output, the tridiagonal selfadjoint matrix T is stored in the diagonal
331
+ * and lower sub-diagonal of the matrix \a matA.
332
+ * The unitary matrix Q is represented in a compact way as a product of
333
+ * Householder reflectors \f$ H_i \f$ such that:
334
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
335
+ * The Householder reflectors are defined as
336
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
337
+ * where \f$ h_i = hCoeffs[i]\f$ is the \f$ i \f$th Householder coefficient and
338
+ * \f$ v_i \f$ is the Householder vector defined by
339
+ * \f$ v_i = [ 0, \ldots, 0, 1, matA(i+2,i), \ldots, matA(N-1,i) ]^T \f$.
340
+ *
341
+ * Implemented from Golub's "Matrix Computations", algorithm 8.3.1.
342
+ *
343
+ * \sa Tridiagonalization::packedMatrix()
344
+ */
345
+ template<typename MatrixType, typename CoeffVectorType>
346
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
347
+ {
348
+ using numext::conj;
349
+ typedef typename MatrixType::Index Index;
350
+ typedef typename MatrixType::Scalar Scalar;
351
+ typedef typename MatrixType::RealScalar RealScalar;
352
+ Index n = matA.rows();
353
+ eigen_assert(n==matA.cols());
354
+ eigen_assert(n==hCoeffs.size()+1 || n==1);
355
+
356
+ for (Index i = 0; i<n-1; ++i)
357
+ {
358
+ Index remainingSize = n-i-1;
359
+ RealScalar beta;
360
+ Scalar h;
361
+ matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
362
+
363
+ // Apply similarity transformation to remaining columns,
364
+ // i.e., A = H A H' where H = I - h v v' and v = matA.col(i).tail(n-i-1)
365
+ matA.col(i).coeffRef(i+1) = 1;
366
+
367
+ hCoeffs.tail(n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
368
+ * (conj(h) * matA.col(i).tail(remainingSize)));
369
+
370
+ hCoeffs.tail(n-i-1) += (conj(h)*Scalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1);
371
+
372
+ matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
373
+ .rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), -1);
374
+
375
+ matA.col(i).coeffRef(i+1) = beta;
376
+ hCoeffs.coeffRef(i) = h;
377
+ }
378
+ }
379
+
380
+ // forward declaration, implementation at the end of this file
381
+ template<typename MatrixType,
382
+ int Size=MatrixType::ColsAtCompileTime,
383
+ bool IsComplex=NumTraits<typename MatrixType::Scalar>::IsComplex>
384
+ struct tridiagonalization_inplace_selector;
385
+
386
+ /** \brief Performs a full tridiagonalization in place
387
+ *
388
+ * \param[in,out] mat On input, the selfadjoint matrix whose tridiagonal
389
+ * decomposition is to be computed. Only the lower triangular part referenced.
390
+ * The rest is left unchanged. On output, the orthogonal matrix Q
391
+ * in the decomposition if \p extractQ is true.
392
+ * \param[out] diag The diagonal of the tridiagonal matrix T in the
393
+ * decomposition.
394
+ * \param[out] subdiag The subdiagonal of the tridiagonal matrix T in
395
+ * the decomposition.
396
+ * \param[in] extractQ If true, the orthogonal matrix Q in the
397
+ * decomposition is computed and stored in \p mat.
398
+ *
399
+ * Computes the tridiagonal decomposition of the selfadjoint matrix \p mat in place
400
+ * such that \f$ mat = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real
401
+ * symmetric tridiagonal matrix.
402
+ *
403
+ * The tridiagonal matrix T is passed to the output parameters \p diag and \p subdiag. If
404
+ * \p extractQ is true, then the orthogonal matrix Q is passed to \p mat. Otherwise the lower
405
+ * part of the matrix \p mat is destroyed.
406
+ *
407
+ * The vectors \p diag and \p subdiag are not resized. The function
408
+ * assumes that they are already of the correct size. The length of the
409
+ * vector \p diag should equal the number of rows in \p mat, and the
410
+ * length of the vector \p subdiag should be one left.
411
+ *
412
+ * This implementation contains an optimized path for 3-by-3 matrices
413
+ * which is especially useful for plane fitting.
414
+ *
415
+ * \note Currently, it requires two temporary vectors to hold the intermediate
416
+ * Householder coefficients, and to reconstruct the matrix Q from the Householder
417
+ * reflectors.
418
+ *
419
+ * Example (this uses the same matrix as the example in
420
+ * Tridiagonalization::Tridiagonalization(const MatrixType&)):
421
+ * \include Tridiagonalization_decomposeInPlace.cpp
422
+ * Output: \verbinclude Tridiagonalization_decomposeInPlace.out
423
+ *
424
+ * \sa class Tridiagonalization
425
+ */
426
+ template<typename MatrixType, typename DiagonalType, typename SubDiagonalType>
427
+ void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
428
+ {
429
+ 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);
431
+ }
432
+
433
+ /** \internal
434
+ * General full tridiagonalization
435
+ */
436
+ template<typename MatrixType, int Size, bool IsComplex>
437
+ struct tridiagonalization_inplace_selector
438
+ {
439
+ typedef typename Tridiagonalization<MatrixType>::CoeffVectorType CoeffVectorType;
440
+ typedef typename Tridiagonalization<MatrixType>::HouseholderSequenceType HouseholderSequenceType;
441
+ typedef typename MatrixType::Index Index;
442
+ template<typename DiagonalType, typename SubDiagonalType>
443
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
444
+ {
445
+ CoeffVectorType hCoeffs(mat.cols()-1);
446
+ tridiagonalization_inplace(mat,hCoeffs);
447
+ diag = mat.diagonal().real();
448
+ subdiag = mat.template diagonal<-1>().real();
449
+ if(extractQ)
450
+ mat = HouseholderSequenceType(mat, hCoeffs.conjugate())
451
+ .setLength(mat.rows() - 1)
452
+ .setShift(1);
453
+ }
454
+ };
455
+
456
+ /** \internal
457
+ * Specialization for 3x3 real matrices.
458
+ * Especially useful for plane fitting.
459
+ */
460
+ template<typename MatrixType>
461
+ struct tridiagonalization_inplace_selector<MatrixType,3,false>
462
+ {
463
+ typedef typename MatrixType::Scalar Scalar;
464
+ typedef typename MatrixType::RealScalar RealScalar;
465
+
466
+ template<typename DiagonalType, typename SubDiagonalType>
467
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
468
+ {
469
+ using std::sqrt;
470
+ diag[0] = mat(0,0);
471
+ RealScalar v1norm2 = numext::abs2(mat(2,0));
472
+ if(v1norm2 == RealScalar(0))
473
+ {
474
+ diag[1] = mat(1,1);
475
+ diag[2] = mat(2,2);
476
+ subdiag[0] = mat(1,0);
477
+ subdiag[1] = mat(2,1);
478
+ if (extractQ)
479
+ mat.setIdentity();
480
+ }
481
+ else
482
+ {
483
+ RealScalar beta = sqrt(numext::abs2(mat(1,0)) + v1norm2);
484
+ RealScalar invBeta = RealScalar(1)/beta;
485
+ Scalar m01 = mat(1,0) * invBeta;
486
+ Scalar m02 = mat(2,0) * invBeta;
487
+ Scalar q = RealScalar(2)*m01*mat(2,1) + m02*(mat(2,2) - mat(1,1));
488
+ diag[1] = mat(1,1) + m02*q;
489
+ diag[2] = mat(2,2) - m02*q;
490
+ subdiag[0] = beta;
491
+ subdiag[1] = mat(2,1) - m01 * q;
492
+ if (extractQ)
493
+ {
494
+ mat << 1, 0, 0,
495
+ 0, m01, m02,
496
+ 0, m02, -m01;
497
+ }
498
+ }
499
+ }
500
+ };
501
+
502
+ /** \internal
503
+ * Trivial specialization for 1x1 matrices
504
+ */
505
+ template<typename MatrixType, bool IsComplex>
506
+ struct tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
507
+ {
508
+ typedef typename MatrixType::Scalar Scalar;
509
+
510
+ template<typename DiagonalType, typename SubDiagonalType>
511
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, bool extractQ)
512
+ {
513
+ diag(0,0) = numext::real(mat(0,0));
514
+ if(extractQ)
515
+ mat(0,0) = Scalar(1);
516
+ }
517
+ };
518
+
519
+ /** \internal
520
+ * \eigenvalues_module \ingroup Eigenvalues_Module
521
+ *
522
+ * \brief Expression type for return value of Tridiagonalization::matrixT()
523
+ *
524
+ * \tparam MatrixType type of underlying dense matrix
525
+ */
526
+ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
527
+ : public ReturnByValue<TridiagonalizationMatrixTReturnType<MatrixType> >
528
+ {
529
+ typedef typename MatrixType::Index Index;
530
+ public:
531
+ /** \brief Constructor.
532
+ *
533
+ * \param[in] mat The underlying dense matrix
534
+ */
535
+ TridiagonalizationMatrixTReturnType(const MatrixType& mat) : m_matrix(mat) { }
536
+
537
+ template <typename ResultType>
538
+ inline void evalTo(ResultType& result) const
539
+ {
540
+ result.setZero();
541
+ result.template diagonal<1>() = m_matrix.template diagonal<-1>().conjugate();
542
+ result.diagonal() = m_matrix.diagonal();
543
+ result.template diagonal<-1>() = m_matrix.template diagonal<-1>();
544
+ }
545
+
546
+ Index rows() const { return m_matrix.rows(); }
547
+ Index cols() const { return m_matrix.cols(); }
548
+
549
+ protected:
550
+ typename MatrixType::Nested m_matrix;
551
+ };
552
+
553
+ } // end namespace internal
554
+
555
+ } // end namespace Eigen
556
+
557
+ #endif // EIGEN_TRIDIAGONALIZATION_H