-
Notifications
You must be signed in to change notification settings - Fork 52
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
Proposal: add support for returning upper and lower triangles of an array #237
Comments
@kgryte You're 10 mins ahead of me! I was working on cupy/cupy#5555 and just realized the very same need. I think we need them to be able to handle and return a batch of matrices like all other linalg functions, which is currently not possible with NumPy/CuPy. |
@leofang I think handling batches could make sense; |
I've opened gh-243 which adds both |
Proposal
Add APIs for returning the upper
(triu
) and lower (tril
) triangles of an array.Motivation
Currently, the array API specification does not provide APIs for returning the upper and lower triangles of an array.
These APIs were identified as potential candidates in gh-187 for inclusion in the next version of the standard. However, depending on the outcome of gh-217 may be necessary to include in the current version in order to ensure users can maintain equivalent functionality.
Background
triu
andtril
APIs are common across array libraries (see here). The notable exception being TensorFlow. MXNet seems to have APIs for returning the triangles of an array, but these are not documented in public documentation, so were not picked up during API comparison analysis.Both
triu
andtril
should be straightforward to include in the specification, as the signatures are consistent across libraries.where
k
specifies the diagonal above/below which to zero elements.The text was updated successfully, but these errors were encountered: