Skip to content

Documentation for index-manipulation and contraction API rework#438

Merged
Jutho merged 6 commits into
mainfrom
ld-indexmanipulations-docs
Jun 4, 2026
Merged

Documentation for index-manipulation and contraction API rework#438
Jutho merged 6 commits into
mainfrom
ld-indexmanipulations-docs

Conversation

@lkdvos
Copy link
Copy Markdown
Member

@lkdvos lkdvos commented May 19, 2026

Stacked on top of #416. Contains the documentation portion of that PR:

  • New manual pages: indexmanipulations.md, contractions.md, linearalgebra.md, factorizations.md
  • New SVG asset: img/tensor-fermioniccontraction.svg
  • Removal of the old tensormanipulations.md
  • Page-tree restructure in docs/make.jl (new "Tensors" group)
  • CollapsedDocStrings = true added to lib/{fusiontrees,sectors,spaces}.md
  • Minor wording tweak in man/tensors.md

Additionally, I finally got around to putting in some information in the documentation section of the fermionic/anyonic contractions pages, let me know what you think.
Ultimately the dream would be to be able to (finally) submit this version to SciPost codebases.

Merge order: #416 first, then this PR. Once #416 lands, the base of this PR will fast-forward to main.

@lkdvos lkdvos force-pushed the ld-indexmanipulations branch from cae3748 to 26c844a Compare May 19, 2026 20:12
@lkdvos lkdvos force-pushed the ld-indexmanipulations-docs branch from c76bbc3 to 01552fb Compare May 19, 2026 20:13
@lkdvos lkdvos marked this pull request as draft May 19, 2026 20:17
@github-actions
Copy link
Copy Markdown
Contributor

After the build completes, the updated documentation will be available here

@borisdevos
Copy link
Copy Markdown
Member

The additional text to contractions is a lifesaver, I actually finally understand why some of my planar diagrams weren't considered to be planar! 😄

@Jutho
Copy link
Copy Markdown
Member

Jutho commented May 20, 2026

I'll had a first quick look and this looks very well written indeed. This will be extremely useful (and is definitely long overdue).

The only comment that is maybe missing is that the @planar contraction in combination with Fermionic() tensors is "equivalent" (or at least closer to) to the "trace" framework, i.e. not twists are inserted and therefore composition of morphisms just works as expected (in particular, e.g. inner products, isometry checks of orthogonal factorizations, ...). This is also why @plansor only resorts to @tensor in the Bosonic case, and not in the Fermionic one.

@lkdvos lkdvos force-pushed the ld-indexmanipulations branch from 26c844a to 35f4d65 Compare May 30, 2026 18:20
Base automatically changed from ld-indexmanipulations to main May 30, 2026 19:36
@lkdvos lkdvos force-pushed the ld-indexmanipulations-docs branch from ff8cf8e to ea24798 Compare May 30, 2026 19:54
@lkdvos lkdvos marked this pull request as ready for review May 30, 2026 19:54
@lkdvos lkdvos requested a review from Jutho May 30, 2026 19:54
Comment thread docs/src/man/indexmanipulations.md Outdated
Comment thread docs/src/man/indexmanipulations.md
@lkdvos lkdvos force-pushed the ld-indexmanipulations-docs branch from ea24798 to 0b0cb9a Compare June 1, 2026 14:10
Comment thread docs/src/man/contractions.md Outdated
Comment thread docs/src/man/contractions.md Outdated
Comment thread docs/src/man/contractions.md Outdated
@borisdevos
Copy link
Copy Markdown
Member

Can I also go through this if that's alright? I can make time for this tomorrow!

@lkdvos lkdvos force-pushed the ld-indexmanipulations-docs branch from cdd9a7d to 508a0ef Compare June 1, 2026 15:28
@lkdvos
Copy link
Copy Markdown
Member Author

lkdvos commented Jun 1, 2026

