tomoto 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,87 @@
1
+ /*
2
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of Intel Corporation nor the names of its contributors may
13
+ be used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ ********************************************************************************
28
+ * Content : Eigen bindings to LAPACKe
29
+ * Self-adjoint eigenvalues/eigenvectors.
30
+ ********************************************************************************
31
+ */
32
+
33
+ #ifndef EIGEN_SAEIGENSOLVER_LAPACKE_H
34
+ #define EIGEN_SAEIGENSOLVER_LAPACKE_H
35
+
36
+ namespace Eigen {
37
+
38
+ /** \internal Specialization for the data types supported by LAPACKe */
39
+
40
+ #define EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, EIGCOLROW ) \
41
+ template<> template<typename InputType> inline \
42
+ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
43
+ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, int options) \
44
+ { \
45
+ eigen_assert(matrix.cols() == matrix.rows()); \
46
+ eigen_assert((options&~(EigVecMask|GenEigMask))==0 \
47
+ && (options&EigVecMask)!=EigVecMask \
48
+ && "invalid option parameter"); \
49
+ bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \
50
+ lapack_int n = internal::convert_index<lapack_int>(matrix.cols()), lda, info; \
51
+ m_eivalues.resize(n,1); \
52
+ m_subdiag.resize(n-1); \
53
+ m_eivec = matrix; \
54
+ \
55
+ if(n==1) \
56
+ { \
57
+ m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); \
58
+ if(computeEigenvectors) m_eivec.setOnes(n,n); \
59
+ m_info = Success; \
60
+ m_isInitialized = true; \
61
+ m_eigenvectorsOk = computeEigenvectors; \
62
+ return *this; \
63
+ } \
64
+ \
65
+ lda = internal::convert_index<lapack_int>(m_eivec.outerStride()); \
66
+ char jobz, uplo='L'/*, range='A'*/; \
67
+ jobz = computeEigenvectors ? 'V' : 'N'; \
68
+ \
69
+ info = LAPACKE_##LAPACKE_NAME( LAPACK_COL_MAJOR, jobz, uplo, n, (LAPACKE_TYPE*)m_eivec.data(), lda, (LAPACKE_RTYPE*)m_eivalues.data() ); \
70
+ m_info = (info==0) ? Success : NoConvergence; \
71
+ m_isInitialized = true; \
72
+ m_eigenvectorsOk = computeEigenvectors; \
73
+ return *this; \
74
+ }
75
+
76
+ #define EIGEN_LAPACKE_EIG_SELFADJ(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME ) \
77
+ EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, ColMajor ) \
78
+ EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, RowMajor )
79
+
80
+ EIGEN_LAPACKE_EIG_SELFADJ(double, double, double, dsyev)
81
+ EIGEN_LAPACKE_EIG_SELFADJ(float, float, float, ssyev)
82
+ EIGEN_LAPACKE_EIG_SELFADJ(dcomplex, lapack_complex_double, double, zheev)
83
+ EIGEN_LAPACKE_EIG_SELFADJ(scomplex, lapack_complex_float, float, cheev)
84
+
85
+ } // end namespace Eigen
86
+
87
+ #endif // EIGEN_SAEIGENSOLVER_H
@@ -0,0 +1,556 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ // Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>
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_TRIDIAGONALIZATION_H
12
+ #define EIGEN_TRIDIAGONALIZATION_H
13
+
14
+ namespace Eigen {
15
+
16
+ namespace internal {
17
+
18
+ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType;
19
+ template<typename MatrixType>
20
+ struct traits<TridiagonalizationMatrixTReturnType<MatrixType> >
21
+ : public traits<typename MatrixType::PlainObject>
22
+ {
23
+ typedef typename MatrixType::PlainObject ReturnType; // FIXME shall it be a BandMatrix?
24
+ enum { Flags = 0 };
25
+ };
26
+
27
+ template<typename MatrixType, typename CoeffVectorType>
28
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs);
29
+ }
30
+
31
+ /** \eigenvalues_module \ingroup Eigenvalues_Module
32
+ *
33
+ *
34
+ * \class Tridiagonalization
35
+ *
36
+ * \brief Tridiagonal decomposition of a selfadjoint matrix
37
+ *
38
+ * \tparam _MatrixType the type of the matrix of which we are computing the
39
+ * tridiagonal decomposition; this is expected to be an instantiation of the
40
+ * Matrix class template.
41
+ *
42
+ * This class performs a tridiagonal decomposition of a selfadjoint matrix \f$ A \f$ such that:
43
+ * \f$ A = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real symmetric tridiagonal matrix.
44
+ *
45
+ * A tridiagonal matrix is a matrix which has nonzero elements only on the
46
+ * main diagonal and the first diagonal below and above it. The Hessenberg
47
+ * decomposition of a selfadjoint matrix is in fact a tridiagonal
48
+ * decomposition. This class is used in SelfAdjointEigenSolver to compute the
49
+ * eigenvalues and eigenvectors of a selfadjoint matrix.
50
+ *
51
+ * Call the function compute() to compute the tridiagonal decomposition of a
52
+ * given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&)
53
+ * constructor which computes the tridiagonal Schur decomposition at
54
+ * construction time. Once the decomposition is computed, you can use the
55
+ * matrixQ() and matrixT() functions to retrieve the matrices Q and T in the
56
+ * decomposition.
57
+ *
58
+ * The documentation of Tridiagonalization(const MatrixType&) contains an
59
+ * example of the typical use of this class.
60
+ *
61
+ * \sa class HessenbergDecomposition, class SelfAdjointEigenSolver
62
+ */
63
+ template<typename _MatrixType> class Tridiagonalization
64
+ {
65
+ public:
66
+
67
+ /** \brief Synonym for the template parameter \p _MatrixType. */
68
+ typedef _MatrixType MatrixType;
69
+
70
+ typedef typename MatrixType::Scalar Scalar;
71
+ typedef typename NumTraits<Scalar>::Real RealScalar;
72
+ typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
73
+
74
+ enum {
75
+ Size = MatrixType::RowsAtCompileTime,
76
+ SizeMinusOne = Size == Dynamic ? Dynamic : (Size > 1 ? Size - 1 : 1),
77
+ Options = MatrixType::Options,
78
+ MaxSize = MatrixType::MaxRowsAtCompileTime,
79
+ MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : (MaxSize > 1 ? MaxSize - 1 : 1)
80
+ };
81
+
82
+ typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> CoeffVectorType;
83
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type DiagonalType;
84
+ typedef Matrix<RealScalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> SubDiagonalType;
85
+ typedef typename internal::remove_all<typename MatrixType::RealReturnType>::type MatrixTypeRealView;
86
+ typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType;
87
+
88
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
89
+ typename internal::add_const_on_value_type<typename Diagonal<const MatrixType>::RealReturnType>::type,
90
+ const Diagonal<const MatrixType>
91
+ >::type DiagonalReturnType;
92
+
93
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
94
+ typename internal::add_const_on_value_type<typename Diagonal<const MatrixType, -1>::RealReturnType>::type,
95
+ const Diagonal<const MatrixType, -1>
96
+ >::type SubDiagonalReturnType;
97
+
98
+ /** \brief Return type of matrixQ() */
99
+ typedef HouseholderSequence<MatrixType,typename internal::remove_all<typename CoeffVectorType::ConjugateReturnType>::type> HouseholderSequenceType;
100
+
101
+ /** \brief Default constructor.
102
+ *
103
+ * \param [in] size Positive integer, size of the matrix whose tridiagonal
104
+ * decomposition will be computed.
105
+ *
106
+ * The default constructor is useful in cases in which the user intends to
107
+ * perform decompositions via compute(). The \p size parameter is only
108
+ * used as a hint. It is not an error to give a wrong \p size, but it may
109
+ * impair performance.
110
+ *
111
+ * \sa compute() for an example.
112
+ */
113
+ explicit Tridiagonalization(Index size = Size==Dynamic ? 2 : Size)
114
+ : m_matrix(size,size),
115
+ m_hCoeffs(size > 1 ? size-1 : 1),
116
+ m_isInitialized(false)
117
+ {}
118
+
119
+ /** \brief Constructor; computes tridiagonal decomposition of given matrix.
120
+ *
121
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
122
+ * is to be computed.
123
+ *
124
+ * This constructor calls compute() to compute the tridiagonal decomposition.
125
+ *
126
+ * Example: \include Tridiagonalization_Tridiagonalization_MatrixType.cpp
127
+ * Output: \verbinclude Tridiagonalization_Tridiagonalization_MatrixType.out
128
+ */
129
+ template<typename InputType>
130
+ explicit Tridiagonalization(const EigenBase<InputType>& matrix)
131
+ : m_matrix(matrix.derived()),
132
+ m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1),
133
+ m_isInitialized(false)
134
+ {
135
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
136
+ m_isInitialized = true;
137
+ }
138
+
139
+ /** \brief Computes tridiagonal decomposition of given matrix.
140
+ *
141
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
142
+ * is to be computed.
143
+ * \returns Reference to \c *this
144
+ *
145
+ * The tridiagonal decomposition is computed by bringing the columns of
146
+ * the matrix successively in the required form using Householder
147
+ * reflections. The cost is \f$ 4n^3/3 \f$ flops, where \f$ n \f$ denotes
148
+ * the size of the given matrix.
149
+ *
150
+ * This method reuses of the allocated data in the Tridiagonalization
151
+ * object, if the size of the matrix does not change.
152
+ *
153
+ * Example: \include Tridiagonalization_compute.cpp
154
+ * Output: \verbinclude Tridiagonalization_compute.out
155
+ */
156
+ template<typename InputType>
157
+ Tridiagonalization& compute(const EigenBase<InputType>& matrix)
158
+ {
159
+ m_matrix = matrix.derived();
160
+ m_hCoeffs.resize(matrix.rows()-1, 1);
161
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
162
+ m_isInitialized = true;
163
+ return *this;
164
+ }
165
+
166
+ /** \brief Returns the Householder coefficients.
167
+ *
168
+ * \returns a const reference to the vector of Householder coefficients
169
+ *
170
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
171
+ * the member function compute(const MatrixType&) has been called before
172
+ * to compute the tridiagonal decomposition of a matrix.
173
+ *
174
+ * The Householder coefficients allow the reconstruction of the matrix
175
+ * \f$ Q \f$ in the tridiagonal decomposition from the packed data.
176
+ *
177
+ * Example: \include Tridiagonalization_householderCoefficients.cpp
178
+ * Output: \verbinclude Tridiagonalization_householderCoefficients.out
179
+ *
180
+ * \sa packedMatrix(), \ref Householder_Module "Householder module"
181
+ */
182
+ inline CoeffVectorType householderCoefficients() const
183
+ {
184
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
185
+ return m_hCoeffs;
186
+ }
187
+
188
+ /** \brief Returns the internal representation of the decomposition
189
+ *
190
+ * \returns a const reference to a matrix with the internal representation
191
+ * of the decomposition.
192
+ *
193
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
194
+ * the member function compute(const MatrixType&) has been called before
195
+ * to compute the tridiagonal decomposition of a matrix.
196
+ *
197
+ * The returned matrix contains the following information:
198
+ * - the strict upper triangular part is equal to the input matrix A.
199
+ * - the diagonal and lower sub-diagonal represent the real tridiagonal
200
+ * symmetric matrix T.
201
+ * - the rest of the lower part contains the Householder vectors that,
202
+ * combined with Householder coefficients returned by
203
+ * householderCoefficients(), allows to reconstruct the matrix Q as
204
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
205
+ * Here, the matrices \f$ H_i \f$ are the Householder transformations
206
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
207
+ * where \f$ h_i \f$ is the \f$ i \f$th Householder coefficient and
208
+ * \f$ v_i \f$ is the Householder vector defined by
209
+ * \f$ v_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \f$
210
+ * with M the matrix returned by this function.
211
+ *
212
+ * See LAPACK for further details on this packed storage.
213
+ *
214
+ * Example: \include Tridiagonalization_packedMatrix.cpp
215
+ * Output: \verbinclude Tridiagonalization_packedMatrix.out
216
+ *
217
+ * \sa householderCoefficients()
218
+ */
219
+ inline const MatrixType& packedMatrix() const
220
+ {
221
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
222
+ return m_matrix;
223
+ }
224
+
225
+ /** \brief Returns the unitary matrix Q in the decomposition
226
+ *
227
+ * \returns object representing the matrix Q
228
+ *
229
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
230
+ * the member function compute(const MatrixType&) has been called before
231
+ * to compute the tridiagonal decomposition of a matrix.
232
+ *
233
+ * This function returns a light-weight object of template class
234
+ * HouseholderSequence. You can either apply it directly to a matrix or
235
+ * you can convert it to a matrix of type #MatrixType.
236
+ *
237
+ * \sa Tridiagonalization(const MatrixType&) for an example,
238
+ * matrixT(), class HouseholderSequence
239
+ */
240
+ HouseholderSequenceType matrixQ() const
241
+ {
242
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
243
+ return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate())
244
+ .setLength(m_matrix.rows() - 1)
245
+ .setShift(1);
246
+ }
247
+
248
+ /** \brief Returns an expression of the tridiagonal matrix T in the decomposition
249
+ *
250
+ * \returns expression object representing the matrix T
251
+ *
252
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
253
+ * the member function compute(const MatrixType&) has been called before
254
+ * to compute the tridiagonal decomposition of a matrix.
255
+ *
256
+ * Currently, this function can be used to extract the matrix T from internal
257
+ * data and copy it to a dense matrix object. In most cases, it may be
258
+ * sufficient to directly use the packed matrix or the vector expressions
259
+ * returned by diagonal() and subDiagonal() instead of creating a new
260
+ * dense copy matrix with this function.
261
+ *
262
+ * \sa Tridiagonalization(const MatrixType&) for an example,
263
+ * matrixQ(), packedMatrix(), diagonal(), subDiagonal()
264
+ */
265
+ MatrixTReturnType matrixT() const
266
+ {
267
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
268
+ return MatrixTReturnType(m_matrix.real());
269
+ }
270
+
271
+ /** \brief Returns the diagonal of the tridiagonal matrix T in the decomposition.
272
+ *
273
+ * \returns expression representing the diagonal of T
274
+ *
275
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
276
+ * the member function compute(const MatrixType&) has been called before
277
+ * to compute the tridiagonal decomposition of a matrix.
278
+ *
279
+ * Example: \include Tridiagonalization_diagonal.cpp
280
+ * Output: \verbinclude Tridiagonalization_diagonal.out
281
+ *
282
+ * \sa matrixT(), subDiagonal()
283
+ */
284
+ DiagonalReturnType diagonal() const;
285
+
286
+ /** \brief Returns the subdiagonal of the tridiagonal matrix T in the decomposition.
287
+ *
288
+ * \returns expression representing the subdiagonal of T
289
+ *
290
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
291
+ * the member function compute(const MatrixType&) has been called before
292
+ * to compute the tridiagonal decomposition of a matrix.
293
+ *
294
+ * \sa diagonal() for an example, matrixT()
295
+ */
296
+ SubDiagonalReturnType subDiagonal() const;
297
+
298
+ protected:
299
+
300
+ MatrixType m_matrix;
301
+ CoeffVectorType m_hCoeffs;
302
+ bool m_isInitialized;
303
+ };
304
+
305
+ template<typename MatrixType>
306
+ typename Tridiagonalization<MatrixType>::DiagonalReturnType
307
+ Tridiagonalization<MatrixType>::diagonal() const
308
+ {
309
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
310
+ return m_matrix.diagonal().real();
311
+ }
312
+
313
+ template<typename MatrixType>
314
+ typename Tridiagonalization<MatrixType>::SubDiagonalReturnType
315
+ Tridiagonalization<MatrixType>::subDiagonal() const
316
+ {
317
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
318
+ return m_matrix.template diagonal<-1>().real();
319
+ }
320
+
321
+ namespace internal {
322
+
323
+ /** \internal
324
+ * Performs a tridiagonal decomposition of the selfadjoint matrix \a matA in-place.
325
+ *
326
+ * \param[in,out] matA On input the selfadjoint matrix. Only the \b lower triangular part is referenced.
327
+ * On output, the strict upper part is left unchanged, and the lower triangular part
328
+ * represents the T and Q matrices in packed format has detailed below.
329
+ * \param[out] hCoeffs returned Householder coefficients (see below)
330
+ *
331
+ * On output, the tridiagonal selfadjoint matrix T is stored in the diagonal
332
+ * and lower sub-diagonal of the matrix \a matA.
333
+ * The unitary matrix Q is represented in a compact way as a product of
334
+ * Householder reflectors \f$ H_i \f$ such that:
335
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
336
+ * The Householder reflectors are defined as
337
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
338
+ * where \f$ h_i = hCoeffs[i]\f$ is the \f$ i \f$th Householder coefficient and
339
+ * \f$ v_i \f$ is the Householder vector defined by
340
+ * \f$ v_i = [ 0, \ldots, 0, 1, matA(i+2,i), \ldots, matA(N-1,i) ]^T \f$.
341
+ *
342
+ * Implemented from Golub's "Matrix Computations", algorithm 8.3.1.
343
+ *
344
+ * \sa Tridiagonalization::packedMatrix()
345
+ */
346
+ template<typename MatrixType, typename CoeffVectorType>
347
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
348
+ {
349
+ using numext::conj;
350
+ typedef typename MatrixType::Scalar Scalar;
351
+ typedef typename MatrixType::RealScalar RealScalar;
352
+ Index n = matA.rows();
353
+ eigen_assert(n==matA.cols());
354
+ eigen_assert(n==hCoeffs.size()+1 || n==1);
355
+
356
+ for (Index i = 0; i<n-1; ++i)
357
+ {
358
+ Index remainingSize = n-i-1;
359
+ RealScalar beta;
360
+ Scalar h;
361
+ matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
362
+
363
+ // Apply similarity transformation to remaining columns,
364
+ // i.e., A = H A H' where H = I - h v v' and v = matA.col(i).tail(n-i-1)
365
+ matA.col(i).coeffRef(i+1) = 1;
366
+
367
+ hCoeffs.tail(n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
368
+ * (conj(h) * matA.col(i).tail(remainingSize)));
369
+
370
+ hCoeffs.tail(n-i-1) += (conj(h)*RealScalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1);
371
+
372
+ matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
373
+ .rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), Scalar(-1));
374
+
375
+ matA.col(i).coeffRef(i+1) = beta;
376
+ hCoeffs.coeffRef(i) = h;
377
+ }
378
+ }
379
+
380
+ // forward declaration, implementation at the end of this file
381
+ template<typename MatrixType,
382
+ int Size=MatrixType::ColsAtCompileTime,
383
+ bool IsComplex=NumTraits<typename MatrixType::Scalar>::IsComplex>
384
+ struct tridiagonalization_inplace_selector;
385
+
386
+ /** \brief Performs a full tridiagonalization in place
387
+ *
388
+ * \param[in,out] mat On input, the selfadjoint matrix whose tridiagonal
389
+ * decomposition is to be computed. Only the lower triangular part referenced.
390
+ * The rest is left unchanged. On output, the orthogonal matrix Q
391
+ * in the decomposition if \p extractQ is true.
392
+ * \param[out] diag The diagonal of the tridiagonal matrix T in the
393
+ * decomposition.
394
+ * \param[out] subdiag The subdiagonal of the tridiagonal matrix T in
395
+ * the decomposition.
396
+ * \param[in] extractQ If true, the orthogonal matrix Q in the
397
+ * decomposition is computed and stored in \p mat.
398
+ *
399
+ * Computes the tridiagonal decomposition of the selfadjoint matrix \p mat in place
400
+ * such that \f$ mat = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real
401
+ * symmetric tridiagonal matrix.
402
+ *
403
+ * The tridiagonal matrix T is passed to the output parameters \p diag and \p subdiag. If
404
+ * \p extractQ is true, then the orthogonal matrix Q is passed to \p mat. Otherwise the lower
405
+ * part of the matrix \p mat is destroyed.
406
+ *
407
+ * The vectors \p diag and \p subdiag are not resized. The function
408
+ * assumes that they are already of the correct size. The length of the
409
+ * vector \p diag should equal the number of rows in \p mat, and the
410
+ * length of the vector \p subdiag should be one left.
411
+ *
412
+ * This implementation contains an optimized path for 3-by-3 matrices
413
+ * which is especially useful for plane fitting.
414
+ *
415
+ * \note Currently, it requires two temporary vectors to hold the intermediate
416
+ * Householder coefficients, and to reconstruct the matrix Q from the Householder
417
+ * reflectors.
418
+ *
419
+ * Example (this uses the same matrix as the example in
420
+ * Tridiagonalization::Tridiagonalization(const MatrixType&)):
421
+ * \include Tridiagonalization_decomposeInPlace.cpp
422
+ * Output: \verbinclude Tridiagonalization_decomposeInPlace.out
423
+ *
424
+ * \sa class Tridiagonalization
425
+ */
426
+ template<typename MatrixType, typename DiagonalType, typename SubDiagonalType>
427
+ void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
428
+ {
429
+ eigen_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1);
430
+ tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, extractQ);
431
+ }
432
+
433
+ /** \internal
434
+ * General full tridiagonalization
435
+ */
436
+ template<typename MatrixType, int Size, bool IsComplex>
437
+ struct tridiagonalization_inplace_selector
438
+ {
439
+ typedef typename Tridiagonalization<MatrixType>::CoeffVectorType CoeffVectorType;
440
+ typedef typename Tridiagonalization<MatrixType>::HouseholderSequenceType HouseholderSequenceType;
441
+ template<typename DiagonalType, typename SubDiagonalType>
442
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
443
+ {
444
+ CoeffVectorType hCoeffs(mat.cols()-1);
445
+ tridiagonalization_inplace(mat,hCoeffs);
446
+ diag = mat.diagonal().real();
447
+ subdiag = mat.template diagonal<-1>().real();
448
+ if(extractQ)
449
+ mat = HouseholderSequenceType(mat, hCoeffs.conjugate())
450
+ .setLength(mat.rows() - 1)
451
+ .setShift(1);
452
+ }
453
+ };
454
+
455
+ /** \internal
456
+ * Specialization for 3x3 real matrices.
457
+ * Especially useful for plane fitting.
458
+ */
459
+ template<typename MatrixType>
460
+ struct tridiagonalization_inplace_selector<MatrixType,3,false>
461
+ {
462
+ typedef typename MatrixType::Scalar Scalar;
463
+ typedef typename MatrixType::RealScalar RealScalar;
464
+
465
+ template<typename DiagonalType, typename SubDiagonalType>
466
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, bool extractQ)
467
+ {
468
+ using std::sqrt;
469
+ const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
470
+ diag[0] = mat(0,0);
471
+ RealScalar v1norm2 = numext::abs2(mat(2,0));
472
+ if(v1norm2 <= tol)
473
+ {
474
+ diag[1] = mat(1,1);
475
+ diag[2] = mat(2,2);
476
+ subdiag[0] = mat(1,0);
477
+ subdiag[1] = mat(2,1);
478
+ if (extractQ)
479
+ mat.setIdentity();
480
+ }
481
+ else
482
+ {
483
+ RealScalar beta = sqrt(numext::abs2(mat(1,0)) + v1norm2);
484
+ RealScalar invBeta = RealScalar(1)/beta;
485
+ Scalar m01 = mat(1,0) * invBeta;
486
+ Scalar m02 = mat(2,0) * invBeta;
487
+ Scalar q = RealScalar(2)*m01*mat(2,1) + m02*(mat(2,2) - mat(1,1));
488
+ diag[1] = mat(1,1) + m02*q;
489
+ diag[2] = mat(2,2) - m02*q;
490
+ subdiag[0] = beta;
491
+ subdiag[1] = mat(2,1) - m01 * q;
492
+ if (extractQ)
493
+ {
494
+ mat << 1, 0, 0,
495
+ 0, m01, m02,
496
+ 0, m02, -m01;
497
+ }
498
+ }
499
+ }
500
+ };
501
+
502
+ /** \internal
503
+ * Trivial specialization for 1x1 matrices
504
+ */
505
+ template<typename MatrixType, bool IsComplex>
506
+ struct tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
507
+ {
508
+ typedef typename MatrixType::Scalar Scalar;
509
+
510
+ template<typename DiagonalType, typename SubDiagonalType>
511
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, bool extractQ)
512
+ {
513
+ diag(0,0) = numext::real(mat(0,0));
514
+ if(extractQ)
515
+ mat(0,0) = Scalar(1);
516
+ }
517
+ };
518
+
519
+ /** \internal
520
+ * \eigenvalues_module \ingroup Eigenvalues_Module
521
+ *
522
+ * \brief Expression type for return value of Tridiagonalization::matrixT()
523
+ *
524
+ * \tparam MatrixType type of underlying dense matrix
525
+ */
526
+ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
527
+ : public ReturnByValue<TridiagonalizationMatrixTReturnType<MatrixType> >
528
+ {
529
+ public:
530
+ /** \brief Constructor.
531
+ *
532
+ * \param[in] mat The underlying dense matrix
533
+ */
534
+ TridiagonalizationMatrixTReturnType(const MatrixType& mat) : m_matrix(mat) { }
535
+
536
+ template <typename ResultType>
537
+ inline void evalTo(ResultType& result) const
538
+ {
539
+ result.setZero();
540
+ result.template diagonal<1>() = m_matrix.template diagonal<-1>().conjugate();
541
+ result.diagonal() = m_matrix.diagonal();
542
+ result.template diagonal<-1>() = m_matrix.template diagonal<-1>();
543
+ }
544
+
545
+ Index rows() const { return m_matrix.rows(); }
546
+ Index cols() const { return m_matrix.cols(); }
547
+
548
+ protected:
549
+ typename MatrixType::Nested m_matrix;
550
+ };
551
+
552
+ } // end namespace internal
553
+
554
+ } // end namespace Eigen
555
+
556
+ #endif // EIGEN_TRIDIAGONALIZATION_H