-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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. |
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:
Index(::SiteType)
"just work" through a generic function(rangetype::Type{<:AbstractUnitRange}; kwargs...)(t::SiteType) = rangetype(AbstractUnitRange(t); kwargs...)
.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.Open to track elsewhere and fix in followup PRs:
"SWAP"
gates so that sites of the output get swapped properly. The current code is correct if the sites are exactly the same, but with named dimensions and site of different sizes the code isn't correct. (Tracking in [BUG] Fix"SWAP"
gates when sites aren't the same #20.)SiteType
callable, similar toOpName
andStateName
, so thatSiteType("S=1/2")()
constructs the unit rangeAbstractUnitRange(SiteType("S=1/2"))
. (Tracking in [ENHANCEMENT] Consider makingSiteType
callable #18.)Diagonal
operators are getting converted to dense with the current code design. (Tracking in [ENHANCEMENT]Diagonal
operators are being converted to dense #19.)randn(2)[Index(2)]
hits an ambiguity error. (Tracking in [BUG]randn(2)[Index(2)]
is broken ITensorBase.jl#25.)getindex(::AbstractArray, ::AbstractGradedUnitRange...)
. (Tracking in [BUG] Issues slicing dense arrays by graded unit ranges GradedUnitRanges.jl#9.)randn(2, 2)[r, dual(r)]
wherer isa AbstractGradedUnitRange
drops the dual information. (Tracking in [BUG] Issues slicing dense arrays by graded unit ranges GradedUnitRanges.jl#9.)BitArray
s to block arrays and ITensors when the axes are graded (probably will be fixed when the above issue is fixed). (Tracking in [BUG] Issues slicing dense arrays by graded unit ranges GradedUnitRanges.jl#9.)