-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
qr(A; full=false) no longer available? #27397
Comments
In 0.7,
from which you can extract the orthogonal/unitary factors with the same efficient internal representation
Close if this answer satisfies you? Best! :) |
But what if |
You can get that with julia> A = randn(4,2);
julia> F = qr(A);
julia> Array(F.Q)
4×2 Array{Float64,2}:
-0.70317 0.295658
-0.45671 -0.879036
-0.445754 0.357912
-0.313483 0.108542 but I think I'd actaully like that method to return the square version eventually. My preferred version to get the rectangular version would be julia> F.Q*Matrix(I, size(A)...)
4×2 Array{Float64,2}:
-0.70317 0.295658
-0.45671 -0.879036
-0.445754 0.357912
-0.313483 0.108542 since it is how it is constructed anyway from the elementary reflectors. Do you really need the densely stored version though? It might be more efficient to apply the compact form first and then only afterward extract the part you interested in, e.g. least squares julia> b = randn(4);
julia> UpperTriangular(F.R)\(F.Q'*b)[1:size(F, 2)]
2-element Array{Float64,1}:
0.39458420793912025
0.8375702802780137 where extracting the rectangular first would effectively be julia> UpperTriangular(F.R)\((F.Q*Matrix(I, size(F)...))'*b)
2-element Array{Float64,1}:
0.39458420793912025
0.8375702802780137 which is much less efficient. |
I use the |
The compact Q type we use is an efficient representation of such an orthogonal set of vectors so it might but in the end, it depends on the application of the orthogonal vectors. I suspect that the orthogonal representation would be preferable in many cases, but of course, there are cases where is better, easier, or only feasible to work with the explicitly stored version of Q. |
I see: the step I think the documentation mentions this now that I look at it again (... A Q matrix can be converted into a regular matrix with Matrix. ...), but it might be worthwhile to explicitly spell out that the resulting matrix might be an economy matrix. |
|
It is mention. See https://github.com/JuliaLang/julia/blob/master/NEWS.md#breaking-changes and search for |
No, it is not mentioned. The only mention of
After reading this, one would reasonably expect code that worked on julia 0.6 to either continue working or actually break when used as a tuple of arrays. Instead, there is no error but just different behavior, without any mention of the |
The point is that it now returns a factorization object.
That is not really the case. The julia> using LinearAlgebra
julia> Q, R = qr(randn(5,3));
julia> Q*Matrix(I, 5, 3)
5×3 Array{Float64,2}:
-0.126594 -0.162614 0.836955
0.0265404 -0.400726 0.128851
-0.640374 0.0083259 -0.431216
0.447749 -0.730629 -0.30548
0.610501 0.528287 -0.0603235
julia> Q*Matrix(I, 5, 5)
5×5 Array{Float64,2}:
-0.126594 -0.162614 0.836955 0.38462 0.330311
0.0265404 -0.400726 0.128851 -0.802883 0.421297
-0.640374 0.0083259 -0.431216 0.218607 0.596754
0.447749 -0.730629 -0.30548 0.395966 0.124877
0.610501 0.528287 -0.0603235 0.0535566 0.584546 and |
Perhaps I should have been more clear from the beginning. It has been a longstanding goal in julia development, for as long as I remember, that code written for julia 0.x should behave identically on julia 0.(x+1). Yes, one should expect that doing so will result in a ton of deprecation warnings, and it may even run slower until these warnings are fixed. And sure, there have been a few occasions where this principle has been violated (though typically with good reason). But overall, the goal has been for the upgrade path to be smooth. This change has broken with this tradition.
As mentioned above, in an identical context (i.e. when treating it as a tuple), it results in a thin decomposition under julia 0.6 and a thick decomposition under julia 0.7. I would consider this a bug in the deprecations, but it may be a bit late to "fix" this, so I think it would be reasonable to mention this explicitly in NEWS. I will work on phrasing for a pull request. |
Explain in docstring how to obtain both the thin and full factors. This is related to issue JuliaLang#27397.
I have created a pull-request to improve the documentation of this issue: #28446 |
* update docstring for qr Explain in docstring how to obtain both the thin and full factors. This is related to issue #27397. * further improvement/clarification
* update docstring for qr Explain in docstring how to obtain both the thin and full factors. This is related to issue #27397. * further improvement/clarification
How is the economy factorization supported in 0.7-alpha? There doesn't seem to be a good retrieval method for getting just the economy Q (or have I missed it?).
The text was updated successfully, but these errors were encountered: