Skip to content

Commit 4e48dbc

Browse files
committed
2 parents 85874b6 + a2cf653 commit 4e48dbc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/SparseMatrixCOO.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function allocated_coo(::Type{T}, M::Int, N::Int, nnz::Int) where {T}
8181
SparseMatrixCOO{T}(undef, M, N, nnz)
8282
end
8383

84-
function getindex(coo::SparseMatrixCOO{Tv,Ti}, i::Ti, j::Ti) where {Tv,Ti}
84+
function getindex(coo::SparseMatrixCOO{Tv,Ti}, i::Integer, j::Integer) where {Tv,Ti}
8585
res = zero(Tv)
8686
for k = 1:nnz(coo)
8787
if coo.is[k] == i && coo.js[k] == j
@@ -110,8 +110,8 @@ isdense(::SparseMatrixCOO) = false
110110
Base.@propagate_inbounds function Base.setindex!(
111111
coo::SparseMatrixCOO{Tv,Ti},
112112
v,
113-
i::Ti,
114-
j::Ti,
113+
i::Integer,
114+
j::Integer,
115115
) where {Tv,Ti}
116116
@boundscheck (1 <= i <= coo.m) && (1 <= j <= coo.n) || throw(BoundsError(coo, (i, j)))
117117

test/SparseMatrixCOO.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ end
5252
@test coo.is[end] == 1
5353
@test coo.js[end] == 1
5454
@test coo.vs[end] == 0.2
55+
56+
S = SparseMatrixCOO{Float32, Cint}(Cint[], Cint[], Float32[], 5, 5)
57+
S[1, 1] = 3
58+
@test S[1, 1] == 3
5559
end

0 commit comments

Comments
 (0)