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

Fix transpose for arrays #9466

Merged
merged 1 commit into from
Dec 30, 2014
Merged

Fix transpose for arrays #9466

merged 1 commit into from
Dec 30, 2014

Conversation

andreasnoack
Copy link
Member

I have failed to convince @StefanKarpinski and @JeffBezanson in #9170 and that pr is therefore superseded by this which adds some error messages for (c)transpose of AbstractMatrixs instead of removing the transpose methods defined for Any. For the record I'll note that I don't think it is the right solution as new matrix like types that are not subtypes of AbstractMatrix will silently return wrong results for (c)transpose.

For the QR example that revealed this issue, the result is now

julia> Q = qrfact(randn(3,3))[:Q];

julia> Q*diagm(randn(3))*Q'
ERROR: ctranspose not implemented for Base.LinAlg.QRCompactWYQ{Float64,Array{Float64,2}}. Consider adding parentheses, e.g. A*(B*C') instead of A*B*C' to avoid explicit calculation of the transposed matrix.
 in error at error.jl:21
 in ctranspose at abstractarray.jl:29

As part of the tranpose fix, I have added (c)transpose for Givens and Rotation types and changed the AbstractRotation to be an abstract type instead of a union. I have also removed the r property from the Givens type. Instead, it is returned from the givens method. The r property wouldn't make sense for the transposed rotation and I think it is a better design in general.

cc: @jiahao, @ivanslapnicar

…row on (c)transpose to avoid silent errors when (c)transpose is not implemented for a matrix type. Add some tests. Remove r property from Givens type and return it from givens method.
@andreasnoack andreasnoack changed the title Fix tranpose for arrays Fix transpose for arrays Dec 26, 2014
andreasnoack added a commit that referenced this pull request Dec 30, 2014
@andreasnoack andreasnoack merged commit 89b0aa6 into master Dec 30, 2014
@andreasnoack andreasnoack deleted the anj/notr2 branch December 30, 2014 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant