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,181 @@
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_MAPPED_SPARSEMATRIX_H
11
+ #define EIGEN_MAPPED_SPARSEMATRIX_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \class MappedSparseMatrix
16
+ *
17
+ * \brief Sparse matrix
18
+ *
19
+ * \param _Scalar the scalar type, i.e. the type of the coefficients
20
+ *
21
+ * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
22
+ *
23
+ */
24
+ namespace internal {
25
+ template<typename _Scalar, int _Flags, typename _Index>
26
+ struct traits<MappedSparseMatrix<_Scalar, _Flags, _Index> > : traits<SparseMatrix<_Scalar, _Flags, _Index> >
27
+ {};
28
+ }
29
+
30
+ template<typename _Scalar, int _Flags, typename _Index>
31
+ class MappedSparseMatrix
32
+ : public SparseMatrixBase<MappedSparseMatrix<_Scalar, _Flags, _Index> >
33
+ {
34
+ public:
35
+ EIGEN_SPARSE_PUBLIC_INTERFACE(MappedSparseMatrix)
36
+ enum { IsRowMajor = Base::IsRowMajor };
37
+
38
+ protected:
39
+
40
+ Index m_outerSize;
41
+ Index m_innerSize;
42
+ Index m_nnz;
43
+ Index* m_outerIndex;
44
+ Index* m_innerIndices;
45
+ Scalar* m_values;
46
+
47
+ public:
48
+
49
+ inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
50
+ inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
51
+ inline Index innerSize() const { return m_innerSize; }
52
+ inline Index outerSize() const { return m_outerSize; }
53
+
54
+ bool isCompressed() const { return true; }
55
+
56
+ //----------------------------------------
57
+ // direct access interface
58
+ inline const Scalar* valuePtr() const { return m_values; }
59
+ inline Scalar* valuePtr() { return m_values; }
60
+
61
+ inline const Index* innerIndexPtr() const { return m_innerIndices; }
62
+ inline Index* innerIndexPtr() { return m_innerIndices; }
63
+
64
+ inline const Index* outerIndexPtr() const { return m_outerIndex; }
65
+ inline Index* outerIndexPtr() { return m_outerIndex; }
66
+ //----------------------------------------
67
+
68
+ inline Scalar coeff(Index row, Index col) const
69
+ {
70
+ const Index outer = IsRowMajor ? row : col;
71
+ const Index inner = IsRowMajor ? col : row;
72
+
73
+ Index start = m_outerIndex[outer];
74
+ Index end = m_outerIndex[outer+1];
75
+ if (start==end)
76
+ return Scalar(0);
77
+ else if (end>0 && inner==m_innerIndices[end-1])
78
+ return m_values[end-1];
79
+ // ^^ optimization: let's first check if it is the last coefficient
80
+ // (very common in high level algorithms)
81
+
82
+ const Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner);
83
+ const Index id = r-&m_innerIndices[0];
84
+ return ((*r==inner) && (id<end)) ? m_values[id] : Scalar(0);
85
+ }
86
+
87
+ inline Scalar& coeffRef(Index row, Index col)
88
+ {
89
+ const Index outer = IsRowMajor ? row : col;
90
+ const Index inner = IsRowMajor ? col : row;
91
+
92
+ Index start = m_outerIndex[outer];
93
+ Index end = m_outerIndex[outer+1];
94
+ eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
95
+ eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
96
+ Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end],inner);
97
+ const Index id = r-&m_innerIndices[0];
98
+ eigen_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
99
+ return m_values[id];
100
+ }
101
+
102
+ class InnerIterator;
103
+ class ReverseInnerIterator;
104
+
105
+ /** \returns the number of non zero coefficients */
106
+ inline Index nonZeros() const { return m_nnz; }
107
+
108
+ inline MappedSparseMatrix(Index rows, Index cols, Index nnz, Index* outerIndexPtr, Index* innerIndexPtr, Scalar* valuePtr)
109
+ : m_outerSize(IsRowMajor?rows:cols), m_innerSize(IsRowMajor?cols:rows), m_nnz(nnz), m_outerIndex(outerIndexPtr),
110
+ m_innerIndices(innerIndexPtr), m_values(valuePtr)
111
+ {}
112
+
113
+ /** Empty destructor */
114
+ inline ~MappedSparseMatrix() {}
115
+ };
116
+
117
+ template<typename Scalar, int _Flags, typename _Index>
118
+ class MappedSparseMatrix<Scalar,_Flags,_Index>::InnerIterator
119
+ {
120
+ public:
121
+ InnerIterator(const MappedSparseMatrix& mat, Index outer)
122
+ : m_matrix(mat),
123
+ m_outer(outer),
124
+ m_id(mat.outerIndexPtr()[outer]),
125
+ m_start(m_id),
126
+ m_end(mat.outerIndexPtr()[outer+1])
127
+ {}
128
+
129
+ inline InnerIterator& operator++() { m_id++; return *this; }
130
+
131
+ inline Scalar value() const { return m_matrix.valuePtr()[m_id]; }
132
+ inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix.valuePtr()[m_id]); }
133
+
134
+ inline Index index() const { return m_matrix.innerIndexPtr()[m_id]; }
135
+ inline Index row() const { return IsRowMajor ? m_outer : index(); }
136
+ inline Index col() const { return IsRowMajor ? index() : m_outer; }
137
+
138
+ inline operator bool() const { return (m_id < m_end) && (m_id>=m_start); }
139
+
140
+ protected:
141
+ const MappedSparseMatrix& m_matrix;
142
+ const Index m_outer;
143
+ Index m_id;
144
+ const Index m_start;
145
+ const Index m_end;
146
+ };
147
+
148
+ template<typename Scalar, int _Flags, typename _Index>
149
+ class MappedSparseMatrix<Scalar,_Flags,_Index>::ReverseInnerIterator
150
+ {
151
+ public:
152
+ ReverseInnerIterator(const MappedSparseMatrix& mat, Index outer)
153
+ : m_matrix(mat),
154
+ m_outer(outer),
155
+ m_id(mat.outerIndexPtr()[outer+1]),
156
+ m_start(mat.outerIndexPtr()[outer]),
157
+ m_end(m_id)
158
+ {}
159
+
160
+ inline ReverseInnerIterator& operator--() { m_id--; return *this; }
161
+
162
+ inline Scalar value() const { return m_matrix.valuePtr()[m_id-1]; }
163
+ inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix.valuePtr()[m_id-1]); }
164
+
165
+ inline Index index() const { return m_matrix.innerIndexPtr()[m_id-1]; }
166
+ inline Index row() const { return IsRowMajor ? m_outer : index(); }
167
+ inline Index col() const { return IsRowMajor ? index() : m_outer; }
168
+
169
+ inline operator bool() const { return (m_id <= m_end) && (m_id>m_start); }
170
+
171
+ protected:
172
+ const MappedSparseMatrix& m_matrix;
173
+ const Index m_outer;
174
+ Index m_id;
175
+ const Index m_start;
176
+ const Index m_end;
177
+ };
178
+
179
+ } // end namespace Eigen
180
+
181
+ #endif // EIGEN_MAPPED_SPARSEMATRIX_H
@@ -0,0 +1,537 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
6
+ // This Source Code Form is subject to the terms of the Mozilla
7
+ // Public License v. 2.0. If a copy of the MPL was not distributed
8
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+
10
+ #ifndef EIGEN_SPARSE_BLOCK_H
11
+ #define EIGEN_SPARSE_BLOCK_H
12
+
13
+ namespace Eigen {
14
+
15
+ template<typename XprType, int BlockRows, int BlockCols>
16
+ class BlockImpl<XprType,BlockRows,BlockCols,true,Sparse>
17
+ : public SparseMatrixBase<Block<XprType,BlockRows,BlockCols,true> >
18
+ {
19
+ typedef typename internal::remove_all<typename XprType::Nested>::type _MatrixTypeNested;
20
+ typedef Block<XprType, BlockRows, BlockCols, true> BlockType;
21
+ public:
22
+ enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
23
+ protected:
24
+ enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
25
+ public:
26
+ EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
27
+
28
+ class InnerIterator: public XprType::InnerIterator
29
+ {
30
+ typedef typename BlockImpl::Index Index;
31
+ public:
32
+ inline InnerIterator(const BlockType& xpr, Index outer)
33
+ : XprType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
34
+ {}
35
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
36
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
37
+ protected:
38
+ Index m_outer;
39
+ };
40
+ class ReverseInnerIterator: public XprType::ReverseInnerIterator
41
+ {
42
+ typedef typename BlockImpl::Index Index;
43
+ public:
44
+ inline ReverseInnerIterator(const BlockType& xpr, Index outer)
45
+ : XprType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
46
+ {}
47
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
48
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
49
+ protected:
50
+ Index m_outer;
51
+ };
52
+
53
+ inline BlockImpl(const XprType& xpr, int i)
54
+ : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
55
+ {}
56
+
57
+ inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
58
+ : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
59
+ {}
60
+
61
+ inline const Scalar coeff(int row, int col) const
62
+ {
63
+ return m_matrix.coeff(row + IsRowMajor ? m_outerStart : 0, col +IsRowMajor ? 0 : m_outerStart);
64
+ }
65
+
66
+ inline const Scalar coeff(int index) const
67
+ {
68
+ return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
69
+ }
70
+
71
+ EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
72
+ EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
73
+
74
+ protected:
75
+
76
+ typename XprType::Nested m_matrix;
77
+ Index m_outerStart;
78
+ const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
79
+
80
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
81
+ private:
82
+ Index nonZeros() const;
83
+ };
84
+
85
+
86
+ /***************************************************************************
87
+ * specialisation for SparseMatrix
88
+ ***************************************************************************/
89
+
90
+ template<typename _Scalar, int _Options, typename _Index, int BlockRows, int BlockCols>
91
+ class BlockImpl<SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true,Sparse>
92
+ : public SparseMatrixBase<Block<SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true> >
93
+ {
94
+ typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
95
+ typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
96
+ typedef Block<SparseMatrixType, BlockRows, BlockCols, true> BlockType;
97
+ typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> ConstBlockType;
98
+ public:
99
+ enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
100
+ EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
101
+ protected:
102
+ enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
103
+ public:
104
+
105
+ class InnerIterator: public SparseMatrixType::InnerIterator
106
+ {
107
+ public:
108
+ inline InnerIterator(const BlockType& xpr, Index outer)
109
+ : SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
110
+ {}
111
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
112
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
113
+ protected:
114
+ Index m_outer;
115
+ };
116
+ class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator
117
+ {
118
+ public:
119
+ inline ReverseInnerIterator(const BlockType& xpr, Index outer)
120
+ : SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
121
+ {}
122
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
123
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
124
+ protected:
125
+ Index m_outer;
126
+ };
127
+
128
+ inline BlockImpl(const SparseMatrixType& xpr, int i)
129
+ : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
130
+ {}
131
+
132
+ inline BlockImpl(const SparseMatrixType& xpr, int startRow, int startCol, int blockRows, int blockCols)
133
+ : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
134
+ {}
135
+
136
+ template<typename OtherDerived>
137
+ inline BlockType& operator=(const SparseMatrixBase<OtherDerived>& other)
138
+ {
139
+ typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _NestedMatrixType;
140
+ _NestedMatrixType& matrix = const_cast<_NestedMatrixType&>(m_matrix);;
141
+ // This assignement is slow if this vector set is not empty
142
+ // and/or it is not at the end of the nonzeros of the underlying matrix.
143
+
144
+ // 1 - eval to a temporary to avoid transposition and/or aliasing issues
145
+ SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, Index> tmp(other);
146
+
147
+ // 2 - let's check whether there is enough allocated memory
148
+ Index nnz = tmp.nonZeros();
149
+ Index start = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
150
+ Index end = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending posiiton of the current block
151
+ Index block_size = end - start; // available room in the current block
152
+ Index tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
153
+
154
+ Index free_size = m_matrix.isCompressed()
155
+ ? Index(matrix.data().allocatedSize()) + block_size
156
+ : block_size;
157
+
158
+ if(nnz>free_size)
159
+ {
160
+ // realloc manually to reduce copies
161
+ typename SparseMatrixType::Storage newdata(m_matrix.data().allocatedSize() - block_size + nnz);
162
+
163
+ std::memcpy(&newdata.value(0), &m_matrix.data().value(0), start*sizeof(Scalar));
164
+ std::memcpy(&newdata.index(0), &m_matrix.data().index(0), start*sizeof(Index));
165
+
166
+ std::memcpy(&newdata.value(start), &tmp.data().value(0), nnz*sizeof(Scalar));
167
+ std::memcpy(&newdata.index(start), &tmp.data().index(0), nnz*sizeof(Index));
168
+
169
+ std::memcpy(&newdata.value(start+nnz), &matrix.data().value(end), tail_size*sizeof(Scalar));
170
+ std::memcpy(&newdata.index(start+nnz), &matrix.data().index(end), tail_size*sizeof(Index));
171
+
172
+ newdata.resize(m_matrix.outerIndexPtr()[m_matrix.outerSize()] - block_size + nnz);
173
+
174
+ matrix.data().swap(newdata);
175
+ }
176
+ else
177
+ {
178
+ // no need to realloc, simply copy the tail at its respective position and insert tmp
179
+ matrix.data().resize(start + nnz + tail_size);
180
+
181
+ std::memmove(&matrix.data().value(start+nnz), &matrix.data().value(end), tail_size*sizeof(Scalar));
182
+ std::memmove(&matrix.data().index(start+nnz), &matrix.data().index(end), tail_size*sizeof(Index));
183
+
184
+ std::memcpy(&matrix.data().value(start), &tmp.data().value(0), nnz*sizeof(Scalar));
185
+ std::memcpy(&matrix.data().index(start), &tmp.data().index(0), nnz*sizeof(Index));
186
+ }
187
+
188
+ // update innerNonZeros
189
+ if(!m_matrix.isCompressed())
190
+ for(Index j=0; j<m_outerSize.value(); ++j)
191
+ matrix.innerNonZeroPtr()[m_outerStart+j] = tmp.innerVector(j).nonZeros();
192
+
193
+ // update outer index pointers
194
+ Index p = start;
195
+ for(Index k=0; k<m_outerSize.value(); ++k)
196
+ {
197
+ matrix.outerIndexPtr()[m_outerStart+k] = p;
198
+ p += tmp.innerVector(k).nonZeros();
199
+ }
200
+ std::ptrdiff_t offset = nnz - block_size;
201
+ for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
202
+ {
203
+ matrix.outerIndexPtr()[k] += offset;
204
+ }
205
+
206
+ return derived();
207
+ }
208
+
209
+ inline BlockType& operator=(const BlockType& other)
210
+ {
211
+ return operator=<BlockType>(other);
212
+ }
213
+
214
+ inline const Scalar* valuePtr() const
215
+ { return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
216
+ inline Scalar* valuePtr()
217
+ { return m_matrix.const_cast_derived().valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
218
+
219
+ inline const Index* innerIndexPtr() const
220
+ { return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
221
+ inline Index* innerIndexPtr()
222
+ { return m_matrix.const_cast_derived().innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
223
+
224
+ inline const Index* outerIndexPtr() const
225
+ { return m_matrix.outerIndexPtr() + m_outerStart; }
226
+ inline Index* outerIndexPtr()
227
+ { return m_matrix.const_cast_derived().outerIndexPtr() + m_outerStart; }
228
+
229
+ Index nonZeros() const
230
+ {
231
+ if(m_matrix.isCompressed())
232
+ return std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
233
+ - std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
234
+ else if(m_outerSize.value()==0)
235
+ return 0;
236
+ else
237
+ return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
238
+ }
239
+
240
+ inline Scalar& coeffRef(int row, int col)
241
+ {
242
+ return m_matrix.const_cast_derived().coeffRef(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
243
+ }
244
+
245
+ inline const Scalar coeff(int row, int col) const
246
+ {
247
+ return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
248
+ }
249
+
250
+ inline const Scalar coeff(int index) const
251
+ {
252
+ return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
253
+ }
254
+
255
+ const Scalar& lastCoeff() const
256
+ {
257
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(BlockImpl);
258
+ eigen_assert(nonZeros()>0);
259
+ if(m_matrix.isCompressed())
260
+ return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
261
+ else
262
+ return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
263
+ }
264
+
265
+ EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
266
+ EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
267
+
268
+ protected:
269
+
270
+ typename SparseMatrixType::Nested m_matrix;
271
+ Index m_outerStart;
272
+ const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
273
+
274
+ };
275
+
276
+
277
+ template<typename _Scalar, int _Options, typename _Index, int BlockRows, int BlockCols>
278
+ class BlockImpl<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true,Sparse>
279
+ : public SparseMatrixBase<Block<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true> >
280
+ {
281
+ typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
282
+ typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
283
+ typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> BlockType;
284
+ public:
285
+ enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
286
+ EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
287
+ protected:
288
+ enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
289
+ public:
290
+
291
+ class InnerIterator: public SparseMatrixType::InnerIterator
292
+ {
293
+ public:
294
+ inline InnerIterator(const BlockType& xpr, Index outer)
295
+ : SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
296
+ {}
297
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
298
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
299
+ protected:
300
+ Index m_outer;
301
+ };
302
+ class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator
303
+ {
304
+ public:
305
+ inline ReverseInnerIterator(const BlockType& xpr, Index outer)
306
+ : SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
307
+ {}
308
+ inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
309
+ inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
310
+ protected:
311
+ Index m_outer;
312
+ };
313
+
314
+ inline BlockImpl(const SparseMatrixType& xpr, int i)
315
+ : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
316
+ {}
317
+
318
+ inline BlockImpl(const SparseMatrixType& xpr, int startRow, int startCol, int blockRows, int blockCols)
319
+ : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
320
+ {}
321
+
322
+ inline const Scalar* valuePtr() const
323
+ { return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
324
+
325
+ inline const Index* innerIndexPtr() const
326
+ { return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
327
+
328
+ inline const Index* outerIndexPtr() const
329
+ { return m_matrix.outerIndexPtr() + m_outerStart; }
330
+
331
+ Index nonZeros() const
332
+ {
333
+ if(m_matrix.isCompressed())
334
+ return std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
335
+ - std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
336
+ else if(m_outerSize.value()==0)
337
+ return 0;
338
+ else
339
+ return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
340
+ }
341
+
342
+ inline const Scalar coeff(int row, int col) const
343
+ {
344
+ return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
345
+ }
346
+
347
+ inline const Scalar coeff(int index) const
348
+ {
349
+ return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
350
+ }
351
+
352
+ const Scalar& lastCoeff() const
353
+ {
354
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(BlockImpl);
355
+ eigen_assert(nonZeros()>0);
356
+ if(m_matrix.isCompressed())
357
+ return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
358
+ else
359
+ return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
360
+ }
361
+
362
+ EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
363
+ EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
364
+
365
+ protected:
366
+
367
+ typename SparseMatrixType::Nested m_matrix;
368
+ Index m_outerStart;
369
+ const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
370
+
371
+ };
372
+
373
+ //----------
374
+
375
+ /** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
376
+ * is col-major (resp. row-major).
377
+ */
378
+ template<typename Derived>
379
+ typename SparseMatrixBase<Derived>::InnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer)
380
+ { return InnerVectorReturnType(derived(), outer); }
381
+
382
+ /** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
383
+ * is col-major (resp. row-major). Read-only.
384
+ */
385
+ template<typename Derived>
386
+ const typename SparseMatrixBase<Derived>::ConstInnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer) const
387
+ { return ConstInnerVectorReturnType(derived(), outer); }
388
+
389
+ /** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
390
+ * is col-major (resp. row-major).
391
+ */
392
+ template<typename Derived>
393
+ typename SparseMatrixBase<Derived>::InnerVectorsReturnType
394
+ SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
395
+ {
396
+ return Block<Derived,Dynamic,Dynamic,true>(derived(),
397
+ IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
398
+ IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
399
+
400
+ }
401
+
402
+ /** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
403
+ * is col-major (resp. row-major). Read-only.
404
+ */
405
+ template<typename Derived>
406
+ const typename SparseMatrixBase<Derived>::ConstInnerVectorsReturnType
407
+ SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
408
+ {
409
+ return Block<const Derived,Dynamic,Dynamic,true>(derived(),
410
+ IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
411
+ IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
412
+
413
+ }
414
+
415
+ /** Generic implementation of sparse Block expression.
416
+ * Real-only.
417
+ */
418
+ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
419
+ class BlockImpl<XprType,BlockRows,BlockCols,InnerPanel,Sparse>
420
+ : public SparseMatrixBase<Block<XprType,BlockRows,BlockCols,InnerPanel> >, internal::no_assignment_operator
421
+ {
422
+ typedef typename internal::remove_all<typename XprType::Nested>::type _MatrixTypeNested;
423
+ typedef Block<XprType, BlockRows, BlockCols, InnerPanel> BlockType;
424
+ public:
425
+ enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
426
+ EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
427
+
428
+ /** Column or Row constructor
429
+ */
430
+ inline BlockImpl(const XprType& xpr, int i)
431
+ : m_matrix(xpr),
432
+ m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0),
433
+ m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0),
434
+ m_blockRows(BlockRows==1 ? 1 : xpr.rows()),
435
+ m_blockCols(BlockCols==1 ? 1 : xpr.cols())
436
+ {}
437
+
438
+ /** Dynamic-size constructor
439
+ */
440
+ inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
441
+ : m_matrix(xpr), m_startRow(startRow), m_startCol(startCol), m_blockRows(blockRows), m_blockCols(blockCols)
442
+ {}
443
+
444
+ inline int rows() const { return m_blockRows.value(); }
445
+ inline int cols() const { return m_blockCols.value(); }
446
+
447
+ inline Scalar& coeffRef(int row, int col)
448
+ {
449
+ return m_matrix.const_cast_derived()
450
+ .coeffRef(row + m_startRow.value(), col + m_startCol.value());
451
+ }
452
+
453
+ inline const Scalar coeff(int row, int col) const
454
+ {
455
+ return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value());
456
+ }
457
+
458
+ inline Scalar& coeffRef(int index)
459
+ {
460
+ return m_matrix.const_cast_derived()
461
+ .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
462
+ m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
463
+ }
464
+
465
+ inline const Scalar coeff(int index) const
466
+ {
467
+ return m_matrix
468
+ .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
469
+ m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
470
+ }
471
+
472
+ inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; }
473
+
474
+ class InnerIterator : public _MatrixTypeNested::InnerIterator
475
+ {
476
+ typedef typename _MatrixTypeNested::InnerIterator Base;
477
+ const BlockType& m_block;
478
+ Index m_end;
479
+ public:
480
+
481
+ EIGEN_STRONG_INLINE InnerIterator(const BlockType& block, Index outer)
482
+ : Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())),
483
+ m_block(block),
484
+ m_end(IsRowMajor ? block.m_startCol.value()+block.m_blockCols.value() : block.m_startRow.value()+block.m_blockRows.value())
485
+ {
486
+ while( (Base::operator bool()) && (Base::index() < (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value())) )
487
+ Base::operator++();
488
+ }
489
+
490
+ inline Index index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
491
+ inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
492
+ inline Index row() const { return Base::row() - m_block.m_startRow.value(); }
493
+ inline Index col() const { return Base::col() - m_block.m_startCol.value(); }
494
+
495
+ inline operator bool() const { return Base::operator bool() && Base::index() < m_end; }
496
+ };
497
+ class ReverseInnerIterator : public _MatrixTypeNested::ReverseInnerIterator
498
+ {
499
+ typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
500
+ const BlockType& m_block;
501
+ Index m_begin;
502
+ public:
503
+
504
+ EIGEN_STRONG_INLINE ReverseInnerIterator(const BlockType& block, Index outer)
505
+ : Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())),
506
+ m_block(block),
507
+ m_begin(IsRowMajor ? block.m_startCol.value() : block.m_startRow.value())
508
+ {
509
+ while( (Base::operator bool()) && (Base::index() >= (IsRowMajor ? m_block.m_startCol.value()+block.m_blockCols.value() : m_block.m_startRow.value()+block.m_blockRows.value())) )
510
+ Base::operator--();
511
+ }
512
+
513
+ inline Index index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
514
+ inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
515
+ inline Index row() const { return Base::row() - m_block.m_startRow.value(); }
516
+ inline Index col() const { return Base::col() - m_block.m_startCol.value(); }
517
+
518
+ inline operator bool() const { return Base::operator bool() && Base::index() >= m_begin; }
519
+ };
520
+ protected:
521
+ friend class InnerIterator;
522
+ friend class ReverseInnerIterator;
523
+
524
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
525
+
526
+ typename XprType::Nested m_matrix;
527
+ const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
528
+ const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
529
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
530
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
531
+
532
+ };
533
+
534
+ } // end namespace Eigen
535
+
536
+ #endif // EIGEN_SPARSE_BLOCK_H
537
+