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,427 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008-2009 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_GENERAL_MATRIX_MATRIX_H
11
+ #define EIGEN_GENERAL_MATRIX_MATRIX_H
12
+
13
+ namespace Eigen {
14
+
15
+ namespace internal {
16
+
17
+ template<typename _LhsScalar, typename _RhsScalar> class level3_blocking;
18
+
19
+ /* Specialization for a row-major destination matrix => simple transposition of the product */
20
+ template<
21
+ typename Index,
22
+ typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
23
+ typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs>
24
+ struct general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor>
25
+ {
26
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
27
+ static EIGEN_STRONG_INLINE void run(
28
+ Index rows, Index cols, Index depth,
29
+ const LhsScalar* lhs, Index lhsStride,
30
+ const RhsScalar* rhs, Index rhsStride,
31
+ ResScalar* res, Index resStride,
32
+ ResScalar alpha,
33
+ level3_blocking<RhsScalar,LhsScalar>& blocking,
34
+ GemmParallelInfo<Index>* info = 0)
35
+ {
36
+ // transpose the product such that the result is column major
37
+ general_matrix_matrix_product<Index,
38
+ RhsScalar, RhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateRhs,
39
+ LhsScalar, LhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateLhs,
40
+ ColMajor>
41
+ ::run(cols,rows,depth,rhs,rhsStride,lhs,lhsStride,res,resStride,alpha,blocking,info);
42
+ }
43
+ };
44
+
45
+ /* Specialization for a col-major destination matrix
46
+ * => Blocking algorithm following Goto's paper */
47
+ template<
48
+ typename Index,
49
+ typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
50
+ typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs>
51
+ struct general_matrix_matrix_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor>
52
+ {
53
+
54
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
55
+ static void run(Index rows, Index cols, Index depth,
56
+ const LhsScalar* _lhs, Index lhsStride,
57
+ const RhsScalar* _rhs, Index rhsStride,
58
+ ResScalar* res, Index resStride,
59
+ ResScalar alpha,
60
+ level3_blocking<LhsScalar,RhsScalar>& blocking,
61
+ GemmParallelInfo<Index>* info = 0)
62
+ {
63
+ const_blas_data_mapper<LhsScalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
64
+ const_blas_data_mapper<RhsScalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
65
+
66
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
67
+
68
+ Index kc = blocking.kc(); // cache block size along the K direction
69
+ Index mc = (std::min)(rows,blocking.mc()); // cache block size along the M direction
70
+ //Index nc = blocking.nc(); // cache block size along the N direction
71
+
72
+ gemm_pack_lhs<LhsScalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
73
+ gemm_pack_rhs<RhsScalar, Index, Traits::nr, RhsStorageOrder> pack_rhs;
74
+ gebp_kernel<LhsScalar, RhsScalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp;
75
+
76
+ #ifdef EIGEN_HAS_OPENMP
77
+ if(info)
78
+ {
79
+ // this is the parallel version!
80
+ Index tid = omp_get_thread_num();
81
+ Index threads = omp_get_num_threads();
82
+
83
+ std::size_t sizeA = kc*mc;
84
+ std::size_t sizeW = kc*Traits::WorkSpaceFactor;
85
+ ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, sizeA, 0);
86
+ ei_declare_aligned_stack_constructed_variable(RhsScalar, w, sizeW, 0);
87
+
88
+ RhsScalar* blockB = blocking.blockB();
89
+ eigen_internal_assert(blockB!=0);
90
+
91
+ // For each horizontal panel of the rhs, and corresponding vertical panel of the lhs...
92
+ for(Index k=0; k<depth; k+=kc)
93
+ {
94
+ const Index actual_kc = (std::min)(k+kc,depth)-k; // => rows of B', and cols of the A'
95
+
96
+ // In order to reduce the chance that a thread has to wait for the other,
97
+ // let's start by packing A'.
98
+ pack_lhs(blockA, &lhs(0,k), lhsStride, actual_kc, mc);
99
+
100
+ // Pack B_k to B' in a parallel fashion:
101
+ // each thread packs the sub block B_k,j to B'_j where j is the thread id.
102
+
103
+ // However, before copying to B'_j, we have to make sure that no other thread is still using it,
104
+ // i.e., we test that info[tid].users equals 0.
105
+ // Then, we set info[tid].users to the number of threads to mark that all other threads are going to use it.
106
+ while(info[tid].users!=0) {}
107
+ info[tid].users += threads;
108
+
109
+ pack_rhs(blockB+info[tid].rhs_start*actual_kc, &rhs(k,info[tid].rhs_start), rhsStride, actual_kc, info[tid].rhs_length);
110
+
111
+ // Notify the other threads that the part B'_j is ready to go.
112
+ info[tid].sync = k;
113
+
114
+ // Computes C_i += A' * B' per B'_j
115
+ for(Index shift=0; shift<threads; ++shift)
116
+ {
117
+ Index j = (tid+shift)%threads;
118
+
119
+ // At this point we have to make sure that B'_j has been updated by the thread j,
120
+ // we use testAndSetOrdered to mimic a volatile access.
121
+ // However, no need to wait for the B' part which has been updated by the current thread!
122
+ if(shift>0)
123
+ while(info[j].sync!=k) {}
124
+
125
+ gebp(res+info[j].rhs_start*resStride, resStride, blockA, blockB+info[j].rhs_start*actual_kc, mc, actual_kc, info[j].rhs_length, alpha, -1,-1,0,0, w);
126
+ }
127
+
128
+ // Then keep going as usual with the remaining A'
129
+ for(Index i=mc; i<rows; i+=mc)
130
+ {
131
+ const Index actual_mc = (std::min)(i+mc,rows)-i;
132
+
133
+ // pack A_i,k to A'
134
+ pack_lhs(blockA, &lhs(i,k), lhsStride, actual_kc, actual_mc);
135
+
136
+ // C_i += A' * B'
137
+ gebp(res+i, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha, -1,-1,0,0, w);
138
+ }
139
+
140
+ // Release all the sub blocks B'_j of B' for the current thread,
141
+ // i.e., we simply decrement the number of users by 1
142
+ for(Index j=0; j<threads; ++j)
143
+ #pragma omp atomic
144
+ --(info[j].users);
145
+ }
146
+ }
147
+ else
148
+ #endif // EIGEN_HAS_OPENMP
149
+ {
150
+ EIGEN_UNUSED_VARIABLE(info);
151
+
152
+ // this is the sequential version!
153
+ std::size_t sizeA = kc*mc;
154
+ std::size_t sizeB = kc*cols;
155
+ std::size_t sizeW = kc*Traits::WorkSpaceFactor;
156
+
157
+ ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, sizeA, blocking.blockA());
158
+ ei_declare_aligned_stack_constructed_variable(RhsScalar, blockB, sizeB, blocking.blockB());
159
+ ei_declare_aligned_stack_constructed_variable(RhsScalar, blockW, sizeW, blocking.blockW());
160
+
161
+ // For each horizontal panel of the rhs, and corresponding panel of the lhs...
162
+ // (==GEMM_VAR1)
163
+ for(Index k2=0; k2<depth; k2+=kc)
164
+ {
165
+ const Index actual_kc = (std::min)(k2+kc,depth)-k2;
166
+
167
+ // OK, here we have selected one horizontal panel of rhs and one vertical panel of lhs.
168
+ // => Pack rhs's panel into a sequential chunk of memory (L2 caching)
169
+ // Note that this panel will be read as many times as the number of blocks in the lhs's
170
+ // vertical panel which is, in practice, a very low number.
171
+ pack_rhs(blockB, &rhs(k2,0), rhsStride, actual_kc, cols);
172
+
173
+ // For each mc x kc block of the lhs's vertical panel...
174
+ // (==GEPP_VAR1)
175
+ for(Index i2=0; i2<rows; i2+=mc)
176
+ {
177
+ const Index actual_mc = (std::min)(i2+mc,rows)-i2;
178
+
179
+ // We pack the lhs's block into a sequential chunk of memory (L1 caching)
180
+ // Note that this block will be read a very high number of times, which is equal to the number of
181
+ // micro vertical panel of the large rhs's panel (e.g., cols/4 times).
182
+ pack_lhs(blockA, &lhs(i2,k2), lhsStride, actual_kc, actual_mc);
183
+
184
+ // Everything is packed, we can now call the block * panel kernel:
185
+ gebp(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, cols, alpha, -1, -1, 0, 0, blockW);
186
+ }
187
+ }
188
+ }
189
+ }
190
+
191
+ };
192
+
193
+ /*********************************************************************************
194
+ * Specialization of GeneralProduct<> for "large" GEMM, i.e.,
195
+ * implementation of the high level wrapper to general_matrix_matrix_product
196
+ **********************************************************************************/
197
+
198
+ template<typename Lhs, typename Rhs>
199
+ struct traits<GeneralProduct<Lhs,Rhs,GemmProduct> >
200
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemmProduct>, Lhs, Rhs> >
201
+ {};
202
+
203
+ template<typename Scalar, typename Index, typename Gemm, typename Lhs, typename Rhs, typename Dest, typename BlockingType>
204
+ struct gemm_functor
205
+ {
206
+ gemm_functor(const Lhs& lhs, const Rhs& rhs, Dest& dest, const Scalar& actualAlpha,
207
+ BlockingType& blocking)
208
+ : m_lhs(lhs), m_rhs(rhs), m_dest(dest), m_actualAlpha(actualAlpha), m_blocking(blocking)
209
+ {}
210
+
211
+ void initParallelSession() const
212
+ {
213
+ m_blocking.allocateB();
214
+ }
215
+
216
+ void operator() (Index row, Index rows, Index col=0, Index cols=-1, GemmParallelInfo<Index>* info=0) const
217
+ {
218
+ if(cols==-1)
219
+ cols = m_rhs.cols();
220
+
221
+ Gemm::run(rows, cols, m_lhs.cols(),
222
+ /*(const Scalar*)*/&m_lhs.coeffRef(row,0), m_lhs.outerStride(),
223
+ /*(const Scalar*)*/&m_rhs.coeffRef(0,col), m_rhs.outerStride(),
224
+ (Scalar*)&(m_dest.coeffRef(row,col)), m_dest.outerStride(),
225
+ m_actualAlpha, m_blocking, info);
226
+ }
227
+
228
+ protected:
229
+ const Lhs& m_lhs;
230
+ const Rhs& m_rhs;
231
+ Dest& m_dest;
232
+ Scalar m_actualAlpha;
233
+ BlockingType& m_blocking;
234
+ };
235
+
236
+ template<int StorageOrder, typename LhsScalar, typename RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor=1,
237
+ bool FiniteAtCompileTime = MaxRows!=Dynamic && MaxCols!=Dynamic && MaxDepth != Dynamic> class gemm_blocking_space;
238
+
239
+ template<typename _LhsScalar, typename _RhsScalar>
240
+ class level3_blocking
241
+ {
242
+ typedef _LhsScalar LhsScalar;
243
+ typedef _RhsScalar RhsScalar;
244
+
245
+ protected:
246
+ LhsScalar* m_blockA;
247
+ RhsScalar* m_blockB;
248
+ RhsScalar* m_blockW;
249
+
250
+ DenseIndex m_mc;
251
+ DenseIndex m_nc;
252
+ DenseIndex m_kc;
253
+
254
+ public:
255
+
256
+ level3_blocking()
257
+ : m_blockA(0), m_blockB(0), m_blockW(0), m_mc(0), m_nc(0), m_kc(0)
258
+ {}
259
+
260
+ inline DenseIndex mc() const { return m_mc; }
261
+ inline DenseIndex nc() const { return m_nc; }
262
+ inline DenseIndex kc() const { return m_kc; }
263
+
264
+ inline LhsScalar* blockA() { return m_blockA; }
265
+ inline RhsScalar* blockB() { return m_blockB; }
266
+ inline RhsScalar* blockW() { return m_blockW; }
267
+ };
268
+
269
+ template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor>
270
+ class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, KcFactor, true>
271
+ : public level3_blocking<
272
+ typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
273
+ typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
274
+ {
275
+ enum {
276
+ Transpose = StorageOrder==RowMajor,
277
+ ActualRows = Transpose ? MaxCols : MaxRows,
278
+ ActualCols = Transpose ? MaxRows : MaxCols
279
+ };
280
+ typedef typename conditional<Transpose,_RhsScalar,_LhsScalar>::type LhsScalar;
281
+ typedef typename conditional<Transpose,_LhsScalar,_RhsScalar>::type RhsScalar;
282
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
283
+ enum {
284
+ SizeA = ActualRows * MaxDepth,
285
+ SizeB = ActualCols * MaxDepth,
286
+ SizeW = MaxDepth * Traits::WorkSpaceFactor
287
+ };
288
+
289
+ EIGEN_ALIGN16 LhsScalar m_staticA[SizeA];
290
+ EIGEN_ALIGN16 RhsScalar m_staticB[SizeB];
291
+ EIGEN_ALIGN16 RhsScalar m_staticW[SizeW];
292
+
293
+ public:
294
+
295
+ gemm_blocking_space(DenseIndex /*rows*/, DenseIndex /*cols*/, DenseIndex /*depth*/)
296
+ {
297
+ this->m_mc = ActualRows;
298
+ this->m_nc = ActualCols;
299
+ this->m_kc = MaxDepth;
300
+ this->m_blockA = m_staticA;
301
+ this->m_blockB = m_staticB;
302
+ this->m_blockW = m_staticW;
303
+ }
304
+
305
+ inline void allocateA() {}
306
+ inline void allocateB() {}
307
+ inline void allocateW() {}
308
+ inline void allocateAll() {}
309
+ };
310
+
311
+ template<int StorageOrder, typename _LhsScalar, typename _RhsScalar, int MaxRows, int MaxCols, int MaxDepth, int KcFactor>
312
+ class gemm_blocking_space<StorageOrder,_LhsScalar,_RhsScalar,MaxRows, MaxCols, MaxDepth, KcFactor, false>
313
+ : public level3_blocking<
314
+ typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
315
+ typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
316
+ {
317
+ enum {
318
+ Transpose = StorageOrder==RowMajor
319
+ };
320
+ typedef typename conditional<Transpose,_RhsScalar,_LhsScalar>::type LhsScalar;
321
+ typedef typename conditional<Transpose,_LhsScalar,_RhsScalar>::type RhsScalar;
322
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
323
+
324
+ DenseIndex m_sizeA;
325
+ DenseIndex m_sizeB;
326
+ DenseIndex m_sizeW;
327
+
328
+ public:
329
+
330
+ gemm_blocking_space(DenseIndex rows, DenseIndex cols, DenseIndex depth)
331
+ {
332
+ this->m_mc = Transpose ? cols : rows;
333
+ this->m_nc = Transpose ? rows : cols;
334
+ this->m_kc = depth;
335
+
336
+ computeProductBlockingSizes<LhsScalar,RhsScalar,KcFactor>(this->m_kc, this->m_mc, this->m_nc);
337
+ m_sizeA = this->m_mc * this->m_kc;
338
+ m_sizeB = this->m_kc * this->m_nc;
339
+ m_sizeW = this->m_kc*Traits::WorkSpaceFactor;
340
+ }
341
+
342
+ void allocateA()
343
+ {
344
+ if(this->m_blockA==0)
345
+ this->m_blockA = aligned_new<LhsScalar>(m_sizeA);
346
+ }
347
+
348
+ void allocateB()
349
+ {
350
+ if(this->m_blockB==0)
351
+ this->m_blockB = aligned_new<RhsScalar>(m_sizeB);
352
+ }
353
+
354
+ void allocateW()
355
+ {
356
+ if(this->m_blockW==0)
357
+ this->m_blockW = aligned_new<RhsScalar>(m_sizeW);
358
+ }
359
+
360
+ void allocateAll()
361
+ {
362
+ allocateA();
363
+ allocateB();
364
+ allocateW();
365
+ }
366
+
367
+ ~gemm_blocking_space()
368
+ {
369
+ aligned_delete(this->m_blockA, m_sizeA);
370
+ aligned_delete(this->m_blockB, m_sizeB);
371
+ aligned_delete(this->m_blockW, m_sizeW);
372
+ }
373
+ };
374
+
375
+ } // end namespace internal
376
+
377
+ template<typename Lhs, typename Rhs>
378
+ class GeneralProduct<Lhs, Rhs, GemmProduct>
379
+ : public ProductBase<GeneralProduct<Lhs,Rhs,GemmProduct>, Lhs, Rhs>
380
+ {
381
+ enum {
382
+ MaxDepthAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(Lhs::MaxColsAtCompileTime,Rhs::MaxRowsAtCompileTime)
383
+ };
384
+ public:
385
+ EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
386
+
387
+ typedef typename Lhs::Scalar LhsScalar;
388
+ typedef typename Rhs::Scalar RhsScalar;
389
+ typedef Scalar ResScalar;
390
+
391
+ GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
392
+ {
393
+ typedef internal::scalar_product_op<LhsScalar,RhsScalar> BinOp;
394
+ EIGEN_CHECK_BINARY_COMPATIBILIY(BinOp,LhsScalar,RhsScalar);
395
+ }
396
+
397
+ template<typename Dest> void scaleAndAddTo(Dest& dst, const Scalar& alpha) const
398
+ {
399
+ eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
400
+
401
+ typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
402
+ typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
403
+
404
+ Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
405
+ * RhsBlasTraits::extractScalarFactor(m_rhs);
406
+
407
+ typedef internal::gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,LhsScalar,RhsScalar,
408
+ Dest::MaxRowsAtCompileTime,Dest::MaxColsAtCompileTime,MaxDepthAtCompileTime> BlockingType;
409
+
410
+ typedef internal::gemm_functor<
411
+ Scalar, Index,
412
+ internal::general_matrix_matrix_product<
413
+ Index,
414
+ LhsScalar, (_ActualLhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(LhsBlasTraits::NeedToConjugate),
415
+ RhsScalar, (_ActualRhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(RhsBlasTraits::NeedToConjugate),
416
+ (Dest::Flags&RowMajorBit) ? RowMajor : ColMajor>,
417
+ _ActualLhsType, _ActualRhsType, Dest, BlockingType> GemmFunctor;
418
+
419
+ BlockingType blocking(dst.rows(), dst.cols(), lhs.cols());
420
+
421
+ internal::parallelize_gemm<(Dest::MaxRowsAtCompileTime>32 || Dest::MaxRowsAtCompileTime==Dynamic)>(GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), this->rows(), this->cols(), Dest::Flags&RowMajorBit);
422
+ }
423
+ };
424
+
425
+ } // end namespace Eigen
426
+
427
+ #endif // EIGEN_GENERAL_MATRIX_MATRIX_H
@@ -0,0 +1,278 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2009-2010 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_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
11
+ #define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
12
+
13
+ namespace Eigen {
14
+
15
+ template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
16
+ struct selfadjoint_rank1_update;
17
+
18
+ namespace internal {
19
+
20
+ /**********************************************************************
21
+ * This file implements a general A * B product while
22
+ * evaluating only one triangular part of the product.
23
+ * This is more general version of self adjoint product (C += A A^T)
24
+ * as the level 3 SYRK Blas routine.
25
+ **********************************************************************/
26
+
27
+ // forward declarations (defined at the end of this file)
28
+ template<typename LhsScalar, typename RhsScalar, typename Index, int mr, int nr, bool ConjLhs, bool ConjRhs, int UpLo>
29
+ struct tribb_kernel;
30
+
31
+ /* Optimized matrix-matrix product evaluating only one triangular half */
32
+ template <typename Index,
33
+ typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
34
+ typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs,
35
+ int ResStorageOrder, int UpLo, int Version = Specialized>
36
+ struct general_matrix_matrix_triangular_product;
37
+
38
+ // as usual if the result is row major => we transpose the product
39
+ template <typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
40
+ typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int UpLo, int Version>
41
+ struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,RowMajor,UpLo,Version>
42
+ {
43
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
44
+ static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* lhs, Index lhsStride,
45
+ const RhsScalar* rhs, Index rhsStride, ResScalar* res, Index resStride, const ResScalar& alpha)
46
+ {
47
+ general_matrix_matrix_triangular_product<Index,
48
+ RhsScalar, RhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateRhs,
49
+ LhsScalar, LhsStorageOrder==RowMajor ? ColMajor : RowMajor, ConjugateLhs,
50
+ ColMajor, UpLo==Lower?Upper:Lower>
51
+ ::run(size,depth,rhs,rhsStride,lhs,lhsStride,res,resStride,alpha);
52
+ }
53
+ };
54
+
55
+ template <typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
56
+ typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs, int UpLo, int Version>
57
+ struct general_matrix_matrix_triangular_product<Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,ColMajor,UpLo,Version>
58
+ {
59
+ typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType ResScalar;
60
+ static EIGEN_STRONG_INLINE void run(Index size, Index depth,const LhsScalar* _lhs, Index lhsStride,
61
+ const RhsScalar* _rhs, Index rhsStride, ResScalar* res, Index resStride, const ResScalar& alpha)
62
+ {
63
+ const_blas_data_mapper<LhsScalar, Index, LhsStorageOrder> lhs(_lhs,lhsStride);
64
+ const_blas_data_mapper<RhsScalar, Index, RhsStorageOrder> rhs(_rhs,rhsStride);
65
+
66
+ typedef gebp_traits<LhsScalar,RhsScalar> Traits;
67
+
68
+ Index kc = depth; // cache block size along the K direction
69
+ Index mc = size; // cache block size along the M direction
70
+ Index nc = size; // cache block size along the N direction
71
+ computeProductBlockingSizes<LhsScalar,RhsScalar>(kc, mc, nc);
72
+ // !!! mc must be a multiple of nr:
73
+ if(mc > Traits::nr)
74
+ mc = (mc/Traits::nr)*Traits::nr;
75
+
76
+ std::size_t sizeW = kc*Traits::WorkSpaceFactor;
77
+ std::size_t sizeB = sizeW + kc*size;
78
+ ei_declare_aligned_stack_constructed_variable(LhsScalar, blockA, kc*mc, 0);
79
+ ei_declare_aligned_stack_constructed_variable(RhsScalar, allocatedBlockB, sizeB, 0);
80
+ RhsScalar* blockB = allocatedBlockB + sizeW;
81
+
82
+ gemm_pack_lhs<LhsScalar, Index, Traits::mr, Traits::LhsProgress, LhsStorageOrder> pack_lhs;
83
+ gemm_pack_rhs<RhsScalar, Index, Traits::nr, RhsStorageOrder> pack_rhs;
84
+ gebp_kernel <LhsScalar, RhsScalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs> gebp;
85
+ tribb_kernel<LhsScalar, RhsScalar, Index, Traits::mr, Traits::nr, ConjugateLhs, ConjugateRhs, UpLo> sybb;
86
+
87
+ for(Index k2=0; k2<depth; k2+=kc)
88
+ {
89
+ const Index actual_kc = (std::min)(k2+kc,depth)-k2;
90
+
91
+ // note that the actual rhs is the transpose/adjoint of mat
92
+ pack_rhs(blockB, &rhs(k2,0), rhsStride, actual_kc, size);
93
+
94
+ for(Index i2=0; i2<size; i2+=mc)
95
+ {
96
+ const Index actual_mc = (std::min)(i2+mc,size)-i2;
97
+
98
+ pack_lhs(blockA, &lhs(i2, k2), lhsStride, actual_kc, actual_mc);
99
+
100
+ // the selected actual_mc * size panel of res is split into three different part:
101
+ // 1 - before the diagonal => processed with gebp or skipped
102
+ // 2 - the actual_mc x actual_mc symmetric block => processed with a special kernel
103
+ // 3 - after the diagonal => processed with gebp or skipped
104
+ if (UpLo==Lower)
105
+ gebp(res+i2, resStride, blockA, blockB, actual_mc, actual_kc, (std::min)(size,i2), alpha,
106
+ -1, -1, 0, 0, allocatedBlockB);
107
+
108
+ sybb(res+resStride*i2 + i2, resStride, blockA, blockB + actual_kc*i2, actual_mc, actual_kc, alpha, allocatedBlockB);
109
+
110
+ if (UpLo==Upper)
111
+ {
112
+ Index j2 = i2+actual_mc;
113
+ gebp(res+resStride*j2+i2, resStride, blockA, blockB+actual_kc*j2, actual_mc, actual_kc, (std::max)(Index(0), size-j2), alpha,
114
+ -1, -1, 0, 0, allocatedBlockB);
115
+ }
116
+ }
117
+ }
118
+ }
119
+ };
120
+
121
+ // Optimized packed Block * packed Block product kernel evaluating only one given triangular part
122
+ // This kernel is built on top of the gebp kernel:
123
+ // - the current destination block is processed per panel of actual_mc x BlockSize
124
+ // where BlockSize is set to the minimal value allowing gebp to be as fast as possible
125
+ // - then, as usual, each panel is split into three parts along the diagonal,
126
+ // the sub blocks above and below the diagonal are processed as usual,
127
+ // while the triangular block overlapping the diagonal is evaluated into a
128
+ // small temporary buffer which is then accumulated into the result using a
129
+ // triangular traversal.
130
+ template<typename LhsScalar, typename RhsScalar, typename Index, int mr, int nr, bool ConjLhs, bool ConjRhs, int UpLo>
131
+ struct tribb_kernel
132
+ {
133
+ typedef gebp_traits<LhsScalar,RhsScalar,ConjLhs,ConjRhs> Traits;
134
+ typedef typename Traits::ResScalar ResScalar;
135
+
136
+ enum {
137
+ BlockSize = EIGEN_PLAIN_ENUM_MAX(mr,nr)
138
+ };
139
+ void operator()(ResScalar* res, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index size, Index depth, const ResScalar& alpha, RhsScalar* workspace)
140
+ {
141
+ gebp_kernel<LhsScalar, RhsScalar, Index, mr, nr, ConjLhs, ConjRhs> gebp_kernel;
142
+ Matrix<ResScalar,BlockSize,BlockSize,ColMajor> buffer;
143
+
144
+ // let's process the block per panel of actual_mc x BlockSize,
145
+ // again, each is split into three parts, etc.
146
+ for (Index j=0; j<size; j+=BlockSize)
147
+ {
148
+ Index actualBlockSize = std::min<Index>(BlockSize,size - j);
149
+ const RhsScalar* actual_b = blockB+j*depth;
150
+
151
+ if(UpLo==Upper)
152
+ gebp_kernel(res+j*resStride, resStride, blockA, actual_b, j, depth, actualBlockSize, alpha,
153
+ -1, -1, 0, 0, workspace);
154
+
155
+ // selfadjoint micro block
156
+ {
157
+ Index i = j;
158
+ buffer.setZero();
159
+ // 1 - apply the kernel on the temporary buffer
160
+ gebp_kernel(buffer.data(), BlockSize, blockA+depth*i, actual_b, actualBlockSize, depth, actualBlockSize, alpha,
161
+ -1, -1, 0, 0, workspace);
162
+ // 2 - triangular accumulation
163
+ for(Index j1=0; j1<actualBlockSize; ++j1)
164
+ {
165
+ ResScalar* r = res + (j+j1)*resStride + i;
166
+ for(Index i1=UpLo==Lower ? j1 : 0;
167
+ UpLo==Lower ? i1<actualBlockSize : i1<=j1; ++i1)
168
+ r[i1] += buffer(i1,j1);
169
+ }
170
+ }
171
+
172
+ if(UpLo==Lower)
173
+ {
174
+ Index i = j+actualBlockSize;
175
+ gebp_kernel(res+j*resStride+i, resStride, blockA+depth*i, actual_b, size-i, depth, actualBlockSize, alpha,
176
+ -1, -1, 0, 0, workspace);
177
+ }
178
+ }
179
+ }
180
+ };
181
+
182
+ } // end namespace internal
183
+
184
+ // high level API
185
+
186
+ template<typename MatrixType, typename ProductType, int UpLo, bool IsOuterProduct>
187
+ struct general_product_to_triangular_selector;
188
+
189
+
190
+ template<typename MatrixType, typename ProductType, int UpLo>
191
+ struct general_product_to_triangular_selector<MatrixType,ProductType,UpLo,true>
192
+ {
193
+ static void run(MatrixType& mat, const ProductType& prod, const typename MatrixType::Scalar& alpha)
194
+ {
195
+ typedef typename MatrixType::Scalar Scalar;
196
+ typedef typename MatrixType::Index Index;
197
+
198
+ typedef typename internal::remove_all<typename ProductType::LhsNested>::type Lhs;
199
+ typedef internal::blas_traits<Lhs> LhsBlasTraits;
200
+ typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
201
+ typedef typename internal::remove_all<ActualLhs>::type _ActualLhs;
202
+ typename internal::add_const_on_value_type<ActualLhs>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
203
+
204
+ typedef typename internal::remove_all<typename ProductType::RhsNested>::type Rhs;
205
+ typedef internal::blas_traits<Rhs> RhsBlasTraits;
206
+ typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
207
+ typedef typename internal::remove_all<ActualRhs>::type _ActualRhs;
208
+ typename internal::add_const_on_value_type<ActualRhs>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
209
+
210
+ Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());
211
+
212
+ enum {
213
+ StorageOrder = (internal::traits<MatrixType>::Flags&RowMajorBit) ? RowMajor : ColMajor,
214
+ UseLhsDirectly = _ActualLhs::InnerStrideAtCompileTime==1,
215
+ UseRhsDirectly = _ActualRhs::InnerStrideAtCompileTime==1
216
+ };
217
+
218
+ internal::gemv_static_vector_if<Scalar,Lhs::SizeAtCompileTime,Lhs::MaxSizeAtCompileTime,!UseLhsDirectly> static_lhs;
219
+ ei_declare_aligned_stack_constructed_variable(Scalar, actualLhsPtr, actualLhs.size(),
220
+ (UseLhsDirectly ? const_cast<Scalar*>(actualLhs.data()) : static_lhs.data()));
221
+ if(!UseLhsDirectly) Map<typename _ActualLhs::PlainObject>(actualLhsPtr, actualLhs.size()) = actualLhs;
222
+
223
+ internal::gemv_static_vector_if<Scalar,Rhs::SizeAtCompileTime,Rhs::MaxSizeAtCompileTime,!UseRhsDirectly> static_rhs;
224
+ ei_declare_aligned_stack_constructed_variable(Scalar, actualRhsPtr, actualRhs.size(),
225
+ (UseRhsDirectly ? const_cast<Scalar*>(actualRhs.data()) : static_rhs.data()));
226
+ if(!UseRhsDirectly) Map<typename _ActualRhs::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
227
+
228
+
229
+ selfadjoint_rank1_update<Scalar,Index,StorageOrder,UpLo,
230
+ LhsBlasTraits::NeedToConjugate && NumTraits<Scalar>::IsComplex,
231
+ RhsBlasTraits::NeedToConjugate && NumTraits<Scalar>::IsComplex>
232
+ ::run(actualLhs.size(), mat.data(), mat.outerStride(), actualLhsPtr, actualRhsPtr, actualAlpha);
233
+ }
234
+ };
235
+
236
+ template<typename MatrixType, typename ProductType, int UpLo>
237
+ struct general_product_to_triangular_selector<MatrixType,ProductType,UpLo,false>
238
+ {
239
+ static void run(MatrixType& mat, const ProductType& prod, const typename MatrixType::Scalar& alpha)
240
+ {
241
+ typedef typename MatrixType::Index Index;
242
+
243
+ typedef typename internal::remove_all<typename ProductType::LhsNested>::type Lhs;
244
+ typedef internal::blas_traits<Lhs> LhsBlasTraits;
245
+ typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
246
+ typedef typename internal::remove_all<ActualLhs>::type _ActualLhs;
247
+ typename internal::add_const_on_value_type<ActualLhs>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
248
+
249
+ typedef typename internal::remove_all<typename ProductType::RhsNested>::type Rhs;
250
+ typedef internal::blas_traits<Rhs> RhsBlasTraits;
251
+ typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
252
+ typedef typename internal::remove_all<ActualRhs>::type _ActualRhs;
253
+ typename internal::add_const_on_value_type<ActualRhs>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
254
+
255
+ typename ProductType::Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());
256
+
257
+ internal::general_matrix_matrix_triangular_product<Index,
258
+ typename Lhs::Scalar, _ActualLhs::Flags&RowMajorBit ? RowMajor : ColMajor, LhsBlasTraits::NeedToConjugate,
259
+ typename Rhs::Scalar, _ActualRhs::Flags&RowMajorBit ? RowMajor : ColMajor, RhsBlasTraits::NeedToConjugate,
260
+ MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor, UpLo>
261
+ ::run(mat.cols(), actualLhs.cols(),
262
+ &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &actualRhs.coeffRef(0,0), actualRhs.outerStride(),
263
+ mat.data(), mat.outerStride(), actualAlpha);
264
+ }
265
+ };
266
+
267
+ template<typename MatrixType, unsigned int UpLo>
268
+ template<typename ProductDerived, typename _Lhs, typename _Rhs>
269
+ TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::assignProduct(const ProductBase<ProductDerived, _Lhs,_Rhs>& prod, const Scalar& alpha)
270
+ {
271
+ general_product_to_triangular_selector<MatrixType, ProductDerived, UpLo, (_Lhs::ColsAtCompileTime==1) || (_Rhs::RowsAtCompileTime==1)>::run(m_matrix.const_cast_derived(), prod.derived(), alpha);
272
+
273
+ return *this;
274
+ }
275
+
276
+ } // end namespace Eigen
277
+
278
+ #endif // EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H