Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print_matrix is broken for SubArrays #3697

Closed
stevengj opened this issue Jul 12, 2013 · 1 comment
Closed

print_matrix is broken for SubArrays #3697

stevengj opened this issue Jul 12, 2013 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@stevengj
Copy link
Member

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).

@johnmyleswhite
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants