Skip to content
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

Implement consistent linear algebra for arrays with dimension > 2, in particular matmul #1104

Closed
mrfh92 opened this issue Feb 14, 2023 · 5 comments
Assignees
Labels
API Anything relating the API enhancement New feature or request linalg stale

Comments

@mrfh92
Copy link
Collaborator

mrfh92 commented Feb 14, 2023

In Pytorch, most linear algebra routines can be applied to batches of matrices. In Heat it would be nice to have a similar rule how to "define" linear algebra (matmul,qr,cholesky,svd etc.) for DNDarray's with dimension exceeding 2.

To do so, follow the PyTorch convention (see, e.g., https://pytorch.org/docs/stable/generated/torch.linalg.solve.html#torch.linalg.solve or also the code in #893): for arrays with ndim>=3 we regard the last two dimensions (in the case of matrices) or the last dimension (in the case of vectors) of the array as "linear algebra-dimensions" and the indices of the first ndim-2 (matrices) or ndim-1 (vectors) dimensions as indices of a "batch of linear algebra objects"

Particular example: see matmul (#890 )

Suggestion:

  • "minimal solution" (data/batch-parallel higher-dim matmul only):
    introduce batched matmul for ndim>=3 for the case that the split-dimension is a batch-dimension, i.e. no parallel matrix-matrix multiplication algorithm is required
  • "full solution": go through the existing matmul-code and adapt it in such a way that you add batch-dimensions in order to handle the case of split equal to one of the two last dimensions that has been omitted in the "mimal solution"

Note: qr, svd, cholesky have been split off to #1320

@mrfh92 mrfh92 added enhancement New feature or request API Anything relating the API linalg To be discussed Requires discussion in project meeting first labels Feb 14, 2023
@ClaudiaComito
Copy link
Contributor

Related: #890

@mrfh92
Copy link
Collaborator Author

mrfh92 commented Aug 17, 2023

see #890 for the particular case of matmul on higher dim arrays

Reviewed within #1109 : still open and relevant

@mrfh92 mrfh92 changed the title Discuss and implement consistent linear algebra for arrays with dimension > 2 Implement consistent linear algebra for arrays with dimension > 2, in particular matmul Aug 17, 2023
@mrfh92 mrfh92 removed the To be discussed Requires discussion in project meeting first label Aug 17, 2023
@github-actions
Copy link
Contributor

Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale label Mar 18, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 60 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Anything relating the API enhancement New feature or request linalg stale
Projects
None yet
Development

No branches or pull requests

3 participants