Skip to content

Commit 0936d2b

Browse files
committed
Update decompression.jl
1 parent fcf052b commit 0936d2b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/decompression.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ struct JoinCompressed{R<:Real,M1<:AbstractMatrix{R},M2<:AbstractMatrix{R}} <:
749749
symmetric_to_column::Vector{Int}
750750
end
751751

752-
function Base.getindex(B::JoinCompressed, i::Integer, j::Integer)
752+
function Base.getindex(B::JoinCompressed, i::Int, j::Int)
753753
(; n, Br, Bc, symmetric_to_row, symmetric_to_column) = B
754754
if i n
755755
return Br[symmetric_to_row[j], i]
@@ -758,11 +758,10 @@ function Base.getindex(B::JoinCompressed, i::Integer, j::Integer)
758758
end
759759
end
760760

761-
function Base.getindex(B::JoinCompressed, k::Integer)
761+
function Base.getindex(B::JoinCompressed, k::Int)
762762
dim = B.m + B.n
763-
i = mod(k - 1, dim) + 1
764-
j = div(k - 1, dim) + 1
765-
return getindex(B, i, j)
763+
j, i = divrem(k - 1, dim)
764+
return getindex(B, i+1, j+1)
766765
end
767766

768767
function decompress!(

0 commit comments

Comments
 (0)