ruby-eigen 0.0.9 → 0.0.10.pre1

Sign up to get free protection for your applications and to get access to all the features.
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,282 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
6
+ // This Source Code Form is subject to the terms of the Mozilla
7
+ // Public License v. 2.0. If a copy of the MPL was not distributed
8
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+
10
+ #ifndef EIGEN_ITERATIVE_SOLVER_BASE_H
11
+ #define EIGEN_ITERATIVE_SOLVER_BASE_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \ingroup IterativeLinearSolvers_Module
16
+ * \brief Base class for linear iterative solvers
17
+ *
18
+ * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
19
+ */
20
+ template< typename Derived>
21
+ class IterativeSolverBase : internal::noncopyable
22
+ {
23
+ public:
24
+ typedef typename internal::traits<Derived>::MatrixType MatrixType;
25
+ typedef typename internal::traits<Derived>::Preconditioner Preconditioner;
26
+ typedef typename MatrixType::Scalar Scalar;
27
+ typedef typename MatrixType::Index Index;
28
+ typedef typename MatrixType::RealScalar RealScalar;
29
+
30
+ public:
31
+
32
+ Derived& derived() { return *static_cast<Derived*>(this); }
33
+ const Derived& derived() const { return *static_cast<const Derived*>(this); }
34
+
35
+ /** Default constructor. */
36
+ IterativeSolverBase()
37
+ : mp_matrix(0)
38
+ {
39
+ init();
40
+ }
41
+
42
+ /** Initialize the solver with matrix \a A for further \c Ax=b solving.
43
+ *
44
+ * This constructor is a shortcut for the default constructor followed
45
+ * by a call to compute().
46
+ *
47
+ * \warning this class stores a reference to the matrix A as well as some
48
+ * precomputed values that depend on it. Therefore, if \a A is changed
49
+ * this class becomes invalid. Call compute() to update it with the new
50
+ * matrix A, or modify a copy of A.
51
+ */
52
+ template<typename InputDerived>
53
+ IterativeSolverBase(const EigenBase<InputDerived>& A)
54
+ {
55
+ init();
56
+ compute(A.derived());
57
+ }
58
+
59
+ ~IterativeSolverBase() {}
60
+
61
+ /** Initializes the iterative solver for the sparcity pattern of the matrix \a A for further solving \c Ax=b problems.
62
+ *
63
+ * Currently, this function mostly call analyzePattern on the preconditioner. In the future
64
+ * we might, for instance, implement column reodering for faster matrix vector products.
65
+ */
66
+ template<typename InputDerived>
67
+ Derived& analyzePattern(const EigenBase<InputDerived>& A)
68
+ {
69
+ grabInput(A.derived());
70
+ m_preconditioner.analyzePattern(*mp_matrix);
71
+ m_isInitialized = true;
72
+ m_analysisIsOk = true;
73
+ m_info = Success;
74
+ return derived();
75
+ }
76
+
77
+ /** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems.
78
+ *
79
+ * Currently, this function mostly call factorize on the preconditioner.
80
+ *
81
+ * \warning this class stores a reference to the matrix A as well as some
82
+ * precomputed values that depend on it. Therefore, if \a A is changed
83
+ * this class becomes invalid. Call compute() to update it with the new
84
+ * matrix A, or modify a copy of A.
85
+ */
86
+ template<typename InputDerived>
87
+ Derived& factorize(const EigenBase<InputDerived>& A)
88
+ {
89
+ grabInput(A.derived());
90
+ eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
91
+ m_preconditioner.factorize(*mp_matrix);
92
+ m_factorizationIsOk = true;
93
+ m_info = Success;
94
+ return derived();
95
+ }
96
+
97
+ /** Initializes the iterative solver with the matrix \a A for further solving \c Ax=b problems.
98
+ *
99
+ * Currently, this function mostly initialized/compute the preconditioner. In the future
100
+ * we might, for instance, implement column reodering for faster matrix vector products.
101
+ *
102
+ * \warning this class stores a reference to the matrix A as well as some
103
+ * precomputed values that depend on it. Therefore, if \a A is changed
104
+ * this class becomes invalid. Call compute() to update it with the new
105
+ * matrix A, or modify a copy of A.
106
+ */
107
+ template<typename InputDerived>
108
+ Derived& compute(const EigenBase<InputDerived>& A)
109
+ {
110
+ grabInput(A.derived());
111
+ m_preconditioner.compute(*mp_matrix);
112
+ m_isInitialized = true;
113
+ m_analysisIsOk = true;
114
+ m_factorizationIsOk = true;
115
+ m_info = Success;
116
+ return derived();
117
+ }
118
+
119
+ /** \internal */
120
+ Index rows() const { return mp_matrix ? mp_matrix->rows() : 0; }
121
+ /** \internal */
122
+ Index cols() const { return mp_matrix ? mp_matrix->cols() : 0; }
123
+
124
+ /** \returns the tolerance threshold used by the stopping criteria */
125
+ RealScalar tolerance() const { return m_tolerance; }
126
+
127
+ /** Sets the tolerance threshold used by the stopping criteria */
128
+ Derived& setTolerance(const RealScalar& tolerance)
129
+ {
130
+ m_tolerance = tolerance;
131
+ return derived();
132
+ }
133
+
134
+ /** \returns a read-write reference to the preconditioner for custom configuration. */
135
+ Preconditioner& preconditioner() { return m_preconditioner; }
136
+
137
+ /** \returns a read-only reference to the preconditioner. */
138
+ const Preconditioner& preconditioner() const { return m_preconditioner; }
139
+
140
+ /** \returns the max number of iterations */
141
+ int maxIterations() const
142
+ {
143
+ return (mp_matrix && m_maxIterations<0) ? mp_matrix->cols() : m_maxIterations;
144
+ }
145
+
146
+ /** Sets the max number of iterations */
147
+ Derived& setMaxIterations(int maxIters)
148
+ {
149
+ m_maxIterations = maxIters;
150
+ return derived();
151
+ }
152
+
153
+ /** \returns the number of iterations performed during the last solve */
154
+ int iterations() const
155
+ {
156
+ eigen_assert(m_isInitialized && "ConjugateGradient is not initialized.");
157
+ return m_iterations;
158
+ }
159
+
160
+ /** \returns the tolerance error reached during the last solve */
161
+ RealScalar error() const
162
+ {
163
+ eigen_assert(m_isInitialized && "ConjugateGradient is not initialized.");
164
+ return m_error;
165
+ }
166
+
167
+ /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
168
+ *
169
+ * \sa compute()
170
+ */
171
+ template<typename Rhs> inline const internal::solve_retval<Derived, Rhs>
172
+ solve(const MatrixBase<Rhs>& b) const
173
+ {
174
+ eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
175
+ eigen_assert(rows()==b.rows()
176
+ && "IterativeSolverBase::solve(): invalid number of rows of the right hand side matrix b");
177
+ return internal::solve_retval<Derived, Rhs>(derived(), b.derived());
178
+ }
179
+
180
+ /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
181
+ *
182
+ * \sa compute()
183
+ */
184
+ template<typename Rhs>
185
+ inline const internal::sparse_solve_retval<IterativeSolverBase, Rhs>
186
+ solve(const SparseMatrixBase<Rhs>& b) const
187
+ {
188
+ eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
189
+ eigen_assert(rows()==b.rows()
190
+ && "IterativeSolverBase::solve(): invalid number of rows of the right hand side matrix b");
191
+ return internal::sparse_solve_retval<IterativeSolverBase, Rhs>(*this, b.derived());
192
+ }
193
+
194
+ /** \returns Success if the iterations converged, and NoConvergence otherwise. */
195
+ ComputationInfo info() const
196
+ {
197
+ eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
198
+ return m_info;
199
+ }
200
+
201
+ /** \internal */
202
+ template<typename Rhs, typename DestScalar, int DestOptions, typename DestIndex>
203
+ void _solve_sparse(const Rhs& b, SparseMatrix<DestScalar,DestOptions,DestIndex> &dest) const
204
+ {
205
+ eigen_assert(rows()==b.rows());
206
+
207
+ int rhsCols = b.cols();
208
+ int size = b.rows();
209
+ Eigen::Matrix<DestScalar,Dynamic,1> tb(size);
210
+ Eigen::Matrix<DestScalar,Dynamic,1> tx(size);
211
+ for(int k=0; k<rhsCols; ++k)
212
+ {
213
+ tb = b.col(k);
214
+ tx = derived().solve(tb);
215
+ dest.col(k) = tx.sparseView(0);
216
+ }
217
+ }
218
+
219
+ protected:
220
+
221
+ template<typename InputDerived>
222
+ void grabInput(const EigenBase<InputDerived>& A)
223
+ {
224
+ // we const cast to prevent the creation of a MatrixType temporary by the compiler.
225
+ grabInput_impl(A.const_cast_derived());
226
+ }
227
+
228
+ template<typename InputDerived>
229
+ void grabInput_impl(const EigenBase<InputDerived>& A)
230
+ {
231
+ m_copyMatrix = A;
232
+ mp_matrix = &m_copyMatrix;
233
+ }
234
+
235
+ void grabInput_impl(MatrixType& A)
236
+ {
237
+ if(MatrixType::RowsAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==Dynamic)
238
+ m_copyMatrix.resize(0,0);
239
+ mp_matrix = &A;
240
+ }
241
+
242
+ void init()
243
+ {
244
+ m_isInitialized = false;
245
+ m_analysisIsOk = false;
246
+ m_factorizationIsOk = false;
247
+ m_maxIterations = -1;
248
+ m_tolerance = NumTraits<Scalar>::epsilon();
249
+ }
250
+ MatrixType m_copyMatrix;
251
+ const MatrixType* mp_matrix;
252
+ Preconditioner m_preconditioner;
253
+
254
+ int m_maxIterations;
255
+ RealScalar m_tolerance;
256
+
257
+ mutable RealScalar m_error;
258
+ mutable int m_iterations;
259
+ mutable ComputationInfo m_info;
260
+ mutable bool m_isInitialized, m_analysisIsOk, m_factorizationIsOk;
261
+ };
262
+
263
+ namespace internal {
264
+
265
+ template<typename Derived, typename Rhs>
266
+ struct sparse_solve_retval<IterativeSolverBase<Derived>, Rhs>
267
+ : sparse_solve_retval_base<IterativeSolverBase<Derived>, Rhs>
268
+ {
269
+ typedef IterativeSolverBase<Derived> Dec;
270
+ EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
271
+
272
+ template<typename Dest> void evalTo(Dest& dst) const
273
+ {
274
+ dec().derived()._solve_sparse(rhs(),dst);
275
+ }
276
+ };
277
+
278
+ } // end namespace internal
279
+
280
+ } // end namespace Eigen
281
+
282
+ #endif // EIGEN_ITERATIVE_SOLVER_BASE_H
@@ -0,0 +1,433 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5
+ // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
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_JACOBI_H
12
+ #define EIGEN_JACOBI_H
13
+
14
+ namespace Eigen {
15
+
16
+ /** \ingroup Jacobi_Module
17
+ * \jacobi_module
18
+ * \class JacobiRotation
19
+ * \brief Rotation given by a cosine-sine pair.
20
+ *
21
+ * This class represents a Jacobi or Givens rotation.
22
+ * This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by
23
+ * its cosine \c c and sine \c s as follow:
24
+ * \f$ J = \left ( \begin{array}{cc} c & \overline s \\ -s & \overline c \end{array} \right ) \f$
25
+ *
26
+ * You can apply the respective counter-clockwise rotation to a column vector \c v by
27
+ * applying its adjoint on the left: \f$ v = J^* v \f$ that translates to the following Eigen code:
28
+ * \code
29
+ * v.applyOnTheLeft(J.adjoint());
30
+ * \endcode
31
+ *
32
+ * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
33
+ */
34
+ template<typename Scalar> class JacobiRotation
35
+ {
36
+ public:
37
+ typedef typename NumTraits<Scalar>::Real RealScalar;
38
+
39
+ /** Default constructor without any initialization. */
40
+ JacobiRotation() {}
41
+
42
+ /** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */
43
+ JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {}
44
+
45
+ Scalar& c() { return m_c; }
46
+ Scalar c() const { return m_c; }
47
+ Scalar& s() { return m_s; }
48
+ Scalar s() const { return m_s; }
49
+
50
+ /** Concatenates two planar rotation */
51
+ JacobiRotation operator*(const JacobiRotation& other)
52
+ {
53
+ using numext::conj;
54
+ return JacobiRotation(m_c * other.m_c - conj(m_s) * other.m_s,
55
+ conj(m_c * conj(other.m_s) + conj(m_s) * conj(other.m_c)));
56
+ }
57
+
58
+ /** Returns the transposed transformation */
59
+ JacobiRotation transpose() const { using numext::conj; return JacobiRotation(m_c, -conj(m_s)); }
60
+
61
+ /** Returns the adjoint transformation */
62
+ JacobiRotation adjoint() const { using numext::conj; return JacobiRotation(conj(m_c), -m_s); }
63
+
64
+ template<typename Derived>
65
+ bool makeJacobi(const MatrixBase<Derived>&, typename Derived::Index p, typename Derived::Index q);
66
+ bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z);
67
+
68
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0);
69
+
70
+ protected:
71
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type);
72
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type);
73
+
74
+ Scalar m_c, m_s;
75
+ };
76
+
77
+ /** Makes \c *this as a Jacobi rotation \a J such that applying \a J on both the right and left sides of the selfadjoint 2x2 matrix
78
+ * \f$ B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )\f$ yields a diagonal matrix \f$ A = J^* B J \f$
79
+ *
80
+ * \sa MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
81
+ */
82
+ template<typename Scalar>
83
+ bool JacobiRotation<Scalar>::makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z)
84
+ {
85
+ using std::sqrt;
86
+ using std::abs;
87
+ typedef typename NumTraits<Scalar>::Real RealScalar;
88
+ if(y == Scalar(0))
89
+ {
90
+ m_c = Scalar(1);
91
+ m_s = Scalar(0);
92
+ return false;
93
+ }
94
+ else
95
+ {
96
+ RealScalar tau = (x-z)/(RealScalar(2)*abs(y));
97
+ RealScalar w = sqrt(numext::abs2(tau) + RealScalar(1));
98
+ RealScalar t;
99
+ if(tau>RealScalar(0))
100
+ {
101
+ t = RealScalar(1) / (tau + w);
102
+ }
103
+ else
104
+ {
105
+ t = RealScalar(1) / (tau - w);
106
+ }
107
+ RealScalar sign_t = t > RealScalar(0) ? RealScalar(1) : RealScalar(-1);
108
+ RealScalar n = RealScalar(1) / sqrt(numext::abs2(t)+RealScalar(1));
109
+ m_s = - sign_t * (numext::conj(y) / abs(y)) * abs(t) * n;
110
+ m_c = n;
111
+ return true;
112
+ }
113
+ }
114
+
115
+ /** Makes \c *this as a Jacobi rotation \c J such that applying \a J on both the right and left sides of the 2x2 selfadjoint matrix
116
+ * \f$ B = \left ( \begin{array}{cc} \text{this}_{pp} & \text{this}_{pq} \\ (\text{this}_{pq})^* & \text{this}_{qq} \end{array} \right )\f$ yields
117
+ * a diagonal matrix \f$ A = J^* B J \f$
118
+ *
119
+ * Example: \include Jacobi_makeJacobi.cpp
120
+ * Output: \verbinclude Jacobi_makeJacobi.out
121
+ *
122
+ * \sa JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
123
+ */
124
+ template<typename Scalar>
125
+ template<typename Derived>
126
+ inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q)
127
+ {
128
+ return makeJacobi(numext::real(m.coeff(p,p)), m.coeff(p,q), numext::real(m.coeff(q,q)));
129
+ }
130
+
131
+ /** Makes \c *this as a Givens rotation \c G such that applying \f$ G^* \f$ to the left of the vector
132
+ * \f$ V = \left ( \begin{array}{c} p \\ q \end{array} \right )\f$ yields:
133
+ * \f$ G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\f$.
134
+ *
135
+ * The value of \a z is returned if \a z is not null (the default is null).
136
+ * Also note that G is built such that the cosine is always real.
137
+ *
138
+ * Example: \include Jacobi_makeGivens.cpp
139
+ * Output: \verbinclude Jacobi_makeGivens.out
140
+ *
141
+ * This function implements the continuous Givens rotation generation algorithm
142
+ * found in Anderson (2000), Discontinuous Plane Rotations and the Symmetric Eigenvalue Problem.
143
+ * LAPACK Working Note 150, University of Tennessee, UT-CS-00-454, December 4, 2000.
144
+ *
145
+ * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
146
+ */
147
+ template<typename Scalar>
148
+ void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)
149
+ {
150
+ makeGivens(p, q, z, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type());
151
+ }
152
+
153
+
154
+ // specialization for complexes
155
+ template<typename Scalar>
156
+ void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type)
157
+ {
158
+ using std::sqrt;
159
+ using std::abs;
160
+ using numext::conj;
161
+
162
+ if(q==Scalar(0))
163
+ {
164
+ m_c = numext::real(p)<0 ? Scalar(-1) : Scalar(1);
165
+ m_s = 0;
166
+ if(r) *r = m_c * p;
167
+ }
168
+ else if(p==Scalar(0))
169
+ {
170
+ m_c = 0;
171
+ m_s = -q/abs(q);
172
+ if(r) *r = abs(q);
173
+ }
174
+ else
175
+ {
176
+ RealScalar p1 = numext::norm1(p);
177
+ RealScalar q1 = numext::norm1(q);
178
+ if(p1>=q1)
179
+ {
180
+ Scalar ps = p / p1;
181
+ RealScalar p2 = numext::abs2(ps);
182
+ Scalar qs = q / p1;
183
+ RealScalar q2 = numext::abs2(qs);
184
+
185
+ RealScalar u = sqrt(RealScalar(1) + q2/p2);
186
+ if(numext::real(p)<RealScalar(0))
187
+ u = -u;
188
+
189
+ m_c = Scalar(1)/u;
190
+ m_s = -qs*conj(ps)*(m_c/p2);
191
+ if(r) *r = p * u;
192
+ }
193
+ else
194
+ {
195
+ Scalar ps = p / q1;
196
+ RealScalar p2 = numext::abs2(ps);
197
+ Scalar qs = q / q1;
198
+ RealScalar q2 = numext::abs2(qs);
199
+
200
+ RealScalar u = q1 * sqrt(p2 + q2);
201
+ if(numext::real(p)<RealScalar(0))
202
+ u = -u;
203
+
204
+ p1 = abs(p);
205
+ ps = p/p1;
206
+ m_c = p1/u;
207
+ m_s = -conj(ps) * (q/u);
208
+ if(r) *r = ps * u;
209
+ }
210
+ }
211
+ }
212
+
213
+ // specialization for reals
214
+ template<typename Scalar>
215
+ void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type)
216
+ {
217
+ using std::sqrt;
218
+ using std::abs;
219
+ if(q==Scalar(0))
220
+ {
221
+ m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1);
222
+ m_s = Scalar(0);
223
+ if(r) *r = abs(p);
224
+ }
225
+ else if(p==Scalar(0))
226
+ {
227
+ m_c = Scalar(0);
228
+ m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1);
229
+ if(r) *r = abs(q);
230
+ }
231
+ else if(abs(p) > abs(q))
232
+ {
233
+ Scalar t = q/p;
234
+ Scalar u = sqrt(Scalar(1) + numext::abs2(t));
235
+ if(p<Scalar(0))
236
+ u = -u;
237
+ m_c = Scalar(1)/u;
238
+ m_s = -t * m_c;
239
+ if(r) *r = p * u;
240
+ }
241
+ else
242
+ {
243
+ Scalar t = p/q;
244
+ Scalar u = sqrt(Scalar(1) + numext::abs2(t));
245
+ if(q<Scalar(0))
246
+ u = -u;
247
+ m_s = -Scalar(1)/u;
248
+ m_c = -t * m_s;
249
+ if(r) *r = q * u;
250
+ }
251
+
252
+ }
253
+
254
+ /****************************************************************************************
255
+ * Implementation of MatrixBase methods
256
+ ****************************************************************************************/
257
+
258
+ /** \jacobi_module
259
+ * Applies the clock wise 2D rotation \a j to the set of 2D vectors of cordinates \a x and \a y:
260
+ * \f$ \left ( \begin{array}{cc} x \\ y \end{array} \right ) = J \left ( \begin{array}{cc} x \\ y \end{array} \right ) \f$
261
+ *
262
+ * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
263
+ */
264
+ namespace internal {
265
+ template<typename VectorX, typename VectorY, typename OtherScalar>
266
+ void apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j);
267
+ }
268
+
269
+ /** \jacobi_module
270
+ * Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B,
271
+ * with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$.
272
+ *
273
+ * \sa class JacobiRotation, MatrixBase::applyOnTheRight(), internal::apply_rotation_in_the_plane()
274
+ */
275
+ template<typename Derived>
276
+ template<typename OtherScalar>
277
+ inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j)
278
+ {
279
+ RowXpr x(this->row(p));
280
+ RowXpr y(this->row(q));
281
+ internal::apply_rotation_in_the_plane(x, y, j);
282
+ }
283
+
284
+ /** \ingroup Jacobi_Module
285
+ * Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J
286
+ * with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$.
287
+ *
288
+ * \sa class JacobiRotation, MatrixBase::applyOnTheLeft(), internal::apply_rotation_in_the_plane()
289
+ */
290
+ template<typename Derived>
291
+ template<typename OtherScalar>
292
+ inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j)
293
+ {
294
+ ColXpr x(this->col(p));
295
+ ColXpr y(this->col(q));
296
+ internal::apply_rotation_in_the_plane(x, y, j.transpose());
297
+ }
298
+
299
+ namespace internal {
300
+ template<typename VectorX, typename VectorY, typename OtherScalar>
301
+ void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j)
302
+ {
303
+ typedef typename VectorX::Index Index;
304
+ typedef typename VectorX::Scalar Scalar;
305
+ enum { PacketSize = packet_traits<Scalar>::size };
306
+ typedef typename packet_traits<Scalar>::type Packet;
307
+ eigen_assert(_x.size() == _y.size());
308
+ Index size = _x.size();
309
+ Index incrx = _x.innerStride();
310
+ Index incry = _y.innerStride();
311
+
312
+ Scalar* EIGEN_RESTRICT x = &_x.coeffRef(0);
313
+ Scalar* EIGEN_RESTRICT y = &_y.coeffRef(0);
314
+
315
+ OtherScalar c = j.c();
316
+ OtherScalar s = j.s();
317
+ if (c==OtherScalar(1) && s==OtherScalar(0))
318
+ return;
319
+
320
+ /*** dynamic-size vectorized paths ***/
321
+
322
+ if(VectorX::SizeAtCompileTime == Dynamic &&
323
+ (VectorX::Flags & VectorY::Flags & PacketAccessBit) &&
324
+ ((incrx==1 && incry==1) || PacketSize == 1))
325
+ {
326
+ // both vectors are sequentially stored in memory => vectorization
327
+ enum { Peeling = 2 };
328
+
329
+ Index alignedStart = internal::first_aligned(y, size);
330
+ Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize;
331
+
332
+ const Packet pc = pset1<Packet>(c);
333
+ const Packet ps = pset1<Packet>(s);
334
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj;
335
+
336
+ for(Index i=0; i<alignedStart; ++i)
337
+ {
338
+ Scalar xi = x[i];
339
+ Scalar yi = y[i];
340
+ x[i] = c * xi + numext::conj(s) * yi;
341
+ y[i] = -s * xi + numext::conj(c) * yi;
342
+ }
343
+
344
+ Scalar* EIGEN_RESTRICT px = x + alignedStart;
345
+ Scalar* EIGEN_RESTRICT py = y + alignedStart;
346
+
347
+ if(internal::first_aligned(x, size)==alignedStart)
348
+ {
349
+ for(Index i=alignedStart; i<alignedEnd; i+=PacketSize)
350
+ {
351
+ Packet xi = pload<Packet>(px);
352
+ Packet yi = pload<Packet>(py);
353
+ pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
354
+ pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
355
+ px += PacketSize;
356
+ py += PacketSize;
357
+ }
358
+ }
359
+ else
360
+ {
361
+ Index peelingEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize);
362
+ for(Index i=alignedStart; i<peelingEnd; i+=Peeling*PacketSize)
363
+ {
364
+ Packet xi = ploadu<Packet>(px);
365
+ Packet xi1 = ploadu<Packet>(px+PacketSize);
366
+ Packet yi = pload <Packet>(py);
367
+ Packet yi1 = pload <Packet>(py+PacketSize);
368
+ pstoreu(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
369
+ pstoreu(px+PacketSize, padd(pmul(pc,xi1),pcj.pmul(ps,yi1)));
370
+ pstore (py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
371
+ pstore (py+PacketSize, psub(pcj.pmul(pc,yi1),pmul(ps,xi1)));
372
+ px += Peeling*PacketSize;
373
+ py += Peeling*PacketSize;
374
+ }
375
+ if(alignedEnd!=peelingEnd)
376
+ {
377
+ Packet xi = ploadu<Packet>(x+peelingEnd);
378
+ Packet yi = pload <Packet>(y+peelingEnd);
379
+ pstoreu(x+peelingEnd, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
380
+ pstore (y+peelingEnd, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
381
+ }
382
+ }
383
+
384
+ for(Index i=alignedEnd; i<size; ++i)
385
+ {
386
+ Scalar xi = x[i];
387
+ Scalar yi = y[i];
388
+ x[i] = c * xi + numext::conj(s) * yi;
389
+ y[i] = -s * xi + numext::conj(c) * yi;
390
+ }
391
+ }
392
+
393
+ /*** fixed-size vectorized path ***/
394
+ else if(VectorX::SizeAtCompileTime != Dynamic &&
395
+ (VectorX::Flags & VectorY::Flags & PacketAccessBit) &&
396
+ (VectorX::Flags & VectorY::Flags & AlignedBit))
397
+ {
398
+ const Packet pc = pset1<Packet>(c);
399
+ const Packet ps = pset1<Packet>(s);
400
+ conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj;
401
+ Scalar* EIGEN_RESTRICT px = x;
402
+ Scalar* EIGEN_RESTRICT py = y;
403
+ for(Index i=0; i<size; i+=PacketSize)
404
+ {
405
+ Packet xi = pload<Packet>(px);
406
+ Packet yi = pload<Packet>(py);
407
+ pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi)));
408
+ pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi)));
409
+ px += PacketSize;
410
+ py += PacketSize;
411
+ }
412
+ }
413
+
414
+ /*** non-vectorized path ***/
415
+ else
416
+ {
417
+ for(Index i=0; i<size; ++i)
418
+ {
419
+ Scalar xi = *x;
420
+ Scalar yi = *y;
421
+ *x = c * xi + numext::conj(s) * yi;
422
+ *y = -s * xi + numext::conj(c) * yi;
423
+ x += incrx;
424
+ y += incry;
425
+ }
426
+ }
427
+ }
428
+
429
+ } // end namespace internal
430
+
431
+ } // end namespace Eigen
432
+
433
+ #endif // EIGEN_JACOBI_H