Measuring the MPS

TenNetLib.entropyMethod
function entropy(psi::MPS, bond::Int)

Compute von Neumann entropy of a given MPS psi at bond.

Note: Since both ITensors.jl and ITensorMPS.jl export a function named entropy(), this function must be explicitly called as TenNetLib.entropy().

source
TenNetLib.entropyMethod
function entropy(psi::MPS; bonds = nothing)

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].

Note: Since both ITensors.jl and ITensorMPS.jl export a function named entropy(), this function must be explicitly called as TenNetLib.entropy().

source
TenNetLib.bond_spectrumMethod
bond_spectrum(psi::MPS, bond::Int; by_charge = false)

Compute the eigenvalue spectrum $\{ \lambda_k \}$ of the reduced density matrix obtained by cutting the MPS psi at the specified bond.

If by_charge == false, the function returns the full spectrum as a Vector{Float64}.

If by_charge == true, the spectrum is grouped into different QN sectors, and the result is returned as a Vector{Pair{QN, Vector{Float64}}}, where each pair contains a QN label and its associated eigenvalue spectrum.

source
TenNetLib.bond_spectrumMethod
bond_spectrum(psi::MPS; bonds = nothing, by_charge = false)

Compute the eigenvalue spectra $\{ \lambda_k \}$ of the reduced density matricies obtained by cutting the MPS psi at all the bonds.

Optionally, for specific bonds, keyword argument bonds can be specified, e.g., bonds = [1, 2, 3].

Returns a vector of spectra, one for each bonds. The type depends on by_charge.

If by_charge == false, the function returns the full spectrum as a Vector{Vector{Float64}}.

If by_charge == true, the spectrum is grouped into different QN sectors, and the result is returned as a Vector{Vector{Pair{QN, Vector{Float64}}}}, where each pair contains a QN label and its associated eigenvalue spectrum.

source
TenNetLib.measureMethod
function 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!

source
TenNetLib.measureMethod
function 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!

source
TenNetLib.measureMethod
function 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!

source
TenNetLib.measureMethod
function 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!

source
TenNetLib.measureMethod
function 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])
source