-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Avoid allocation in ldiv! with QR #38389
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
Conversation
`ldiv!` is currently allocating memory unnecessarily: ```julia julia> n = 1000; A = randn(n,n); F = qr(A); b = randn(n); julia> @time ldiv!(F, b); 0.005001 seconds (9 allocations: 7.637 MiB) ``` The culprit is that `F.R` creates a copy. Using `UpperTriangular(F.factors)` is equivalent to `F.R` without the allocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of minor suggestions, partly from the original PR.
Co-authored-by: Daniel Karrasch <[email protected]>
Co-authored-by: Daniel Karrasch <[email protected]>
Co-authored-by: Daniel Karrasch <[email protected]>
|
Let's rerun CI and merge if tests pass. |
| ldiv!(UpperTriangular(view(R,1:n,:)), view(B, 1:n, :)) | ||
| return B | ||
| end | ||
| function ldiv!(A::QR, B::StridedVector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates the method just below it. #38801
Co-authored-by: Daniel Karrasch <[email protected]> (cherry picked from commit b1a2847)
|
Apologies: I think it was a result as rebase-gone-bad. |
Co-authored-by: Daniel Karrasch <[email protected]>
This reopens #31314 after a dodgy rebase