Skip to content
This repository

print_matrix is broken for SubArrays #3697

Closed
stevengj opened this Issue · 1 comment

2 participants

Steven G. Johnson John Myles White
Steven G. Johnson
Collaborator

Running a = [1,2,3,4]; b = sub(a, 1:2) in the repl gives

2-element SubArray of 4-element Int64 Array:
 #undef
 #undef

The culprit seems to be somewhere in print_matrix (since print_matrix(STDOUT, b) gives the two #undefs).

John Myles White
Collaborator

I'd bet that the problem is that SubArray doesn't implement a matrix style getindex for vectors. Does a quick hack like getindex(s::SubArray, i::Integer, j::Integer) = getindex(s, i) restore printing something that's not #undef?

Jeff Bezanson JeffBezanson closed this in a012bba
Elliot Saba staticfloat referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.