Sure, I can leave this open if you like. I still have some typos etc that I'd like to push this evening, otherwise for me it would be easiest if you just apply your suggestions tomorrow (or the day after 🤷) and merge.

Comment thread docs/src/man/linearalgebra.md Outdated

`AbstractTensorMap` instances `t` represent linear maps, i.e. homomorphisms in a `𝕜`-linear category, just like matrices.
To a large extent, they follow the interface of `Matrix` in Julia's `LinearAlgebra` standard library.
Many methods from `LinearAlgebra` are (re)exported by TensorKit.jl, and can then us be used without `using LinearAlgebra` explicitly.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Many methods from `LinearAlgebra` are (re)exported by TensorKit.jl, and can then us be used without `using LinearAlgebra` explicitly.
Many methods from `LinearAlgebra` are (re)exported by TensorKit.jl, and can thus be used without `using LinearAlgebra` explicitly.

Comment thread docs/src/man/linearalgebra.md Outdated
The tensor product of two `TensorMap` instances `t1` and `t2` is obtained as `t1 ⊗ t2` and results in a new `TensorMap` with `codomain(t1 ⊗ t2) = codomain(t1) ⊗ codomain(t2)` and `domain(t1 ⊗ t2) = domain(t1) ⊗ domain(t2)`.
If we have two `TensorMap{T, S, N, 1}` instances `t1` and `t2` with the same codomain, we can combine them in a way that is analogous to `hcat`, i.e. we stack them such that the new tensor `catdomain(t1, t2)` has also the same codomain, but has a domain which is `domain(t1) ⊕ domain(t2)`.
Similarly, if `t1` and `t2` are of type `TensorMap{T, S, 1, N}` and have the same domain, the operation `catcodomain(t1, t2)` results in a new tensor with the same domain and a codomain given by `codomain(t1) ⊕ codomain(t2)`, which is the analogy of `vcat`.
Note that direct sum only makes sense between `ElementarySpace` objects, i.e. there is no way to give a tensor product meaning to a direct sum of tensor product spaces.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that direct sum only makes sense between `ElementarySpace` objects, i.e. there is no way to give a tensor product meaning to a direct sum of tensor product spaces.
Note that the direct sum only makes sense between `ElementarySpace` objects, i.e. there is no way to give a tensor product meaning to a direct sum of tensor product spaces.

Comment thread docs/src/man/factorizations.md Outdated
using LinearAlgebra
```

As tensors are linear maps, they suport various kinds of factorizations.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As tensors are linear maps, they suport various kinds of factorizations.
As tensors are linear maps, they support various kinds of factorizations.

Comment thread docs/src/man/factorizations.md Outdated
Comment thread docs/src/man/contractions.md Outdated
Comment thread docs/src/man/contractions.md Outdated
Comment thread docs/src/man/contractions.md Outdated
Comment thread docs/src/man/indexmanipulations.md Outdated
Comment thread docs/src/man/indexmanipulations.md Outdated
Comment thread docs/src/man/indexmanipulations.md Outdated
lkdvos and others added 6 commits June 3, 2026 16:32
Split the consolidated tensormanipulations.md page into dedicated
indexmanipulations, contractions, factorizations, and linearalgebra
pages, and wire them into the docs navigation.
Document contraction behavior for fermionic and anyonic sectors,
including a note on @planar for Fermionic, with an accompanying
illustration.
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
@lkdvos lkdvos force-pushed the ld-indexmanipulations-docs branch from 37ecc0c to 2d58baa Compare June 3, 2026 20:32
@lkdvos
Copy link
Copy Markdown
Member Author

lkdvos commented Jun 3, 2026

If there are no further comments, happy to merge this!

@Jutho Jutho merged commit 2231953 into main Jun 4, 2026
41 of 42 checks passed
@Jutho Jutho deleted the ld-indexmanipulations-docs branch June 4, 2026 09:21
lkdvos added a commit that referenced this pull request Jun 4, 2026
@lkdvos lkdvos mentioned this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants