Skip to content

Fix SparseMatrixCSC with alternative Integer types #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ext/ArrayInterfaceSparseArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
(rowind, colind)
end

function bunchkaufman_instance(A::SparseMatrixCSC)
bunchkaufman(sparse(similar(A, 1, 1)), check = false)
function bunchkaufman_instance(A::SparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
bunchkaufman(SparseMatrixCSC{Tv, Ti}(similar(A, 1, 1)), check = false)

Check warning on line 18 in ext/ArrayInterfaceSparseArraysExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ArrayInterfaceSparseArraysExt.jl#L17-L18

Added lines #L17 - L18 were not covered by tests
end

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

function ldlt_instance(A::SparseMatrixCSC)
ldlt(sparse(similar(A, 1, 1)), check=false)
function ldlt_instance(A::SparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
ldlt(SparseMatrixCSC{Tv, Ti}(similar(A, 1, 1)), check=false)

Check warning on line 26 in ext/ArrayInterfaceSparseArraysExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ArrayInterfaceSparseArraysExt.jl#L25-L26

Added lines #L25 - L26 were not covered by tests
end

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

function qr_instance(jac_prototype::SparseMatrixCSC, pivot = DEFAULT_CHOLESKY_PIVOT)
qr(sparse(rand(1,1)))
function qr_instance(jac_prototype::SparseMatrixCSC{Tv, Ti}, pivot = DEFAULT_CHOLESKY_PIVOT) where {Tv, Ti}
qr(SparseMatrixCSC{Tv, Ti}(rand(1,1)))
end

end
Loading