Skip to content

Commit

Permalink
Fix non-truncated show(...) for SparseMatrixCSR
Browse files Browse the repository at this point in the history
  • Loading branch information
frankier committed Aug 27, 2024
1 parent dbe71cf commit 6e04ea1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/SparseMatrixCSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function show(io::IOContext, S::SparseMatrixCSR{Bi}) where{Bi}
nnz(S) == 0 && return show(io, MIME("text/plain"), S)
ioc = IOContext(io, :compact => true)

function _format_line(r, col, padr, padc,o)
function _format_line(r, col, padr, padc, o=0)
print(ioc, "\n [", rpad(col+o, padr), ", ", lpad(S.colval[r]+o, padc), "] = ")
if isassigned(S.nzval, Int(r))
show(ioc, S.nzval[r])
Expand Down
3 changes: 2 additions & 1 deletion test/SparseMatrixCSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function test_csr(Bi,Tv,Ti)
@test copy(CSR) == CSC
end
CSR = sparsecsr(Val(Bi),I,J,V)
show(CSR)
show(IOContext(stdout, :limit=>true, :displaysize=>(10,10)), CSR)
show(IOContext(stdout, :limit=>false), CSR)
@test CSR == CSC
@test copy(CSR) == CSC
@test eltype(CSR) == Tv
Expand Down

0 comments on commit 6e04ea1

Please sign in to comment.