ITensors.jl icon indicating copy to clipboard operation
ITensors.jl copied to clipboard

Generalize `inner(::MPO, ::MPS, ::MPO, ::MPS)` for arbitrary tags and prime levels

Open leburgel opened this issue 3 years ago • 2 comments

Description

Generalizes inner(::MPO, ::MPS, ::MPO, ::MPS) to no longer rely on any tag or prime level conventions. It is now only required that for inner(A::MPO, x::MPS, B::MPO, y::MPS):

  • A and x share site indices.
  • B and y share site indices.
  • A * x and B * y share site indices.

Fixes #499

How Has This Been Tested?

Extended the "inner <By|A|x>" unit test in test/mpo.jl.

Checklist:

  • [x] My code follows the style guidelines of this project. Please run using JuliaFormatter; format(".") in the base directory of the repository (~/.julia/dev/ITensors) to format your code according to our style guidelines.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have added tests that verify the behavior of the changes I made.
  • [ ] I have made corresponding changes to the documentation.
  • [ ] My changes generate no new warnings.
  • [ ] Any dependent changes have been merged and published in downstream modules.

leburgel avatar Oct 07 '22 21:10 leburgel

Thanks! Once tests pass I'll merge this.

mtfishman avatar Oct 13 '22 17:10 mtfishman

Codecov Report

Merging #995 (888afcf) into main (8fc77d1) will decrease coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head 888afcf differs from pull request most recent head 42132c7. Consider uploading reports for the commit 42132c7 to get more accurate results

@@            Coverage Diff             @@
##             main     #995      +/-   ##
==========================================
- Coverage   64.90%   64.90%   -0.01%     
==========================================
  Files          97       97              
  Lines       10173    10169       -4     
==========================================
- Hits         6603     6600       -3     
+ Misses       3570     3569       -1     
Impacted Files Coverage Δ
src/mps/mpo.jl 84.71% <100.00%> (-0.12%) :arrow_down:
src/ITensorChainRules/ITensorChainRules.jl 84.61% <0.00%> (-7.70%) :arrow_down:
src/tensor_operations/matrix_algebra.jl 93.02% <0.00%> (-2.33%) :arrow_down:
src/physics/lattices.jl 95.65% <0.00%> (-2.18%) :arrow_down:
src/mps/sweeps.jl 90.69% <0.00%> (-1.17%) :arrow_down:
src/tagset.jl 86.95% <0.00%> (-1.09%) :arrow_down:
src/ITensorChainRules/mps/abstractmps.jl 88.17% <0.00%> (-1.08%) :arrow_down:
src/qn/qn.jl 88.51% <0.00%> (-0.86%) :arrow_down:
src/LazyApply/LazyApply.jl 80.10% <0.00%> (-0.52%) :arrow_down:
src/physics/sitetype.jl 90.78% <0.00%> (-0.44%) :arrow_down:
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Oct 13 '22 18:10 codecov-commenter