Closed jofrevalles closed 8 months ago
Merging #46 (f7c9a9f) into master (bd41d90) will increase coverage by
1.13%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #46 +/- ##
==========================================
+ Coverage 82.78% 83.92% +1.13%
==========================================
Files 12 12
Lines 610 653 +43
==========================================
+ Hits 505 548 +43
Misses 105 105
Impacted Files | Coverage Δ | |
---|---|---|
src/Tenet.jl | 100.00% <ø> (ø) |
|
src/Quantum/MatrixProductState.jl | 94.44% <100.00%> (+2.87%) |
:arrow_up: |
I don't understand why I have this error in the test. Why is using OMEinsum
not enough to load @ein_str
? I am using this locally and I don't have issues.
I don't understand why I have this error in the test. Why is
using OMEinsum
not enough to load@ein_str
? I am using this locally and I don't have issues.
Strange error. Maybe OMEinsum
is not added to the test project but anyway, you should try to use contract
and svd
with Tensor
s.
I'm gonna pull the code to fix it and refactor it a lil.
Strange error. Maybe
OMEinsum
is not added to the test project but anyway, you should try to usecontract
andsvd
withTensor
s.
Can I use contract
with certain indices only?
I'm gonna pull the code to fix it and refactor it a lil.
Okay, however you prefer. I can also do it myself.
Can I use
contract
with certain indices only?
Yes! That's the 3rd argument. Pass a list or tuple of Symbol
s.
Can I use
contract
with certain indices only?Yes! That's the 3rd argument. Pass a list or tuple of
Symbol
s.
Is it supposed to work like this?
julia> A = tensors(ϕ, 3); ein"ijk,ilk->jl"(A, conj(A))
8×8 Matrix{Float64}:
1.0 -1.2878e-16 3.2034e-16 -8.75272e-17 9.60378e-17 -1.16679e-16 5.70454e-17 1.98919e-16
-1.2878e-16 1.0 -1.64091e-16 -1.1692e-16 5.85044e-16 -1.96559e-16 4.28362e-16 5.11654e-17
3.2034e-16 -1.64091e-16 1.0 -4.59832e-17 5.08813e-17 -3.10939e-16 2.33305e-16 -3.48943e-16
-8.75272e-17 -1.1692e-16 -4.59832e-17 1.0 2.93677e-18 -8.10736e-18 3.14701e-16 -2.33236e-16
9.60378e-17 5.85044e-16 5.08813e-17 2.93677e-18 1.0 -3.38649e-16 -2.1951e-16 1.2226e-16
-1.16679e-16 -1.96559e-16 -3.10939e-16 -8.10736e-18 -3.38649e-16 1.0 2.5346e-16 4.90241e-16
5.70454e-17 4.28362e-16 2.33305e-16 3.14701e-16 -2.1951e-16 2.5346e-16 1.0 9.16482e-17
1.98919e-16 5.11654e-17 -3.48943e-16 -2.33236e-16 1.2226e-16 4.90241e-16 9.16482e-17 1.0
julia> A = tensors(ϕ, 3); labels_A = labels(A); Tenet.contract(A, conj(A), (labels_A[1], labels_A[3]))
8-element Tensor{Float64, 1, Vector{Float64}}:
1.0000000000000009
0.9999999999999999
1.0000000000000002
0.9999999999999997
0.9999999999999999
0.9999999999999999
0.9999999999999993
0.9999999999999993
I would expect from conj(A)
to have different labels than A
so we can contract two selected indices and return a Matrix
.
I updated the code to use now contract
instead of OMEinsum
. The discussion on the labels
argument of the contract
function for Tensor
s is continued in Tensors/#13.
Related code moved to Qrochet.jl
.
Summary
In this PR we add the function
canonize
(fix #45), which takes aMatrixProductState{Open}
and it transforms it to the desired canonical form. This function accepts acenter
, which determines the center of orthogonality, which can be anInteger
orUnitRange
. It performssvd
to ensure that the tensors on the left and right of thecenter
are left and right canonical, respectively. It also can limit the bond dimensionchi
to the desired value for the tensors outside of thecenter
. We also added tests to ensure that it works accordingly.Example