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

show(::QRCompactWYQ) doesn't work properly #7583

Closed
jiahao opened this issue Jul 13, 2014 · 8 comments
Closed

show(::QRCompactWYQ) doesn't work properly #7583

jiahao opened this issue Jul 13, 2014 · 8 comments
Labels

Comments

@jiahao
Copy link
Member

jiahao commented Jul 13, 2014

julia> qrfact(eye(2))[:Q] |> display
2x2 QRCompactWYQ{Float64}:
 1.0  0.0
 0.0  1.0

julia> qrfact(eye(2))[:Q] |> show
[#undef #undef
 #undef #undef]

cc: @andreasnoackjensen - is this because getindex(::QRCompactWYQ, i,j) isn't defined?

@andreasnoack
Copy link
Member

At least, it is sufficient to define a getindex method to get show working. Maybe we should define a general getindex{AbstractMatrix{<:Number}} method that works by pre and post multiplying unit vectors.

@jiahao
Copy link
Member Author

jiahao commented Jul 13, 2014

I like the idea of a general getindex.

@andreasnoack
Copy link
Member

I'll do that. Actually, I have done it, but I need to investigate some ambiguity warnings to figure out which could not show value of type Tuple Julia is thinking of.

@JeffBezanson
Copy link
Sponsor Member

I think a type that can't implement getindex is not really an array. I'm not sure we should suddenly introduce the idea that for all conceivable arrays, multiplying by vectors is more fundamental than getting elements.

@andreasnoack
Copy link
Member

even when restricted to AbstractMatrix{<:Number}?

@jiahao
Copy link
Member Author

jiahao commented Jul 14, 2014

From the offline discussion, the idea was that QRCompactWYQ isn't actually an AbstractArray since it isn't a container that can implement getindex in less than O(N) time (ref #987).

I guess the real issue is why show() is defined the way it is; maybe it should imitate display() and dump the raw data.

@andreasnoack
Copy link
Member

This was the reason to have StoredArray<:AbstractArray. See #6212. If the special storage matrices cannot be allowed to be abstract matrices anymore I think we'd need some kind of AbstractParametrized{T} type to make it possible to define something like the Transpose type in #6837.

@andreasnoack
Copy link
Member

Fixed by 8e76a21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants