tomoto 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +123 -0
  5. data/ext/tomoto/ext.cpp +245 -0
  6. data/ext/tomoto/extconf.rb +28 -0
  7. data/lib/tomoto.rb +12 -0
  8. data/lib/tomoto/ct.rb +11 -0
  9. data/lib/tomoto/hdp.rb +11 -0
  10. data/lib/tomoto/lda.rb +67 -0
  11. data/lib/tomoto/version.rb +3 -0
  12. data/vendor/EigenRand/EigenRand/Core.h +1139 -0
  13. data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
  14. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
  15. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
  16. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
  17. data/vendor/EigenRand/EigenRand/EigenRand +19 -0
  18. data/vendor/EigenRand/EigenRand/Macro.h +24 -0
  19. data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
  20. data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
  21. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
  22. data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
  23. data/vendor/EigenRand/EigenRand/doc.h +220 -0
  24. data/vendor/EigenRand/LICENSE +21 -0
  25. data/vendor/EigenRand/README.md +288 -0
  26. data/vendor/eigen/COPYING.BSD +26 -0
  27. data/vendor/eigen/COPYING.GPL +674 -0
  28. data/vendor/eigen/COPYING.LGPL +502 -0
  29. data/vendor/eigen/COPYING.MINPACK +52 -0
  30. data/vendor/eigen/COPYING.MPL2 +373 -0
  31. data/vendor/eigen/COPYING.README +18 -0
  32. data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
  33. data/vendor/eigen/Eigen/Cholesky +46 -0
  34. data/vendor/eigen/Eigen/CholmodSupport +48 -0
  35. data/vendor/eigen/Eigen/Core +537 -0
  36. data/vendor/eigen/Eigen/Dense +7 -0
  37. data/vendor/eigen/Eigen/Eigen +2 -0
  38. data/vendor/eigen/Eigen/Eigenvalues +61 -0
  39. data/vendor/eigen/Eigen/Geometry +62 -0
  40. data/vendor/eigen/Eigen/Householder +30 -0
  41. data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
  42. data/vendor/eigen/Eigen/Jacobi +33 -0
  43. data/vendor/eigen/Eigen/LU +50 -0
  44. data/vendor/eigen/Eigen/MetisSupport +35 -0
  45. data/vendor/eigen/Eigen/OrderingMethods +73 -0
  46. data/vendor/eigen/Eigen/PaStiXSupport +48 -0
  47. data/vendor/eigen/Eigen/PardisoSupport +35 -0
  48. data/vendor/eigen/Eigen/QR +51 -0
  49. data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
  50. data/vendor/eigen/Eigen/SPQRSupport +34 -0
  51. data/vendor/eigen/Eigen/SVD +51 -0
  52. data/vendor/eigen/Eigen/Sparse +36 -0
  53. data/vendor/eigen/Eigen/SparseCholesky +45 -0
  54. data/vendor/eigen/Eigen/SparseCore +69 -0
  55. data/vendor/eigen/Eigen/SparseLU +46 -0
  56. data/vendor/eigen/Eigen/SparseQR +37 -0
  57. data/vendor/eigen/Eigen/StdDeque +27 -0
  58. data/vendor/eigen/Eigen/StdList +26 -0
  59. data/vendor/eigen/Eigen/StdVector +27 -0
  60. data/vendor/eigen/Eigen/SuperLUSupport +64 -0
  61. data/vendor/eigen/Eigen/UmfPackSupport +40 -0
  62. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
  63. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
  64. data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  65. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
  66. data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
  67. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
  68. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
  69. data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
  70. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
  71. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
  72. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
  73. data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
  74. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
  75. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
  76. data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
  77. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
  78. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
  79. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
  80. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
  81. data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  82. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  83. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
  84. data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
  85. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
  86. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
  87. data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
  88. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
  89. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
  90. data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
  91. data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
  92. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
  93. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
  94. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
  95. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
  96. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
  97. data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
  98. data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
  99. data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
  100. data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
  101. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
  102. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
  103. data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
  104. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
  105. data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
  106. data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
  107. data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
  108. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
  109. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
  110. data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
  111. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
  112. data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
  113. data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
  114. data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
  115. data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
  116. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
  117. data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
  118. data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
  119. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
  120. data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  121. data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
  122. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
  123. data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
  124. data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
  125. data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
  126. data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
  127. data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
  128. data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
  129. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
  130. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
  131. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
  132. data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
  133. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
  134. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
  135. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
  136. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
  137. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
  138. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
  139. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
  140. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
  141. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
  142. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
  143. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
  145. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
  146. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
  148. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
  149. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
  153. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
  154. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
  155. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
  156. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
  157. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
  158. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
  160. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
  161. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
  162. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
  163. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
  164. data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  165. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
  166. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
  167. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
  168. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
  169. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  170. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
  171. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
  172. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  173. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
  174. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
  175. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
  176. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
  177. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  178. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  179. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
  180. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
  181. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
  182. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  183. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  184. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
  185. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
  186. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
  187. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
  188. data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
  189. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
  190. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
  191. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
  192. data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
  193. data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
  194. data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
  195. data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
  196. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
  197. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
  198. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
  199. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  200. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
  201. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  202. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  203. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  204. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  205. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  206. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  207. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
  208. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
  209. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  210. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
  211. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  212. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
  213. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
  214. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
  215. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
  216. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
  217. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
  218. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
  219. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
  220. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
  221. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
  222. data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
  223. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
  224. data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
  225. data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
  226. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
  227. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
  228. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
  229. data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
  230. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
  231. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  232. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
  233. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
  234. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
  235. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
  236. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
  237. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
  238. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
  239. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
  240. data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
  241. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
  242. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
  243. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
  244. data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  245. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
  246. data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  247. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
  248. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
  249. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
  250. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  251. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
  252. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
  253. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  254. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
  255. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
  256. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
  257. data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  258. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
  259. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
  260. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
  261. data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  262. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
  263. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  264. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
  265. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
  266. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
  267. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
  268. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  269. data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  270. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
  271. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
  272. data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  273. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
  274. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
  275. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
  276. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
  277. data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  278. data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
  279. data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  280. data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
  281. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
  282. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
  283. data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  284. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
  285. data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
  286. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
  287. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
  288. data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  289. data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  290. data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  291. data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  292. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
  293. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
  294. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
  295. data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  296. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
  297. data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  298. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  299. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  300. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
  301. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  302. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  303. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  304. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  305. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  306. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  307. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  308. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  309. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  310. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  311. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  312. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  313. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
  314. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
  315. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
  316. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
  317. data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
  318. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
  319. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
  320. data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
  321. data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
  322. data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
  323. data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
  324. data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
  325. data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
  326. data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
  327. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
  328. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
  329. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
  330. data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  331. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
  332. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  333. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
  334. data/vendor/eigen/README.md +3 -0
  335. data/vendor/eigen/bench/README.txt +55 -0
  336. data/vendor/eigen/bench/btl/COPYING +340 -0
  337. data/vendor/eigen/bench/btl/README +154 -0
  338. data/vendor/eigen/bench/tensors/README +21 -0
  339. data/vendor/eigen/blas/README.txt +6 -0
  340. data/vendor/eigen/demos/mandelbrot/README +10 -0
  341. data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
  342. data/vendor/eigen/demos/opengl/README +13 -0
  343. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
  344. data/vendor/eigen/unsupported/README.txt +50 -0
  345. data/vendor/tomotopy/LICENSE +21 -0
  346. data/vendor/tomotopy/README.kr.rst +375 -0
  347. data/vendor/tomotopy/README.rst +382 -0
  348. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
  349. data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
  350. data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
  351. data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
  352. data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
  353. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
  354. data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
  355. data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
  356. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
  357. data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
  358. data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
  359. data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
  360. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
  361. data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
  362. data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
  363. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
  364. data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
  365. data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
  366. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
  367. data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
  368. data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
  369. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
  370. data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
  371. data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
  372. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
  373. data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
  374. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
  375. data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
  376. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
  377. data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
  378. data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
  379. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
  380. data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
  381. data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
  382. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
  383. data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
  384. data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
  385. data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
  386. data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
  387. data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
  388. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
  389. data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
  390. data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
  391. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
  392. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
  393. data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
  394. data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
  395. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
  396. data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
  397. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
  398. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
  399. data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
  400. data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
  401. data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
  402. data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
  403. data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
  404. data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
  405. data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
  406. data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
  407. data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
  408. data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
  409. data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
  410. data/vendor/tomotopy/src/Utils/exception.h +28 -0
  411. data/vendor/tomotopy/src/Utils/math.h +281 -0
  412. data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
  413. data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
  414. data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
  415. data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
  416. data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
  417. data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
  418. data/vendor/tomotopy/src/Utils/text.hpp +49 -0
  419. data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
  420. metadata +531 -0
@@ -0,0 +1,66 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@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
+ #ifndef SPARSELU_IMPL_H
10
+ #define SPARSELU_IMPL_H
11
+
12
+ namespace Eigen {
13
+ namespace internal {
14
+
15
+ /** \ingroup SparseLU_Module
16
+ * \class SparseLUImpl
17
+ * Base class for sparseLU
18
+ */
19
+ template <typename Scalar, typename StorageIndex>
20
+ class SparseLUImpl
21
+ {
22
+ public:
23
+ typedef Matrix<Scalar,Dynamic,1> ScalarVector;
24
+ typedef Matrix<StorageIndex,Dynamic,1> IndexVector;
25
+ typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> ScalarMatrix;
26
+ typedef Map<ScalarMatrix, 0, OuterStride<> > MappedMatrixBlock;
27
+ typedef typename ScalarVector::RealScalar RealScalar;
28
+ typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector;
29
+ typedef Ref<Matrix<StorageIndex,Dynamic,1> > BlockIndexVector;
30
+ typedef LU_GlobalLU_t<IndexVector, ScalarVector> GlobalLU_t;
31
+ typedef SparseMatrix<Scalar,ColMajor,StorageIndex> MatrixType;
32
+
33
+ protected:
34
+ template <typename VectorType>
35
+ Index expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions);
36
+ Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu);
37
+ template <typename VectorType>
38
+ Index memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions);
39
+ void heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end);
40
+ void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end);
41
+ Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat, IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu);
42
+ Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu);
43
+ Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu);
44
+ template <typename Traits>
45
+ void dfs_kernel(const StorageIndex jj, IndexVector& perm_r,
46
+ Index& nseg, IndexVector& panel_lsub, IndexVector& segrep,
47
+ Ref<IndexVector> repfnz_col, IndexVector& xprune, Ref<IndexVector> marker, IndexVector& parent,
48
+ IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits);
49
+ void panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu);
50
+
51
+ void panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu);
52
+ Index column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu);
53
+ Index column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu);
54
+ Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu);
55
+ void pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu);
56
+ void countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu);
57
+ void fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu);
58
+
59
+ template<typename , typename >
60
+ friend struct column_dfs_traits;
61
+ };
62
+
63
+ } // end namespace internal
64
+ } // namespace Eigen
65
+
66
+ #endif
@@ -0,0 +1,226 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@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
+ /*
11
+
12
+ * NOTE: This file is the modified version of [s,d,c,z]memory.c files in SuperLU
13
+
14
+ * -- SuperLU routine (version 3.1) --
15
+ * Univ. of California Berkeley, Xerox Palo Alto Research Center,
16
+ * and Lawrence Berkeley National Lab.
17
+ * August 1, 2008
18
+ *
19
+ * Copyright (c) 1994 by Xerox Corporation. All rights reserved.
20
+ *
21
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
22
+ * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
23
+ *
24
+ * Permission is hereby granted to use or copy this program for any
25
+ * purpose, provided the above notices are retained on all copies.
26
+ * Permission to modify the code and to distribute modified code is
27
+ * granted, provided the above notices are retained, and a notice that
28
+ * the code was modified is included with the above copyright notice.
29
+ */
30
+
31
+ #ifndef EIGEN_SPARSELU_MEMORY
32
+ #define EIGEN_SPARSELU_MEMORY
33
+
34
+ namespace Eigen {
35
+ namespace internal {
36
+
37
+ enum { LUNoMarker = 3 };
38
+ enum {emptyIdxLU = -1};
39
+ inline Index LUnumTempV(Index& m, Index& w, Index& t, Index& b)
40
+ {
41
+ return (std::max)(m, (t+b)*w);
42
+ }
43
+
44
+ template< typename Scalar>
45
+ inline Index LUTempSpace(Index&m, Index& w)
46
+ {
47
+ return (2*w + 4 + LUNoMarker) * m * sizeof(Index) + (w + 1) * m * sizeof(Scalar);
48
+ }
49
+
50
+
51
+
52
+
53
+ /**
54
+ * Expand the existing storage to accomodate more fill-ins
55
+ * \param vec Valid pointer to the vector to allocate or expand
56
+ * \param[in,out] length At input, contain the current length of the vector that is to be increased. At output, length of the newly allocated vector
57
+ * \param[in] nbElts Current number of elements in the factors
58
+ * \param keep_prev 1: use length and do not expand the vector; 0: compute new_len and expand
59
+ * \param[in,out] num_expansions Number of times the memory has been expanded
60
+ */
61
+ template <typename Scalar, typename StorageIndex>
62
+ template <typename VectorType>
63
+ Index SparseLUImpl<Scalar,StorageIndex>::expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions)
64
+ {
65
+
66
+ float alpha = 1.5; // Ratio of the memory increase
67
+ Index new_len; // New size of the allocated memory
68
+
69
+ if(num_expansions == 0 || keep_prev)
70
+ new_len = length ; // First time allocate requested
71
+ else
72
+ new_len = (std::max)(length+1,Index(alpha * length));
73
+
74
+ VectorType old_vec; // Temporary vector to hold the previous values
75
+ if (nbElts > 0 )
76
+ old_vec = vec.segment(0,nbElts);
77
+
78
+ //Allocate or expand the current vector
79
+ #ifdef EIGEN_EXCEPTIONS
80
+ try
81
+ #endif
82
+ {
83
+ vec.resize(new_len);
84
+ }
85
+ #ifdef EIGEN_EXCEPTIONS
86
+ catch(std::bad_alloc& )
87
+ #else
88
+ if(!vec.size())
89
+ #endif
90
+ {
91
+ if (!num_expansions)
92
+ {
93
+ // First time to allocate from LUMemInit()
94
+ // Let LUMemInit() deals with it.
95
+ return -1;
96
+ }
97
+ if (keep_prev)
98
+ {
99
+ // In this case, the memory length should not not be reduced
100
+ return new_len;
101
+ }
102
+ else
103
+ {
104
+ // Reduce the size and increase again
105
+ Index tries = 0; // Number of attempts
106
+ do
107
+ {
108
+ alpha = (alpha + 1)/2;
109
+ new_len = (std::max)(length+1,Index(alpha * length));
110
+ #ifdef EIGEN_EXCEPTIONS
111
+ try
112
+ #endif
113
+ {
114
+ vec.resize(new_len);
115
+ }
116
+ #ifdef EIGEN_EXCEPTIONS
117
+ catch(std::bad_alloc& )
118
+ #else
119
+ if (!vec.size())
120
+ #endif
121
+ {
122
+ tries += 1;
123
+ if ( tries > 10) return new_len;
124
+ }
125
+ } while (!vec.size());
126
+ }
127
+ }
128
+ //Copy the previous values to the newly allocated space
129
+ if (nbElts > 0)
130
+ vec.segment(0, nbElts) = old_vec;
131
+
132
+
133
+ length = new_len;
134
+ if(num_expansions) ++num_expansions;
135
+ return 0;
136
+ }
137
+
138
+ /**
139
+ * \brief Allocate various working space for the numerical factorization phase.
140
+ * \param m number of rows of the input matrix
141
+ * \param n number of columns
142
+ * \param annz number of initial nonzeros in the matrix
143
+ * \param lwork if lwork=-1, this routine returns an estimated size of the required memory
144
+ * \param glu persistent data to facilitate multiple factors : will be deleted later ??
145
+ * \param fillratio estimated ratio of fill in the factors
146
+ * \param panel_size Size of a panel
147
+ * \return an estimated size of the required memory if lwork = -1; otherwise, return the size of actually allocated memory when allocation failed, and 0 on success
148
+ * \note Unlike SuperLU, this routine does not support successive factorization with the same pattern and the same row permutation
149
+ */
150
+ template <typename Scalar, typename StorageIndex>
151
+ Index SparseLUImpl<Scalar,StorageIndex>::memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu)
152
+ {
153
+ Index& num_expansions = glu.num_expansions; //No memory expansions so far
154
+ num_expansions = 0;
155
+ glu.nzumax = glu.nzlumax = (std::min)(fillratio * (annz+1) / n, m) * n; // estimated number of nonzeros in U
156
+ glu.nzlmax = (std::max)(Index(4), fillratio) * (annz+1) / 4; // estimated nnz in L factor
157
+ // Return the estimated size to the user if necessary
158
+ Index tempSpace;
159
+ tempSpace = (2*panel_size + 4 + LUNoMarker) * m * sizeof(Index) + (panel_size + 1) * m * sizeof(Scalar);
160
+ if (lwork == emptyIdxLU)
161
+ {
162
+ Index estimated_size;
163
+ estimated_size = (5 * n + 5) * sizeof(Index) + tempSpace
164
+ + (glu.nzlmax + glu.nzumax) * sizeof(Index) + (glu.nzlumax+glu.nzumax) * sizeof(Scalar) + n;
165
+ return estimated_size;
166
+ }
167
+
168
+ // Setup the required space
169
+
170
+ // First allocate Integer pointers for L\U factors
171
+ glu.xsup.resize(n+1);
172
+ glu.supno.resize(n+1);
173
+ glu.xlsub.resize(n+1);
174
+ glu.xlusup.resize(n+1);
175
+ glu.xusub.resize(n+1);
176
+
177
+ // Reserve memory for L/U factors
178
+ do
179
+ {
180
+ if( (expand<ScalarVector>(glu.lusup, glu.nzlumax, 0, 0, num_expansions)<0)
181
+ || (expand<ScalarVector>(glu.ucol, glu.nzumax, 0, 0, num_expansions)<0)
182
+ || (expand<IndexVector> (glu.lsub, glu.nzlmax, 0, 0, num_expansions)<0)
183
+ || (expand<IndexVector> (glu.usub, glu.nzumax, 0, 1, num_expansions)<0) )
184
+ {
185
+ //Reduce the estimated size and retry
186
+ glu.nzlumax /= 2;
187
+ glu.nzumax /= 2;
188
+ glu.nzlmax /= 2;
189
+ if (glu.nzlumax < annz ) return glu.nzlumax;
190
+ }
191
+ } while (!glu.lusup.size() || !glu.ucol.size() || !glu.lsub.size() || !glu.usub.size());
192
+
193
+ ++num_expansions;
194
+ return 0;
195
+
196
+ } // end LuMemInit
197
+
198
+ /**
199
+ * \brief Expand the existing storage
200
+ * \param vec vector to expand
201
+ * \param[in,out] maxlen On input, previous size of vec (Number of elements to copy ). on output, new size
202
+ * \param nbElts current number of elements in the vector.
203
+ * \param memtype Type of the element to expand
204
+ * \param num_expansions Number of expansions
205
+ * \return 0 on success, > 0 size of the memory allocated so far
206
+ */
207
+ template <typename Scalar, typename StorageIndex>
208
+ template <typename VectorType>
209
+ Index SparseLUImpl<Scalar,StorageIndex>::memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions)
210
+ {
211
+ Index failed_size;
212
+ if (memtype == USUB)
213
+ failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 1, num_expansions);
214
+ else
215
+ failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 0, num_expansions);
216
+
217
+ if (failed_size)
218
+ return failed_size;
219
+
220
+ return 0 ;
221
+ }
222
+
223
+ } // end namespace internal
224
+
225
+ } // end namespace Eigen
226
+ #endif // EIGEN_SPARSELU_MEMORY
@@ -0,0 +1,110 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@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
+ /*
11
+ * NOTE: This file comes from a partly modified version of files slu_[s,d,c,z]defs.h
12
+ * -- SuperLU routine (version 4.1) --
13
+ * Univ. of California Berkeley, Xerox Palo Alto Research Center,
14
+ * and Lawrence Berkeley National Lab.
15
+ * November, 2010
16
+ *
17
+ * Global data structures used in LU factorization -
18
+ *
19
+ * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
20
+ * (xsup,supno): supno[i] is the supernode no to which i belongs;
21
+ * xsup(s) points to the beginning of the s-th supernode.
22
+ * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
23
+ * xsup 0 1 2 4 7 12
24
+ * Note: dfs will be performed on supernode rep. relative to the new
25
+ * row pivoting ordering
26
+ *
27
+ * (xlsub,lsub): lsub[*] contains the compressed subscript of
28
+ * rectangular supernodes; xlsub[j] points to the starting
29
+ * location of the j-th column in lsub[*]. Note that xlsub
30
+ * is indexed by column.
31
+ * Storage: original row subscripts
32
+ *
33
+ * During the course of sparse LU factorization, we also use
34
+ * (xlsub,lsub) for the purpose of symmetric pruning. For each
35
+ * supernode {s,s+1,...,t=s+r} with first column s and last
36
+ * column t, the subscript set
37
+ * lsub[j], j=xlsub[s], .., xlsub[s+1]-1
38
+ * is the structure of column s (i.e. structure of this supernode).
39
+ * It is used for the storage of numerical values.
40
+ * Furthermore,
41
+ * lsub[j], j=xlsub[t], .., xlsub[t+1]-1
42
+ * is the structure of the last column t of this supernode.
43
+ * It is for the purpose of symmetric pruning. Therefore, the
44
+ * structural subscripts can be rearranged without making physical
45
+ * interchanges among the numerical values.
46
+ *
47
+ * However, if the supernode has only one column, then we
48
+ * only keep one set of subscripts. For any subscript interchange
49
+ * performed, similar interchange must be done on the numerical
50
+ * values.
51
+ *
52
+ * The last column structures (for pruning) will be removed
53
+ * after the numercial LU factorization phase.
54
+ *
55
+ * (xlusup,lusup): lusup[*] contains the numerical values of the
56
+ * rectangular supernodes; xlusup[j] points to the starting
57
+ * location of the j-th column in storage vector lusup[*]
58
+ * Note: xlusup is indexed by column.
59
+ * Each rectangular supernode is stored by column-major
60
+ * scheme, consistent with Fortran 2-dim array storage.
61
+ *
62
+ * (xusub,ucol,usub): ucol[*] stores the numerical values of
63
+ * U-columns outside the rectangular supernodes. The row
64
+ * subscript of nonzero ucol[k] is stored in usub[k].
65
+ * xusub[i] points to the starting location of column i in ucol.
66
+ * Storage: new row subscripts; that is subscripts of PA.
67
+ */
68
+
69
+ #ifndef EIGEN_LU_STRUCTS
70
+ #define EIGEN_LU_STRUCTS
71
+ namespace Eigen {
72
+ namespace internal {
73
+
74
+ typedef enum {LUSUP, UCOL, LSUB, USUB, LLVL, ULVL} MemType;
75
+
76
+ template <typename IndexVector, typename ScalarVector>
77
+ struct LU_GlobalLU_t {
78
+ typedef typename IndexVector::Scalar StorageIndex;
79
+ IndexVector xsup; //First supernode column ... xsup(s) points to the beginning of the s-th supernode
80
+ IndexVector supno; // Supernode number corresponding to this column (column to supernode mapping)
81
+ ScalarVector lusup; // nonzero values of L ordered by columns
82
+ IndexVector lsub; // Compressed row indices of L rectangular supernodes.
83
+ IndexVector xlusup; // pointers to the beginning of each column in lusup
84
+ IndexVector xlsub; // pointers to the beginning of each column in lsub
85
+ Index nzlmax; // Current max size of lsub
86
+ Index nzlumax; // Current max size of lusup
87
+ ScalarVector ucol; // nonzero values of U ordered by columns
88
+ IndexVector usub; // row indices of U columns in ucol
89
+ IndexVector xusub; // Pointers to the beginning of each column of U in ucol
90
+ Index nzumax; // Current max size of ucol
91
+ Index n; // Number of columns in the matrix
92
+ Index num_expansions;
93
+ };
94
+
95
+ // Values to set for performance
96
+ struct perfvalues {
97
+ Index panel_size; // a panel consists of at most <panel_size> consecutive columns
98
+ Index relax; // To control degree of relaxing supernodes. If the number of nodes (columns)
99
+ // in a subtree of the elimination tree is less than relax, this subtree is considered
100
+ // as one supernode regardless of the row structures of those columns
101
+ Index maxsuper; // The maximum size for a supernode in complete LU
102
+ Index rowblk; // The minimum row dimension for 2-D blocking to be used;
103
+ Index colblk; // The minimum column dimension for 2-D blocking to be used;
104
+ Index fillfactor; // The estimated fills factors for L and U, compared with A
105
+ };
106
+
107
+ } // end namespace internal
108
+
109
+ } // end namespace Eigen
110
+ #endif // EIGEN_LU_STRUCTS
@@ -0,0 +1,301 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
5
+ // Copyright (C) 2012 Gael Guennebaud <gael.guennebaud@inria.fr>
6
+ //
7
+ // This Source Code Form is subject to the terms of the Mozilla
8
+ // Public License v. 2.0. If a copy of the MPL was not distributed
9
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
+
11
+ #ifndef EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
12
+ #define EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
13
+
14
+ namespace Eigen {
15
+ namespace internal {
16
+
17
+ /** \ingroup SparseLU_Module
18
+ * \brief a class to manipulate the L supernodal factor from the SparseLU factorization
19
+ *
20
+ * This class contain the data to easily store
21
+ * and manipulate the supernodes during the factorization and solution phase of Sparse LU.
22
+ * Only the lower triangular matrix has supernodes.
23
+ *
24
+ * NOTE : This class corresponds to the SCformat structure in SuperLU
25
+ *
26
+ */
27
+ /* TODO
28
+ * InnerIterator as for sparsematrix
29
+ * SuperInnerIterator to iterate through all supernodes
30
+ * Function for triangular solve
31
+ */
32
+ template <typename _Scalar, typename _StorageIndex>
33
+ class MappedSuperNodalMatrix
34
+ {
35
+ public:
36
+ typedef _Scalar Scalar;
37
+ typedef _StorageIndex StorageIndex;
38
+ typedef Matrix<StorageIndex,Dynamic,1> IndexVector;
39
+ typedef Matrix<Scalar,Dynamic,1> ScalarVector;
40
+ public:
41
+ MappedSuperNodalMatrix()
42
+ {
43
+
44
+ }
45
+ MappedSuperNodalMatrix(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind,
46
+ IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col )
47
+ {
48
+ setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col);
49
+ }
50
+
51
+ ~MappedSuperNodalMatrix()
52
+ {
53
+
54
+ }
55
+ /**
56
+ * Set appropriate pointers for the lower triangular supernodal matrix
57
+ * These infos are available at the end of the numerical factorization
58
+ * FIXME This class will be modified such that it can be use in the course
59
+ * of the factorization.
60
+ */
61
+ void setInfos(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind,
62
+ IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col )
63
+ {
64
+ m_row = m;
65
+ m_col = n;
66
+ m_nzval = nzval.data();
67
+ m_nzval_colptr = nzval_colptr.data();
68
+ m_rowind = rowind.data();
69
+ m_rowind_colptr = rowind_colptr.data();
70
+ m_nsuper = col_to_sup(n);
71
+ m_col_to_sup = col_to_sup.data();
72
+ m_sup_to_col = sup_to_col.data();
73
+ }
74
+
75
+ /**
76
+ * Number of rows
77
+ */
78
+ Index rows() { return m_row; }
79
+
80
+ /**
81
+ * Number of columns
82
+ */
83
+ Index cols() { return m_col; }
84
+
85
+ /**
86
+ * Return the array of nonzero values packed by column
87
+ *
88
+ * The size is nnz
89
+ */
90
+ Scalar* valuePtr() { return m_nzval; }
91
+
92
+ const Scalar* valuePtr() const
93
+ {
94
+ return m_nzval;
95
+ }
96
+ /**
97
+ * Return the pointers to the beginning of each column in \ref valuePtr()
98
+ */
99
+ StorageIndex* colIndexPtr()
100
+ {
101
+ return m_nzval_colptr;
102
+ }
103
+
104
+ const StorageIndex* colIndexPtr() const
105
+ {
106
+ return m_nzval_colptr;
107
+ }
108
+
109
+ /**
110
+ * Return the array of compressed row indices of all supernodes
111
+ */
112
+ StorageIndex* rowIndex() { return m_rowind; }
113
+
114
+ const StorageIndex* rowIndex() const
115
+ {
116
+ return m_rowind;
117
+ }
118
+
119
+ /**
120
+ * Return the location in \em rowvaluePtr() which starts each column
121
+ */
122
+ StorageIndex* rowIndexPtr() { return m_rowind_colptr; }
123
+
124
+ const StorageIndex* rowIndexPtr() const
125
+ {
126
+ return m_rowind_colptr;
127
+ }
128
+
129
+ /**
130
+ * Return the array of column-to-supernode mapping
131
+ */
132
+ StorageIndex* colToSup() { return m_col_to_sup; }
133
+
134
+ const StorageIndex* colToSup() const
135
+ {
136
+ return m_col_to_sup;
137
+ }
138
+ /**
139
+ * Return the array of supernode-to-column mapping
140
+ */
141
+ StorageIndex* supToCol() { return m_sup_to_col; }
142
+
143
+ const StorageIndex* supToCol() const
144
+ {
145
+ return m_sup_to_col;
146
+ }
147
+
148
+ /**
149
+ * Return the number of supernodes
150
+ */
151
+ Index nsuper() const
152
+ {
153
+ return m_nsuper;
154
+ }
155
+
156
+ class InnerIterator;
157
+ template<typename Dest>
158
+ void solveInPlace( MatrixBase<Dest>&X) const;
159
+
160
+
161
+
162
+
163
+ protected:
164
+ Index m_row; // Number of rows
165
+ Index m_col; // Number of columns
166
+ Index m_nsuper; // Number of supernodes
167
+ Scalar* m_nzval; //array of nonzero values packed by column
168
+ StorageIndex* m_nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j
169
+ StorageIndex* m_rowind; // Array of compressed row indices of rectangular supernodes
170
+ StorageIndex* m_rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j
171
+ StorageIndex* m_col_to_sup; // col_to_sup[j] is the supernode number to which column j belongs
172
+ StorageIndex* m_sup_to_col; //sup_to_col[s] points to the starting column of the s-th supernode
173
+
174
+ private :
175
+ };
176
+
177
+ /**
178
+ * \brief InnerIterator class to iterate over nonzero values of the current column in the supernodal matrix L
179
+ *
180
+ */
181
+ template<typename Scalar, typename StorageIndex>
182
+ class MappedSuperNodalMatrix<Scalar,StorageIndex>::InnerIterator
183
+ {
184
+ public:
185
+ InnerIterator(const MappedSuperNodalMatrix& mat, Index outer)
186
+ : m_matrix(mat),
187
+ m_outer(outer),
188
+ m_supno(mat.colToSup()[outer]),
189
+ m_idval(mat.colIndexPtr()[outer]),
190
+ m_startidval(m_idval),
191
+ m_endidval(mat.colIndexPtr()[outer+1]),
192
+ m_idrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]]),
193
+ m_endidrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]+1])
194
+ {}
195
+ inline InnerIterator& operator++()
196
+ {
197
+ m_idval++;
198
+ m_idrow++;
199
+ return *this;
200
+ }
201
+ inline Scalar value() const { return m_matrix.valuePtr()[m_idval]; }
202
+
203
+ inline Scalar& valueRef() { return const_cast<Scalar&>(m_matrix.valuePtr()[m_idval]); }
204
+
205
+ inline Index index() const { return m_matrix.rowIndex()[m_idrow]; }
206
+ inline Index row() const { return index(); }
207
+ inline Index col() const { return m_outer; }
208
+
209
+ inline Index supIndex() const { return m_supno; }
210
+
211
+ inline operator bool() const
212
+ {
213
+ return ( (m_idval < m_endidval) && (m_idval >= m_startidval)
214
+ && (m_idrow < m_endidrow) );
215
+ }
216
+
217
+ protected:
218
+ const MappedSuperNodalMatrix& m_matrix; // Supernodal lower triangular matrix
219
+ const Index m_outer; // Current column
220
+ const Index m_supno; // Current SuperNode number
221
+ Index m_idval; // Index to browse the values in the current column
222
+ const Index m_startidval; // Start of the column value
223
+ const Index m_endidval; // End of the column value
224
+ Index m_idrow; // Index to browse the row indices
225
+ Index m_endidrow; // End index of row indices of the current column
226
+ };
227
+
228
+ /**
229
+ * \brief Solve with the supernode triangular matrix
230
+ *
231
+ */
232
+ template<typename Scalar, typename Index_>
233
+ template<typename Dest>
234
+ void MappedSuperNodalMatrix<Scalar,Index_>::solveInPlace( MatrixBase<Dest>&X) const
235
+ {
236
+ /* Explicit type conversion as the Index type of MatrixBase<Dest> may be wider than Index */
237
+ // eigen_assert(X.rows() <= NumTraits<Index>::highest());
238
+ // eigen_assert(X.cols() <= NumTraits<Index>::highest());
239
+ Index n = int(X.rows());
240
+ Index nrhs = Index(X.cols());
241
+ const Scalar * Lval = valuePtr(); // Nonzero values
242
+ Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor> work(n, nrhs); // working vector
243
+ work.setZero();
244
+ for (Index k = 0; k <= nsuper(); k ++)
245
+ {
246
+ Index fsupc = supToCol()[k]; // First column of the current supernode
247
+ Index istart = rowIndexPtr()[fsupc]; // Pointer index to the subscript of the current column
248
+ Index nsupr = rowIndexPtr()[fsupc+1] - istart; // Number of rows in the current supernode
249
+ Index nsupc = supToCol()[k+1] - fsupc; // Number of columns in the current supernode
250
+ Index nrow = nsupr - nsupc; // Number of rows in the non-diagonal part of the supernode
251
+ Index irow; //Current index row
252
+
253
+ if (nsupc == 1 )
254
+ {
255
+ for (Index j = 0; j < nrhs; j++)
256
+ {
257
+ InnerIterator it(*this, fsupc);
258
+ ++it; // Skip the diagonal element
259
+ for (; it; ++it)
260
+ {
261
+ irow = it.row();
262
+ X(irow, j) -= X(fsupc, j) * it.value();
263
+ }
264
+ }
265
+ }
266
+ else
267
+ {
268
+ // The supernode has more than one column
269
+ Index luptr = colIndexPtr()[fsupc];
270
+ Index lda = colIndexPtr()[fsupc+1] - luptr;
271
+
272
+ // Triangular solve
273
+ Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) );
274
+ Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
275
+ U = A.template triangularView<UnitLower>().solve(U);
276
+
277
+ // Matrix-vector product
278
+ new (&A) Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > ( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
279
+ work.topRows(nrow).noalias() = A * U;
280
+
281
+ //Begin Scatter
282
+ for (Index j = 0; j < nrhs; j++)
283
+ {
284
+ Index iptr = istart + nsupc;
285
+ for (Index i = 0; i < nrow; i++)
286
+ {
287
+ irow = rowIndex()[iptr];
288
+ X(irow, j) -= work(i, j); // Scatter operation
289
+ work(i, j) = Scalar(0);
290
+ iptr++;
291
+ }
292
+ }
293
+ }
294
+ }
295
+ }
296
+
297
+ } // end namespace internal
298
+
299
+ } // end namespace Eigen
300
+
301
+ #endif // EIGEN_SPARSELU_MATRIX_H