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,150 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
5
+ // Copyright (C) 2008 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_FUZZY_H
12
+ #define EIGEN_FUZZY_H
13
+
14
+ namespace Eigen {
15
+
16
+ namespace internal
17
+ {
18
+
19
+ template<typename Derived, typename OtherDerived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger>
20
+ struct isApprox_selector
21
+ {
22
+ static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec)
23
+ {
24
+ using std::min;
25
+ typename internal::nested<Derived,2>::type nested(x);
26
+ typename internal::nested<OtherDerived,2>::type otherNested(y);
27
+ return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
28
+ }
29
+ };
30
+
31
+ template<typename Derived, typename OtherDerived>
32
+ struct isApprox_selector<Derived, OtherDerived, true>
33
+ {
34
+ static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&)
35
+ {
36
+ return x.matrix() == y.matrix();
37
+ }
38
+ };
39
+
40
+ template<typename Derived, typename OtherDerived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger>
41
+ struct isMuchSmallerThan_object_selector
42
+ {
43
+ static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec)
44
+ {
45
+ return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum();
46
+ }
47
+ };
48
+
49
+ template<typename Derived, typename OtherDerived>
50
+ struct isMuchSmallerThan_object_selector<Derived, OtherDerived, true>
51
+ {
52
+ static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&)
53
+ {
54
+ return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix();
55
+ }
56
+ };
57
+
58
+ template<typename Derived, bool is_integer = NumTraits<typename Derived::Scalar>::IsInteger>
59
+ struct isMuchSmallerThan_scalar_selector
60
+ {
61
+ static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec)
62
+ {
63
+ return x.cwiseAbs2().sum() <= numext::abs2(prec * y);
64
+ }
65
+ };
66
+
67
+ template<typename Derived>
68
+ struct isMuchSmallerThan_scalar_selector<Derived, true>
69
+ {
70
+ static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&)
71
+ {
72
+ return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix();
73
+ }
74
+ };
75
+
76
+ } // end namespace internal
77
+
78
+
79
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
80
+ * determined by \a prec.
81
+ *
82
+ * \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$
83
+ * are considered to be approximately equal within precision \f$ p \f$ if
84
+ * \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f]
85
+ * For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm
86
+ * L2 norm).
87
+ *
88
+ * \note Because of the multiplicativeness of this comparison, one can't use this function
89
+ * to check whether \c *this is approximately equal to the zero matrix or vector.
90
+ * Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix
91
+ * or vector. If you want to test whether \c *this is zero, use internal::isMuchSmallerThan(const
92
+ * RealScalar&, RealScalar) instead.
93
+ *
94
+ * \sa internal::isMuchSmallerThan(const RealScalar&, RealScalar) const
95
+ */
96
+ template<typename Derived>
97
+ template<typename OtherDerived>
98
+ bool DenseBase<Derived>::isApprox(
99
+ const DenseBase<OtherDerived>& other,
100
+ const RealScalar& prec
101
+ ) const
102
+ {
103
+ return internal::isApprox_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec);
104
+ }
105
+
106
+ /** \returns \c true if the norm of \c *this is much smaller than \a other,
107
+ * within the precision determined by \a prec.
108
+ *
109
+ * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
110
+ * considered to be much smaller than \f$ x \f$ within precision \f$ p \f$ if
111
+ * \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f]
112
+ *
113
+ * For matrices, the comparison is done using the Hilbert-Schmidt norm. For this reason,
114
+ * the value of the reference scalar \a other should come from the Hilbert-Schmidt norm
115
+ * of a reference matrix of same dimensions.
116
+ *
117
+ * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
118
+ */
119
+ template<typename Derived>
120
+ bool DenseBase<Derived>::isMuchSmallerThan(
121
+ const typename NumTraits<Scalar>::Real& other,
122
+ const RealScalar& prec
123
+ ) const
124
+ {
125
+ return internal::isMuchSmallerThan_scalar_selector<Derived>::run(derived(), other, prec);
126
+ }
127
+
128
+ /** \returns \c true if the norm of \c *this is much smaller than the norm of \a other,
129
+ * within the precision determined by \a prec.
130
+ *
131
+ * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
132
+ * considered to be much smaller than a vector \f$ w \f$ within precision \f$ p \f$ if
133
+ * \f[ \Vert v \Vert \leqslant p\,\Vert w\Vert. \f]
134
+ * For matrices, the comparison is done using the Hilbert-Schmidt norm.
135
+ *
136
+ * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const
137
+ */
138
+ template<typename Derived>
139
+ template<typename OtherDerived>
140
+ bool DenseBase<Derived>::isMuchSmallerThan(
141
+ const DenseBase<OtherDerived>& other,
142
+ const RealScalar& prec
143
+ ) const
144
+ {
145
+ return internal::isMuchSmallerThan_object_selector<Derived, OtherDerived>::run(derived(), other.derived(), prec);
146
+ }
147
+
148
+ } // end namespace Eigen
149
+
150
+ #endif // EIGEN_FUZZY_H
@@ -0,0 +1,635 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
5
+ // Copyright (C) 2008-2011 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_GENERAL_PRODUCT_H
12
+ #define EIGEN_GENERAL_PRODUCT_H
13
+
14
+ namespace Eigen {
15
+
16
+ /** \class GeneralProduct
17
+ * \ingroup Core_Module
18
+ *
19
+ * \brief Expression of the product of two general matrices or vectors
20
+ *
21
+ * \param LhsNested the type used to store the left-hand side
22
+ * \param RhsNested the type used to store the right-hand side
23
+ * \param ProductMode the type of the product
24
+ *
25
+ * This class represents an expression of the product of two general matrices.
26
+ * We call a general matrix, a dense matrix with full storage. For instance,
27
+ * This excludes triangular, selfadjoint, and sparse matrices.
28
+ * It is the return type of the operator* between general matrices. Its template
29
+ * arguments are determined automatically by ProductReturnType. Therefore,
30
+ * GeneralProduct should never be used direclty. To determine the result type of a
31
+ * function which involves a matrix product, use ProductReturnType::Type.
32
+ *
33
+ * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
34
+ */
35
+ template<typename Lhs, typename Rhs, int ProductType = internal::product_type<Lhs,Rhs>::value>
36
+ class GeneralProduct;
37
+
38
+ enum {
39
+ Large = 2,
40
+ Small = 3
41
+ };
42
+
43
+ namespace internal {
44
+
45
+ template<int Rows, int Cols, int Depth> struct product_type_selector;
46
+
47
+ template<int Size, int MaxSize> struct product_size_category
48
+ {
49
+ enum { is_large = MaxSize == Dynamic ||
50
+ Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD,
51
+ value = is_large ? Large
52
+ : Size == 1 ? 1
53
+ : Small
54
+ };
55
+ };
56
+
57
+ template<typename Lhs, typename Rhs> struct product_type
58
+ {
59
+ typedef typename remove_all<Lhs>::type _Lhs;
60
+ typedef typename remove_all<Rhs>::type _Rhs;
61
+ enum {
62
+ MaxRows = _Lhs::MaxRowsAtCompileTime,
63
+ Rows = _Lhs::RowsAtCompileTime,
64
+ MaxCols = _Rhs::MaxColsAtCompileTime,
65
+ Cols = _Rhs::ColsAtCompileTime,
66
+ MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime,
67
+ _Rhs::MaxRowsAtCompileTime),
68
+ Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime,
69
+ _Rhs::RowsAtCompileTime),
70
+ LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
71
+ };
72
+
73
+ // the splitting into different lines of code here, introducing the _select enums and the typedef below,
74
+ // is to work around an internal compiler error with gcc 4.1 and 4.2.
75
+ private:
76
+ enum {
77
+ rows_select = product_size_category<Rows,MaxRows>::value,
78
+ cols_select = product_size_category<Cols,MaxCols>::value,
79
+ depth_select = product_size_category<Depth,MaxDepth>::value
80
+ };
81
+ typedef product_type_selector<rows_select, cols_select, depth_select> selector;
82
+
83
+ public:
84
+ enum {
85
+ value = selector::ret
86
+ };
87
+ #ifdef EIGEN_DEBUG_PRODUCT
88
+ static void debug()
89
+ {
90
+ EIGEN_DEBUG_VAR(Rows);
91
+ EIGEN_DEBUG_VAR(Cols);
92
+ EIGEN_DEBUG_VAR(Depth);
93
+ EIGEN_DEBUG_VAR(rows_select);
94
+ EIGEN_DEBUG_VAR(cols_select);
95
+ EIGEN_DEBUG_VAR(depth_select);
96
+ EIGEN_DEBUG_VAR(value);
97
+ }
98
+ #endif
99
+ };
100
+
101
+
102
+ /* The following allows to select the kind of product at compile time
103
+ * based on the three dimensions of the product.
104
+ * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
105
+ // FIXME I'm not sure the current mapping is the ideal one.
106
+ template<int M, int N> struct product_type_selector<M,N,1> { enum { ret = OuterProduct }; };
107
+ template<int Depth> struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; };
108
+ template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; };
109
+ template<> struct product_type_selector<Small,1, Small> { enum { ret = CoeffBasedProductMode }; };
110
+ template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; };
111
+ template<> struct product_type_selector<Small,Small,Small> { enum { ret = CoeffBasedProductMode }; };
112
+ template<> struct product_type_selector<Small, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
113
+ template<> struct product_type_selector<Small, Large, 1> { enum { ret = LazyCoeffBasedProductMode }; };
114
+ template<> struct product_type_selector<Large, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
115
+ template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; };
116
+ template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; };
117
+ template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; };
118
+ template<> struct product_type_selector<Large,1, Small> { enum { ret = CoeffBasedProductMode }; };
119
+ template<> struct product_type_selector<Large,1, Large> { enum { ret = GemvProduct }; };
120
+ template<> struct product_type_selector<Small,1, Large> { enum { ret = CoeffBasedProductMode }; };
121
+ template<> struct product_type_selector<Small,Small,Large> { enum { ret = GemmProduct }; };
122
+ template<> struct product_type_selector<Large,Small,Large> { enum { ret = GemmProduct }; };
123
+ template<> struct product_type_selector<Small,Large,Large> { enum { ret = GemmProduct }; };
124
+ template<> struct product_type_selector<Large,Large,Large> { enum { ret = GemmProduct }; };
125
+ template<> struct product_type_selector<Large,Small,Small> { enum { ret = GemmProduct }; };
126
+ template<> struct product_type_selector<Small,Large,Small> { enum { ret = GemmProduct }; };
127
+ template<> struct product_type_selector<Large,Large,Small> { enum { ret = GemmProduct }; };
128
+
129
+ } // end namespace internal
130
+
131
+ /** \class ProductReturnType
132
+ * \ingroup Core_Module
133
+ *
134
+ * \brief Helper class to get the correct and optimized returned type of operator*
135
+ *
136
+ * \param Lhs the type of the left-hand side
137
+ * \param Rhs the type of the right-hand side
138
+ * \param ProductMode the type of the product (determined automatically by internal::product_mode)
139
+ *
140
+ * This class defines the typename Type representing the optimized product expression
141
+ * between two matrix expressions. In practice, using ProductReturnType<Lhs,Rhs>::Type
142
+ * is the recommended way to define the result type of a function returning an expression
143
+ * which involve a matrix product. The class Product should never be
144
+ * used directly.
145
+ *
146
+ * \sa class Product, MatrixBase::operator*(const MatrixBase<OtherDerived>&)
147
+ */
148
+ template<typename Lhs, typename Rhs, int ProductType>
149
+ struct ProductReturnType
150
+ {
151
+ // TODO use the nested type to reduce instanciations ????
152
+ // typedef typename internal::nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
153
+ // typedef typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
154
+
155
+ typedef GeneralProduct<Lhs/*Nested*/, Rhs/*Nested*/, ProductType> Type;
156
+ };
157
+
158
+ template<typename Lhs, typename Rhs>
159
+ struct ProductReturnType<Lhs,Rhs,CoeffBasedProductMode>
160
+ {
161
+ typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
162
+ typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
163
+ typedef CoeffBasedProduct<LhsNested, RhsNested, EvalBeforeAssigningBit | EvalBeforeNestingBit> Type;
164
+ };
165
+
166
+ template<typename Lhs, typename Rhs>
167
+ struct ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
168
+ {
169
+ typedef typename internal::nested<Lhs, Rhs::ColsAtCompileTime, typename internal::plain_matrix_type<Lhs>::type >::type LhsNested;
170
+ typedef typename internal::nested<Rhs, Lhs::RowsAtCompileTime, typename internal::plain_matrix_type<Rhs>::type >::type RhsNested;
171
+ typedef CoeffBasedProduct<LhsNested, RhsNested, NestByRefBit> Type;
172
+ };
173
+
174
+ // this is a workaround for sun CC
175
+ template<typename Lhs, typename Rhs>
176
+ struct LazyProductReturnType : public ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
177
+ {};
178
+
179
+ /***********************************************************************
180
+ * Implementation of Inner Vector Vector Product
181
+ ***********************************************************************/
182
+
183
+ // FIXME : maybe the "inner product" could return a Scalar
184
+ // instead of a 1x1 matrix ??
185
+ // Pro: more natural for the user
186
+ // Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix
187
+ // product ends up to a row-vector times col-vector product... To tackle this use
188
+ // case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
189
+
190
+ namespace internal {
191
+
192
+ template<typename Lhs, typename Rhs>
193
+ struct traits<GeneralProduct<Lhs,Rhs,InnerProduct> >
194
+ : traits<Matrix<typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> >
195
+ {};
196
+
197
+ }
198
+
199
+ template<typename Lhs, typename Rhs>
200
+ class GeneralProduct<Lhs, Rhs, InnerProduct>
201
+ : internal::no_assignment_operator,
202
+ public Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1>
203
+ {
204
+ typedef Matrix<typename internal::scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base;
205
+ public:
206
+ GeneralProduct(const Lhs& lhs, const Rhs& rhs)
207
+ {
208
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
209
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
210
+
211
+ Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
212
+ }
213
+
214
+ /** Convertion to scalar */
215
+ operator const typename Base::Scalar() const {
216
+ return Base::coeff(0,0);
217
+ }
218
+ };
219
+
220
+ /***********************************************************************
221
+ * Implementation of Outer Vector Vector Product
222
+ ***********************************************************************/
223
+
224
+ namespace internal {
225
+
226
+ // Column major
227
+ template<typename ProductType, typename Dest, typename Func>
228
+ EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const false_type&)
229
+ {
230
+ typedef typename Dest::Index Index;
231
+ // FIXME make sure lhs is sequentially stored
232
+ // FIXME not very good if rhs is real and lhs complex while alpha is real too
233
+ const Index cols = dest.cols();
234
+ for (Index j=0; j<cols; ++j)
235
+ func(dest.col(j), prod.rhs().coeff(0,j) * prod.lhs());
236
+ }
237
+
238
+ // Row major
239
+ template<typename ProductType, typename Dest, typename Func>
240
+ EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const true_type&) {
241
+ typedef typename Dest::Index Index;
242
+ // FIXME make sure rhs is sequentially stored
243
+ // FIXME not very good if lhs is real and rhs complex while alpha is real too
244
+ const Index rows = dest.rows();
245
+ for (Index i=0; i<rows; ++i)
246
+ func(dest.row(i), prod.lhs().coeff(i,0) * prod.rhs());
247
+ }
248
+
249
+ template<typename Lhs, typename Rhs>
250
+ struct traits<GeneralProduct<Lhs,Rhs,OuterProduct> >
251
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs> >
252
+ {};
253
+
254
+ }
255
+
256
+ template<typename Lhs, typename Rhs>
257
+ class GeneralProduct<Lhs, Rhs, OuterProduct>
258
+ : public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
259
+ {
260
+ template<typename T> struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {};
261
+
262
+ public:
263
+ EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
264
+
265
+ GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
266
+ {
267
+ EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
268
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
269
+ }
270
+
271
+ struct set { template<typename Dst, typename Src> void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } };
272
+ struct add { template<typename Dst, typename Src> void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } };
273
+ struct sub { template<typename Dst, typename Src> void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } };
274
+ struct adds {
275
+ Scalar m_scale;
276
+ adds(const Scalar& s) : m_scale(s) {}
277
+ template<typename Dst, typename Src> void operator()(const Dst& dst, const Src& src) const {
278
+ dst.const_cast_derived() += m_scale * src;
279
+ }
280
+ };
281
+
282
+ template<typename Dest>
283
+ inline void evalTo(Dest& dest) const {
284
+ internal::outer_product_selector_run(*this, dest, set(), is_row_major<Dest>());
285
+ }
286
+
287
+ template<typename Dest>
288
+ inline void addTo(Dest& dest) const {
289
+ internal::outer_product_selector_run(*this, dest, add(), is_row_major<Dest>());
290
+ }
291
+
292
+ template<typename Dest>
293
+ inline void subTo(Dest& dest) const {
294
+ internal::outer_product_selector_run(*this, dest, sub(), is_row_major<Dest>());
295
+ }
296
+
297
+ template<typename Dest> void scaleAndAddTo(Dest& dest, const Scalar& alpha) const
298
+ {
299
+ internal::outer_product_selector_run(*this, dest, adds(alpha), is_row_major<Dest>());
300
+ }
301
+ };
302
+
303
+ /***********************************************************************
304
+ * Implementation of General Matrix Vector Product
305
+ ***********************************************************************/
306
+
307
+ /* According to the shape/flags of the matrix we have to distinghish 3 different cases:
308
+ * 1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine
309
+ * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine
310
+ * 3 - all other cases are handled using a simple loop along the outer-storage direction.
311
+ * Therefore we need a lower level meta selector.
312
+ * Furthermore, if the matrix is the rhs, then the product has to be transposed.
313
+ */
314
+ namespace internal {
315
+
316
+ template<typename Lhs, typename Rhs>
317
+ struct traits<GeneralProduct<Lhs,Rhs,GemvProduct> >
318
+ : traits<ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs> >
319
+ {};
320
+
321
+ template<int Side, int StorageOrder, bool BlasCompatible>
322
+ struct gemv_selector;
323
+
324
+ } // end namespace internal
325
+
326
+ template<typename Lhs, typename Rhs>
327
+ class GeneralProduct<Lhs, Rhs, GemvProduct>
328
+ : public ProductBase<GeneralProduct<Lhs,Rhs,GemvProduct>, Lhs, Rhs>
329
+ {
330
+ public:
331
+ EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
332
+
333
+ typedef typename Lhs::Scalar LhsScalar;
334
+ typedef typename Rhs::Scalar RhsScalar;
335
+
336
+ GeneralProduct(const Lhs& a_lhs, const Rhs& a_rhs) : Base(a_lhs,a_rhs)
337
+ {
338
+ // EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value),
339
+ // YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
340
+ }
341
+
342
+ enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
343
+ typedef typename internal::conditional<int(Side)==OnTheRight,_LhsNested,_RhsNested>::type MatrixType;
344
+
345
+ template<typename Dest> void scaleAndAddTo(Dest& dst, const Scalar& alpha) const
346
+ {
347
+ eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols());
348
+ internal::gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
349
+ bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha);
350
+ }
351
+ };
352
+
353
+ namespace internal {
354
+
355
+ // The vector is on the left => transposition
356
+ template<int StorageOrder, bool BlasCompatible>
357
+ struct gemv_selector<OnTheLeft,StorageOrder,BlasCompatible>
358
+ {
359
+ template<typename ProductType, typename Dest>
360
+ static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha)
361
+ {
362
+ Transpose<Dest> destT(dest);
363
+ enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor };
364
+ gemv_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
365
+ ::run(GeneralProduct<Transpose<const typename ProductType::_RhsNested>,Transpose<const typename ProductType::_LhsNested>, GemvProduct>
366
+ (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha);
367
+ }
368
+ };
369
+
370
+ template<typename Scalar,int Size,int MaxSize,bool Cond> struct gemv_static_vector_if;
371
+
372
+ template<typename Scalar,int Size,int MaxSize>
373
+ struct gemv_static_vector_if<Scalar,Size,MaxSize,false>
374
+ {
375
+ EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; }
376
+ };
377
+
378
+ template<typename Scalar,int Size>
379
+ struct gemv_static_vector_if<Scalar,Size,Dynamic,true>
380
+ {
381
+ EIGEN_STRONG_INLINE Scalar* data() { return 0; }
382
+ };
383
+
384
+ template<typename Scalar,int Size,int MaxSize>
385
+ struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
386
+ {
387
+ #if EIGEN_ALIGN_STATICALLY
388
+ internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;
389
+ EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
390
+ #else
391
+ // Some architectures cannot align on the stack,
392
+ // => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
393
+ enum {
394
+ ForceAlignment = internal::packet_traits<Scalar>::Vectorizable,
395
+ PacketSize = internal::packet_traits<Scalar>::size
396
+ };
397
+ internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;
398
+ EIGEN_STRONG_INLINE Scalar* data() {
399
+ return ForceAlignment
400
+ ? reinterpret_cast<Scalar*>((reinterpret_cast<size_t>(m_data.array) & ~(size_t(15))) + 16)
401
+ : m_data.array;
402
+ }
403
+ #endif
404
+ };
405
+
406
+ template<> struct gemv_selector<OnTheRight,ColMajor,true>
407
+ {
408
+ template<typename ProductType, typename Dest>
409
+ static inline void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha)
410
+ {
411
+ typedef typename ProductType::Index Index;
412
+ typedef typename ProductType::LhsScalar LhsScalar;
413
+ typedef typename ProductType::RhsScalar RhsScalar;
414
+ typedef typename ProductType::Scalar ResScalar;
415
+ typedef typename ProductType::RealScalar RealScalar;
416
+ typedef typename ProductType::ActualLhsType ActualLhsType;
417
+ typedef typename ProductType::ActualRhsType ActualRhsType;
418
+ typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
419
+ typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
420
+ typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
421
+
422
+ ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs());
423
+ ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs());
424
+
425
+ ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
426
+ * RhsBlasTraits::extractScalarFactor(prod.rhs());
427
+
428
+ enum {
429
+ // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
430
+ // on, the other hand it is good for the cache to pack the vector anyways...
431
+ EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
432
+ ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
433
+ MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal
434
+ };
435
+
436
+ gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
437
+
438
+ bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0));
439
+ bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
440
+
441
+ RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
442
+
443
+ ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
444
+ evalToDest ? dest.data() : static_dest.data());
445
+
446
+ if(!evalToDest)
447
+ {
448
+ #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
449
+ int size = dest.size();
450
+ EIGEN_DENSE_STORAGE_CTOR_PLUGIN
451
+ #endif
452
+ if(!alphaIsCompatible)
453
+ {
454
+ MappedDest(actualDestPtr, dest.size()).setZero();
455
+ compatibleAlpha = RhsScalar(1);
456
+ }
457
+ else
458
+ MappedDest(actualDestPtr, dest.size()) = dest;
459
+ }
460
+
461
+ general_matrix_vector_product
462
+ <Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
463
+ actualLhs.rows(), actualLhs.cols(),
464
+ actualLhs.data(), actualLhs.outerStride(),
465
+ actualRhs.data(), actualRhs.innerStride(),
466
+ actualDestPtr, 1,
467
+ compatibleAlpha);
468
+
469
+ if (!evalToDest)
470
+ {
471
+ if(!alphaIsCompatible)
472
+ dest += actualAlpha * MappedDest(actualDestPtr, dest.size());
473
+ else
474
+ dest = MappedDest(actualDestPtr, dest.size());
475
+ }
476
+ }
477
+ };
478
+
479
+ template<> struct gemv_selector<OnTheRight,RowMajor,true>
480
+ {
481
+ template<typename ProductType, typename Dest>
482
+ static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha)
483
+ {
484
+ typedef typename ProductType::LhsScalar LhsScalar;
485
+ typedef typename ProductType::RhsScalar RhsScalar;
486
+ typedef typename ProductType::Scalar ResScalar;
487
+ typedef typename ProductType::Index Index;
488
+ typedef typename ProductType::ActualLhsType ActualLhsType;
489
+ typedef typename ProductType::ActualRhsType ActualRhsType;
490
+ typedef typename ProductType::_ActualRhsType _ActualRhsType;
491
+ typedef typename ProductType::LhsBlasTraits LhsBlasTraits;
492
+ typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
493
+
494
+ typename add_const<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
495
+ typename add_const<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
496
+
497
+ ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
498
+ * RhsBlasTraits::extractScalarFactor(prod.rhs());
499
+
500
+ enum {
501
+ // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
502
+ // on, the other hand it is good for the cache to pack the vector anyways...
503
+ DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1
504
+ };
505
+
506
+ gemv_static_vector_if<RhsScalar,_ActualRhsType::SizeAtCompileTime,_ActualRhsType::MaxSizeAtCompileTime,!DirectlyUseRhs> static_rhs;
507
+
508
+ ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(),
509
+ DirectlyUseRhs ? const_cast<RhsScalar*>(actualRhs.data()) : static_rhs.data());
510
+
511
+ if(!DirectlyUseRhs)
512
+ {
513
+ #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
514
+ int size = actualRhs.size();
515
+ EIGEN_DENSE_STORAGE_CTOR_PLUGIN
516
+ #endif
517
+ Map<typename _ActualRhsType::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
518
+ }
519
+
520
+ general_matrix_vector_product
521
+ <Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
522
+ actualLhs.rows(), actualLhs.cols(),
523
+ actualLhs.data(), actualLhs.outerStride(),
524
+ actualRhsPtr, 1,
525
+ dest.data(), dest.innerStride(),
526
+ actualAlpha);
527
+ }
528
+ };
529
+
530
+ template<> struct gemv_selector<OnTheRight,ColMajor,false>
531
+ {
532
+ template<typename ProductType, typename Dest>
533
+ static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha)
534
+ {
535
+ typedef typename Dest::Index Index;
536
+ // TODO makes sure dest is sequentially stored in memory, otherwise use a temp
537
+ const Index size = prod.rhs().rows();
538
+ for(Index k=0; k<size; ++k)
539
+ dest += (alpha*prod.rhs().coeff(k)) * prod.lhs().col(k);
540
+ }
541
+ };
542
+
543
+ template<> struct gemv_selector<OnTheRight,RowMajor,false>
544
+ {
545
+ template<typename ProductType, typename Dest>
546
+ static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha)
547
+ {
548
+ typedef typename Dest::Index Index;
549
+ // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp
550
+ const Index rows = prod.rows();
551
+ for(Index i=0; i<rows; ++i)
552
+ dest.coeffRef(i) += alpha * (prod.lhs().row(i).cwiseProduct(prod.rhs().transpose())).sum();
553
+ }
554
+ };
555
+
556
+ } // end namespace internal
557
+
558
+ /***************************************************************************
559
+ * Implementation of matrix base methods
560
+ ***************************************************************************/
561
+
562
+ /** \returns the matrix product of \c *this and \a other.
563
+ *
564
+ * \note If instead of the matrix product you want the coefficient-wise product, see Cwise::operator*().
565
+ *
566
+ * \sa lazyProduct(), operator*=(const MatrixBase&), Cwise::operator*()
567
+ */
568
+ template<typename Derived>
569
+ template<typename OtherDerived>
570
+ inline const typename ProductReturnType<Derived, OtherDerived>::Type
571
+ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
572
+ {
573
+ // A note regarding the function declaration: In MSVC, this function will sometimes
574
+ // not be inlined since DenseStorage is an unwindable object for dynamic
575
+ // matrices and product types are holding a member to store the result.
576
+ // Thus it does not help tagging this function with EIGEN_STRONG_INLINE.
577
+ enum {
578
+ ProductIsValid = Derived::ColsAtCompileTime==Dynamic
579
+ || OtherDerived::RowsAtCompileTime==Dynamic
580
+ || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
581
+ AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
582
+ SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
583
+ };
584
+ // note to the lost user:
585
+ // * for a dot product use: v1.dot(v2)
586
+ // * for a coeff-wise product use: v1.cwiseProduct(v2)
587
+ EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
588
+ INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
589
+ EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
590
+ INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
591
+ EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
592
+ #ifdef EIGEN_DEBUG_PRODUCT
593
+ internal::product_type<Derived,OtherDerived>::debug();
594
+ #endif
595
+ return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
596
+ }
597
+
598
+ /** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation.
599
+ *
600
+ * The returned product will behave like any other expressions: the coefficients of the product will be
601
+ * computed once at a time as requested. This might be useful in some extremely rare cases when only
602
+ * a small and no coherent fraction of the result's coefficients have to be computed.
603
+ *
604
+ * \warning This version of the matrix product can be much much slower. So use it only if you know
605
+ * what you are doing and that you measured a true speed improvement.
606
+ *
607
+ * \sa operator*(const MatrixBase&)
608
+ */
609
+ template<typename Derived>
610
+ template<typename OtherDerived>
611
+ const typename LazyProductReturnType<Derived,OtherDerived>::Type
612
+ MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
613
+ {
614
+ enum {
615
+ ProductIsValid = Derived::ColsAtCompileTime==Dynamic
616
+ || OtherDerived::RowsAtCompileTime==Dynamic
617
+ || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
618
+ AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
619
+ SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
620
+ };
621
+ // note to the lost user:
622
+ // * for a dot product use: v1.dot(v2)
623
+ // * for a coeff-wise product use: v1.cwiseProduct(v2)
624
+ EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
625
+ INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
626
+ EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
627
+ INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
628
+ EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
629
+
630
+ return typename LazyProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
631
+ }
632
+
633
+ } // end namespace Eigen
634
+
635
+ #endif // EIGEN_PRODUCT_H