Rework index manipulation API#416
Merged
Merged
Conversation
Contributor
|
After the build completes, the updated documentation will be available here |
f45ab42 to
2841304
Compare
Member
Author
|
|
ff15f1e to
c4408b3
Compare
a0bc84b to
2c44dca
Compare
b833340 to
5a576f0
Compare
Jutho
reviewed
May 13, 2026
Jutho
reviewed
May 13, 2026
Jutho
reviewed
May 13, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Jutho
reviewed
May 15, 2026
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
[skip ci]
Docs content is being added back in a stacked follow-up PR to keep this one reviewable. The minimal docs/src/lib/tensors.md change is kept here because removing the @docs block for the now-deprecated add_permute!/add_braid!/add_transpose! wrappers is required for the docs build to succeed.
26c844a to
35f4d65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR overhauls the index manipulation API in
src/tensors/indexmanipulations.jlto match TensorOperations dispatch conventions, reduces code duplication in the implementation, and adds a dedicated documentation page.The goal was a bunch of code simplification, (overall number of lines reduced, even though I added some docs 🎉 )
API changes
permute!,braid!,transpose!, andrepartition!now directly acceptα,β,backend, andallocatoras optional arguments (with defaultsOne(),Zero(),DefaultBackend(),DefaultAllocator()), following the TensorOperations dispatch pattern. The oldadd_permute!,add_braid!, andadd_transpose!are deprecated and forward to the new functions.allocatorsupport: previously, the index manipulation functions did not support a customallocatorat all. It is now a positional argument in both the public and internal interfaces, consistent with TensorOperations convention.permute,braid,transpose,repartition) gainbackendas a new keyword argument alongside the now-supportedallocatorkeyword.Implementation changes
braid!, eliminating duplicate codepaths.braid!method added forAdjointTensorMap.add_transform!kernels forTensorMaprefactored to operate on the raw data vector rather than the fullTensorMap. Because the data vector has no symmetry type, this avoids recompilation for everyTensorMaptype combination, improving compilation time.