forgeo-gmlib 0.6.2__cp311-cp311-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (554) hide show
  1. forgeo/gmlib/GeologicalModel3D.py +758 -0
  2. forgeo/gmlib/__init__.py +9 -0
  3. forgeo/gmlib/_version.py +34 -0
  4. forgeo/gmlib/architecture/__init__.py +1 -0
  5. forgeo/gmlib/architecture/core.py +130 -0
  6. forgeo/gmlib/common.cpython-311-x86_64-linux-musl.so +0 -0
  7. forgeo/gmlib/fault_network.py +171 -0
  8. forgeo/gmlib/geomodeller_data.py +101 -0
  9. forgeo/gmlib/geomodeller_project.py +396 -0
  10. forgeo/gmlib/myxmltools.py +30 -0
  11. forgeo/gmlib/pypotential2D.cpython-311-x86_64-linux-musl.so +0 -0
  12. forgeo/gmlib/pypotential3D.cpython-311-x86_64-linux-musl.so +0 -0
  13. forgeo/gmlib/tesselate.py +236 -0
  14. forgeo/gmlib/tesselate_deprecated.py +249 -0
  15. forgeo/gmlib/topography_reader.py +198 -0
  16. forgeo/gmlib/utils/__init__.py +0 -0
  17. forgeo/gmlib/utils/append_data.py +508 -0
  18. forgeo/gmlib/utils/export.py +45 -0
  19. forgeo/gmlib/utils/normalized_gradient.py +40 -0
  20. forgeo/gmlib/utils/tools.py +35 -0
  21. forgeo_gmlib-0.6.2.dist-info/METADATA +23 -0
  22. forgeo_gmlib-0.6.2.dist-info/RECORD +554 -0
  23. forgeo_gmlib-0.6.2.dist-info/WHEEL +5 -0
  24. forgeo_gmlib-0.6.2.dist-info/licenses/LICENSE +661 -0
  25. include/eigen3/Eigen/Cholesky +45 -0
  26. include/eigen3/Eigen/CholmodSupport +48 -0
  27. include/eigen3/Eigen/Core +385 -0
  28. include/eigen3/Eigen/Dense +7 -0
  29. include/eigen3/Eigen/Eigen +2 -0
  30. include/eigen3/Eigen/Eigenvalues +60 -0
  31. include/eigen3/Eigen/Geometry +59 -0
  32. include/eigen3/Eigen/Householder +29 -0
  33. include/eigen3/Eigen/IterativeLinearSolvers +48 -0
  34. include/eigen3/Eigen/Jacobi +32 -0
  35. include/eigen3/Eigen/KLUSupport +41 -0
  36. include/eigen3/Eigen/LU +47 -0
  37. include/eigen3/Eigen/MetisSupport +35 -0
  38. include/eigen3/Eigen/OrderingMethods +70 -0
  39. include/eigen3/Eigen/PaStiXSupport +49 -0
  40. include/eigen3/Eigen/PardisoSupport +35 -0
  41. include/eigen3/Eigen/QR +50 -0
  42. include/eigen3/Eigen/QtAlignedMalloc +39 -0
  43. include/eigen3/Eigen/SPQRSupport +34 -0
  44. include/eigen3/Eigen/SVD +50 -0
  45. include/eigen3/Eigen/Sparse +34 -0
  46. include/eigen3/Eigen/SparseCholesky +37 -0
  47. include/eigen3/Eigen/SparseCore +69 -0
  48. include/eigen3/Eigen/SparseLU +48 -0
  49. include/eigen3/Eigen/SparseQR +36 -0
  50. include/eigen3/Eigen/StdDeque +27 -0
  51. include/eigen3/Eigen/StdList +26 -0
  52. include/eigen3/Eigen/StdVector +27 -0
  53. include/eigen3/Eigen/SuperLUSupport +64 -0
  54. include/eigen3/Eigen/UmfPackSupport +40 -0
  55. include/eigen3/Eigen/src/Cholesky/LDLT.h +688 -0
  56. include/eigen3/Eigen/src/Cholesky/LLT.h +558 -0
  57. include/eigen3/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  58. include/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
  59. include/eigen3/Eigen/src/Core/ArithmeticSequence.h +406 -0
  60. include/eigen3/Eigen/src/Core/Array.h +425 -0
  61. include/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
  62. include/eigen3/Eigen/src/Core/ArrayWrapper.h +209 -0
  63. include/eigen3/Eigen/src/Core/Assign.h +90 -0
  64. include/eigen3/Eigen/src/Core/AssignEvaluator.h +1010 -0
  65. include/eigen3/Eigen/src/Core/Assign_MKL.h +178 -0
  66. include/eigen3/Eigen/src/Core/BandMatrix.h +353 -0
  67. include/eigen3/Eigen/src/Core/Block.h +463 -0
  68. include/eigen3/Eigen/src/Core/BooleanRedux.h +164 -0
  69. include/eigen3/Eigen/src/Core/CommaInitializer.h +164 -0
  70. include/eigen3/Eigen/src/Core/ConditionEstimator.h +175 -0
  71. include/eigen3/Eigen/src/Core/CoreEvaluators.h +1741 -0
  72. include/eigen3/Eigen/src/Core/CoreIterators.h +132 -0
  73. include/eigen3/Eigen/src/Core/CwiseBinaryOp.h +183 -0
  74. include/eigen3/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
  75. include/eigen3/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  76. include/eigen3/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  77. include/eigen3/Eigen/src/Core/CwiseUnaryView.h +132 -0
  78. include/eigen3/Eigen/src/Core/DenseBase.h +701 -0
  79. include/eigen3/Eigen/src/Core/DenseCoeffsBase.h +685 -0
  80. include/eigen3/Eigen/src/Core/DenseStorage.h +652 -0
  81. include/eigen3/Eigen/src/Core/Diagonal.h +259 -0
  82. include/eigen3/Eigen/src/Core/DiagonalMatrix.h +391 -0
  83. include/eigen3/Eigen/src/Core/DiagonalProduct.h +28 -0
  84. include/eigen3/Eigen/src/Core/Dot.h +313 -0
  85. include/eigen3/Eigen/src/Core/EigenBase.h +160 -0
  86. include/eigen3/Eigen/src/Core/ForceAlignedAccess.h +150 -0
  87. include/eigen3/Eigen/src/Core/Fuzzy.h +155 -0
  88. include/eigen3/Eigen/src/Core/GeneralProduct.h +465 -0
  89. include/eigen3/Eigen/src/Core/GenericPacketMath.h +1040 -0
  90. include/eigen3/Eigen/src/Core/GlobalFunctions.h +194 -0
  91. include/eigen3/Eigen/src/Core/IO.h +258 -0
  92. include/eigen3/Eigen/src/Core/IndexedView.h +247 -0
  93. include/eigen3/Eigen/src/Core/Inverse.h +117 -0
  94. include/eigen3/Eigen/src/Core/Map.h +171 -0
  95. include/eigen3/Eigen/src/Core/MapBase.h +310 -0
  96. include/eigen3/Eigen/src/Core/MathFunctions.h +2212 -0
  97. include/eigen3/Eigen/src/Core/MathFunctionsImpl.h +200 -0
  98. include/eigen3/Eigen/src/Core/Matrix.h +578 -0
  99. include/eigen3/Eigen/src/Core/MatrixBase.h +541 -0
  100. include/eigen3/Eigen/src/Core/NestByValue.h +85 -0
  101. include/eigen3/Eigen/src/Core/NoAlias.h +109 -0
  102. include/eigen3/Eigen/src/Core/NumTraits.h +351 -0
  103. include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h +237 -0
  104. include/eigen3/Eigen/src/Core/PermutationMatrix.h +605 -0
  105. include/eigen3/Eigen/src/Core/PlainObjectBase.h +1128 -0
  106. include/eigen3/Eigen/src/Core/Product.h +191 -0
  107. include/eigen3/Eigen/src/Core/ProductEvaluators.h +1179 -0
  108. include/eigen3/Eigen/src/Core/Random.h +218 -0
  109. include/eigen3/Eigen/src/Core/Redux.h +515 -0
  110. include/eigen3/Eigen/src/Core/Ref.h +381 -0
  111. include/eigen3/Eigen/src/Core/Replicate.h +142 -0
  112. include/eigen3/Eigen/src/Core/Reshaped.h +454 -0
  113. include/eigen3/Eigen/src/Core/ReturnByValue.h +119 -0
  114. include/eigen3/Eigen/src/Core/Reverse.h +217 -0
  115. include/eigen3/Eigen/src/Core/Select.h +164 -0
  116. include/eigen3/Eigen/src/Core/SelfAdjointView.h +365 -0
  117. include/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  118. include/eigen3/Eigen/src/Core/Solve.h +188 -0
  119. include/eigen3/Eigen/src/Core/SolveTriangular.h +235 -0
  120. include/eigen3/Eigen/src/Core/SolverBase.h +168 -0
  121. include/eigen3/Eigen/src/Core/StableNorm.h +251 -0
  122. include/eigen3/Eigen/src/Core/StlIterators.h +463 -0
  123. include/eigen3/Eigen/src/Core/Stride.h +120 -0
  124. include/eigen3/Eigen/src/Core/Swap.h +68 -0
  125. include/eigen3/Eigen/src/Core/Transpose.h +464 -0
  126. include/eigen3/Eigen/src/Core/Transpositions.h +386 -0
  127. include/eigen3/Eigen/src/Core/TriangularMatrix.h +994 -0
  128. include/eigen3/Eigen/src/Core/VectorBlock.h +96 -0
  129. include/eigen3/Eigen/src/Core/VectorwiseOp.h +784 -0
  130. include/eigen3/Eigen/src/Core/Visitor.h +381 -0
  131. include/eigen3/Eigen/src/Core/arch/AVX/Complex.h +368 -0
  132. include/eigen3/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
  133. include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h +1588 -0
  134. include/eigen3/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
  135. include/eigen3/Eigen/src/Core/arch/AVX512/Complex.h +384 -0
  136. include/eigen3/Eigen/src/Core/arch/AVX512/MathFunctions.h +361 -0
  137. include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h +2270 -0
  138. include/eigen3/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  139. include/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +415 -0
  140. include/eigen3/Eigen/src/Core/arch/AltiVec/MathFunctions.h +119 -0
  141. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2776 -0
  142. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +159 -0
  143. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +627 -0
  144. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h +2400 -0
  145. include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +2743 -0
  146. include/eigen3/Eigen/src/Core/arch/CUDA/Complex.h +269 -0
  147. include/eigen3/Eigen/src/Core/arch/Default/BFloat16.h +688 -0
  148. include/eigen3/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
  149. include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1662 -0
  150. include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +116 -0
  151. include/eigen3/Eigen/src/Core/arch/Default/Half.h +950 -0
  152. include/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
  153. include/eigen3/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  154. include/eigen3/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
  155. include/eigen3/Eigen/src/Core/arch/GPU/PacketMath.h +1646 -0
  156. include/eigen3/Eigen/src/Core/arch/GPU/TypeCasting.h +79 -0
  157. include/eigen3/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  158. include/eigen3/Eigen/src/Core/arch/MSA/Complex.h +645 -0
  159. include/eigen3/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  160. include/eigen3/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  161. include/eigen3/Eigen/src/Core/arch/NEON/Complex.h +560 -0
  162. include/eigen3/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  163. include/eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
  164. include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +4653 -0
  165. include/eigen3/Eigen/src/Core/arch/NEON/TypeCasting.h +1424 -0
  166. include/eigen3/Eigen/src/Core/arch/SSE/Complex.h +338 -0
  167. include/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
  168. include/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
  169. include/eigen3/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
  170. include/eigen3/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  171. include/eigen3/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  172. include/eigen3/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  173. include/eigen3/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  174. include/eigen3/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  175. include/eigen3/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  176. include/eigen3/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  177. include/eigen3/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  178. include/eigen3/Eigen/src/Core/arch/ZVector/Complex.h +428 -0
  179. include/eigen3/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
  180. include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
  181. include/eigen3/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
  182. include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
  183. include/eigen3/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
  184. include/eigen3/Eigen/src/Core/functors/StlFunctors.h +166 -0
  185. include/eigen3/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  186. include/eigen3/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
  187. include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
  188. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
  189. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +322 -0
  190. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  191. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
  192. include/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +523 -0
  193. include/eigen3/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  194. include/eigen3/Eigen/src/Core/products/Parallelizer.h +180 -0
  195. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
  196. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
  197. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
  198. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  199. include/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  200. include/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
  201. include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
  202. include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
  203. include/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  204. include/eigen3/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  205. include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
  206. include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
  207. include/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
  208. include/eigen3/Eigen/src/Core/util/BlasUtil.h +583 -0
  209. include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h +521 -0
  210. include/eigen3/Eigen/src/Core/util/Constants.h +563 -0
  211. include/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +138 -0
  212. include/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
  213. include/eigen3/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  214. include/eigen3/Eigen/src/Core/util/IntegralConstant.h +272 -0
  215. include/eigen3/Eigen/src/Core/util/MKL_support.h +137 -0
  216. include/eigen3/Eigen/src/Core/util/Macros.h +1511 -0
  217. include/eigen3/Eigen/src/Core/util/Memory.h +1202 -0
  218. include/eigen3/Eigen/src/Core/util/Meta.h +812 -0
  219. include/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
  220. include/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
  221. include/eigen3/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  222. include/eigen3/Eigen/src/Core/util/StaticAssert.h +221 -0
  223. include/eigen3/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  224. include/eigen3/Eigen/src/Core/util/XprHelper.h +856 -0
  225. include/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +345 -0
  226. include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
  227. include/eigen3/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  228. include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  229. include/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +417 -0
  230. include/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  231. include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  232. include/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  233. include/eigen3/Eigen/src/Eigenvalues/RealQZ.h +657 -0
  234. include/eigen3/Eigen/src/Eigenvalues/RealSchur.h +557 -0
  235. include/eigen3/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  236. include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
  237. include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  238. include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +560 -0
  239. include/eigen3/Eigen/src/Geometry/AlignedBox.h +486 -0
  240. include/eigen3/Eigen/src/Geometry/AngleAxis.h +247 -0
  241. include/eigen3/Eigen/src/Geometry/EulerAngles.h +114 -0
  242. include/eigen3/Eigen/src/Geometry/Homogeneous.h +501 -0
  243. include/eigen3/Eigen/src/Geometry/Hyperplane.h +282 -0
  244. include/eigen3/Eigen/src/Geometry/OrthoMethods.h +235 -0
  245. include/eigen3/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  246. include/eigen3/Eigen/src/Geometry/Quaternion.h +870 -0
  247. include/eigen3/Eigen/src/Geometry/Rotation2D.h +199 -0
  248. include/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
  249. include/eigen3/Eigen/src/Geometry/Scaling.h +188 -0
  250. include/eigen3/Eigen/src/Geometry/Transform.h +1566 -0
  251. include/eigen3/Eigen/src/Geometry/Translation.h +202 -0
  252. include/eigen3/Eigen/src/Geometry/Umeyama.h +168 -0
  253. include/eigen3/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  254. include/eigen3/Eigen/src/Householder/BlockHouseholder.h +110 -0
  255. include/eigen3/Eigen/src/Householder/Householder.h +176 -0
  256. include/eigen3/Eigen/src/Householder/HouseholderSequence.h +553 -0
  257. include/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  258. include/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
  259. include/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +227 -0
  260. include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
  261. include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
  262. include/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
  263. include/eigen3/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
  264. include/eigen3/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
  265. include/eigen3/Eigen/src/Jacobi/Jacobi.h +483 -0
  266. include/eigen3/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  267. include/eigen3/Eigen/src/LU/Determinant.h +117 -0
  268. include/eigen3/Eigen/src/LU/FullPivLU.h +877 -0
  269. include/eigen3/Eigen/src/LU/InverseImpl.h +432 -0
  270. include/eigen3/Eigen/src/LU/PartialPivLU.h +624 -0
  271. include/eigen3/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  272. include/eigen3/Eigen/src/LU/arch/InverseSize4.h +363 -0
  273. include/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  274. include/eigen3/Eigen/src/OrderingMethods/Amd.h +435 -0
  275. include/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
  276. include/eigen3/Eigen/src/OrderingMethods/Ordering.h +153 -0
  277. include/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  278. include/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
  279. include/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  280. include/eigen3/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  281. include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
  282. include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
  283. include/eigen3/Eigen/src/QR/HouseholderQR.h +434 -0
  284. include/eigen3/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  285. include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
  286. include/eigen3/Eigen/src/SVD/BDCSVD.h +1377 -0
  287. include/eigen3/Eigen/src/SVD/JacobiSVD.h +813 -0
  288. include/eigen3/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  289. include/eigen3/Eigen/src/SVD/SVDBase.h +376 -0
  290. include/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +415 -0
  291. include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
  292. include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
  293. include/eigen3/Eigen/src/SparseCore/AmbiVector.h +378 -0
  294. include/eigen3/Eigen/src/SparseCore/CompressedStorage.h +274 -0
  295. include/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  296. include/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  297. include/eigen3/Eigen/src/SparseCore/SparseAssign.h +270 -0
  298. include/eigen3/Eigen/src/SparseCore/SparseBlock.h +566 -0
  299. include/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  300. include/eigen3/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
  301. include/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
  302. include/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
  303. include/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
  304. include/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  305. include/eigen3/Eigen/src/SparseCore/SparseDot.h +98 -0
  306. include/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  307. include/eigen3/Eigen/src/SparseCore/SparseMap.h +306 -0
  308. include/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
  309. include/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +399 -0
  310. include/eigen3/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  311. include/eigen3/Eigen/src/SparseCore/SparseProduct.h +182 -0
  312. include/eigen3/Eigen/src/SparseCore/SparseRedux.h +49 -0
  313. include/eigen3/Eigen/src/SparseCore/SparseRef.h +397 -0
  314. include/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
  315. include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  316. include/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  317. include/eigen3/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  318. include/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  319. include/eigen3/Eigen/src/SparseCore/SparseUtil.h +186 -0
  320. include/eigen3/Eigen/src/SparseCore/SparseVector.h +480 -0
  321. include/eigen3/Eigen/src/SparseCore/SparseView.h +254 -0
  322. include/eigen3/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  323. include/eigen3/Eigen/src/SparseLU/SparseLU.h +925 -0
  324. include/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  325. include/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  326. include/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  327. include/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +374 -0
  328. include/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  329. include/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  330. include/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  331. include/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  332. include/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +121 -0
  333. include/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +129 -0
  334. include/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +222 -0
  335. include/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  336. include/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  337. include/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  338. include/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  339. include/eigen3/Eigen/src/SparseQR/SparseQR.h +758 -0
  340. include/eigen3/Eigen/src/StlSupport/StdDeque.h +116 -0
  341. include/eigen3/Eigen/src/StlSupport/StdList.h +106 -0
  342. include/eigen3/Eigen/src/StlSupport/StdVector.h +131 -0
  343. include/eigen3/Eigen/src/StlSupport/details.h +84 -0
  344. include/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
  345. include/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
  346. include/eigen3/Eigen/src/misc/Image.h +82 -0
  347. include/eigen3/Eigen/src/misc/Kernel.h +79 -0
  348. include/eigen3/Eigen/src/misc/RealSvd2x2.h +55 -0
  349. include/eigen3/Eigen/src/misc/blas.h +440 -0
  350. include/eigen3/Eigen/src/misc/lapack.h +152 -0
  351. include/eigen3/Eigen/src/misc/lapacke.h +16292 -0
  352. include/eigen3/Eigen/src/misc/lapacke_mangling.h +17 -0
  353. include/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +431 -0
  354. include/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
  355. include/eigen3/Eigen/src/plugins/BlockMethods.h +1442 -0
  356. include/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  357. include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
  358. include/eigen3/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  359. include/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +184 -0
  360. include/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
  361. include/eigen3/Eigen/src/plugins/ReshapedMethods.h +149 -0
  362. include/eigen3/signature_of_eigen3_matrix_library +1 -0
  363. include/eigen3/unsupported/Eigen/AdolcForward +159 -0
  364. include/eigen3/unsupported/Eigen/AlignedVector3 +234 -0
  365. include/eigen3/unsupported/Eigen/ArpackSupport +30 -0
  366. include/eigen3/unsupported/Eigen/AutoDiff +48 -0
  367. include/eigen3/unsupported/Eigen/BVH +95 -0
  368. include/eigen3/unsupported/Eigen/CXX11/Tensor +137 -0
  369. include/eigen3/unsupported/Eigen/CXX11/TensorSymmetry +42 -0
  370. include/eigen3/unsupported/Eigen/CXX11/ThreadPool +74 -0
  371. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +554 -0
  372. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +327 -0
  373. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +242 -0
  374. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +1176 -0
  375. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +1559 -0
  376. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +1083 -0
  377. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +510 -0
  378. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +373 -0
  379. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +1019 -0
  380. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h +73 -0
  381. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h +6 -0
  382. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +1413 -0
  383. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +575 -0
  384. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h +1650 -0
  385. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +1679 -0
  386. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h +455 -0
  387. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h +1126 -0
  388. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h +536 -0
  389. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h +213 -0
  390. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +342 -0
  391. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h +137 -0
  392. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h +6 -0
  393. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h +104 -0
  394. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h +389 -0
  395. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h +1048 -0
  396. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +409 -0
  397. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h +234 -0
  398. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +493 -0
  399. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +229 -0
  400. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +980 -0
  401. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +701 -0
  402. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +389 -0
  403. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +669 -0
  404. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +377 -0
  405. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +232 -0
  406. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +191 -0
  407. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +488 -0
  408. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +297 -0
  409. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h +33 -0
  410. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h +99 -0
  411. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h +44 -0
  412. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +79 -0
  413. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +602 -0
  414. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +735 -0
  415. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h +244 -0
  416. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +82 -0
  417. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +257 -0
  418. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h +213 -0
  419. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +98 -0
  420. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +327 -0
  421. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +311 -0
  422. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +1098 -0
  423. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +705 -0
  424. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h +286 -0
  425. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +317 -0
  426. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +1000 -0
  427. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h +6 -0
  428. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +973 -0
  429. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h +582 -0
  430. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +454 -0
  431. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h +462 -0
  432. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +528 -0
  433. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h +513 -0
  434. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +466 -0
  435. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h +157 -0
  436. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +341 -0
  437. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h +299 -0
  438. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +264 -0
  439. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h +249 -0
  440. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +628 -0
  441. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h +293 -0
  442. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h +236 -0
  443. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h +338 -0
  444. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h +669 -0
  445. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h +67 -0
  446. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h +249 -0
  447. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +486 -0
  448. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h +236 -0
  449. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h +23 -0
  450. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h +40 -0
  451. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h +301 -0
  452. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h +48 -0
  453. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h +20 -0
  454. include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h +538 -0
  455. include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h +88 -0
  456. include/eigen3/unsupported/Eigen/CXX11/src/util/EmulateArray.h +261 -0
  457. include/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h +158 -0
  458. include/eigen3/unsupported/Eigen/EulerAngles +43 -0
  459. include/eigen3/unsupported/Eigen/FFT +420 -0
  460. include/eigen3/unsupported/Eigen/IterativeSolvers +51 -0
  461. include/eigen3/unsupported/Eigen/KroneckerProduct +36 -0
  462. include/eigen3/unsupported/Eigen/LevenbergMarquardt +49 -0
  463. include/eigen3/unsupported/Eigen/MPRealSupport +213 -0
  464. include/eigen3/unsupported/Eigen/MatrixFunctions +504 -0
  465. include/eigen3/unsupported/Eigen/MoreVectorization +24 -0
  466. include/eigen3/unsupported/Eigen/NonLinearOptimization +140 -0
  467. include/eigen3/unsupported/Eigen/NumericalDiff +56 -0
  468. include/eigen3/unsupported/Eigen/OpenGLSupport +322 -0
  469. include/eigen3/unsupported/Eigen/Polynomials +137 -0
  470. include/eigen3/unsupported/Eigen/Skyline +39 -0
  471. include/eigen3/unsupported/Eigen/SparseExtra +54 -0
  472. include/eigen3/unsupported/Eigen/SpecialFunctions +103 -0
  473. include/eigen3/unsupported/Eigen/Splines +35 -0
  474. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h +108 -0
  475. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +730 -0
  476. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h +220 -0
  477. include/eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h +293 -0
  478. include/eigen3/unsupported/Eigen/src/BVH/KdBVH.h +223 -0
  479. include/eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +790 -0
  480. include/eigen3/unsupported/Eigen/src/EulerAngles/EulerAngles.h +356 -0
  481. include/eigen3/unsupported/Eigen/src/EulerAngles/EulerSystem.h +306 -0
  482. include/eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h +261 -0
  483. include/eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h +449 -0
  484. include/eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h +187 -0
  485. include/eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h +511 -0
  486. include/eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h +335 -0
  487. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IDRS.h +436 -0
  488. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h +90 -0
  489. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h +154 -0
  490. include/eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h +267 -0
  491. include/eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h +193 -0
  492. include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h +305 -0
  493. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h +84 -0
  494. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h +202 -0
  495. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h +160 -0
  496. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h +188 -0
  497. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h +396 -0
  498. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +441 -0
  499. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +569 -0
  500. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +373 -0
  501. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +705 -0
  502. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +368 -0
  503. include/eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h +117 -0
  504. include/eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h +95 -0
  505. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +601 -0
  506. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +657 -0
  507. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h +66 -0
  508. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h +70 -0
  509. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/dogleg.h +107 -0
  510. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h +79 -0
  511. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +298 -0
  512. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h +91 -0
  513. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h +30 -0
  514. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1updt.h +99 -0
  515. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h +49 -0
  516. include/eigen3/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +130 -0
  517. include/eigen3/unsupported/Eigen/src/Polynomials/Companion.h +280 -0
  518. include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialSolver.h +429 -0
  519. include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialUtils.h +143 -0
  520. include/eigen3/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h +352 -0
  521. include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrix.h +862 -0
  522. include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h +212 -0
  523. include/eigen3/unsupported/Eigen/src/Skyline/SkylineProduct.h +295 -0
  524. include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h +259 -0
  525. include/eigen3/unsupported/Eigen/src/Skyline/SkylineUtil.h +89 -0
  526. include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h +122 -0
  527. include/eigen3/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h +1079 -0
  528. include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h +404 -0
  529. include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h +282 -0
  530. include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +247 -0
  531. include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h +349 -0
  532. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h +286 -0
  533. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h +68 -0
  534. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h +357 -0
  535. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h +66 -0
  536. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +1959 -0
  537. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h +118 -0
  538. include/eigen3/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h +67 -0
  539. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h +167 -0
  540. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h +58 -0
  541. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h +330 -0
  542. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h +58 -0
  543. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +2051 -0
  544. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h +79 -0
  545. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h +46 -0
  546. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h +16 -0
  547. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h +51 -0
  548. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h +16 -0
  549. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h +369 -0
  550. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h +54 -0
  551. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h +34 -0
  552. include/eigen3/unsupported/Eigen/src/Splines/Spline.h +507 -0
  553. include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h +431 -0
  554. include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h +93 -0
