State tensors

State tensors are full-rank tensorial objects for describing tensors of a many-body system, e.g., wavefunctions for lattice systems.

Vectors

Initiating a state vector

There are many ways to initialise a state. For variational methods, a popular choice is to initiate it randomly, which can be achieved using randomsv(dim, length) for physical dimension dim and length lattice sites.

TeNe.randomsvMethod
randomsv(dim::Int, length::Int)
randomstatevector(dim::Int, length::Int)

Create a random state vector with dimensions dim, size length.

Optional Keyword Arguments

- `T::Type=ComplexF64`: The element type for the tensors.
source

Alternatively, you can initalise it as a mean field state.

TeNe.productsvMethod
productsv(dim::Int, A::AbstractVector)
productstatevector(dim::Int, A::AbstractVector)

Create a product state vector with length length and local state A.

Optional Keyword Arguments

- `T::Type=ComplexF64`: The element type for the tensors.
source

Similarly, you can do this using the LatticeTypes feature. For example, initalise a lattice for Qubits, lt = Qubits() and then use ψ = productsv(lt, ["up" for _ = 1:6]).

TeNe.productsvMethod
productsv(lt::LatticeTypes, states::AbstractVector{String})
productstatevector(lt::LatticeTypes, states::AbstractVector{String})

Create a product state from a string of state names.

Example

julia> lt = Qubits();
julia> ψ = productsv(lt, ["up" for _ = 1:6]);
source

Properties of state vectors

TeNe.dimMethod
dim(ψ::GStateTensor, [which::Int, site::Int])

Return the physical dimension of a StateTensor. The axis can be specified using which, and furthermore the site. Returns 0 for heterogeneous systems.

source
TeNe.entropyMethod
entropy(ψ::StateVector, site::Int)

Calcualte the bipartition entanglement entropy between sites site and site+1 for a StateVector ψ.

source
TeNe.entropyMethod
entropy(ψ::StateVector, sites)

Calcualte the bipartition entanglement entropy between two partitions, one with sites and the other with the remaining sites for StateVector ψ.

source

Manipulations of state vectors

Normalization

Exponentiation

Base.expMethod
exp(O::StateOperator; kwargs...)

Exponentiate a StateOperator.

Optional Keyword Arguments

- `prefactor=1.0`: Multiply the StateOperator by some value before the exponetiation.
source

Inner products

TeNe.innerMethod
inner(ψ::StateVector, ϕ::StateVector)
dot(ψ::StateVector, ϕ::StateVector)
*(ψ::StateVector, ϕ::StateVector)

Calculate the inner product of two StateVectors ψ and ϕ.

source

Sampling a state vector

TeNe.sampleMethod
sample(ψ::MPS)

Sample the StateVector ψ with the interpretation that it is a wavefunction (or Born ansatz).

source

Operators

Operators, such as the Hamiltonian of a quantum many-body system, or more generally a matrix can be represented by a StateOperator.

Initiating an operator

Like a StateVector, we can initalise a StateOperator randomly or as a product state.

TeNe.randomsoFunction
randomso(dim::Int, length::Int; kwargs...)
randomstateoperator(dim::Int, length::Int; kwargs...)

Create a state operator with physical dimensions dim and length sites.

Optional Keyword Arguments

- `T::Type=ComplexF64`: The element type for the tensor.

Examples

julia> O = randomso(2, 10);
source
TeNe.productsoMethod
productso(N::Int, A::AbstractMatrix; kwargs...)
productstateoperator(N::Int, A::AbstractMatrix; kwargs...)

Create a state operator as a product state with size N, and composed of array A.

Optional Keyword Arguments

- `T::Type=ComplexF64`: The element type for the tensor.

Examples

julia> O = productso(10, [1 0; 0 1]);
source

Construct an operator from a list

We can also use the LatticeTypes interface to initalise as a product of a string of operators...

TeNe.StateOperatorMethod
StateOperator(ops::OpList)

Create a StateOperator from an OpList.

Examples

julia> lt = Qubits();
julia> H = OpList(lt, 10);
julia> for i = 1:10 add!(H, "x", i) end;
julia> for i = 1:9 add!(H, ["z", "z"], [i, i+1]) end;
julia> H = StateOperator(H);
source

Products

A StateVector or a StateOperator can be multiplied by a StateOperator.

TeNe.applysoFunction
applyso(O::StateOperator, ψ::StateVector)
applyso(ψ::StateVector, O::StateOperator)
*(O::StateOperator, ψ::StateVector)
*(ψ::StateVector, O::StateOperator)

Multiply the StateOperator O to the StateVector ψ.

Examples

julia> O = productso(10, [0 1; 1 0]);
julia> ψ = productsv(10, [1, 0]);
julia> ϕ = O * ψ;
source
applyso(O1::StateOperator, O2::StateOperator)

Calculate the product of two StateOperators, O1 and O2.

Examples

julia> O1 = productso(10, [0 1; 1 0]);
julia> O2 = productso(10, [0 1im; -1im 0]);
julia> O = O1 * O2;
source

This can be done in-place, either so store the result in an existing StateVector ϕ, or to replace ψ. In the case of a StateOperator-StateOperator multiplication, the StateOperator for the result must be specified.

TeNe.applyso!Function
applyso!(ϕ::StateVector, O::StateOperator, ψ::StateVector)
applyso!(ϕ::StateVector, ψ::StateVector, O::StateOperator)

Multiply the StateOperator O to the StateVector ψ, and store the result in ϕ.

Examples

julia> O = productso(10, [0 1; 1 0]);
julia> ψ = productsv(10, [1, 0]);
julia> ϕ = StateVector(2, 10);
julia> applyso!(ϕ, O, ψ);
source
applyso!(O::StateOperator, O1::StateOperator, O2::StateOperator)

Calculate the product of two StateOperators, O1 and O2. Store the result in StateOperator O.

Examples

julia> O1 = productso(10, [0 1; 1 0]);
julia> O2 = productso(10, [0 1im; -1im 0]);
julia> O = StateOperator(2, 10);
julia> applyso!(O, O1, O2);
source

The expectation value of operators (or a string of operators) can be calculated in the following way.

TeNe.innerMethod
inner(ψ::StateVector, O::StateOperator, ϕ::StateVector)
inner(ψ::StateVector, O1::StateOperator, O2::MPO, ϕ::StateVector)

Calculate the expectation of a string of StateOperators Os with respect to StateVectors ψ and ϕ.

Examples

julia> ψ = randomsv(2, 10);
julia> O = productso(10, [0 1; 1 0]);
julia> inner(ψ, O, O, ψ)
1.0 + 0.0im
source

The trace of an operator (or a string of operators) can be computed in the following way.

TeNe.traceMethod
trace(Os::StateOperator...)

Compute the trace of a string of StateOperators.

Examples

julia> O = productso(10, [0 1; 1 0]);
julia> trace(O, O)
1024.0 + 0.0im
source