672672end
673673
674674function init_cacheval (alg:: UMFPACKFactorization ,
675- A:: Union{Nothing, Matrix, AbstractSciMLOperator} , b, u, Pl, Pr,
675+ A, b, u, Pl, Pr,
676676 maxiters:: Int , abstol, reltol,
677677 verbose:: Bool , assumptions:: OperatorAssumptions )
678678 nothing
@@ -685,39 +685,24 @@ function init_cacheval(alg::UMFPACKFactorization, A::SparseMatrixCSC{Float64, In
685685 PREALLOCATED_UMFPACK
686686end
687687
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,
689689 reltol,
690690 verbose:: Bool , assumptions:: OperatorAssumptions )
691691 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
711703 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)))
721706 end
722707end
723708
@@ -770,7 +755,7 @@ const PREALLOCATED_KLU = KLU.KLUFactorization(SparseMatrixCSC(0, 0, [1], Int64[]
770755 Float64[]))
771756
772757function init_cacheval (alg:: KLUFactorization ,
773- A:: Union{Matrix, Nothing, AbstractSciMLOperator} , b, u, Pl, Pr,
758+ A, b, u, Pl, Pr,
774759 maxiters:: Int , abstol, reltol,
775760 verbose:: Bool , assumptions:: OperatorAssumptions )
776761 nothing
@@ -783,18 +768,12 @@ function init_cacheval(alg::KLUFactorization, A::SparseMatrixCSC{Float64, Int},
783768 PREALLOCATED_KLU
784769end
785770
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,
787772 reltol,
788773 verbose:: Bool , assumptions:: OperatorAssumptions )
789774 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)))
798777end
799778
800779function SciMLBase. solve! (cache:: LinearCache , alg:: KLUFactorization ; kwargs... )
@@ -859,25 +838,19 @@ end
859838const PREALLOCATED_CHOLMOD = cholesky (SparseMatrixCSC (0 , 0 , [1 ], Int64[], Float64[]))
860839
861840function init_cacheval (alg:: CHOLMODFactorization ,
862- A:: Union{Matrix, Nothing, AbstractSciMLOperator} , b, u, Pl, Pr,
841+ A, b, u, Pl, Pr,
863842 maxiters:: Int , abstol, reltol,
864843 verbose:: Bool , assumptions:: OperatorAssumptions )
865844 nothing
866845end
867846
868- function init_cacheval (alg:: CHOLMODFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
847+ function init_cacheval (alg:: CHOLMODFactorization , A, b, u,
869848 Pl, Pr,
870849 maxiters:: Int , abstol, reltol,
871850 verbose:: Bool , assumptions:: OperatorAssumptions )
872851 PREALLOCATED_CHOLMOD
873852end
874853
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-
881854function SciMLBase. solve! (cache:: LinearCache , alg:: CHOLMODFactorization ; kwargs... )
882855 A = cache. A
883856 A = convert (AbstractMatrix, A)
0 commit comments