@smake/eigen 1.1.0 → 1.1.1
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.
- package/README.md +1 -1
- package/eigen/Eigen/AccelerateSupport +52 -0
- package/eigen/Eigen/Cholesky +18 -20
- package/eigen/Eigen/CholmodSupport +28 -28
- package/eigen/Eigen/Core +187 -120
- package/eigen/Eigen/Eigenvalues +16 -13
- package/eigen/Eigen/Geometry +18 -18
- package/eigen/Eigen/Householder +9 -7
- package/eigen/Eigen/IterativeLinearSolvers +8 -4
- package/eigen/Eigen/Jacobi +14 -13
- package/eigen/Eigen/KLUSupport +23 -21
- package/eigen/Eigen/LU +15 -16
- package/eigen/Eigen/MetisSupport +12 -12
- package/eigen/Eigen/OrderingMethods +54 -51
- package/eigen/Eigen/PaStiXSupport +23 -21
- package/eigen/Eigen/PardisoSupport +17 -14
- package/eigen/Eigen/QR +18 -20
- package/eigen/Eigen/QtAlignedMalloc +5 -12
- package/eigen/Eigen/SPQRSupport +21 -14
- package/eigen/Eigen/SVD +23 -17
- package/eigen/Eigen/Sparse +1 -2
- package/eigen/Eigen/SparseCholesky +18 -15
- package/eigen/Eigen/SparseCore +18 -17
- package/eigen/Eigen/SparseLU +9 -9
- package/eigen/Eigen/SparseQR +16 -14
- package/eigen/Eigen/StdDeque +5 -2
- package/eigen/Eigen/StdList +5 -2
- package/eigen/Eigen/StdVector +5 -2
- package/eigen/Eigen/SuperLUSupport +30 -24
- package/eigen/Eigen/ThreadPool +80 -0
- package/eigen/Eigen/UmfPackSupport +19 -17
- package/eigen/Eigen/Version +14 -0
- package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
- package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +366 -405
- package/eigen/Eigen/src/Cholesky/LLT.h +323 -367
- package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +585 -529
- package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +143 -317
- package/eigen/Eigen/src/Core/Array.h +329 -370
- package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
- package/eigen/Eigen/src/Core/ArrayWrapper.h +126 -170
- package/eigen/Eigen/src/Core/Assign.h +30 -40
- package/eigen/Eigen/src/Core/AssignEvaluator.h +651 -604
- package/eigen/Eigen/src/Core/Assign_MKL.h +125 -120
- package/eigen/Eigen/src/Core/BandMatrix.h +267 -282
- package/eigen/Eigen/src/Core/Block.h +371 -390
- package/eigen/Eigen/src/Core/CommaInitializer.h +85 -100
- package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
- package/eigen/Eigen/src/Core/CoreEvaluators.h +1214 -937
- package/eigen/Eigen/src/Core/CoreIterators.h +72 -63
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +112 -129
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +676 -702
- package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +55 -67
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +127 -92
- package/eigen/Eigen/src/Core/DenseBase.h +630 -658
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -628
- package/eigen/Eigen/src/Core/DenseStorage.h +511 -590
- package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
- package/eigen/Eigen/src/Core/Diagonal.h +168 -207
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +346 -317
- package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
- package/eigen/Eigen/src/Core/Dot.h +167 -217
- package/eigen/Eigen/src/Core/EigenBase.h +74 -85
- package/eigen/Eigen/src/Core/Fill.h +138 -0
- package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -113
- package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
- package/eigen/Eigen/src/Core/GeneralProduct.h +315 -261
- package/eigen/Eigen/src/Core/GenericPacketMath.h +1182 -520
- package/eigen/Eigen/src/Core/GlobalFunctions.h +193 -157
- package/eigen/Eigen/src/Core/IO.h +131 -156
- package/eigen/Eigen/src/Core/IndexedView.h +209 -125
- package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
- package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/Inverse.h +50 -59
- package/eigen/Eigen/src/Core/Map.h +123 -141
- package/eigen/Eigen/src/Core/MapBase.h +255 -282
- package/eigen/Eigen/src/Core/MathFunctions.h +1247 -1201
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +162 -99
- package/eigen/Eigen/src/Core/Matrix.h +463 -494
- package/eigen/Eigen/src/Core/MatrixBase.h +468 -470
- package/eigen/Eigen/src/Core/NestByValue.h +58 -52
- package/eigen/Eigen/src/Core/NoAlias.h +79 -86
- package/eigen/Eigen/src/Core/NumTraits.h +206 -206
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +163 -142
- package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
- package/eigen/Eigen/src/Core/PlainObjectBase.h +858 -972
- package/eigen/Eigen/src/Core/Product.h +246 -130
- package/eigen/Eigen/src/Core/ProductEvaluators.h +779 -671
- package/eigen/Eigen/src/Core/Random.h +153 -164
- package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
- package/eigen/Eigen/src/Core/RealView.h +250 -0
- package/eigen/Eigen/src/Core/Redux.h +334 -314
- package/eigen/Eigen/src/Core/Ref.h +259 -257
- package/eigen/Eigen/src/Core/Replicate.h +92 -104
- package/eigen/Eigen/src/Core/Reshaped.h +215 -271
- package/eigen/Eigen/src/Core/ReturnByValue.h +47 -55
- package/eigen/Eigen/src/Core/Reverse.h +133 -148
- package/eigen/Eigen/src/Core/Select.h +68 -140
- package/eigen/Eigen/src/Core/SelfAdjointView.h +254 -290
- package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
- package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
- package/eigen/Eigen/src/Core/Solve.h +88 -102
- package/eigen/Eigen/src/Core/SolveTriangular.h +126 -124
- package/eigen/Eigen/src/Core/SolverBase.h +132 -133
- package/eigen/Eigen/src/Core/StableNorm.h +113 -147
- package/eigen/Eigen/src/Core/StlIterators.h +404 -248
- package/eigen/Eigen/src/Core/Stride.h +90 -92
- package/eigen/Eigen/src/Core/Swap.h +70 -39
- package/eigen/Eigen/src/Core/Transpose.h +258 -295
- package/eigen/Eigen/src/Core/Transpositions.h +270 -333
- package/eigen/Eigen/src/Core/TriangularMatrix.h +642 -743
- package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
- package/eigen/Eigen/src/Core/VectorwiseOp.h +653 -704
- package/eigen/Eigen/src/Core/Visitor.h +464 -308
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +380 -187
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +65 -163
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2145 -638
- package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +253 -60
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +278 -228
- package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +48 -269
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1597 -754
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
- package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +229 -41
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +420 -184
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +40 -49
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2962 -2213
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +196 -212
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +713 -441
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2380 -1362
- package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +390 -224
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +78 -67
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1784 -799
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +167 -50
- package/eigen/Eigen/src/Core/arch/Default/Half.h +528 -379
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +10 -12
- package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
- package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +41 -40
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +550 -523
- package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +27 -30
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +8 -8
- package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
- package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
- package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
- package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
- package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
- package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +54 -82
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +84 -92
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +51 -47
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +454 -306
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +175 -115
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +23 -30
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4366 -2857
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +616 -393
- package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +350 -198
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +38 -149
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +1791 -912
- package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +128 -40
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +10 -6
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +156 -234
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +6 -3
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +27 -32
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +119 -117
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +325 -419
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +15 -17
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +325 -181
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +94 -83
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +811 -458
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +121 -124
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +576 -370
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +194 -109
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +95 -112
- package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1038 -749
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1883 -1375
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +312 -370
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +189 -176
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +84 -81
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +292 -337
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
- package/eigen/Eigen/src/Core/products/Parallelizer.h +207 -105
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +327 -388
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +138 -147
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -47
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -277
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +68 -94
- package/eigen/Eigen/src/Core/util/Assert.h +158 -0
- package/eigen/Eigen/src/Core/util/BlasUtil.h +342 -303
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +348 -317
- package/eigen/Eigen/src/Core/util/Constants.h +297 -262
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -90
- package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +449 -247
- package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
- package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +417 -116
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +211 -204
- package/eigen/Eigen/src/Core/util/MKL_support.h +39 -37
- package/eigen/Eigen/src/Core/util/Macros.h +655 -773
- package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
- package/eigen/Eigen/src/Core/util/Memory.h +970 -748
- package/eigen/Eigen/src/Core/util/Meta.h +581 -633
- package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
- package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +17 -17
- package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +50 -166
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +377 -225
- package/eigen/Eigen/src/Core/util/XprHelper.h +784 -547
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
- package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
- package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +89 -105
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +537 -607
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +342 -381
- package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +541 -595
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +430 -462
- package/eigen/Eigen/src/Geometry/AlignedBox.h +226 -227
- package/eigen/Eigen/src/Geometry/AngleAxis.h +131 -133
- package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
- package/eigen/Eigen/src/Geometry/Homogeneous.h +285 -333
- package/eigen/Eigen/src/Geometry/Hyperplane.h +151 -160
- package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -146
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +127 -127
- package/eigen/Eigen/src/Geometry/Quaternion.h +566 -506
- package/eigen/Eigen/src/Geometry/Rotation2D.h +107 -105
- package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
- package/eigen/Eigen/src/Geometry/Scaling.h +113 -106
- package/eigen/Eigen/src/Geometry/Transform.h +858 -936
- package/eigen/Eigen/src/Geometry/Translation.h +94 -92
- package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +90 -104
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +51 -46
- package/eigen/Eigen/src/Householder/Householder.h +102 -124
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +412 -453
- package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -162
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +124 -119
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +92 -104
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +251 -243
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +224 -228
- package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +178 -227
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +79 -84
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +54 -60
- package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Jacobi/Jacobi.h +252 -308
- package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +208 -227
- package/eigen/Eigen/src/LU/Determinant.h +50 -69
- package/eigen/Eigen/src/LU/FullPivLU.h +545 -596
- package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/LU/InverseImpl.h +206 -285
- package/eigen/Eigen/src/LU/PartialPivLU.h +390 -428
- package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +72 -70
- package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
- package/eigen/Eigen/src/OrderingMethods/Amd.h +243 -265
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +831 -1004
- package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +112 -119
- package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
- package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -430
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +479 -479
- package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +166 -153
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +495 -475
- package/eigen/Eigen/src/QR/HouseholderQR.h +394 -285
- package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
- package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +244 -264
- package/eigen/Eigen/src/SVD/BDCSVD.h +817 -713
- package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
- package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SVD/JacobiSVD.h +577 -543
- package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
- package/eigen/Eigen/src/SVD/SVDBase.h +242 -182
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +200 -235
- package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +765 -594
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +308 -94
- package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -252
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +134 -178
- package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +149 -140
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +403 -440
- package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +525 -303
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +555 -339
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +169 -197
- package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
- package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
- package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
- package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1603 -1245
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -350
- package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +94 -97
- package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
- package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +370 -416
- package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
- package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
- package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
- package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +138 -115
- package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
- package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
- package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
- package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseLU/SparseLU.h +756 -710
- package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
- package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +245 -301
- package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
- package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +89 -100
- package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
- package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
- package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +124 -132
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
- package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
- package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
- package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
- package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseQR/SparseQR.h +450 -502
- package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -93
- package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
- package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
- package/eigen/Eigen/src/StlSupport/details.h +48 -50
- package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -730
- package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
- package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
- package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
- package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
- package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
- package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
- package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
- package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
- package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
- package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
- package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
- package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
- package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +428 -464
- package/eigen/Eigen/src/misc/Image.h +41 -43
- package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/misc/Kernel.h +39 -41
- package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
- package/eigen/Eigen/src/misc/blas.h +83 -426
- package/eigen/Eigen/src/misc/lapacke.h +9972 -16179
- package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
- package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
- package/eigen/Eigen/src/plugins/{BlockMethods.h → BlockMethods.inc} +434 -506
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
- package/eigen/Eigen/src/plugins/{CommonCwiseUnaryOps.h → CommonCwiseUnaryOps.inc} +58 -68
- package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
- package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
- package/package.json +1 -1
- package/eigen/COPYING.APACHE +0 -203
- package/eigen/COPYING.BSD +0 -26
- package/eigen/COPYING.GPL +0 -674
- package/eigen/COPYING.LGPL +0 -502
- package/eigen/COPYING.MINPACK +0 -51
- package/eigen/COPYING.MPL2 +0 -373
- package/eigen/COPYING.README +0 -18
- package/eigen/Eigen/src/Core/BooleanRedux.h +0 -162
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -258
- package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +0 -120
- package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +0 -694
- package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
- package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
- package/eigen/Eigen/src/misc/lapack.h +0 -152
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -358
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -696
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
- package/eigen/Eigen/src/plugins/IndexedViewMethods.h +0 -262
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -95
- package/eigen/Eigen/src/plugins/ReshapedMethods.h +0 -149
- package/eigen/README.md +0 -5
|
@@ -43,12 +43,11 @@
|
|
|
43
43
|
//
|
|
44
44
|
// http://www.suitesparse.com
|
|
45
45
|
|
|
46
|
-
|
|
47
46
|
#ifndef EIGEN_COLAMD_H
|
|
48
47
|
#define EIGEN_COLAMD_H
|
|
49
48
|
|
|
49
|
+
namespace Eigen {
|
|
50
50
|
namespace internal {
|
|
51
|
-
|
|
52
51
|
namespace Colamd {
|
|
53
52
|
|
|
54
53
|
/* Ensure that debugging is turned off: */
|
|
@@ -56,7 +55,6 @@ namespace Colamd {
|
|
|
56
55
|
#define COLAMD_NDEBUG
|
|
57
56
|
#endif /* NDEBUG */
|
|
58
57
|
|
|
59
|
-
|
|
60
58
|
/* ========================================================================== */
|
|
61
59
|
/* === Knob and statistics definitions ====================================== */
|
|
62
60
|
/* ========================================================================== */
|
|
@@ -116,16 +114,10 @@ IndexType ones_complement(const IndexType r) {
|
|
|
116
114
|
const int Empty = -1;
|
|
117
115
|
|
|
118
116
|
/* Row and column status */
|
|
119
|
-
enum RowColumnStatus {
|
|
120
|
-
Alive = 0,
|
|
121
|
-
Dead = -1
|
|
122
|
-
};
|
|
117
|
+
enum RowColumnStatus { Alive = 0, Dead = -1 };
|
|
123
118
|
|
|
124
119
|
/* Column status */
|
|
125
|
-
enum ColumnStatus {
|
|
126
|
-
DeadPrincipal = -1,
|
|
127
|
-
DeadNonPrincipal = -2
|
|
128
|
-
};
|
|
120
|
+
enum ColumnStatus { DeadPrincipal = -1, DeadNonPrincipal = -2 };
|
|
129
121
|
|
|
130
122
|
/* ========================================================================== */
|
|
131
123
|
/* === Colamd reporting mechanism =========================================== */
|
|
@@ -133,36 +125,31 @@ enum ColumnStatus {
|
|
|
133
125
|
|
|
134
126
|
// == Row and Column structures ==
|
|
135
127
|
template <typename IndexType>
|
|
136
|
-
struct ColStructure
|
|
137
|
-
|
|
138
|
-
IndexType start ; /* index for A of first row in this column, or Dead */
|
|
128
|
+
struct ColStructure {
|
|
129
|
+
IndexType start; /* index for A of first row in this column, or Dead */
|
|
139
130
|
/* if column is dead */
|
|
140
|
-
IndexType length
|
|
141
|
-
union
|
|
142
|
-
|
|
143
|
-
IndexType thickness ; /* number of original columns represented by this */
|
|
131
|
+
IndexType length; /* number of rows in this column */
|
|
132
|
+
union {
|
|
133
|
+
IndexType thickness; /* number of original columns represented by this */
|
|
144
134
|
/* col, if the column is alive */
|
|
145
|
-
IndexType parent
|
|
135
|
+
IndexType parent; /* parent in parent tree super-column structure, if */
|
|
146
136
|
/* the column is dead */
|
|
147
|
-
} shared1
|
|
148
|
-
union
|
|
149
|
-
|
|
150
|
-
IndexType
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
IndexType headhash ; /* head of a hash bucket, if col is at the head of */
|
|
137
|
+
} shared1;
|
|
138
|
+
union {
|
|
139
|
+
IndexType score; /* the score used to maintain heap, if col is alive */
|
|
140
|
+
IndexType order; /* pivot ordering of this column, if col is dead */
|
|
141
|
+
} shared2;
|
|
142
|
+
union {
|
|
143
|
+
IndexType headhash; /* head of a hash bucket, if col is at the head of */
|
|
156
144
|
/* a degree list */
|
|
157
|
-
IndexType hash
|
|
158
|
-
IndexType prev
|
|
145
|
+
IndexType hash; /* hash value, if col is not in a degree list */
|
|
146
|
+
IndexType prev; /* previous column in degree list, if col is in a */
|
|
159
147
|
/* degree list (but not at the head of a degree list) */
|
|
160
|
-
} shared3
|
|
161
|
-
union
|
|
162
|
-
|
|
163
|
-
IndexType
|
|
164
|
-
|
|
165
|
-
} shared4 ;
|
|
148
|
+
} shared3;
|
|
149
|
+
union {
|
|
150
|
+
IndexType degree_next; /* next column, if col is in a degree list */
|
|
151
|
+
IndexType hash_next; /* next column, if col is in a hash list */
|
|
152
|
+
} shared4;
|
|
166
153
|
|
|
167
154
|
inline bool is_dead() const { return start < Alive; }
|
|
168
155
|
|
|
@@ -173,31 +160,26 @@ struct ColStructure
|
|
|
173
160
|
inline void kill_principal() { start = DeadPrincipal; }
|
|
174
161
|
|
|
175
162
|
inline void kill_non_principal() { start = DeadNonPrincipal; }
|
|
176
|
-
|
|
177
163
|
};
|
|
178
164
|
|
|
179
165
|
template <typename IndexType>
|
|
180
|
-
struct RowStructure
|
|
181
|
-
|
|
182
|
-
IndexType
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
IndexType mark ; /* for computing set differences and marking dead rows*/
|
|
192
|
-
IndexType first_column ;/* first column in row (used in garbage collection) */
|
|
193
|
-
} shared2 ;
|
|
166
|
+
struct RowStructure {
|
|
167
|
+
IndexType start; /* index for A of first col in this row */
|
|
168
|
+
IndexType length; /* number of principal columns in this row */
|
|
169
|
+
union {
|
|
170
|
+
IndexType degree; /* number of principal & non-principal columns in row */
|
|
171
|
+
IndexType p; /* used as a row pointer in init_rows_cols () */
|
|
172
|
+
} shared1;
|
|
173
|
+
union {
|
|
174
|
+
IndexType mark; /* for computing set differences and marking dead rows*/
|
|
175
|
+
IndexType first_column; /* first column in row (used in garbage collection) */
|
|
176
|
+
} shared2;
|
|
194
177
|
|
|
195
178
|
inline bool is_dead() const { return shared2.mark < Alive; }
|
|
196
179
|
|
|
197
180
|
inline bool is_alive() const { return shared2.mark >= Alive; }
|
|
198
181
|
|
|
199
182
|
inline void kill() { shared2.mark = Dead; }
|
|
200
|
-
|
|
201
183
|
};
|
|
202
184
|
|
|
203
185
|
/* ========================================================================== */
|
|
@@ -219,34 +201,43 @@ struct RowStructure
|
|
|
219
201
|
gcc -pedantic warning messages.
|
|
220
202
|
*/
|
|
221
203
|
template <typename IndexType>
|
|
222
|
-
inline IndexType colamd_c(IndexType n_col)
|
|
223
|
-
|
|
204
|
+
inline IndexType colamd_c(IndexType n_col) {
|
|
205
|
+
return IndexType(((n_col) + 1) * sizeof(ColStructure<IndexType>) / sizeof(IndexType));
|
|
206
|
+
}
|
|
224
207
|
|
|
225
208
|
template <typename IndexType>
|
|
226
|
-
inline IndexType
|
|
227
|
-
|
|
209
|
+
inline IndexType colamd_r(IndexType n_row) {
|
|
210
|
+
return IndexType(((n_row) + 1) * sizeof(RowStructure<IndexType>) / sizeof(IndexType));
|
|
211
|
+
}
|
|
228
212
|
|
|
229
213
|
// Prototypes of non-user callable routines
|
|
230
214
|
template <typename IndexType>
|
|
231
|
-
static IndexType init_rows_cols
|
|
215
|
+
static IndexType init_rows_cols(IndexType n_row, IndexType n_col, RowStructure<IndexType> Row[],
|
|
216
|
+
ColStructure<IndexType> col[], IndexType A[], IndexType p[], IndexType stats[NStats]);
|
|
232
217
|
|
|
233
218
|
template <typename IndexType>
|
|
234
|
-
static void init_scoring
|
|
219
|
+
static void init_scoring(IndexType n_row, IndexType n_col, RowStructure<IndexType> Row[], ColStructure<IndexType> Col[],
|
|
220
|
+
IndexType A[], IndexType head[], double knobs[NKnobs], IndexType *p_n_row2,
|
|
221
|
+
IndexType *p_n_col2, IndexType *p_max_deg);
|
|
235
222
|
|
|
236
223
|
template <typename IndexType>
|
|
237
|
-
static IndexType find_ordering
|
|
224
|
+
static IndexType find_ordering(IndexType n_row, IndexType n_col, IndexType Alen, RowStructure<IndexType> Row[],
|
|
225
|
+
ColStructure<IndexType> Col[], IndexType A[], IndexType head[], IndexType n_col2,
|
|
226
|
+
IndexType max_deg, IndexType pfree);
|
|
238
227
|
|
|
239
228
|
template <typename IndexType>
|
|
240
|
-
static void order_children
|
|
229
|
+
static void order_children(IndexType n_col, ColStructure<IndexType> Col[], IndexType p[]);
|
|
241
230
|
|
|
242
231
|
template <typename IndexType>
|
|
243
|
-
static void detect_super_cols
|
|
232
|
+
static void detect_super_cols(ColStructure<IndexType> Col[], IndexType A[], IndexType head[], IndexType row_start,
|
|
233
|
+
IndexType row_length);
|
|
244
234
|
|
|
245
235
|
template <typename IndexType>
|
|
246
|
-
static IndexType garbage_collection
|
|
236
|
+
static IndexType garbage_collection(IndexType n_row, IndexType n_col, RowStructure<IndexType> Row[],
|
|
237
|
+
ColStructure<IndexType> Col[], IndexType A[], IndexType *pfree);
|
|
247
238
|
|
|
248
239
|
template <typename IndexType>
|
|
249
|
-
static inline
|
|
240
|
+
static inline IndexType clear_mark(IndexType n_row, RowStructure<IndexType> Row[]);
|
|
250
241
|
|
|
251
242
|
/* === No debugging ========================================================= */
|
|
252
243
|
|
|
@@ -256,8 +247,7 @@ static inline IndexType clear_mark (IndexType n_row, RowStructure<IndexType> Ro
|
|
|
256
247
|
#define COLAMD_DEBUG3(params) ;
|
|
257
248
|
#define COLAMD_DEBUG4(params) ;
|
|
258
249
|
|
|
259
|
-
#define COLAMD_ASSERT(expression) ((void)
|
|
260
|
-
|
|
250
|
+
#define COLAMD_ASSERT(expression) ((void)0)
|
|
261
251
|
|
|
262
252
|
/**
|
|
263
253
|
* \brief Returns the recommended value of Alen
|
|
@@ -274,12 +264,11 @@ static inline IndexType clear_mark (IndexType n_row, RowStructure<IndexType> Ro
|
|
|
274
264
|
* \return recommended value of Alen for use by colamd
|
|
275
265
|
*/
|
|
276
266
|
template <typename IndexType>
|
|
277
|
-
inline IndexType recommended
|
|
278
|
-
{
|
|
267
|
+
inline IndexType recommended(IndexType nnz, IndexType n_row, IndexType n_col) {
|
|
279
268
|
if ((nnz) < 0 || (n_row) < 0 || (n_col) < 0)
|
|
280
269
|
return (-1);
|
|
281
270
|
else
|
|
282
|
-
return (2 * (nnz) + colamd_c
|
|
271
|
+
return (2 * (nnz) + colamd_c(n_col) + colamd_r(n_row) + (n_col) + ((nnz) / 5));
|
|
283
272
|
}
|
|
284
273
|
|
|
285
274
|
/**
|
|
@@ -303,22 +292,19 @@ inline IndexType recommended ( IndexType nnz, IndexType n_row, IndexType n_col)
|
|
|
303
292
|
* \param knobs parameter settings for colamd
|
|
304
293
|
*/
|
|
305
294
|
|
|
306
|
-
static inline void set_defaults(double knobs[NKnobs])
|
|
307
|
-
{
|
|
295
|
+
static inline void set_defaults(double knobs[NKnobs]) {
|
|
308
296
|
/* === Local variables ================================================== */
|
|
309
297
|
|
|
310
|
-
int i
|
|
298
|
+
int i;
|
|
311
299
|
|
|
312
|
-
if (!knobs)
|
|
313
|
-
|
|
314
|
-
return ; /* no knobs to initialize */
|
|
300
|
+
if (!knobs) {
|
|
301
|
+
return; /* no knobs to initialize */
|
|
315
302
|
}
|
|
316
|
-
for (i = 0
|
|
317
|
-
|
|
318
|
-
knobs [i] = 0 ;
|
|
303
|
+
for (i = 0; i < NKnobs; i++) {
|
|
304
|
+
knobs[i] = 0;
|
|
319
305
|
}
|
|
320
|
-
knobs
|
|
321
|
-
knobs
|
|
306
|
+
knobs[Colamd::DenseRow] = 0.5; /* ignore rows over 50% dense */
|
|
307
|
+
knobs[Colamd::DenseCol] = 0.5; /* ignore columns over 50% dense */
|
|
322
308
|
}
|
|
323
309
|
|
|
324
310
|
/**
|
|
@@ -332,151 +318,142 @@ static inline void set_defaults(double knobs[NKnobs])
|
|
|
332
318
|
*
|
|
333
319
|
* \param n_row number of rows in A
|
|
334
320
|
* \param n_col number of columns in A
|
|
335
|
-
* \param Alen
|
|
321
|
+
* \param Alen size of the array A
|
|
336
322
|
* \param A row indices of the matrix, of size ALen
|
|
337
323
|
* \param p column pointers of A, of size n_col+1
|
|
338
324
|
* \param knobs parameter settings for colamd
|
|
339
325
|
* \param stats colamd output statistics and error codes
|
|
340
326
|
*/
|
|
341
327
|
template <typename IndexType>
|
|
342
|
-
static bool compute_ordering(IndexType n_row, IndexType n_col, IndexType Alen, IndexType *A, IndexType *p,
|
|
343
|
-
{
|
|
328
|
+
static bool compute_ordering(IndexType n_row, IndexType n_col, IndexType Alen, IndexType *A, IndexType *p,
|
|
329
|
+
double knobs[NKnobs], IndexType stats[NStats]) {
|
|
344
330
|
/* === Local variables ================================================== */
|
|
345
331
|
|
|
346
|
-
IndexType i
|
|
347
|
-
IndexType nnz
|
|
348
|
-
IndexType Row_size
|
|
349
|
-
IndexType Col_size
|
|
350
|
-
IndexType need
|
|
351
|
-
Colamd::RowStructure<IndexType> *Row
|
|
352
|
-
Colamd::ColStructure<IndexType> *Col
|
|
353
|
-
IndexType n_col2
|
|
354
|
-
IndexType n_row2
|
|
355
|
-
IndexType ngarbage
|
|
356
|
-
IndexType max_deg
|
|
357
|
-
double default_knobs
|
|
358
|
-
|
|
332
|
+
IndexType i; /* loop index */
|
|
333
|
+
IndexType nnz; /* nonzeros in A */
|
|
334
|
+
IndexType Row_size; /* size of Row [], in integers */
|
|
335
|
+
IndexType Col_size; /* size of Col [], in integers */
|
|
336
|
+
IndexType need; /* minimum required length of A */
|
|
337
|
+
Colamd::RowStructure<IndexType> *Row; /* pointer into A of Row [0..n_row] array */
|
|
338
|
+
Colamd::ColStructure<IndexType> *Col; /* pointer into A of Col [0..n_col] array */
|
|
339
|
+
IndexType n_col2; /* number of non-dense, non-empty columns */
|
|
340
|
+
IndexType n_row2; /* number of non-dense, non-empty rows */
|
|
341
|
+
IndexType ngarbage; /* number of garbage collections performed */
|
|
342
|
+
IndexType max_deg; /* maximum row degree */
|
|
343
|
+
double default_knobs[NKnobs]; /* default knobs array */
|
|
359
344
|
|
|
360
345
|
/* === Check the input arguments ======================================== */
|
|
361
346
|
|
|
362
|
-
if (!stats)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
return (false) ;
|
|
347
|
+
if (!stats) {
|
|
348
|
+
COLAMD_DEBUG0(("colamd: stats not present\n"));
|
|
349
|
+
return (false);
|
|
366
350
|
}
|
|
367
|
-
for (i = 0
|
|
368
|
-
|
|
369
|
-
stats [i] = 0 ;
|
|
351
|
+
for (i = 0; i < NStats; i++) {
|
|
352
|
+
stats[i] = 0;
|
|
370
353
|
}
|
|
371
|
-
stats
|
|
372
|
-
stats
|
|
373
|
-
stats
|
|
354
|
+
stats[Colamd::Status] = Colamd::Ok;
|
|
355
|
+
stats[Colamd::Info1] = -1;
|
|
356
|
+
stats[Colamd::Info2] = -1;
|
|
374
357
|
|
|
375
|
-
if (!A)
|
|
358
|
+
if (!A) /* A is not present */
|
|
376
359
|
{
|
|
377
|
-
stats
|
|
378
|
-
COLAMD_DEBUG0
|
|
379
|
-
return (false)
|
|
360
|
+
stats[Colamd::Status] = Colamd::ErrorANotPresent;
|
|
361
|
+
COLAMD_DEBUG0(("colamd: A not present\n"));
|
|
362
|
+
return (false);
|
|
380
363
|
}
|
|
381
364
|
|
|
382
|
-
if (!p)
|
|
365
|
+
if (!p) /* p is not present */
|
|
383
366
|
{
|
|
384
|
-
stats
|
|
385
|
-
COLAMD_DEBUG0
|
|
386
|
-
return (false)
|
|
367
|
+
stats[Colamd::Status] = Colamd::ErrorPNotPresent;
|
|
368
|
+
COLAMD_DEBUG0(("colamd: p not present\n"));
|
|
369
|
+
return (false);
|
|
387
370
|
}
|
|
388
371
|
|
|
389
|
-
if (n_row < 0)
|
|
372
|
+
if (n_row < 0) /* n_row must be >= 0 */
|
|
390
373
|
{
|
|
391
|
-
stats
|
|
392
|
-
stats
|
|
393
|
-
COLAMD_DEBUG0
|
|
394
|
-
return (false)
|
|
374
|
+
stats[Colamd::Status] = Colamd::ErrorNrowNegative;
|
|
375
|
+
stats[Colamd::Info1] = n_row;
|
|
376
|
+
COLAMD_DEBUG0(("colamd: nrow negative %d\n", n_row));
|
|
377
|
+
return (false);
|
|
395
378
|
}
|
|
396
379
|
|
|
397
|
-
if (n_col < 0)
|
|
380
|
+
if (n_col < 0) /* n_col must be >= 0 */
|
|
398
381
|
{
|
|
399
|
-
stats
|
|
400
|
-
stats
|
|
401
|
-
COLAMD_DEBUG0
|
|
402
|
-
return (false)
|
|
382
|
+
stats[Colamd::Status] = Colamd::ErrorNcolNegative;
|
|
383
|
+
stats[Colamd::Info1] = n_col;
|
|
384
|
+
COLAMD_DEBUG0(("colamd: ncol negative %d\n", n_col));
|
|
385
|
+
return (false);
|
|
403
386
|
}
|
|
404
387
|
|
|
405
|
-
nnz = p
|
|
406
|
-
if (nnz < 0)
|
|
388
|
+
nnz = p[n_col];
|
|
389
|
+
if (nnz < 0) /* nnz must be >= 0 */
|
|
407
390
|
{
|
|
408
|
-
stats
|
|
409
|
-
stats
|
|
410
|
-
COLAMD_DEBUG0
|
|
411
|
-
return (false)
|
|
391
|
+
stats[Colamd::Status] = Colamd::ErrorNnzNegative;
|
|
392
|
+
stats[Colamd::Info1] = nnz;
|
|
393
|
+
COLAMD_DEBUG0(("colamd: number of entries negative %d\n", nnz));
|
|
394
|
+
return (false);
|
|
412
395
|
}
|
|
413
396
|
|
|
414
|
-
if (p
|
|
415
|
-
|
|
416
|
-
stats
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return (false) ;
|
|
397
|
+
if (p[0] != 0) {
|
|
398
|
+
stats[Colamd::Status] = Colamd::ErrorP0Nonzero;
|
|
399
|
+
stats[Colamd::Info1] = p[0];
|
|
400
|
+
COLAMD_DEBUG0(("colamd: p[0] not zero %d\n", p[0]));
|
|
401
|
+
return (false);
|
|
420
402
|
}
|
|
421
403
|
|
|
422
404
|
/* === If no knobs, set default knobs =================================== */
|
|
423
405
|
|
|
424
|
-
if (!knobs)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
knobs = default_knobs ;
|
|
406
|
+
if (!knobs) {
|
|
407
|
+
set_defaults(default_knobs);
|
|
408
|
+
knobs = default_knobs;
|
|
428
409
|
}
|
|
429
410
|
|
|
430
411
|
/* === Allocate the Row and Col arrays from array A ===================== */
|
|
431
412
|
|
|
432
|
-
Col_size = colamd_c
|
|
433
|
-
Row_size = colamd_r
|
|
434
|
-
need = 2*nnz + n_col + Col_size + Row_size
|
|
413
|
+
Col_size = colamd_c(n_col);
|
|
414
|
+
Row_size = colamd_r(n_row);
|
|
415
|
+
need = 2 * nnz + n_col + Col_size + Row_size;
|
|
435
416
|
|
|
436
|
-
if (need > Alen)
|
|
437
|
-
{
|
|
417
|
+
if (need > Alen) {
|
|
438
418
|
/* not enough space in array A to perform the ordering */
|
|
439
|
-
stats
|
|
440
|
-
stats
|
|
441
|
-
stats
|
|
442
|
-
COLAMD_DEBUG0
|
|
443
|
-
return (false)
|
|
419
|
+
stats[Colamd::Status] = Colamd::ErrorATooSmall;
|
|
420
|
+
stats[Colamd::Info1] = need;
|
|
421
|
+
stats[Colamd::Info2] = Alen;
|
|
422
|
+
COLAMD_DEBUG0(("colamd: Need Alen >= %d, given only Alen = %d\n", need, Alen));
|
|
423
|
+
return (false);
|
|
444
424
|
}
|
|
445
425
|
|
|
446
|
-
Alen -= Col_size + Row_size
|
|
447
|
-
Col = (ColStructure<IndexType> *)
|
|
448
|
-
Row = (RowStructure<IndexType> *)
|
|
426
|
+
Alen -= Col_size + Row_size;
|
|
427
|
+
Col = (ColStructure<IndexType> *)&A[Alen];
|
|
428
|
+
Row = (RowStructure<IndexType> *)&A[Alen + Col_size];
|
|
449
429
|
|
|
450
430
|
/* === Construct the row and column data structures ===================== */
|
|
451
431
|
|
|
452
|
-
if (!Colamd::init_rows_cols
|
|
453
|
-
{
|
|
432
|
+
if (!Colamd::init_rows_cols(n_row, n_col, Row, Col, A, p, stats)) {
|
|
454
433
|
/* input matrix is invalid */
|
|
455
|
-
COLAMD_DEBUG0
|
|
456
|
-
return (false)
|
|
434
|
+
COLAMD_DEBUG0(("colamd: Matrix invalid\n"));
|
|
435
|
+
return (false);
|
|
457
436
|
}
|
|
458
437
|
|
|
459
438
|
/* === Initialize scores, kill dense rows/columns ======================= */
|
|
460
439
|
|
|
461
|
-
Colamd::init_scoring
|
|
462
|
-
&n_row2, &n_col2, &max_deg) ;
|
|
440
|
+
Colamd::init_scoring(n_row, n_col, Row, Col, A, p, knobs, &n_row2, &n_col2, &max_deg);
|
|
463
441
|
|
|
464
442
|
/* === Order the supercolumns =========================================== */
|
|
465
443
|
|
|
466
|
-
ngarbage = Colamd::find_ordering
|
|
467
|
-
n_col2, max_deg, 2*nnz) ;
|
|
444
|
+
ngarbage = Colamd::find_ordering(n_row, n_col, Alen, Row, Col, A, p, n_col2, max_deg, 2 * nnz);
|
|
468
445
|
|
|
469
446
|
/* === Order the non-principal columns ================================== */
|
|
470
447
|
|
|
471
|
-
Colamd::order_children
|
|
448
|
+
Colamd::order_children(n_col, Col, p);
|
|
472
449
|
|
|
473
450
|
/* === Return statistics in stats ======================================= */
|
|
474
451
|
|
|
475
|
-
stats
|
|
476
|
-
stats
|
|
477
|
-
stats
|
|
478
|
-
COLAMD_DEBUG0
|
|
479
|
-
return (true)
|
|
452
|
+
stats[Colamd::DenseRow] = n_row - n_row2;
|
|
453
|
+
stats[Colamd::DenseCol] = n_col - n_col2;
|
|
454
|
+
stats[Colamd::DefragCount] = ngarbage;
|
|
455
|
+
COLAMD_DEBUG0(("colamd: done.\n"));
|
|
456
|
+
return (true);
|
|
480
457
|
}
|
|
481
458
|
|
|
482
459
|
/* ========================================================================== */
|
|
@@ -498,112 +475,102 @@ static bool compute_ordering(IndexType n_row, IndexType n_col, IndexType Alen, I
|
|
|
498
475
|
true otherwise. Not user-callable.
|
|
499
476
|
*/
|
|
500
477
|
template <typename IndexType>
|
|
501
|
-
static IndexType init_rows_cols
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
)
|
|
513
|
-
{
|
|
478
|
+
static IndexType init_rows_cols /* returns true if OK, or false otherwise */
|
|
479
|
+
(
|
|
480
|
+
/* === Parameters ======================================================= */
|
|
481
|
+
|
|
482
|
+
IndexType n_row, /* number of rows of A */
|
|
483
|
+
IndexType n_col, /* number of columns of A */
|
|
484
|
+
RowStructure<IndexType> Row[], /* of size n_row+1 */
|
|
485
|
+
ColStructure<IndexType> Col[], /* of size n_col+1 */
|
|
486
|
+
IndexType A[], /* row indices of A, of size Alen */
|
|
487
|
+
IndexType p[], /* pointers to columns in A, of size n_col+1 */
|
|
488
|
+
IndexType stats[NStats] /* colamd statistics */
|
|
489
|
+
) {
|
|
514
490
|
/* === Local variables ================================================== */
|
|
515
491
|
|
|
516
|
-
IndexType col
|
|
517
|
-
IndexType row
|
|
518
|
-
IndexType *cp
|
|
519
|
-
IndexType *cp_end
|
|
520
|
-
IndexType *rp
|
|
521
|
-
IndexType *rp_end
|
|
522
|
-
IndexType last_row
|
|
492
|
+
IndexType col; /* a column index */
|
|
493
|
+
IndexType row; /* a row index */
|
|
494
|
+
IndexType *cp; /* a column pointer */
|
|
495
|
+
IndexType *cp_end; /* a pointer to the end of a column */
|
|
496
|
+
IndexType *rp; /* a row pointer */
|
|
497
|
+
IndexType *rp_end; /* a pointer to the end of a row */
|
|
498
|
+
IndexType last_row; /* previous row */
|
|
523
499
|
|
|
524
500
|
/* === Initialize columns, and check column pointers ==================== */
|
|
525
501
|
|
|
526
|
-
for (col = 0
|
|
527
|
-
|
|
528
|
-
Col
|
|
529
|
-
Col [col].length = p [col+1] - p [col] ;
|
|
502
|
+
for (col = 0; col < n_col; col++) {
|
|
503
|
+
Col[col].start = p[col];
|
|
504
|
+
Col[col].length = p[col + 1] - p[col];
|
|
530
505
|
|
|
531
|
-
if ((Col
|
|
506
|
+
if ((Col[col].length) < 0) // extra parentheses to work-around gcc bug 10200
|
|
532
507
|
{
|
|
533
508
|
/* column pointers must be non-decreasing */
|
|
534
|
-
stats
|
|
535
|
-
stats
|
|
536
|
-
stats
|
|
537
|
-
COLAMD_DEBUG0
|
|
538
|
-
return (false)
|
|
509
|
+
stats[Colamd::Status] = Colamd::ErrorColLengthNegative;
|
|
510
|
+
stats[Colamd::Info1] = col;
|
|
511
|
+
stats[Colamd::Info2] = Col[col].length;
|
|
512
|
+
COLAMD_DEBUG0(("colamd: col %d length %d < 0\n", col, Col[col].length));
|
|
513
|
+
return (false);
|
|
539
514
|
}
|
|
540
515
|
|
|
541
|
-
Col
|
|
542
|
-
Col
|
|
543
|
-
Col
|
|
544
|
-
Col
|
|
516
|
+
Col[col].shared1.thickness = 1;
|
|
517
|
+
Col[col].shared2.score = 0;
|
|
518
|
+
Col[col].shared3.prev = Empty;
|
|
519
|
+
Col[col].shared4.degree_next = Empty;
|
|
545
520
|
}
|
|
546
521
|
|
|
547
522
|
/* p [0..n_col] no longer needed, used as "head" in subsequent routines */
|
|
548
523
|
|
|
549
524
|
/* === Scan columns, compute row degrees, and check row indices ========= */
|
|
550
525
|
|
|
551
|
-
stats
|
|
526
|
+
stats[Info3] = 0; /* number of duplicate or unsorted row indices*/
|
|
552
527
|
|
|
553
|
-
for (row = 0
|
|
554
|
-
|
|
555
|
-
Row
|
|
556
|
-
Row [row].shared2.mark = -1 ;
|
|
528
|
+
for (row = 0; row < n_row; row++) {
|
|
529
|
+
Row[row].length = 0;
|
|
530
|
+
Row[row].shared2.mark = -1;
|
|
557
531
|
}
|
|
558
532
|
|
|
559
|
-
for (col = 0
|
|
560
|
-
|
|
561
|
-
last_row = -1 ;
|
|
533
|
+
for (col = 0; col < n_col; col++) {
|
|
534
|
+
last_row = -1;
|
|
562
535
|
|
|
563
|
-
cp = &A
|
|
564
|
-
cp_end = &A
|
|
536
|
+
cp = &A[p[col]];
|
|
537
|
+
cp_end = &A[p[col + 1]];
|
|
565
538
|
|
|
566
|
-
while (cp < cp_end)
|
|
567
|
-
|
|
568
|
-
row = *cp++ ;
|
|
539
|
+
while (cp < cp_end) {
|
|
540
|
+
row = *cp++;
|
|
569
541
|
|
|
570
542
|
/* make sure row indices within range */
|
|
571
|
-
if (row < 0 || row >= n_row)
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
return (false) ;
|
|
543
|
+
if (row < 0 || row >= n_row) {
|
|
544
|
+
stats[Colamd::Status] = Colamd::ErrorRowIndexOutOfBounds;
|
|
545
|
+
stats[Colamd::Info1] = col;
|
|
546
|
+
stats[Colamd::Info2] = row;
|
|
547
|
+
stats[Colamd::Info3] = n_row;
|
|
548
|
+
COLAMD_DEBUG0(("colamd: row %d col %d out of bounds\n", row, col));
|
|
549
|
+
return (false);
|
|
579
550
|
}
|
|
580
551
|
|
|
581
|
-
if (row <= last_row || Row
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
COLAMD_DEBUG1 (("colamd: row %d col %d unsorted/duplicate\n",row,col));
|
|
552
|
+
if (row <= last_row || Row[row].shared2.mark == col) {
|
|
553
|
+
/* row index are unsorted or repeated (or both), thus col */
|
|
554
|
+
/* is jumbled. This is a notice, not an error condition. */
|
|
555
|
+
stats[Colamd::Status] = Colamd::OkButJumbled;
|
|
556
|
+
stats[Colamd::Info1] = col;
|
|
557
|
+
stats[Colamd::Info2] = row;
|
|
558
|
+
(stats[Colamd::Info3])++;
|
|
559
|
+
COLAMD_DEBUG1(("colamd: row %d col %d unsorted/duplicate\n", row, col));
|
|
590
560
|
}
|
|
591
561
|
|
|
592
|
-
if (Row
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
/* this is a repeated entry in the column, */
|
|
599
|
-
/* it will be removed */
|
|
600
|
-
Col [col].length-- ;
|
|
562
|
+
if (Row[row].shared2.mark != col) {
|
|
563
|
+
Row[row].length++;
|
|
564
|
+
} else {
|
|
565
|
+
/* this is a repeated entry in the column, */
|
|
566
|
+
/* it will be removed */
|
|
567
|
+
Col[col].length--;
|
|
601
568
|
}
|
|
602
569
|
|
|
603
570
|
/* mark the row as having been seen in this column */
|
|
604
|
-
Row
|
|
571
|
+
Row[row].shared2.mark = col;
|
|
605
572
|
|
|
606
|
-
last_row = row
|
|
573
|
+
last_row = row;
|
|
607
574
|
}
|
|
608
575
|
}
|
|
609
576
|
|
|
@@ -611,64 +578,52 @@ static IndexType init_rows_cols /* returns true if OK, or false otherwise */
|
|
|
611
578
|
|
|
612
579
|
/* row form of the matrix starts directly after the column */
|
|
613
580
|
/* form of matrix in A */
|
|
614
|
-
Row
|
|
615
|
-
Row
|
|
616
|
-
Row
|
|
617
|
-
for (row = 1
|
|
618
|
-
|
|
619
|
-
Row
|
|
620
|
-
Row
|
|
621
|
-
Row [row].shared2.mark = -1 ;
|
|
581
|
+
Row[0].start = p[n_col];
|
|
582
|
+
Row[0].shared1.p = Row[0].start;
|
|
583
|
+
Row[0].shared2.mark = -1;
|
|
584
|
+
for (row = 1; row < n_row; row++) {
|
|
585
|
+
Row[row].start = Row[row - 1].start + Row[row - 1].length;
|
|
586
|
+
Row[row].shared1.p = Row[row].start;
|
|
587
|
+
Row[row].shared2.mark = -1;
|
|
622
588
|
}
|
|
623
589
|
|
|
624
590
|
/* === Create row form ================================================== */
|
|
625
591
|
|
|
626
|
-
if (stats
|
|
627
|
-
{
|
|
592
|
+
if (stats[Status] == OkButJumbled) {
|
|
628
593
|
/* if cols jumbled, watch for repeated row indices */
|
|
629
|
-
for (col = 0
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
A [(Row [row].shared1.p)++] = col ;
|
|
639
|
-
Row [row].shared2.mark = col ;
|
|
640
|
-
}
|
|
594
|
+
for (col = 0; col < n_col; col++) {
|
|
595
|
+
cp = &A[p[col]];
|
|
596
|
+
cp_end = &A[p[col + 1]];
|
|
597
|
+
while (cp < cp_end) {
|
|
598
|
+
row = *cp++;
|
|
599
|
+
if (Row[row].shared2.mark != col) {
|
|
600
|
+
A[(Row[row].shared1.p)++] = col;
|
|
601
|
+
Row[row].shared2.mark = col;
|
|
602
|
+
}
|
|
641
603
|
}
|
|
642
604
|
}
|
|
643
|
-
}
|
|
644
|
-
else
|
|
645
|
-
{
|
|
605
|
+
} else {
|
|
646
606
|
/* if cols not jumbled, we don't need the mark (this is faster) */
|
|
647
|
-
for (col = 0
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
{
|
|
653
|
-
A [(Row [*cp++].shared1.p)++] = col ;
|
|
607
|
+
for (col = 0; col < n_col; col++) {
|
|
608
|
+
cp = &A[p[col]];
|
|
609
|
+
cp_end = &A[p[col + 1]];
|
|
610
|
+
while (cp < cp_end) {
|
|
611
|
+
A[(Row[*cp++].shared1.p)++] = col;
|
|
654
612
|
}
|
|
655
613
|
}
|
|
656
614
|
}
|
|
657
615
|
|
|
658
616
|
/* === Clear the row marks and set row degrees ========================== */
|
|
659
617
|
|
|
660
|
-
for (row = 0
|
|
661
|
-
|
|
662
|
-
Row
|
|
663
|
-
Row [row].shared1.degree = Row [row].length ;
|
|
618
|
+
for (row = 0; row < n_row; row++) {
|
|
619
|
+
Row[row].shared2.mark = 0;
|
|
620
|
+
Row[row].shared1.degree = Row[row].length;
|
|
664
621
|
}
|
|
665
622
|
|
|
666
623
|
/* === See if we need to re-create columns ============================== */
|
|
667
624
|
|
|
668
|
-
if (stats
|
|
669
|
-
|
|
670
|
-
COLAMD_DEBUG0 (("colamd: reconstructing column form, matrix jumbled\n")) ;
|
|
671
|
-
|
|
625
|
+
if (stats[Status] == OkButJumbled) {
|
|
626
|
+
COLAMD_DEBUG0(("colamd: reconstructing column form, matrix jumbled\n"));
|
|
672
627
|
|
|
673
628
|
/* === Compute col pointers ========================================= */
|
|
674
629
|
|
|
@@ -676,35 +631,31 @@ static IndexType init_rows_cols /* returns true if OK, or false otherwise */
|
|
|
676
631
|
/* Note, we may have a gap between the col form and the row */
|
|
677
632
|
/* form if there were duplicate entries, if so, it will be */
|
|
678
633
|
/* removed upon the first garbage collection */
|
|
679
|
-
Col
|
|
680
|
-
p
|
|
681
|
-
for (col = 1
|
|
682
|
-
{
|
|
634
|
+
Col[0].start = 0;
|
|
635
|
+
p[0] = Col[0].start;
|
|
636
|
+
for (col = 1; col < n_col; col++) {
|
|
683
637
|
/* note that the lengths here are for pruned columns, i.e. */
|
|
684
638
|
/* no duplicate row indices will exist for these columns */
|
|
685
|
-
Col
|
|
686
|
-
p
|
|
639
|
+
Col[col].start = Col[col - 1].start + Col[col - 1].length;
|
|
640
|
+
p[col] = Col[col].start;
|
|
687
641
|
}
|
|
688
642
|
|
|
689
643
|
/* === Re-create col form =========================================== */
|
|
690
644
|
|
|
691
|
-
for (row = 0
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
{
|
|
697
|
-
A [(p [*rp++])++] = row ;
|
|
645
|
+
for (row = 0; row < n_row; row++) {
|
|
646
|
+
rp = &A[Row[row].start];
|
|
647
|
+
rp_end = rp + Row[row].length;
|
|
648
|
+
while (rp < rp_end) {
|
|
649
|
+
A[(p[*rp++])++] = row;
|
|
698
650
|
}
|
|
699
651
|
}
|
|
700
652
|
}
|
|
701
653
|
|
|
702
654
|
/* === Done. Matrix is not (or no longer) jumbled ====================== */
|
|
703
655
|
|
|
704
|
-
return (true)
|
|
656
|
+
return (true);
|
|
705
657
|
}
|
|
706
658
|
|
|
707
|
-
|
|
708
659
|
/* ========================================================================== */
|
|
709
660
|
/* === init_scoring ========================================================= */
|
|
710
661
|
/* ========================================================================== */
|
|
@@ -714,112 +665,99 @@ static IndexType init_rows_cols /* returns true if OK, or false otherwise */
|
|
|
714
665
|
each column, and places all columns in the degree lists. Not user-callable.
|
|
715
666
|
*/
|
|
716
667
|
template <typename IndexType>
|
|
717
|
-
static void init_scoring
|
|
718
|
-
(
|
|
668
|
+
static void init_scoring(
|
|
719
669
|
/* === Parameters ======================================================= */
|
|
720
670
|
|
|
721
|
-
IndexType n_row,
|
|
722
|
-
IndexType n_col,
|
|
723
|
-
RowStructure<IndexType> Row
|
|
724
|
-
ColStructure<IndexType> Col
|
|
725
|
-
IndexType A
|
|
726
|
-
IndexType head
|
|
727
|
-
double knobs
|
|
728
|
-
IndexType *p_n_row2,
|
|
729
|
-
IndexType *p_n_col2,
|
|
730
|
-
IndexType *p_max_deg
|
|
731
|
-
|
|
732
|
-
{
|
|
671
|
+
IndexType n_row, /* number of rows of A */
|
|
672
|
+
IndexType n_col, /* number of columns of A */
|
|
673
|
+
RowStructure<IndexType> Row[], /* of size n_row+1 */
|
|
674
|
+
ColStructure<IndexType> Col[], /* of size n_col+1 */
|
|
675
|
+
IndexType A[], /* column form and row form of A */
|
|
676
|
+
IndexType head[], /* of size n_col+1 */
|
|
677
|
+
double knobs[NKnobs], /* parameters */
|
|
678
|
+
IndexType *p_n_row2, /* number of non-dense, non-empty rows */
|
|
679
|
+
IndexType *p_n_col2, /* number of non-dense, non-empty columns */
|
|
680
|
+
IndexType *p_max_deg /* maximum row degree */
|
|
681
|
+
) {
|
|
733
682
|
/* === Local variables ================================================== */
|
|
734
683
|
|
|
735
|
-
IndexType c
|
|
736
|
-
IndexType r, row
|
|
737
|
-
IndexType *cp
|
|
738
|
-
IndexType deg
|
|
739
|
-
IndexType *cp_end
|
|
740
|
-
IndexType *new_cp
|
|
741
|
-
IndexType col_length
|
|
742
|
-
IndexType score
|
|
743
|
-
IndexType n_col2
|
|
744
|
-
IndexType n_row2
|
|
745
|
-
IndexType dense_row_count
|
|
746
|
-
IndexType dense_col_count
|
|
747
|
-
IndexType min_score
|
|
748
|
-
IndexType max_deg
|
|
749
|
-
IndexType next_col
|
|
750
|
-
|
|
684
|
+
IndexType c; /* a column index */
|
|
685
|
+
IndexType r, row; /* a row index */
|
|
686
|
+
IndexType *cp; /* a column pointer */
|
|
687
|
+
IndexType deg; /* degree of a row or column */
|
|
688
|
+
IndexType *cp_end; /* a pointer to the end of a column */
|
|
689
|
+
IndexType *new_cp; /* new column pointer */
|
|
690
|
+
IndexType col_length; /* length of pruned column */
|
|
691
|
+
IndexType score; /* current column score */
|
|
692
|
+
IndexType n_col2; /* number of non-dense, non-empty columns */
|
|
693
|
+
IndexType n_row2; /* number of non-dense, non-empty rows */
|
|
694
|
+
IndexType dense_row_count; /* remove rows with more entries than this */
|
|
695
|
+
IndexType dense_col_count; /* remove cols with more entries than this */
|
|
696
|
+
IndexType min_score; /* smallest column score */
|
|
697
|
+
IndexType max_deg; /* maximum row degree */
|
|
698
|
+
IndexType next_col; /* Used to add to degree list.*/
|
|
751
699
|
|
|
752
700
|
/* === Extract knobs ==================================================== */
|
|
753
701
|
|
|
754
|
-
dense_row_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs
|
|
755
|
-
dense_col_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs
|
|
756
|
-
COLAMD_DEBUG1
|
|
757
|
-
max_deg = 0
|
|
758
|
-
n_col2 = n_col
|
|
759
|
-
n_row2 = n_row
|
|
702
|
+
dense_row_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs[Colamd::DenseRow] * n_col), n_col));
|
|
703
|
+
dense_col_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs[Colamd::DenseCol] * n_row), n_row));
|
|
704
|
+
COLAMD_DEBUG1(("colamd: densecount: %d %d\n", dense_row_count, dense_col_count));
|
|
705
|
+
max_deg = 0;
|
|
706
|
+
n_col2 = n_col;
|
|
707
|
+
n_row2 = n_row;
|
|
760
708
|
|
|
761
709
|
/* === Kill empty columns =============================================== */
|
|
762
710
|
|
|
763
711
|
/* Put the empty columns at the end in their natural order, so that LU */
|
|
764
712
|
/* factorization can proceed as far as possible. */
|
|
765
|
-
for (c = n_col-1
|
|
766
|
-
|
|
767
|
-
deg
|
|
768
|
-
if (deg == 0)
|
|
769
|
-
{
|
|
713
|
+
for (c = n_col - 1; c >= 0; c--) {
|
|
714
|
+
deg = Col[c].length;
|
|
715
|
+
if (deg == 0) {
|
|
770
716
|
/* this is a empty column, kill and order it last */
|
|
771
|
-
Col
|
|
772
|
-
Col[c].kill_principal()
|
|
717
|
+
Col[c].shared2.order = --n_col2;
|
|
718
|
+
Col[c].kill_principal();
|
|
773
719
|
}
|
|
774
720
|
}
|
|
775
|
-
COLAMD_DEBUG1
|
|
721
|
+
COLAMD_DEBUG1(("colamd: null columns killed: %d\n", n_col - n_col2));
|
|
776
722
|
|
|
777
723
|
/* === Kill dense columns =============================================== */
|
|
778
724
|
|
|
779
725
|
/* Put the dense columns at the end, in their natural order */
|
|
780
|
-
for (c = n_col-1
|
|
781
|
-
{
|
|
726
|
+
for (c = n_col - 1; c >= 0; c--) {
|
|
782
727
|
/* skip any dead columns */
|
|
783
|
-
if (Col[c].is_dead())
|
|
784
|
-
|
|
785
|
-
continue ;
|
|
728
|
+
if (Col[c].is_dead()) {
|
|
729
|
+
continue;
|
|
786
730
|
}
|
|
787
|
-
deg = Col
|
|
788
|
-
if (deg > dense_col_count)
|
|
789
|
-
{
|
|
731
|
+
deg = Col[c].length;
|
|
732
|
+
if (deg > dense_col_count) {
|
|
790
733
|
/* this is a dense column, kill and order it last */
|
|
791
|
-
Col
|
|
734
|
+
Col[c].shared2.order = --n_col2;
|
|
792
735
|
/* decrement the row degrees */
|
|
793
|
-
cp = &A
|
|
794
|
-
cp_end = cp + Col
|
|
795
|
-
while (cp < cp_end)
|
|
796
|
-
|
|
797
|
-
Row [*cp++].shared1.degree-- ;
|
|
736
|
+
cp = &A[Col[c].start];
|
|
737
|
+
cp_end = cp + Col[c].length;
|
|
738
|
+
while (cp < cp_end) {
|
|
739
|
+
Row[*cp++].shared1.degree--;
|
|
798
740
|
}
|
|
799
|
-
Col[c].kill_principal()
|
|
741
|
+
Col[c].kill_principal();
|
|
800
742
|
}
|
|
801
743
|
}
|
|
802
|
-
COLAMD_DEBUG1
|
|
744
|
+
COLAMD_DEBUG1(("colamd: Dense and null columns killed: %d\n", n_col - n_col2));
|
|
803
745
|
|
|
804
746
|
/* === Kill dense and empty rows ======================================== */
|
|
805
747
|
|
|
806
|
-
for (r = 0
|
|
807
|
-
|
|
808
|
-
deg
|
|
809
|
-
|
|
810
|
-
if (deg > dense_row_count || deg == 0)
|
|
811
|
-
{
|
|
748
|
+
for (r = 0; r < n_row; r++) {
|
|
749
|
+
deg = Row[r].shared1.degree;
|
|
750
|
+
COLAMD_ASSERT(deg >= 0 && deg <= n_col);
|
|
751
|
+
if (deg > dense_row_count || deg == 0) {
|
|
812
752
|
/* kill a dense or empty row */
|
|
813
|
-
Row[r].kill()
|
|
814
|
-
--n_row2
|
|
815
|
-
}
|
|
816
|
-
else
|
|
817
|
-
{
|
|
753
|
+
Row[r].kill();
|
|
754
|
+
--n_row2;
|
|
755
|
+
} else {
|
|
818
756
|
/* keep track of max degree of remaining rows */
|
|
819
|
-
max_deg = numext::maxi(max_deg, deg)
|
|
757
|
+
max_deg = numext::maxi(max_deg, deg);
|
|
820
758
|
}
|
|
821
759
|
}
|
|
822
|
-
COLAMD_DEBUG1
|
|
760
|
+
COLAMD_DEBUG1(("colamd: Dense and null rows killed: %d\n", n_row - n_row2));
|
|
823
761
|
|
|
824
762
|
/* === Compute initial column scores ==================================== */
|
|
825
763
|
|
|
@@ -829,54 +767,46 @@ static void init_scoring
|
|
|
829
767
|
/* pruned in the code below. */
|
|
830
768
|
|
|
831
769
|
/* now find the initial matlab score for each column */
|
|
832
|
-
for (c = n_col-1
|
|
833
|
-
{
|
|
770
|
+
for (c = n_col - 1; c >= 0; c--) {
|
|
834
771
|
/* skip dead column */
|
|
835
|
-
if (Col[c].is_dead())
|
|
836
|
-
|
|
837
|
-
continue ;
|
|
772
|
+
if (Col[c].is_dead()) {
|
|
773
|
+
continue;
|
|
838
774
|
}
|
|
839
|
-
score = 0
|
|
840
|
-
cp = &A
|
|
841
|
-
new_cp = cp
|
|
842
|
-
cp_end = cp + Col
|
|
843
|
-
while (cp < cp_end)
|
|
844
|
-
{
|
|
775
|
+
score = 0;
|
|
776
|
+
cp = &A[Col[c].start];
|
|
777
|
+
new_cp = cp;
|
|
778
|
+
cp_end = cp + Col[c].length;
|
|
779
|
+
while (cp < cp_end) {
|
|
845
780
|
/* get a row */
|
|
846
|
-
row = *cp
|
|
781
|
+
row = *cp++;
|
|
847
782
|
/* skip if dead */
|
|
848
|
-
if (Row[row].is_dead())
|
|
849
|
-
|
|
850
|
-
continue ;
|
|
783
|
+
if (Row[row].is_dead()) {
|
|
784
|
+
continue;
|
|
851
785
|
}
|
|
852
786
|
/* compact the column */
|
|
853
|
-
*new_cp++ = row
|
|
787
|
+
*new_cp++ = row;
|
|
854
788
|
/* add row's external degree */
|
|
855
|
-
score += Row
|
|
789
|
+
score += Row[row].shared1.degree - 1;
|
|
856
790
|
/* guard against integer overflow */
|
|
857
|
-
score = numext::mini(score, n_col)
|
|
791
|
+
score = numext::mini(score, n_col);
|
|
858
792
|
}
|
|
859
793
|
/* determine pruned column length */
|
|
860
|
-
col_length = (IndexType)
|
|
861
|
-
if (col_length == 0)
|
|
862
|
-
{
|
|
794
|
+
col_length = (IndexType)(new_cp - &A[Col[c].start]);
|
|
795
|
+
if (col_length == 0) {
|
|
863
796
|
/* a newly-made null column (all rows in this col are "dense" */
|
|
864
797
|
/* and have already been killed) */
|
|
865
|
-
COLAMD_DEBUG2
|
|
866
|
-
Col
|
|
867
|
-
Col[c].kill_principal()
|
|
868
|
-
}
|
|
869
|
-
else
|
|
870
|
-
{
|
|
798
|
+
COLAMD_DEBUG2(("Newly null killed: %d\n", c));
|
|
799
|
+
Col[c].shared2.order = --n_col2;
|
|
800
|
+
Col[c].kill_principal();
|
|
801
|
+
} else {
|
|
871
802
|
/* set column length and set score */
|
|
872
|
-
COLAMD_ASSERT
|
|
873
|
-
COLAMD_ASSERT
|
|
874
|
-
Col
|
|
875
|
-
Col
|
|
803
|
+
COLAMD_ASSERT(score >= 0);
|
|
804
|
+
COLAMD_ASSERT(score <= n_col);
|
|
805
|
+
Col[c].length = col_length;
|
|
806
|
+
Col[c].shared2.score = score;
|
|
876
807
|
}
|
|
877
808
|
}
|
|
878
|
-
COLAMD_DEBUG1
|
|
879
|
-
n_col-n_col2)) ;
|
|
809
|
+
COLAMD_DEBUG1(("colamd: Dense, null, and newly-null columns killed: %d\n", n_col - n_col2));
|
|
880
810
|
|
|
881
811
|
/* At this point, all empty rows and columns are dead. All live columns */
|
|
882
812
|
/* are "clean" (containing no dead rows) and simplicial (no supercolumns */
|
|
@@ -885,62 +815,52 @@ static void init_scoring
|
|
|
885
815
|
|
|
886
816
|
/* === Initialize degree lists ========================================== */
|
|
887
817
|
|
|
888
|
-
|
|
889
818
|
/* clear the hash buckets */
|
|
890
|
-
for (c = 0
|
|
891
|
-
|
|
892
|
-
head [c] = Empty ;
|
|
819
|
+
for (c = 0; c <= n_col; c++) {
|
|
820
|
+
head[c] = Empty;
|
|
893
821
|
}
|
|
894
|
-
min_score = n_col
|
|
822
|
+
min_score = n_col;
|
|
895
823
|
/* place in reverse order, so low column indices are at the front */
|
|
896
824
|
/* of the lists. This is to encourage natural tie-breaking */
|
|
897
|
-
for (c = n_col-1
|
|
898
|
-
{
|
|
825
|
+
for (c = n_col - 1; c >= 0; c--) {
|
|
899
826
|
/* only add principal columns to degree lists */
|
|
900
|
-
if (Col[c].is_alive())
|
|
901
|
-
|
|
902
|
-
COLAMD_DEBUG4 (("place %d score %d minscore %d ncol %d\n",
|
|
903
|
-
c, Col [c].shared2.score, min_score, n_col)) ;
|
|
827
|
+
if (Col[c].is_alive()) {
|
|
828
|
+
COLAMD_DEBUG4(("place %d score %d minscore %d ncol %d\n", c, Col[c].shared2.score, min_score, n_col));
|
|
904
829
|
|
|
905
830
|
/* === Add columns score to DList =============================== */
|
|
906
831
|
|
|
907
|
-
score = Col
|
|
832
|
+
score = Col[c].shared2.score;
|
|
908
833
|
|
|
909
|
-
COLAMD_ASSERT
|
|
910
|
-
COLAMD_ASSERT
|
|
911
|
-
COLAMD_ASSERT
|
|
912
|
-
COLAMD_ASSERT
|
|
913
|
-
COLAMD_ASSERT
|
|
834
|
+
COLAMD_ASSERT(min_score >= 0);
|
|
835
|
+
COLAMD_ASSERT(min_score <= n_col);
|
|
836
|
+
COLAMD_ASSERT(score >= 0);
|
|
837
|
+
COLAMD_ASSERT(score <= n_col);
|
|
838
|
+
COLAMD_ASSERT(head[score] >= Empty);
|
|
914
839
|
|
|
915
840
|
/* now add this column to dList at proper score location */
|
|
916
|
-
next_col = head
|
|
917
|
-
Col
|
|
918
|
-
Col
|
|
841
|
+
next_col = head[score];
|
|
842
|
+
Col[c].shared3.prev = Empty;
|
|
843
|
+
Col[c].shared4.degree_next = next_col;
|
|
919
844
|
|
|
920
845
|
/* if there already was a column with the same score, set its */
|
|
921
846
|
/* previous pointer to this new column */
|
|
922
|
-
if (next_col != Empty)
|
|
923
|
-
|
|
924
|
-
Col [next_col].shared3.prev = c ;
|
|
847
|
+
if (next_col != Empty) {
|
|
848
|
+
Col[next_col].shared3.prev = c;
|
|
925
849
|
}
|
|
926
|
-
head
|
|
850
|
+
head[score] = c;
|
|
927
851
|
|
|
928
852
|
/* see if this score is less than current min */
|
|
929
|
-
min_score = numext::mini(min_score, score)
|
|
930
|
-
|
|
931
|
-
|
|
853
|
+
min_score = numext::mini(min_score, score);
|
|
932
854
|
}
|
|
933
855
|
}
|
|
934
856
|
|
|
935
|
-
|
|
936
857
|
/* === Return number of remaining columns, and max row degree =========== */
|
|
937
858
|
|
|
938
|
-
*p_n_col2 = n_col2
|
|
939
|
-
*p_n_row2 = n_row2
|
|
940
|
-
*p_max_deg = max_deg
|
|
859
|
+
*p_n_col2 = n_col2;
|
|
860
|
+
*p_n_row2 = n_row2;
|
|
861
|
+
*p_max_deg = max_deg;
|
|
941
862
|
}
|
|
942
863
|
|
|
943
|
-
|
|
944
864
|
/* ========================================================================== */
|
|
945
865
|
/* === find_ordering ======================================================== */
|
|
946
866
|
/* ========================================================================== */
|
|
@@ -952,197 +872,180 @@ static void init_scoring
|
|
|
952
872
|
*/
|
|
953
873
|
template <typename IndexType>
|
|
954
874
|
static IndexType find_ordering /* return the number of garbage collections */
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
)
|
|
969
|
-
{
|
|
875
|
+
(
|
|
876
|
+
/* === Parameters ======================================================= */
|
|
877
|
+
|
|
878
|
+
IndexType n_row, /* number of rows of A */
|
|
879
|
+
IndexType n_col, /* number of columns of A */
|
|
880
|
+
IndexType Alen, /* size of A, 2*nnz + n_col or larger */
|
|
881
|
+
RowStructure<IndexType> Row[], /* of size n_row+1 */
|
|
882
|
+
ColStructure<IndexType> Col[], /* of size n_col+1 */
|
|
883
|
+
IndexType A[], /* column form and row form of A */
|
|
884
|
+
IndexType head[], /* of size n_col+1 */
|
|
885
|
+
IndexType n_col2, /* Remaining columns to order */
|
|
886
|
+
IndexType max_deg, /* Maximum row degree */
|
|
887
|
+
IndexType pfree /* index of first free slot (2*nnz on entry) */
|
|
888
|
+
) {
|
|
970
889
|
/* === Local variables ================================================== */
|
|
971
890
|
|
|
972
|
-
IndexType k
|
|
973
|
-
IndexType pivot_col
|
|
974
|
-
IndexType *cp
|
|
975
|
-
IndexType *rp
|
|
976
|
-
IndexType pivot_row
|
|
977
|
-
IndexType *new_cp
|
|
978
|
-
IndexType *new_rp
|
|
979
|
-
IndexType pivot_row_start
|
|
980
|
-
IndexType pivot_row_degree
|
|
981
|
-
IndexType pivot_row_length
|
|
982
|
-
IndexType pivot_col_score
|
|
983
|
-
IndexType needed_memory
|
|
984
|
-
IndexType *cp_end
|
|
985
|
-
IndexType *rp_end
|
|
986
|
-
IndexType row
|
|
987
|
-
IndexType col
|
|
988
|
-
IndexType max_score
|
|
989
|
-
IndexType cur_score
|
|
990
|
-
unsigned int hash
|
|
991
|
-
IndexType head_column
|
|
992
|
-
IndexType first_col
|
|
993
|
-
IndexType tag_mark
|
|
994
|
-
IndexType row_mark
|
|
995
|
-
IndexType set_difference
|
|
996
|
-
IndexType min_score
|
|
997
|
-
IndexType col_thickness
|
|
998
|
-
IndexType max_mark
|
|
999
|
-
IndexType pivot_col_thickness
|
|
1000
|
-
IndexType prev_col
|
|
1001
|
-
IndexType next_col
|
|
1002
|
-
IndexType ngarbage
|
|
1003
|
-
|
|
891
|
+
IndexType k; /* current pivot ordering step */
|
|
892
|
+
IndexType pivot_col; /* current pivot column */
|
|
893
|
+
IndexType *cp; /* a column pointer */
|
|
894
|
+
IndexType *rp; /* a row pointer */
|
|
895
|
+
IndexType pivot_row; /* current pivot row */
|
|
896
|
+
IndexType *new_cp; /* modified column pointer */
|
|
897
|
+
IndexType *new_rp; /* modified row pointer */
|
|
898
|
+
IndexType pivot_row_start; /* pointer to start of pivot row */
|
|
899
|
+
IndexType pivot_row_degree; /* number of columns in pivot row */
|
|
900
|
+
IndexType pivot_row_length; /* number of supercolumns in pivot row */
|
|
901
|
+
IndexType pivot_col_score; /* score of pivot column */
|
|
902
|
+
IndexType needed_memory; /* free space needed for pivot row */
|
|
903
|
+
IndexType *cp_end; /* pointer to the end of a column */
|
|
904
|
+
IndexType *rp_end; /* pointer to the end of a row */
|
|
905
|
+
IndexType row; /* a row index */
|
|
906
|
+
IndexType col; /* a column index */
|
|
907
|
+
IndexType max_score; /* maximum possible score */
|
|
908
|
+
IndexType cur_score; /* score of current column */
|
|
909
|
+
unsigned int hash; /* hash value for supernode detection */
|
|
910
|
+
IndexType head_column; /* head of hash bucket */
|
|
911
|
+
IndexType first_col; /* first column in hash bucket */
|
|
912
|
+
IndexType tag_mark; /* marker value for mark array */
|
|
913
|
+
IndexType row_mark; /* Row [row].shared2.mark */
|
|
914
|
+
IndexType set_difference; /* set difference size of row with pivot row */
|
|
915
|
+
IndexType min_score; /* smallest column score */
|
|
916
|
+
IndexType col_thickness; /* "thickness" (no. of columns in a supercol) */
|
|
917
|
+
IndexType max_mark; /* maximum value of tag_mark */
|
|
918
|
+
IndexType pivot_col_thickness; /* number of columns represented by pivot col */
|
|
919
|
+
IndexType prev_col; /* Used by Dlist operations. */
|
|
920
|
+
IndexType next_col; /* Used by Dlist operations. */
|
|
921
|
+
IndexType ngarbage; /* number of garbage collections performed */
|
|
1004
922
|
|
|
1005
923
|
/* === Initialization and clear mark ==================================== */
|
|
1006
924
|
|
|
1007
|
-
max_mark = INT_MAX - n_col
|
|
1008
|
-
tag_mark = Colamd::clear_mark
|
|
1009
|
-
min_score = 0
|
|
1010
|
-
ngarbage = 0
|
|
1011
|
-
COLAMD_DEBUG1
|
|
925
|
+
max_mark = INT_MAX - n_col; /* INT_MAX defined in <limits.h> */
|
|
926
|
+
tag_mark = Colamd::clear_mark(n_row, Row);
|
|
927
|
+
min_score = 0;
|
|
928
|
+
ngarbage = 0;
|
|
929
|
+
COLAMD_DEBUG1(("colamd: Ordering, n_col2=%d\n", n_col2));
|
|
1012
930
|
|
|
1013
931
|
/* === Order the columns ================================================ */
|
|
1014
932
|
|
|
1015
|
-
for (k = 0
|
|
1016
|
-
{
|
|
1017
|
-
|
|
933
|
+
for (k = 0; k < n_col2; /* 'k' is incremented below */) {
|
|
1018
934
|
/* === Select pivot column, and order it ============================ */
|
|
1019
935
|
|
|
1020
936
|
/* make sure degree list isn't empty */
|
|
1021
|
-
COLAMD_ASSERT
|
|
1022
|
-
COLAMD_ASSERT
|
|
1023
|
-
COLAMD_ASSERT
|
|
937
|
+
COLAMD_ASSERT(min_score >= 0);
|
|
938
|
+
COLAMD_ASSERT(min_score <= n_col);
|
|
939
|
+
COLAMD_ASSERT(head[min_score] >= Empty);
|
|
1024
940
|
|
|
1025
941
|
/* get pivot column from head of minimum degree list */
|
|
1026
|
-
while (min_score < n_col && head
|
|
1027
|
-
|
|
1028
|
-
min_score++ ;
|
|
942
|
+
while (min_score < n_col && head[min_score] == Empty) {
|
|
943
|
+
min_score++;
|
|
1029
944
|
}
|
|
1030
|
-
pivot_col = head
|
|
1031
|
-
COLAMD_ASSERT
|
|
1032
|
-
next_col = Col
|
|
1033
|
-
head
|
|
1034
|
-
if (next_col != Empty)
|
|
1035
|
-
|
|
1036
|
-
Col [next_col].shared3.prev = Empty ;
|
|
945
|
+
pivot_col = head[min_score];
|
|
946
|
+
COLAMD_ASSERT(pivot_col >= 0 && pivot_col <= n_col);
|
|
947
|
+
next_col = Col[pivot_col].shared4.degree_next;
|
|
948
|
+
head[min_score] = next_col;
|
|
949
|
+
if (next_col != Empty) {
|
|
950
|
+
Col[next_col].shared3.prev = Empty;
|
|
1037
951
|
}
|
|
1038
952
|
|
|
1039
|
-
COLAMD_ASSERT
|
|
1040
|
-
COLAMD_DEBUG3
|
|
953
|
+
COLAMD_ASSERT(Col[pivot_col].is_alive());
|
|
954
|
+
COLAMD_DEBUG3(("Pivot col: %d\n", pivot_col));
|
|
1041
955
|
|
|
1042
956
|
/* remember score for defrag check */
|
|
1043
|
-
pivot_col_score = Col
|
|
957
|
+
pivot_col_score = Col[pivot_col].shared2.score;
|
|
1044
958
|
|
|
1045
959
|
/* the pivot column is the kth column in the pivot order */
|
|
1046
|
-
Col
|
|
960
|
+
Col[pivot_col].shared2.order = k;
|
|
1047
961
|
|
|
1048
962
|
/* increment order count by column thickness */
|
|
1049
|
-
pivot_col_thickness = Col
|
|
1050
|
-
k += pivot_col_thickness
|
|
1051
|
-
COLAMD_ASSERT
|
|
963
|
+
pivot_col_thickness = Col[pivot_col].shared1.thickness;
|
|
964
|
+
k += pivot_col_thickness;
|
|
965
|
+
COLAMD_ASSERT(pivot_col_thickness > 0);
|
|
1052
966
|
|
|
1053
967
|
/* === Garbage_collection, if necessary ============================= */
|
|
1054
968
|
|
|
1055
|
-
needed_memory = numext::mini(pivot_col_score, n_col - k)
|
|
1056
|
-
if (pfree + needed_memory >= Alen)
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
ngarbage++ ;
|
|
969
|
+
needed_memory = numext::mini(pivot_col_score, n_col - k);
|
|
970
|
+
if (pfree + needed_memory >= Alen) {
|
|
971
|
+
pfree = Colamd::garbage_collection(n_row, n_col, Row, Col, A, &A[pfree]);
|
|
972
|
+
ngarbage++;
|
|
1060
973
|
/* after garbage collection we will have enough */
|
|
1061
|
-
COLAMD_ASSERT
|
|
974
|
+
COLAMD_ASSERT(pfree + needed_memory < Alen);
|
|
1062
975
|
/* garbage collection has wiped out the Row[].shared2.mark array */
|
|
1063
|
-
tag_mark = Colamd::clear_mark
|
|
1064
|
-
|
|
976
|
+
tag_mark = Colamd::clear_mark(n_row, Row);
|
|
1065
977
|
}
|
|
1066
978
|
|
|
1067
979
|
/* === Compute pivot row pattern ==================================== */
|
|
1068
980
|
|
|
1069
981
|
/* get starting location for this new merged row */
|
|
1070
|
-
pivot_row_start = pfree
|
|
982
|
+
pivot_row_start = pfree;
|
|
1071
983
|
|
|
1072
984
|
/* initialize new row counts to zero */
|
|
1073
|
-
pivot_row_degree = 0
|
|
985
|
+
pivot_row_degree = 0;
|
|
1074
986
|
|
|
1075
987
|
/* tag pivot column as having been visited so it isn't included */
|
|
1076
988
|
/* in merged pivot row */
|
|
1077
|
-
Col
|
|
989
|
+
Col[pivot_col].shared1.thickness = -pivot_col_thickness;
|
|
1078
990
|
|
|
1079
991
|
/* pivot row is the union of all rows in the pivot column pattern */
|
|
1080
|
-
cp = &A
|
|
1081
|
-
cp_end = cp + Col
|
|
1082
|
-
while (cp < cp_end)
|
|
1083
|
-
{
|
|
992
|
+
cp = &A[Col[pivot_col].start];
|
|
993
|
+
cp_end = cp + Col[pivot_col].length;
|
|
994
|
+
while (cp < cp_end) {
|
|
1084
995
|
/* get a row */
|
|
1085
|
-
row = *cp
|
|
1086
|
-
COLAMD_DEBUG4
|
|
996
|
+
row = *cp++;
|
|
997
|
+
COLAMD_DEBUG4(("Pivot col pattern %d %d\n", Row[row].is_alive(), row));
|
|
1087
998
|
/* skip if row is dead */
|
|
1088
|
-
if (Row[row].is_dead())
|
|
1089
|
-
|
|
1090
|
-
continue ;
|
|
999
|
+
if (Row[row].is_dead()) {
|
|
1000
|
+
continue;
|
|
1091
1001
|
}
|
|
1092
|
-
rp = &A
|
|
1093
|
-
rp_end = rp + Row
|
|
1094
|
-
while (rp < rp_end)
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
pivot_row_degree += col_thickness ;
|
|
1108
|
-
}
|
|
1002
|
+
rp = &A[Row[row].start];
|
|
1003
|
+
rp_end = rp + Row[row].length;
|
|
1004
|
+
while (rp < rp_end) {
|
|
1005
|
+
/* get a column */
|
|
1006
|
+
col = *rp++;
|
|
1007
|
+
/* add the column, if alive and untagged */
|
|
1008
|
+
col_thickness = Col[col].shared1.thickness;
|
|
1009
|
+
if (col_thickness > 0 && Col[col].is_alive()) {
|
|
1010
|
+
/* tag column in pivot row */
|
|
1011
|
+
Col[col].shared1.thickness = -col_thickness;
|
|
1012
|
+
COLAMD_ASSERT(pfree < Alen);
|
|
1013
|
+
/* place column in pivot row */
|
|
1014
|
+
A[pfree++] = col;
|
|
1015
|
+
pivot_row_degree += col_thickness;
|
|
1016
|
+
}
|
|
1109
1017
|
}
|
|
1110
1018
|
}
|
|
1111
1019
|
|
|
1112
1020
|
/* clear tag on pivot column */
|
|
1113
|
-
Col
|
|
1114
|
-
max_deg = numext::maxi(max_deg, pivot_row_degree)
|
|
1115
|
-
|
|
1021
|
+
Col[pivot_col].shared1.thickness = pivot_col_thickness;
|
|
1022
|
+
max_deg = numext::maxi(max_deg, pivot_row_degree);
|
|
1116
1023
|
|
|
1117
1024
|
/* === Kill all rows used to construct pivot row ==================== */
|
|
1118
1025
|
|
|
1119
1026
|
/* also kill pivot row, temporarily */
|
|
1120
|
-
cp = &A
|
|
1121
|
-
cp_end = cp + Col
|
|
1122
|
-
while (cp < cp_end)
|
|
1123
|
-
{
|
|
1027
|
+
cp = &A[Col[pivot_col].start];
|
|
1028
|
+
cp_end = cp + Col[pivot_col].length;
|
|
1029
|
+
while (cp < cp_end) {
|
|
1124
1030
|
/* may be killing an already dead row */
|
|
1125
|
-
row = *cp
|
|
1126
|
-
COLAMD_DEBUG3
|
|
1127
|
-
Row[row].kill()
|
|
1031
|
+
row = *cp++;
|
|
1032
|
+
COLAMD_DEBUG3(("Kill row in pivot col: %d\n", row));
|
|
1033
|
+
Row[row].kill();
|
|
1128
1034
|
}
|
|
1129
1035
|
|
|
1130
1036
|
/* === Select a row index to use as the new pivot row =============== */
|
|
1131
1037
|
|
|
1132
|
-
pivot_row_length = pfree - pivot_row_start
|
|
1133
|
-
if (pivot_row_length > 0)
|
|
1134
|
-
{
|
|
1038
|
+
pivot_row_length = pfree - pivot_row_start;
|
|
1039
|
+
if (pivot_row_length > 0) {
|
|
1135
1040
|
/* pick the "pivot" row arbitrarily (first row in col) */
|
|
1136
|
-
pivot_row = A
|
|
1137
|
-
COLAMD_DEBUG3
|
|
1138
|
-
}
|
|
1139
|
-
else
|
|
1140
|
-
{
|
|
1041
|
+
pivot_row = A[Col[pivot_col].start];
|
|
1042
|
+
COLAMD_DEBUG3(("Pivotal row is %d\n", pivot_row));
|
|
1043
|
+
} else {
|
|
1141
1044
|
/* there is no pivot row, since it is of zero length */
|
|
1142
|
-
pivot_row = Empty
|
|
1143
|
-
COLAMD_ASSERT
|
|
1045
|
+
pivot_row = Empty;
|
|
1046
|
+
COLAMD_ASSERT(pivot_row_length == 0);
|
|
1144
1047
|
}
|
|
1145
|
-
COLAMD_ASSERT
|
|
1048
|
+
COLAMD_ASSERT(Col[pivot_col].length > 0 || pivot_row_length == 0);
|
|
1146
1049
|
|
|
1147
1050
|
/* === Approximate degree computation =============================== */
|
|
1148
1051
|
|
|
@@ -1165,180 +1068,159 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|
|
1165
1068
|
|
|
1166
1069
|
/* === Compute set differences ====================================== */
|
|
1167
1070
|
|
|
1168
|
-
COLAMD_DEBUG3
|
|
1071
|
+
COLAMD_DEBUG3(("** Computing set differences phase. **\n"));
|
|
1169
1072
|
|
|
1170
1073
|
/* pivot row is currently dead - it will be revived later. */
|
|
1171
1074
|
|
|
1172
|
-
COLAMD_DEBUG3
|
|
1075
|
+
COLAMD_DEBUG3(("Pivot row: "));
|
|
1173
1076
|
/* for each column in pivot row */
|
|
1174
|
-
rp = &A
|
|
1175
|
-
rp_end = rp + pivot_row_length
|
|
1176
|
-
while (rp < rp_end)
|
|
1177
|
-
|
|
1178
|
-
col
|
|
1179
|
-
|
|
1180
|
-
COLAMD_DEBUG3 (("Col: %d\n", col)) ;
|
|
1077
|
+
rp = &A[pivot_row_start];
|
|
1078
|
+
rp_end = rp + pivot_row_length;
|
|
1079
|
+
while (rp < rp_end) {
|
|
1080
|
+
col = *rp++;
|
|
1081
|
+
COLAMD_ASSERT(Col[col].is_alive() && col != pivot_col);
|
|
1082
|
+
COLAMD_DEBUG3(("Col: %d\n", col));
|
|
1181
1083
|
|
|
1182
1084
|
/* clear tags used to construct pivot row pattern */
|
|
1183
|
-
col_thickness = -Col
|
|
1184
|
-
COLAMD_ASSERT
|
|
1185
|
-
Col
|
|
1085
|
+
col_thickness = -Col[col].shared1.thickness;
|
|
1086
|
+
COLAMD_ASSERT(col_thickness > 0);
|
|
1087
|
+
Col[col].shared1.thickness = col_thickness;
|
|
1186
1088
|
|
|
1187
1089
|
/* === Remove column from degree list =========================== */
|
|
1188
1090
|
|
|
1189
|
-
cur_score = Col
|
|
1190
|
-
prev_col = Col
|
|
1191
|
-
next_col = Col
|
|
1192
|
-
COLAMD_ASSERT
|
|
1193
|
-
COLAMD_ASSERT
|
|
1194
|
-
COLAMD_ASSERT
|
|
1195
|
-
if (prev_col == Empty)
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
else
|
|
1200
|
-
{
|
|
1201
|
-
Col [prev_col].shared4.degree_next = next_col ;
|
|
1091
|
+
cur_score = Col[col].shared2.score;
|
|
1092
|
+
prev_col = Col[col].shared3.prev;
|
|
1093
|
+
next_col = Col[col].shared4.degree_next;
|
|
1094
|
+
COLAMD_ASSERT(cur_score >= 0);
|
|
1095
|
+
COLAMD_ASSERT(cur_score <= n_col);
|
|
1096
|
+
COLAMD_ASSERT(cur_score >= Empty);
|
|
1097
|
+
if (prev_col == Empty) {
|
|
1098
|
+
head[cur_score] = next_col;
|
|
1099
|
+
} else {
|
|
1100
|
+
Col[prev_col].shared4.degree_next = next_col;
|
|
1202
1101
|
}
|
|
1203
|
-
if (next_col != Empty)
|
|
1204
|
-
|
|
1205
|
-
Col [next_col].shared3.prev = prev_col ;
|
|
1102
|
+
if (next_col != Empty) {
|
|
1103
|
+
Col[next_col].shared3.prev = prev_col;
|
|
1206
1104
|
}
|
|
1207
1105
|
|
|
1208
1106
|
/* === Scan the column ========================================== */
|
|
1209
1107
|
|
|
1210
|
-
cp = &A
|
|
1211
|
-
cp_end = cp + Col
|
|
1212
|
-
while (cp < cp_end)
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
}
|
|
1239
|
-
else
|
|
1240
|
-
{
|
|
1241
|
-
/* save the new mark */
|
|
1242
|
-
Row [row].shared2.mark = set_difference + tag_mark ;
|
|
1243
|
-
}
|
|
1108
|
+
cp = &A[Col[col].start];
|
|
1109
|
+
cp_end = cp + Col[col].length;
|
|
1110
|
+
while (cp < cp_end) {
|
|
1111
|
+
/* get a row */
|
|
1112
|
+
row = *cp++;
|
|
1113
|
+
/* skip if dead */
|
|
1114
|
+
if (Row[row].is_dead()) {
|
|
1115
|
+
continue;
|
|
1116
|
+
}
|
|
1117
|
+
row_mark = Row[row].shared2.mark;
|
|
1118
|
+
COLAMD_ASSERT(row != pivot_row);
|
|
1119
|
+
set_difference = row_mark - tag_mark;
|
|
1120
|
+
/* check if the row has been seen yet */
|
|
1121
|
+
if (set_difference < 0) {
|
|
1122
|
+
COLAMD_ASSERT(Row[row].shared1.degree <= max_deg);
|
|
1123
|
+
set_difference = Row[row].shared1.degree;
|
|
1124
|
+
}
|
|
1125
|
+
/* subtract column thickness from this row's set difference */
|
|
1126
|
+
set_difference -= col_thickness;
|
|
1127
|
+
COLAMD_ASSERT(set_difference >= 0);
|
|
1128
|
+
/* absorb this row if the set difference becomes zero */
|
|
1129
|
+
if (set_difference == 0) {
|
|
1130
|
+
COLAMD_DEBUG3(("aggressive absorption. Row: %d\n", row));
|
|
1131
|
+
Row[row].kill();
|
|
1132
|
+
} else {
|
|
1133
|
+
/* save the new mark */
|
|
1134
|
+
Row[row].shared2.mark = set_difference + tag_mark;
|
|
1135
|
+
}
|
|
1244
1136
|
}
|
|
1245
1137
|
}
|
|
1246
1138
|
|
|
1247
|
-
|
|
1248
1139
|
/* === Add up set differences for each column ======================= */
|
|
1249
1140
|
|
|
1250
|
-
COLAMD_DEBUG3
|
|
1141
|
+
COLAMD_DEBUG3(("** Adding set differences phase. **\n"));
|
|
1251
1142
|
|
|
1252
1143
|
/* for each column in pivot row */
|
|
1253
|
-
rp = &A
|
|
1254
|
-
rp_end = rp + pivot_row_length
|
|
1255
|
-
while (rp < rp_end)
|
|
1256
|
-
{
|
|
1144
|
+
rp = &A[pivot_row_start];
|
|
1145
|
+
rp_end = rp + pivot_row_length;
|
|
1146
|
+
while (rp < rp_end) {
|
|
1257
1147
|
/* get a column */
|
|
1258
|
-
col = *rp
|
|
1259
|
-
COLAMD_ASSERT
|
|
1260
|
-
hash = 0
|
|
1261
|
-
cur_score = 0
|
|
1262
|
-
cp = &A
|
|
1148
|
+
col = *rp++;
|
|
1149
|
+
COLAMD_ASSERT(Col[col].is_alive() && col != pivot_col);
|
|
1150
|
+
hash = 0;
|
|
1151
|
+
cur_score = 0;
|
|
1152
|
+
cp = &A[Col[col].start];
|
|
1263
1153
|
/* compact the column */
|
|
1264
|
-
new_cp = cp
|
|
1265
|
-
cp_end = cp + Col
|
|
1266
|
-
|
|
1267
|
-
COLAMD_DEBUG4
|
|
1268
|
-
|
|
1269
|
-
while (cp < cp_end)
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
/* integer overflow... */
|
|
1288
|
-
cur_score = numext::mini(cur_score, n_col) ;
|
|
1154
|
+
new_cp = cp;
|
|
1155
|
+
cp_end = cp + Col[col].length;
|
|
1156
|
+
|
|
1157
|
+
COLAMD_DEBUG4(("Adding set diffs for Col: %d.\n", col));
|
|
1158
|
+
|
|
1159
|
+
while (cp < cp_end) {
|
|
1160
|
+
/* get a row */
|
|
1161
|
+
row = *cp++;
|
|
1162
|
+
COLAMD_ASSERT(row >= 0 && row < n_row);
|
|
1163
|
+
/* skip if dead */
|
|
1164
|
+
if (Row[row].is_dead()) {
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
row_mark = Row[row].shared2.mark;
|
|
1168
|
+
COLAMD_ASSERT(row_mark > tag_mark);
|
|
1169
|
+
/* compact the column */
|
|
1170
|
+
*new_cp++ = row;
|
|
1171
|
+
/* compute hash function */
|
|
1172
|
+
hash += row;
|
|
1173
|
+
/* add set difference */
|
|
1174
|
+
cur_score += row_mark - tag_mark;
|
|
1175
|
+
/* integer overflow... */
|
|
1176
|
+
cur_score = numext::mini(cur_score, n_col);
|
|
1289
1177
|
}
|
|
1290
1178
|
|
|
1291
1179
|
/* recompute the column's length */
|
|
1292
|
-
Col
|
|
1180
|
+
Col[col].length = (IndexType)(new_cp - &A[Col[col].start]);
|
|
1293
1181
|
|
|
1294
1182
|
/* === Further mass elimination ================================= */
|
|
1295
1183
|
|
|
1296
|
-
if (Col
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
Col [col].shared4.hash_next = first_col ;
|
|
1338
|
-
|
|
1339
|
-
/* save hash function in Col [col].shared3.hash */
|
|
1340
|
-
Col [col].shared3.hash = (IndexType) hash ;
|
|
1341
|
-
COLAMD_ASSERT (Col[col].is_alive()) ;
|
|
1184
|
+
if (Col[col].length == 0) {
|
|
1185
|
+
COLAMD_DEBUG4(("further mass elimination. Col: %d\n", col));
|
|
1186
|
+
/* nothing left but the pivot row in this column */
|
|
1187
|
+
Col[col].kill_principal();
|
|
1188
|
+
pivot_row_degree -= Col[col].shared1.thickness;
|
|
1189
|
+
COLAMD_ASSERT(pivot_row_degree >= 0);
|
|
1190
|
+
/* order it */
|
|
1191
|
+
Col[col].shared2.order = k;
|
|
1192
|
+
/* increment order count by column thickness */
|
|
1193
|
+
k += Col[col].shared1.thickness;
|
|
1194
|
+
} else {
|
|
1195
|
+
/* === Prepare for supercolumn detection ==================== */
|
|
1196
|
+
|
|
1197
|
+
COLAMD_DEBUG4(("Preparing supercol detection for Col: %d.\n", col));
|
|
1198
|
+
|
|
1199
|
+
/* save score so far */
|
|
1200
|
+
Col[col].shared2.score = cur_score;
|
|
1201
|
+
|
|
1202
|
+
/* add column to hash table, for supercolumn detection */
|
|
1203
|
+
hash %= n_col + 1;
|
|
1204
|
+
|
|
1205
|
+
COLAMD_DEBUG4((" Hash = %d, n_col = %d.\n", hash, n_col));
|
|
1206
|
+
COLAMD_ASSERT(hash <= n_col);
|
|
1207
|
+
|
|
1208
|
+
head_column = head[hash];
|
|
1209
|
+
if (head_column > Empty) {
|
|
1210
|
+
/* degree list "hash" is non-empty, use prev (shared3) of */
|
|
1211
|
+
/* first column in degree list as head of hash bucket */
|
|
1212
|
+
first_col = Col[head_column].shared3.headhash;
|
|
1213
|
+
Col[head_column].shared3.headhash = col;
|
|
1214
|
+
} else {
|
|
1215
|
+
/* degree list "hash" is empty, use head as hash bucket */
|
|
1216
|
+
first_col = -(head_column + 2);
|
|
1217
|
+
head[hash] = -(col + 2);
|
|
1218
|
+
}
|
|
1219
|
+
Col[col].shared4.hash_next = first_col;
|
|
1220
|
+
|
|
1221
|
+
/* save hash function in Col [col].shared3.hash */
|
|
1222
|
+
Col[col].shared3.hash = (IndexType)hash;
|
|
1223
|
+
COLAMD_ASSERT(Col[col].is_alive());
|
|
1342
1224
|
}
|
|
1343
1225
|
}
|
|
1344
1226
|
|
|
@@ -1346,105 +1228,98 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|
|
1346
1228
|
|
|
1347
1229
|
/* === Supercolumn detection ======================================== */
|
|
1348
1230
|
|
|
1349
|
-
COLAMD_DEBUG3
|
|
1231
|
+
COLAMD_DEBUG3(("** Supercolumn detection phase. **\n"));
|
|
1350
1232
|
|
|
1351
|
-
Colamd::detect_super_cols
|
|
1233
|
+
Colamd::detect_super_cols(Col, A, head, pivot_row_start, pivot_row_length);
|
|
1352
1234
|
|
|
1353
1235
|
/* === Kill the pivotal column ====================================== */
|
|
1354
1236
|
|
|
1355
|
-
Col[pivot_col].kill_principal()
|
|
1237
|
+
Col[pivot_col].kill_principal();
|
|
1356
1238
|
|
|
1357
1239
|
/* === Clear mark =================================================== */
|
|
1358
1240
|
|
|
1359
|
-
tag_mark += (max_deg + 1)
|
|
1360
|
-
if (tag_mark >= max_mark)
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
tag_mark = Colamd::clear_mark (n_row, Row) ;
|
|
1241
|
+
tag_mark += (max_deg + 1);
|
|
1242
|
+
if (tag_mark >= max_mark) {
|
|
1243
|
+
COLAMD_DEBUG2(("clearing tag_mark\n"));
|
|
1244
|
+
tag_mark = Colamd::clear_mark(n_row, Row);
|
|
1364
1245
|
}
|
|
1365
1246
|
|
|
1366
1247
|
/* === Finalize the new pivot row, and column scores ================ */
|
|
1367
1248
|
|
|
1368
|
-
COLAMD_DEBUG3
|
|
1249
|
+
COLAMD_DEBUG3(("** Finalize scores phase. **\n"));
|
|
1369
1250
|
|
|
1370
1251
|
/* for each column in pivot row */
|
|
1371
|
-
rp = &A
|
|
1252
|
+
rp = &A[pivot_row_start];
|
|
1372
1253
|
/* compact the pivot row */
|
|
1373
|
-
new_rp = rp
|
|
1374
|
-
rp_end = rp + pivot_row_length
|
|
1375
|
-
while (rp < rp_end)
|
|
1376
|
-
|
|
1377
|
-
col = *rp++ ;
|
|
1254
|
+
new_rp = rp;
|
|
1255
|
+
rp_end = rp + pivot_row_length;
|
|
1256
|
+
while (rp < rp_end) {
|
|
1257
|
+
col = *rp++;
|
|
1378
1258
|
/* skip dead columns */
|
|
1379
|
-
if (Col[col].is_dead())
|
|
1380
|
-
|
|
1381
|
-
continue ;
|
|
1259
|
+
if (Col[col].is_dead()) {
|
|
1260
|
+
continue;
|
|
1382
1261
|
}
|
|
1383
|
-
*new_rp++ = col
|
|
1262
|
+
*new_rp++ = col;
|
|
1384
1263
|
/* add new pivot row to column */
|
|
1385
|
-
A
|
|
1264
|
+
A[Col[col].start + (Col[col].length++)] = pivot_row;
|
|
1386
1265
|
|
|
1387
1266
|
/* retrieve score so far and add on pivot row's degree. */
|
|
1388
1267
|
/* (we wait until here for this in case the pivot */
|
|
1389
1268
|
/* row's degree was reduced due to mass elimination). */
|
|
1390
|
-
cur_score = Col
|
|
1269
|
+
cur_score = Col[col].shared2.score + pivot_row_degree;
|
|
1391
1270
|
|
|
1392
1271
|
/* calculate the max possible score as the number of */
|
|
1393
1272
|
/* external columns minus the 'k' value minus the */
|
|
1394
1273
|
/* columns thickness */
|
|
1395
|
-
max_score = n_col - k - Col
|
|
1274
|
+
max_score = n_col - k - Col[col].shared1.thickness;
|
|
1396
1275
|
|
|
1397
1276
|
/* make the score the external degree of the union-of-rows */
|
|
1398
|
-
cur_score -= Col
|
|
1277
|
+
cur_score -= Col[col].shared1.thickness;
|
|
1399
1278
|
|
|
1400
1279
|
/* make sure score is less or equal than the max score */
|
|
1401
|
-
cur_score = numext::mini(cur_score, max_score)
|
|
1402
|
-
COLAMD_ASSERT
|
|
1280
|
+
cur_score = numext::mini(cur_score, max_score);
|
|
1281
|
+
COLAMD_ASSERT(cur_score >= 0);
|
|
1403
1282
|
|
|
1404
1283
|
/* store updated score */
|
|
1405
|
-
Col
|
|
1284
|
+
Col[col].shared2.score = cur_score;
|
|
1406
1285
|
|
|
1407
1286
|
/* === Place column back in degree list ========================= */
|
|
1408
1287
|
|
|
1409
|
-
COLAMD_ASSERT
|
|
1410
|
-
COLAMD_ASSERT
|
|
1411
|
-
COLAMD_ASSERT
|
|
1412
|
-
COLAMD_ASSERT
|
|
1413
|
-
COLAMD_ASSERT
|
|
1414
|
-
next_col = head
|
|
1415
|
-
Col
|
|
1416
|
-
Col
|
|
1417
|
-
if (next_col != Empty)
|
|
1418
|
-
|
|
1419
|
-
Col [next_col].shared3.prev = col ;
|
|
1288
|
+
COLAMD_ASSERT(min_score >= 0);
|
|
1289
|
+
COLAMD_ASSERT(min_score <= n_col);
|
|
1290
|
+
COLAMD_ASSERT(cur_score >= 0);
|
|
1291
|
+
COLAMD_ASSERT(cur_score <= n_col);
|
|
1292
|
+
COLAMD_ASSERT(head[cur_score] >= Empty);
|
|
1293
|
+
next_col = head[cur_score];
|
|
1294
|
+
Col[col].shared4.degree_next = next_col;
|
|
1295
|
+
Col[col].shared3.prev = Empty;
|
|
1296
|
+
if (next_col != Empty) {
|
|
1297
|
+
Col[next_col].shared3.prev = col;
|
|
1420
1298
|
}
|
|
1421
|
-
head
|
|
1299
|
+
head[cur_score] = col;
|
|
1422
1300
|
|
|
1423
1301
|
/* see if this score is less than current min */
|
|
1424
|
-
min_score = numext::mini(min_score, cur_score)
|
|
1425
|
-
|
|
1302
|
+
min_score = numext::mini(min_score, cur_score);
|
|
1426
1303
|
}
|
|
1427
1304
|
|
|
1428
1305
|
/* === Resurrect the new pivot row ================================== */
|
|
1429
1306
|
|
|
1430
|
-
if (pivot_row_degree > 0)
|
|
1431
|
-
{
|
|
1307
|
+
if (pivot_row_degree > 0) {
|
|
1432
1308
|
/* update pivot row length to reflect any cols that were killed */
|
|
1433
1309
|
/* during super-col detection and mass elimination */
|
|
1434
|
-
Row
|
|
1435
|
-
Row
|
|
1436
|
-
Row
|
|
1437
|
-
Row
|
|
1310
|
+
Row[pivot_row].start = pivot_row_start;
|
|
1311
|
+
Row[pivot_row].length = (IndexType)(new_rp - &A[pivot_row_start]);
|
|
1312
|
+
Row[pivot_row].shared1.degree = pivot_row_degree;
|
|
1313
|
+
Row[pivot_row].shared2.mark = 0;
|
|
1438
1314
|
/* pivot row is no longer dead */
|
|
1439
1315
|
}
|
|
1440
1316
|
}
|
|
1441
1317
|
|
|
1442
1318
|
/* === All principal columns have now been ordered ====================== */
|
|
1443
1319
|
|
|
1444
|
-
return (ngarbage)
|
|
1320
|
+
return (ngarbage);
|
|
1445
1321
|
}
|
|
1446
1322
|
|
|
1447
|
-
|
|
1448
1323
|
/* ========================================================================== */
|
|
1449
1324
|
/* === order_children ======================================================= */
|
|
1450
1325
|
/* ========================================================================== */
|
|
@@ -1462,74 +1337,66 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|
|
1462
1337
|
columns. Not user-callable.
|
|
1463
1338
|
*/
|
|
1464
1339
|
template <typename IndexType>
|
|
1465
|
-
static inline
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
)
|
|
1473
|
-
{
|
|
1340
|
+
static inline void order_children(
|
|
1341
|
+
/* === Parameters ======================================================= */
|
|
1342
|
+
|
|
1343
|
+
IndexType n_col, /* number of columns of A */
|
|
1344
|
+
ColStructure<IndexType> Col[], /* of size n_col+1 */
|
|
1345
|
+
IndexType p[] /* p [0 ... n_col-1] is the column permutation*/
|
|
1346
|
+
) {
|
|
1474
1347
|
/* === Local variables ================================================== */
|
|
1475
1348
|
|
|
1476
|
-
IndexType i
|
|
1477
|
-
IndexType c
|
|
1478
|
-
IndexType parent
|
|
1479
|
-
IndexType order
|
|
1349
|
+
IndexType i; /* loop counter for all columns */
|
|
1350
|
+
IndexType c; /* column index */
|
|
1351
|
+
IndexType parent; /* index of column's parent */
|
|
1352
|
+
IndexType order; /* column's order */
|
|
1480
1353
|
|
|
1481
1354
|
/* === Order each non-principal column ================================== */
|
|
1482
1355
|
|
|
1483
|
-
for (i = 0
|
|
1484
|
-
{
|
|
1356
|
+
for (i = 0; i < n_col; i++) {
|
|
1485
1357
|
/* find an un-ordered non-principal column */
|
|
1486
|
-
COLAMD_ASSERT
|
|
1487
|
-
if (!Col[i].is_dead_principal() && Col
|
|
1488
|
-
|
|
1489
|
-
parent = i ;
|
|
1358
|
+
COLAMD_ASSERT(col_is_dead(Col, i));
|
|
1359
|
+
if (!Col[i].is_dead_principal() && Col[i].shared2.order == Empty) {
|
|
1360
|
+
parent = i;
|
|
1490
1361
|
/* once found, find its principal parent */
|
|
1491
|
-
do
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
} while (!Col[parent].is_dead_principal()) ;
|
|
1362
|
+
do {
|
|
1363
|
+
parent = Col[parent].shared1.parent;
|
|
1364
|
+
} while (!Col[parent].is_dead_principal());
|
|
1495
1365
|
|
|
1496
1366
|
/* now, order all un-ordered non-principal columns along path */
|
|
1497
1367
|
/* to this parent. collapse tree at the same time */
|
|
1498
|
-
c = i
|
|
1368
|
+
c = i;
|
|
1499
1369
|
/* get order of parent */
|
|
1500
|
-
order = Col
|
|
1370
|
+
order = Col[parent].shared2.order;
|
|
1501
1371
|
|
|
1502
|
-
do
|
|
1503
|
-
|
|
1504
|
-
COLAMD_ASSERT (Col [c].shared2.order == Empty) ;
|
|
1372
|
+
do {
|
|
1373
|
+
COLAMD_ASSERT(Col[c].shared2.order == Empty);
|
|
1505
1374
|
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1375
|
+
/* order this column */
|
|
1376
|
+
Col[c].shared2.order = order++;
|
|
1377
|
+
/* collapse tree */
|
|
1378
|
+
Col[c].shared1.parent = parent;
|
|
1510
1379
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1380
|
+
/* get immediate parent of this column */
|
|
1381
|
+
c = Col[c].shared1.parent;
|
|
1513
1382
|
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
} while (Col
|
|
1383
|
+
/* continue until we hit an ordered column. There are */
|
|
1384
|
+
/* guaranteed not to be anymore unordered columns */
|
|
1385
|
+
/* above an ordered column */
|
|
1386
|
+
} while (Col[c].shared2.order == Empty);
|
|
1518
1387
|
|
|
1519
1388
|
/* re-order the super_col parent to largest order for this group */
|
|
1520
|
-
Col
|
|
1389
|
+
Col[parent].shared2.order = order;
|
|
1521
1390
|
}
|
|
1522
1391
|
}
|
|
1523
1392
|
|
|
1524
1393
|
/* === Generate the permutation ========================================= */
|
|
1525
1394
|
|
|
1526
|
-
for (c = 0
|
|
1527
|
-
|
|
1528
|
-
p [Col [c].shared2.order] = c ;
|
|
1395
|
+
for (c = 0; c < n_col; c++) {
|
|
1396
|
+
p[Col[c].shared2.order] = c;
|
|
1529
1397
|
}
|
|
1530
1398
|
}
|
|
1531
1399
|
|
|
1532
|
-
|
|
1533
1400
|
/* ========================================================================== */
|
|
1534
1401
|
/* === detect_super_cols ==================================================== */
|
|
1535
1402
|
/* ========================================================================== */
|
|
@@ -1563,144 +1430,124 @@ static inline void order_children
|
|
|
1563
1430
|
Not user-callable.
|
|
1564
1431
|
*/
|
|
1565
1432
|
template <typename IndexType>
|
|
1566
|
-
static void detect_super_cols
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
)
|
|
1576
|
-
{
|
|
1433
|
+
static void detect_super_cols(
|
|
1434
|
+
/* === Parameters ======================================================= */
|
|
1435
|
+
|
|
1436
|
+
ColStructure<IndexType> Col[], /* of size n_col+1 */
|
|
1437
|
+
IndexType A[], /* row indices of A */
|
|
1438
|
+
IndexType head[], /* head of degree lists and hash buckets */
|
|
1439
|
+
IndexType row_start, /* pointer to set of columns to check */
|
|
1440
|
+
IndexType row_length /* number of columns to check */
|
|
1441
|
+
) {
|
|
1577
1442
|
/* === Local variables ================================================== */
|
|
1578
1443
|
|
|
1579
|
-
IndexType hash
|
|
1580
|
-
IndexType *rp
|
|
1581
|
-
IndexType c
|
|
1582
|
-
IndexType super_c
|
|
1583
|
-
IndexType *cp1
|
|
1584
|
-
IndexType *cp2
|
|
1585
|
-
IndexType length
|
|
1586
|
-
IndexType prev_c
|
|
1587
|
-
IndexType i
|
|
1588
|
-
IndexType *rp_end
|
|
1589
|
-
IndexType col
|
|
1590
|
-
IndexType head_column
|
|
1591
|
-
IndexType first_col
|
|
1444
|
+
IndexType hash; /* hash value for a column */
|
|
1445
|
+
IndexType *rp; /* pointer to a row */
|
|
1446
|
+
IndexType c; /* a column index */
|
|
1447
|
+
IndexType super_c; /* column index of the column to absorb into */
|
|
1448
|
+
IndexType *cp1; /* column pointer for column super_c */
|
|
1449
|
+
IndexType *cp2; /* column pointer for column c */
|
|
1450
|
+
IndexType length; /* length of column super_c */
|
|
1451
|
+
IndexType prev_c; /* column preceding c in hash bucket */
|
|
1452
|
+
IndexType i; /* loop counter */
|
|
1453
|
+
IndexType *rp_end; /* pointer to the end of the row */
|
|
1454
|
+
IndexType col; /* a column index in the row to check */
|
|
1455
|
+
IndexType head_column; /* first column in hash bucket or degree list */
|
|
1456
|
+
IndexType first_col; /* first column in hash bucket */
|
|
1592
1457
|
|
|
1593
1458
|
/* === Consider each column in the row ================================== */
|
|
1594
1459
|
|
|
1595
|
-
rp = &A
|
|
1596
|
-
rp_end = rp + row_length
|
|
1597
|
-
while (rp < rp_end)
|
|
1598
|
-
|
|
1599
|
-
col
|
|
1600
|
-
|
|
1601
|
-
{
|
|
1602
|
-
continue ;
|
|
1460
|
+
rp = &A[row_start];
|
|
1461
|
+
rp_end = rp + row_length;
|
|
1462
|
+
while (rp < rp_end) {
|
|
1463
|
+
col = *rp++;
|
|
1464
|
+
if (Col[col].is_dead()) {
|
|
1465
|
+
continue;
|
|
1603
1466
|
}
|
|
1604
1467
|
|
|
1605
1468
|
/* get hash number for this column */
|
|
1606
|
-
hash = Col
|
|
1607
|
-
COLAMD_ASSERT
|
|
1469
|
+
hash = Col[col].shared3.hash;
|
|
1470
|
+
COLAMD_ASSERT(hash <= n_col);
|
|
1608
1471
|
|
|
1609
1472
|
/* === Get the first column in this hash bucket ===================== */
|
|
1610
1473
|
|
|
1611
|
-
head_column = head
|
|
1612
|
-
if (head_column > Empty)
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
else
|
|
1617
|
-
{
|
|
1618
|
-
first_col = - (head_column + 2) ;
|
|
1474
|
+
head_column = head[hash];
|
|
1475
|
+
if (head_column > Empty) {
|
|
1476
|
+
first_col = Col[head_column].shared3.headhash;
|
|
1477
|
+
} else {
|
|
1478
|
+
first_col = -(head_column + 2);
|
|
1619
1479
|
}
|
|
1620
1480
|
|
|
1621
1481
|
/* === Consider each column in the hash bucket ====================== */
|
|
1622
1482
|
|
|
1623
|
-
for (super_c = first_col
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
COLAMD_ASSERT (Col [super_c].shared3.hash == hash) ;
|
|
1628
|
-
length = Col [super_c].length ;
|
|
1483
|
+
for (super_c = first_col; super_c != Empty; super_c = Col[super_c].shared4.hash_next) {
|
|
1484
|
+
COLAMD_ASSERT(Col[super_c].is_alive());
|
|
1485
|
+
COLAMD_ASSERT(Col[super_c].shared3.hash == hash);
|
|
1486
|
+
length = Col[super_c].length;
|
|
1629
1487
|
|
|
1630
1488
|
/* prev_c is the column preceding column c in the hash bucket */
|
|
1631
|
-
prev_c = super_c
|
|
1489
|
+
prev_c = super_c;
|
|
1632
1490
|
|
|
1633
1491
|
/* === Compare super_c with all columns after it ================ */
|
|
1634
1492
|
|
|
1635
|
-
for (c = Col
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
Col [super_c].shared1.thickness += Col [c].shared1.thickness ;
|
|
1679
|
-
Col [c].shared1.parent = super_c ;
|
|
1680
|
-
Col[c].kill_non_principal() ;
|
|
1681
|
-
/* order c later, in order_children() */
|
|
1682
|
-
Col [c].shared2.order = Empty ;
|
|
1683
|
-
/* remove c from hash bucket */
|
|
1684
|
-
Col [prev_c].shared4.hash_next = Col [c].shared4.hash_next ;
|
|
1493
|
+
for (c = Col[super_c].shared4.hash_next; c != Empty; c = Col[c].shared4.hash_next) {
|
|
1494
|
+
COLAMD_ASSERT(c != super_c);
|
|
1495
|
+
COLAMD_ASSERT(Col[c].is_alive());
|
|
1496
|
+
COLAMD_ASSERT(Col[c].shared3.hash == hash);
|
|
1497
|
+
|
|
1498
|
+
/* not identical if lengths or scores are different */
|
|
1499
|
+
if (Col[c].length != length || Col[c].shared2.score != Col[super_c].shared2.score) {
|
|
1500
|
+
prev_c = c;
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/* compare the two columns */
|
|
1505
|
+
cp1 = &A[Col[super_c].start];
|
|
1506
|
+
cp2 = &A[Col[c].start];
|
|
1507
|
+
|
|
1508
|
+
for (i = 0; i < length; i++) {
|
|
1509
|
+
/* the columns are "clean" (no dead rows) */
|
|
1510
|
+
COLAMD_ASSERT(cp1->is_alive());
|
|
1511
|
+
COLAMD_ASSERT(cp2->is_alive());
|
|
1512
|
+
/* row indices will same order for both supercols, */
|
|
1513
|
+
/* no gather scatter necessary */
|
|
1514
|
+
if (*cp1++ != *cp2++) {
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/* the two columns are different if the for-loop "broke" */
|
|
1520
|
+
if (i != length) {
|
|
1521
|
+
prev_c = c;
|
|
1522
|
+
continue;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
/* === Got it! two columns are identical =================== */
|
|
1526
|
+
|
|
1527
|
+
COLAMD_ASSERT(Col[c].shared2.score == Col[super_c].shared2.score);
|
|
1528
|
+
|
|
1529
|
+
Col[super_c].shared1.thickness += Col[c].shared1.thickness;
|
|
1530
|
+
Col[c].shared1.parent = super_c;
|
|
1531
|
+
Col[c].kill_non_principal();
|
|
1532
|
+
/* order c later, in order_children() */
|
|
1533
|
+
Col[c].shared2.order = Empty;
|
|
1534
|
+
/* remove c from hash bucket */
|
|
1535
|
+
Col[prev_c].shared4.hash_next = Col[c].shared4.hash_next;
|
|
1685
1536
|
}
|
|
1686
1537
|
}
|
|
1687
1538
|
|
|
1688
1539
|
/* === Empty this hash bucket ======================================= */
|
|
1689
1540
|
|
|
1690
|
-
if (head_column > Empty)
|
|
1691
|
-
{
|
|
1541
|
+
if (head_column > Empty) {
|
|
1692
1542
|
/* corresponding degree list "hash" is not empty */
|
|
1693
|
-
Col
|
|
1694
|
-
}
|
|
1695
|
-
else
|
|
1696
|
-
{
|
|
1543
|
+
Col[head_column].shared3.headhash = Empty;
|
|
1544
|
+
} else {
|
|
1697
1545
|
/* corresponding degree list "hash" is empty */
|
|
1698
|
-
head
|
|
1546
|
+
head[hash] = Empty;
|
|
1699
1547
|
}
|
|
1700
1548
|
}
|
|
1701
1549
|
}
|
|
1702
1550
|
|
|
1703
|
-
|
|
1704
1551
|
/* ========================================================================== */
|
|
1705
1552
|
/* === garbage_collection =================================================== */
|
|
1706
1553
|
/* ========================================================================== */
|
|
@@ -1714,118 +1561,101 @@ static void detect_super_cols
|
|
|
1714
1561
|
Not user-callable.
|
|
1715
1562
|
*/
|
|
1716
1563
|
template <typename IndexType>
|
|
1717
|
-
static IndexType garbage_collection
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
)
|
|
1728
|
-
{
|
|
1564
|
+
static IndexType garbage_collection /* returns the new value of pfree */
|
|
1565
|
+
(
|
|
1566
|
+
/* === Parameters ======================================================= */
|
|
1567
|
+
|
|
1568
|
+
IndexType n_row, /* number of rows */
|
|
1569
|
+
IndexType n_col, /* number of columns */
|
|
1570
|
+
RowStructure<IndexType> Row[], /* row info */
|
|
1571
|
+
ColStructure<IndexType> Col[], /* column info */
|
|
1572
|
+
IndexType A[], /* A [0 ... Alen-1] holds the matrix */
|
|
1573
|
+
IndexType *pfree /* &A [0] ... pfree is in use */
|
|
1574
|
+
) {
|
|
1729
1575
|
/* === Local variables ================================================== */
|
|
1730
1576
|
|
|
1731
|
-
IndexType *psrc
|
|
1732
|
-
IndexType *pdest
|
|
1733
|
-
IndexType j
|
|
1734
|
-
IndexType r
|
|
1735
|
-
IndexType c
|
|
1736
|
-
IndexType length
|
|
1577
|
+
IndexType *psrc; /* source pointer */
|
|
1578
|
+
IndexType *pdest; /* destination pointer */
|
|
1579
|
+
IndexType j; /* counter */
|
|
1580
|
+
IndexType r; /* a row index */
|
|
1581
|
+
IndexType c; /* a column index */
|
|
1582
|
+
IndexType length; /* length of a row or column */
|
|
1737
1583
|
|
|
1738
1584
|
/* === Defragment the columns =========================================== */
|
|
1739
1585
|
|
|
1740
|
-
pdest = &A[0]
|
|
1741
|
-
for (c = 0
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
{
|
|
1745
|
-
psrc = &A [Col [c].start] ;
|
|
1586
|
+
pdest = &A[0];
|
|
1587
|
+
for (c = 0; c < n_col; c++) {
|
|
1588
|
+
if (Col[c].is_alive()) {
|
|
1589
|
+
psrc = &A[Col[c].start];
|
|
1746
1590
|
|
|
1747
1591
|
/* move and compact the column */
|
|
1748
|
-
COLAMD_ASSERT
|
|
1749
|
-
Col
|
|
1750
|
-
length = Col
|
|
1751
|
-
for (j = 0
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
*pdest++ = r ;
|
|
1757
|
-
}
|
|
1592
|
+
COLAMD_ASSERT(pdest <= psrc);
|
|
1593
|
+
Col[c].start = (IndexType)(pdest - &A[0]);
|
|
1594
|
+
length = Col[c].length;
|
|
1595
|
+
for (j = 0; j < length; j++) {
|
|
1596
|
+
r = *psrc++;
|
|
1597
|
+
if (Row[r].is_alive()) {
|
|
1598
|
+
*pdest++ = r;
|
|
1599
|
+
}
|
|
1758
1600
|
}
|
|
1759
|
-
Col
|
|
1601
|
+
Col[c].length = (IndexType)(pdest - &A[Col[c].start]);
|
|
1760
1602
|
}
|
|
1761
1603
|
}
|
|
1762
1604
|
|
|
1763
1605
|
/* === Prepare to defragment the rows =================================== */
|
|
1764
1606
|
|
|
1765
|
-
for (r = 0
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
{
|
|
1769
|
-
if (Row [r].length == 0)
|
|
1770
|
-
{
|
|
1607
|
+
for (r = 0; r < n_row; r++) {
|
|
1608
|
+
if (Row[r].is_alive()) {
|
|
1609
|
+
if (Row[r].length == 0) {
|
|
1771
1610
|
/* this row is of zero length. cannot compact it, so kill it */
|
|
1772
|
-
COLAMD_DEBUG3
|
|
1773
|
-
Row[r].kill()
|
|
1774
|
-
}
|
|
1775
|
-
else
|
|
1776
|
-
{
|
|
1611
|
+
COLAMD_DEBUG3(("Defrag row kill\n"));
|
|
1612
|
+
Row[r].kill();
|
|
1613
|
+
} else {
|
|
1777
1614
|
/* save first column index in Row [r].shared2.first_column */
|
|
1778
|
-
psrc = &A
|
|
1779
|
-
Row
|
|
1780
|
-
COLAMD_ASSERT
|
|
1615
|
+
psrc = &A[Row[r].start];
|
|
1616
|
+
Row[r].shared2.first_column = *psrc;
|
|
1617
|
+
COLAMD_ASSERT(Row[r].is_alive());
|
|
1781
1618
|
/* flag the start of the row with the one's complement of row */
|
|
1782
|
-
*psrc = ones_complement(r)
|
|
1783
|
-
|
|
1619
|
+
*psrc = ones_complement(r);
|
|
1784
1620
|
}
|
|
1785
1621
|
}
|
|
1786
1622
|
}
|
|
1787
1623
|
|
|
1788
1624
|
/* === Defragment the rows ============================================== */
|
|
1789
1625
|
|
|
1790
|
-
psrc = pdest
|
|
1791
|
-
while (psrc < pfree)
|
|
1792
|
-
{
|
|
1626
|
+
psrc = pdest;
|
|
1627
|
+
while (psrc < pfree) {
|
|
1793
1628
|
/* find a negative number ... the start of a row */
|
|
1794
|
-
if (*psrc++ < 0)
|
|
1795
|
-
|
|
1796
|
-
psrc-- ;
|
|
1629
|
+
if (*psrc++ < 0) {
|
|
1630
|
+
psrc--;
|
|
1797
1631
|
/* get the row index */
|
|
1798
|
-
r = ones_complement(*psrc)
|
|
1799
|
-
COLAMD_ASSERT
|
|
1632
|
+
r = ones_complement(*psrc);
|
|
1633
|
+
COLAMD_ASSERT(r >= 0 && r < n_row);
|
|
1800
1634
|
/* restore first column index */
|
|
1801
|
-
*psrc = Row
|
|
1802
|
-
COLAMD_ASSERT
|
|
1635
|
+
*psrc = Row[r].shared2.first_column;
|
|
1636
|
+
COLAMD_ASSERT(Row[r].is_alive());
|
|
1803
1637
|
|
|
1804
1638
|
/* move and compact the row */
|
|
1805
|
-
COLAMD_ASSERT
|
|
1806
|
-
Row
|
|
1807
|
-
length = Row
|
|
1808
|
-
for (j = 0
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
*pdest++ = c ;
|
|
1814
|
-
}
|
|
1639
|
+
COLAMD_ASSERT(pdest <= psrc);
|
|
1640
|
+
Row[r].start = (IndexType)(pdest - &A[0]);
|
|
1641
|
+
length = Row[r].length;
|
|
1642
|
+
for (j = 0; j < length; j++) {
|
|
1643
|
+
c = *psrc++;
|
|
1644
|
+
if (Col[c].is_alive()) {
|
|
1645
|
+
*pdest++ = c;
|
|
1646
|
+
}
|
|
1815
1647
|
}
|
|
1816
|
-
Row
|
|
1817
|
-
|
|
1648
|
+
Row[r].length = (IndexType)(pdest - &A[Row[r].start]);
|
|
1818
1649
|
}
|
|
1819
1650
|
}
|
|
1820
1651
|
/* ensure we found all the rows */
|
|
1821
|
-
COLAMD_ASSERT
|
|
1652
|
+
COLAMD_ASSERT(debug_rows == 0);
|
|
1822
1653
|
|
|
1823
1654
|
/* === Return the new value of pfree ==================================== */
|
|
1824
1655
|
|
|
1825
|
-
return ((IndexType)
|
|
1656
|
+
return ((IndexType)(pdest - &A[0]));
|
|
1826
1657
|
}
|
|
1827
1658
|
|
|
1828
|
-
|
|
1829
1659
|
/* ========================================================================== */
|
|
1830
1660
|
/* === clear_mark =========================================================== */
|
|
1831
1661
|
/* ========================================================================== */
|
|
@@ -1835,29 +1665,26 @@ static IndexType garbage_collection /* returns the new value of pfree */
|
|
|
1835
1665
|
Return value is the new tag_mark. Not user-callable.
|
|
1836
1666
|
*/
|
|
1837
1667
|
template <typename IndexType>
|
|
1838
|
-
static inline
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
)
|
|
1845
|
-
{
|
|
1668
|
+
static inline IndexType clear_mark /* return the new value for tag_mark */
|
|
1669
|
+
(
|
|
1670
|
+
/* === Parameters ======================================================= */
|
|
1671
|
+
|
|
1672
|
+
IndexType n_row, /* number of rows in A */
|
|
1673
|
+
RowStructure<IndexType> Row[] /* Row [0 ... n_row-1].shared2.mark is set to zero */
|
|
1674
|
+
) {
|
|
1846
1675
|
/* === Local variables ================================================== */
|
|
1847
1676
|
|
|
1848
|
-
IndexType r
|
|
1677
|
+
IndexType r;
|
|
1849
1678
|
|
|
1850
|
-
for (r = 0
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
{
|
|
1854
|
-
Row [r].shared2.mark = 0 ;
|
|
1679
|
+
for (r = 0; r < n_row; r++) {
|
|
1680
|
+
if (Row[r].is_alive()) {
|
|
1681
|
+
Row[r].shared2.mark = 0;
|
|
1855
1682
|
}
|
|
1856
1683
|
}
|
|
1857
|
-
return (1)
|
|
1684
|
+
return (1);
|
|
1858
1685
|
}
|
|
1859
1686
|
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
}
|
|
1687
|
+
} // namespace Colamd
|
|
1688
|
+
} // namespace internal
|
|
1689
|
+
} // namespace Eigen
|
|
1863
1690
|
#endif
|