tomoto 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +8 -10
  4. data/ext/tomoto/extconf.rb +6 -2
  5. data/ext/tomoto/{ext.cpp → tomoto.cpp} +1 -1
  6. data/lib/tomoto/version.rb +1 -1
  7. data/lib/tomoto.rb +5 -1
  8. data/vendor/EigenRand/EigenRand/Core.h +10 -10
  9. data/vendor/EigenRand/EigenRand/Dists/Basic.h +208 -9
  10. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +52 -31
  11. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +9 -8
  12. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +28 -21
  13. data/vendor/EigenRand/EigenRand/EigenRand +11 -6
  14. data/vendor/EigenRand/EigenRand/Macro.h +13 -7
  15. data/vendor/EigenRand/EigenRand/MorePacketMath.h +348 -740
  16. data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +5 -3
  17. data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +9 -3
  18. data/vendor/EigenRand/EigenRand/PacketFilter.h +11 -253
  19. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +21 -47
  20. data/vendor/EigenRand/EigenRand/RandUtils.h +50 -344
  21. data/vendor/EigenRand/EigenRand/arch/AVX/MorePacketMath.h +619 -0
  22. data/vendor/EigenRand/EigenRand/arch/AVX/PacketFilter.h +149 -0
  23. data/vendor/EigenRand/EigenRand/arch/AVX/RandUtils.h +228 -0
  24. data/vendor/EigenRand/EigenRand/arch/NEON/MorePacketMath.h +473 -0
  25. data/vendor/EigenRand/EigenRand/arch/NEON/PacketFilter.h +142 -0
  26. data/vendor/EigenRand/EigenRand/arch/NEON/RandUtils.h +126 -0
  27. data/vendor/EigenRand/EigenRand/arch/SSE/MorePacketMath.h +501 -0
  28. data/vendor/EigenRand/EigenRand/arch/SSE/PacketFilter.h +133 -0
  29. data/vendor/EigenRand/EigenRand/arch/SSE/RandUtils.h +120 -0
  30. data/vendor/EigenRand/EigenRand/doc.h +24 -12
  31. data/vendor/EigenRand/README.md +57 -4
  32. data/vendor/eigen/COPYING.APACHE +203 -0
  33. data/vendor/eigen/COPYING.BSD +1 -1
  34. data/vendor/eigen/COPYING.MINPACK +51 -52
  35. data/vendor/eigen/Eigen/Cholesky +0 -1
  36. data/vendor/eigen/Eigen/Core +112 -265
  37. data/vendor/eigen/Eigen/Eigenvalues +2 -3
  38. data/vendor/eigen/Eigen/Geometry +5 -8
  39. data/vendor/eigen/Eigen/Householder +0 -1
  40. data/vendor/eigen/Eigen/Jacobi +0 -1
  41. data/vendor/eigen/Eigen/KLUSupport +41 -0
  42. data/vendor/eigen/Eigen/LU +2 -5
  43. data/vendor/eigen/Eigen/OrderingMethods +0 -3
  44. data/vendor/eigen/Eigen/PaStiXSupport +1 -0
  45. data/vendor/eigen/Eigen/PardisoSupport +0 -0
  46. data/vendor/eigen/Eigen/QR +2 -3
  47. data/vendor/eigen/Eigen/QtAlignedMalloc +0 -1
  48. data/vendor/eigen/Eigen/SVD +0 -1
  49. data/vendor/eigen/Eigen/Sparse +0 -2
  50. data/vendor/eigen/Eigen/SparseCholesky +0 -8
  51. data/vendor/eigen/Eigen/SparseLU +4 -0
  52. data/vendor/eigen/Eigen/SparseQR +0 -1
  53. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
  54. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +39 -23
  55. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
  56. data/vendor/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
  57. data/vendor/eigen/Eigen/src/Core/Array.h +99 -11
  58. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +3 -3
  59. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
  60. data/vendor/eigen/Eigen/src/Core/Assign.h +1 -1
  61. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
  62. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
  63. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +16 -16
  64. data/vendor/eigen/Eigen/src/Core/Block.h +56 -60
  65. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
  66. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
  67. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
  68. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +5 -0
  69. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
  70. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
  71. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
  72. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +14 -10
  73. data/vendor/eigen/Eigen/src/Core/DenseBase.h +132 -42
  74. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
  75. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +153 -71
  76. data/vendor/eigen/Eigen/src/Core/Diagonal.h +21 -23
  77. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
  78. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
  79. data/vendor/eigen/Eigen/src/Core/Dot.h +10 -10
  80. data/vendor/eigen/Eigen/src/Core/EigenBase.h +10 -9
  81. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
  82. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +3 -3
  83. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
  84. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +599 -152
  85. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
  86. data/vendor/eigen/Eigen/src/Core/IO.h +40 -7
  87. data/vendor/eigen/Eigen/src/Core/IndexedView.h +237 -0
  88. data/vendor/eigen/Eigen/src/Core/Inverse.h +9 -10
  89. data/vendor/eigen/Eigen/src/Core/Map.h +7 -7
  90. data/vendor/eigen/Eigen/src/Core/MapBase.h +10 -3
  91. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +767 -125
  92. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
  93. data/vendor/eigen/Eigen/src/Core/Matrix.h +131 -25
  94. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +21 -3
  95. data/vendor/eigen/Eigen/src/Core/NestByValue.h +25 -50
  96. data/vendor/eigen/Eigen/src/Core/NoAlias.h +4 -3
  97. data/vendor/eigen/Eigen/src/Core/NumTraits.h +107 -20
  98. data/vendor/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  99. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +3 -31
  100. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +152 -59
  101. data/vendor/eigen/Eigen/src/Core/Product.h +30 -25
  102. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +192 -125
  103. data/vendor/eigen/Eigen/src/Core/Random.h +37 -1
  104. data/vendor/eigen/Eigen/src/Core/Redux.h +180 -170
  105. data/vendor/eigen/Eigen/src/Core/Ref.h +121 -23
  106. data/vendor/eigen/Eigen/src/Core/Replicate.h +8 -8
  107. data/vendor/eigen/Eigen/src/Core/Reshaped.h +454 -0
  108. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
  109. data/vendor/eigen/Eigen/src/Core/Reverse.h +18 -12
  110. data/vendor/eigen/Eigen/src/Core/Select.h +8 -6
  111. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
  112. data/vendor/eigen/Eigen/src/Core/Solve.h +14 -14
  113. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +16 -16
  114. data/vendor/eigen/Eigen/src/Core/SolverBase.h +41 -3
  115. data/vendor/eigen/Eigen/src/Core/StableNorm.h +100 -70
  116. data/vendor/eigen/Eigen/src/Core/StlIterators.h +463 -0
  117. data/vendor/eigen/Eigen/src/Core/Stride.h +9 -4
  118. data/vendor/eigen/Eigen/src/Core/Swap.h +5 -4
  119. data/vendor/eigen/Eigen/src/Core/Transpose.h +88 -27
  120. data/vendor/eigen/Eigen/src/Core/Transpositions.h +26 -47
  121. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +93 -75
  122. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +5 -5
  123. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
  124. data/vendor/eigen/Eigen/src/Core/Visitor.h +137 -29
  125. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
  126. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
  127. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
  128. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
  129. data/vendor/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  130. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +207 -236
  131. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1482 -495
  132. data/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  133. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
  134. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
  135. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  136. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  137. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  138. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
  139. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
  140. data/vendor/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  141. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
  142. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  143. data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
  145. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
  146. data/vendor/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
  148. data/vendor/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  149. data/vendor/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  153. data/vendor/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  154. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
  155. data/vendor/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  156. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
  157. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
  158. data/vendor/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
  160. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
  161. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
  162. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
  163. data/vendor/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  164. data/vendor/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  165. data/vendor/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  166. data/vendor/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  167. data/vendor/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  168. data/vendor/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  169. data/vendor/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  170. data/vendor/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  171. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
  172. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
  173. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
  174. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
  175. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
  176. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
  177. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
  178. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +355 -16
  179. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1075 -586
  180. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +49 -24
  181. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +41 -35
  182. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +6 -6
  183. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +4 -2
  184. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
  185. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +22 -5
  186. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +53 -30
  187. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +16 -8
  188. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
  189. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +4 -4
  190. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
  191. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +33 -27
  192. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +14 -12
  193. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +36 -34
  194. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +8 -4
  195. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
  196. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +304 -119
  197. data/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  198. data/vendor/eigen/Eigen/src/Core/util/Constants.h +25 -9
  199. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +26 -3
  200. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +29 -9
  201. data/vendor/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  202. data/vendor/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
  203. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
  204. data/vendor/eigen/Eigen/src/Core/util/Macros.h +709 -246
  205. data/vendor/eigen/Eigen/src/Core/util/Memory.h +222 -52
  206. data/vendor/eigen/Eigen/src/Core/util/Meta.h +355 -77
  207. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +5 -1
  208. data/vendor/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  209. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
  210. data/vendor/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  211. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +65 -30
  212. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
  213. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +7 -4
  214. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
  215. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
  216. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
  217. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
  218. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
  219. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +21 -9
  220. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +77 -43
  221. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
  222. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
  223. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
  224. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
  225. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
  226. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
  227. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
  228. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
  229. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +70 -14
  230. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
  231. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +23 -5
  232. data/vendor/eigen/Eigen/src/Geometry/Transform.h +88 -67
  233. data/vendor/eigen/Eigen/src/Geometry/Translation.h +6 -12
  234. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +1 -1
  235. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  236. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
  237. data/vendor/eigen/Eigen/src/Householder/Householder.h +8 -4
  238. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
  239. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
  240. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
  241. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
  242. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
  243. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
  244. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
  245. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
  246. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
  247. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
  248. data/vendor/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  249. data/vendor/eigen/Eigen/src/LU/Determinant.h +35 -19
  250. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +29 -43
  251. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +25 -8
  252. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +71 -58
  253. data/vendor/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
  254. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
  255. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
  256. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
  257. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
  258. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +9 -7
  259. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
  260. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
  261. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
  262. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
  263. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
  264. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +183 -63
  265. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
  266. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +83 -22
  267. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
  268. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +17 -9
  269. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +12 -37
  270. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +3 -2
  271. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
  272. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
  273. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
  274. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
  275. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
  276. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
  277. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +4 -2
  278. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
  279. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +126 -11
  280. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
  281. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
  282. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
  283. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +5 -2
  284. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
  285. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
  286. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +1 -0
  287. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +162 -12
  288. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
  289. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
  290. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
  291. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
  292. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
  293. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
  294. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +2 -12
  295. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +2 -2
  296. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
  297. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
  298. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
  299. data/vendor/eigen/Eigen/src/misc/lapacke.h +5 -4
  300. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +28 -2
  301. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
  302. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
  303. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
  304. data/vendor/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  305. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
  306. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
  307. data/vendor/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
  308. data/vendor/eigen/README.md +2 -0
  309. data/vendor/eigen/bench/btl/README +1 -1
  310. data/vendor/eigen/bench/tensors/README +6 -7
  311. data/vendor/eigen/ci/README.md +56 -0
  312. data/vendor/eigen/demos/mix_eigen_and_c/README +1 -1
  313. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +213 -158
  314. data/vendor/eigen/unsupported/README.txt +1 -1
  315. data/vendor/tomotopy/README.kr.rst +21 -0
  316. data/vendor/tomotopy/README.rst +20 -0
  317. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +2 -2
  318. data/vendor/tomotopy/src/Labeling/Phraser.hpp +1 -1
  319. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +2 -1
  320. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +2 -1
  321. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +1 -1
  322. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +2 -2
  323. data/vendor/tomotopy/src/TopicModel/HDP.h +1 -0
  324. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +53 -2
  325. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +1 -1
  326. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +1 -0
  327. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +2 -2
  328. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +16 -5
  329. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +1 -0
  330. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +1 -0
  331. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +1 -0
  332. data/vendor/tomotopy/src/TopicModel/PT.h +3 -1
  333. data/vendor/tomotopy/src/TopicModel/PTModel.hpp +31 -1
  334. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +2 -2
  335. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +7 -5
  336. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +36 -1
  337. data/vendor/tomotopy/src/Utils/exception.h +6 -0
  338. data/vendor/tomotopy/src/Utils/sample.hpp +14 -12
  339. data/vendor/tomotopy/src/Utils/sse_gamma.h +0 -3
  340. metadata +60 -14
  341. data/vendor/eigen/Eigen/CMakeLists.txt +0 -19
  342. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -674
  343. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  344. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  345. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  346. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  347. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
@@ -15,6 +15,7 @@ namespace Eigen {
15
15
  namespace internal {
16
16
 
17
17
  template<typename Derived>
18
+ EIGEN_DEVICE_FUNC
18
19
  inline const typename Derived::Scalar bruteforce_det3_helper
19
20
  (const MatrixBase<Derived>& matrix, int a, int b, int c)
20
21
  {
@@ -22,14 +23,6 @@ inline const typename Derived::Scalar bruteforce_det3_helper
22
23
  * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b));
23
24
  }
24
25
 
25
- template<typename Derived>
26
- const typename Derived::Scalar bruteforce_det4_helper
27
- (const MatrixBase<Derived>& matrix, int j, int k, int m, int n)
28
- {
29
- return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1))
30
- * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3));
31
- }
32
-
33
26
  template<typename Derived,
34
27
  int DeterminantType = Derived::RowsAtCompileTime
35
28
  > struct determinant_impl
@@ -44,7 +37,8 @@ template<typename Derived,
44
37
 
45
38
  template<typename Derived> struct determinant_impl<Derived, 1>
46
39
  {
47
- static inline typename traits<Derived>::Scalar run(const Derived& m)
40
+ static inline EIGEN_DEVICE_FUNC
41
+ typename traits<Derived>::Scalar run(const Derived& m)
48
42
  {
49
43
  return m.coeff(0,0);
50
44
  }
@@ -52,7 +46,8 @@ template<typename Derived> struct determinant_impl<Derived, 1>
52
46
 
53
47
  template<typename Derived> struct determinant_impl<Derived, 2>
54
48
  {
55
- static inline typename traits<Derived>::Scalar run(const Derived& m)
49
+ static inline EIGEN_DEVICE_FUNC
50
+ typename traits<Derived>::Scalar run(const Derived& m)
56
51
  {
57
52
  return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1);
58
53
  }
@@ -60,7 +55,8 @@ template<typename Derived> struct determinant_impl<Derived, 2>
60
55
 
61
56
  template<typename Derived> struct determinant_impl<Derived, 3>
62
57
  {
63
- static inline typename traits<Derived>::Scalar run(const Derived& m)
58
+ static inline EIGEN_DEVICE_FUNC
59
+ typename traits<Derived>::Scalar run(const Derived& m)
64
60
  {
65
61
  return bruteforce_det3_helper(m,0,1,2)
66
62
  - bruteforce_det3_helper(m,1,0,2)
@@ -70,15 +66,34 @@ template<typename Derived> struct determinant_impl<Derived, 3>
70
66
 
71
67
  template<typename Derived> struct determinant_impl<Derived, 4>
72
68
  {
73
- static typename traits<Derived>::Scalar run(const Derived& m)
69
+ typedef typename traits<Derived>::Scalar Scalar;
70
+ static EIGEN_DEVICE_FUNC
71
+ Scalar run(const Derived& m)
72
+ {
73
+ Scalar d2_01 = det2(m, 0, 1);
74
+ Scalar d2_02 = det2(m, 0, 2);
75
+ Scalar d2_03 = det2(m, 0, 3);
76
+ Scalar d2_12 = det2(m, 1, 2);
77
+ Scalar d2_13 = det2(m, 1, 3);
78
+ Scalar d2_23 = det2(m, 2, 3);
79
+ Scalar d3_0 = det3(m, 1,d2_23, 2,d2_13, 3,d2_12);
80
+ Scalar d3_1 = det3(m, 0,d2_23, 2,d2_03, 3,d2_02);
81
+ Scalar d3_2 = det3(m, 0,d2_13, 1,d2_03, 3,d2_01);
82
+ Scalar d3_3 = det3(m, 0,d2_12, 1,d2_02, 2,d2_01);
83
+ return internal::pmadd(-m(0,3),d3_0, m(1,3)*d3_1) +
84
+ internal::pmadd(-m(2,3),d3_2, m(3,3)*d3_3);
85
+ }
86
+ protected:
87
+ static EIGEN_DEVICE_FUNC
88
+ Scalar det2(const Derived& m, Index i0, Index i1)
89
+ {
90
+ return m(i0,0) * m(i1,1) - m(i1,0) * m(i0,1);
91
+ }
92
+
93
+ static EIGEN_DEVICE_FUNC
94
+ Scalar det3(const Derived& m, Index i0, const Scalar& d0, Index i1, const Scalar& d1, Index i2, const Scalar& d2)
74
95
  {
75
- // trick by Martin Costabel to compute 4x4 det with only 30 muls
76
- return bruteforce_det4_helper(m,0,1,2,3)
77
- - bruteforce_det4_helper(m,0,2,1,3)
78
- + bruteforce_det4_helper(m,0,3,1,2)
79
- + bruteforce_det4_helper(m,1,2,0,3)
80
- - bruteforce_det4_helper(m,1,3,0,2)
81
- + bruteforce_det4_helper(m,2,3,0,1);
96
+ return internal::pmadd(m(i0,2), d0, internal::pmadd(-m(i1,2), d1, m(i2,2)*d2));
82
97
  }
83
98
  };
84
99
 
@@ -89,6 +104,7 @@ template<typename Derived> struct determinant_impl<Derived, 4>
89
104
  * \returns the determinant of this matrix
90
105
  */
91
106
  template<typename Derived>
107
+ EIGEN_DEVICE_FUNC
92
108
  inline typename internal::traits<Derived>::Scalar MatrixBase<Derived>::determinant() const
93
109
  {
94
110
  eigen_assert(rows() == cols());
@@ -18,6 +18,7 @@ template<typename _MatrixType> struct traits<FullPivLU<_MatrixType> >
18
18
  {
19
19
  typedef MatrixXpr XprKind;
20
20
  typedef SolverStorage StorageKind;
21
+ typedef int StorageIndex;
21
22
  enum { Flags = 0 };
22
23
  };
23
24
 
@@ -48,12 +49,12 @@ template<typename _MatrixType> struct traits<FullPivLU<_MatrixType> >
48
49
  * The data of the LU decomposition can be directly accessed through the methods matrixLU(),
49
50
  * permutationP(), permutationQ().
50
51
  *
51
- * As an exemple, here is how the original matrix can be retrieved:
52
+ * As an example, here is how the original matrix can be retrieved:
52
53
  * \include class_FullPivLU.cpp
53
54
  * Output: \verbinclude class_FullPivLU.out
54
55
  *
55
56
  * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
56
- *
57
+ *
57
58
  * \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
58
59
  */
59
60
  template<typename _MatrixType> class FullPivLU
@@ -62,9 +63,9 @@ template<typename _MatrixType> class FullPivLU
62
63
  public:
63
64
  typedef _MatrixType MatrixType;
64
65
  typedef SolverBase<FullPivLU> Base;
66
+ friend class SolverBase<FullPivLU>;
65
67
 
66
68
  EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU)
67
- // FIXME StorageIndex defined in EIGEN_GENERIC_PUBLIC_INTERFACE should be int
68
69
  enum {
69
70
  MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
70
71
  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
@@ -218,6 +219,7 @@ template<typename _MatrixType> class FullPivLU
218
219
  return internal::image_retval<FullPivLU>(*this, originalMatrix);
219
220
  }
220
221
 
222
+ #ifdef EIGEN_PARSED_BY_DOXYGEN
221
223
  /** \return a solution x to the equation Ax=b, where A is the matrix of which
222
224
  * *this is the LU decomposition.
223
225
  *
@@ -237,14 +239,10 @@ template<typename _MatrixType> class FullPivLU
237
239
  *
238
240
  * \sa TriangularView::solve(), kernel(), inverse()
239
241
  */
240
- // FIXME this is a copy-paste of the base-class member to add the isInitialized assertion.
241
242
  template<typename Rhs>
242
243
  inline const Solve<FullPivLU, Rhs>
243
- solve(const MatrixBase<Rhs>& b) const
244
- {
245
- eigen_assert(m_isInitialized && "LU is not initialized.");
246
- return Solve<FullPivLU, Rhs>(*this, b.derived());
247
- }
244
+ solve(const MatrixBase<Rhs>& b) const;
245
+ #endif
248
246
 
249
247
  /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
250
248
  the LU decomposition.
@@ -320,7 +318,7 @@ template<typename _MatrixType> class FullPivLU
320
318
  return m_usePrescribedThreshold ? m_prescribedThreshold
321
319
  // this formula comes from experimenting (see "LU precision tuning" thread on the list)
322
320
  // and turns out to be identical to Higham's formula used already in LDLt.
323
- : NumTraits<Scalar>::epsilon() * m_lu.diagonalSize();
321
+ : NumTraits<Scalar>::epsilon() * RealScalar(m_lu.diagonalSize());
324
322
  }
325
323
 
326
324
  /** \returns the rank of the matrix of which *this is the LU decomposition.
@@ -406,16 +404,16 @@ template<typename _MatrixType> class FullPivLU
406
404
 
407
405
  MatrixType reconstructedMatrix() const;
408
406
 
409
- EIGEN_DEVICE_FUNC inline Index rows() const { return m_lu.rows(); }
410
- EIGEN_DEVICE_FUNC inline Index cols() const { return m_lu.cols(); }
407
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
408
+ inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
409
+ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
410
+ inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
411
411
 
412
412
  #ifndef EIGEN_PARSED_BY_DOXYGEN
413
413
  template<typename RhsType, typename DstType>
414
- EIGEN_DEVICE_FUNC
415
414
  void _solve_impl(const RhsType &rhs, DstType &dst) const;
416
415
 
417
416
  template<bool Conjugate, typename RhsType, typename DstType>
418
- EIGEN_DEVICE_FUNC
419
417
  void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
420
418
  #endif
421
419
 
@@ -531,8 +529,8 @@ void FullPivLU<MatrixType>::computeInPlace()
531
529
  m_nonzero_pivots = k;
532
530
  for(Index i = k; i < size; ++i)
533
531
  {
534
- m_rowsTranspositions.coeffRef(i) = i;
535
- m_colsTranspositions.coeffRef(i) = i;
532
+ m_rowsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
533
+ m_colsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
536
534
  }
537
535
  break;
538
536
  }
@@ -543,8 +541,8 @@ void FullPivLU<MatrixType>::computeInPlace()
543
541
  // Now that we've found the pivot, we need to apply the row/col swaps to
544
542
  // bring it to the location (k,k).
545
543
 
546
- m_rowsTranspositions.coeffRef(k) = row_of_biggest_in_corner;
547
- m_colsTranspositions.coeffRef(k) = col_of_biggest_in_corner;
544
+ m_rowsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(row_of_biggest_in_corner);
545
+ m_colsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(col_of_biggest_in_corner);
548
546
  if(k != row_of_biggest_in_corner) {
549
547
  m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner));
550
548
  ++number_of_transpositions;
@@ -757,7 +755,6 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
757
755
  const Index rows = this->rows(),
758
756
  cols = this->cols(),
759
757
  nonzero_pivots = this->rank();
760
- eigen_assert(rhs.rows() == rows);
761
758
  const Index smalldim = (std::min)(rows, cols);
762
759
 
763
760
  if(nonzero_pivots == 0)
@@ -807,7 +804,6 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
807
804
 
808
805
  const Index rows = this->rows(), cols = this->cols(),
809
806
  nonzero_pivots = this->rank();
810
- eigen_assert(rhs.rows() == cols);
811
807
  const Index smalldim = (std::min)(rows, cols);
812
808
 
813
809
  if(nonzero_pivots == 0)
@@ -821,29 +817,19 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
821
817
  // Step 1
822
818
  c = permutationQ().inverse() * rhs;
823
819
 
824
- if (Conjugate) {
825
- // Step 2
826
- m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
827
- .template triangularView<Upper>()
828
- .adjoint()
829
- .solveInPlace(c.topRows(nonzero_pivots));
830
- // Step 3
831
- m_lu.topLeftCorner(smalldim, smalldim)
832
- .template triangularView<UnitLower>()
833
- .adjoint()
834
- .solveInPlace(c.topRows(smalldim));
835
- } else {
836
- // Step 2
837
- m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
838
- .template triangularView<Upper>()
839
- .transpose()
840
- .solveInPlace(c.topRows(nonzero_pivots));
841
- // Step 3
842
- m_lu.topLeftCorner(smalldim, smalldim)
843
- .template triangularView<UnitLower>()
844
- .transpose()
845
- .solveInPlace(c.topRows(smalldim));
846
- }
820
+ // Step 2
821
+ m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
822
+ .template triangularView<Upper>()
823
+ .transpose()
824
+ .template conjugateIf<Conjugate>()
825
+ .solveInPlace(c.topRows(nonzero_pivots));
826
+
827
+ // Step 3
828
+ m_lu.topLeftCorner(smalldim, smalldim)
829
+ .template triangularView<UnitLower>()
830
+ .transpose()
831
+ .template conjugateIf<Conjugate>()
832
+ .solveInPlace(c.topRows(smalldim));
847
833
 
848
834
  // Step 4
849
835
  PermutationPType invp = permutationP().inverse().eval();
@@ -77,10 +77,11 @@ inline void compute_inverse_size2_helper(
77
77
  const MatrixType& matrix, const typename ResultType::Scalar& invdet,
78
78
  ResultType& result)
79
79
  {
80
+ typename ResultType::Scalar temp = matrix.coeff(0,0);
80
81
  result.coeffRef(0,0) = matrix.coeff(1,1) * invdet;
81
82
  result.coeffRef(1,0) = -matrix.coeff(1,0) * invdet;
82
83
  result.coeffRef(0,1) = -matrix.coeff(0,1) * invdet;
83
- result.coeffRef(1,1) = matrix.coeff(0,0) * invdet;
84
+ result.coeffRef(1,1) = temp * invdet;
84
85
  }
85
86
 
86
87
  template<typename MatrixType, typename ResultType>
@@ -143,13 +144,18 @@ inline void compute_inverse_size3_helper(
143
144
  const Matrix<typename ResultType::Scalar,3,1>& cofactors_col0,
144
145
  ResultType& result)
145
146
  {
146
- result.row(0) = cofactors_col0 * invdet;
147
- result.coeffRef(1,0) = cofactor_3x3<MatrixType,0,1>(matrix) * invdet;
148
- result.coeffRef(1,1) = cofactor_3x3<MatrixType,1,1>(matrix) * invdet;
147
+ // Compute cofactors in a way that avoids aliasing issues.
148
+ typedef typename ResultType::Scalar Scalar;
149
+ const Scalar c01 = cofactor_3x3<MatrixType,0,1>(matrix) * invdet;
150
+ const Scalar c11 = cofactor_3x3<MatrixType,1,1>(matrix) * invdet;
151
+ const Scalar c02 = cofactor_3x3<MatrixType,0,2>(matrix) * invdet;
149
152
  result.coeffRef(1,2) = cofactor_3x3<MatrixType,2,1>(matrix) * invdet;
150
- result.coeffRef(2,0) = cofactor_3x3<MatrixType,0,2>(matrix) * invdet;
151
153
  result.coeffRef(2,1) = cofactor_3x3<MatrixType,1,2>(matrix) * invdet;
152
154
  result.coeffRef(2,2) = cofactor_3x3<MatrixType,2,2>(matrix) * invdet;
155
+ result.coeffRef(1,0) = c01;
156
+ result.coeffRef(1,1) = c11;
157
+ result.coeffRef(2,0) = c02;
158
+ result.row(0) = cofactors_col0 * invdet;
153
159
  }
154
160
 
155
161
  template<typename MatrixType, typename ResultType>
@@ -181,14 +187,13 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
181
187
  bool& invertible
182
188
  )
183
189
  {
184
- using std::abs;
185
190
  typedef typename ResultType::Scalar Scalar;
186
191
  Matrix<Scalar,3,1> cofactors_col0;
187
192
  cofactors_col0.coeffRef(0) = cofactor_3x3<MatrixType,0,0>(matrix);
188
193
  cofactors_col0.coeffRef(1) = cofactor_3x3<MatrixType,1,0>(matrix);
189
194
  cofactors_col0.coeffRef(2) = cofactor_3x3<MatrixType,2,0>(matrix);
190
195
  determinant = (cofactors_col0.cwiseProduct(matrix.col(0))).sum();
191
- invertible = abs(determinant) > absDeterminantThreshold;
196
+ invertible = Eigen::numext::abs(determinant) > absDeterminantThreshold;
192
197
  if(!invertible) return;
193
198
  const Scalar invdet = Scalar(1) / determinant;
194
199
  compute_inverse_size3_helper(matrix, invdet, cofactors_col0, inverse);
@@ -273,7 +278,13 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
273
278
  using std::abs;
274
279
  determinant = matrix.determinant();
275
280
  invertible = abs(determinant) > absDeterminantThreshold;
276
- if(invertible) compute_inverse<MatrixType, ResultType>::run(matrix, inverse);
281
+ if(invertible && extract_data(matrix) != extract_data(inverse)) {
282
+ compute_inverse<MatrixType, ResultType>::run(matrix, inverse);
283
+ }
284
+ else if(invertible) {
285
+ MatrixType matrix_t = matrix;
286
+ compute_inverse<MatrixType, ResultType>::run(matrix_t, inverse);
287
+ }
277
288
  }
278
289
  };
279
290
 
@@ -290,6 +301,7 @@ template<typename DstXprType, typename XprType>
290
301
  struct Assignment<DstXprType, Inverse<XprType>, internal::assign_op<typename DstXprType::Scalar,typename XprType::Scalar>, Dense2Dense>
291
302
  {
292
303
  typedef Inverse<XprType> SrcXprType;
304
+ EIGEN_DEVICE_FUNC
293
305
  static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename XprType::Scalar> &)
294
306
  {
295
307
  Index dstRows = src.rows();
@@ -332,6 +344,7 @@ struct Assignment<DstXprType, Inverse<XprType>, internal::assign_op<typename Dst
332
344
  * \sa computeInverseAndDetWithCheck()
333
345
  */
334
346
  template<typename Derived>
347
+ EIGEN_DEVICE_FUNC
335
348
  inline const Inverse<Derived> MatrixBase<Derived>::inverse() const
336
349
  {
337
350
  EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsInteger,THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES)
@@ -345,6 +358,8 @@ inline const Inverse<Derived> MatrixBase<Derived>::inverse() const
345
358
  *
346
359
  * This is only for fixed-size square matrices of size up to 4x4.
347
360
  *
361
+ * Notice that it will trigger a copy of input matrix when trying to do the inverse in place.
362
+ *
348
363
  * \param inverse Reference to the matrix in which to store the inverse.
349
364
  * \param determinant Reference to the variable in which to store the determinant.
350
365
  * \param invertible Reference to the bool variable in which to store whether the matrix is invertible.
@@ -385,6 +400,8 @@ inline void MatrixBase<Derived>::computeInverseAndDetWithCheck(
385
400
  *
386
401
  * This is only for fixed-size square matrices of size up to 4x4.
387
402
  *
403
+ * Notice that it will trigger a copy of input matrix when trying to do the inverse in place.
404
+ *
388
405
  * \param inverse Reference to the matrix in which to store the inverse.
389
406
  * \param invertible Reference to the bool variable in which to store whether the matrix is invertible.
390
407
  * \param absDeterminantThreshold Optional parameter controlling the invertibility check.
@@ -19,6 +19,7 @@ template<typename _MatrixType> struct traits<PartialPivLU<_MatrixType> >
19
19
  {
20
20
  typedef MatrixXpr XprKind;
21
21
  typedef SolverStorage StorageKind;
22
+ typedef int StorageIndex;
22
23
  typedef traits<_MatrixType> BaseTraits;
23
24
  enum {
24
25
  Flags = BaseTraits::Flags & RowMajorBit,
@@ -69,7 +70,7 @@ struct enable_if_ref<Ref<T>,Derived> {
69
70
  * The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP().
70
71
  *
71
72
  * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
72
- *
73
+ *
73
74
  * \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU
74
75
  */
75
76
  template<typename _MatrixType> class PartialPivLU
@@ -79,8 +80,9 @@ template<typename _MatrixType> class PartialPivLU
79
80
 
80
81
  typedef _MatrixType MatrixType;
81
82
  typedef SolverBase<PartialPivLU> Base;
83
+ friend class SolverBase<PartialPivLU>;
84
+
82
85
  EIGEN_GENERIC_PUBLIC_INTERFACE(PartialPivLU)
83
- // FIXME StorageIndex defined in EIGEN_GENERIC_PUBLIC_INTERFACE should be int
84
86
  enum {
85
87
  MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
86
88
  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
@@ -152,6 +154,7 @@ template<typename _MatrixType> class PartialPivLU
152
154
  return m_p;
153
155
  }
154
156
 
157
+ #ifdef EIGEN_PARSED_BY_DOXYGEN
155
158
  /** This method returns the solution x to the equation Ax=b, where A is the matrix of which
156
159
  * *this is the LU decomposition.
157
160
  *
@@ -169,14 +172,10 @@ template<typename _MatrixType> class PartialPivLU
169
172
  *
170
173
  * \sa TriangularView::solve(), inverse(), computeInverse()
171
174
  */
172
- // FIXME this is a copy-paste of the base-class member to add the isInitialized assertion.
173
175
  template<typename Rhs>
174
176
  inline const Solve<PartialPivLU, Rhs>
175
- solve(const MatrixBase<Rhs>& b) const
176
- {
177
- eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
178
- return Solve<PartialPivLU, Rhs>(*this, b.derived());
179
- }
177
+ solve(const MatrixBase<Rhs>& b) const;
178
+ #endif
180
179
 
181
180
  /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
182
181
  the LU decomposition.
@@ -217,8 +216,8 @@ template<typename _MatrixType> class PartialPivLU
217
216
 
218
217
  MatrixType reconstructedMatrix() const;
219
218
 
220
- inline Index rows() const { return m_lu.rows(); }
221
- inline Index cols() const { return m_lu.cols(); }
219
+ EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
220
+ EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
222
221
 
223
222
  #ifndef EIGEN_PARSED_BY_DOXYGEN
224
223
  template<typename RhsType, typename DstType>
@@ -231,8 +230,6 @@ template<typename _MatrixType> class PartialPivLU
231
230
  * Step 3: replace c by the solution x to Ux = c.
232
231
  */
233
232
 
234
- eigen_assert(rhs.rows() == m_lu.rows());
235
-
236
233
  // Step 1
237
234
  dst = permutationP() * rhs;
238
235
 
@@ -246,26 +243,21 @@ template<typename _MatrixType> class PartialPivLU
246
243
  template<bool Conjugate, typename RhsType, typename DstType>
247
244
  EIGEN_DEVICE_FUNC
248
245
  void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const {
249
- /* The decomposition PA = LU can be rewritten as A = P^{-1} L U.
246
+ /* The decomposition PA = LU can be rewritten as A^T = U^T L^T P.
250
247
  * So we proceed as follows:
251
- * Step 1: compute c = Pb.
252
- * Step 2: replace c by the solution x to Lx = c.
253
- * Step 3: replace c by the solution x to Ux = c.
248
+ * Step 1: compute c as the solution to L^T c = b
249
+ * Step 2: replace c by the solution x to U^T x = c.
250
+ * Step 3: update c = P^-1 c.
254
251
  */
255
252
 
256
253
  eigen_assert(rhs.rows() == m_lu.cols());
257
254
 
258
- if (Conjugate) {
259
- // Step 1
260
- dst = m_lu.template triangularView<Upper>().adjoint().solve(rhs);
261
- // Step 2
262
- m_lu.template triangularView<UnitLower>().adjoint().solveInPlace(dst);
263
- } else {
264
- // Step 1
265
- dst = m_lu.template triangularView<Upper>().transpose().solve(rhs);
266
- // Step 2
267
- m_lu.template triangularView<UnitLower>().transpose().solveInPlace(dst);
268
- }
255
+ // Step 1
256
+ dst = m_lu.template triangularView<Upper>().transpose()
257
+ .template conjugateIf<Conjugate>().solve(rhs);
258
+ // Step 2
259
+ m_lu.template triangularView<UnitLower>().transpose()
260
+ .template conjugateIf<Conjugate>().solveInPlace(dst);
269
261
  // Step 3
270
262
  dst = permutationP().transpose() * dst;
271
263
  }
@@ -339,17 +331,18 @@ PartialPivLU<MatrixType>::PartialPivLU(EigenBase<InputType>& matrix)
339
331
  namespace internal {
340
332
 
341
333
  /** \internal This is the blocked version of fullpivlu_unblocked() */
342
- template<typename Scalar, int StorageOrder, typename PivIndex>
334
+ template<typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime=Dynamic>
343
335
  struct partial_lu_impl
344
336
  {
345
- // FIXME add a stride to Map, so that the following mapping becomes easier,
346
- // another option would be to create an expression being able to automatically
347
- // warp any Map, Matrix, and Block expressions as a unique type, but since that's exactly
348
- // a Map + stride, why not adding a stride to Map, and convenient ctors from a Matrix,
349
- // and Block.
350
- typedef Map<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > MapLU;
351
- typedef Block<MapLU, Dynamic, Dynamic> MatrixType;
352
- typedef Block<MatrixType,Dynamic,Dynamic> BlockType;
337
+ static const int UnBlockedBound = 16;
338
+ static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound;
339
+ static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
340
+ // Remaining rows and columns at compile-time:
341
+ static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic;
342
+ static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic;
343
+ typedef Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder> MatrixType;
344
+ typedef Ref<MatrixType> MatrixTypeRef;
345
+ typedef Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > BlockType;
353
346
  typedef typename MatrixType::RealScalar RealScalar;
354
347
 
355
348
  /** \internal performs the LU decomposition in-place of the matrix \a lu
@@ -362,19 +355,22 @@ struct partial_lu_impl
362
355
  *
363
356
  * \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise.
364
357
  */
365
- static Index unblocked_lu(MatrixType& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions)
358
+ static Index unblocked_lu(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions)
366
359
  {
367
360
  typedef scalar_score_coeff_op<Scalar> Scoring;
368
361
  typedef typename Scoring::result_type Score;
369
362
  const Index rows = lu.rows();
370
363
  const Index cols = lu.cols();
371
364
  const Index size = (std::min)(rows,cols);
365
+ // For small compile-time matrices it is worth processing the last row separately:
366
+ // speedup: +100% for 2x2, +10% for others.
367
+ const Index endk = UnBlockedAtCompileTime ? size-1 : size;
372
368
  nb_transpositions = 0;
373
369
  Index first_zero_pivot = -1;
374
- for(Index k = 0; k < size; ++k)
370
+ for(Index k = 0; k < endk; ++k)
375
371
  {
376
- Index rrows = rows-k-1;
377
- Index rcols = cols-k-1;
372
+ int rrows = internal::convert_index<int>(rows-k-1);
373
+ int rcols = internal::convert_index<int>(cols-k-1);
378
374
 
379
375
  Index row_of_biggest_in_col;
380
376
  Score biggest_in_corner
@@ -391,9 +387,7 @@ struct partial_lu_impl
391
387
  ++nb_transpositions;
392
388
  }
393
389
 
394
- // FIXME shall we introduce a safe quotient expression in cas 1/lu.coeff(k,k)
395
- // overflow but not the actual quotient?
396
- lu.col(k).tail(rrows) /= lu.coeff(k,k);
390
+ lu.col(k).tail(fix<RRows>(rrows)) /= lu.coeff(k,k);
397
391
  }
398
392
  else if(first_zero_pivot==-1)
399
393
  {
@@ -403,8 +397,18 @@ struct partial_lu_impl
403
397
  }
404
398
 
405
399
  if(k<rows-1)
406
- lu.bottomRightCorner(rrows,rcols).noalias() -= lu.col(k).tail(rrows) * lu.row(k).tail(rcols);
400
+ lu.bottomRightCorner(fix<RRows>(rrows),fix<RCols>(rcols)).noalias() -= lu.col(k).tail(fix<RRows>(rrows)) * lu.row(k).tail(fix<RCols>(rcols));
401
+ }
402
+
403
+ // special handling of the last entry
404
+ if(UnBlockedAtCompileTime)
405
+ {
406
+ Index k = endk;
407
+ row_transpositions[k] = PivIndex(k);
408
+ if (Scoring()(lu(k, k)) == Score(0) && first_zero_pivot == -1)
409
+ first_zero_pivot = k;
407
410
  }
411
+
408
412
  return first_zero_pivot;
409
413
  }
410
414
 
@@ -420,18 +424,17 @@ struct partial_lu_impl
420
424
  * \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise.
421
425
  *
422
426
  * \note This very low level interface using pointers, etc. is to:
423
- * 1 - reduce the number of instanciations to the strict minimum
424
- * 2 - avoid infinite recursion of the instanciations with Block<Block<Block<...> > >
427
+ * 1 - reduce the number of instantiations to the strict minimum
428
+ * 2 - avoid infinite recursion of the instantiations with Block<Block<Block<...> > >
425
429
  */
426
430
  static Index blocked_lu(Index rows, Index cols, Scalar* lu_data, Index luStride, PivIndex* row_transpositions, PivIndex& nb_transpositions, Index maxBlockSize=256)
427
431
  {
428
- MapLU lu1(lu_data,StorageOrder==RowMajor?rows:luStride,StorageOrder==RowMajor?luStride:cols);
429
- MatrixType lu(lu1,0,0,rows,cols);
432
+ MatrixTypeRef lu = MatrixType::Map(lu_data,rows, cols, OuterStride<>(luStride));
430
433
 
431
434
  const Index size = (std::min)(rows,cols);
432
435
 
433
436
  // if the matrix is too small, no blocking:
434
- if(size<=16)
437
+ if(UnBlockedAtCompileTime || size<=UnBlockedBound)
435
438
  {
436
439
  return unblocked_lu(lu, row_transpositions, nb_transpositions);
437
440
  }
@@ -457,12 +460,12 @@ struct partial_lu_impl
457
460
  // A00 | A01 | A02
458
461
  // lu = A_0 | A_1 | A_2 = A10 | A11 | A12
459
462
  // A20 | A21 | A22
460
- BlockType A_0(lu,0,0,rows,k);
461
- BlockType A_2(lu,0,k+bs,rows,tsize);
462
- BlockType A11(lu,k,k,bs,bs);
463
- BlockType A12(lu,k,k+bs,bs,tsize);
464
- BlockType A21(lu,k+bs,k,trows,bs);
465
- BlockType A22(lu,k+bs,k+bs,trows,tsize);
463
+ BlockType A_0 = lu.block(0,0,rows,k);
464
+ BlockType A_2 = lu.block(0,k+bs,rows,tsize);
465
+ BlockType A11 = lu.block(k,k,bs,bs);
466
+ BlockType A12 = lu.block(k,k+bs,bs,tsize);
467
+ BlockType A21 = lu.block(k+bs,k,trows,bs);
468
+ BlockType A22 = lu.block(k+bs,k+bs,trows,tsize);
466
469
 
467
470
  PivIndex nb_transpositions_in_panel;
468
471
  // recursively call the blocked LU algorithm on [A11^T A21^T]^T
@@ -501,11 +504,18 @@ struct partial_lu_impl
501
504
  template<typename MatrixType, typename TranspositionType>
502
505
  void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename TranspositionType::StorageIndex& nb_transpositions)
503
506
  {
507
+ // Special-case of zero matrix.
508
+ if (lu.rows() == 0 || lu.cols() == 0) {
509
+ nb_transpositions = 0;
510
+ return;
511
+ }
504
512
  eigen_assert(lu.cols() == row_transpositions.size());
505
- eigen_assert((&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
513
+ eigen_assert(row_transpositions.size() < 2 || (&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
506
514
 
507
515
  partial_lu_impl
508
- <typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor, typename TranspositionType::StorageIndex>
516
+ < typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor,
517
+ typename TranspositionType::StorageIndex,
518
+ EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime)>
509
519
  ::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
510
520
  }
511
521
 
@@ -519,7 +529,10 @@ void PartialPivLU<MatrixType>::compute()
519
529
  // the row permutation is stored as int indices, so just to be sure:
520
530
  eigen_assert(m_lu.rows()<NumTraits<int>::highest());
521
531
 
522
- m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
532
+ if(m_lu.cols()>0)
533
+ m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
534
+ else
535
+ m_l1_norm = RealScalar(0);
523
536
 
524
537
  eigen_assert(m_lu.rows() == m_lu.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
525
538
  const Index size = m_lu.rows();