Repository navigation
Replace SectorRange with the Sector hierarchy - #285
Merged
Merged
Conversation
Concrete sectors are now GradedArrays types carrying no dual flag, and duality moves onto OrientedSector and the axis types. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts: # Project.toml
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #285 +/- ##
==========================================
+ Coverage 83.75% 85.50% +1.75%
==========================================
Files 39 40 +1
Lines 2758 2822 +64
==========================================
+ Hits 2310 2413 +103
+ Misses 448 409 -39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Splits `SectorProduct` into positional and named concrete types, each mapping one to one onto TensorKitSectors' `ProductSector` and `NamedSector`. `TrivialSector` is equal only to itself and positional products no longer pad, so equality and hashing read a fixed notion of content instead of depending on the other operand. Adds `fU1` and `fSU2`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deletes the `==` and `isless` methods between a GradedArrays sector and a `TensorKitSectors` one, so `Sector` is the only way across. Comparing across the two libraries cannot be made to agree with `hash`, which takes a single operand and so has to read one library's notion of identity. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Drops `structureaxes1` and `dataaxes1`. The first only ever spelled `structure` the long way, since all three call sites hold a `SectorOneTo`, whose structure is an `OrientedSector` and so is its own axis. The second had no call sites at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Puts the arrow last in `SectorOneTo`, matching `GradedOneTo`, `FusedGradedOneTo` and `OrientedSector`, and collapsing six convenience constructors to four. Its two- and three-argument forms previously disagreed about what the second position meant. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Moves the `nsymbol` methods onto `TensorKitSectors.Nsymbol`, the way `TKS.Sector`, `TKS.FusionStyle` and `TKS.BraidingStyle` are already extended, so one name covers the concept. The methods still have to live here, since upstream cannot express fusion across named products with different key sets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts: # Project.toml # src/GradedArrays.jl # src/fusion.jl # test/test_exports.jl # test/test_fermionic.jl # test/test_tensoralgebra.jl
Adds `CU1` for irreps of `U(1) ⋊ C` and `SUN` for irreps of `SU(N)`, the two symmetries that previously had to come through the `TensorKitSector` escape hatch. `SUN` lives in GradedArrays with its conversions in the SUNRepresentations extension, so it can be named, built and compared without that package. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds `sector_labels`, which returns a sector's labels as a tuple, so that
display and the TensorKitSectors conversion are derived from it rather than
written per type. `SUN` becomes `SU{N}`, labelled by its Dynkin labels to
match the form SUNRepresentations stores.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`gradedrange` and `fusedgradedrange` threw on every empty vector, including ones whose key type already determines the sector. Also renames `charge_conjugate` to `dual_sector`, which says which of the two duals it takes, and moves `to_tensorkit_space` beside the builder it feeds. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A `FusedGradedOneTo` holds its sectors as TensorKitSectors sectors, the form a `GradedSpace` holds, so crossing into TensorKit hands over the stored vectors instead of rebuilding them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Keeps docstrings to the exported and `public` names, so the documented surface is the one we mean to keep stable and an internal rename is not a documented change. Internal names carry regular comments instead. The duplicate `gradedrange` and `fusedgradedrange` method pairs also collapse into one method each. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deletes four constructor methods that were unreachable or that only turned a `MethodError` into a custom one, so the method tables now say what a caller can actually pass. An oriented sector is not a specification `Sector` accepts, and `Sector()` gives the empty named product rather than branching on `isempty`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Asserts by identity that a `GradedSpace` built from a `FusedGradedOneTo` shares the axis's stored sector and dimension vectors. That aliasing is the whole reason the axis stores its sectors in TensorKitSectors form, and it was untested, so a change that quietly started copying would not have shown up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cuts comments back to what a future reader needs: what explains another library's behavior, or an invariant that is not visible locally. A lot of them had grown into walkthroughs of readable code, design justification that belongs in a PR body, and accounts of how the code used to work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Stores `SU`'s labels in `SUNIrrep{N, M}`'s own byte layout, which also makes an `SU{3}` 2 bytes rather than 24, and hands a sector's stored labels to the conversion without widening them. Display normalizes each label instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cuts the docstrings back to what a caller needs: no types or functions from outside the package's public surface, and no account of how a type is implemented. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Marks `GradedOneTo`, `sectors`, `FusedGradedMatrix` and `FusedGradedVector` public and documents them, since callers hold all four. Aqua now checks that every public name is documented. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`sectors` is not an API we want to commit to yet, so it goes back to being a comment and comes off the public list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The five copies of this comment explained why the parameter has to exist rather than what it holds, and each said it differently. They now all say it is the TensorKitSectors sector type the `Sector` corresponds to, kept for the conversion to and from TensorKit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two test files import `@test_broken` without ever calling it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A bare `Sector` is an oriented sector whose arrow is unset, so both answer `sector` and `isdual`, and that pair is their identity. `AbstractOrientedSector` gives them one place to define the range interface, comparison and fusion, replacing the `SectorOrOrientedSector` union, and lets a non-dual `OrientedSector` stand in for the sector it wraps. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The lookup tested the key's type, which reported a key spelled as another type but `isequal` to a stored one as absent. It now asks for the `isless` and `isequal` that the search actually needs and nothing more. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reading a graded axis's sectors is part of using one, so the accessor becomes API rather than an internal name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A graded contraction differs from the dense one only in sending the right factor through `twisted_matricizeop`, so it dispatches on the operand type rather than on a contraction algorithm of its own. An explicit `alg = MatricizeContract()` now runs the twist as well, where before it took the dense kernel and returned an order-dependent result for fermionic sectors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A display header now carries every type parameter but the TensorKitSectors sector type, which only aids conversion to and from TensorKit and shows as an ellipsis, and the graded axes gain a header of their own so they stop printing a module-qualified name. `Z2` prints under its exported alias, and a `FusedGradedVector` no longer ends its display with a blank line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A page listing the available symmetry sectors and a page covering graded axes, duality and the arrays built over them, plus a changelog for the 0.17 release. The README now carries a worked example in place of its placeholder. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fused arrays labelled their axis lines `Dim 1` and `Dim 2` and read them from `axes`, which shows the domain half dualized, so a matricized form contradicted the array holding it four lines above. All four displays now share one helper that reads the stored halves and pads the labels so the axes line up in a column. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The kernel named the type only in the right factor's slot, the one the fermionic twist is keyed on, which is the shape that ties with any method narrowing a different slot. Every operand that reaches it is already tensor-level, since `contractpermalign` lifts a matrix-level one to its `GradedArray` wrap and the destination is allocated graded in turn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`×` multiplied sector types positionally only, so a named fused symmetry could be built as a value but never named as a type. A `NamedTuple` of sector types now names the factors, as in `(; charge = U1) × (; spin = SU2)`, and a container is also how to spell a one-factor product. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A wrapped sector printed as the sector it wraps, or as the native product for the same symmetry, neither of which it equals, so the printed form rebuilt a different value. It now spells the wrapping call around upstream's own spelling, which also fixes `FibonacciAnyon` printing its `isunit` flag as a number. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A graded display forced its own namespace on the names it printed, so a type read as unqualified whatever the reader had in scope. The names now go through `show` against the caller's context, and the array and axis types are exported rather than `public`, since they name themselves in every graded display. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Covers the whole surface a reader meets first: the sector types and the products they build, both constructor forms for a graded array, and the array constructors other than `randn`. Drops the changelog page, which belongs to a later release than this one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It was a paragraph inside the array section, with no mention that a domain axis prints the way it was passed rather than the way `axes` returns it, nor that the conventions line up with TensorKit's. Downstream docs can link to it instead of restating it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Describes a graded array as a map between spaces rather than a tensor map, and states the domain duality as the printing convention it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Builds an array and then scales, adds, and permutes it, rather than walking through how a graded space is put together, which is what the graded arrays page is for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The wrapper exists to carry symmetries that have no GradedArrays name of their own, and those are experimental enough that pointing users at them oversells what works today. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A graded array is more limited than a general array, so saying it behaves like any other one promises more than it does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Says that sectors convert both ways and that fusion rules and the rest of the topological data come from that conversion, and that an SU sector needs SUNRepresentations loaded for any of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Cuts the sentences that narrate the example below them and rewrites the rest as plain statements. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Also points the TensorKit links at the repository's current location. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mtfishman
marked this pull request as ready for review
October 2, 2026 02:46
mtfishman
added a commit
to ITensor/ITensorBase.jl
that referenced
this pull request
Oct 2, 2026
## Summary Bumps compat to GradedArrays 0.17 (ITensor/GradedArrays.jl#285). An `Index` now prints the space it was written with, so a graded one shows its `sector => multiplicity` pairs and its arrow, and there is a new docs page on building symmetric tensors. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
Replaces
SectorRangewith aSectorhierarchy of types that carry no dual flag and are built throughSectoralone, with duality onOrientedSectorand the axis types. Also adds user interface documentation for sectors and graded arrays.