Skip to content

Commit 3dbf8c5

Browse files
committed
Fix DiagonalIndices when sparse matrix indices are not Int64.
searchsortedfirst (used to get diagonal entries) requires its inputs to be Int64. When the sparse matrix passed to DiagonalIndices has a different type of indices, searchsortedfirst is not found.
1 parent ed66486 commit 3dbf8c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/stationary_sparse.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct DiagonalIndices{Tv, Ti <: Integer}
1212
diag = Vector{Ti}(undef, A.n)
1313

1414
for col = 1 : A.n
15-
r1 = A.colptr[col]
16-
r2 = A.colptr[col + 1] - 1
15+
r1 = Int64(A.colptr[col])
16+
r2 = Int64(A.colptr[col + 1] - 1)
1717
r1 = searchsortedfirst(A.rowval, col, r1, r2, Base.Order.Forward)
1818
if r1 > r2 || A.rowval[r1] != col || iszero(A.nzval[r1])
1919
throw(LinearAlgebra.SingularException(col))

0 commit comments

Comments
 (0)