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
ENH: Vectorising np.linalg.qr #19151
Conversation
Please let me know if the above additions require any modifications. A bunch of questions,
ping @eric-wieser @mattip Thank you. Apologies if I missed out on any guidelines. |
Note you'll need numpy/numpy/linalg/umath_linalg.c.src Lines 2838 to 3234 in a436fb9
Not just the final |
Sure. So, can we say that this is the kind of pattern to be followed for every new function added to |
It depends on the underlying LAPACK/BLAS functionality. In general, I think it would be better to add functionality to SciPy and not to Numpy. In fact, you may be able to reuse some ideas or code from the scipy.linalg.qr implementation. |
In the recent push I have written a generic implementation of QR decomposition. I will add specific ones for 'r', 'raw', 'economic' and 'reduced_m' and 'reduced_n' separately in future commits. |
Can someone please restart this build on Travis CI? It seems like the build error-ed due to some issue on Travis servers. Thanks. |
ping @eric-wieser Please let me know if any updates are required to this PR. Thanks. |
@eric-wieser @mattip Are there any improvements to be made here? Please let me know. |
@eric-wieser any more review here? |
I have factored out common code in initialization for |
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 review part covers only the Python part of the PR: mostly nits, clarifications, and request to improve testing coverage.
Hi. Thanks a lot for the reviews. I will be addressing them by pushing changes tomorrow morning. |
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 review part covers the C code. My comments are mostly optimization nits and clarifications.
PS: github did not do a good job in displaying diffs this time..
I have addressed the reviews and the tests seem to pass. Please let me know if there are any other concerns or there is something more that can be done. Thank you. |
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.
I have a couple of optimization nits and a BC question.
In addition, it is not clear to me why to define function pairs, qr_r_raw_m and qr_r_raw_n, when they both use the same C implementation. The only difference appears in gufunc descriptor signatures: "(m,n),(m)->(m,m)"
vs "(m,n),(n)->(m,n)"
.
Would it be possible join these signatures to "(m, n),(k)->(m, k)" and let the implementation to check that k == min(m, n)
?
The same note applies to other function pairs with _m
and _n
sufficies.
Here's the thread - #19151 (comment) - which covers the same. |
OK, we have:
So:
|
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.
Bug report.
I have addressed all the reviews. Let me know if there's something else to be done. Thanks. |
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.
LGTM, thanks @czgdp1807 !
Thanks @pearu for the feedbacks and thorough reviews. |
Thanks @czgdp1807 |
Fixes #11741
Comments
This is my first PR to numpy. I thought of pushing the early changes so that reviews can be provided as soon as possible and I can keep updating my local branch frequently, keeping the things up to date.
As of now I have just initialized the framework for implementing QR decomposition at C level. I haven't made any change to Python code, will do that once the C code looks good. See, #11741 (comment)