umappp 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +25 -0
  3. data/README.md +110 -0
  4. data/ext/umappp/extconf.rb +25 -0
  5. data/ext/umappp/numo.hpp +867 -0
  6. data/ext/umappp/umappp.cpp +225 -0
  7. data/lib/umappp/version.rb +5 -0
  8. data/lib/umappp.rb +41 -0
  9. data/vendor/Eigen/Cholesky +45 -0
  10. data/vendor/Eigen/CholmodSupport +48 -0
  11. data/vendor/Eigen/Core +384 -0
  12. data/vendor/Eigen/Dense +7 -0
  13. data/vendor/Eigen/Eigen +2 -0
  14. data/vendor/Eigen/Eigenvalues +60 -0
  15. data/vendor/Eigen/Geometry +59 -0
  16. data/vendor/Eigen/Householder +29 -0
  17. data/vendor/Eigen/IterativeLinearSolvers +48 -0
  18. data/vendor/Eigen/Jacobi +32 -0
  19. data/vendor/Eigen/KLUSupport +41 -0
  20. data/vendor/Eigen/LU +47 -0
  21. data/vendor/Eigen/MetisSupport +35 -0
  22. data/vendor/Eigen/OrderingMethods +70 -0
  23. data/vendor/Eigen/PaStiXSupport +49 -0
  24. data/vendor/Eigen/PardisoSupport +35 -0
  25. data/vendor/Eigen/QR +50 -0
  26. data/vendor/Eigen/QtAlignedMalloc +39 -0
  27. data/vendor/Eigen/SPQRSupport +34 -0
  28. data/vendor/Eigen/SVD +50 -0
  29. data/vendor/Eigen/Sparse +34 -0
  30. data/vendor/Eigen/SparseCholesky +37 -0
  31. data/vendor/Eigen/SparseCore +69 -0
  32. data/vendor/Eigen/SparseLU +50 -0
  33. data/vendor/Eigen/SparseQR +36 -0
  34. data/vendor/Eigen/StdDeque +27 -0
  35. data/vendor/Eigen/StdList +26 -0
  36. data/vendor/Eigen/StdVector +27 -0
  37. data/vendor/Eigen/SuperLUSupport +64 -0
  38. data/vendor/Eigen/UmfPackSupport +40 -0
  39. data/vendor/Eigen/src/Cholesky/LDLT.h +688 -0
  40. data/vendor/Eigen/src/Cholesky/LLT.h +558 -0
  41. data/vendor/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  42. data/vendor/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
  43. data/vendor/Eigen/src/Core/ArithmeticSequence.h +413 -0
  44. data/vendor/Eigen/src/Core/Array.h +417 -0
  45. data/vendor/Eigen/src/Core/ArrayBase.h +226 -0
  46. data/vendor/Eigen/src/Core/ArrayWrapper.h +209 -0
  47. data/vendor/Eigen/src/Core/Assign.h +90 -0
  48. data/vendor/Eigen/src/Core/AssignEvaluator.h +1010 -0
  49. data/vendor/Eigen/src/Core/Assign_MKL.h +178 -0
  50. data/vendor/Eigen/src/Core/BandMatrix.h +353 -0
  51. data/vendor/Eigen/src/Core/Block.h +448 -0
  52. data/vendor/Eigen/src/Core/BooleanRedux.h +162 -0
  53. data/vendor/Eigen/src/Core/CommaInitializer.h +164 -0
  54. data/vendor/Eigen/src/Core/ConditionEstimator.h +175 -0
  55. data/vendor/Eigen/src/Core/CoreEvaluators.h +1741 -0
  56. data/vendor/Eigen/src/Core/CoreIterators.h +132 -0
  57. data/vendor/Eigen/src/Core/CwiseBinaryOp.h +183 -0
  58. data/vendor/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
  59. data/vendor/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  60. data/vendor/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  61. data/vendor/Eigen/src/Core/CwiseUnaryView.h +132 -0
  62. data/vendor/Eigen/src/Core/DenseBase.h +701 -0
  63. data/vendor/Eigen/src/Core/DenseCoeffsBase.h +685 -0
  64. data/vendor/Eigen/src/Core/DenseStorage.h +652 -0
  65. data/vendor/Eigen/src/Core/Diagonal.h +258 -0
  66. data/vendor/Eigen/src/Core/DiagonalMatrix.h +391 -0
  67. data/vendor/Eigen/src/Core/DiagonalProduct.h +28 -0
  68. data/vendor/Eigen/src/Core/Dot.h +318 -0
  69. data/vendor/Eigen/src/Core/EigenBase.h +160 -0
  70. data/vendor/Eigen/src/Core/ForceAlignedAccess.h +150 -0
  71. data/vendor/Eigen/src/Core/Fuzzy.h +155 -0
  72. data/vendor/Eigen/src/Core/GeneralProduct.h +465 -0
  73. data/vendor/Eigen/src/Core/GenericPacketMath.h +1040 -0
  74. data/vendor/Eigen/src/Core/GlobalFunctions.h +194 -0
  75. data/vendor/Eigen/src/Core/IO.h +258 -0
  76. data/vendor/Eigen/src/Core/IndexedView.h +237 -0
  77. data/vendor/Eigen/src/Core/Inverse.h +117 -0
  78. data/vendor/Eigen/src/Core/Map.h +171 -0
  79. data/vendor/Eigen/src/Core/MapBase.h +310 -0
  80. data/vendor/Eigen/src/Core/MathFunctions.h +2057 -0
  81. data/vendor/Eigen/src/Core/MathFunctionsImpl.h +200 -0
  82. data/vendor/Eigen/src/Core/Matrix.h +565 -0
  83. data/vendor/Eigen/src/Core/MatrixBase.h +547 -0
  84. data/vendor/Eigen/src/Core/NestByValue.h +85 -0
  85. data/vendor/Eigen/src/Core/NoAlias.h +109 -0
  86. data/vendor/Eigen/src/Core/NumTraits.h +335 -0
  87. data/vendor/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  88. data/vendor/Eigen/src/Core/PermutationMatrix.h +605 -0
  89. data/vendor/Eigen/src/Core/PlainObjectBase.h +1128 -0
  90. data/vendor/Eigen/src/Core/Product.h +191 -0
  91. data/vendor/Eigen/src/Core/ProductEvaluators.h +1179 -0
  92. data/vendor/Eigen/src/Core/Random.h +218 -0
  93. data/vendor/Eigen/src/Core/Redux.h +515 -0
  94. data/vendor/Eigen/src/Core/Ref.h +381 -0
  95. data/vendor/Eigen/src/Core/Replicate.h +142 -0
  96. data/vendor/Eigen/src/Core/Reshaped.h +454 -0
  97. data/vendor/Eigen/src/Core/ReturnByValue.h +119 -0
  98. data/vendor/Eigen/src/Core/Reverse.h +217 -0
  99. data/vendor/Eigen/src/Core/Select.h +164 -0
  100. data/vendor/Eigen/src/Core/SelfAdjointView.h +365 -0
  101. data/vendor/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  102. data/vendor/Eigen/src/Core/Solve.h +188 -0
  103. data/vendor/Eigen/src/Core/SolveTriangular.h +235 -0
  104. data/vendor/Eigen/src/Core/SolverBase.h +168 -0
  105. data/vendor/Eigen/src/Core/StableNorm.h +251 -0
  106. data/vendor/Eigen/src/Core/StlIterators.h +463 -0
  107. data/vendor/Eigen/src/Core/Stride.h +116 -0
  108. data/vendor/Eigen/src/Core/Swap.h +68 -0
  109. data/vendor/Eigen/src/Core/Transpose.h +464 -0
  110. data/vendor/Eigen/src/Core/Transpositions.h +386 -0
  111. data/vendor/Eigen/src/Core/TriangularMatrix.h +1001 -0
  112. data/vendor/Eigen/src/Core/VectorBlock.h +96 -0
  113. data/vendor/Eigen/src/Core/VectorwiseOp.h +784 -0
  114. data/vendor/Eigen/src/Core/Visitor.h +381 -0
  115. data/vendor/Eigen/src/Core/arch/AVX/Complex.h +372 -0
  116. data/vendor/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
  117. data/vendor/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
  118. data/vendor/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
  119. data/vendor/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  120. data/vendor/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
  121. data/vendor/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
  122. data/vendor/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  123. data/vendor/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
  124. data/vendor/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
  125. data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  126. data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  127. data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  128. data/vendor/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
  129. data/vendor/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
  130. data/vendor/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  131. data/vendor/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
  132. data/vendor/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  133. data/vendor/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  134. data/vendor/Eigen/src/Core/arch/Default/Half.h +942 -0
  135. data/vendor/Eigen/src/Core/arch/Default/Settings.h +49 -0
  136. data/vendor/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  137. data/vendor/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
  138. data/vendor/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  139. data/vendor/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  140. data/vendor/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  141. data/vendor/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  142. data/vendor/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  143. data/vendor/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  144. data/vendor/Eigen/src/Core/arch/NEON/Complex.h +584 -0
  145. data/vendor/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  146. data/vendor/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
  147. data/vendor/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
  148. data/vendor/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  149. data/vendor/Eigen/src/Core/arch/SSE/Complex.h +351 -0
  150. data/vendor/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
  151. data/vendor/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
  152. data/vendor/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
  153. data/vendor/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  154. data/vendor/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  155. data/vendor/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  156. data/vendor/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  157. data/vendor/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  158. data/vendor/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  159. data/vendor/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  160. data/vendor/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  161. data/vendor/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
  162. data/vendor/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
  163. data/vendor/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
  164. data/vendor/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
  165. data/vendor/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
  166. data/vendor/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
  167. data/vendor/Eigen/src/Core/functors/StlFunctors.h +166 -0
  168. data/vendor/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  169. data/vendor/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
  170. data/vendor/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
  171. data/vendor/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
  172. data/vendor/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
  173. data/vendor/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  174. data/vendor/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
  175. data/vendor/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
  176. data/vendor/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  177. data/vendor/Eigen/src/Core/products/Parallelizer.h +180 -0
  178. data/vendor/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
  179. data/vendor/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
  180. data/vendor/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
  181. data/vendor/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  182. data/vendor/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  183. data/vendor/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
  184. data/vendor/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
  185. data/vendor/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
  186. data/vendor/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  187. data/vendor/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  188. data/vendor/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
  189. data/vendor/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
  190. data/vendor/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
  191. data/vendor/Eigen/src/Core/util/BlasUtil.h +583 -0
  192. data/vendor/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  193. data/vendor/Eigen/src/Core/util/Constants.h +563 -0
  194. data/vendor/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
  195. data/vendor/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
  196. data/vendor/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  197. data/vendor/Eigen/src/Core/util/IntegralConstant.h +272 -0
  198. data/vendor/Eigen/src/Core/util/MKL_support.h +137 -0
  199. data/vendor/Eigen/src/Core/util/Macros.h +1464 -0
  200. data/vendor/Eigen/src/Core/util/Memory.h +1163 -0
  201. data/vendor/Eigen/src/Core/util/Meta.h +812 -0
  202. data/vendor/Eigen/src/Core/util/NonMPL2.h +3 -0
  203. data/vendor/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
  204. data/vendor/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  205. data/vendor/Eigen/src/Core/util/StaticAssert.h +221 -0
  206. data/vendor/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  207. data/vendor/Eigen/src/Core/util/XprHelper.h +856 -0
  208. data/vendor/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  209. data/vendor/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
  210. data/vendor/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  211. data/vendor/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  212. data/vendor/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  213. data/vendor/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  214. data/vendor/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  215. data/vendor/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  216. data/vendor/Eigen/src/Eigenvalues/RealQZ.h +657 -0
  217. data/vendor/Eigen/src/Eigenvalues/RealSchur.h +558 -0
  218. data/vendor/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  219. data/vendor/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
  220. data/vendor/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  221. data/vendor/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
  222. data/vendor/Eigen/src/Geometry/AlignedBox.h +486 -0
  223. data/vendor/Eigen/src/Geometry/AngleAxis.h +247 -0
  224. data/vendor/Eigen/src/Geometry/EulerAngles.h +114 -0
  225. data/vendor/Eigen/src/Geometry/Homogeneous.h +501 -0
  226. data/vendor/Eigen/src/Geometry/Hyperplane.h +282 -0
  227. data/vendor/Eigen/src/Geometry/OrthoMethods.h +235 -0
  228. data/vendor/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  229. data/vendor/Eigen/src/Geometry/Quaternion.h +870 -0
  230. data/vendor/Eigen/src/Geometry/Rotation2D.h +199 -0
  231. data/vendor/Eigen/src/Geometry/RotationBase.h +206 -0
  232. data/vendor/Eigen/src/Geometry/Scaling.h +188 -0
  233. data/vendor/Eigen/src/Geometry/Transform.h +1563 -0
  234. data/vendor/Eigen/src/Geometry/Translation.h +202 -0
  235. data/vendor/Eigen/src/Geometry/Umeyama.h +166 -0
  236. data/vendor/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  237. data/vendor/Eigen/src/Householder/BlockHouseholder.h +110 -0
  238. data/vendor/Eigen/src/Householder/Householder.h +176 -0
  239. data/vendor/Eigen/src/Householder/HouseholderSequence.h +545 -0
  240. data/vendor/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  241. data/vendor/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
  242. data/vendor/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
  243. data/vendor/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
  244. data/vendor/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
  245. data/vendor/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
  246. data/vendor/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
  247. data/vendor/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
  248. data/vendor/Eigen/src/Jacobi/Jacobi.h +483 -0
  249. data/vendor/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  250. data/vendor/Eigen/src/LU/Determinant.h +117 -0
  251. data/vendor/Eigen/src/LU/FullPivLU.h +877 -0
  252. data/vendor/Eigen/src/LU/InverseImpl.h +432 -0
  253. data/vendor/Eigen/src/LU/PartialPivLU.h +624 -0
  254. data/vendor/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  255. data/vendor/Eigen/src/LU/arch/InverseSize4.h +351 -0
  256. data/vendor/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  257. data/vendor/Eigen/src/OrderingMethods/Amd.h +435 -0
  258. data/vendor/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
  259. data/vendor/Eigen/src/OrderingMethods/Ordering.h +153 -0
  260. data/vendor/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  261. data/vendor/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
  262. data/vendor/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  263. data/vendor/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  264. data/vendor/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
  265. data/vendor/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
  266. data/vendor/Eigen/src/QR/HouseholderQR.h +434 -0
  267. data/vendor/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  268. data/vendor/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
  269. data/vendor/Eigen/src/SVD/BDCSVD.h +1366 -0
  270. data/vendor/Eigen/src/SVD/JacobiSVD.h +812 -0
  271. data/vendor/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  272. data/vendor/Eigen/src/SVD/SVDBase.h +376 -0
  273. data/vendor/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  274. data/vendor/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
  275. data/vendor/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
  276. data/vendor/Eigen/src/SparseCore/AmbiVector.h +378 -0
  277. data/vendor/Eigen/src/SparseCore/CompressedStorage.h +274 -0
  278. data/vendor/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  279. data/vendor/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  280. data/vendor/Eigen/src/SparseCore/SparseAssign.h +270 -0
  281. data/vendor/Eigen/src/SparseCore/SparseBlock.h +571 -0
  282. data/vendor/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  283. data/vendor/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
  284. data/vendor/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
  285. data/vendor/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
  286. data/vendor/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
  287. data/vendor/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  288. data/vendor/Eigen/src/SparseCore/SparseDot.h +98 -0
  289. data/vendor/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  290. data/vendor/Eigen/src/SparseCore/SparseMap.h +305 -0
  291. data/vendor/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
  292. data/vendor/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
  293. data/vendor/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  294. data/vendor/Eigen/src/SparseCore/SparseProduct.h +181 -0
  295. data/vendor/Eigen/src/SparseCore/SparseRedux.h +49 -0
  296. data/vendor/Eigen/src/SparseCore/SparseRef.h +397 -0
  297. data/vendor/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
  298. data/vendor/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  299. data/vendor/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  300. data/vendor/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  301. data/vendor/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  302. data/vendor/Eigen/src/SparseCore/SparseUtil.h +186 -0
  303. data/vendor/Eigen/src/SparseCore/SparseVector.h +478 -0
  304. data/vendor/Eigen/src/SparseCore/SparseView.h +254 -0
  305. data/vendor/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  306. data/vendor/Eigen/src/SparseLU/SparseLU.h +923 -0
  307. data/vendor/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  308. data/vendor/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  309. data/vendor/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  310. data/vendor/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
  311. data/vendor/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  312. data/vendor/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  313. data/vendor/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  314. data/vendor/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  315. data/vendor/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  316. data/vendor/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  317. data/vendor/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  318. data/vendor/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  319. data/vendor/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  320. data/vendor/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  321. data/vendor/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  322. data/vendor/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  323. data/vendor/Eigen/src/SparseQR/SparseQR.h +758 -0
  324. data/vendor/Eigen/src/StlSupport/StdDeque.h +116 -0
  325. data/vendor/Eigen/src/StlSupport/StdList.h +106 -0
  326. data/vendor/Eigen/src/StlSupport/StdVector.h +131 -0
  327. data/vendor/Eigen/src/StlSupport/details.h +84 -0
  328. data/vendor/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
  329. data/vendor/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
  330. data/vendor/Eigen/src/misc/Image.h +82 -0
  331. data/vendor/Eigen/src/misc/Kernel.h +79 -0
  332. data/vendor/Eigen/src/misc/RealSvd2x2.h +55 -0
  333. data/vendor/Eigen/src/misc/blas.h +440 -0
  334. data/vendor/Eigen/src/misc/lapack.h +152 -0
  335. data/vendor/Eigen/src/misc/lapacke.h +16292 -0
  336. data/vendor/Eigen/src/misc/lapacke_mangling.h +17 -0
  337. data/vendor/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
  338. data/vendor/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
  339. data/vendor/Eigen/src/plugins/BlockMethods.h +1442 -0
  340. data/vendor/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  341. data/vendor/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
  342. data/vendor/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  343. data/vendor/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  344. data/vendor/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
  345. data/vendor/Eigen/src/plugins/ReshapedMethods.h +149 -0
  346. data/vendor/aarand/aarand.hpp +114 -0
  347. data/vendor/annoy/annoylib.h +1495 -0
  348. data/vendor/annoy/kissrandom.h +120 -0
  349. data/vendor/annoy/mman.h +242 -0
  350. data/vendor/hnswlib/bruteforce.h +152 -0
  351. data/vendor/hnswlib/hnswalg.h +1192 -0
  352. data/vendor/hnswlib/hnswlib.h +108 -0
  353. data/vendor/hnswlib/space_ip.h +282 -0
  354. data/vendor/hnswlib/space_l2.h +281 -0
  355. data/vendor/hnswlib/visited_list_pool.h +79 -0
  356. data/vendor/irlba/irlba.hpp +575 -0
  357. data/vendor/irlba/lanczos.hpp +212 -0
  358. data/vendor/irlba/parallel.hpp +474 -0
  359. data/vendor/irlba/utils.hpp +224 -0
  360. data/vendor/irlba/wrappers.hpp +228 -0
  361. data/vendor/kmeans/Base.hpp +75 -0
  362. data/vendor/kmeans/Details.hpp +79 -0
  363. data/vendor/kmeans/HartiganWong.hpp +492 -0
  364. data/vendor/kmeans/InitializeKmeansPP.hpp +144 -0
  365. data/vendor/kmeans/InitializeNone.hpp +44 -0
  366. data/vendor/kmeans/InitializePCAPartition.hpp +309 -0
  367. data/vendor/kmeans/InitializeRandom.hpp +91 -0
  368. data/vendor/kmeans/Kmeans.hpp +161 -0
  369. data/vendor/kmeans/Lloyd.hpp +134 -0
  370. data/vendor/kmeans/MiniBatch.hpp +269 -0
  371. data/vendor/kmeans/QuickSearch.hpp +179 -0
  372. data/vendor/kmeans/compute_centroids.hpp +32 -0
  373. data/vendor/kmeans/compute_wcss.hpp +27 -0
  374. data/vendor/kmeans/is_edge_case.hpp +42 -0
  375. data/vendor/kmeans/random.hpp +55 -0
  376. data/vendor/knncolle/Annoy/Annoy.hpp +193 -0
  377. data/vendor/knncolle/BruteForce/BruteForce.hpp +120 -0
  378. data/vendor/knncolle/Hnsw/Hnsw.hpp +225 -0
  379. data/vendor/knncolle/Kmknn/Kmknn.hpp +286 -0
  380. data/vendor/knncolle/VpTree/VpTree.hpp +256 -0
  381. data/vendor/knncolle/knncolle.hpp +34 -0
  382. data/vendor/knncolle/utils/Base.hpp +100 -0
  383. data/vendor/knncolle/utils/NeighborQueue.hpp +94 -0
  384. data/vendor/knncolle/utils/distances.hpp +98 -0
  385. data/vendor/knncolle/utils/find_nearest_neighbors.hpp +112 -0
  386. data/vendor/powerit/PowerIterations.hpp +157 -0
  387. data/vendor/umappp/NeighborList.hpp +37 -0
  388. data/vendor/umappp/Umap.hpp +662 -0
  389. data/vendor/umappp/combine_neighbor_sets.hpp +95 -0
  390. data/vendor/umappp/find_ab.hpp +157 -0
  391. data/vendor/umappp/neighbor_similarities.hpp +136 -0
  392. data/vendor/umappp/optimize_layout.hpp +285 -0
  393. data/vendor/umappp/spectral_init.hpp +181 -0
  394. data/vendor/umappp/umappp.hpp +13 -0
  395. metadata +465 -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,561 @@
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
+ EIGEN_DEVICE_FUNC
29
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs);
30
+ }
31
+
32
+ /** \eigenvalues_module \ingroup Eigenvalues_Module
33
+ *
34
+ *
35
+ * \class Tridiagonalization
36
+ *
37
+ * \brief Tridiagonal decomposition of a selfadjoint matrix
38
+ *
39
+ * \tparam _MatrixType the type of the matrix of which we are computing the
40
+ * tridiagonal decomposition; this is expected to be an instantiation of the
41
+ * Matrix class template.
42
+ *
43
+ * This class performs a tridiagonal decomposition of a selfadjoint matrix \f$ A \f$ such that:
44
+ * \f$ A = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real symmetric tridiagonal matrix.
45
+ *
46
+ * A tridiagonal matrix is a matrix which has nonzero elements only on the
47
+ * main diagonal and the first diagonal below and above it. The Hessenberg
48
+ * decomposition of a selfadjoint matrix is in fact a tridiagonal
49
+ * decomposition. This class is used in SelfAdjointEigenSolver to compute the
50
+ * eigenvalues and eigenvectors of a selfadjoint matrix.
51
+ *
52
+ * Call the function compute() to compute the tridiagonal decomposition of a
53
+ * given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&)
54
+ * constructor which computes the tridiagonal Schur decomposition at
55
+ * construction time. Once the decomposition is computed, you can use the
56
+ * matrixQ() and matrixT() functions to retrieve the matrices Q and T in the
57
+ * decomposition.
58
+ *
59
+ * The documentation of Tridiagonalization(const MatrixType&) contains an
60
+ * example of the typical use of this class.
61
+ *
62
+ * \sa class HessenbergDecomposition, class SelfAdjointEigenSolver
63
+ */
64
+ template<typename _MatrixType> class Tridiagonalization
65
+ {
66
+ public:
67
+
68
+ /** \brief Synonym for the template parameter \p _MatrixType. */
69
+ typedef _MatrixType MatrixType;
70
+
71
+ typedef typename MatrixType::Scalar Scalar;
72
+ typedef typename NumTraits<Scalar>::Real RealScalar;
73
+ typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
74
+
75
+ enum {
76
+ Size = MatrixType::RowsAtCompileTime,
77
+ SizeMinusOne = Size == Dynamic ? Dynamic : (Size > 1 ? Size - 1 : 1),
78
+ Options = MatrixType::Options,
79
+ MaxSize = MatrixType::MaxRowsAtCompileTime,
80
+ MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : (MaxSize > 1 ? MaxSize - 1 : 1)
81
+ };
82
+
83
+ typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> CoeffVectorType;
84
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type DiagonalType;
85
+ typedef Matrix<RealScalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> SubDiagonalType;
86
+ typedef typename internal::remove_all<typename MatrixType::RealReturnType>::type MatrixTypeRealView;
87
+ typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType;
88
+
89
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
90
+ typename internal::add_const_on_value_type<typename Diagonal<const MatrixType>::RealReturnType>::type,
91
+ const Diagonal<const MatrixType>
92
+ >::type DiagonalReturnType;
93
+
94
+ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
95
+ typename internal::add_const_on_value_type<typename Diagonal<const MatrixType, -1>::RealReturnType>::type,
96
+ const Diagonal<const MatrixType, -1>
97
+ >::type SubDiagonalReturnType;
98
+
99
+ /** \brief Return type of matrixQ() */
100
+ typedef HouseholderSequence<MatrixType,typename internal::remove_all<typename CoeffVectorType::ConjugateReturnType>::type> HouseholderSequenceType;
101
+
102
+ /** \brief Default constructor.
103
+ *
104
+ * \param [in] size Positive integer, size of the matrix whose tridiagonal
105
+ * decomposition will be computed.
106
+ *
107
+ * The default constructor is useful in cases in which the user intends to
108
+ * perform decompositions via compute(). The \p size parameter is only
109
+ * used as a hint. It is not an error to give a wrong \p size, but it may
110
+ * impair performance.
111
+ *
112
+ * \sa compute() for an example.
113
+ */
114
+ explicit Tridiagonalization(Index size = Size==Dynamic ? 2 : Size)
115
+ : m_matrix(size,size),
116
+ m_hCoeffs(size > 1 ? size-1 : 1),
117
+ m_isInitialized(false)
118
+ {}
119
+
120
+ /** \brief Constructor; computes tridiagonal decomposition of given matrix.
121
+ *
122
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
123
+ * is to be computed.
124
+ *
125
+ * This constructor calls compute() to compute the tridiagonal decomposition.
126
+ *
127
+ * Example: \include Tridiagonalization_Tridiagonalization_MatrixType.cpp
128
+ * Output: \verbinclude Tridiagonalization_Tridiagonalization_MatrixType.out
129
+ */
130
+ template<typename InputType>
131
+ explicit Tridiagonalization(const EigenBase<InputType>& matrix)
132
+ : m_matrix(matrix.derived()),
133
+ m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1),
134
+ m_isInitialized(false)
135
+ {
136
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
137
+ m_isInitialized = true;
138
+ }
139
+
140
+ /** \brief Computes tridiagonal decomposition of given matrix.
141
+ *
142
+ * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition
143
+ * is to be computed.
144
+ * \returns Reference to \c *this
145
+ *
146
+ * The tridiagonal decomposition is computed by bringing the columns of
147
+ * the matrix successively in the required form using Householder
148
+ * reflections. The cost is \f$ 4n^3/3 \f$ flops, where \f$ n \f$ denotes
149
+ * the size of the given matrix.
150
+ *
151
+ * This method reuses of the allocated data in the Tridiagonalization
152
+ * object, if the size of the matrix does not change.
153
+ *
154
+ * Example: \include Tridiagonalization_compute.cpp
155
+ * Output: \verbinclude Tridiagonalization_compute.out
156
+ */
157
+ template<typename InputType>
158
+ Tridiagonalization& compute(const EigenBase<InputType>& matrix)
159
+ {
160
+ m_matrix = matrix.derived();
161
+ m_hCoeffs.resize(matrix.rows()-1, 1);
162
+ internal::tridiagonalization_inplace(m_matrix, m_hCoeffs);
163
+ m_isInitialized = true;
164
+ return *this;
165
+ }
166
+
167
+ /** \brief Returns the Householder coefficients.
168
+ *
169
+ * \returns a const reference to the vector of Householder coefficients
170
+ *
171
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
172
+ * the member function compute(const MatrixType&) has been called before
173
+ * to compute the tridiagonal decomposition of a matrix.
174
+ *
175
+ * The Householder coefficients allow the reconstruction of the matrix
176
+ * \f$ Q \f$ in the tridiagonal decomposition from the packed data.
177
+ *
178
+ * Example: \include Tridiagonalization_householderCoefficients.cpp
179
+ * Output: \verbinclude Tridiagonalization_householderCoefficients.out
180
+ *
181
+ * \sa packedMatrix(), \ref Householder_Module "Householder module"
182
+ */
183
+ inline CoeffVectorType householderCoefficients() const
184
+ {
185
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
186
+ return m_hCoeffs;
187
+ }
188
+
189
+ /** \brief Returns the internal representation of the decomposition
190
+ *
191
+ * \returns a const reference to a matrix with the internal representation
192
+ * of the decomposition.
193
+ *
194
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
195
+ * the member function compute(const MatrixType&) has been called before
196
+ * to compute the tridiagonal decomposition of a matrix.
197
+ *
198
+ * The returned matrix contains the following information:
199
+ * - the strict upper triangular part is equal to the input matrix A.
200
+ * - the diagonal and lower sub-diagonal represent the real tridiagonal
201
+ * symmetric matrix T.
202
+ * - the rest of the lower part contains the Householder vectors that,
203
+ * combined with Householder coefficients returned by
204
+ * householderCoefficients(), allows to reconstruct the matrix Q as
205
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
206
+ * Here, the matrices \f$ H_i \f$ are the Householder transformations
207
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
208
+ * where \f$ h_i \f$ is the \f$ i \f$th Householder coefficient and
209
+ * \f$ v_i \f$ is the Householder vector defined by
210
+ * \f$ v_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \f$
211
+ * with M the matrix returned by this function.
212
+ *
213
+ * See LAPACK for further details on this packed storage.
214
+ *
215
+ * Example: \include Tridiagonalization_packedMatrix.cpp
216
+ * Output: \verbinclude Tridiagonalization_packedMatrix.out
217
+ *
218
+ * \sa householderCoefficients()
219
+ */
220
+ inline const MatrixType& packedMatrix() const
221
+ {
222
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
223
+ return m_matrix;
224
+ }
225
+
226
+ /** \brief Returns the unitary matrix Q in the decomposition
227
+ *
228
+ * \returns object representing the matrix Q
229
+ *
230
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
231
+ * the member function compute(const MatrixType&) has been called before
232
+ * to compute the tridiagonal decomposition of a matrix.
233
+ *
234
+ * This function returns a light-weight object of template class
235
+ * HouseholderSequence. You can either apply it directly to a matrix or
236
+ * you can convert it to a matrix of type #MatrixType.
237
+ *
238
+ * \sa Tridiagonalization(const MatrixType&) for an example,
239
+ * matrixT(), class HouseholderSequence
240
+ */
241
+ HouseholderSequenceType matrixQ() const
242
+ {
243
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
244
+ return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate())
245
+ .setLength(m_matrix.rows() - 1)
246
+ .setShift(1);
247
+ }
248
+
249
+ /** \brief Returns an expression of the tridiagonal matrix T in the decomposition
250
+ *
251
+ * \returns expression object representing the matrix T
252
+ *
253
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
254
+ * the member function compute(const MatrixType&) has been called before
255
+ * to compute the tridiagonal decomposition of a matrix.
256
+ *
257
+ * Currently, this function can be used to extract the matrix T from internal
258
+ * data and copy it to a dense matrix object. In most cases, it may be
259
+ * sufficient to directly use the packed matrix or the vector expressions
260
+ * returned by diagonal() and subDiagonal() instead of creating a new
261
+ * dense copy matrix with this function.
262
+ *
263
+ * \sa Tridiagonalization(const MatrixType&) for an example,
264
+ * matrixQ(), packedMatrix(), diagonal(), subDiagonal()
265
+ */
266
+ MatrixTReturnType matrixT() const
267
+ {
268
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
269
+ return MatrixTReturnType(m_matrix.real());
270
+ }
271
+
272
+ /** \brief Returns the diagonal of the tridiagonal matrix T in the decomposition.
273
+ *
274
+ * \returns expression representing the diagonal of T
275
+ *
276
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
277
+ * the member function compute(const MatrixType&) has been called before
278
+ * to compute the tridiagonal decomposition of a matrix.
279
+ *
280
+ * Example: \include Tridiagonalization_diagonal.cpp
281
+ * Output: \verbinclude Tridiagonalization_diagonal.out
282
+ *
283
+ * \sa matrixT(), subDiagonal()
284
+ */
285
+ DiagonalReturnType diagonal() const;
286
+
287
+ /** \brief Returns the subdiagonal of the tridiagonal matrix T in the decomposition.
288
+ *
289
+ * \returns expression representing the subdiagonal of T
290
+ *
291
+ * \pre Either the constructor Tridiagonalization(const MatrixType&) or
292
+ * the member function compute(const MatrixType&) has been called before
293
+ * to compute the tridiagonal decomposition of a matrix.
294
+ *
295
+ * \sa diagonal() for an example, matrixT()
296
+ */
297
+ SubDiagonalReturnType subDiagonal() const;
298
+
299
+ protected:
300
+
301
+ MatrixType m_matrix;
302
+ CoeffVectorType m_hCoeffs;
303
+ bool m_isInitialized;
304
+ };
305
+
306
+ template<typename MatrixType>
307
+ typename Tridiagonalization<MatrixType>::DiagonalReturnType
308
+ Tridiagonalization<MatrixType>::diagonal() const
309
+ {
310
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
311
+ return m_matrix.diagonal().real();
312
+ }
313
+
314
+ template<typename MatrixType>
315
+ typename Tridiagonalization<MatrixType>::SubDiagonalReturnType
316
+ Tridiagonalization<MatrixType>::subDiagonal() const
317
+ {
318
+ eigen_assert(m_isInitialized && "Tridiagonalization is not initialized.");
319
+ return m_matrix.template diagonal<-1>().real();
320
+ }
321
+
322
+ namespace internal {
323
+
324
+ /** \internal
325
+ * Performs a tridiagonal decomposition of the selfadjoint matrix \a matA in-place.
326
+ *
327
+ * \param[in,out] matA On input the selfadjoint matrix. Only the \b lower triangular part is referenced.
328
+ * On output, the strict upper part is left unchanged, and the lower triangular part
329
+ * represents the T and Q matrices in packed format has detailed below.
330
+ * \param[out] hCoeffs returned Householder coefficients (see below)
331
+ *
332
+ * On output, the tridiagonal selfadjoint matrix T is stored in the diagonal
333
+ * and lower sub-diagonal of the matrix \a matA.
334
+ * The unitary matrix Q is represented in a compact way as a product of
335
+ * Householder reflectors \f$ H_i \f$ such that:
336
+ * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$.
337
+ * The Householder reflectors are defined as
338
+ * \f$ H_i = (I - h_i v_i v_i^T) \f$
339
+ * where \f$ h_i = hCoeffs[i]\f$ is the \f$ i \f$th Householder coefficient and
340
+ * \f$ v_i \f$ is the Householder vector defined by
341
+ * \f$ v_i = [ 0, \ldots, 0, 1, matA(i+2,i), \ldots, matA(N-1,i) ]^T \f$.
342
+ *
343
+ * Implemented from Golub's "Matrix Computations", algorithm 8.3.1.
344
+ *
345
+ * \sa Tridiagonalization::packedMatrix()
346
+ */
347
+ template<typename MatrixType, typename CoeffVectorType>
348
+ EIGEN_DEVICE_FUNC
349
+ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
350
+ {
351
+ using numext::conj;
352
+ typedef typename MatrixType::Scalar Scalar;
353
+ typedef typename MatrixType::RealScalar RealScalar;
354
+ Index n = matA.rows();
355
+ eigen_assert(n==matA.cols());
356
+ eigen_assert(n==hCoeffs.size()+1 || n==1);
357
+
358
+ for (Index i = 0; i<n-1; ++i)
359
+ {
360
+ Index remainingSize = n-i-1;
361
+ RealScalar beta;
362
+ Scalar h;
363
+ matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
364
+
365
+ // Apply similarity transformation to remaining columns,
366
+ // i.e., A = H A H' where H = I - h v v' and v = matA.col(i).tail(n-i-1)
367
+ matA.col(i).coeffRef(i+1) = 1;
368
+
369
+ hCoeffs.tail(n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
370
+ * (conj(h) * matA.col(i).tail(remainingSize)));
371
+
372
+ 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);
373
+
374
+ matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
375
+ .rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), Scalar(-1));
376
+
377
+ matA.col(i).coeffRef(i+1) = beta;
378
+ hCoeffs.coeffRef(i) = h;
379
+ }
380
+ }
381
+
382
+ // forward declaration, implementation at the end of this file
383
+ template<typename MatrixType,
384
+ int Size=MatrixType::ColsAtCompileTime,
385
+ bool IsComplex=NumTraits<typename MatrixType::Scalar>::IsComplex>
386
+ struct tridiagonalization_inplace_selector;
387
+
388
+ /** \brief Performs a full tridiagonalization in place
389
+ *
390
+ * \param[in,out] mat On input, the selfadjoint matrix whose tridiagonal
391
+ * decomposition is to be computed. Only the lower triangular part referenced.
392
+ * The rest is left unchanged. On output, the orthogonal matrix Q
393
+ * in the decomposition if \p extractQ is true.
394
+ * \param[out] diag The diagonal of the tridiagonal matrix T in the
395
+ * decomposition.
396
+ * \param[out] subdiag The subdiagonal of the tridiagonal matrix T in
397
+ * the decomposition.
398
+ * \param[in] extractQ If true, the orthogonal matrix Q in the
399
+ * decomposition is computed and stored in \p mat.
400
+ *
401
+ * Computes the tridiagonal decomposition of the selfadjoint matrix \p mat in place
402
+ * such that \f$ mat = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real
403
+ * symmetric tridiagonal matrix.
404
+ *
405
+ * The tridiagonal matrix T is passed to the output parameters \p diag and \p subdiag. If
406
+ * \p extractQ is true, then the orthogonal matrix Q is passed to \p mat. Otherwise the lower
407
+ * part of the matrix \p mat is destroyed.
408
+ *
409
+ * The vectors \p diag and \p subdiag are not resized. The function
410
+ * assumes that they are already of the correct size. The length of the
411
+ * vector \p diag should equal the number of rows in \p mat, and the
412
+ * length of the vector \p subdiag should be one left.
413
+ *
414
+ * This implementation contains an optimized path for 3-by-3 matrices
415
+ * which is especially useful for plane fitting.
416
+ *
417
+ * \note Currently, it requires two temporary vectors to hold the intermediate
418
+ * Householder coefficients, and to reconstruct the matrix Q from the Householder
419
+ * reflectors.
420
+ *
421
+ * Example (this uses the same matrix as the example in
422
+ * Tridiagonalization::Tridiagonalization(const MatrixType&)):
423
+ * \include Tridiagonalization_decomposeInPlace.cpp
424
+ * Output: \verbinclude Tridiagonalization_decomposeInPlace.out
425
+ *
426
+ * \sa class Tridiagonalization
427
+ */
428
+ template<typename MatrixType, typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
429
+ EIGEN_DEVICE_FUNC
430
+ void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag,
431
+ CoeffVectorType& hcoeffs, bool extractQ)
432
+ {
433
+ eigen_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1);
434
+ tridiagonalization_inplace_selector<MatrixType>::run(mat, diag, subdiag, hcoeffs, extractQ);
435
+ }
436
+
437
+ /** \internal
438
+ * General full tridiagonalization
439
+ */
440
+ template<typename MatrixType, int Size, bool IsComplex>
441
+ struct tridiagonalization_inplace_selector
442
+ {
443
+ typedef typename Tridiagonalization<MatrixType>::CoeffVectorType CoeffVectorType;
444
+ typedef typename Tridiagonalization<MatrixType>::HouseholderSequenceType HouseholderSequenceType;
445
+ template<typename DiagonalType, typename SubDiagonalType>
446
+ static EIGEN_DEVICE_FUNC
447
+ void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType& hCoeffs, bool extractQ)
448
+ {
449
+ tridiagonalization_inplace(mat, hCoeffs);
450
+ diag = mat.diagonal().real();
451
+ subdiag = mat.template diagonal<-1>().real();
452
+ if(extractQ)
453
+ mat = HouseholderSequenceType(mat, hCoeffs.conjugate())
454
+ .setLength(mat.rows() - 1)
455
+ .setShift(1);
456
+ }
457
+ };
458
+
459
+ /** \internal
460
+ * Specialization for 3x3 real matrices.
461
+ * Especially useful for plane fitting.
462
+ */
463
+ template<typename MatrixType>
464
+ struct tridiagonalization_inplace_selector<MatrixType,3,false>
465
+ {
466
+ typedef typename MatrixType::Scalar Scalar;
467
+ typedef typename MatrixType::RealScalar RealScalar;
468
+
469
+ template<typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
470
+ static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType&, bool extractQ)
471
+ {
472
+ using std::sqrt;
473
+ const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
474
+ diag[0] = mat(0,0);
475
+ RealScalar v1norm2 = numext::abs2(mat(2,0));
476
+ if(v1norm2 <= tol)
477
+ {
478
+ diag[1] = mat(1,1);
479
+ diag[2] = mat(2,2);
480
+ subdiag[0] = mat(1,0);
481
+ subdiag[1] = mat(2,1);
482
+ if (extractQ)
483
+ mat.setIdentity();
484
+ }
485
+ else
486
+ {
487
+ RealScalar beta = sqrt(numext::abs2(mat(1,0)) + v1norm2);
488
+ RealScalar invBeta = RealScalar(1)/beta;
489
+ Scalar m01 = mat(1,0) * invBeta;
490
+ Scalar m02 = mat(2,0) * invBeta;
491
+ Scalar q = RealScalar(2)*m01*mat(2,1) + m02*(mat(2,2) - mat(1,1));
492
+ diag[1] = mat(1,1) + m02*q;
493
+ diag[2] = mat(2,2) - m02*q;
494
+ subdiag[0] = beta;
495
+ subdiag[1] = mat(2,1) - m01 * q;
496
+ if (extractQ)
497
+ {
498
+ mat << 1, 0, 0,
499
+ 0, m01, m02,
500
+ 0, m02, -m01;
501
+ }
502
+ }
503
+ }
504
+ };
505
+
506
+ /** \internal
507
+ * Trivial specialization for 1x1 matrices
508
+ */
509
+ template<typename MatrixType, bool IsComplex>
510
+ struct tridiagonalization_inplace_selector<MatrixType,1,IsComplex>
511
+ {
512
+ typedef typename MatrixType::Scalar Scalar;
513
+
514
+ template<typename DiagonalType, typename SubDiagonalType, typename CoeffVectorType>
515
+ static EIGEN_DEVICE_FUNC
516
+ void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, CoeffVectorType&, bool extractQ)
517
+ {
518
+ diag(0,0) = numext::real(mat(0,0));
519
+ if(extractQ)
520
+ mat(0,0) = Scalar(1);
521
+ }
522
+ };
523
+
524
+ /** \internal
525
+ * \eigenvalues_module \ingroup Eigenvalues_Module
526
+ *
527
+ * \brief Expression type for return value of Tridiagonalization::matrixT()
528
+ *
529
+ * \tparam MatrixType type of underlying dense matrix
530
+ */
531
+ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
532
+ : public ReturnByValue<TridiagonalizationMatrixTReturnType<MatrixType> >
533
+ {
534
+ public:
535
+ /** \brief Constructor.
536
+ *
537
+ * \param[in] mat The underlying dense matrix
538
+ */
539
+ TridiagonalizationMatrixTReturnType(const MatrixType& mat) : m_matrix(mat) { }
540
+
541
+ template <typename ResultType>
542
+ inline void evalTo(ResultType& result) const
543
+ {
544
+ result.setZero();
545
+ result.template diagonal<1>() = m_matrix.template diagonal<-1>().conjugate();
546
+ result.diagonal() = m_matrix.diagonal();
547
+ result.template diagonal<-1>() = m_matrix.template diagonal<-1>();
548
+ }
549
+
550
+ EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); }
551
+ EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }
552
+
553
+ protected:
554
+ typename MatrixType::Nested m_matrix;
555
+ };
556
+
557
+ } // end namespace internal
558
+
559
+ } // end namespace Eigen
560
+
561
+ #endif // EIGEN_TRIDIAGONALIZATION_H