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,290 @@
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_PRODUCTBASE_H
11
+ #define EIGEN_PRODUCTBASE_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \class ProductBase
16
+ * \ingroup Core_Module
17
+ *
18
+ */
19
+
20
+ namespace internal {
21
+ template<typename Derived, typename _Lhs, typename _Rhs>
22
+ struct traits<ProductBase<Derived,_Lhs,_Rhs> >
23
+ {
24
+ typedef MatrixXpr XprKind;
25
+ typedef typename remove_all<_Lhs>::type Lhs;
26
+ typedef typename remove_all<_Rhs>::type Rhs;
27
+ typedef typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType Scalar;
28
+ typedef typename promote_storage_type<typename traits<Lhs>::StorageKind,
29
+ typename traits<Rhs>::StorageKind>::ret StorageKind;
30
+ typedef typename promote_index_type<typename traits<Lhs>::Index,
31
+ typename traits<Rhs>::Index>::type Index;
32
+ enum {
33
+ RowsAtCompileTime = traits<Lhs>::RowsAtCompileTime,
34
+ ColsAtCompileTime = traits<Rhs>::ColsAtCompileTime,
35
+ MaxRowsAtCompileTime = traits<Lhs>::MaxRowsAtCompileTime,
36
+ MaxColsAtCompileTime = traits<Rhs>::MaxColsAtCompileTime,
37
+ Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0)
38
+ | EvalBeforeNestingBit | EvalBeforeAssigningBit | NestByRefBit,
39
+ // Note that EvalBeforeNestingBit and NestByRefBit
40
+ // are not used in practice because nested is overloaded for products
41
+ CoeffReadCost = 0 // FIXME why is it needed ?
42
+ };
43
+ };
44
+ }
45
+
46
+ #define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \
47
+ typedef ProductBase<Derived, Lhs, Rhs > Base; \
48
+ EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
49
+ typedef typename Base::LhsNested LhsNested; \
50
+ typedef typename Base::_LhsNested _LhsNested; \
51
+ typedef typename Base::LhsBlasTraits LhsBlasTraits; \
52
+ typedef typename Base::ActualLhsType ActualLhsType; \
53
+ typedef typename Base::_ActualLhsType _ActualLhsType; \
54
+ typedef typename Base::RhsNested RhsNested; \
55
+ typedef typename Base::_RhsNested _RhsNested; \
56
+ typedef typename Base::RhsBlasTraits RhsBlasTraits; \
57
+ typedef typename Base::ActualRhsType ActualRhsType; \
58
+ typedef typename Base::_ActualRhsType _ActualRhsType; \
59
+ using Base::m_lhs; \
60
+ using Base::m_rhs;
61
+
62
+ template<typename Derived, typename Lhs, typename Rhs>
63
+ class ProductBase : public MatrixBase<Derived>
64
+ {
65
+ public:
66
+ typedef MatrixBase<Derived> Base;
67
+ EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase)
68
+
69
+ typedef typename Lhs::Nested LhsNested;
70
+ typedef typename internal::remove_all<LhsNested>::type _LhsNested;
71
+ typedef internal::blas_traits<_LhsNested> LhsBlasTraits;
72
+ typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
73
+ typedef typename internal::remove_all<ActualLhsType>::type _ActualLhsType;
74
+ typedef typename internal::traits<Lhs>::Scalar LhsScalar;
75
+
76
+ typedef typename Rhs::Nested RhsNested;
77
+ typedef typename internal::remove_all<RhsNested>::type _RhsNested;
78
+ typedef internal::blas_traits<_RhsNested> RhsBlasTraits;
79
+ typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
80
+ typedef typename internal::remove_all<ActualRhsType>::type _ActualRhsType;
81
+ typedef typename internal::traits<Rhs>::Scalar RhsScalar;
82
+
83
+ // Diagonal of a product: no need to evaluate the arguments because they are going to be evaluated only once
84
+ typedef CoeffBasedProduct<LhsNested, RhsNested, 0> FullyLazyCoeffBaseProductType;
85
+
86
+ public:
87
+
88
+ #ifndef EIGEN_NO_MALLOC
89
+ typedef typename Base::PlainObject BasePlainObject;
90
+ typedef Matrix<Scalar,RowsAtCompileTime==1?1:Dynamic,ColsAtCompileTime==1?1:Dynamic,BasePlainObject::Options> DynPlainObject;
91
+ typedef typename internal::conditional<(BasePlainObject::SizeAtCompileTime==Dynamic) || (BasePlainObject::SizeAtCompileTime*int(sizeof(Scalar)) < int(EIGEN_STACK_ALLOCATION_LIMIT)),
92
+ BasePlainObject, DynPlainObject>::type PlainObject;
93
+ #else
94
+ typedef typename Base::PlainObject PlainObject;
95
+ #endif
96
+
97
+ ProductBase(const Lhs& a_lhs, const Rhs& a_rhs)
98
+ : m_lhs(a_lhs), m_rhs(a_rhs)
99
+ {
100
+ eigen_assert(a_lhs.cols() == a_rhs.rows()
101
+ && "invalid matrix product"
102
+ && "if you wanted a coeff-wise or a dot product use the respective explicit functions");
103
+ }
104
+
105
+ inline Index rows() const { return m_lhs.rows(); }
106
+ inline Index cols() const { return m_rhs.cols(); }
107
+
108
+ template<typename Dest>
109
+ inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); }
110
+
111
+ template<typename Dest>
112
+ inline void addTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(1)); }
113
+
114
+ template<typename Dest>
115
+ inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); }
116
+
117
+ template<typename Dest>
118
+ inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); }
119
+
120
+ const _LhsNested& lhs() const { return m_lhs; }
121
+ const _RhsNested& rhs() const { return m_rhs; }
122
+
123
+ // Implicit conversion to the nested type (trigger the evaluation of the product)
124
+ operator const PlainObject& () const
125
+ {
126
+ m_result.resize(m_lhs.rows(), m_rhs.cols());
127
+ derived().evalTo(m_result);
128
+ return m_result;
129
+ }
130
+
131
+ const Diagonal<const FullyLazyCoeffBaseProductType,0> diagonal() const
132
+ { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); }
133
+
134
+ template<int Index>
135
+ const Diagonal<FullyLazyCoeffBaseProductType,Index> diagonal() const
136
+ { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); }
137
+
138
+ const Diagonal<FullyLazyCoeffBaseProductType,Dynamic> diagonal(Index index) const
139
+ { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs).diagonal(index); }
140
+
141
+ // restrict coeff accessors to 1x1 expressions. No need to care about mutators here since this isnt a Lvalue expression
142
+ typename Base::CoeffReturnType coeff(Index row, Index col) const
143
+ {
144
+ #ifdef EIGEN2_SUPPORT
145
+ return lhs().row(row).cwiseProduct(rhs().col(col).transpose()).sum();
146
+ #else
147
+ EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
148
+ eigen_assert(this->rows() == 1 && this->cols() == 1);
149
+ Matrix<Scalar,1,1> result = *this;
150
+ return result.coeff(row,col);
151
+ #endif
152
+ }
153
+
154
+ typename Base::CoeffReturnType coeff(Index i) const
155
+ {
156
+ EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
157
+ eigen_assert(this->rows() == 1 && this->cols() == 1);
158
+ Matrix<Scalar,1,1> result = *this;
159
+ return result.coeff(i);
160
+ }
161
+
162
+ const Scalar& coeffRef(Index row, Index col) const
163
+ {
164
+ EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
165
+ eigen_assert(this->rows() == 1 && this->cols() == 1);
166
+ return derived().coeffRef(row,col);
167
+ }
168
+
169
+ const Scalar& coeffRef(Index i) const
170
+ {
171
+ EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
172
+ eigen_assert(this->rows() == 1 && this->cols() == 1);
173
+ return derived().coeffRef(i);
174
+ }
175
+
176
+ protected:
177
+
178
+ LhsNested m_lhs;
179
+ RhsNested m_rhs;
180
+
181
+ mutable PlainObject m_result;
182
+ };
183
+
184
+ // here we need to overload the nested rule for products
185
+ // such that the nested type is a const reference to a plain matrix
186
+ namespace internal {
187
+ template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
188
+ struct nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
189
+ {
190
+ typedef typename GeneralProduct<Lhs,Rhs,Mode>::PlainObject const& type;
191
+ };
192
+ template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
193
+ struct nested<const GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
194
+ {
195
+ typedef typename GeneralProduct<Lhs,Rhs,Mode>::PlainObject const& type;
196
+ };
197
+ }
198
+
199
+ template<typename NestedProduct>
200
+ class ScaledProduct;
201
+
202
+ // Note that these two operator* functions are not defined as member
203
+ // functions of ProductBase, because, otherwise we would have to
204
+ // define all overloads defined in MatrixBase. Furthermore, Using
205
+ // "using Base::operator*" would not work with MSVC.
206
+ //
207
+ // Also note that here we accept any compatible scalar types
208
+ template<typename Derived,typename Lhs,typename Rhs>
209
+ const ScaledProduct<Derived>
210
+ operator*(const ProductBase<Derived,Lhs,Rhs>& prod, const typename Derived::Scalar& x)
211
+ { return ScaledProduct<Derived>(prod.derived(), x); }
212
+
213
+ template<typename Derived,typename Lhs,typename Rhs>
214
+ typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value,
215
+ const ScaledProduct<Derived> >::type
216
+ operator*(const ProductBase<Derived,Lhs,Rhs>& prod, const typename Derived::RealScalar& x)
217
+ { return ScaledProduct<Derived>(prod.derived(), x); }
218
+
219
+
220
+ template<typename Derived,typename Lhs,typename Rhs>
221
+ const ScaledProduct<Derived>
222
+ operator*(const typename Derived::Scalar& x,const ProductBase<Derived,Lhs,Rhs>& prod)
223
+ { return ScaledProduct<Derived>(prod.derived(), x); }
224
+
225
+ template<typename Derived,typename Lhs,typename Rhs>
226
+ typename internal::enable_if<!internal::is_same<typename Derived::Scalar,typename Derived::RealScalar>::value,
227
+ const ScaledProduct<Derived> >::type
228
+ operator*(const typename Derived::RealScalar& x,const ProductBase<Derived,Lhs,Rhs>& prod)
229
+ { return ScaledProduct<Derived>(prod.derived(), x); }
230
+
231
+ namespace internal {
232
+ template<typename NestedProduct>
233
+ struct traits<ScaledProduct<NestedProduct> >
234
+ : traits<ProductBase<ScaledProduct<NestedProduct>,
235
+ typename NestedProduct::_LhsNested,
236
+ typename NestedProduct::_RhsNested> >
237
+ {
238
+ typedef typename traits<NestedProduct>::StorageKind StorageKind;
239
+ };
240
+ }
241
+
242
+ template<typename NestedProduct>
243
+ class ScaledProduct
244
+ : public ProductBase<ScaledProduct<NestedProduct>,
245
+ typename NestedProduct::_LhsNested,
246
+ typename NestedProduct::_RhsNested>
247
+ {
248
+ public:
249
+ typedef ProductBase<ScaledProduct<NestedProduct>,
250
+ typename NestedProduct::_LhsNested,
251
+ typename NestedProduct::_RhsNested> Base;
252
+ typedef typename Base::Scalar Scalar;
253
+ typedef typename Base::PlainObject PlainObject;
254
+ // EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct)
255
+
256
+ ScaledProduct(const NestedProduct& prod, const Scalar& x)
257
+ : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {}
258
+
259
+ template<typename Dest>
260
+ inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst, Scalar(1)); }
261
+
262
+ template<typename Dest>
263
+ inline void addTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(1)); }
264
+
265
+ template<typename Dest>
266
+ inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); }
267
+
268
+ template<typename Dest>
269
+ inline void scaleAndAddTo(Dest& dst, const Scalar& a_alpha) const { m_prod.derived().scaleAndAddTo(dst,a_alpha * m_alpha); }
270
+
271
+ const Scalar& alpha() const { return m_alpha; }
272
+
273
+ protected:
274
+ const NestedProduct& m_prod;
275
+ Scalar m_alpha;
276
+ };
277
+
278
+ /** \internal
279
+ * Overloaded to perform an efficient C = (A*B).lazy() */
280
+ template<typename Derived>
281
+ template<typename ProductDerived, typename Lhs, typename Rhs>
282
+ Derived& MatrixBase<Derived>::lazyAssign(const ProductBase<ProductDerived, Lhs,Rhs>& other)
283
+ {
284
+ other.derived().evalTo(derived());
285
+ return derived();
286
+ }
287
+
288
+ } // end namespace Eigen
289
+
290
+ #endif // EIGEN_PRODUCTBASE_H
@@ -0,0 +1,152 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
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_RANDOM_H
11
+ #define EIGEN_RANDOM_H
12
+
13
+ namespace Eigen {
14
+
15
+ namespace internal {
16
+
17
+ template<typename Scalar> struct scalar_random_op {
18
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op)
19
+ template<typename Index>
20
+ inline const Scalar operator() (Index, Index = 0) const { return random<Scalar>(); }
21
+ };
22
+
23
+ template<typename Scalar>
24
+ struct functor_traits<scalar_random_op<Scalar> >
25
+ { enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false, IsRepeatable = false }; };
26
+
27
+ } // end namespace internal
28
+
29
+ /** \returns a random matrix expression
30
+ *
31
+ * The parameters \a rows and \a cols are the number of rows and of columns of
32
+ * the returned matrix. Must be compatible with this MatrixBase type.
33
+ *
34
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
35
+ * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used
36
+ * instead.
37
+ *
38
+ * Example: \include MatrixBase_random_int_int.cpp
39
+ * Output: \verbinclude MatrixBase_random_int_int.out
40
+ *
41
+ * This expression has the "evaluate before nesting" flag so that it will be evaluated into
42
+ * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected
43
+ * behavior with expressions involving random matrices.
44
+ *
45
+ * \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random()
46
+ */
47
+ template<typename Derived>
48
+ inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
49
+ DenseBase<Derived>::Random(Index rows, Index cols)
50
+ {
51
+ return NullaryExpr(rows, cols, internal::scalar_random_op<Scalar>());
52
+ }
53
+
54
+ /** \returns a random vector expression
55
+ *
56
+ * The parameter \a size is the size of the returned vector.
57
+ * Must be compatible with this MatrixBase type.
58
+ *
59
+ * \only_for_vectors
60
+ *
61
+ * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
62
+ * it is redundant to pass \a size as argument, so Random() should be used
63
+ * instead.
64
+ *
65
+ * Example: \include MatrixBase_random_int.cpp
66
+ * Output: \verbinclude MatrixBase_random_int.out
67
+ *
68
+ * This expression has the "evaluate before nesting" flag so that it will be evaluated into
69
+ * a temporary vector whenever it is nested in a larger expression. This prevents unexpected
70
+ * behavior with expressions involving random matrices.
71
+ *
72
+ * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random()
73
+ */
74
+ template<typename Derived>
75
+ inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
76
+ DenseBase<Derived>::Random(Index size)
77
+ {
78
+ return NullaryExpr(size, internal::scalar_random_op<Scalar>());
79
+ }
80
+
81
+ /** \returns a fixed-size random matrix or vector expression
82
+ *
83
+ * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
84
+ * need to use the variants taking size arguments.
85
+ *
86
+ * Example: \include MatrixBase_random.cpp
87
+ * Output: \verbinclude MatrixBase_random.out
88
+ *
89
+ * This expression has the "evaluate before nesting" flag so that it will be evaluated into
90
+ * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected
91
+ * behavior with expressions involving random matrices.
92
+ *
93
+ * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index)
94
+ */
95
+ template<typename Derived>
96
+ inline const CwiseNullaryOp<internal::scalar_random_op<typename internal::traits<Derived>::Scalar>, Derived>
97
+ DenseBase<Derived>::Random()
98
+ {
99
+ return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op<Scalar>());
100
+ }
101
+
102
+ /** Sets all coefficients in this expression to random values.
103
+ *
104
+ * Example: \include MatrixBase_setRandom.cpp
105
+ * Output: \verbinclude MatrixBase_setRandom.out
106
+ *
107
+ * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index)
108
+ */
109
+ template<typename Derived>
110
+ inline Derived& DenseBase<Derived>::setRandom()
111
+ {
112
+ return *this = Random(rows(), cols());
113
+ }
114
+
115
+ /** Resizes to the given \a newSize, and sets all coefficients in this expression to random values.
116
+ *
117
+ * \only_for_vectors
118
+ *
119
+ * Example: \include Matrix_setRandom_int.cpp
120
+ * Output: \verbinclude Matrix_setRandom_int.out
121
+ *
122
+ * \sa MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random()
123
+ */
124
+ template<typename Derived>
125
+ EIGEN_STRONG_INLINE Derived&
126
+ PlainObjectBase<Derived>::setRandom(Index newSize)
127
+ {
128
+ resize(newSize);
129
+ return setRandom();
130
+ }
131
+
132
+ /** Resizes to the given size, and sets all coefficients in this expression to random values.
133
+ *
134
+ * \param nbRows the new number of rows
135
+ * \param nbCols the new number of columns
136
+ *
137
+ * Example: \include Matrix_setRandom_int_int.cpp
138
+ * Output: \verbinclude Matrix_setRandom_int_int.out
139
+ *
140
+ * \sa MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random()
141
+ */
142
+ template<typename Derived>
143
+ EIGEN_STRONG_INLINE Derived&
144
+ PlainObjectBase<Derived>::setRandom(Index nbRows, Index nbCols)
145
+ {
146
+ resize(nbRows, nbCols);
147
+ return setRandom();
148
+ }
149
+
150
+ } // end namespace Eigen
151
+
152
+ #endif // EIGEN_RANDOM_H
@@ -0,0 +1,409 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
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_REDUX_H
12
+ #define EIGEN_REDUX_H
13
+
14
+ namespace Eigen {
15
+
16
+ namespace internal {
17
+
18
+ // TODO
19
+ // * implement other kind of vectorization
20
+ // * factorize code
21
+
22
+ /***************************************************************************
23
+ * Part 1 : the logic deciding a strategy for vectorization and unrolling
24
+ ***************************************************************************/
25
+
26
+ template<typename Func, typename Derived>
27
+ struct redux_traits
28
+ {
29
+ public:
30
+ enum {
31
+ PacketSize = packet_traits<typename Derived::Scalar>::size,
32
+ InnerMaxSize = int(Derived::IsRowMajor)
33
+ ? Derived::MaxColsAtCompileTime
34
+ : Derived::MaxRowsAtCompileTime
35
+ };
36
+
37
+ enum {
38
+ MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit)
39
+ && (functor_traits<Func>::PacketAccess),
40
+ MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit),
41
+ MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize
42
+ };
43
+
44
+ public:
45
+ enum {
46
+ Traversal = int(MayLinearVectorize) ? int(LinearVectorizedTraversal)
47
+ : int(MaySliceVectorize) ? int(SliceVectorizedTraversal)
48
+ : int(DefaultTraversal)
49
+ };
50
+
51
+ public:
52
+ enum {
53
+ Cost = ( Derived::SizeAtCompileTime == Dynamic
54
+ || Derived::CoeffReadCost == Dynamic
55
+ || (Derived::SizeAtCompileTime!=1 && functor_traits<Func>::Cost == Dynamic)
56
+ ) ? Dynamic
57
+ : Derived::SizeAtCompileTime * Derived::CoeffReadCost
58
+ + (Derived::SizeAtCompileTime-1) * functor_traits<Func>::Cost,
59
+ UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize))
60
+ };
61
+
62
+ public:
63
+ enum {
64
+ Unrolling = Cost != Dynamic && Cost <= UnrollingLimit
65
+ ? CompleteUnrolling
66
+ : NoUnrolling
67
+ };
68
+ };
69
+
70
+ /***************************************************************************
71
+ * Part 2 : unrollers
72
+ ***************************************************************************/
73
+
74
+ /*** no vectorization ***/
75
+
76
+ template<typename Func, typename Derived, int Start, int Length>
77
+ struct redux_novec_unroller
78
+ {
79
+ enum {
80
+ HalfLength = Length/2
81
+ };
82
+
83
+ typedef typename Derived::Scalar Scalar;
84
+
85
+ static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func)
86
+ {
87
+ return func(redux_novec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
88
+ redux_novec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func));
89
+ }
90
+ };
91
+
92
+ template<typename Func, typename Derived, int Start>
93
+ struct redux_novec_unroller<Func, Derived, Start, 1>
94
+ {
95
+ enum {
96
+ outer = Start / Derived::InnerSizeAtCompileTime,
97
+ inner = Start % Derived::InnerSizeAtCompileTime
98
+ };
99
+
100
+ typedef typename Derived::Scalar Scalar;
101
+
102
+ static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func&)
103
+ {
104
+ return mat.coeffByOuterInner(outer, inner);
105
+ }
106
+ };
107
+
108
+ // This is actually dead code and will never be called. It is required
109
+ // to prevent false warnings regarding failed inlining though
110
+ // for 0 length run() will never be called at all.
111
+ template<typename Func, typename Derived, int Start>
112
+ struct redux_novec_unroller<Func, Derived, Start, 0>
113
+ {
114
+ typedef typename Derived::Scalar Scalar;
115
+ static EIGEN_STRONG_INLINE Scalar run(const Derived&, const Func&) { return Scalar(); }
116
+ };
117
+
118
+ /*** vectorization ***/
119
+
120
+ template<typename Func, typename Derived, int Start, int Length>
121
+ struct redux_vec_unroller
122
+ {
123
+ enum {
124
+ PacketSize = packet_traits<typename Derived::Scalar>::size,
125
+ HalfLength = Length/2
126
+ };
127
+
128
+ typedef typename Derived::Scalar Scalar;
129
+ typedef typename packet_traits<Scalar>::type PacketScalar;
130
+
131
+ static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func& func)
132
+ {
133
+ return func.packetOp(
134
+ redux_vec_unroller<Func, Derived, Start, HalfLength>::run(mat,func),
135
+ redux_vec_unroller<Func, Derived, Start+HalfLength, Length-HalfLength>::run(mat,func) );
136
+ }
137
+ };
138
+
139
+ template<typename Func, typename Derived, int Start>
140
+ struct redux_vec_unroller<Func, Derived, Start, 1>
141
+ {
142
+ enum {
143
+ index = Start * packet_traits<typename Derived::Scalar>::size,
144
+ outer = index / int(Derived::InnerSizeAtCompileTime),
145
+ inner = index % int(Derived::InnerSizeAtCompileTime),
146
+ alignment = (Derived::Flags & AlignedBit) ? Aligned : Unaligned
147
+ };
148
+
149
+ typedef typename Derived::Scalar Scalar;
150
+ typedef typename packet_traits<Scalar>::type PacketScalar;
151
+
152
+ static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func&)
153
+ {
154
+ return mat.template packetByOuterInner<alignment>(outer, inner);
155
+ }
156
+ };
157
+
158
+ /***************************************************************************
159
+ * Part 3 : implementation of all cases
160
+ ***************************************************************************/
161
+
162
+ template<typename Func, typename Derived,
163
+ int Traversal = redux_traits<Func, Derived>::Traversal,
164
+ int Unrolling = redux_traits<Func, Derived>::Unrolling
165
+ >
166
+ struct redux_impl;
167
+
168
+ template<typename Func, typename Derived>
169
+ struct redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>
170
+ {
171
+ typedef typename Derived::Scalar Scalar;
172
+ typedef typename Derived::Index Index;
173
+ static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func)
174
+ {
175
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
176
+ Scalar res;
177
+ res = mat.coeffByOuterInner(0, 0);
178
+ for(Index i = 1; i < mat.innerSize(); ++i)
179
+ res = func(res, mat.coeffByOuterInner(0, i));
180
+ for(Index i = 1; i < mat.outerSize(); ++i)
181
+ for(Index j = 0; j < mat.innerSize(); ++j)
182
+ res = func(res, mat.coeffByOuterInner(i, j));
183
+ return res;
184
+ }
185
+ };
186
+
187
+ template<typename Func, typename Derived>
188
+ struct redux_impl<Func,Derived, DefaultTraversal, CompleteUnrolling>
189
+ : public redux_novec_unroller<Func,Derived, 0, Derived::SizeAtCompileTime>
190
+ {};
191
+
192
+ template<typename Func, typename Derived>
193
+ struct redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
194
+ {
195
+ typedef typename Derived::Scalar Scalar;
196
+ typedef typename packet_traits<Scalar>::type PacketScalar;
197
+ typedef typename Derived::Index Index;
198
+
199
+ static Scalar run(const Derived& mat, const Func& func)
200
+ {
201
+ const Index size = mat.size();
202
+ eigen_assert(size && "you are using an empty matrix");
203
+ const Index packetSize = packet_traits<Scalar>::size;
204
+ const Index alignedStart = internal::first_aligned(mat);
205
+ enum {
206
+ alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit)
207
+ ? Aligned : Unaligned
208
+ };
209
+ const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize);
210
+ const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize);
211
+ const Index alignedEnd2 = alignedStart + alignedSize2;
212
+ const Index alignedEnd = alignedStart + alignedSize;
213
+ Scalar res;
214
+ if(alignedSize)
215
+ {
216
+ PacketScalar packet_res0 = mat.template packet<alignment>(alignedStart);
217
+ if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop
218
+ {
219
+ PacketScalar packet_res1 = mat.template packet<alignment>(alignedStart+packetSize);
220
+ for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize)
221
+ {
222
+ packet_res0 = func.packetOp(packet_res0, mat.template packet<alignment>(index));
223
+ packet_res1 = func.packetOp(packet_res1, mat.template packet<alignment>(index+packetSize));
224
+ }
225
+
226
+ packet_res0 = func.packetOp(packet_res0,packet_res1);
227
+ if(alignedEnd>alignedEnd2)
228
+ packet_res0 = func.packetOp(packet_res0, mat.template packet<alignment>(alignedEnd2));
229
+ }
230
+ res = func.predux(packet_res0);
231
+
232
+ for(Index index = 0; index < alignedStart; ++index)
233
+ res = func(res,mat.coeff(index));
234
+
235
+ for(Index index = alignedEnd; index < size; ++index)
236
+ res = func(res,mat.coeff(index));
237
+ }
238
+ else // too small to vectorize anything.
239
+ // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
240
+ {
241
+ res = mat.coeff(0);
242
+ for(Index index = 1; index < size; ++index)
243
+ res = func(res,mat.coeff(index));
244
+ }
245
+
246
+ return res;
247
+ }
248
+ };
249
+
250
+ // NOTE: for SliceVectorizedTraversal we simply bypass unrolling
251
+ template<typename Func, typename Derived, int Unrolling>
252
+ struct redux_impl<Func, Derived, SliceVectorizedTraversal, Unrolling>
253
+ {
254
+ typedef typename Derived::Scalar Scalar;
255
+ typedef typename packet_traits<Scalar>::type PacketScalar;
256
+ typedef typename Derived::Index Index;
257
+
258
+ static Scalar run(const Derived& mat, const Func& func)
259
+ {
260
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
261
+ const Index innerSize = mat.innerSize();
262
+ const Index outerSize = mat.outerSize();
263
+ enum {
264
+ packetSize = packet_traits<Scalar>::size
265
+ };
266
+ const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize;
267
+ Scalar res;
268
+ if(packetedInnerSize)
269
+ {
270
+ PacketScalar packet_res = mat.template packet<Unaligned>(0,0);
271
+ for(Index j=0; j<outerSize; ++j)
272
+ for(Index i=(j==0?packetSize:0); i<packetedInnerSize; i+=Index(packetSize))
273
+ packet_res = func.packetOp(packet_res, mat.template packetByOuterInner<Unaligned>(j,i));
274
+
275
+ res = func.predux(packet_res);
276
+ for(Index j=0; j<outerSize; ++j)
277
+ for(Index i=packetedInnerSize; i<innerSize; ++i)
278
+ res = func(res, mat.coeffByOuterInner(j,i));
279
+ }
280
+ else // too small to vectorize anything.
281
+ // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize.
282
+ {
283
+ res = redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>::run(mat, func);
284
+ }
285
+
286
+ return res;
287
+ }
288
+ };
289
+
290
+ template<typename Func, typename Derived>
291
+ struct redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling>
292
+ {
293
+ typedef typename Derived::Scalar Scalar;
294
+ typedef typename packet_traits<Scalar>::type PacketScalar;
295
+ enum {
296
+ PacketSize = packet_traits<Scalar>::size,
297
+ Size = Derived::SizeAtCompileTime,
298
+ VectorizedSize = (Size / PacketSize) * PacketSize
299
+ };
300
+ static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func)
301
+ {
302
+ eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix");
303
+ Scalar res = func.predux(redux_vec_unroller<Func, Derived, 0, Size / PacketSize>::run(mat,func));
304
+ if (VectorizedSize != Size)
305
+ res = func(res,redux_novec_unroller<Func, Derived, VectorizedSize, Size-VectorizedSize>::run(mat,func));
306
+ return res;
307
+ }
308
+ };
309
+
310
+ } // end namespace internal
311
+
312
+ /***************************************************************************
313
+ * Part 4 : public API
314
+ ***************************************************************************/
315
+
316
+
317
+ /** \returns the result of a full redux operation on the whole matrix or vector using \a func
318
+ *
319
+ * The template parameter \a BinaryOp is the type of the functor \a func which must be
320
+ * an associative operator. Both current STL and TR1 functor styles are handled.
321
+ *
322
+ * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise()
323
+ */
324
+ template<typename Derived>
325
+ template<typename Func>
326
+ EIGEN_STRONG_INLINE typename internal::result_of<Func(typename internal::traits<Derived>::Scalar)>::type
327
+ DenseBase<Derived>::redux(const Func& func) const
328
+ {
329
+ typedef typename internal::remove_all<typename Derived::Nested>::type ThisNested;
330
+ return internal::redux_impl<Func, ThisNested>
331
+ ::run(derived(), func);
332
+ }
333
+
334
+ /** \returns the minimum of all coefficients of \c *this.
335
+ * \warning the result is undefined if \c *this contains NaN.
336
+ */
337
+ template<typename Derived>
338
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
339
+ DenseBase<Derived>::minCoeff() const
340
+ {
341
+ return this->redux(Eigen::internal::scalar_min_op<Scalar>());
342
+ }
343
+
344
+ /** \returns the maximum of all coefficients of \c *this.
345
+ * \warning the result is undefined if \c *this contains NaN.
346
+ */
347
+ template<typename Derived>
348
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
349
+ DenseBase<Derived>::maxCoeff() const
350
+ {
351
+ return this->redux(Eigen::internal::scalar_max_op<Scalar>());
352
+ }
353
+
354
+ /** \returns the sum of all coefficients of *this
355
+ *
356
+ * \sa trace(), prod(), mean()
357
+ */
358
+ template<typename Derived>
359
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
360
+ DenseBase<Derived>::sum() const
361
+ {
362
+ if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
363
+ return Scalar(0);
364
+ return this->redux(Eigen::internal::scalar_sum_op<Scalar>());
365
+ }
366
+
367
+ /** \returns the mean of all coefficients of *this
368
+ *
369
+ * \sa trace(), prod(), sum()
370
+ */
371
+ template<typename Derived>
372
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
373
+ DenseBase<Derived>::mean() const
374
+ {
375
+ return Scalar(this->redux(Eigen::internal::scalar_sum_op<Scalar>())) / Scalar(this->size());
376
+ }
377
+
378
+ /** \returns the product of all coefficients of *this
379
+ *
380
+ * Example: \include MatrixBase_prod.cpp
381
+ * Output: \verbinclude MatrixBase_prod.out
382
+ *
383
+ * \sa sum(), mean(), trace()
384
+ */
385
+ template<typename Derived>
386
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
387
+ DenseBase<Derived>::prod() const
388
+ {
389
+ if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
390
+ return Scalar(1);
391
+ return this->redux(Eigen::internal::scalar_product_op<Scalar>());
392
+ }
393
+
394
+ /** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal.
395
+ *
396
+ * \c *this can be any matrix, not necessarily square.
397
+ *
398
+ * \sa diagonal(), sum()
399
+ */
400
+ template<typename Derived>
401
+ EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
402
+ MatrixBase<Derived>::trace() const
403
+ {
404
+ return derived().diagonal().sum();
405
+ }
406
+
407
+ } // end namespace Eigen
408
+
409
+ #endif // EIGEN_REDUX_H