Skip to content

Allow custom axes when constructing operators, SymmetrySectors.jl and ITensorBase.jl extensions #17

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

Merged
merged 12 commits into from
Feb 1, 2025

Conversation

mtfishman
Copy link
Member

@mtfishman mtfishman commented Jan 30, 2025

This enables passing custom axes when constructing operators.

It also adds an ITensor extension for constructing ITensors when Index objects are passed as the axes.

This also adds an interface for specifying and customizing symmetries of axes/Index objects, similar to this old proposal: ITensor/ITensors.jl#522.

To-do:

  • Add tests.
  • Try to make Index(::SiteType) "just work" through a generic function (rangetype::Type{<:AbstractUnitRange}; kwargs...)(t::SiteType) = rangetype(AbstractUnitRange(t); kwargs...).
  • Decide if multi-site operators like op("SWAP") should output n-dimensional arrays or matrices, this PR changes the behavior so that it reshapes to n-dimensional arrays, which is a bit annoying for dense arrays but makes sense for block sparse/symmetric tensors since reshaping is much less trivial in those cases.
  • Look into how things work constructing ITensors for multi-site operators. Does the memory ordering match what is expected? The site indices may be reverse of what we want, since it is based on Julia's memory ordering convention.

Open to track elsewhere and fix in followup PRs:

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 71.20000% with 36 lines in your changes missing coverage. Please review.

Project coverage is 68.65%. Comparing base (3df5640) to head (b36566f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...xt/QuantumOperatorDefinitionsSymmetrySectorsExt.jl 52.63% 18 Missing ⚠️
src/sitetype.jl 60.52% 15 Missing ⚠️
src/state.jl 71.42% 2 Missing ⚠️
src/op.jl 96.77% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #17       +/-   ##
===========================================
+ Coverage   28.20%   68.65%   +40.45%     
===========================================
  Files          11       13        +2     
  Lines         429      536      +107     
===========================================
+ Hits          121      368      +247     
+ Misses        308      168      -140     
Flag Coverage Δ
docs 28.62% <31.96%> (+0.42%) ⬆️

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.

@mtfishman mtfishman changed the title [WIP] Allow custom axes when constructing operators, ITensor extension Allow custom axes when constructing operators, ITensor extension Feb 1, 2025
@mtfishman mtfishman marked this pull request as ready for review February 1, 2025 00:07
@mtfishman
Copy link
Member Author

There are a number of open issues to resolve that I came across while working on this, mostly related to the interaction of BlockSparseArrays.jl, GradedUnitRanges.jl, and NamedDimsArrays.jl/ITensorBase.jl (so they need to be fixed in those packages), which are listed above and I raised issues in appropriate places for them. This PR already makes a lot of progress towards constructing abelian symmetric states and operators as ITensors, so I will merge this and work on those in followup PRs.

@mtfishman mtfishman changed the title Allow custom axes when constructing operators, ITensor extension Allow custom axes when constructing operators, SymmetrySectors.jl and ITensorBase.jl extensions Feb 1, 2025
@mtfishman mtfishman merged commit e08b46e into main Feb 1, 2025
12 checks passed
@mtfishman mtfishman deleted the custom_axes branch February 1, 2025 02:03
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