tomoto 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (369) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +8 -10
  4. data/ext/tomoto/ct.cpp +11 -11
  5. data/ext/tomoto/dmr.cpp +14 -13
  6. data/ext/tomoto/dt.cpp +14 -14
  7. data/ext/tomoto/extconf.rb +7 -5
  8. data/ext/tomoto/gdmr.cpp +7 -7
  9. data/ext/tomoto/hdp.cpp +9 -9
  10. data/ext/tomoto/hlda.cpp +13 -13
  11. data/ext/tomoto/hpa.cpp +5 -5
  12. data/ext/tomoto/lda.cpp +42 -39
  13. data/ext/tomoto/llda.cpp +6 -6
  14. data/ext/tomoto/mglda.cpp +15 -15
  15. data/ext/tomoto/pa.cpp +6 -6
  16. data/ext/tomoto/plda.cpp +6 -6
  17. data/ext/tomoto/slda.cpp +8 -8
  18. data/ext/tomoto/{ext.cpp → tomoto.cpp} +8 -8
  19. data/ext/tomoto/utils.h +16 -70
  20. data/lib/tomoto/version.rb +1 -1
  21. data/lib/tomoto.rb +5 -1
  22. data/vendor/EigenRand/EigenRand/Core.h +10 -10
  23. data/vendor/EigenRand/EigenRand/Dists/Basic.h +208 -9
  24. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +52 -31
  25. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +9 -8
  26. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +28 -21
  27. data/vendor/EigenRand/EigenRand/EigenRand +11 -6
  28. data/vendor/EigenRand/EigenRand/Macro.h +13 -7
  29. data/vendor/EigenRand/EigenRand/MorePacketMath.h +348 -740
  30. data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +5 -3
  31. data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +9 -3
  32. data/vendor/EigenRand/EigenRand/PacketFilter.h +11 -253
  33. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +21 -47
  34. data/vendor/EigenRand/EigenRand/RandUtils.h +50 -344
  35. data/vendor/EigenRand/EigenRand/arch/AVX/MorePacketMath.h +619 -0
  36. data/vendor/EigenRand/EigenRand/arch/AVX/PacketFilter.h +149 -0
  37. data/vendor/EigenRand/EigenRand/arch/AVX/RandUtils.h +228 -0
  38. data/vendor/EigenRand/EigenRand/arch/NEON/MorePacketMath.h +473 -0
  39. data/vendor/EigenRand/EigenRand/arch/NEON/PacketFilter.h +142 -0
  40. data/vendor/EigenRand/EigenRand/arch/NEON/RandUtils.h +126 -0
  41. data/vendor/EigenRand/EigenRand/arch/SSE/MorePacketMath.h +501 -0
  42. data/vendor/EigenRand/EigenRand/arch/SSE/PacketFilter.h +133 -0
  43. data/vendor/EigenRand/EigenRand/arch/SSE/RandUtils.h +120 -0
  44. data/vendor/EigenRand/EigenRand/doc.h +24 -12
  45. data/vendor/EigenRand/README.md +57 -4
  46. data/vendor/eigen/COPYING.APACHE +203 -0
  47. data/vendor/eigen/COPYING.BSD +1 -1
  48. data/vendor/eigen/COPYING.MINPACK +51 -52
  49. data/vendor/eigen/Eigen/Cholesky +0 -1
  50. data/vendor/eigen/Eigen/Core +112 -265
  51. data/vendor/eigen/Eigen/Eigenvalues +2 -3
  52. data/vendor/eigen/Eigen/Geometry +5 -8
  53. data/vendor/eigen/Eigen/Householder +0 -1
  54. data/vendor/eigen/Eigen/Jacobi +0 -1
  55. data/vendor/eigen/Eigen/KLUSupport +41 -0
  56. data/vendor/eigen/Eigen/LU +2 -5
  57. data/vendor/eigen/Eigen/OrderingMethods +0 -3
  58. data/vendor/eigen/Eigen/PaStiXSupport +1 -0
  59. data/vendor/eigen/Eigen/PardisoSupport +0 -0
  60. data/vendor/eigen/Eigen/QR +2 -3
  61. data/vendor/eigen/Eigen/QtAlignedMalloc +0 -1
  62. data/vendor/eigen/Eigen/SVD +0 -1
  63. data/vendor/eigen/Eigen/Sparse +0 -2
  64. data/vendor/eigen/Eigen/SparseCholesky +0 -8
  65. data/vendor/eigen/Eigen/SparseLU +4 -0
  66. data/vendor/eigen/Eigen/SparseQR +0 -1
  67. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
  68. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +39 -23
  69. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
  70. data/vendor/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
  71. data/vendor/eigen/Eigen/src/Core/Array.h +99 -11
  72. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +3 -3
  73. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
  74. data/vendor/eigen/Eigen/src/Core/Assign.h +1 -1
  75. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
  76. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
  77. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +16 -16
  78. data/vendor/eigen/Eigen/src/Core/Block.h +56 -60
  79. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
  80. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
  81. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
  82. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +5 -0
  83. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
  84. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
  85. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
  86. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +14 -10
  87. data/vendor/eigen/Eigen/src/Core/DenseBase.h +132 -42
  88. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
  89. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +153 -71
  90. data/vendor/eigen/Eigen/src/Core/Diagonal.h +21 -23
  91. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
  92. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
  93. data/vendor/eigen/Eigen/src/Core/Dot.h +10 -10
  94. data/vendor/eigen/Eigen/src/Core/EigenBase.h +10 -9
  95. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
  96. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +3 -3
  97. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
  98. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +599 -152
  99. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
  100. data/vendor/eigen/Eigen/src/Core/IO.h +40 -7
  101. data/vendor/eigen/Eigen/src/Core/IndexedView.h +237 -0
  102. data/vendor/eigen/Eigen/src/Core/Inverse.h +9 -10
  103. data/vendor/eigen/Eigen/src/Core/Map.h +7 -7
  104. data/vendor/eigen/Eigen/src/Core/MapBase.h +10 -3
  105. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +767 -125
  106. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
  107. data/vendor/eigen/Eigen/src/Core/Matrix.h +131 -25
  108. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +21 -3
  109. data/vendor/eigen/Eigen/src/Core/NestByValue.h +25 -50
  110. data/vendor/eigen/Eigen/src/Core/NoAlias.h +4 -3
  111. data/vendor/eigen/Eigen/src/Core/NumTraits.h +107 -20
  112. data/vendor/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  113. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +3 -31
  114. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +152 -59
  115. data/vendor/eigen/Eigen/src/Core/Product.h +30 -25
  116. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +192 -125
  117. data/vendor/eigen/Eigen/src/Core/Random.h +37 -1
  118. data/vendor/eigen/Eigen/src/Core/Redux.h +180 -170
  119. data/vendor/eigen/Eigen/src/Core/Ref.h +121 -23
  120. data/vendor/eigen/Eigen/src/Core/Replicate.h +8 -8
  121. data/vendor/eigen/Eigen/src/Core/Reshaped.h +454 -0
  122. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
  123. data/vendor/eigen/Eigen/src/Core/Reverse.h +18 -12
  124. data/vendor/eigen/Eigen/src/Core/Select.h +8 -6
  125. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
  126. data/vendor/eigen/Eigen/src/Core/Solve.h +14 -14
  127. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +16 -16
  128. data/vendor/eigen/Eigen/src/Core/SolverBase.h +41 -3
  129. data/vendor/eigen/Eigen/src/Core/StableNorm.h +100 -70
  130. data/vendor/eigen/Eigen/src/Core/StlIterators.h +463 -0
  131. data/vendor/eigen/Eigen/src/Core/Stride.h +9 -4
  132. data/vendor/eigen/Eigen/src/Core/Swap.h +5 -4
  133. data/vendor/eigen/Eigen/src/Core/Transpose.h +88 -27
  134. data/vendor/eigen/Eigen/src/Core/Transpositions.h +26 -47
  135. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +93 -75
  136. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +5 -5
  137. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
  138. data/vendor/eigen/Eigen/src/Core/Visitor.h +137 -29
  139. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
  140. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
  141. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
  142. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
  143. data/vendor/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +207 -236
  145. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1482 -495
  146. data/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
  148. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
  149. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
  153. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
  154. data/vendor/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  155. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
  156. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  157. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  158. data/vendor/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
  160. data/vendor/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  161. data/vendor/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
  162. data/vendor/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  163. data/vendor/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  164. data/vendor/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  165. data/vendor/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  166. data/vendor/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  167. data/vendor/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  168. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
  169. data/vendor/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  170. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
  171. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
  172. data/vendor/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  173. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
  174. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
  175. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
  176. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
  177. data/vendor/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  178. data/vendor/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  179. data/vendor/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  180. data/vendor/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  181. data/vendor/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  182. data/vendor/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  183. data/vendor/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  184. data/vendor/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  185. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
  186. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
  187. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
  188. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
  189. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
  190. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
  191. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
  192. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +355 -16
  193. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1075 -586
  194. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +49 -24
  195. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +41 -35
  196. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +6 -6
  197. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +4 -2
  198. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
  199. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +22 -5
  200. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +53 -30
  201. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +16 -8
  202. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
  203. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +4 -4
  204. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
  205. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +33 -27
  206. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +14 -12
  207. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +36 -34
  208. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +8 -4
  209. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
  210. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +304 -119
  211. data/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  212. data/vendor/eigen/Eigen/src/Core/util/Constants.h +25 -9
  213. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +26 -3
  214. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +29 -9
  215. data/vendor/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  216. data/vendor/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
  217. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
  218. data/vendor/eigen/Eigen/src/Core/util/Macros.h +709 -246
  219. data/vendor/eigen/Eigen/src/Core/util/Memory.h +222 -52
  220. data/vendor/eigen/Eigen/src/Core/util/Meta.h +355 -77
  221. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +5 -1
  222. data/vendor/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  223. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
  224. data/vendor/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  225. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +65 -30
  226. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
  227. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +7 -4
  228. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
  229. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
  230. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
  231. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
  232. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
  233. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +21 -9
  234. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +77 -43
  235. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
  236. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
  237. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
  238. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
  239. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
  240. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
  241. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
  242. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
  243. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +70 -14
  244. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
  245. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +23 -5
  246. data/vendor/eigen/Eigen/src/Geometry/Transform.h +88 -67
  247. data/vendor/eigen/Eigen/src/Geometry/Translation.h +6 -12
  248. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +1 -1
  249. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  250. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
  251. data/vendor/eigen/Eigen/src/Householder/Householder.h +8 -4
  252. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
  253. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
  254. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
  255. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
  256. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
  257. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
  258. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
  259. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
  260. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
  261. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
  262. data/vendor/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  263. data/vendor/eigen/Eigen/src/LU/Determinant.h +35 -19
  264. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +29 -43
  265. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +25 -8
  266. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +71 -58
  267. data/vendor/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
  268. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
  269. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
  270. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
  271. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
  272. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +9 -7
  273. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
  274. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
  275. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
  276. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
  277. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
  278. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +183 -63
  279. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
  280. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +83 -22
  281. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
  282. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +17 -9
  283. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +12 -37
  284. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +3 -2
  285. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
  286. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
  287. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
  288. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
  289. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
  290. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
  291. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +4 -2
  292. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
  293. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +126 -11
  294. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
  295. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
  296. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
  297. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +5 -2
  298. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
  299. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
  300. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +1 -0
  301. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +162 -12
  302. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
  303. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
  304. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
  305. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
  306. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
  307. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
  308. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +2 -12
  309. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +2 -2
  310. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
  311. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
  312. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
  313. data/vendor/eigen/Eigen/src/misc/lapacke.h +5 -4
  314. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +28 -2
  315. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
  316. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
  317. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
  318. data/vendor/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  319. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
  320. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
  321. data/vendor/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
  322. data/vendor/eigen/README.md +2 -0
  323. data/vendor/eigen/bench/btl/README +1 -1
  324. data/vendor/eigen/bench/tensors/README +6 -7
  325. data/vendor/eigen/ci/README.md +56 -0
  326. data/vendor/eigen/demos/mix_eigen_and_c/README +1 -1
  327. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +213 -158
  328. data/vendor/eigen/unsupported/README.txt +1 -1
  329. data/vendor/tomotopy/README.kr.rst +78 -0
  330. data/vendor/tomotopy/README.rst +75 -0
  331. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +2 -2
  332. data/vendor/tomotopy/src/Labeling/Phraser.hpp +4 -4
  333. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +7 -3
  334. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +7 -3
  335. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +6 -3
  336. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +2 -2
  337. data/vendor/tomotopy/src/TopicModel/HDP.h +1 -0
  338. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +57 -6
  339. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +6 -3
  340. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +3 -2
  341. data/vendor/tomotopy/src/TopicModel/LDA.h +3 -3
  342. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +5 -5
  343. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +50 -19
  344. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +6 -2
  345. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +3 -2
  346. data/vendor/tomotopy/src/TopicModel/PAModel.hpp +1 -1
  347. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +6 -2
  348. data/vendor/tomotopy/src/TopicModel/PT.h +3 -1
  349. data/vendor/tomotopy/src/TopicModel/PTModel.hpp +36 -3
  350. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +6 -3
  351. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +55 -26
  352. data/vendor/tomotopy/src/Utils/AliasMethod.hpp +5 -4
  353. data/vendor/tomotopy/src/Utils/Dictionary.h +2 -2
  354. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +36 -1
  355. data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +1 -1
  356. data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +1 -1
  357. data/vendor/tomotopy/src/Utils/exception.h +6 -0
  358. data/vendor/tomotopy/src/Utils/math.h +2 -2
  359. data/vendor/tomotopy/src/Utils/sample.hpp +14 -12
  360. data/vendor/tomotopy/src/Utils/serializer.hpp +30 -5
  361. data/vendor/tomotopy/src/Utils/sse_gamma.h +0 -3
  362. metadata +64 -18
  363. data/vendor/eigen/Eigen/CMakeLists.txt +0 -19
  364. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -674
  365. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  366. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  367. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  368. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  369. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
