JuliaLang/julia — pull request #9466 by andreasnoack (2014-12-26 20:44:33+00:00)
Title: Fix tranpose for arrays

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 `AbstractMatrix`s 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