@@ -0,0 +1,1377 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // We used the "A Divide-And-Conquer Algorithm for the Bidiagonal SVD"
5
+ // research report written by Ming Gu and Stanley C.Eisenstat
6
+ // The code variable names correspond to the names they used in their
7
+ // report
8
+ //
9
+ // Copyright (C) 2013 Gauthier Brun <brun.gauthier@gmail.com>
10
+ // Copyright (C) 2013 Nicolas Carre <nicolas.carre@ensimag.fr>
11
+ // Copyright (C) 2013 Jean Ceccato <jean.ceccato@ensimag.fr>
12
+ // Copyright (C) 2013 Pierre Zoppitelli <pierre.zoppitelli@ensimag.fr>
13
+ // Copyright (C) 2013 Jitse Niesen <jitse@maths.leeds.ac.uk>
14
+ // Copyright (C) 2014-2017 Gael Guennebaud <gael.guennebaud@inria.fr>
15
+ //
16
+ // Source Code Form is subject to the terms of the Mozilla
17
+ // Public License v. 2.0. If a copy of the MPL was not distributed
18
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
19
+
20
+ #ifndef EIGEN_BDCSVD_H
21
+ #define EIGEN_BDCSVD_H
22
+ // #define EIGEN_BDCSVD_DEBUG_VERBOSE
23
+ // #define EIGEN_BDCSVD_SANITY_CHECKS
24
+
25
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
26
+ #undef eigen_internal_assert
27
+ #define eigen_internal_assert(X) assert(X);
28
+ #endif
29
+
30
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
31
+ #include <iostream>
32
+ #endif
33
+
34
+ namespace Eigen {
35
+
36
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
37
+ IOFormat bdcsvdfmt(8, 0, ", ", "\n", " [", "]");
38
+ #endif
39
+
40
+ template<typename _MatrixType> class BDCSVD;
41
+
42
+ namespace internal {
43
+
44
+ template<typename _MatrixType>
45
+ struct traits<BDCSVD<_MatrixType> >
46
+ : traits<_MatrixType>
47
+ {
48
+ typedef _MatrixType MatrixType;
49
+ };
50
+
51
+ } // end namespace internal
52
+
53
+
54
+ /** \ingroup SVD_Module
55
+ *
56
+ *
57
+ * \class BDCSVD
58
+ *
59
+ * \brief class Bidiagonal Divide and Conquer SVD
60
+ *
61
+ * \tparam _MatrixType the type of the matrix of which we are computing the SVD decomposition
62
+ *
63
+ * This class first reduces the input matrix to bi-diagonal form using class UpperBidiagonalization,
64
+ * and then performs a divide-and-conquer diagonalization. Small blocks are diagonalized using class JacobiSVD.
65
+ * You can control the switching size with the setSwitchSize() method, default is 16.
66
+ * For small matrice (<16), it is thus preferable to directly use JacobiSVD. For larger ones, BDCSVD is highly
67
+ * recommended and can several order of magnitude faster.
68
+ *
69
+ * \warning this algorithm is unlikely to provide accurate result when compiled with unsafe math optimizations.
70
+ * For instance, this concerns Intel's compiler (ICC), which performs such optimization by default unless
71
+ * you compile with the \c -fp-model \c precise option. Likewise, the \c -ffast-math option of GCC or clang will
72
+ * significantly degrade the accuracy.
73
+ *
74
+ * \sa class JacobiSVD
75
+ */
76
+ template<typename _MatrixType>
77
+ class BDCSVD : public SVDBase<BDCSVD<_MatrixType> >
78
+ {
79
+ typedef SVDBase<BDCSVD> Base;
80
+
81
+ public:
82
+ using Base::rows;
83
+ using Base::cols;
84
+ using Base::computeU;
85
+ using Base::computeV;
86
+
87
+ typedef _MatrixType MatrixType;
88
+ typedef typename MatrixType::Scalar Scalar;
89
+ typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
90
+ typedef typename NumTraits<RealScalar>::Literal Literal;
91
+ enum {
92
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
93
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime,
94
+ DiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime),
95
+ MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
96
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
97
+ MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(MaxRowsAtCompileTime, MaxColsAtCompileTime),
98
+ MatrixOptions = MatrixType::Options
99
+ };
100
+
101
+ typedef typename Base::MatrixUType MatrixUType;
102
+ typedef typename Base::MatrixVType MatrixVType;
103
+ typedef typename Base::SingularValuesType SingularValuesType;
104
+
105
+ typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> MatrixX;
106
+ typedef Matrix<RealScalar, Dynamic, Dynamic, ColMajor> MatrixXr;
107
+ typedef Matrix<RealScalar, Dynamic, 1> VectorType;
108
+ typedef Array<RealScalar, Dynamic, 1> ArrayXr;
109
+ typedef Array<Index,1,Dynamic> ArrayXi;
110
+ typedef Ref<ArrayXr> ArrayRef;
111
+ typedef Ref<ArrayXi> IndicesRef;
112
+
113
+ /** \brief Default Constructor.
114
+ *
115
+ * The default constructor is useful in cases in which the user intends to
116
+ * perform decompositions via BDCSVD::compute(const MatrixType&).
117
+ */
118
+ BDCSVD() : m_algoswap(16), m_isTranspose(false), m_compU(false), m_compV(false), m_numIters(0)
119
+ {}
120
+
121
+
122
+ /** \brief Default Constructor with memory preallocation
123
+ *
124
+ * Like the default constructor but with preallocation of the internal data
125
+ * according to the specified problem size.
126
+ * \sa BDCSVD()
127
+ */
128
+ BDCSVD(Index rows, Index cols, unsigned int computationOptions = 0)
129
+ : m_algoswap(16), m_numIters(0)
130
+ {
131
+ allocate(rows, cols, computationOptions);
132
+ }
133
+
134
+ /** \brief Constructor performing the decomposition of given matrix.
135
+ *
136
+ * \param matrix the matrix to decompose
137
+ * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
138
+ * By default, none is computed. This is a bit - field, the possible bits are #ComputeFullU, #ComputeThinU,
139
+ * #ComputeFullV, #ComputeThinV.
140
+ *
141
+ * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
142
+ * available with the (non - default) FullPivHouseholderQR preconditioner.
143
+ */
144
+ BDCSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
145
+ : m_algoswap(16), m_numIters(0)
146
+ {
147
+ compute(matrix, computationOptions);
148
+ }
149
+
150
+ ~BDCSVD()
151
+ {
152
+ }
153
+
154
+ /** \brief Method performing the decomposition of given matrix using custom options.
155
+ *
156
+ * \param matrix the matrix to decompose
157
+ * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
158
+ * By default, none is computed. This is a bit - field, the possible bits are #ComputeFullU, #ComputeThinU,
159
+ * #ComputeFullV, #ComputeThinV.
160
+ *
161
+ * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
162
+ * available with the (non - default) FullPivHouseholderQR preconditioner.
163
+ */
164
+ BDCSVD& compute(const MatrixType& matrix, unsigned int computationOptions);
165
+
166
+ /** \brief Method performing the decomposition of given matrix using current options.
167
+ *
168
+ * \param matrix the matrix to decompose
169
+ *
170
+ * This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int).
171
+ */
172
+ BDCSVD& compute(const MatrixType& matrix)
173
+ {
174
+ return compute(matrix, this->m_computationOptions);
175
+ }
176
+
177
+ void setSwitchSize(int s)
178
+ {
179
+ eigen_assert(s>=3 && "BDCSVD the size of the algo switch has to be at least 3.");
180
+ m_algoswap = s;
181
+ }
182
+
183
+ private:
184
+ void allocate(Index rows, Index cols, unsigned int computationOptions);
185
+ void divide(Index firstCol, Index lastCol, Index firstRowW, Index firstColW, Index shift);
186
+ void computeSVDofM(Index firstCol, Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V);
187
+ void computeSingVals(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef& perm, VectorType& singVals, ArrayRef shifts, ArrayRef mus);
188
+ void perturbCol0(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef& perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, ArrayRef zhat);
189
+ void computeSingVecs(const ArrayRef& zhat, const ArrayRef& diag, const IndicesRef& perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, MatrixXr& U, MatrixXr& V);
190
+ void deflation43(Index firstCol, Index shift, Index i, Index size);
191
+ void deflation44(Index firstColu , Index firstColm, Index firstRowW, Index firstColW, Index i, Index j, Index size);
192
+ void deflation(Index firstCol, Index lastCol, Index k, Index firstRowW, Index firstColW, Index shift);
193
+ template<typename HouseholderU, typename HouseholderV, typename NaiveU, typename NaiveV>
194
+ void copyUV(const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naivev);
195
+ void structured_update(Block<MatrixXr,Dynamic,Dynamic> A, const MatrixXr &B, Index n1);
196
+ static RealScalar secularEq(RealScalar x, const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const ArrayRef& diagShifted, RealScalar shift);
197
+
198
+ protected:
199
+ MatrixXr m_naiveU, m_naiveV;
200
+ MatrixXr m_computed;
201
+ Index m_nRec;
202
+ ArrayXr m_workspace;
203
+ ArrayXi m_workspaceI;
204
+ int m_algoswap;
205
+ bool m_isTranspose, m_compU, m_compV;
206
+
207
+ using Base::m_singularValues;
208
+ using Base::m_diagSize;
209
+ using Base::m_computeFullU;
210
+ using Base::m_computeFullV;
211
+ using Base::m_computeThinU;
212
+ using Base::m_computeThinV;
213
+ using Base::m_matrixU;
214
+ using Base::m_matrixV;
215
+ using Base::m_info;
216
+ using Base::m_isInitialized;
217
+ using Base::m_nonzeroSingularValues;
218
+
219
+ public:
220
+ int m_numIters;
221
+ }; //end class BDCSVD
222
+
223
+
224
+ // Method to allocate and initialize matrix and attributes
225
+ template<typename MatrixType>
226
+ void BDCSVD<MatrixType>::allocate(Eigen::Index rows, Eigen::Index cols, unsigned int computationOptions)
227
+ {
228
+ m_isTranspose = (cols > rows);
229
+
230
+ if (Base::allocate(rows, cols, computationOptions))
231
+ return;
232
+
233
+ m_computed = MatrixXr::Zero(m_diagSize + 1, m_diagSize );
234
+ m_compU = computeV();
235
+ m_compV = computeU();
236
+ if (m_isTranspose)
237
+ std::swap(m_compU, m_compV);
238
+
239
+ if (m_compU) m_naiveU = MatrixXr::Zero(m_diagSize + 1, m_diagSize + 1 );
240
+ else m_naiveU = MatrixXr::Zero(2, m_diagSize + 1 );
241
+
242
+ if (m_compV) m_naiveV = MatrixXr::Zero(m_diagSize, m_diagSize);
243
+
244
+ m_workspace.resize((m_diagSize+1)*(m_diagSize+1)*3);
245
+ m_workspaceI.resize(3*m_diagSize);
246
+ }// end allocate
247
+
248
+ template<typename MatrixType>
249
+ BDCSVD<MatrixType>& BDCSVD<MatrixType>::compute(const MatrixType& matrix, unsigned int computationOptions)
250
+ {
251
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
252
+ std::cout << "\n\n\n======================================================================================================================\n\n\n";
253
+ #endif
254
+ allocate(matrix.rows(), matrix.cols(), computationOptions);
255
+ using std::abs;
256
+
257
+ const RealScalar considerZero = (std::numeric_limits<RealScalar>::min)();
258
+
259
+ //**** step -1 - If the problem is too small, directly falls back to JacobiSVD and return
260
+ if(matrix.cols() < m_algoswap)
261
+ {
262
+ // FIXME this line involves temporaries
263
+ JacobiSVD<MatrixType> jsvd(matrix,computationOptions);
264
+ m_isInitialized = true;
265
+ m_info = jsvd.info();
266
+ if (m_info == Success || m_info == NoConvergence) {
267
+ if(computeU()) m_matrixU = jsvd.matrixU();
268
+ if(computeV()) m_matrixV = jsvd.matrixV();
269
+ m_singularValues = jsvd.singularValues();
270
+ m_nonzeroSingularValues = jsvd.nonzeroSingularValues();
271
+ }
272
+ return *this;
273
+ }
274
+
275
+ //**** step 0 - Copy the input matrix and apply scaling to reduce over/under-flows
276
+ RealScalar scale = matrix.cwiseAbs().template maxCoeff<PropagateNaN>();
277
+ if (!(numext::isfinite)(scale)) {
278
+ m_isInitialized = true;
279
+ m_info = InvalidInput;
280
+ return *this;
281
+ }
282
+
283
+ if(scale==Literal(0)) scale = Literal(1);
284
+ MatrixX copy;
285
+ if (m_isTranspose) copy = matrix.adjoint()/scale;
286
+ else copy = matrix/scale;
287
+
288
+ //**** step 1 - Bidiagonalization
289
+ // FIXME this line involves temporaries
290
+ internal::UpperBidiagonalization<MatrixX> bid(copy);
291
+
292
+ //**** step 2 - Divide & Conquer
293
+ m_naiveU.setZero();
294
+ m_naiveV.setZero();
295
+ // FIXME this line involves a temporary matrix
296
+ m_computed.topRows(m_diagSize) = bid.bidiagonal().toDenseMatrix().transpose();
297
+ m_computed.template bottomRows<1>().setZero();
298
+ divide(0, m_diagSize - 1, 0, 0, 0);
299
+ if (m_info != Success && m_info != NoConvergence) {
300
+ m_isInitialized = true;
301
+ return *this;
302
+ }
303
+
304
+ //**** step 3 - Copy singular values and vectors
305
+ for (int i=0; i<m_diagSize; i++)
306
+ {
307
+ RealScalar a = abs(m_computed.coeff(i, i));
308
+ m_singularValues.coeffRef(i) = a * scale;
309
+ if (a<considerZero)
310
+ {
311
+ m_nonzeroSingularValues = i;
312
+ m_singularValues.tail(m_diagSize - i - 1).setZero();
313
+ break;
314
+ }
315
+ else if (i == m_diagSize - 1)
316
+ {
317
+ m_nonzeroSingularValues = i + 1;
318
+ break;
319
+ }
320
+ }
321
+
322
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
323
+ // std::cout << "m_naiveU\n" << m_naiveU << "\n\n";
324
+ // std::cout << "m_naiveV\n" << m_naiveV << "\n\n";
325
+ #endif
326
+ if(m_isTranspose) copyUV(bid.householderV(), bid.householderU(), m_naiveV, m_naiveU);
327
+ else copyUV(bid.householderU(), bid.householderV(), m_naiveU, m_naiveV);
328
+
329
+ m_isInitialized = true;
330
+ return *this;
331
+ }// end compute
332
+
333
+
334
+ template<typename MatrixType>
335
+ template<typename HouseholderU, typename HouseholderV, typename NaiveU, typename NaiveV>
336
+ void BDCSVD<MatrixType>::copyUV(const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naiveV)
337
+ {
338
+ // Note exchange of U and V: m_matrixU is set from m_naiveV and vice versa
339
+ if (computeU())
340
+ {
341
+ Index Ucols = m_computeThinU ? m_diagSize : householderU.cols();
342
+ m_matrixU = MatrixX::Identity(householderU.cols(), Ucols);
343
+ m_matrixU.topLeftCorner(m_diagSize, m_diagSize) = naiveV.template cast<Scalar>().topLeftCorner(m_diagSize, m_diagSize);
344
+ householderU.applyThisOnTheLeft(m_matrixU); // FIXME this line involves a temporary buffer
345
+ }
346
+ if (computeV())
347
+ {
348
+ Index Vcols = m_computeThinV ? m_diagSize : householderV.cols();
349
+ m_matrixV = MatrixX::Identity(householderV.cols(), Vcols);
350
+ m_matrixV.topLeftCorner(m_diagSize, m_diagSize) = naiveU.template cast<Scalar>().topLeftCorner(m_diagSize, m_diagSize);
351
+ householderV.applyThisOnTheLeft(m_matrixV); // FIXME this line involves a temporary buffer
352
+ }
353
+ }
354
+
355
+ /** \internal
356
+ * Performs A = A * B exploiting the special structure of the matrix A. Splitting A as:
357
+ * A = [A1]
358
+ * [A2]
359
+ * such that A1.rows()==n1, then we assume that at least half of the columns of A1 and A2 are zeros.
360
+ * We can thus pack them prior to the the matrix product. However, this is only worth the effort if the matrix is large
361
+ * enough.
362
+ */
363
+ template<typename MatrixType>
364
+ void BDCSVD<MatrixType>::structured_update(Block<MatrixXr,Dynamic,Dynamic> A, const MatrixXr &B, Index n1)
365
+ {
366
+ Index n = A.rows();
367
+ if(n>100)
368
+ {
369
+ // If the matrices are large enough, let's exploit the sparse structure of A by
370
+ // splitting it in half (wrt n1), and packing the non-zero columns.
371
+ Index n2 = n - n1;
372
+ Map<MatrixXr> A1(m_workspace.data() , n1, n);
373
+ Map<MatrixXr> A2(m_workspace.data()+ n1*n, n2, n);
374
+ Map<MatrixXr> B1(m_workspace.data()+ n*n, n, n);
375
+ Map<MatrixXr> B2(m_workspace.data()+2*n*n, n, n);
376
+ Index k1=0, k2=0;
377
+ for(Index j=0; j<n; ++j)
378
+ {
379
+ if( (A.col(j).head(n1).array()!=Literal(0)).any() )
380
+ {
381
+ A1.col(k1) = A.col(j).head(n1);
382
+ B1.row(k1) = B.row(j);
383
+ ++k1;
384
+ }
385
+ if( (A.col(j).tail(n2).array()!=Literal(0)).any() )
386
+ {
387
+ A2.col(k2) = A.col(j).tail(n2);
388
+ B2.row(k2) = B.row(j);
389
+ ++k2;
390
+ }
391
+ }
392
+
393
+ A.topRows(n1).noalias() = A1.leftCols(k1) * B1.topRows(k1);
394
+ A.bottomRows(n2).noalias() = A2.leftCols(k2) * B2.topRows(k2);
395
+ }
396
+ else
397
+ {
398
+ Map<MatrixXr,Aligned> tmp(m_workspace.data(),n,n);
399
+ tmp.noalias() = A*B;
400
+ A = tmp;
401
+ }
402
+ }
403
+
404
+ // The divide algorithm is done "in place", we are always working on subsets of the same matrix. The divide methods takes as argument the
405
+ // place of the submatrix we are currently working on.
406
+
407
+ //@param firstCol : The Index of the first column of the submatrix of m_computed and for m_naiveU;
408
+ //@param lastCol : The Index of the last column of the submatrix of m_computed and for m_naiveU;
409
+ // lastCol + 1 - firstCol is the size of the submatrix.
410
+ //@param firstRowW : The Index of the first row of the matrix W that we are to change. (see the reference paper section 1 for more information on W)
411
+ //@param firstColW : Same as firstRowW with the column.
412
+ //@param shift : Each time one takes the left submatrix, one must add 1 to the shift. Why? Because! We actually want the last column of the U submatrix
413
+ // to become the first column (*coeff) and to shift all the other columns to the right. There are more details on the reference paper.
414
+ template<typename MatrixType>
415
+ void BDCSVD<MatrixType>::divide(Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift)
416
+ {
417
+ // requires rows = cols + 1;
418
+ using std::pow;
419
+ using std::sqrt;
420
+ using std::abs;
421
+ const Index n = lastCol - firstCol + 1;
422
+ const Index k = n/2;
423
+ const RealScalar considerZero = (std::numeric_limits<RealScalar>::min)();
424
+ RealScalar alphaK;
425
+ RealScalar betaK;
426
+ RealScalar r0;
427
+ RealScalar lambda, phi, c0, s0;
428
+ VectorType l, f;
429
+ // We use the other algorithm which is more efficient for small
430
+ // matrices.
431
+ if (n < m_algoswap)
432
+ {
433
+ // FIXME this line involves temporaries
434
+ JacobiSVD<MatrixXr> b(m_computed.block(firstCol, firstCol, n + 1, n), ComputeFullU | (m_compV ? ComputeFullV : 0));
435
+ m_info = b.info();
436
+ if (m_info != Success && m_info != NoConvergence) return;
437
+ if (m_compU)
438
+ m_naiveU.block(firstCol, firstCol, n + 1, n + 1).real() = b.matrixU();
439
+ else
440
+ {
441
+ m_naiveU.row(0).segment(firstCol, n + 1).real() = b.matrixU().row(0);
442
+ m_naiveU.row(1).segment(firstCol, n + 1).real() = b.matrixU().row(n);
443
+ }
444
+ if (m_compV) m_naiveV.block(firstRowW, firstColW, n, n).real() = b.matrixV();
445
+ m_computed.block(firstCol + shift, firstCol + shift, n + 1, n).setZero();
446
+ m_computed.diagonal().segment(firstCol + shift, n) = b.singularValues().head(n);
447
+ return;
448
+ }
449
+ // We use the divide and conquer algorithm
450
+ alphaK = m_computed(firstCol + k, firstCol + k);
451
+ betaK = m_computed(firstCol + k + 1, firstCol + k);
452
+ // The divide must be done in that order in order to have good results. Divide change the data inside the submatrices
453
+ // and the divide of the right submatrice reads one column of the left submatrice. That's why we need to treat the
454
+ // right submatrix before the left one.
455
+ divide(k + 1 + firstCol, lastCol, k + 1 + firstRowW, k + 1 + firstColW, shift);
456
+ if (m_info != Success && m_info != NoConvergence) return;
457
+ divide(firstCol, k - 1 + firstCol, firstRowW, firstColW + 1, shift + 1);
458
+ if (m_info != Success && m_info != NoConvergence) return;
459
+
460
+ if (m_compU)
461
+ {
462
+ lambda = m_naiveU(firstCol + k, firstCol + k);
463
+ phi = m_naiveU(firstCol + k + 1, lastCol + 1);
464
+ }
465
+ else
466
+ {
467
+ lambda = m_naiveU(1, firstCol + k);
468
+ phi = m_naiveU(0, lastCol + 1);
469
+ }
470
+ r0 = sqrt((abs(alphaK * lambda) * abs(alphaK * lambda)) + abs(betaK * phi) * abs(betaK * phi));
471
+ if (m_compU)
472
+ {
473
+ l = m_naiveU.row(firstCol + k).segment(firstCol, k);
474
+ f = m_naiveU.row(firstCol + k + 1).segment(firstCol + k + 1, n - k - 1);
475
+ }
476
+ else
477
+ {
478
+ l = m_naiveU.row(1).segment(firstCol, k);
479
+ f = m_naiveU.row(0).segment(firstCol + k + 1, n - k - 1);
480
+ }
481
+ if (m_compV) m_naiveV(firstRowW+k, firstColW) = Literal(1);
482
+ if (r0<considerZero)
483
+ {
484
+ c0 = Literal(1);
485
+ s0 = Literal(0);
486
+ }
487
+ else
488
+ {
489
+ c0 = alphaK * lambda / r0;
490
+ s0 = betaK * phi / r0;
491
+ }
492
+
493
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
494
+ assert(m_naiveU.allFinite());
495
+ assert(m_naiveV.allFinite());
496
+ assert(m_computed.allFinite());
497
+ #endif
498
+
499
+ if (m_compU)
500
+ {
501
+ MatrixXr q1 (m_naiveU.col(firstCol + k).segment(firstCol, k + 1));
502
+ // we shiftW Q1 to the right
503
+ for (Index i = firstCol + k - 1; i >= firstCol; i--)
504
+ m_naiveU.col(i + 1).segment(firstCol, k + 1) = m_naiveU.col(i).segment(firstCol, k + 1);
505
+ // we shift q1 at the left with a factor c0
506
+ m_naiveU.col(firstCol).segment( firstCol, k + 1) = (q1 * c0);
507
+ // last column = q1 * - s0
508
+ m_naiveU.col(lastCol + 1).segment(firstCol, k + 1) = (q1 * ( - s0));
509
+ // first column = q2 * s0
510
+ m_naiveU.col(firstCol).segment(firstCol + k + 1, n - k) = m_naiveU.col(lastCol + 1).segment(firstCol + k + 1, n - k) * s0;
511
+ // q2 *= c0
512
+ m_naiveU.col(lastCol + 1).segment(firstCol + k + 1, n - k) *= c0;
513
+ }
514
+ else
515
+ {
516
+ RealScalar q1 = m_naiveU(0, firstCol + k);
517
+ // we shift Q1 to the right
518
+ for (Index i = firstCol + k - 1; i >= firstCol; i--)
519
+ m_naiveU(0, i + 1) = m_naiveU(0, i);
520
+ // we shift q1 at the left with a factor c0
521
+ m_naiveU(0, firstCol) = (q1 * c0);
522
+ // last column = q1 * - s0
523
+ m_naiveU(0, lastCol + 1) = (q1 * ( - s0));
524
+ // first column = q2 * s0
525
+ m_naiveU(1, firstCol) = m_naiveU(1, lastCol + 1) *s0;
526
+ // q2 *= c0
527
+ m_naiveU(1, lastCol + 1) *= c0;
528
+ m_naiveU.row(1).segment(firstCol + 1, k).setZero();
529
+ m_naiveU.row(0).segment(firstCol + k + 1, n - k - 1).setZero();
530
+ }
531
+
532
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
533
+ assert(m_naiveU.allFinite());
534
+ assert(m_naiveV.allFinite());
535
+ assert(m_computed.allFinite());
536
+ #endif
537
+
538
+ m_computed(firstCol + shift, firstCol + shift) = r0;
539
+ m_computed.col(firstCol + shift).segment(firstCol + shift + 1, k) = alphaK * l.transpose().real();
540
+ m_computed.col(firstCol + shift).segment(firstCol + shift + k + 1, n - k - 1) = betaK * f.transpose().real();
541
+
542
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
543
+ ArrayXr tmp1 = (m_computed.block(firstCol+shift, firstCol+shift, n, n)).jacobiSvd().singularValues();
544
+ #endif
545
+ // Second part: try to deflate singular values in combined matrix
546
+ deflation(firstCol, lastCol, k, firstRowW, firstColW, shift);
547
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
548
+ ArrayXr tmp2 = (m_computed.block(firstCol+shift, firstCol+shift, n, n)).jacobiSvd().singularValues();
549
+ std::cout << "\n\nj1 = " << tmp1.transpose().format(bdcsvdfmt) << "\n";
550
+ std::cout << "j2 = " << tmp2.transpose().format(bdcsvdfmt) << "\n\n";
551
+ std::cout << "err: " << ((tmp1-tmp2).abs()>1e-12*tmp2.abs()).transpose() << "\n";
552
+ static int count = 0;
553
+ std::cout << "# " << ++count << "\n\n";
554
+ assert((tmp1-tmp2).matrix().norm() < 1e-14*tmp2.matrix().norm());
555
+ // assert(count<681);
556
+ // assert(((tmp1-tmp2).abs()<1e-13*tmp2.abs()).all());
557
+ #endif
558
+
559
+ // Third part: compute SVD of combined matrix
560
+ MatrixXr UofSVD, VofSVD;
561
+ VectorType singVals;
562
+ computeSVDofM(firstCol + shift, n, UofSVD, singVals, VofSVD);
563
+
564
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
565
+ assert(UofSVD.allFinite());
566
+ assert(VofSVD.allFinite());
567
+ #endif
568
+
569
+ if (m_compU)
570
+ structured_update(m_naiveU.block(firstCol, firstCol, n + 1, n + 1), UofSVD, (n+2)/2);
571
+ else
572
+ {
573
+ Map<Matrix<RealScalar,2,Dynamic>,Aligned> tmp(m_workspace.data(),2,n+1);
574
+ tmp.noalias() = m_naiveU.middleCols(firstCol, n+1) * UofSVD;
575
+ m_naiveU.middleCols(firstCol, n + 1) = tmp;
576
+ }
577
+
578
+ if (m_compV) structured_update(m_naiveV.block(firstRowW, firstColW, n, n), VofSVD, (n+1)/2);
579
+
580
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
581
+ assert(m_naiveU.allFinite());
582
+ assert(m_naiveV.allFinite());
583
+ assert(m_computed.allFinite());
584
+ #endif
585
+
586
+ m_computed.block(firstCol + shift, firstCol + shift, n, n).setZero();
587
+ m_computed.block(firstCol + shift, firstCol + shift, n, n).diagonal() = singVals;
588
+ }// end divide
589
+
590
+ // Compute SVD of m_computed.block(firstCol, firstCol, n + 1, n); this block only has non-zeros in
591
+ // the first column and on the diagonal and has undergone deflation, so diagonal is in increasing
592
+ // order except for possibly the (0,0) entry. The computed SVD is stored U, singVals and V, except
593
+ // that if m_compV is false, then V is not computed. Singular values are sorted in decreasing order.
594
+ //
595
+ // TODO Opportunities for optimization: better root finding algo, better stopping criterion, better
596
+ // handling of round-off errors, be consistent in ordering
597
+ // For instance, to solve the secular equation using FMM, see http://www.stat.uchicago.edu/~lekheng/courses/302/classics/greengard-rokhlin.pdf
598
+ template <typename MatrixType>
599
+ void BDCSVD<MatrixType>::computeSVDofM(Eigen::Index firstCol, Eigen::Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V)
600
+ {
601
+ const RealScalar considerZero = (std::numeric_limits<RealScalar>::min)();
602
+ using std::abs;
603
+ ArrayRef col0 = m_computed.col(firstCol).segment(firstCol, n);
604
+ m_workspace.head(n) = m_computed.block(firstCol, firstCol, n, n).diagonal();
605
+ ArrayRef diag = m_workspace.head(n);
606
+ diag(0) = Literal(0);
607
+
608
+ // Allocate space for singular values and vectors
609
+ singVals.resize(n);
610
+ U.resize(n+1, n+1);
611
+ if (m_compV) V.resize(n, n);
612
+
613
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
614
+ if (col0.hasNaN() || diag.hasNaN())
615
+ std::cout << "\n\nHAS NAN\n\n";
616
+ #endif
617
+
618
+ // Many singular values might have been deflated, the zero ones have been moved to the end,
619
+ // but others are interleaved and we must ignore them at this stage.
620
+ // To this end, let's compute a permutation skipping them:
621
+ Index actual_n = n;
622
+ while(actual_n>1 && diag(actual_n-1)==Literal(0)) {--actual_n; eigen_internal_assert(col0(actual_n)==Literal(0)); }
623
+ Index m = 0; // size of the deflated problem
624
+ for(Index k=0;k<actual_n;++k)
625
+ if(abs(col0(k))>considerZero)
626
+ m_workspaceI(m++) = k;
627
+ Map<ArrayXi> perm(m_workspaceI.data(),m);
628
+
629
+ Map<ArrayXr> shifts(m_workspace.data()+1*n, n);
630
+ Map<ArrayXr> mus(m_workspace.data()+2*n, n);
631
+ Map<ArrayXr> zhat(m_workspace.data()+3*n, n);
632
+
633
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
634
+ std::cout << "computeSVDofM using:\n";
635
+ std::cout << " z: " << col0.transpose() << "\n";
636
+ std::cout << " d: " << diag.transpose() << "\n";
637
+ #endif
638
+
639
+ // Compute singVals, shifts, and mus
640
+ computeSingVals(col0, diag, perm, singVals, shifts, mus);
641
+
642
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
643
+ std::cout << " j: " << (m_computed.block(firstCol, firstCol, n, n)).jacobiSvd().singularValues().transpose().reverse() << "\n\n";
644
+ std::cout << " sing-val: " << singVals.transpose() << "\n";
645
+ std::cout << " mu: " << mus.transpose() << "\n";
646
+ std::cout << " shift: " << shifts.transpose() << "\n";
647
+
648
+ {
649
+ std::cout << "\n\n mus: " << mus.head(actual_n).transpose() << "\n\n";
650
+ std::cout << " check1 (expect0) : " << ((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n).transpose() << "\n\n";
651
+ assert((((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n) >= 0).all());
652
+ std::cout << " check2 (>0) : " << ((singVals.array()-diag) / singVals.array()).head(actual_n).transpose() << "\n\n";
653
+ assert((((singVals.array()-diag) / singVals.array()).head(actual_n) >= 0).all());
654
+ }
655
+ #endif
656
+
657
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
658
+ assert(singVals.allFinite());
659
+ assert(mus.allFinite());
660
+ assert(shifts.allFinite());
661
+ #endif
662
+
663
+ // Compute zhat
664
+ perturbCol0(col0, diag, perm, singVals, shifts, mus, zhat);
665
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
666
+ std::cout << " zhat: " << zhat.transpose() << "\n";
667
+ #endif
668
+
669
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
670
+ assert(zhat.allFinite());
671
+ #endif
672
+
673
+ computeSingVecs(zhat, diag, perm, singVals, shifts, mus, U, V);
674
+
675
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
676
+ std::cout << "U^T U: " << (U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() << "\n";
677
+ std::cout << "V^T V: " << (V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() << "\n";
678
+ #endif
679
+
680
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
681
+ assert(m_naiveU.allFinite());
682
+ assert(m_naiveV.allFinite());
683
+ assert(m_computed.allFinite());
684
+ assert(U.allFinite());
685
+ assert(V.allFinite());
686
+ // assert((U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() < 100*NumTraits<RealScalar>::epsilon() * n);
687
+ // assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 100*NumTraits<RealScalar>::epsilon() * n);
688
+ #endif
689
+
690
+ // Because of deflation, the singular values might not be completely sorted.
691
+ // Fortunately, reordering them is a O(n) problem
692
+ for(Index i=0; i<actual_n-1; ++i)
693
+ {
694
+ if(singVals(i)>singVals(i+1))
695
+ {
696
+ using std::swap;
697
+ swap(singVals(i),singVals(i+1));
698
+ U.col(i).swap(U.col(i+1));
699
+ if(m_compV) V.col(i).swap(V.col(i+1));
700
+ }
701
+ }
702
+
703
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
704
+ {
705
+ bool singular_values_sorted = (((singVals.segment(1,actual_n-1)-singVals.head(actual_n-1))).array() >= 0).all();
706
+ if(!singular_values_sorted)
707
+ std::cout << "Singular values are not sorted: " << singVals.segment(1,actual_n).transpose() << "\n";
708
+ assert(singular_values_sorted);
709
+ }
710
+ #endif
711
+
712
+ // Reverse order so that singular values in increased order
713
+ // Because of deflation, the zeros singular-values are already at the end
714
+ singVals.head(actual_n).reverseInPlace();
715
+ U.leftCols(actual_n).rowwise().reverseInPlace();
716
+ if (m_compV) V.leftCols(actual_n).rowwise().reverseInPlace();
717
+
718
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
719
+ JacobiSVD<MatrixXr> jsvd(m_computed.block(firstCol, firstCol, n, n) );
720
+ std::cout << " * j: " << jsvd.singularValues().transpose() << "\n\n";
721
+ std::cout << " * sing-val: " << singVals.transpose() << "\n";
722
+ // std::cout << " * err: " << ((jsvd.singularValues()-singVals)>1e-13*singVals.norm()).transpose() << "\n";
723
+ #endif
724
+ }
725
+
726
+ template <typename MatrixType>
727
+ typename BDCSVD<MatrixType>::RealScalar BDCSVD<MatrixType>::secularEq(RealScalar mu, const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const ArrayRef& diagShifted, RealScalar shift)
728
+ {
729
+ Index m = perm.size();
730
+ RealScalar res = Literal(1);
731
+ for(Index i=0; i<m; ++i)
732
+ {
733
+ Index j = perm(i);
734
+ // The following expression could be rewritten to involve only a single division,
735
+ // but this would make the expression more sensitive to overflow.
736
+ res += (col0(j) / (diagShifted(j) - mu)) * (col0(j) / (diag(j) + shift + mu));
737
+ }
738
+ return res;
739
+
740
+ }
741
+
742
+ template <typename MatrixType>
743
+ void BDCSVD<MatrixType>::computeSingVals(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm,
744
+ VectorType& singVals, ArrayRef shifts, ArrayRef mus)
745
+ {
746
+ using std::abs;
747
+ using std::swap;
748
+ using std::sqrt;
749
+
750
+ Index n = col0.size();
751
+ Index actual_n = n;
752
+ // Note that here actual_n is computed based on col0(i)==0 instead of diag(i)==0 as above
753
+ // because 1) we have diag(i)==0 => col0(i)==0 and 2) if col0(i)==0, then diag(i) is already a singular value.
754
+ while(actual_n>1 && col0(actual_n-1)==Literal(0)) --actual_n;
755
+
756
+ for (Index k = 0; k < n; ++k)
757
+ {
758
+ if (col0(k) == Literal(0) || actual_n==1)
759
+ {
760
+ // if col0(k) == 0, then entry is deflated, so singular value is on diagonal
761
+ // if actual_n==1, then the deflated problem is already diagonalized
762
+ singVals(k) = k==0 ? col0(0) : diag(k);
763
+ mus(k) = Literal(0);
764
+ shifts(k) = k==0 ? col0(0) : diag(k);
765
+ continue;
766
+ }
767
+
768
+ // otherwise, use secular equation to find singular value
769
+ RealScalar left = diag(k);
770
+ RealScalar right; // was: = (k != actual_n-1) ? diag(k+1) : (diag(actual_n-1) + col0.matrix().norm());
771
+ if(k==actual_n-1)
772
+ right = (diag(actual_n-1) + col0.matrix().norm());
773
+ else
774
+ {
775
+ // Skip deflated singular values,
776
+ // recall that at this stage we assume that z[j]!=0 and all entries for which z[j]==0 have been put aside.
777
+ // This should be equivalent to using perm[]
778
+ Index l = k+1;
779
+ while(col0(l)==Literal(0)) { ++l; eigen_internal_assert(l<actual_n); }
780
+ right = diag(l);
781
+ }
782
+
783
+ // first decide whether it's closer to the left end or the right end
784
+ RealScalar mid = left + (right-left) / Literal(2);
785
+ RealScalar fMid = secularEq(mid, col0, diag, perm, diag, Literal(0));
786
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
787
+ std::cout << "right-left = " << right-left << "\n";
788
+ // std::cout << "fMid = " << fMid << " " << secularEq(mid-left, col0, diag, perm, ArrayXr(diag-left), left)
789
+ // << " " << secularEq(mid-right, col0, diag, perm, ArrayXr(diag-right), right) << "\n";
790
+ std::cout << " = " << secularEq(left+RealScalar(0.000001)*(right-left), col0, diag, perm, diag, 0)
791
+ << " " << secularEq(left+RealScalar(0.1) *(right-left), col0, diag, perm, diag, 0)
792
+ << " " << secularEq(left+RealScalar(0.2) *(right-left), col0, diag, perm, diag, 0)
793
+ << " " << secularEq(left+RealScalar(0.3) *(right-left), col0, diag, perm, diag, 0)
794
+ << " " << secularEq(left+RealScalar(0.4) *(right-left), col0, diag, perm, diag, 0)
795
+ << " " << secularEq(left+RealScalar(0.49) *(right-left), col0, diag, perm, diag, 0)
796
+ << " " << secularEq(left+RealScalar(0.5) *(right-left), col0, diag, perm, diag, 0)
797
+ << " " << secularEq(left+RealScalar(0.51) *(right-left), col0, diag, perm, diag, 0)
798
+ << " " << secularEq(left+RealScalar(0.6) *(right-left), col0, diag, perm, diag, 0)
799
+ << " " << secularEq(left+RealScalar(0.7) *(right-left), col0, diag, perm, diag, 0)
800
+ << " " << secularEq(left+RealScalar(0.8) *(right-left), col0, diag, perm, diag, 0)
801
+ << " " << secularEq(left+RealScalar(0.9) *(right-left), col0, diag, perm, diag, 0)
802
+ << " " << secularEq(left+RealScalar(0.999999)*(right-left), col0, diag, perm, diag, 0) << "\n";
803
+ #endif
804
+ RealScalar shift = (k == actual_n-1 || fMid > Literal(0)) ? left : right;
805
+
806
+ // measure everything relative to shift
807
+ Map<ArrayXr> diagShifted(m_workspace.data()+4*n, n);
808
+ diagShifted = diag - shift;
809
+
810
+ if(k!=actual_n-1)
811
+ {
812
+ // check that after the shift, f(mid) is still negative:
813
+ RealScalar midShifted = (right - left) / RealScalar(2);
814
+ if(shift==right)
815
+ midShifted = -midShifted;
816
+ RealScalar fMidShifted = secularEq(midShifted, col0, diag, perm, diagShifted, shift);
817
+ if(fMidShifted>0)
818
+ {
819
+ // fMid was erroneous, fix it:
820
+ shift = fMidShifted > Literal(0) ? left : right;
821
+ diagShifted = diag - shift;
822
+ }
823
+ }
824
+
825
+ // initial guess
826
+ RealScalar muPrev, muCur;
827
+ if (shift == left)
828
+ {
829
+ muPrev = (right - left) * RealScalar(0.1);
830
+ if (k == actual_n-1) muCur = right - left;
831
+ else muCur = (right - left) * RealScalar(0.5);
832
+ }
833
+ else
834
+ {
835
+ muPrev = -(right - left) * RealScalar(0.1);
836
+ muCur = -(right - left) * RealScalar(0.5);
837
+ }
838
+
839
+ RealScalar fPrev = secularEq(muPrev, col0, diag, perm, diagShifted, shift);
840
+ RealScalar fCur = secularEq(muCur, col0, diag, perm, diagShifted, shift);
841
+ if (abs(fPrev) < abs(fCur))
842
+ {
843
+ swap(fPrev, fCur);
844
+ swap(muPrev, muCur);
845
+ }
846
+
847
+ // rational interpolation: fit a function of the form a / mu + b through the two previous
848
+ // iterates and use its zero to compute the next iterate
849
+ bool useBisection = fPrev*fCur>Literal(0);
850
+ while (fCur!=Literal(0) && abs(muCur - muPrev) > Literal(8) * NumTraits<RealScalar>::epsilon() * numext::maxi<RealScalar>(abs(muCur), abs(muPrev)) && abs(fCur - fPrev)>NumTraits<RealScalar>::epsilon() && !useBisection)
851
+ {
852
+ ++m_numIters;
853
+
854
+ // Find a and b such that the function f(mu) = a / mu + b matches the current and previous samples.
855
+ RealScalar a = (fCur - fPrev) / (Literal(1)/muCur - Literal(1)/muPrev);
856
+ RealScalar b = fCur - a / muCur;
857
+ // And find mu such that f(mu)==0:
858
+ RealScalar muZero = -a/b;
859
+ RealScalar fZero = secularEq(muZero, col0, diag, perm, diagShifted, shift);
860
+
861
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
862
+ assert((numext::isfinite)(fZero));
863
+ #endif
864
+
865
+ muPrev = muCur;
866
+ fPrev = fCur;
867
+ muCur = muZero;
868
+ fCur = fZero;
869
+
870
+ if (shift == left && (muCur < Literal(0) || muCur > right - left)) useBisection = true;
871
+ if (shift == right && (muCur < -(right - left) || muCur > Literal(0))) useBisection = true;
872
+ if (abs(fCur)>abs(fPrev)) useBisection = true;
873
+ }
874
+
875
+ // fall back on bisection method if rational interpolation did not work
876
+ if (useBisection)
877
+ {
878
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
879
+ std::cout << "useBisection for k = " << k << ", actual_n = " << actual_n << "\n";
880
+ #endif
881
+ RealScalar leftShifted, rightShifted;
882
+ if (shift == left)
883
+ {
884
+ // to avoid overflow, we must have mu > max(real_min, |z(k)|/sqrt(real_max)),
885
+ // the factor 2 is to be more conservative
886
+ leftShifted = numext::maxi<RealScalar>( (std::numeric_limits<RealScalar>::min)(), Literal(2) * abs(col0(k)) / sqrt((std::numeric_limits<RealScalar>::max)()) );
887
+
888
+ // check that we did it right:
889
+ eigen_internal_assert( (numext::isfinite)( (col0(k)/leftShifted)*(col0(k)/(diag(k)+shift+leftShifted)) ) );
890
+ // I don't understand why the case k==0 would be special there:
891
+ // if (k == 0) rightShifted = right - left; else
892
+ rightShifted = (k==actual_n-1) ? right : ((right - left) * RealScalar(0.51)); // theoretically we can take 0.5, but let's be safe
893
+ }
894
+ else
895
+ {
896
+ leftShifted = -(right - left) * RealScalar(0.51);
897
+ if(k+1<n)
898
+ rightShifted = -numext::maxi<RealScalar>( (std::numeric_limits<RealScalar>::min)(), abs(col0(k+1)) / sqrt((std::numeric_limits<RealScalar>::max)()) );
899
+ else
900
+ rightShifted = -(std::numeric_limits<RealScalar>::min)();
901
+ }
902
+
903
+ RealScalar fLeft = secularEq(leftShifted, col0, diag, perm, diagShifted, shift);
904
+ eigen_internal_assert(fLeft<Literal(0));
905
+
906
+ #if defined EIGEN_BDCSVD_DEBUG_VERBOSE || defined EIGEN_BDCSVD_SANITY_CHECKS || defined EIGEN_INTERNAL_DEBUGGING
907
+ RealScalar fRight = secularEq(rightShifted, col0, diag, perm, diagShifted, shift);
908
+ #endif
909
+
910
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
911
+ if(!(numext::isfinite)(fLeft))
912
+ std::cout << "f(" << leftShifted << ") =" << fLeft << " ; " << left << " " << shift << " " << right << "\n";
913
+ assert((numext::isfinite)(fLeft));
914
+
915
+ if(!(numext::isfinite)(fRight))
916
+ std::cout << "f(" << rightShifted << ") =" << fRight << " ; " << left << " " << shift << " " << right << "\n";
917
+ // assert((numext::isfinite)(fRight));
918
+ #endif
919
+
920
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
921
+ if(!(fLeft * fRight<0))
922
+ {
923
+ std::cout << "f(leftShifted) using leftShifted=" << leftShifted << " ; diagShifted(1:10):" << diagShifted.head(10).transpose() << "\n ; "
924
+ << "left==shift=" << bool(left==shift) << " ; left-shift = " << (left-shift) << "\n";
925
+ std::cout << "k=" << k << ", " << fLeft << " * " << fRight << " == " << fLeft * fRight << " ; "
926
+ << "[" << left << " .. " << right << "] -> [" << leftShifted << " " << rightShifted << "], shift=" << shift
927
+ << " , f(right)=" << secularEq(0, col0, diag, perm, diagShifted, shift)
928
+ << " == " << secularEq(right, col0, diag, perm, diag, 0) << " == " << fRight << "\n";
929
+ }
930
+ #endif
931
+ eigen_internal_assert(fLeft * fRight < Literal(0));
932
+
933
+ if(fLeft<Literal(0))
934
+ {
935
+ while (rightShifted - leftShifted > Literal(2) * NumTraits<RealScalar>::epsilon() * numext::maxi<RealScalar>(abs(leftShifted), abs(rightShifted)))
936
+ {
937
+ RealScalar midShifted = (leftShifted + rightShifted) / Literal(2);
938
+ fMid = secularEq(midShifted, col0, diag, perm, diagShifted, shift);
939
+ eigen_internal_assert((numext::isfinite)(fMid));
940
+
941
+ if (fLeft * fMid < Literal(0))
942
+ {
943
+ rightShifted = midShifted;
944
+ }
945
+ else
946
+ {
947
+ leftShifted = midShifted;
948
+ fLeft = fMid;
949
+ }
950
+ }
951
+ muCur = (leftShifted + rightShifted) / Literal(2);
952
+ }
953
+ else
954
+ {
955
+ // We have a problem as shifting on the left or right give either a positive or negative value
956
+ // at the middle of [left,right]...
957
+ // Instead fo abbording or entering an infinite loop,
958
+ // let's just use the middle as the estimated zero-crossing:
959
+ muCur = (right - left) * RealScalar(0.5);
960
+ if(shift == right)
961
+ muCur = -muCur;
962
+ }
963
+ }
964
+
965
+ singVals[k] = shift + muCur;
966
+ shifts[k] = shift;
967
+ mus[k] = muCur;
968
+
969
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
970
+ if(k+1<n)
971
+ std::cout << "found " << singVals[k] << " == " << shift << " + " << muCur << " from " << diag(k) << " .. " << diag(k+1) << "\n";
972
+ #endif
973
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
974
+ assert(k==0 || singVals[k]>=singVals[k-1]);
975
+ assert(singVals[k]>=diag(k));
976
+ #endif
977
+
978
+ // perturb singular value slightly if it equals diagonal entry to avoid division by zero later
979
+ // (deflation is supposed to avoid this from happening)
980
+ // - this does no seem to be necessary anymore -
981
+ // if (singVals[k] == left) singVals[k] *= 1 + NumTraits<RealScalar>::epsilon();
982
+ // if (singVals[k] == right) singVals[k] *= 1 - NumTraits<RealScalar>::epsilon();
983
+ }
984
+ }
985
+
986
+
987
+ // zhat is perturbation of col0 for which singular vectors can be computed stably (see Section 3.1)
988
+ template <typename MatrixType>
989
+ void BDCSVD<MatrixType>::perturbCol0
990
+ (const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const VectorType& singVals,
991
+ const ArrayRef& shifts, const ArrayRef& mus, ArrayRef zhat)
992
+ {
993
+ using std::sqrt;
994
+ Index n = col0.size();
995
+ Index m = perm.size();
996
+ if(m==0)
997
+ {
998
+ zhat.setZero();
999
+ return;
1000
+ }
1001
+ Index lastIdx = perm(m-1);
1002
+ // The offset permits to skip deflated entries while computing zhat
1003
+ for (Index k = 0; k < n; ++k)
1004
+ {
1005
+ if (col0(k) == Literal(0)) // deflated
1006
+ zhat(k) = Literal(0);
1007
+ else
1008
+ {
1009
+ // see equation (3.6)
1010
+ RealScalar dk = diag(k);
1011
+ RealScalar prod = (singVals(lastIdx) + dk) * (mus(lastIdx) + (shifts(lastIdx) - dk));
1012
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1013
+ if(prod<0) {
1014
+ std::cout << "k = " << k << " ; z(k)=" << col0(k) << ", diag(k)=" << dk << "\n";
1015
+ std::cout << "prod = " << "(" << singVals(lastIdx) << " + " << dk << ") * (" << mus(lastIdx) << " + (" << shifts(lastIdx) << " - " << dk << "))" << "\n";
1016
+ std::cout << " = " << singVals(lastIdx) + dk << " * " << mus(lastIdx) + (shifts(lastIdx) - dk) << "\n";
1017
+ }
1018
+ assert(prod>=0);
1019
+ #endif
1020
+
1021
+ for(Index l = 0; l<m; ++l)
1022
+ {
1023
+ Index i = perm(l);
1024
+ if(i!=k)
1025
+ {
1026
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1027
+ if(i>=k && (l==0 || l-1>=m))
1028
+ {
1029
+ std::cout << "Error in perturbCol0\n";
1030
+ std::cout << " " << k << "/" << n << " " << l << "/" << m << " " << i << "/" << n << " ; " << col0(k) << " " << diag(k) << " " << "\n";
1031
+ std::cout << " " <<diag(i) << "\n";
1032
+ Index j = (i<k /*|| l==0*/) ? i : perm(l-1);
1033
+ std::cout << " " << "j=" << j << "\n";
1034
+ }
1035
+ #endif
1036
+ // Avoid index out of bounds.
1037
+ // Will end up setting zhat(k) = 0.
1038
+ if (i >= k && l == 0) {
1039
+ m_info = NumericalIssue;
1040
+ prod = 0;
1041
+ break;
1042
+ }
1043
+ Index j = i<k ? i : l > 0 ? perm(l-1) : i;
1044
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1045
+ if(!(dk!=Literal(0) || diag(i)!=Literal(0)))
1046
+ {
1047
+ std::cout << "k=" << k << ", i=" << i << ", l=" << l << ", perm.size()=" << perm.size() << "\n";
1048
+ }
1049
+ assert(dk!=Literal(0) || diag(i)!=Literal(0));
1050
+ #endif
1051
+ prod *= ((singVals(j)+dk) / ((diag(i)+dk))) * ((mus(j)+(shifts(j)-dk)) / ((diag(i)-dk)));
1052
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1053
+ assert(prod>=0);
1054
+ #endif
1055
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1056
+ if(i!=k && numext::abs(((singVals(j)+dk)*(mus(j)+(shifts(j)-dk)))/((diag(i)+dk)*(diag(i)-dk)) - 1) > 0.9 )
1057
+ std::cout << " " << ((singVals(j)+dk)*(mus(j)+(shifts(j)-dk)))/((diag(i)+dk)*(diag(i)-dk)) << " == (" << (singVals(j)+dk) << " * " << (mus(j)+(shifts(j)-dk))
1058
+ << ") / (" << (diag(i)+dk) << " * " << (diag(i)-dk) << ")\n";
1059
+ #endif
1060
+ }
1061
+ }
1062
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1063
+ std::cout << "zhat(" << k << ") = sqrt( " << prod << ") ; " << (singVals(lastIdx) + dk) << " * " << mus(lastIdx) + shifts(lastIdx) << " - " << dk << "\n";
1064
+ #endif
1065
+ RealScalar tmp = sqrt(prod);
1066
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1067
+ assert((numext::isfinite)(tmp));
1068
+ #endif
1069
+ zhat(k) = col0(k) > Literal(0) ? RealScalar(tmp) : RealScalar(-tmp);
1070
+ }
1071
+ }
1072
+ }
1073
+
1074
+ // compute singular vectors
1075
+ template <typename MatrixType>
1076
+ void BDCSVD<MatrixType>::computeSingVecs
1077
+ (const ArrayRef& zhat, const ArrayRef& diag, const IndicesRef &perm, const VectorType& singVals,
1078
+ const ArrayRef& shifts, const ArrayRef& mus, MatrixXr& U, MatrixXr& V)
1079
+ {
1080
+ Index n = zhat.size();
1081
+ Index m = perm.size();
1082
+
1083
+ for (Index k = 0; k < n; ++k)
1084
+ {
1085
+ if (zhat(k) == Literal(0))
1086
+ {
1087
+ U.col(k) = VectorType::Unit(n+1, k);
1088
+ if (m_compV) V.col(k) = VectorType::Unit(n, k);
1089
+ }
1090
+ else
1091
+ {
1092
+ U.col(k).setZero();
1093
+ for(Index l=0;l<m;++l)
1094
+ {
1095
+ Index i = perm(l);
1096
+ U(i,k) = zhat(i)/(((diag(i) - shifts(k)) - mus(k)) )/( (diag(i) + singVals[k]));
1097
+ }
1098
+ U(n,k) = Literal(0);
1099
+ U.col(k).normalize();
1100
+
1101
+ if (m_compV)
1102
+ {
1103
+ V.col(k).setZero();
1104
+ for(Index l=1;l<m;++l)
1105
+ {
1106
+ Index i = perm(l);
1107
+ V(i,k) = diag(i) * zhat(i) / (((diag(i) - shifts(k)) - mus(k)) )/( (diag(i) + singVals[k]));
1108
+ }
1109
+ V(0,k) = Literal(-1);
1110
+ V.col(k).normalize();
1111
+ }
1112
+ }
1113
+ }
1114
+ U.col(n) = VectorType::Unit(n+1, n);
1115
+ }
1116
+
1117
+
1118
+ // page 12_13
1119
+ // i >= 1, di almost null and zi non null.
1120
+ // We use a rotation to zero out zi applied to the left of M
1121
+ template <typename MatrixType>
1122
+ void BDCSVD<MatrixType>::deflation43(Eigen::Index firstCol, Eigen::Index shift, Eigen::Index i, Eigen::Index size)
1123
+ {
1124
+ using std::abs;
1125
+ using std::sqrt;
1126
+ using std::pow;
1127
+ Index start = firstCol + shift;
1128
+ RealScalar c = m_computed(start, start);
1129
+ RealScalar s = m_computed(start+i, start);
1130
+ RealScalar r = numext::hypot(c,s);
1131
+ if (r == Literal(0))
1132
+ {
1133
+ m_computed(start+i, start+i) = Literal(0);
1134
+ return;
1135
+ }
1136
+ m_computed(start,start) = r;
1137
+ m_computed(start+i, start) = Literal(0);
1138
+ m_computed(start+i, start+i) = Literal(0);
1139
+
1140
+ JacobiRotation<RealScalar> J(c/r,-s/r);
1141
+ if (m_compU) m_naiveU.middleRows(firstCol, size+1).applyOnTheRight(firstCol, firstCol+i, J);
1142
+ else m_naiveU.applyOnTheRight(firstCol, firstCol+i, J);
1143
+ }// end deflation 43
1144
+
1145
+
1146
+ // page 13
1147
+ // i,j >= 1, i!=j and |di - dj| < epsilon * norm2(M)
1148
+ // We apply two rotations to have zj = 0;
1149
+ // TODO deflation44 is still broken and not properly tested
1150
+ template <typename MatrixType>
1151
+ void BDCSVD<MatrixType>::deflation44(Eigen::Index firstColu , Eigen::Index firstColm, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index i, Eigen::Index j, Eigen::Index size)
1152
+ {
1153
+ using std::abs;
1154
+ using std::sqrt;
1155
+ using std::conj;
1156
+ using std::pow;
1157
+ RealScalar c = m_computed(firstColm+i, firstColm);
1158
+ RealScalar s = m_computed(firstColm+j, firstColm);
1159
+ RealScalar r = sqrt(numext::abs2(c) + numext::abs2(s));
1160
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1161
+ std::cout << "deflation 4.4: " << i << "," << j << " -> " << c << " " << s << " " << r << " ; "
1162
+ << m_computed(firstColm + i-1, firstColm) << " "
1163
+ << m_computed(firstColm + i, firstColm) << " "
1164
+ << m_computed(firstColm + i+1, firstColm) << " "
1165
+ << m_computed(firstColm + i+2, firstColm) << "\n";
1166
+ std::cout << m_computed(firstColm + i-1, firstColm + i-1) << " "
1167
+ << m_computed(firstColm + i, firstColm+i) << " "
1168
+ << m_computed(firstColm + i+1, firstColm+i+1) << " "
1169
+ << m_computed(firstColm + i+2, firstColm+i+2) << "\n";
1170
+ #endif
1171
+ if (r==Literal(0))
1172
+ {
1173
+ m_computed(firstColm + i, firstColm + i) = m_computed(firstColm + j, firstColm + j);
1174
+ return;
1175
+ }
1176
+ c/=r;
1177
+ s/=r;
1178
+ m_computed(firstColm + i, firstColm) = r;
1179
+ m_computed(firstColm + j, firstColm + j) = m_computed(firstColm + i, firstColm + i);
1180
+ m_computed(firstColm + j, firstColm) = Literal(0);
1181
+
1182
+ JacobiRotation<RealScalar> J(c,-s);
1183
+ if (m_compU) m_naiveU.middleRows(firstColu, size+1).applyOnTheRight(firstColu + i, firstColu + j, J);
1184
+ else m_naiveU.applyOnTheRight(firstColu+i, firstColu+j, J);
1185
+ if (m_compV) m_naiveV.middleRows(firstRowW, size).applyOnTheRight(firstColW + i, firstColW + j, J);
1186
+ }// end deflation 44
1187
+
1188
+
1189
+ // acts on block from (firstCol+shift, firstCol+shift) to (lastCol+shift, lastCol+shift) [inclusive]
1190
+ template <typename MatrixType>
1191
+ void BDCSVD<MatrixType>::deflation(Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index k, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift)
1192
+ {
1193
+ using std::sqrt;
1194
+ using std::abs;
1195
+ const Index length = lastCol + 1 - firstCol;
1196
+
1197
+ Block<MatrixXr,Dynamic,1> col0(m_computed, firstCol+shift, firstCol+shift, length, 1);
1198
+ Diagonal<MatrixXr> fulldiag(m_computed);
1199
+ VectorBlock<Diagonal<MatrixXr>,Dynamic> diag(fulldiag, firstCol+shift, length);
1200
+
1201
+ const RealScalar considerZero = (std::numeric_limits<RealScalar>::min)();
1202
+ RealScalar maxDiag = diag.tail((std::max)(Index(1),length-1)).cwiseAbs().maxCoeff();
1203
+ RealScalar epsilon_strict = numext::maxi<RealScalar>(considerZero,NumTraits<RealScalar>::epsilon() * maxDiag);
1204
+ RealScalar epsilon_coarse = Literal(8) * NumTraits<RealScalar>::epsilon() * numext::maxi<RealScalar>(col0.cwiseAbs().maxCoeff(), maxDiag);
1205
+
1206
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1207
+ assert(m_naiveU.allFinite());
1208
+ assert(m_naiveV.allFinite());
1209
+ assert(m_computed.allFinite());
1210
+ #endif
1211
+
1212
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1213
+ std::cout << "\ndeflate:" << diag.head(k+1).transpose() << " | " << diag.segment(k+1,length-k-1).transpose() << "\n";
1214
+ #endif
1215
+
1216
+ //condition 4.1
1217
+ if (diag(0) < epsilon_coarse)
1218
+ {
1219
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1220
+ std::cout << "deflation 4.1, because " << diag(0) << " < " << epsilon_coarse << "\n";
1221
+ #endif
1222
+ diag(0) = epsilon_coarse;
1223
+ }
1224
+
1225
+ //condition 4.2
1226
+ for (Index i=1;i<length;++i)
1227
+ if (abs(col0(i)) < epsilon_strict)
1228
+ {
1229
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1230
+ std::cout << "deflation 4.2, set z(" << i << ") to zero because " << abs(col0(i)) << " < " << epsilon_strict << " (diag(" << i << ")=" << diag(i) << ")\n";
1231
+ #endif
1232
+ col0(i) = Literal(0);
1233
+ }
1234
+
1235
+ //condition 4.3
1236
+ for (Index i=1;i<length; i++)
1237
+ if (diag(i) < epsilon_coarse)
1238
+ {
1239
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1240
+ std::cout << "deflation 4.3, cancel z(" << i << ")=" << col0(i) << " because diag(" << i << ")=" << diag(i) << " < " << epsilon_coarse << "\n";
1241
+ #endif
1242
+ deflation43(firstCol, shift, i, length);
1243
+ }
1244
+
1245
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1246
+ assert(m_naiveU.allFinite());
1247
+ assert(m_naiveV.allFinite());
1248
+ assert(m_computed.allFinite());
1249
+ #endif
1250
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1251
+ std::cout << "to be sorted: " << diag.transpose() << "\n\n";
1252
+ std::cout << " : " << col0.transpose() << "\n\n";
1253
+ #endif
1254
+ {
1255
+ // Check for total deflation
1256
+ // If we have a total deflation, then we have to consider col0(0)==diag(0) as a singular value during sorting.
1257
+ const bool total_deflation = (col0.tail(length-1).array().abs()<considerZero).all();
1258
+
1259
+ // Sort the diagonal entries, since diag(1:k-1) and diag(k:length) are already sorted, let's do a sorted merge.
1260
+ // First, compute the respective permutation.
1261
+ Index *permutation = m_workspaceI.data();
1262
+ {
1263
+ permutation[0] = 0;
1264
+ Index p = 1;
1265
+
1266
+ // Move deflated diagonal entries at the end.
1267
+ for(Index i=1; i<length; ++i)
1268
+ if(abs(diag(i))<considerZero)
1269
+ permutation[p++] = i;
1270
+
1271
+ Index i=1, j=k+1;
1272
+ for( ; p < length; ++p)
1273
+ {
1274
+ if (i > k) permutation[p] = j++;
1275
+ else if (j >= length) permutation[p] = i++;
1276
+ else if (diag(i) < diag(j)) permutation[p] = j++;
1277
+ else permutation[p] = i++;
1278
+ }
1279
+ }
1280
+
1281
+ // If we have a total deflation, then we have to insert diag(0) at the right place
1282
+ if(total_deflation)
1283
+ {
1284
+ for(Index i=1; i<length; ++i)
1285
+ {
1286
+ Index pi = permutation[i];
1287
+ if(abs(diag(pi))<considerZero || diag(0)<diag(pi))
1288
+ permutation[i-1] = permutation[i];
1289
+ else
1290
+ {
1291
+ permutation[i-1] = 0;
1292
+ break;
1293
+ }
1294
+ }
1295
+ }
1296
+
1297
+ // Current index of each col, and current column of each index
1298
+ Index *realInd = m_workspaceI.data()+length;
1299
+ Index *realCol = m_workspaceI.data()+2*length;
1300
+
1301
+ for(int pos = 0; pos< length; pos++)
1302
+ {
1303
+ realCol[pos] = pos;
1304
+ realInd[pos] = pos;
1305
+ }
1306
+
1307
+ for(Index i = total_deflation?0:1; i < length; i++)
1308
+ {
1309
+ const Index pi = permutation[length - (total_deflation ? i+1 : i)];
1310
+ const Index J = realCol[pi];
1311
+
1312
+ using std::swap;
1313
+ // swap diagonal and first column entries:
1314
+ swap(diag(i), diag(J));
1315
+ if(i!=0 && J!=0) swap(col0(i), col0(J));
1316
+
1317
+ // change columns
1318
+ if (m_compU) m_naiveU.col(firstCol+i).segment(firstCol, length + 1).swap(m_naiveU.col(firstCol+J).segment(firstCol, length + 1));
1319
+ else m_naiveU.col(firstCol+i).segment(0, 2) .swap(m_naiveU.col(firstCol+J).segment(0, 2));
1320
+ if (m_compV) m_naiveV.col(firstColW + i).segment(firstRowW, length).swap(m_naiveV.col(firstColW + J).segment(firstRowW, length));
1321
+
1322
+ //update real pos
1323
+ const Index realI = realInd[i];
1324
+ realCol[realI] = J;
1325
+ realCol[pi] = i;
1326
+ realInd[J] = realI;
1327
+ realInd[i] = pi;
1328
+ }
1329
+ }
1330
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1331
+ std::cout << "sorted: " << diag.transpose().format(bdcsvdfmt) << "\n";
1332
+ std::cout << " : " << col0.transpose() << "\n\n";
1333
+ #endif
1334
+
1335
+ //condition 4.4
1336
+ {
1337
+ Index i = length-1;
1338
+ while(i>0 && (abs(diag(i))<considerZero || abs(col0(i))<considerZero)) --i;
1339
+ for(; i>1;--i)
1340
+ if( (diag(i) - diag(i-1)) < NumTraits<RealScalar>::epsilon()*maxDiag )
1341
+ {
1342
+ #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
1343
+ std::cout << "deflation 4.4 with i = " << i << " because " << diag(i) << " - " << diag(i-1) << " == " << (diag(i) - diag(i-1)) << " < " << NumTraits<RealScalar>::epsilon()*/*diag(i)*/maxDiag << "\n";
1344
+ #endif
1345
+ eigen_internal_assert(abs(diag(i) - diag(i-1))<epsilon_coarse && " diagonal entries are not properly sorted");
1346
+ deflation44(firstCol, firstCol + shift, firstRowW, firstColW, i-1, i, length);
1347
+ }
1348
+ }
1349
+
1350
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1351
+ for(Index j=2;j<length;++j)
1352
+ assert(diag(j-1)<=diag(j) || abs(diag(j))<considerZero);
1353
+ #endif
1354
+
1355
+ #ifdef EIGEN_BDCSVD_SANITY_CHECKS
1356
+ assert(m_naiveU.allFinite());
1357
+ assert(m_naiveV.allFinite());
1358
+ assert(m_computed.allFinite());
1359
+ #endif
1360
+ }//end deflation
1361
+
1362
+ /** \svd_module
1363
+ *
1364
+ * \return the singular value decomposition of \c *this computed by Divide & Conquer algorithm
1365
+ *
1366
+ * \sa class BDCSVD
1367
+ */
1368
+ template<typename Derived>
1369
+ BDCSVD<typename MatrixBase<Derived>::PlainObject>
1370
+ MatrixBase<Derived>::bdcSvd(unsigned int computationOptions) const
1371
+ {
1372
+ return BDCSVD<PlainObject>(*this, computationOptions);
1373
+ }
1374
+
1375
+ } // end namespace Eigen
1376
+
1377
+ #endif