@@ -39,6 +39,7 @@ template<int n> struct decrement_size
39
39
  * MatrixBase::applyHouseholderOnTheRight()
40
40
  */
41
41
  template<typename Derived>
42
+ EIGEN_DEVICE_FUNC
42
43
  void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
43
44
  {
44
45
  VectorBlock<Derived, internal::decrement_size<Base::SizeAtCompileTime>::ret> essentialPart(derived(), 1, size()-1);
@@ -62,6 +63,7 @@ void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
62
63
  */
63
64
  template<typename Derived>
64
65
  template<typename EssentialPart>
66
+ EIGEN_DEVICE_FUNC
65
67
  void MatrixBase<Derived>::makeHouseholder(
66
68
  EssentialPart& essential,
67
69
  Scalar& tau,
@@ -103,13 +105,14 @@ void MatrixBase<Derived>::makeHouseholder(
103
105
  * \param essential the essential part of the vector \c v
104
106
  * \param tau the scaling factor of the Householder transformation
105
107
  * \param workspace a pointer to working space with at least
106
- * this->cols() * essential.size() entries
108
+ * this->cols() entries
107
109
  *
108
110
  * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
109
111
  * MatrixBase::applyHouseholderOnTheRight()
110
112
  */
111
113
  template<typename Derived>
112
114
  template<typename EssentialPart>
115
+ EIGEN_DEVICE_FUNC
113
116
  void MatrixBase<Derived>::applyHouseholderOnTheLeft(
114
117
  const EssentialPart& essential,
115
118
  const Scalar& tau,
@@ -140,13 +143,14 @@ void MatrixBase<Derived>::applyHouseholderOnTheLeft(
140
143
  * \param essential the essential part of the vector \c v
141
144
  * \param tau the scaling factor of the Householder transformation
142
145
  * \param workspace a pointer to working space with at least
143
- * this->cols() * essential.size() entries
146
+ * this->rows() entries
144
147
  *
145
148
  * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
146
149
  * MatrixBase::applyHouseholderOnTheLeft()
147
150
  */
148
151
  template<typename Derived>
149
152
  template<typename EssentialPart>
153
+ EIGEN_DEVICE_FUNC
150
154
  void MatrixBase<Derived>::applyHouseholderOnTheRight(
151
155
  const EssentialPart& essential,
152
156
  const Scalar& tau,
@@ -160,10 +164,10 @@ void MatrixBase<Derived>::applyHouseholderOnTheRight(
160
164
  {
161
165
  Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace,rows());
162
166
  Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols()-1);
163
- tmp.noalias() = right * essential.conjugate();
167
+ tmp.noalias() = right * essential;
164
168
  tmp += this->col(0);
165
169
  this->col(0) -= tau * tmp;
166
- right.noalias() -= tau * tmp * essential.transpose();
170
+ right.noalias() -= tau * tmp * essential.adjoint();
167
171
  }
168
172
  }
169
173
 
@@ -11,7 +11,7 @@
11
11
  #ifndef EIGEN_HOUSEHOLDER_SEQUENCE_H
12
12
  #define EIGEN_HOUSEHOLDER_SEQUENCE_H
13
13
 
14
- namespace Eigen {
14
+ namespace Eigen {
15
15
 
16
16
  /** \ingroup Householder_Module
17
17
  * \householder_module
@@ -34,8 +34,8 @@ namespace Eigen {
34
34
  * form \f$ H = \prod_{i=0}^{n-1} H_i \f$ where the i-th Householder reflection is \f$ H_i = I - h_i v_i
35
35
  * v_i^* \f$. The i-th Householder coefficient \f$ h_i \f$ is a scalar and the i-th Householder vector \f$
36
36
  * v_i \f$ is a vector of the form
37
- * \f[
38
- * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
37
+ * \f[
38
+ * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
39
39
  * \f]
40
40
  * The last \f$ n-i \f$ entries of \f$ v_i \f$ are called the essential part of the Householder vector.
41
41
  *
@@ -87,7 +87,7 @@ struct hseq_side_dependent_impl
87
87
  {
88
88
  typedef Block<const VectorsType, Dynamic, 1> EssentialVectorType;
89
89
  typedef HouseholderSequence<VectorsType, CoeffsType, OnTheLeft> HouseholderSequenceType;
90
- static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k)
90
+ static EIGEN_DEVICE_FUNC inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k)
91
91
  {
92
92
  Index start = k+1+h.m_shift;
93
93
  return Block<const VectorsType,Dynamic,1>(h.m_vectors, start, k, h.rows()-start, 1);
@@ -120,7 +120,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
120
120
  : public EigenBase<HouseholderSequence<VectorsType,CoeffsType,Side> >
121
121
  {
122
122
  typedef typename internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType EssentialVectorType;
123
-
123
+
124
124
  public:
125
125
  enum {
126
126
  RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime,
@@ -140,6 +140,28 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
140
140
  Side
141
141
  > ConjugateReturnType;
142
142
 
143
+ typedef HouseholderSequence<
144
+ VectorsType,
145
+ typename internal::conditional<NumTraits<Scalar>::IsComplex,
146
+ typename internal::remove_all<typename CoeffsType::ConjugateReturnType>::type,
147
+ CoeffsType>::type,
148
+ Side
149
+ > AdjointReturnType;
150
+
151
+ typedef HouseholderSequence<
152
+ typename internal::conditional<NumTraits<Scalar>::IsComplex,
153
+ typename internal::remove_all<typename VectorsType::ConjugateReturnType>::type,
154
+ VectorsType>::type,
155
+ CoeffsType,
156
+ Side
157
+ > TransposeReturnType;
158
+
159
+ typedef HouseholderSequence<
160
+ typename internal::add_const<VectorsType>::type,
161
+ typename internal::add_const<CoeffsType>::type,
162
+ Side
163
+ > ConstHouseholderSequence;
164
+
143
165
  /** \brief Constructor.
144
166
  * \param[in] v %Matrix containing the essential parts of the Householder vectors
145
167
  * \param[in] h Vector containing the Householder coefficients
@@ -157,33 +179,37 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
157
179
  *
158
180
  * \sa setLength(), setShift()
159
181
  */
182
+ EIGEN_DEVICE_FUNC
160
183
  HouseholderSequence(const VectorsType& v, const CoeffsType& h)
161
- : m_vectors(v), m_coeffs(h), m_trans(false), m_length(v.diagonalSize()),
184
+ : m_vectors(v), m_coeffs(h), m_reverse(false), m_length(v.diagonalSize()),
162
185
  m_shift(0)
163
186
  {
164
187
  }
165
188
 
166
189
  /** \brief Copy constructor. */
190
+ EIGEN_DEVICE_FUNC
167
191
  HouseholderSequence(const HouseholderSequence& other)
168
192
  : m_vectors(other.m_vectors),
169
193
  m_coeffs(other.m_coeffs),
170
- m_trans(other.m_trans),
194
+ m_reverse(other.m_reverse),
171
195
  m_length(other.m_length),
172
196
  m_shift(other.m_shift)
173
197
  {
174
198
  }
175
199
 
176
200
  /** \brief Number of rows of transformation viewed as a matrix.
177
- * \returns Number of rows
201
+ * \returns Number of rows
178
202
  * \details This equals the dimension of the space that the transformation acts on.
179
203
  */
180
- Index rows() const { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); }
204
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
205
+ Index rows() const EIGEN_NOEXCEPT { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); }
181
206
 
182
207
  /** \brief Number of columns of transformation viewed as a matrix.
183
208
  * \returns Number of columns
184
209
  * \details This equals the dimension of the space that the transformation acts on.
185
210
  */
186
- Index cols() const { return rows(); }
211
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
212
+ Index cols() const EIGEN_NOEXCEPT { return rows(); }
187
213
 
188
214
  /** \brief Essential part of a Householder vector.
189
215
  * \param[in] k Index of Householder reflection
@@ -191,14 +217,15 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
191
217
  *
192
218
  * This function returns the essential part of the Householder vector \f$ v_i \f$. This is a vector of
193
219
  * length \f$ n-i \f$ containing the last \f$ n-i \f$ entries of the vector
194
- * \f[
195
- * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
220
+ * \f[
221
+ * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
196
222
  * \f]
197
223
  * The index \f$ i \f$ equals \p k + shift(), corresponding to the k-th column of the matrix \p v
198
224
  * passed to the constructor.
199
225
  *
200
226
  * \sa setShift(), shift()
201
227
  */
228
+ EIGEN_DEVICE_FUNC
202
229
  const EssentialVectorType essentialVector(Index k) const
203
230
  {
204
231
  eigen_assert(k >= 0 && k < m_length);
@@ -206,31 +233,51 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
206
233
  }
207
234
 
208
235
  /** \brief %Transpose of the Householder sequence. */
209
- HouseholderSequence transpose() const
236
+ TransposeReturnType transpose() const
210
237
  {
211
- return HouseholderSequence(*this).setTrans(!m_trans);
238
+ return TransposeReturnType(m_vectors.conjugate(), m_coeffs)
239
+ .setReverseFlag(!m_reverse)
240
+ .setLength(m_length)
241
+ .setShift(m_shift);
212
242
  }
213
243
 
214
244
  /** \brief Complex conjugate of the Householder sequence. */
215
245
  ConjugateReturnType conjugate() const
216
246
  {
217
247
  return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate())
218
- .setTrans(m_trans)
248
+ .setReverseFlag(m_reverse)
219
249
  .setLength(m_length)
220
250
  .setShift(m_shift);
221
251
  }
222
252
 
253
+ /** \returns an expression of the complex conjugate of \c *this if Cond==true,
254
+ * returns \c *this otherwise.
255
+ */
256
+ template<bool Cond>
257
+ EIGEN_DEVICE_FUNC
258
+ inline typename internal::conditional<Cond,ConjugateReturnType,ConstHouseholderSequence>::type
259
+ conjugateIf() const
260
+ {
261
+ typedef typename internal::conditional<Cond,ConjugateReturnType,ConstHouseholderSequence>::type ReturnType;
262
+ return ReturnType(m_vectors.template conjugateIf<Cond>(), m_coeffs.template conjugateIf<Cond>());
263
+ }
264
+
223
265
  /** \brief Adjoint (conjugate transpose) of the Householder sequence. */
224
- ConjugateReturnType adjoint() const
266
+ AdjointReturnType adjoint() const
225
267
  {
226
- return conjugate().setTrans(!m_trans);
268
+ return AdjointReturnType(m_vectors, m_coeffs.conjugate())
269
+ .setReverseFlag(!m_reverse)
270
+ .setLength(m_length)
271
+ .setShift(m_shift);
227
272
  }
228
273
 
229
274
  /** \brief Inverse of the Householder sequence (equals the adjoint). */
230
- ConjugateReturnType inverse() const { return adjoint(); }
275
+ AdjointReturnType inverse() const { return adjoint(); }
231
276
 
232
277
  /** \internal */
233
- template<typename DestType> inline void evalTo(DestType& dst) const
278
+ template<typename DestType>
279
+ inline EIGEN_DEVICE_FUNC
280
+ void evalTo(DestType& dst) const
234
281
  {
235
282
  Matrix<Scalar, DestType::RowsAtCompileTime, 1,
236
283
  AutoAlign|ColMajor, DestType::MaxRowsAtCompileTime, 1> workspace(rows());
@@ -239,6 +286,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
239
286
 
240
287
  /** \internal */
241
288
  template<typename Dest, typename Workspace>
289
+ EIGEN_DEVICE_FUNC
242
290
  void evalTo(Dest& dst, Workspace& workspace) const
243
291
  {
244
292
  workspace.resize(rows());
@@ -251,7 +299,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
251
299
  for(Index k = vecs-1; k >= 0; --k)
252
300
  {
253
301
  Index cornerSize = rows() - k - m_shift;
254
- if(m_trans)
302
+ if(m_reverse)
255
303
  dst.bottomRightCorner(cornerSize, cornerSize)
256
304
  .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
257
305
  else
@@ -265,18 +313,26 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
265
313
  for(Index k = 0; k<cols()-vecs ; ++k)
266
314
  dst.col(k).tail(rows()-k-1).setZero();
267
315
  }
316
+ else if(m_length>BlockSize)
317
+ {
318
+ dst.setIdentity(rows(), rows());
319
+ if(m_reverse)
320
+ applyThisOnTheLeft(dst,workspace,true);
321
+ else
322
+ applyThisOnTheLeft(dst,workspace,true);
323
+ }
268
324
  else
269
325
  {
270
326
  dst.setIdentity(rows(), rows());
271
327
  for(Index k = vecs-1; k >= 0; --k)
272
328
  {
273
329
  Index cornerSize = rows() - k - m_shift;
274
- if(m_trans)
330
+ if(m_reverse)
275
331
  dst.bottomRightCorner(cornerSize, cornerSize)
276
- .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
332
+ .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
277
333
  else
278
334
  dst.bottomRightCorner(cornerSize, cornerSize)
279
- .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
335
+ .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data());
280
336
  }
281
337
  }
282
338
  }
@@ -295,42 +351,52 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
295
351
  workspace.resize(dst.rows());
296
352
  for(Index k = 0; k < m_length; ++k)
297
353
  {
298
- Index actual_k = m_trans ? m_length-k-1 : k;
354
+ Index actual_k = m_reverse ? m_length-k-1 : k;
299
355
  dst.rightCols(rows()-m_shift-actual_k)
300
356
  .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
301
357
  }
302
358
  }
303
359
 
304
360
  /** \internal */
305
- template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const
361
+ template<typename Dest> inline void applyThisOnTheLeft(Dest& dst, bool inputIsIdentity = false) const
306
362
  {
307
363
  Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> workspace;
308
- applyThisOnTheLeft(dst, workspace);
364
+ applyThisOnTheLeft(dst, workspace, inputIsIdentity);
309
365
  }
310
366
 
311
367
  /** \internal */
312
368
  template<typename Dest, typename Workspace>
313
- inline void applyThisOnTheLeft(Dest& dst, Workspace& workspace) const
369
+ inline void applyThisOnTheLeft(Dest& dst, Workspace& workspace, bool inputIsIdentity = false) const
314
370
  {
315
- const Index BlockSize = 48;
371
+ if(inputIsIdentity && m_reverse)
372
+ inputIsIdentity = false;
316
373
  // if the entries are large enough, then apply the reflectors by block
317
374
  if(m_length>=BlockSize && dst.cols()>1)
318
375
  {
319
- for(Index i = 0; i < m_length; i+=BlockSize)
376
+ // Make sure we have at least 2 useful blocks, otherwise it is point-less:
377
+ Index blockSize = m_length<Index(2*BlockSize) ? (m_length+1)/2 : Index(BlockSize);
378
+ for(Index i = 0; i < m_length; i+=blockSize)
320
379
  {
321
- Index end = m_trans ? (std::min)(m_length,i+BlockSize) : m_length-i;
322
- Index k = m_trans ? i : (std::max)(Index(0),end-BlockSize);
380
+ Index end = m_reverse ? (std::min)(m_length,i+blockSize) : m_length-i;
381
+ Index k = m_reverse ? i : (std::max)(Index(0),end-blockSize);
323
382
  Index bs = end-k;
324
383
  Index start = k + m_shift;
325
-
384
+
326
385
  typedef Block<typename internal::remove_all<VectorsType>::type,Dynamic,Dynamic> SubVectorsType;
327
386
  SubVectorsType sub_vecs1(m_vectors.const_cast_derived(), Side==OnTheRight ? k : start,
328
387
  Side==OnTheRight ? start : k,
329
388
  Side==OnTheRight ? bs : m_vectors.rows()-start,
330
389
  Side==OnTheRight ? m_vectors.cols()-start : bs);
331
390
  typename internal::conditional<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&>::type sub_vecs(sub_vecs1);
332
- Block<Dest,Dynamic,Dynamic> sub_dst(dst,dst.rows()-rows()+m_shift+k,0, rows()-m_shift-k,dst.cols());
333
- apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_trans);
391
+
392
+ Index dstStart = dst.rows()-rows()+m_shift+k;
393
+ Index dstRows = rows()-m_shift-k;
394
+ Block<Dest,Dynamic,Dynamic> sub_dst(dst,
395
+ dstStart,
396
+ inputIsIdentity ? dstStart : 0,
397
+ dstRows,
398
+ inputIsIdentity ? dstRows : dst.cols());
399
+ apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);
334
400
  }
335
401
  }
336
402
  else
@@ -338,8 +404,9 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
338
404
  workspace.resize(dst.cols());
339
405
  for(Index k = 0; k < m_length; ++k)
340
406
  {
341
- Index actual_k = m_trans ? k : m_length-k-1;
342
- dst.bottomRows(rows()-m_shift-actual_k)
407
+ Index actual_k = m_reverse ? k : m_length-k-1;
408
+ Index dstStart = rows()-m_shift-actual_k;
409
+ dst.bottomRightCorner(dstStart, inputIsIdentity ? dstStart : dst.cols())
343
410
  .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
344
411
  }
345
412
  }
@@ -357,7 +424,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
357
424
  {
358
425
  typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
359
426
  res(other.template cast<typename internal::matrix_type_times_scalar_type<Scalar,OtherDerived>::ResultScalar>());
360
- applyThisOnTheLeft(res);
427
+ applyThisOnTheLeft(res, internal::is_identity<OtherDerived>::value && res.rows()==res.cols());
361
428
  return res;
362
429
  }
363
430
 
@@ -372,6 +439,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
372
439
  *
373
440
  * \sa length()
374
441
  */
442
+ EIGEN_DEVICE_FUNC
375
443
  HouseholderSequence& setLength(Index length)
376
444
  {
377
445
  m_length = length;
@@ -389,13 +457,17 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
389
457
  *
390
458
  * \sa shift()
391
459
  */
460
+ EIGEN_DEVICE_FUNC
392
461
  HouseholderSequence& setShift(Index shift)
393
462
  {
394
463
  m_shift = shift;
395
464
  return *this;
396
465
  }
397
466
 
467
+ EIGEN_DEVICE_FUNC
398
468
  Index length() const { return m_length; } /**< \brief Returns the length of the Householder sequence. */
469
+
470
+ EIGEN_DEVICE_FUNC
399
471
  Index shift() const { return m_shift; } /**< \brief Returns the shift of the Householder sequence. */
400
472
 
401
473
  /* Necessary for .adjoint() and .conjugate() */
@@ -403,27 +475,30 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
403
475
 
404
476
  protected:
405
477
 
406
- /** \brief Sets the transpose flag.
407
- * \param [in] trans New value of the transpose flag.
478
+ /** \internal
479
+ * \brief Sets the reverse flag.
480
+ * \param [in] reverse New value of the reverse flag.
408
481
  *
409
- * By default, the transpose flag is not set. If the transpose flag is set, then this object represents
410
- * \f$ H^T = H_{n-1}^T \ldots H_1^T H_0^T \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.
482
+ * By default, the reverse flag is not set. If the reverse flag is set, then this object represents
483
+ * \f$ H^r = H_{n-1} \ldots H_1 H_0 \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.
484
+ * \note For real valued HouseholderSequence this is equivalent to transposing \f$ H \f$.
411
485
  *
412
- * \sa trans()
486
+ * \sa reverseFlag(), transpose(), adjoint()
413
487
  */
414
- HouseholderSequence& setTrans(bool trans)
488
+ HouseholderSequence& setReverseFlag(bool reverse)
415
489
  {
416
- m_trans = trans;
490
+ m_reverse = reverse;
417
491
  return *this;
418
492
  }
419
493
 
420
- bool trans() const { return m_trans; } /**< \brief Returns the transpose flag. */
494
+ bool reverseFlag() const { return m_reverse; } /**< \internal \brief Returns the reverse flag. */
421
495
 
422
496
  typename VectorsType::Nested m_vectors;
423
497
  typename CoeffsType::Nested m_coeffs;
424
- bool m_trans;
498
+ bool m_reverse;
425
499
  Index m_length;
426
500
  Index m_shift;
501
+ enum { BlockSize = 48 };
427
502
  };
428
503
 
429
504
  /** \brief Computes the product of a matrix with a Householder sequence.
@@ -444,7 +519,7 @@ typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,Ot
444
519
  }
445
520
 
446
521
  /** \ingroup Householder_Module \householder_module
447
- * \brief Convenience function for constructing a Householder sequence.
522
+ * \brief Convenience function for constructing a Householder sequence.
448
523
  * \returns A HouseholderSequence constructed from the specified arguments.
449
524
  */
450
525
  template<typename VectorsType, typename CoeffsType>
@@ -454,7 +529,7 @@ HouseholderSequence<VectorsType,CoeffsType> householderSequence(const VectorsTyp
454
529
  }
455
530
 
456
531
  /** \ingroup Householder_Module \householder_module
457
- * \brief Convenience function for constructing a Householder sequence.
532
+ * \brief Convenience function for constructing a Householder sequence.
458
533
  * \returns A HouseholderSequence constructed from the specified arguments.
459
534
  * \details This function differs from householderSequence() in that the template argument \p OnTheSide of
460
535
  * the constructed HouseholderSequence is set to OnTheRight, instead of the default OnTheLeft.
@@ -10,7 +10,7 @@
10
10
  #ifndef EIGEN_BASIC_PRECONDITIONERS_H
11
11
  #define EIGEN_BASIC_PRECONDITIONERS_H
12
12
 
13
- namespace Eigen {
13
+ namespace Eigen {
14
14
 
15
15
  /** \ingroup IterativeLinearSolvers_Module
16
16
  * \brief A preconditioner based on the digonal entries
@@ -52,15 +52,15 @@ class DiagonalPreconditioner
52
52
  compute(mat);
53
53
  }
54
54
 
55
- Index rows() const { return m_invdiag.size(); }
56
- Index cols() const { return m_invdiag.size(); }
57
-
55
+ EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_invdiag.size(); }
56
+ EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_invdiag.size(); }
57
+
58
58
  template<typename MatType>
59
59
  DiagonalPreconditioner& analyzePattern(const MatType& )
60
60
  {
61
61
  return *this;
62
62
  }
63
-
63
+
64
64
  template<typename MatType>
65
65
  DiagonalPreconditioner& factorize(const MatType& mat)
66
66
  {
@@ -77,7 +77,7 @@ class DiagonalPreconditioner
77
77
  m_isInitialized = true;
78
78
  return *this;
79
79
  }
80
-
80
+
81
81
  template<typename MatType>
82
82
  DiagonalPreconditioner& compute(const MatType& mat)
83
83
  {
@@ -99,7 +99,7 @@ class DiagonalPreconditioner
99
99
  && "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b");
100
100
  return Solve<DiagonalPreconditioner, Rhs>(*this, b.derived());
101
101
  }
102
-
102
+
103
103
  ComputationInfo info() { return Success; }
104
104
 
105
105
  protected:
@@ -121,7 +121,7 @@ class DiagonalPreconditioner
121
121
  * \implsparsesolverconcept
122
122
  *
123
123
  * The diagonal entries are pre-inverted and stored into a dense vector.
124
- *
124
+ *
125
125
  * \sa class LeastSquaresConjugateGradient, class DiagonalPreconditioner
126
126
  */
127
127
  template <typename _Scalar>
@@ -146,7 +146,7 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar>
146
146
  {
147
147
  return *this;
148
148
  }
149
-
149
+
150
150
  template<typename MatType>
151
151
  LeastSquareDiagonalPreconditioner& factorize(const MatType& mat)
152
152
  {
@@ -178,13 +178,13 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar>
178
178
  Base::m_isInitialized = true;
179
179
  return *this;
180
180
  }
181
-
181
+
182
182
  template<typename MatType>
183
183
  LeastSquareDiagonalPreconditioner& compute(const MatType& mat)
184
184
  {
185
185
  return factorize(mat);
186
186
  }
187
-
187
+
188
188
  ComputationInfo info() { return Success; }
189
189
 
190
190
  protected:
@@ -205,19 +205,19 @@ class IdentityPreconditioner
205
205
 
206
206
  template<typename MatrixType>
207
207
  explicit IdentityPreconditioner(const MatrixType& ) {}
208
-
208
+
209
209
  template<typename MatrixType>
210
210
  IdentityPreconditioner& analyzePattern(const MatrixType& ) { return *this; }
211
-
211
+
212
212
  template<typename MatrixType>
213
213
  IdentityPreconditioner& factorize(const MatrixType& ) { return *this; }
214
214
 
