672
672
end
673
673
674
674
function init_cacheval (alg:: UMFPACKFactorization ,
675
- A:: Union{Nothing, Matrix, AbstractSciMLOperator} , b, u, Pl, Pr,
675
+ A, b, u, Pl, Pr,
676
676
maxiters:: Int , abstol, reltol,
677
677
verbose:: Bool , assumptions:: OperatorAssumptions )
678
678
nothing
@@ -685,39 +685,24 @@ function init_cacheval(alg::UMFPACKFactorization, A::SparseMatrixCSC{Float64, In
685
685
PREALLOCATED_UMFPACK
686
686
end
687
687
688
- function init_cacheval (alg:: UMFPACKFactorization , A, b, u, Pl, Pr, maxiters:: Int , abstol,
688
+ function init_cacheval (alg:: UMFPACKFactorization , A:: AbstractSparseArray , b, u, Pl, Pr, maxiters:: Int , abstol,
689
689
reltol,
690
690
verbose:: Bool , assumptions:: OperatorAssumptions )
691
691
A = convert (AbstractMatrix, A)
692
-
693
- if typeof (A) <: SparseArrays.AbstractSparseArray
694
- zerobased = SparseArrays. getcolptr (A)[1 ] == 0
695
- @static if VERSION < v " 1.9.0-DEV.1622"
696
- res = SuiteSparse. UMFPACK. UmfpackLU (C_NULL , C_NULL , size (A, 1 ), size (A, 2 ),
697
- zerobased ?
698
- copy (SparseArrays. getcolptr (A)) :
699
- SuiteSparse. decrement (SparseArrays. getcolptr (A)),
700
- zerobased ? copy (rowvals (A)) :
701
- SuiteSparse. decrement (rowvals (A)),
702
- copy (nonzeros (A)), 0 )
703
- finalizer (SuiteSparse. UMFPACK. umfpack_free_symbolic, res)
704
- return res
705
- else
706
- return SuiteSparse. UMFPACK. UmfpackLU (SparseMatrixCSC (size (A)... , getcolptr (A),
707
- rowvals (A), nonzeros (A)))
708
- end
709
- elseif ! (eltype (A) <: Union{Float32,Float64} ) || ! (eltype (b) <: Union{Float32,Float64} )
710
- return nothing # Cannot use Umfpack
692
+ zerobased = SparseArrays. getcolptr (A)[1 ] == 0
693
+ @static if VERSION < v " 1.9.0-DEV.1622"
694
+ res = SuiteSparse. UMFPACK. UmfpackLU (C_NULL , C_NULL , size (A, 1 ), size (A, 2 ),
695
+ zerobased ?
696
+ copy (SparseArrays. getcolptr (A)) :
697
+ SuiteSparse. decrement (SparseArrays. getcolptr (A)),
698
+ zerobased ? copy (rowvals (A)) :
699
+ SuiteSparse. decrement (rowvals (A)),
700
+ copy (nonzeros (A)), 0 )
701
+ finalizer (SuiteSparse. UMFPACK. umfpack_free_symbolic, res)
702
+ return res
711
703
else
712
- @static if VERSION < v " 1.9.0-DEV.1622"
713
- res = SuiteSparse. UMFPACK. UmfpackLU (C_NULL , C_NULL , 0 , 0 ,
714
- [0 ], Int64[], eltype (A)[], 0 )
715
- finalizer (SuiteSparse. UMFPACK. umfpack_free_symbolic, res)
716
- return res
717
- else
718
- return SuiteSparse. UMFPACK. UmfpackLU (SparseMatrixCSC (0 , 0 , [1 ], Int64[],
719
- eltype (A)[]))
720
- end
704
+ return SuiteSparse. UMFPACK. UmfpackLU (SparseMatrixCSC (size (A)... , getcolptr (A),
705
+ rowvals (A), nonzeros (A)))
721
706
end
722
707
end
723
708
@@ -770,7 +755,7 @@ const PREALLOCATED_KLU = KLU.KLUFactorization(SparseMatrixCSC(0, 0, [1], Int64[]
770
755
Float64[]))
771
756
772
757
function init_cacheval (alg:: KLUFactorization ,
773
- A:: Union{Matrix, Nothing, AbstractSciMLOperator} , b, u, Pl, Pr,
758
+ A, b, u, Pl, Pr,
774
759
maxiters:: Int , abstol, reltol,
775
760
verbose:: Bool , assumptions:: OperatorAssumptions )
776
761
nothing
@@ -783,18 +768,12 @@ function init_cacheval(alg::KLUFactorization, A::SparseMatrixCSC{Float64, Int},
783
768
PREALLOCATED_KLU
784
769
end
785
770
786
- function init_cacheval (alg:: KLUFactorization , A, b, u, Pl, Pr, maxiters:: Int , abstol,
771
+ function init_cacheval (alg:: KLUFactorization , A:: AbstractSparseArray , b, u, Pl, Pr, maxiters:: Int , abstol,
787
772
reltol,
788
773
verbose:: Bool , assumptions:: OperatorAssumptions )
789
774
A = convert (AbstractMatrix, A)
790
- if typeof (A) <: SparseArrays.AbstractSparseArray
791
- return KLU. KLUFactorization (SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A),
792
- nonzeros (A)))
793
- elseif ! (eltype (A) <: Union{Float32,Float64} ) || ! (eltype (b) <: Union{Float32,Float64} )
794
- return nothing # Cannot use KLU
795
- else
796
- return KLU. KLUFactorization (SparseMatrixCSC (0 , 0 , [1 ], Int64[], eltype (A)[]))
797
- end
775
+ return KLU. KLUFactorization (SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A),
776
+ nonzeros (A)))
798
777
end
799
778
800
779
function SciMLBase. solve! (cache:: LinearCache , alg:: KLUFactorization ; kwargs... )
@@ -859,25 +838,19 @@ end
859
838
const PREALLOCATED_CHOLMOD = cholesky (SparseMatrixCSC (0 , 0 , [1 ], Int64[], Float64[]))
860
839
861
840
function init_cacheval (alg:: CHOLMODFactorization ,
862
- A:: Union{Matrix, Nothing, AbstractSciMLOperator} , b, u, Pl, Pr,
841
+ A, b, u, Pl, Pr,
863
842
maxiters:: Int , abstol, reltol,
864
843
verbose:: Bool , assumptions:: OperatorAssumptions )
865
844
nothing
866
845
end
867
846
868
- function init_cacheval (alg:: CHOLMODFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
847
+ function init_cacheval (alg:: CHOLMODFactorization , A, b, u,
869
848
Pl, Pr,
870
849
maxiters:: Int , abstol, reltol,
871
850
verbose:: Bool , assumptions:: OperatorAssumptions )
872
851
PREALLOCATED_CHOLMOD
873
852
end
874
853
875
- function init_cacheval (alg:: CHOLMODFactorization , A:: SparseMatrixCSC{Float32, Int} , b, u, Pl, Pr, maxiters:: Int , abstol,
876
- reltol,
877
- verbose:: Bool , assumptions:: OperatorAssumptions )
878
- cholesky (SparseMatrixCSC (0 , 0 , [1 ], Int64[], eltype (A)[]))
879
- end
880
-
881
854
function SciMLBase. solve! (cache:: LinearCache , alg:: CHOLMODFactorization ; kwargs... )
882
855
A = cache. A
883
856
A = convert (AbstractMatrix, A)
0 commit comments