Expectation values#
Examples can be found here.
Overlaps and MPO expectation values#
Measurement of the overlap between two MPSs is calculated by contracting a network formed by MPS and conjugate of another or the same MPS. Works also for two MPOs.
- yastn.tn.mps.measure_overlap(bra, ket) number [source]#
Calculate overlap \(\langle \textrm{bra}|\textrm{ket} \rangle\). Conjugate of MPS
bra
is computed internally.MPSs
bra
andket
must have matching length, physical dimensions, and symmetry.- Parameters:
bra (yastn.tn.mps.MpsMpoOBC) – An MPS which will be conjugated.
ket (yastn.tn.mps.MpsMpoOBC)
While the above allows calculating the norm of MPS or MPO, a dedicated method extracts the norm through canonization. This can be more precise for norms close to zero.
Measurement of MPO’s expectation value is calculated by contracting a network formed by MPS, MPO, and a conjugate of the same or different MPS. Works also for three MPOs.
- yastn.tn.mps.measure_mpo(bra, op: MpsMpoOBC | Sequence[tuple(MpsMpoOBC, number)], ket) number [source]#
Calculate expectation value \(\langle \textrm{bra}|\textrm{op}|\textrm{ket} \rangle\).
Conjugate of MPS
bra
is computed internally. MPSsbra
,ket
, and MPOop
must have matching length, physical dimensions, and symmetry.- Parameters:
bra (yastn.tn.mps.MpsMpoOBC) – An MPS which will be conjugated.
op (yastn.tn.mps.MpsMpoOBC or Sequence[tuple(MpsMpoOBC,number)]) – Operator written as (sums of) MPO.
ket (yastn.tn.mps.MpsMpoOBC)
Shorthand notation#
The above function can be also executed by
One- and two-point expectation values#
- yastn.tn.mps.measure_1site(bra, O, ket, sites=None) dict[int, number] [source]#
Calculate expectation values \(\langle \textrm{bra}|\textrm{O}_i|\textrm{ket} \rangle\) for local operator
O
at sites i.Local operators can be provided as dictionary {site: operator}, limiting the calculation to provided sites. A list of sites can also be provided.
Conjugate of MPS
bra
is computed internally.- Parameters:
bra (yastn.tn.mps.MpsMpoOBC) – An MPS which will be conjugated.
O (yastn.Tensor or dict) – An operator with signature (1, -1). It is possible to provide a dictionary {site: operator} with all operators of the same charge.
ket (yastn.tn.mps.MpsMpoOBC)
sites (int | Sequence[int] | None) – Which 1-sites observables to calculate. For a single site, int, return float; otherwise return dict[site, float] The default is None, in which case the calculation is done for all sites.
- yastn.tn.mps.measure_2site(bra, O, P, ket, bonds='<') dict[tuple[int, int], float] | float [source]#
Calculate expectation values \(\langle \textrm{bra}|\textrm{O}_i \textrm{P}_j|\textrm{ket} \rangle\) of local operators
O
andP
for pairs of lattice sites \(i, j\).Conjugate of MPS
bra
is computed internally. Includes fermionic strings via swap_gate for fermionic operators.- Parameters:
bra (yastn.tn.mps.MpsMpoOBC) – An MPS which will be conjugated.
O, P (yastn.Tensor or dict) – Operators with signature (1, -1). Each can also be a dictionary {site: operator} with all operators of the same charge.
ket (yastn.tn.mps.MpsMpoOBC)
bonds (tuple[int, int] | Sequence[tuple[int, int]] | str) – Which 2-site correlators to calculate. For a single bond, tuple[int, int], return float. Otherwise, return dict[bond, float]. It is possible to provide a string to build a list of bonds as:
‘<’ for all i < j.
‘=’ for all i == j.
‘>’ for all i > j.
‘a’ for all i, j; equivalent to “<=>”.
‘rx’ for all i, i+x with OBC, e.g. “r1” for nearest-neighbours; x can be negative.
‘p’ to include PBC terms in ‘rx’.
The default is ‘<’.
Schmidt values and entropy profile#
The Schmidt values are computed by performing bipartition of the MPS/MPO across each of the bonds. This amounts to SVD decomposition with respect to a bond, where all sites to the left are in left-canonical form and all sites to the right are in right-canonical form.
- MpsMpoOBC.get_Schmidt_values() Sequence[yastn.Tensor] [source]#
Schmidt values for bipartition across all bonds along MPS/MPO from the first to the last site, including “trivial” leftmost and rightmost cuts. This gives a list with N+1 elements. Schmidt values are stored as diagonal tensors and are normalized.
The SVD is used to calculate the entropy at each bond. It allows to get quantum Renyi entropy that is defined as \(S_\alpha(\rho)=\frac{1}{1-\alpha}\log_2 Tr(\rho^\alpha)\), where \(\rho\) indicades reduced density matrix for the bipartition at the bond. For \(\alpha=1\) we get von Neumann entropy, so-called entanglement entropy, that is \(S_1(\rho)=-Tr(\rho_{j,j+1}\log_2 \rho)\). The entropy is counted in bits of entropy, i.e., using logarithm of base 2.
- MpsMpoOBC.get_entropy(alpha=1) Sequence[number] [source]#
Entropy of bipartition across each bond, along MPS/MPO from the first to the last site, including “trivial” leftmost and rightmost cuts. This gives a list with N+1 elements.
- Parameters:
alpha (int) – Order of Renyi entropy. alpha == 1 is von Neuman entropy: -Tr(a log2(a)) otherwise: 1/(1-alpha) log2(Tr(a ** alpha)) The default value is 1, which corresponds to the von Neumann entropy.