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

[ENH] define SectorUnitRange #8

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ogauthe
Copy link
Collaborator

@ogauthe ogauthe commented Jan 29, 2025

This is a work in progress for a new design of GradedUnitRanges.

We are not satisfied with the current design as we want to enforce length(g::GradedUnitRange) == quantum_dimension(g). Consequently, we cannot use the generic LabelledUnitRange - and more generally the LabelledNumbers.jl interface - as the range of a single block.

The new design we settled on pushes more information at the level of the block, and the resulting GradedUnitRange is mostly a mortar of these block unit ranges. We want to use this new type to index arrays that would have an explicit Kronecker product structure and would like our axes to share this Kronecker product structure. However, most array types, including BlockSparseArray, impose AbstractUnitRange as axes. Therefore we cannot use a generic KroneckerProduct{A,B} <: AbstractKroneckerProduct as axis type because it cannot be a AbstractUnitRange.

In this PR, I define a custom SectorUnitRange <: AbstractUnitRange type to index a single sector, while preserving the BlockArrays.jl interface. I use it as the building block for a new design of graded axis currently named NewGradedUnitRange <: AbstractGradedUnitRange. The implementation and structure fields may change, however a large part of the new behavior is already made explicit in the tests.

Todo:

  • check if integration with BlockSparseArray is possible
  • define an explicit KroneckerProduct type and replace getindex(g, ::Tuple{Colon,Any}) with getindex(g, ::KroneckerProduct(Colon,Any)
  • deal with offsets in a NewGradedUnitRange
  • define tensor_product interface for NewGradedUnitRange
  • remove the old types GradedUnitRange, GradedOneTo, GradedUnitRangeDual, LabelledUnitRangeDual

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 0% with 83 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (a645bd9) to head (9281c04).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/sectorunitrange.jl 0.00% 42 Missing ⚠️
src/newgradedunitrange.jl 0.00% 41 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (a645bd9) and HEAD (9281c04). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (a645bd9) HEAD (9281c04)
6 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #8       +/-   ##
==========================================
- Coverage   76.84%   0.00%   -76.85%     
==========================================
  Files           8       9        +1     
  Lines         380     457       +77     
==========================================
- Hits          292       0      -292     
- Misses         88     457      +369     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant