11module ArrayInterface
22
33using LinearAlgebra
4- using SparseArrays
5- using SuiteSparse
64
75@static if isdefined (Base, Symbol (" @assume_effects" ))
86 using Base: @assume_effects
@@ -121,8 +119,6 @@ Return the buffer data that `x` points to. Unlike `parent(x::AbstractArray)`, `b
121119may not return another array type.
122120"""
123121buffer (x) = parent (x)
124- buffer (x:: SparseMatrixCSC ) = getfield (x, :nzval )
125- buffer (x:: SparseVector ) = getfield (x, :nzval )
126122buffer (@nospecialize x:: Union{Base.Slice, Base.IdentityUnitRange} ) = getfield (x, :indices )
127123
128124"""
@@ -308,7 +304,6 @@ Determine whether `findstructralnz` accepts the parameter `x`.
308304has_sparsestruct (x) = has_sparsestruct (typeof (x))
309305has_sparsestruct (:: Type ) = false
310306has_sparsestruct (:: Type{<:AbstractArray} ) = false
311- has_sparsestruct (:: Type{<:SparseMatrixCSC} ) = true
312307has_sparsestruct (:: Type{<:Diagonal} ) = true
313308has_sparsestruct (:: Type{<:Bidiagonal} ) = true
314309has_sparsestruct (:: Type{<:Tridiagonal} ) = true
@@ -320,7 +315,6 @@ has_sparsestruct(::Type{<:SymTridiagonal}) = true
320315Determine whether a given abstract matrix is singular.
321316"""
322317issingular (A:: AbstractMatrix ) = issingular (Matrix (A))
323- issingular (A:: AbstractSparseMatrix ) = ! issuccess (lu (A, check = false ))
324318issingular (A:: Matrix ) = ! issuccess (lu (A, check = false ))
325319issingular (A:: UniformScaling ) = A. λ == 0
326320issingular (A:: Diagonal ) = any (iszero, A. diag)
@@ -359,11 +353,6 @@ function findstructralnz(x::Union{Tridiagonal, SymTridiagonal})
359353 (rowind, colind)
360354end
361355
362- function findstructralnz (x:: SparseMatrixCSC )
363- rowind, colind, _ = findnz (x)
364- (rowind, colind)
365- end
366-
367356abstract type ColoringAlgorithm end
368357
369358"""
@@ -403,9 +392,6 @@ cheaply.
403392function bunchkaufman_instance (A:: Matrix{T} ) where T
404393 return bunchkaufman (similar (A, 0 , 0 ), check = false )
405394end
406- function bunchkaufman_instance (A:: SparseMatrixCSC )
407- bunchkaufman (sparse (similar (A, 1 , 1 )), check = false )
408- end
409395
410396"""
411397bunchkaufman_instance(a::Number) -> a
@@ -429,14 +415,10 @@ cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorizati
429415Returns an instance of the Cholesky factorization object with the correct type
430416cheaply.
431417"""
432- function cholesky_instance (A:: Matrix{T} , pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
418+ function cholesky_instance (A:: Matrix{T} , pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
433419 return cholesky (similar (A, 0 , 0 ), pivot, check = false )
434420end
435421
436- function cholesky_instance (A:: Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}} , pivot = DEFAULT_CHOLESKY_PIVOT)
437- cholesky (sparse (similar (A, 1 , 1 )), check = false )
438- end
439-
440422"""
441423cholesky_instance(a::Number, pivot = LinearAlgebra.RowMaximum()) -> a
442424
@@ -458,14 +440,10 @@ ldlt_instance(A) -> ldlt_factorization_instance
458440Returns an instance of the LDLT factorization object with the correct type
459441cheaply.
460442"""
461- function ldlt_instance (A:: Matrix{T} ) where {T}
443+ function ldlt_instance (A:: Matrix{T} ) where {T}
462444 return ldlt_instance (SymTridiagonal (similar (A, 0 , 0 )))
463445end
464446
465- function ldlt_instance (A:: SparseMatrixCSC )
466- ldlt (sparse (similar (A, 1 , 1 )), check= false )
467- end
468-
469447function ldlt_instance (A:: SymTridiagonal{T,V} ) where {T,V}
470448 return LinearAlgebra. LDLt {T,SymTridiagonal{T,V}} (A)
471449end
@@ -498,9 +476,6 @@ function lu_instance(A::Matrix{T}) where {T}
498476 info = zero (LinearAlgebra. BlasInt)
499477 return LU {luT} (similar (A, 0 , 0 ), ipiv, info)
500478end
501- function lu_instance (jac_prototype:: SparseMatrixCSC )
502- SuiteSparse. UMFPACK. UmfpackLU (similar (jac_prototype, 1 , 1 ))
503- end
504479
505480function lu_instance (A:: Symmetric{T} ) where {T}
506481 noUnitT = typeof (zero (T))
@@ -557,11 +532,6 @@ function qr_instance(A::Matrix{BigFloat},pivot = DEFAULT_CHOLESKY_PIVOT)
557532 LinearAlgebra. QR (zeros (BigFloat,0 ,0 ),zeros (BigFloat,0 ))
558533end
559534
560- # Could be optimized but this should work for any real case.
561- function qr_instance (jac_prototype:: SparseMatrixCSC , pivot = DEFAULT_CHOLESKY_PIVOT)
562- qr (sparse (rand (1 ,1 )))
563- end
564-
565535"""
566536 qr_instance(a::Number) -> a
567537
0 commit comments