215
215
  template<typename MatrixType>
216
216
  IdentityPreconditioner& compute(const MatrixType& ) { return *this; }
217
-
217
+
218
218
  template<typename Rhs>
219
219
  inline const Rhs& solve(const Rhs& b) const { return b; }
220
-
220
+
221
221
  ComputationInfo info() { return Success; }
222
222
  };
223
223
 
@@ -191,32 +191,16 @@ public:
191
191
 
192
192
  /** \internal */
193
193
  template<typename Rhs,typename Dest>
194
- void _solve_with_guess_impl(const Rhs& b, Dest& x) const
194
+ void _solve_vector_with_guess_impl(const Rhs& b, Dest& x) const
195
195
  {
196
- bool failed = false;
197
- for(Index j=0; j<b.cols(); ++j)
198
- {
199
- m_iterations = Base::maxIterations();
200
- m_error = Base::m_tolerance;
201
-
202
- typename Dest::ColXpr xj(x,j);
203
- if(!internal::bicgstab(matrix(), b.col(j), xj, Base::m_preconditioner, m_iterations, m_error))
204
- failed = true;
205
- }
206
- m_info = failed ? NumericalIssue
196
+ m_iterations = Base::maxIterations();
197
+ m_error = Base::m_tolerance;
198
+
199
+ bool ret = internal::bicgstab(matrix(), b, x, Base::m_preconditioner, m_iterations, m_error);
200
+
201
+ m_info = (!ret) ? NumericalIssue
207
202
  : m_error <= Base::m_tolerance ? Success
208
203
  : NoConvergence;
209
- m_isInitialized = true;
210
- }
211
-
212
- /** \internal */
213
- using Base::_solve_impl;
214
- template<typename Rhs,typename Dest>
215
- void _solve_impl(const MatrixBase<Rhs>& b, Dest& x) const
216
- {
217
- x.resize(this->rows(),b.cols());
218
- x.setZero();
219
- _solve_with_guess_impl(b,x);
220
204
  }
221
205
 
222
206
  protected:
@@ -51,7 +51,7 @@ void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x,
51
51
  return;
52
52
  }
53
53
  const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();
54
- RealScalar threshold = numext::maxi(tol*tol*rhsNorm2,considerAsZero);
54
+ RealScalar threshold = numext::maxi(RealScalar(tol*tol*rhsNorm2),considerAsZero);
55
55
  RealScalar residualNorm2 = residual.squaredNorm();
56
56
  if (residualNorm2 < threshold)
57
57
  {
@@ -195,7 +195,7 @@ public:
195
195
 
196
196
  /** \internal */
197
197
  template<typename Rhs,typename Dest>
198
- void _solve_with_guess_impl(const Rhs& b, Dest& x) const
198
+ void _solve_vector_with_guess_impl(const Rhs& b, Dest& x) const
199
199
  {
200
200
  typedef typename Base::MatrixWrapper MatrixWrapper;
201
201
  typedef typename Base::ActualMatrixType ActualMatrixType;
@@ -211,31 +211,14 @@ public:
211
211
  RowMajorWrapper,
212
212
  typename MatrixWrapper::template ConstSelfAdjointViewReturnType<UpLo>::Type
213
213
  >::type SelfAdjointWrapper;
214
+
214
215
  m_iterations = Base::maxIterations();
215
216
  m_error = Base::m_tolerance;
216
217
 
217
- for(Index j=0; j<b.cols(); ++j)
218
- {
219
- m_iterations = Base::maxIterations();
220
- m_error = Base::m_tolerance;
221
-
222
- typename Dest::ColXpr xj(x,j);
223
- RowMajorWrapper row_mat(matrix());
224
- internal::conjugate_gradient(SelfAdjointWrapper(row_mat), b.col(j), xj, Base::m_preconditioner, m_iterations, m_error);
225
- }
226
-
227
- m_isInitialized = true;
218
+ RowMajorWrapper row_mat(matrix());
219
+ internal::conjugate_gradient(SelfAdjointWrapper(row_mat), b, x, Base::m_preconditioner, m_iterations, m_error);
228
220
  m_info = m_error <= Base::m_tolerance ? Success : NoConvergence;
229
221
  }
230
-
231
- /** \internal */
232
- using Base::_solve_impl;
233
- template<typename Rhs,typename Dest>
234
- void _solve_impl(const MatrixBase<Rhs>& b, Dest& x) const
235
- {
236
- x.setZero();
237
- _solve_with_guess_impl(b.derived(),x);
238
- }
239
222
 
240
223
  protected:
241
224