Measuring the MPS
TenNetLib.entropy
— Methodfunction entropy(psi::MPS, bond::Int)
Compute von Neumann Entropy of a given MPS psi
at bond
.
TenNetLib.entropy
— Methodfunction entropy(psi::MPS; kwargs...)
Compute von Neumann Entropies of a given MPS psi
at all the bonds.
Optionally, for specific bonds, keyword argument bonds
can be specified, e.g., bonds = [1, 2, 3]
.
TenNetLib.measure
— Methodfunction measure(::Type{ElT} = ComplexF64, psi::MPS, opten::ITensor)
Returns (complex / real) local expectation value (::ComplexF64
/ ::Float64
) of a given MPS psi::MPS
. The operator opten::ITensor
must be single-site operator.
For ElT = Float64
, if the expectation value is complex, raises a warning!
TenNetLib.measure
— Methodfunction measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String, pos::Int)
Returns (complex / real) local expectation value (::ComplexF64
/ ::Float64
) of a given MPS psi::MPS
for a given operator name (opstr::String
) and a site index (pos::Int
)
For ElT = Float64
, if the expectation value is complex, raises a warning!
TenNetLib.measure
— Methodfunction measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String; kwargs...)
Returns (complex / real) local expectation values (::Vector{ComplexF64}
/ ::Vector{Float64}
) of a given MPS psi::MPS
for a given operator name (opstr::String
) at all the sites.
Optionally, for specific sites, keyword argument sites
can be specified, e.g., sites = [1, 2, 3]
.
For ElT = Float64
, if the expectation value is complex, raises a warning!
TenNetLib.measure
— Methodfunction measure(::Type{ElT} = ComplexF64, psi::MPS, optens::Vector{ITensor})
Returns (complex / real) multi-site expectation value (::ComplexF64
/ ::Float64
) of a given MPS psi::MPS
for a given vector of single-site operators (optens::Vector{ITensor}
).
For ElT = Float64
, if the expectation value is complex, raises a warning!
TenNetLib.measure
— Methodfunction measure(::Type{ElT} = ComplexF64, psi::MPS, oppairs::Vector{Pair{String, Int}};
isfermions::Bool = true)
Returns (complex / real) multi-site expectation value (::ComplexF64
/ ::Float64
) of a given MPS psi::MPS
. oppairs::Vector{Pair{String, Int}}
contains pairs of operator names (String
) and site locations (Int
). E.g., for <ψ|OᵢOⱼOₖ... |ψ>, oppairs = ["O" => i, "O" => j, "O" => k,...]
.
Fermionic JW strings are added automatically for fermionic operators if isfermions::Bool = true
(default).
For ElT = Float64
, if the expectation value is complex, raises a warning!
Example:
valueC = measure(psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
valueR = measure(Float64, psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])