Add flux-canceling randn(sector, inds) constructors#230
Open
mtfishman wants to merge 4 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #230 +/- ##
==========================================
+ Coverage 77.88% 78.02% +0.14%
==========================================
Files 29 30 +1
Lines 1709 1734 +25
==========================================
+ Hits 1331 1353 +22
- Misses 378 381 +3
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:
|
Extend the map-shaped `(codomain, domain)` constructors to `ones` and `fill` alongside `zeros`, routing them through `TensorAlgebra.ones_map`/`fill_map`, and cover them in the `Index`-level flux-canceling forms in `ITensorBaseGradedArraysExt`.
Add the `randn(rng, axes...)`/`rand(rng, axes...)` signatures (default element type) that `Base` supports, covering the flat, split `(codomain, domain)`, and flux `(sector, ...)` forms, so the ITensorBase rng-first surface matches `Base` and the GradedArrays backend.
randn(sector, inds) constructorsrandn(sector, inds) constructors
mtfishman
marked this pull request as ready for review
July 24, 2026 20:50
mtfishman
enabled auto-merge (squash)
July 24, 2026 20:50
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
Adds flux-canceling constructors
randn/rand/zeros/ones/fill(c, codomain[, domain]) at theIndexlevel, so anITensorover graded (block-sparse) indices can be built carrying a nonzero total chargec. They mint a fresh auxiliaryIndexcarryingcand forward to the map-shaped split constructor, appending the aux to the domain dangling last so the physical indices fuse toc. The sector may be a bareTensorKitSectors.Sectoror aSectorRange. These live in a newITensorBaseGradedArraysExt, since ITensorBase does not depend on the sector types.Filling out the constructor surface these build on, this also adds the split
(codomain, domain)forms ofonesandfillto ITensorBase core (alongside the existingzeros), and letsrandn/randtake a leadingrngwithout an explicit element type (matchingBase.randn(rng, dims...)) across the flat, split, and flux forms.Builds on ITensor/GradedArrays.jl#220 and ITensor/TensorAlgebra.jl#216.