Skip to content

Commit 74135a1

Browse files
Merge pull request #462 from JuliaArrays/ChrisRackauckas-patch-2
Fix SparseMatrixCSC with alternative Integer types
2 parents 147b8a2 + e2b9740 commit 74135a1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ext/ArrayInterfaceSparseArraysExt.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ function findstructralnz(x::SparseMatrixCSC)
1414
(rowind, colind)
1515
end
1616

17-
function bunchkaufman_instance(A::SparseMatrixCSC)
18-
bunchkaufman(sparse(similar(A, 1, 1)), check = false)
17+
function bunchkaufman_instance(A::SparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
18+
bunchkaufman(SparseMatrixCSC{Tv, Ti}(similar(A, 1, 1)), check = false)
1919
end
2020

21-
function cholesky_instance(A::Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}}, pivot = DEFAULT_CHOLESKY_PIVOT)
22-
cholesky(sparse(similar(A, 1, 1)), check = false)
21+
function cholesky_instance(A::Union{SparseMatrixCSC{Tv, Ti},Symmetric{<:Number,<:SparseMatrixCSC{Tv, Ti}}}, pivot = DEFAULT_CHOLESKY_PIVOT) where {Tv, Ti}
22+
cholesky(SparseMatrixCSC{Tv, Ti}(similar(A, 1, 1)), check = false)
2323
end
2424

25-
function ldlt_instance(A::SparseMatrixCSC)
26-
ldlt(sparse(similar(A, 1, 1)), check=false)
25+
function ldlt_instance(A::SparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
26+
ldlt(SparseMatrixCSC{Tv, Ti}(similar(A, 1, 1)), check=false)
2727
end
2828

2929
# Could be optimized but this should work for any real case.
30-
function lu_instance(jac_prototype::SparseMatrixCSC, pivot = DEFAULT_CHOLESKY_PIVOT)
31-
lu(sparse(rand(1,1)))
30+
function lu_instance(jac_prototype::SparseMatrixCSC{Tv, Ti}, pivot = DEFAULT_CHOLESKY_PIVOT) where {Tv, Ti}
31+
lu(SparseMatrixCSC{Tv, Ti}(rand(1,1)))
3232
end
3333

34-
function qr_instance(jac_prototype::SparseMatrixCSC, pivot = DEFAULT_CHOLESKY_PIVOT)
35-
qr(sparse(rand(1,1)))
34+
function qr_instance(jac_prototype::SparseMatrixCSC{Tv, Ti}, pivot = DEFAULT_CHOLESKY_PIVOT) where {Tv, Ti}
35+
qr(SparseMatrixCSC{Tv, Ti}(rand(1,1)))
3636
end
3737

3838
end

0 commit comments

Comments
 (0)