-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make better use of BlockedTuple in contract
logic to track codomain and domain
#33
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #33 +/- ##
==========================================
- Coverage 93.95% 0.00% -93.96%
==========================================
Files 15 13 -2
Lines 364 335 -29
==========================================
- Hits 342 0 -342
- Misses 22 335 +313
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It definitely would be nice to get rid of the various |
The tests do not cover this case except for the native |
There is a real difficulty here. Creating a trivial axis ex nihilo is problematic as it may not fit with other axes used in the code or with the array. In the case of
|
That seems reasonable to me, though I don't have all of the context so I don't know all of the tradeoffs between the different choices. But I would call it |
solves #22
see also ITensor/BlockSparseArrays.jl#55
This is a draft to systematically preserve domain and codomain information in
contract
. This PR makes several changes incontract
,fusedims
andsplitdims
. It preserves the current high level interface, adds new interface usingBlockedTuple
andAbstractBlockPermutation
, and rewrite internals using theseAbstractBlockTuple
types.I tried to relax
BlockedPermutation
toAbstractBlockPermutation
wherever I could. We may consider more lax signatures usingBlockedTuple{Parameters}
.In the details:
contract
imposesAbstractBlockPermutation{2}
at lower levels ofcontract
. It implies that final contraction is always done between matrices, adding trailing 1 dimension if needed. In particular, it means dispatch on_mul!
to handle specific cases with 0 or 1 dim arrays are no more needed. The code is simpler, but some specificities of low dimensions are lost. This is how NumPy handlesmatmul
, so I think this should not affect performances much, although the devil is in the details and I may be wrong.fusedims
stack is written as-
splidims
is written usingBlockedTuple{AbstractUnitRange}
at its lowest level.The associated
BlockSparseArrays
PR ITensor/BlockSparseArrays.jl#55 allows tests to pass forGradedUnitRanges
axes.TBD: get rid of
_permutedims
and_permutedims
and replace them with dispatch onpermutedims(a::AbstractArray, bp::BlockedPermutation